ipmininet.router package

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

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

Bases: mininet.node.Node, ipmininet.utils.L3Router

The actualy router, which manages a set of daemons

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

Parameters:
  • config – The configuration generator for this router. 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 router
  • use_v4 – Wether this router has IPv4
  • use_v6 – Wether this router has IPv6
  • password – The password for the routing daemons vtysh access
asn
get(key, val=None)

Check for a given key in the router parameters

start()

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

terminate()

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

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