ipmininet.utils module

utils: utility functions to manipulate host, interfaces, …

class ipmininet.utils.L3Router

Bases: object

Placeholder class to identify L3 routing devices (primarely routers, but this could also be used for a device needing to participate to some routing protocol e.g. for TE purposes)

static is_l3router_intf(itf)

Returns whether an interface belongs to an L3Router (in the Mininet meaning: an intf with an associated node)

ipmininet.utils.address_pair(n, use_v4=True, use_v6=True)

Returns a tuple (ip, ip6) with ip/ip6 being one of the IPv4/IPv6 addresses of the node n

ipmininet.utils.find_node(start, node_name)
Parameters:
  • start – The starting node of the search
  • node_name – The name of the node to find
Returns:

The interface of the node connected to start with node_name as name

ipmininet.utils.get_set(d, key, default)

Attempt to return the value for the given key, otherwise intialize it

Parameters:
  • d – dict
  • default – constructor
ipmininet.utils.has_cmd(cmd)

Return whether the given executable is available on the system or not

ipmininet.utils.is_container(x)

Return whether x is a container (=iterable but not a string)

ipmininet.utils.otherIntf(intf)

“Get the interface on the other side of a link

ipmininet.utils.prefix_for_netmask(mask)

Return the prefix length associated to a given netmask. Will return garbage if the netmask is unproperly formatted!

ipmininet.utils.realIntfList(n)

Return the list of interfaces of node n excluding loopback

ipmininet.utils.require_cmd(cmd, help_str=None)

Ensures that a command is available in $PATH

Parameters:
  • cmd – the command to test
  • help_str – an optional help string to display if cmd is not found