ipmininet.router package

This module defines a modular router that is able to support multiple daemons

class ipmininet.router.IPNode(name, config=<class 'ipmininet.router.config.base.NodeConfig'>, cwd='/tmp', process_manager=<class 'ipmininet.router.__router.ProcessHelper'>, use_v4=True, use_v6=True, *args, **kwargs)

Bases: mininet.node.Node

A Node which manages a set of daemons

Most of the heavy lifting for this node should happen in the associated config object.

Parameters:
  • config – The configuration generator for this node. Either a class or a tuple (class, kwargs)
  • cwd – The base directory for temporary files such as configs
  • process_manager – The class that will manage all the associated processes for this node
  • use_v4 – Whether this node has IPv4
  • use_v6 – Whether this node has IPv6
get(key, val=None)

Check for a given key in the node parameters

start()

Start the node: Configure the daemons, set the relevant sysctls, and fire up all needed processes

terminate()

Stops this node and sets back all sysctls to their old values

class ipmininet.router.Router(name, config=<class 'ipmininet.router.config.base.BasicRouterConfig'>, password='zebra', lo_addresses=(), *args, **kwargs)

Bases: ipmininet.router.__router.IPNode, ipmininet.utils.L3Router

The actual router, which manages a set of daemons

Parameters:
  • password – The password for the routing daemons vtysh access
  • lo_addresses – The list of addresses to set on the loopback interface
asn
class ipmininet.router.ProcessHelper(node, *args, **kwargs)

Bases: object

This class holds processes that are part of a given family, e.g. routing daemons. This also provides the abstraction to execute a new process, currently in a mininet namespace, but could be extended to execute in a different environment.

Parameters:node – The object to use to create subprocesses.
call(*args, **kwargs)

Call a command, wait for it to end and return its ouput.

Parameters:
  • args – the command + arguments
  • kwargs – key-val arguments, as used in subprocess.Popen
get_process(pid)

Return a given process handle in this family

Parameters:pid – a process index, as return by popen
pexec(*args, **kw)

Call a command, wait for it to terminate and save stdout, stderr and its return code

popen(*args, **kwargs)

Call a command and return a Popen handle to it.

Parameters:
  • args – the command + arguments
  • kwargs – key-val arguments, as used in subprocess.Popen
Returns:

a process index in this family

terminate()

Terminate all processes in this family