Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mininet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olaf Bergmann
mininet
Commits
cdeaca86
Commit
cdeaca86
authored
15 years ago
by
Brandon Heller
Browse files
Options
Downloads
Patches
Plain Diff
Rename cliinfo debug level to output
parent
dfc08a86
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
bin/mn
+2
-2
2 additions, 2 deletions
bin/mn
mininet/cli.py
+7
-7
7 additions, 7 deletions
mininet/cli.py
mininet/log.py
+9
-9
9 additions, 9 deletions
mininet/log.py
mininet/net.py
+9
-9
9 additions, 9 deletions
mininet/net.py
with
27 additions
and
27 deletions
bin/mn
+
2
−
2
View file @
cdeaca86
...
...
@@ -178,10 +178,10 @@ class MininetRunner( object ):
"
Setup and validate environment.
"
# set logging verbosity
if
LEVELS
[
self
.
options
.
verbosity
]
>
LEVELS
[
'
cliinfo
'
]:
if
LEVELS
[
self
.
options
.
verbosity
]
>
LEVELS
[
'
output
'
]:
print
(
'
*** WARNING: selected verbosity level (%s) will hide CLI
'
'
output!
\n
'
'
Please restart Mininet with -v [debug, info,
cliinfo
].
'
)
'
Please restart Mininet with -v [debug, info,
output
].
'
)
lg
.
setLogLevel
(
self
.
options
.
verbosity
)
# validate environment setup
...
...
This diff is collapsed.
Click to expand it.
mininet/cli.py
+
7
−
7
View file @
cdeaca86
...
...
@@ -38,7 +38,7 @@
from
subprocess
import
call
from
cmd
import
Cmd
from
mininet.log
import
info
,
cliinfo
from
mininet.log
import
info
,
output
class
CLI
(
Cmd
):
"
Simple command-line interface to talk to nodes.
"
...
...
@@ -84,16 +84,16 @@ def do_help( self, args ):
def
do_nodes
(
self
,
args
):
"
List all nodes.
"
nodes
=
'
'
.
join
(
[
node
.
name
for
node
in
sorted
(
self
.
nodelist
)
]
)
cliinfo
(
'
available nodes are:
\n
%s
\n
'
%
nodes
)
output
(
'
available nodes are:
\n
%s
\n
'
%
nodes
)
def
do_net
(
self
,
args
):
"
List network connections.
"
for
switch
in
self
.
mn
.
switches
:
cliinfo
(
switch
.
name
,
'
<->
'
)
output
(
switch
.
name
,
'
<->
'
)
for
intf
in
switch
.
intfs
.
values
():
name
=
switch
.
connection
[
intf
][
1
]
cliinfo
(
'
%s
'
%
name
)
cliinfo
(
'
\n
'
)
output
(
'
%s
'
%
name
)
output
(
'
\n
'
)
def
do_sh
(
self
,
args
):
"
Run an external shell command
"
...
...
@@ -138,13 +138,13 @@ def do_iperfudp( self, args ):
def
do_intfs
(
self
,
args
):
"
List interfaces.
"
for
node
in
self
.
nodelist
:
cliinfo
(
'
%s: %s
\n
'
%
output
(
'
%s: %s
\n
'
%
(
node
.
name
,
'
'
.
join
(
sorted
(
node
.
intfs
.
values
()
)
)
)
)
def
do_dump
(
self
,
args
):
"
Dump node info.
"
for
node
in
self
.
nodelist
:
cliinfo
(
'
%s
\n
'
%
node
)
output
(
'
%s
\n
'
%
node
)
def
do_exit
(
self
,
args
):
"
Exit
"
...
...
This diff is collapsed.
Click to expand it.
mininet/log.py
+
9
−
9
View file @
cdeaca86
...
...
@@ -8,11 +8,11 @@
# the output of the commands they execute, plus any errors or warnings. This
# level is in between info and warning. CLI info-level commands should not be
# printed during regression tests.
CLIINFO
=
25
OUTPUT
=
25
LEVELS
=
{
'
debug
'
:
logging
.
DEBUG
,
'
info
'
:
logging
.
INFO
,
'
cliinfo
'
:
CLIINFO
,
'
output
'
:
OUTPUT
,
'
warning
'
:
logging
.
WARNING
,
'
error
'
:
logging
.
ERROR
,
'
critical
'
:
logging
.
CRITICAL
}
...
...
@@ -131,18 +131,18 @@ def setLogLevel( self, levelname=None ):
# Not sure why this is occurring - this function definitely gets called.
# See /usr/lib/python2.5/logging/__init__.py; modified from warning()
def
cliinfo
(
self
,
msg
,
*
args
,
**
kwargs
):
"""
Log
'
msg % args
'
with severity
'
CLIINFO
'
.
def
output
(
self
,
msg
,
*
args
,
**
kwargs
):
"""
Log
'
msg % args
'
with severity
'
OUTPUT
'
.
To pass exception information, use the keyword argument exc_info
with a true value, e.g.
logger.warning(
"
Houston, we have a %s
"
,
"
cli output
"
, exc_info=1)
"""
if
self
.
manager
.
disable
>=
CLIINFO
:
if
self
.
manager
.
disable
>=
OUTPUT
:
return
if
self
.
isEnabledFor
(
CLIINFO
):
self
.
_log
(
CLIINFO
,
msg
,
args
,
kwargs
)
if
self
.
isEnabledFor
(
OUTPUT
):
self
.
_log
(
OUTPUT
,
msg
,
args
,
kwargs
)
# pylint: enable-msg=E0202
...
...
@@ -170,6 +170,6 @@ def newfn( *args ):
setattr
(
newfn
,
'
__doc__
'
,
fn
.
__doc__
)
return
newfn
info
,
cliinfo
,
warn
,
error
,
debug
=
lg
.
info
,
lg
.
cliinfo
,
lg
.
warn
,
lg
.
error
,
\
lg
.
debug
=
[
makeListCompatible
(
f
)
for
f
in
lg
.
info
,
lg
.
cliinfo
,
lg
.
warn
,
info
,
output
,
warn
,
error
,
debug
=
lg
.
info
,
lg
.
output
,
lg
.
warn
,
lg
.
error
,
\
lg
.
debug
=
[
makeListCompatible
(
f
)
for
f
in
lg
.
info
,
lg
.
output
,
lg
.
warn
,
lg
.
error
,
lg
.
debug
]
This diff is collapsed.
Click to expand it.
mininet/net.py
+
9
−
9
View file @
cdeaca86
...
...
@@ -89,7 +89,7 @@
from
time
import
sleep
from
mininet.cli
import
CLI
from
mininet.log
import
info
,
error
,
debug
,
cliinfo
from
mininet.log
import
info
,
error
,
debug
,
output
from
mininet.node
import
Host
,
UserSwitch
,
KernelSwitch
,
Controller
from
mininet.node
import
ControllerParams
from
mininet.util
import
quietRun
,
fixLimits
...
...
@@ -402,9 +402,9 @@ def ping( self, hosts=None ):
ploss
=
None
if
not
hosts
:
hosts
=
self
.
hosts
cliinfo
(
'
*** Ping: testing ping reachability
\n
'
)
output
(
'
*** Ping: testing ping reachability
\n
'
)
for
node
in
hosts
:
cliinfo
(
'
%s ->
'
%
node
.
name
)
output
(
'
%s ->
'
%
node
.
name
)
for
dest
in
hosts
:
if
node
!=
dest
:
result
=
node
.
cmd
(
'
ping -c1
'
+
dest
.
IP
()
)
...
...
@@ -416,10 +416,10 @@ def ping( self, hosts=None ):
node
.
cmdPrint
(
'
route
'
)
exit
(
1
)
lost
+=
sent
-
received
cliinfo
(
(
'
%s
'
%
dest
.
name
)
if
received
else
'
X
'
)
cliinfo
(
'
\n
'
)
output
(
(
'
%s
'
%
dest
.
name
)
if
received
else
'
X
'
)
output
(
'
\n
'
)
ploss
=
100
*
lost
/
packets
cliinfo
(
"
*** Results: %i%% dropped (%d/%d lost)
\n
"
%
output
(
"
*** Results: %i%% dropped (%d/%d lost)
\n
"
%
(
ploss
,
lost
,
packets
)
)
return
ploss
...
...
@@ -456,8 +456,8 @@ def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ):
else
:
assert
len
(
hosts
)
==
2
host0
,
host1
=
hosts
cliinfo
(
'
*** Iperf: testing
'
+
l4Type
+
'
bandwidth between
'
)
cliinfo
(
"
%s and %s
\n
"
%
(
host0
.
name
,
host1
.
name
)
)
output
(
'
*** Iperf: testing
'
+
l4Type
+
'
bandwidth between
'
)
output
(
"
%s and %s
\n
"
%
(
host0
.
name
,
host1
.
name
)
)
host0
.
cmd
(
'
killall -9 iperf
'
)
iperfArgs
=
'
iperf
'
bwArgs
=
''
...
...
@@ -476,7 +476,7 @@ def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ):
result
=
[
self
.
_parseIperf
(
server
),
self
.
_parseIperf
(
client
)
]
if
l4Type
==
'
UDP
'
:
result
.
insert
(
0
,
udpBw
)
cliinfo
(
'
*** Results: %s
\n
'
%
result
)
output
(
'
*** Results: %s
\n
'
%
result
)
return
result
def
iperfUdp
(
self
,
udpBw
=
'
10M
'
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment