Skip to content

Commit c70aab0

Browse files
committed
Changed mininet.link() to mininet.configLinkStatus(src,dst,status)
Also rearranged parameters in link command to mininet> link s1 h2 up To resemble ifconfig a bit more.
1 parent fb2f652 commit c70aab0

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

mininet/cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ def do_dump( self, args ):
148148
output( '%s\n' % node )
149149

150150
def do_link( self, args ):
151-
"Bring a link up or down."
151+
"Bring link(s) between two nodes up or down."
152152
args = args.split()
153153
if len(args) != 3:
154-
error( 'invalid number of args: link [up down] end1 end2\n' )
155-
elif args[ 0 ] not in [ 'up', 'down' ]:
156-
error( 'invalid type: link [up down] end1 end2\n' )
154+
error( 'invalid number of args: link end1 end2 [up down]\n' )
155+
elif args[ 2 ] not in [ 'up', 'down' ]:
156+
error( 'invalid type: link end1 end2 [up down]\n' )
157157
else:
158-
self.mn.link( *args )
158+
self.mn.configLinkStatus( *args )
159159

160160
def do_pause( self, args ):
161161
"Temporarily bring a node down."

mininet/net.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,11 @@ def iperfUdp( self, udpBw='10M' ):
511511
"Run iperf UDP test."
512512
return self.iperf( l4Type='UDP', udpBw=udpBw )
513513

514-
def link( self, status, src, dst ):
515-
"""Change link status.
516-
status: string {up, down}
517-
src: string
518-
dst: string"""
514+
def configLinkStatus( self, src, dst, status ):
515+
"""Change status of src <-> dst links.
516+
src: node name
517+
dst: node name
518+
status: string {up, down}"""
519519
if src not in self.nameToNode:
520520
error( 'src not in network: %s\n' % src )
521521
elif dst not in self.nameToNode:

0 commit comments

Comments
 (0)