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
8d3c2859
Commit
8d3c2859
authored
15 years ago
by
Brandon Heller
Browse files
Options
Downloads
Patches
Plain Diff
Add port status change command
parent
e7c787b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mininet/cli.py
+10
-1
10 additions, 1 deletion
mininet/cli.py
mininet/net.py
+27
-0
27 additions, 0 deletions
mininet/net.py
with
37 additions
and
1 deletion
mininet/cli.py
+
10
−
1
View file @
8d3c2859
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
from
subprocess
import
call
from
subprocess
import
call
from
cmd
import
Cmd
from
cmd
import
Cmd
from
mininet.log
import
info
,
output
from
mininet.log
import
info
,
output
,
error
class
CLI
(
Cmd
):
class
CLI
(
Cmd
):
"
Simple command-line interface to talk to nodes.
"
"
Simple command-line interface to talk to nodes.
"
...
@@ -147,6 +147,15 @@ def do_dump( self, args ):
...
@@ -147,6 +147,15 @@ def do_dump( self, args ):
for
node
in
self
.
nodelist
:
for
node
in
self
.
nodelist
:
output
(
'
%s
\n
'
%
node
)
output
(
'
%s
\n
'
%
node
)
def
do_link
(
self
,
args
):
"
Bring a link up or down.
"
if
len
(
args
)
!=
3
:
error
(
'
invalid number of args: link [up down] end1 end2
\n
'
)
elif
args
[
0
]
not
in
[
'
up
'
,
'
down
'
]:
error
(
'
invalid type: link [up down] end1 end2
\n
'
)
else
:
self
.
mn
.
link
(
*
args
)
def
do_exit
(
self
,
args
):
def
do_exit
(
self
,
args
):
"
Exit
"
"
Exit
"
return
'
exited by user command
'
return
'
exited by user command
'
...
...
This diff is collapsed.
Click to expand it.
mininet/net.py
+
27
−
0
View file @
8d3c2859
...
@@ -483,6 +483,33 @@ def iperfUdp( self, udpBw='10M' ):
...
@@ -483,6 +483,33 @@ def iperfUdp( self, udpBw='10M' ):
"
Run iperf UDP test.
"
"
Run iperf UDP test.
"
return
self
.
iperf
(
l4Type
=
'
UDP
'
,
udpBw
=
udpBw
)
return
self
.
iperf
(
l4Type
=
'
UDP
'
,
udpBw
=
udpBw
)
def
link
(
self
,
type
,
src
,
dst
):
"""
Change link status.
type: string {up, down}
src: string
dst: string
"""
if
src
not
in
self
.
nameToNode
:
error
(
'
src not in network: %s
\n
'
%
src
)
elif
dst
not
in
self
.
nameToNode
:
error
(
'
dst not in network: %s
\n
'
%
dst
)
else
:
srcNode
=
self
.
nameToNode
[
src
]
dstNode
=
self
.
nameToNode
[
dst
]
srcID
=
int
(
src
[
1
:
]
)
dstID
=
int
(
dst
[
1
:
]
)
if
self
.
topo
.
port
(
srcID
,
dstID
)
is
None
:
error
(
'
src and dst not connected: %s %s
\n
'
%
(
src
,
dst
)
)
else
:
srcPort
,
dstPort
=
self
.
topo
.
port
(
srcID
,
dstID
)
srcIntf
=
srcNode
.
intfs
[
srcPort
]
dstIntf
=
dstNode
.
intfs
[
dstPort
]
result
=
srcNode
.
cmd
(
[
'
ifconfig
'
,
srcIntf
,
type
]
)
if
result
:
error
(
'
link src status change failed: %s
\n
'
%
result
)
result
=
dstNode
.
cmd
(
[
'
ifconfig
'
,
dstIntf
,
type
]
)
if
result
:
error
(
'
link dst status change failed: %s
\n
'
%
result
)
def
interact
(
self
):
def
interact
(
self
):
"
Start network and run our simple CLI.
"
"
Start network and run our simple CLI.
"
self
.
start
()
self
.
start
()
...
...
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