p4utils.mininetlib.cli module

This module is an extension of mininet.cli. It provides a CLI interface that the user can enable using the NetworkAPI or the JSON network configuration file. If enabled, the CLI starts right after the network boot and provides useful commands.

class p4utils.mininetlib.cli.P4CLI(network_api, *args, **kwargs)[source]

Bases: mininet.cli.CLI

Client class to interact with the network once it has been created.

network_api[source]

instance of the network orchestrator.

Type:NetworkAPI
do_enable_scheduler(line='')[source]

Enables the TaskServer on a node.

Usage:

mininet> enable_scheduler [<node>] [--path <dir>]

Note

The directory where the socket file will be placed can be specified using --path <dir>.

do_p4switch_reboot(line='')[source]

Reboots a P4 switch.

Usage:

mininet> p4switch_reboot <p4switch name> [--p4src <path>] [--cmds <path>]

Note

This command also allows to specify new configuration files for the switch:

  • --p4src provides a new P4 source,
  • --cmds provides a new command file.
do_p4switch_start(line='')[source]

Starts a P4 switch.

Usage:

mininet> p4switch_start <p4switch name> [--p4src <path>] [--cmds <path>]

Note

This command also allows to specify new configuration files for the switch:

  • --p4src provides a new P4 source,
  • --cmds provides a new command file.
do_p4switch_stop(line='')[source]

Stops execution of the specified P4 switch.

Usage:

mininet> p4switch_stop <p4switch name>
do_p4switches_reboot(line='')[source]

Reboots all P4 switches with new program.

Usage:

mininet> p4switches_reboot [--p4src <path>] [--cmds <path>]

Note

This command also allows to specify the same new configuration files for all the switches:

  • --p4src provides a new P4 source,
  • --cmds provides a new command file.
do_pingset(line='')[source]

Pings between the hosts in the set.

Usage:

mininet> pingset <host1> ... <hostN>
do_printSwitches(line='')[source]

Prints the names of all switches.

Usage:

mininet> printSwitches
do_task(line='')[source]

Executes a task on the given host.

Usage:

mininet> task <node> <start> <duration> <exe> [<arg1>] ... [<argN>] [--mod <module>] [--<key1> <kwarg1>] ... [--<keyM> <kwargM>]

Note

The starting delay (specified with <start>) is taken with respect to the current time. The deafult module in which functions are looked up is p4utils.utils.traffic_utils. A different module can be specified in the command with --mod <module>.

do_test_p4(line='')[source]

Tests start stop functionalities.

Usage:

mininet> test_p4
getNode(node_name)[source]

Retrieves the requested node.

Parameters:node_name (str) – node name
Returns:requested node or None if no such object was found.
Return type:mininet.node.Node
getP4Switch(node_name)[source]

Retrieves the requested P4 Switch.

Parameters:node_name (string) – P4 switch name
Returns:requested node or None if no such object was found.
Return type:mininet.node.Node
p4utils.mininetlib.cli.exception_handler(f)[source]

Prevents exceptions from terminating the client, but still prints them.