IPMininet
doc
  • Installation
  • Getting started
  • Example topologies
  • Command-Line interface
  • Configuring daemons
  • Configuring IPv4 and IPv6 networks
  • Configuring a LAN
  • Emulating real network link
  • Using IPv6 Segment Routing
  • Dumping the network state
  • Developer Guide
  • IPMininet API
    • ipmininet package
      • Subpackages
      • Submodules
        • ipmininet.clean module
        • ipmininet.cli module
        • ipmininet.ipnet module
        • ipmininet.ipswitch module
        • ipmininet.iptopo module
        • ipmininet.link module
        • ipmininet.overlay module
        • ipmininet.srv6 module
        • ipmininet.topologydb module
        • ipmininet.utils module
IPMininet
  • Docs »
  • IPMininet API »
  • ipmininet package »
  • ipmininet.link module
  • Edit on GitHub

ipmininet.link module¶

Classes for interfaces and links that are IP-agnostic. This basically enhance the Intf class from Mininet, and then define sane defaults for the link classes and a new TCIntf base.

class ipmininet.link.GRETunnel(if1: ipmininet.link.IPIntf, if2: ipmininet.link.IPIntf, if1address: Union[str, ipaddress.IPv4Interface, ipaddress.IPv6Interface], if2address: Union[str, ipaddress.IPv4Interface, ipaddress.IPv6Interface], bidirectional=True)¶

Bases: object

The GRETunnel class, which enables to create a GRE Tunnel in a network linking two existing interfaces.

Currently, these tunnels only define stretched IP subnets.

The instantiation of these tunnels should happen after the network has been built and before the network has been started. You can leverage the IPTopo.post_build method to do it.

Parameters:
  • if1 – The first interface of the tunnel
  • if2 – The second interface of the tunnel
  • if1address – The ip_interface address for if1
  • if2address – The ip_interface address for if2
  • bidirectional – Whether both end of the tunnel should be established or not. GRE is stateless so there is no handshake per-say, however if one end of the tunnel is not established, the kernel will drop by default the encapsulated packets.
cleanup()¶
setup_tunnel()¶
class ipmininet.link.IPIntf(*args, **kwargs)¶

Bases: mininet.link.Intf

This class represents a node interface. It is IP-agnostic, as in its addresses attribute is a dictionary keyed by IP version, containing the list of all addresses for a given version

describe¶

Return a string describing the interface facing this one

get(key, val)¶

Check for a given key in the interface parameters

igp_area¶

Return the igp area associated to this interface

igp_metric¶

Return the igp metric associated to this interface

interface_width¶

Return the number of addresses that should be allocated to this interface, per address family

ip¶
ip6¶

Return the default IPv6 for this interface

ip6s(exclude_lls=False, exclude_lbs=True) → Generator[ipaddress.IPv6Interface, None, None]¶

Return a generator over all IPv6 assigned to this interface

Parameters:
  • exclude_lls – Whether Link-locals should be included or not
  • exclude_lbs – Whether Loopback addresses should be included or not
ips(exclude_lbs=True) → Generator[ipaddress.IPv4Interface, None, None]¶

Return a generator over all IPv4 assigned to this interface

Parameters:exclude_lbs – Whether Loopback addresses should be included or not
prefixLen¶
prefixLen6¶

Return the prefix length for the default IPv6 for this interface

setIP(ip: Union[str, ipaddress.IPv4Interface, ipaddress.IPv6Interface, Sequence[Union[str, ipaddress.IPv4Interface, ipaddress.IPv6Interface]]], prefixLen: Optional[int] = None) → Union[None, List[str], str]¶

Set one or more IP addresses, possibly from different families. This will remove previously set addresses of the affected families.

Parameters:
  • ip – either an IP string (mininet-like behavior), or an ip_interface like, or a sequence of both
  • prefixLen – the prefix length to use for all cases where the addresses is given as a string without a given prefix.
setIP6(ip: Union[str, ipaddress.IPv4Interface, ipaddress.IPv6Interface, Sequence[Union[str, ipaddress.IPv4Interface, ipaddress.IPv6Interface]]], prefixLen: Optional[int] = None) → Union[None, List[str], str]¶

Set one or more IP addresses, possibly from different families. This will remove previously set addresses of the affected families.

Parameters:
  • ip – either an IP string (mininet-like behavior), or an ip_interface like, or a sequence of both
  • prefixLen – the prefix length to use for all cases where the addresses is given as a string without a given prefix.
updateAddr() → Tuple[Optional[str], Optional[str]]¶

Return IP address and MAC address based on ifconfig.

updateIP() → Optional[str]¶

Return updated IP address based on ifconfig

updateIP6() → Optional[str]¶
updateMAC() → Optional[str]¶

Return updated MAC address based on ifconfig

class ipmininet.link.IPLink(node1: str, node2: str, intf: Type[ipmininet.link.IPIntf] = <class 'ipmininet.link.IPIntf'>, *args, **kwargs)¶

Bases: mininet.link.Link

A Link class that defaults to IPIntf

We override Link intf default to use IPIntf

class ipmininet.link.OrderedAddress(addr)¶

Bases: object

class ipmininet.link.PhysicalInterface(name: str, *args, **kw)¶

Bases: ipmininet.link.IPIntf

An interface that will wrap around an existing (physical) interface, and try to preserve its addresses. The interface must be present in the root namespace.

ipmininet.link.address_comparator(a, b)¶

Return -1, 0, 1 if a is less, equally, more visible than b. We define visibility according to IP version, address scope, address class, and address value

Next Previous

© Copyright 2019, Olivier Tilmans Revision 77d61fe8.

Built with Sphinx using a theme provided by Read the Docs.