Mininet Python API Reference Manual
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
mininet.cli.CLI Class Reference

Simple command-line interface to talk to nodes. More...

Inheritance diagram for mininet.cli.CLI:

Public Member Functions

def __init__
 Start and run interactive or batch mode CLI. More...
 
def initReadline
 Set up history if readline is available.
 
def run
 Run our cmdloop(), catching KeyboardInterrupt.
 
def emptyline
 Don't repeat last command when you hit return. More...
 
def getLocals
 Local variable bindings for py command.
 
def do_help
 Describe available CLI commands. More...
 
def do_nodes
 List all nodes. More...
 
def do_ports
 display ports and interfaces for each switch
 
def do_net
 List network connections. More...
 
def do_sh
 Run an external shell command. More...
 
def do_py
 Evaluate a Python expression. More...
 
def do_px
 Execute a Python statement. More...
 
def do_pingall
 Ping between all hosts. More...
 
def do_pingpair
 Ping between first two hosts, useful for testing. More...
 
def do_pingallfull
 Ping between all hosts, returns all ping results. More...
 
def do_pingpairfull
 Ping between first two hosts, returns all ping results. More...
 
def do_iperf
 Simple iperf TCP test between two (optionally specified) hosts. More...
 
def do_iperfudp
 Simple iperf UDP test between two (optionally specified) hosts. More...
 
def do_intfs
 List interfaces. More...
 
def do_dump
 Dump node info. More...
 
def do_link
 Bring link(s) between two nodes up or down. More...
 
def do_xterm
 Spawn xterm(s) for the given node(s). More...
 
def do_x
 Create an X11 tunnel to the given node, optionally starting a client. More...
 
def do_gterm
 Spawn gnome-terminal(s) for the given node(s). More...
 
def do_exit
 Exit.
 
def do_quit
 Exit.
 
def do_EOF
 Exit.
 
def isatty
 Is our standard input a tty?
 
def do_noecho
 Run an interactive command with echoing turned off. More...
 
def do_source
 Read commands from an input file. More...
 
def do_dpctl
 Run dpctl (or ovs-ofctl) command on all switches. More...
 
def do_time
 Measure time taken for any command in Mininet. More...
 
def do_links
 Report on links.
 
def do_switch
 Starts or stops a switch.
 
def default
 Called on an input line when the command prefix is not recognized. More...
 
def waitForNode
 Wait for a node to finish, and print its output. More...
 
def precmd
 allow for comments in the cli
 

Public Attributes

 mn
 
 locals
 
 stdin
 
 inPoller
 
 inputFile
 

Static Public Attributes

string prompt = 'mininet> '
 
 readlineInited = False
 
tuple helpStr
 

Detailed Description

Simple command-line interface to talk to nodes.

Constructor & Destructor Documentation

def mininet.cli.CLI.__init__ (   self,
  mininet,
  stdin = sys.stdin,
  script = None 
)

Start and run interactive or batch mode CLI.

Parameters
mininetMininet network object
stdinstandard input for CLI
scriptscript to run in batch mode

Member Function Documentation

def mininet.cli.CLI.default (   self,
  line 
)

Called on an input line when the command prefix is not recognized.

Overridden to run shell commands when a node is the first CLI argument. Past the first CLI argument, node names are automatically replaced with corresponding IP addrs.

def mininet.cli.CLI.do_dpctl (   self,
  line 
)

Run dpctl (or ovs-ofctl) command on all switches.

Parameters
Usagedpctl command [arg1] [arg2] ...
def mininet.cli.CLI.do_dump (   self,
  _line 
)

Dump node info.

def mininet.cli.CLI.do_gterm (   self,
  line 
)

Spawn gnome-terminal(s) for the given node(s).

Parameters
Usagegterm node1 node2 ...
def mininet.cli.CLI.do_help (   self,
  line 
)

Describe available CLI commands.

def mininet.cli.CLI.do_intfs (   self,
  _line 
)

List interfaces.

def mininet.cli.CLI.do_iperf (   self,
  line 
)

Simple iperf TCP test between two (optionally specified) hosts.

Parameters
Usageiperf node1 node2
def mininet.cli.CLI.do_iperfudp (   self,
  line 
)

Simple iperf UDP test between two (optionally specified) hosts.

Parameters
Usageiperfudp bw node1 node2
def mininet.cli.CLI.do_link (   self,
  line 
)

Bring link(s) between two nodes up or down.

Parameters
Usagelink node1 node2 [up/down]
def mininet.cli.CLI.do_net (   self,
  _line 
)

List network connections.

def mininet.cli.CLI.do_nodes (   self,
  _line 
)

List all nodes.

def mininet.cli.CLI.do_noecho (   self,
  line 
)

Run an interactive command with echoing turned off.

Parameters
Usagenoecho [cmd args]
def mininet.cli.CLI.do_pingall (   self,
  line 
)

Ping between all hosts.

def mininet.cli.CLI.do_pingallfull (   self,
  _line 
)

Ping between all hosts, returns all ping results.

def mininet.cli.CLI.do_pingpair (   self,
  _line 
)

Ping between first two hosts, useful for testing.

def mininet.cli.CLI.do_pingpairfull (   self,
  _line 
)

Ping between first two hosts, returns all ping results.

def mininet.cli.CLI.do_px (   self,
  line 
)

Execute a Python statement.

Node names may be used, e.g.: px print h1.cmd('ls')

def mininet.cli.CLI.do_py (   self,
  line 
)

Evaluate a Python expression.

Node names may be used, e.g.: py h1.cmd('ls')

def mininet.cli.CLI.do_sh (   self,
  line 
)

Run an external shell command.

Parameters
Usagesh [cmd args]
def mininet.cli.CLI.do_source (   self,
  line 
)

Read commands from an input file.

Parameters
Usagesource <file>
def mininet.cli.CLI.do_time (   self,
  line 
)

Measure time taken for any command in Mininet.

def mininet.cli.CLI.do_x (   self,
  line 
)

Create an X11 tunnel to the given node, optionally starting a client.

Parameters
Usagex node [cmd args]
def mininet.cli.CLI.do_xterm (   self,
  line,
  term = 'xterm' 
)

Spawn xterm(s) for the given node(s).

Parameters
Usagexterm node1 node2 ...
def mininet.cli.CLI.emptyline (   self)

Don't repeat last command when you hit return.

def mininet.cli.CLI.waitForNode (   self,
  node 
)

Wait for a node to finish, and print its output.

Member Data Documentation

tuple mininet.cli.CLI.helpStr
static
Initial value:
1 = (
2  'You may also send a command to a node using:\n'
3  ' <node> command {args}\n'
4  'For example:\n'
5  ' mininet> h1 ifconfig\n'
6  '\n'
7  'The interpreter automatically substitutes IP addresses\n'
8  'for node names when a node is the first arg, so commands\n'
9  'like\n'
10  ' mininet> h2 ping h3\n'
11  'should work.\n'
12  '\n'
13  'Some character-oriented interactive commands require\n'
14  'noecho:\n'
15  ' mininet> noecho h2 vi foo.py\n'
16  'However, starting up an xterm/gterm is generally better:\n'
17  ' mininet> xterm h2\n\n'
18  )

The documentation for this class was generated from the following file: