ipmininet.topologydb module

This module defines a data-store to help dealing with all (possibly) auto-allocated properties of a topology: ip addresses, router ids, …

class ipmininet.topologydb.TopologyDB(db=None, net=None, *args, **kwargs)

Bases: object

A convenience store for auto-allocated mininet properties. This is NOT to be used as IGP graph as it does not reflect the actual availability of a node in the network (as-in it is a static view of the network).

Either extract properties from a network or load a save file

Parameters:
  • db – a path towards a saved version of this class which will be loaded
  • net – an IPNet instance which will be parsed in order to extract useful properties
add_host(n)

Register an host

Parameters:n – Host instance
add_router(n)

Register an router

Parameters:n – Router instance
add_switch(n)

Register an switch

Parameters:n – Switch instance
interface(x, y)

Return the ip address of the interface of x facing y

Parameters:
  • x – the node from which we want an IP address
  • y – the node on the other side of the link
Returns:

ip_interface-like object

interface_bandwidth(x, y)

Return the bandwidth capacity of the interface on node x facing node y.

Parameters:
  • x – node name
  • y – node name
Returns:

The bandwidth of link x-y, -1 if unlimited

interfaces(x)

Return the list of interface names of node x

load(fpath)

Load a topology database

Parameters:fpath – path towards the file to load
node(x)
parse_net(net)

Stores the content of the given network

Parameters:net – IPNet instance
routerid(x)

Return the router id of a node

Parameters:x – router name
Returns:the routerid
save(fpath)

Save the topology database

Parameters:fpath – the save file name
subnet(x, y)

Return the subnet linking node x and y

Parameters:
  • x – node name
  • y – node name
Returns:

ip_network-like object