ipmininet.iptopo module

This module defines topology class that supports adding L3 routers

class ipmininet.iptopo.IPTopo(*args, **kwargs)

Bases: mininet.topo.Topo

A topology that supports L3 routers

OVERLAYS = {'AS': <class 'ipmininet.router.config.bgp.AS'>, 'DNSZone': <class 'ipmininet.host.config.named.DNSZone'>, 'NetworkCapture': <class 'ipmininet.overlay.NetworkCapture'>, 'OSPFArea': <class 'ipmininet.router.config.ospf.OSPFArea'>, 'OpenrDomain': <class 'ipmininet.router.config.openr.OpenrDomain'>, 'Subnet': <class 'ipmininet.overlay.Subnet'>, 'iBGPFullMesh': <class 'ipmininet.router.config.bgp.iBGPFullMesh'>}
addDaemon(node: str, daemon: Union[ipmininet.router.config.base.Daemon, Type[ipmininet.router.config.base.Daemon]], default_cfg_class: Type[ipmininet.router.config.base.NodeConfig] = <class 'ipmininet.router.config.base.BasicRouterConfig'>, cfg_daemon_list='daemons', **daemon_params)

Add the daemon to the list of daemons to start on the router.

Parameters:
  • node – node name
  • daemon – daemon class
  • default_cfg_class – config class to use if there is no configuration class defined for the router yet.
  • cfg_daemon_list – name of the parameter containing the list of daemons in your config class constructor. For instance, RouterConfig uses ‘daemons’ but BasicRouterConfig uses ‘additional_daemons’.
  • daemon_params – all the parameters to give when instantiating the daemon class.
addHost(name: str, **kwargs) → ipmininet.node_description.HostDescription

Add a host to the topology

Parameters:name – the name of the node
addHub(name: str, **opts) → str

Convenience method: Add hub to graph. name: hub name opts: hub options returns: hub name

Parameters:
  • node1 – first node to link
  • node2 – second node to link
  • port1 – port of the first node (optional)
  • port2 – port of the second node (optional)
  • key – a key to identify the link (optional)
  • opts – link options (optional)
Returns:

link info key

Add several links in one go.

Parameters:
  • links – link description tuples, either only both node names or nodes names with link-specific options
  • common_opts – common link options (optional)
addOverlay(overlay: Union[ipmininet.overlay.Overlay, Type[ipmininet.overlay.Overlay]])

Add a new overlay on this topology

addRouter(name: str, routerDescription: ipmininet.node_description.RouterDescription = <class 'ipmininet.node_description.RouterDescription'>, **kwargs) → ipmininet.node_description.RouterDescription

Add a router to the topology

Parameters:name – the name of the node
“param routerDescription: the RouterDescription class to return
(optional)
addRouters(*routers, **common_opts) → List[ipmininet.node_description.RouterDescription]

Add several routers in one go.

Parameters:
  • routers – router names or tuples (each containing the router name and options only applying to this router)
  • common_opts – common router options (optional)
build(*args, **kwargs)

Override this method to build your topology.

capture_physical_interface(intfname: str, node: str)

Adds a pre-existing physical interface to the given node.

getLinkInfo(link: ipmininet.node_description.LinkDescription, key, default: Type[CT_co])

Attempt to retrieve the information for the given link/key combination. If not found, set to an instance of default and return it

getNodeInfo(n: str, key, default: Type[CT_co])

Attempt to retrieve the information for the given node/key combination. If not found, set to an instance of default and return it

hosts(sort=True) → List[ipmininet.node_description.HostDescription]

Return hosts. sort: sort hosts alphabetically returns: list of hosts

hubs(sort=True) → List[str]

Return a list of hub node names

isHub(n: str) → bool

Check whether the given node is a router

Parameters:n – node name
isNodeType(n: str, x) → bool

Return whether node n has a key x set to True

Parameters:
  • n – node name
  • x – the key to check
isRouter(n: str) → bool

Check whether the given node is a router

Parameters:n – node name
post_build(net: ipmininet.ipnet.IPNet)

A method that will be invoked once the topology has been fully built and before it is started.

Parameters:net – The freshly built (Mininet) network
routers(sort=True) → List[ipmininet.node_description.RouterDescription]

Return a list of router node names

class ipmininet.iptopo.OverlayWrapper(topo: ipmininet.iptopo.IPTopo, overlay: Type[ipmininet.overlay.Overlay])

Bases: object