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
2a554ae3
Commit
2a554ae3
authored
14 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Changed 'args' to 'line' and fixed iperfudp.
parent
caf024bc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mininet/cli.py
+27
-26
27 additions, 26 deletions
mininet/cli.py
with
27 additions
and
26 deletions
mininet/cli.py
+
27
−
26
View file @
2a554ae3
...
...
@@ -95,18 +95,18 @@ def emptyline( self ):
'
mininet> xterm h2
\n\n
'
)
def
do_help
(
self
,
args
):
def
do_help
(
self
,
line
):
"
Describe available CLI commands.
"
Cmd
.
do_help
(
self
,
args
)
if
args
is
''
:
Cmd
.
do_help
(
self
,
line
)
if
line
is
''
:
output
(
self
.
helpStr
)
def
do_nodes
(
self
,
args
):
def
do_nodes
(
self
,
line
):
"
List all nodes.
"
nodes
=
'
'
.
join
(
[
node
.
name
for
node
in
sorted
(
self
.
nodelist
)
]
)
output
(
'
available nodes are:
\n
%s
\n
'
%
nodes
)
def
do_net
(
self
,
args
):
def
do_net
(
self
,
line
):
"
List network connections.
"
for
switch
in
self
.
mn
.
switches
:
output
(
switch
.
name
,
'
<->
'
)
...
...
@@ -115,18 +115,18 @@ def do_net( self, args ):
output
(
'
%s
'
%
name
)
output
(
'
\n
'
)
def
do_sh
(
self
,
args
):
def
do_sh
(
self
,
line
):
"
Run an external shell command
"
call
(
args
,
shell
=
True
)
call
(
line
,
shell
=
True
)
# do_py() needs to catch any exception during eval()
# pylint: disable-msg=W0703
def
do_py
(
self
,
args
):
def
do_py
(
self
,
line
):
"""
Evaluate a Python expression.
Node names may be used, e.g.: h1.cmd(
'
ls
'
)
"""
try
:
result
=
eval
(
args
,
globals
(),
self
.
nodemap
)
result
=
eval
(
line
,
globals
(),
self
.
nodemap
)
if
not
result
:
return
elif
isinstance
(
result
,
str
):
...
...
@@ -138,37 +138,38 @@ def do_py( self, args ):
# pylint: enable-msg=W0703
def
do_pingall
(
self
,
args
):
def
do_pingall
(
self
,
line
):
"
Ping between all hosts.
"
self
.
mn
.
pingAll
()
def
do_pingpair
(
self
,
args
):
def
do_pingpair
(
self
,
line
):
"
Ping between first two hosts, useful for testing.
"
self
.
mn
.
pingPair
()
def
do_iperf
(
self
,
args
):
def
do_iperf
(
self
,
line
):
"
Simple iperf TCP test between two hosts.
"
self
.
mn
.
iperf
()
def
do_iperfudp
(
self
,
args
):
def
do_iperfudp
(
self
,
line
):
"
Simple iperf UDP test between two hosts.
"
args
=
line
.
split
()
udpBw
=
args
[
0
]
if
len
(
args
)
else
'
10M
'
self
.
mn
.
iperfUdp
(
udpBw
)
def
do_intfs
(
self
,
args
):
def
do_intfs
(
self
,
line
):
"
List interfaces.
"
for
node
in
self
.
nodelist
:
output
(
'
%s: %s
\n
'
%
(
node
.
name
,
'
'
.
join
(
sorted
(
node
.
intfs
.
values
()
)
)
)
)
def
do_dump
(
self
,
args
):
def
do_dump
(
self
,
line
):
"
Dump node info.
"
for
node
in
self
.
nodelist
:
output
(
'
%s
\n
'
%
node
)
def
do_link
(
self
,
args
):
def
do_link
(
self
,
line
):
"
Bring link(s) between two nodes up or down.
"
args
=
args
.
split
()
args
=
line
.
split
()
if
len
(
args
)
!=
3
:
error
(
'
invalid number of args: link end1 end2 [up down]
\n
'
)
elif
args
[
2
]
not
in
[
'
up
'
,
'
down
'
]:
...
...
@@ -176,9 +177,9 @@ def do_link( self, args ):
else
:
self
.
mn
.
configLinkStatus
(
*
args
)
def
do_xterm
(
self
,
args
,
term
=
'
xterm
'
):
def
do_xterm
(
self
,
line
,
term
=
'
xterm
'
):
"
Spawn xterm(s) for the given node(s).
"
args
=
args
.
split
()
args
=
line
.
split
()
if
not
args
:
error
(
'
usage: %s node1 node2 ...
\n
'
%
term
)
else
:
...
...
@@ -189,22 +190,22 @@ def do_xterm( self, args, term='xterm' ):
node
=
self
.
nodemap
[
arg
]
self
.
mn
.
terms
+=
makeTerms
(
[
node
],
term
=
term
)
def
do_gterm
(
self
,
args
):
def
do_gterm
(
self
,
line
):
"
Spawn gnome-terminal(s) for the given node(s).
"
self
.
do_xterm
(
args
,
term
=
'
gterm
'
)
self
.
do_xterm
(
line
,
term
=
'
gterm
'
)
def
do_exit
(
self
,
args
):
def
do_exit
(
self
,
line
):
"
Exit
"
return
'
exited by user command
'
def
do_quit
(
self
,
args
):
def
do_quit
(
self
,
line
):
"
Exit
"
return
self
.
do_exit
(
args
)
return
self
.
do_exit
(
line
)
def
do_EOF
(
self
,
args
):
def
do_EOF
(
self
,
line
):
"
Exit
"
output
(
'
\n
'
)
return
self
.
do_exit
(
args
)
return
self
.
do_exit
(
line
)
def
isatty
(
self
):
"
Is our standard input a tty?
"
...
...
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