From cac98f5fd5791cff4c52893216e2fa12540207e9 Mon Sep 17 00:00:00 2001 From: cody burkard <cody@onlab.us> Date: Fri, 10 Oct 2014 20:32:15 -0700 Subject: [PATCH] add cli usage information --- mininet/cli.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/mininet/cli.py b/mininet/cli.py index a2c6ff1c..ed605500 100644 --- a/mininet/cli.py +++ b/mininet/cli.py @@ -137,7 +137,8 @@ def do_net( self, _line ): dumpNodeConnections( self.mn.values() ) def do_sh( self, line ): - "Run an external shell command" + """Run an external shell command + Usage: sh [cmd args]""" call( line, shell=True ) # do_py() and do_px() need to catch any exception during eval()/exec() @@ -187,7 +188,8 @@ def do_pingpairfull( self, _line ): self.mn.pingPairFull() def do_iperf( self, line ): - "Simple iperf TCP test between two (optionally specified) hosts." + """Simple iperf TCP test between two (optionally specified) hosts. + Usage: iperf node1 node2""" args = line.split() if not args: self.mn.iperf() @@ -206,7 +208,8 @@ def do_iperf( self, line ): error( 'invalid number of args: iperf src dst\n' ) def do_iperfudp( self, line ): - "Simple iperf UDP test between two (optionally specified) hosts." + """Simple iperf UDP test between two (optionally specified) hosts. + Usage: iperfudp bw node1 node2""" args = line.split() if not args: self.mn.iperf( l4Type='UDP' ) @@ -238,7 +241,8 @@ def do_dump( self, _line ): output( '%s\n' % repr( node ) ) def do_link( self, line ): - "Bring link(s) between two nodes up or down." + """Bring link(s) between two nodes up or down. + Usage: link node1 node2 [up/down]""" args = line.split() if len(args) != 3: error( 'invalid number of args: link end1 end2 [up down]\n' ) @@ -248,7 +252,8 @@ def do_link( self, line ): self.mn.configLinkStatus( *args ) def do_xterm( self, line, term='xterm' ): - "Spawn xterm(s) for the given node(s)." + """Spawn xterm(s) for the given node(s). + Usage: xterm node1 node2 ...""" args = line.split() if not args: error( 'usage: %s node1 node2 ...\n' % term ) @@ -262,7 +267,8 @@ def do_xterm( self, line, term='xterm' ): def do_x( self, line ): """Create an X11 tunnel to the given node, - optionally starting a client.""" + optionally starting a client. + Usage: x node [cmd args]""" args = line.split() if not args: error( 'usage: x node [cmd args]...\n' ) @@ -272,7 +278,8 @@ def do_x( self, line ): self.mn.terms += runX11( node, cmd ) def do_gterm( self, line ): - "Spawn gnome-terminal(s) for the given node(s)." + """Spawn gnome-terminal(s) for the given node(s). + Usage: gterm node1 node2 ...""" self.do_xterm( line, term='gterm' ) def do_exit( self, _line ): @@ -293,7 +300,8 @@ def isatty( self ): return isatty( self.stdin.fileno() ) def do_noecho( self, line ): - "Run an interactive command with echoing turned off." + """Run an interactive command with echoing turned off. + Usage: noecho [cmd args]""" if self.isatty(): quietRun( 'stty -echo' ) self.default( line ) @@ -301,7 +309,8 @@ def do_noecho( self, line ): quietRun( 'stty echo' ) def do_source( self, line ): - "Read commands from an input file." + """Read commands from an input file. + Usage: source <file>""" args = line.split() if len(args) != 1: error( 'usage: source <file>\n' ) @@ -320,7 +329,8 @@ def do_source( self, line ): self.inputFile = None def do_dpctl( self, line ): - "Run dpctl (or ovs-ofctl) command on all switches." + """Run dpctl (or ovs-ofctl) command on all switches. + Usage: dpctl command [arg1] [arg2] ...""" args = line.split() if len(args) < 1: error( 'usage: dpctl command [arg1] [arg2] ...\n' ) -- GitLab