Chapter 3. Tools and Commands

This section gives an overview of helpful tools and commands.

 midonet-cli

The midonet-cli command can be run on any host which has the python-midonet-client package installed and connectivity to the MidoNet API.

 mm-dpctl

The mm-dpctl command can be run on any MidoNet Agent node to display the datapath information, such as the current flows.

Available options:

# mm-dpctl --help
      --timeout  <arg>   timeout in seconds to wait for an operation to complete
                         (default = 3)
      --help             Show help message

Subcommand: datapath - datapath operations (create, delete, list, dump)
  -a, --add  <arg>      add a new datapath
  -D, --delete  <arg>   delete a datapath
  -d, --dump  <arg>     show all the flows installed for a given datapath
  -l, --list            list all the installed datapaths
  -s, --show  <arg>     show all the information related to a given datapath
      --help            Show help message
Subcommand: interface - interface operations (add, delete)
  -a, --add  <arg>      add an interface to a datapath
  -d, --delete  <arg>   delete an interface from a datapath
      --help            Show help message

 trailing arguments:
  datapath (required)   the datapath where to create/delete a flow
Subcommand: flows - flow operations (create, delete)
      --arp               src-ip and dst-ip belong to an ARP
  -d, --datapath  <arg>   the datapath where to create/delete a flow
  -D, --delete            delete the flow
      --dst-ip  <arg>     destination IP/ARP address
      --dst-mac  <arg>    destination MAC address
      --dst-port  <arg>   transport destination port or ICMP code
  -i, --input  <arg>      input interface (adds it to datapath)
  -o, --output  <arg>     output interface (adds it to datapath)
      --proto  <arg>      IP protocol (TCP, UDP, or ICMP)
      --reply             tells whether the ARP is a reply
      --src-ip  <arg>     source IP/ARP address
      --src-mac  <arg>    source MAC address
      --src-port  <arg>   transport source port or ICMP type
      --help              Show help message

Examples:

# mm-dpctl datapath --show midonet # shows datapath and interfaces
# mm-dpctl datapath --dump midonet # dumps current flows

 mm-trace

The mm-trace command allows the MidolMan Agent to capture a particular traffic flow and to log each stage of the simulation.

It’s settings are not persistent across MidolMan restarts.

Outputs are written to the /var/log/midolman/mm-trace.log file.

Available options:

$ mm-trace --help
  -h, --host  <arg>   Host (default = localhost)
  -p, --port  <arg>   JMX port (default = 7200)
      --help          Show help message

Subcommand: add - add a packet tracing match
  -d, --debug                logs at debug level
      --dst-port  <arg>      match on TCP/UDP destination port
      --ethertype  <arg>     match on ethertype
      --ip-dst  <arg>        match on ip destination address
      --ip-protocol  <arg>   match on ip protocol field
      --ip-src  <arg>        match on ip source address
  -l, --limit  <arg>         number of packets to match before disabling this trace
      --mac-dst  <arg>       match on destination MAC address
      --mac-src  <arg>       match on source MAC address
      --src-port  <arg>      match on TCP/UDP source port
  -t, --trace                logs at trace level
      --help                 Show help message
Subcommand: remove - remove a packet tracing match
  -d, --debug                logs at debug level
      --dst-port  <arg>      match on TCP/UDP destination port
      --ethertype  <arg>     match on ethertype
      --ip-dst  <arg>        match on ip destination address
      --ip-protocol  <arg>   match on ip protocol field
      --ip-src  <arg>        match on ip source address
  -l, --limit  <arg>         number of packets to match before disabling this trace
      --mac-dst  <arg>       match on destination MAC address
      --mac-src  <arg>       match on source MAC address
      --src-port  <arg>      match on TCP/UDP source port
  -t, --trace                logs at trace level
      --help                 Show help message
Subcommand: flush - clear the list of tracing matches
  -D, --dead-only   flush expired tracers only
      --help        Show help message
Subcommand: list - list all active tracing matches
  -L, --live-only   list active tracers only
      --help        Show help message

Examples:

$ mm-trace list
$ mm-trace add --debug --ip-dst 192.0.2.1
$ mm-trace add --trace --ip-src 192.0.2.1 --dst-port 80
$ mm-trace list
tracer: --debug --ip-dst 192.0.2.1
tracer: --trace --ip-src 192.0.2.1 --dst-port 80
$ mm-trace remove --trace --ip-src 192.0.2.1 --dst-port 80
Removed 1 tracer(s)
$ mm-trace flush
Removed 1 tracer(s)

 ip

The ip command can be used to show / manipulate routing, devices, policy routing and tunnels.

See the man page for detailed information: http://linux.die.net/man/8/ip

List interfaces:

# ip link show

List namespaces:

# ip netns list

List interfaces within a namespace:

# ip netns exec namespace ip link show
Questions? Discuss on Mailing Lists or Chat.
Found an error? Report a bug.