ipmininet.router.config package

This module holds the configuration generators for daemons that can be used in a router.

class ipmininet.router.config.BasicRouterConfig(node: Router, daemons: Iterable[Union[Daemon, Type[Daemon], Tuple[Union[Daemon, Type[Daemon]], Dict[KT, VT]]]] = (), additional_daemons: Iterable[Union[Daemon, Type[Daemon], Tuple[Union[Daemon, Type[Daemon]], Dict[KT, VT]]]] = (), *args, **kwargs)

Bases: ipmininet.router.config.base.RouterConfig

A basic router that will run an OSPF daemon

A simple router made of at least an OSPF daemon

Parameters:additional_daemons – Other daemons that should be used
class ipmininet.router.config.NodeConfig(node: IPNode, daemons: Iterable[Union[Daemon, Type[Daemon], Tuple[Union[Daemon, Type[Daemon]], Dict[KT, VT]]]] = (), sysctl: Optional[Dict[str, Union[str, int]]] = None, *args, **kwargs)

Bases: object

This class manages a set of daemons, and generates the global configuration for a node

Initialize our config builder

Parameters:
  • node – The node for which this object will build configurations
  • daemons – an iterable of active routing daemons for this node
  • sysctl – A dictionary of sysctl to set for this node. By default, it enables IPv4/IPv6 forwarding on all interfaces.
add_private_fs_path(loc: Sequence[Union[str, Tuple[str, str]]] = ())
build()

Build the configuration for each daemon, then write the configuration files

build_host_file(filename: str)
cleanup()

Cleanup all temporary files for the daemons

daemon(key: Union[str, Daemon, Type[Daemon]]) → ipmininet.router.config.base.Daemon

Return the Daemon object in this config for the given key

Parameters:key – the daemon name or a daemon class or instance
Returns:the Daemon object
Raises:KeyError – if not found
daemons
post_register_daemons()

Method called after all daemon classes were instantiated

register_daemon(cls: Union[Daemon, Type[Daemon], Tuple[Union[Daemon, Type[Daemon]], Dict[KT, VT]]], **daemon_opts)

Add a new daemon to this configuration

Parameters:
  • cls – Daemon class or object, or a 2-tuple (Daemon, dict)
  • daemon_opts – Options to set on the daemons
sysctl

Return an list of all sysctl to set on this node

class ipmininet.router.config.Zebra(*args, **kwargs)

Bases: ipmininet.router.config.zebra.QuaggaDaemon

KILL_PATTERNS = ('zebra',)
NAME = 'zebra'
PRIO = 0
STARTUP_LINE_EXTRA = ''
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
has_started(node_exec=None)

Return whether this daemon has started or not :param node_exec:

listening() → bool
set_defaults(defaults)
Parameters:
  • debug – the set of debug events that should be logged
  • access_lists – The set of AccessList to create, independently from the ones already included by route_maps
  • route_maps – The set of RouteMap to create
class ipmininet.router.config.OSPF(node, *args, **kwargs)

Bases: ipmininet.router.config.zebra.QuaggaDaemon

This class provides a simple configuration for an OSPF daemon. It advertizes one network per interface (the primary one), and set interfaces not facing another L3Router to passive

DEPENDS = (<class 'ipmininet.router.config.zebra.Zebra'>,)
KILL_PATTERNS = ('ospfd',)
NAME = 'ospfd'
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
static is_active_interface(itf) → bool

Return whether an interface is active or not for the OSPF daemon

set_defaults(defaults)
Parameters:
  • debug – the set of debug events that should be logged
  • dead_int – Dead interval timer
  • hello_int – Hello interval timer
  • priority – priority for the interface, used for DR election
  • redistribute – set of OSPFRedistributedRoute sources
class ipmininet.router.config.OSPF6(node, *args, **kwargs)

Bases: ipmininet.router.config.ospf.OSPF

This class provides a simple configuration for an OSPF6 daemon. It advertizes one network per interface (the primary one), and set interfaces not facing another L3Router to passive

DEAD_INT = 3
KILL_PATTERNS = ('ospf6d',)
NAME = 'ospf6d'
set_defaults(defaults)
Parameters:
  • debug – the set of debug events that should be logged
  • dead_int – Dead interval timer
  • hello_int – Hello interval timer
  • priority – priority for the interface, used for DR election
  • redistribute – set of OSPFRedistributedRoute sources
  • instance_id – the number of the attached OSPF instance
class ipmininet.router.config.OSPFArea(area: str, routers: Sequence[str] = (), links: Sequence[str] = (), **props)

Bases: ipmininet.overlay.Overlay

An overlay to group OSPF links and routers by area

Parameters:
  • area – the area for this overlay
  • routers – the set of routers for which all their interfaces belong to that area
  • links – individual links belonging to this area
apply(topo)

Apply the Overlay properties to the given topology

area
class ipmininet.router.config.BGP(node, port=179, *args, **kwargs)

Bases: ipmininet.router.config.zebra.QuaggaDaemon, ipmininet.router.config.bgp.AbstractBGP

This class provides the configuration skeletons for BGP routers.

DEPENDS = (<class 'ipmininet.router.config.zebra.Zebra'>,)
KILL_PATTERNS = ('bgpd',)
NAME = 'bgpd'
STARTUP_LINE_EXTRA

We add the port to the standard startup line

build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
build_access_list() → List[ipmininet.router.config.zebra.AccessList]

Build and return a list of access_filter :return:

build_community_list() → List[ipmininet.router.config.zebra.CommunityList]

Build and return a list of community_filter

build_prefix_list()
build_route_map(neighbors: Sequence[Peer]) → List[ipmininet.router.config.zebra.RouteMap]

Build and return a list of route map for the current node

classmethod get_config(topo: IPTopo, node: RouterDescription, **kwargs)

Returns a config object for the daemon if any

set_defaults(defaults)
Parameters:
  • debug – the set of debug events that should be logged
  • address_families – The set of AddressFamily to use
class ipmininet.router.config.AS(asn: int, routers=(), **props)

Bases: ipmininet.overlay.Overlay

An overlay class that groups routers by AS number

Parameters:
  • asn – The number for this AS
  • routers – an initial set of routers to add to this AS
  • props – key-values to set on all routers of this AS
asn
class ipmininet.router.config.iBGPFullMesh(asn: int, routers=(), **props)

Bases: ipmininet.router.config.bgp.AS

An overlay class to establish iBGP sessions in full mesh between BGP routers.

Parameters:
  • asn – The number for this AS
  • routers – an initial set of routers to add to this AS
  • props – key-values to set on all routers of this AS
apply(topo)

Apply the Overlay properties to the given topology

ipmininet.router.config.bgp_peering(topo: IPTopo, a: RouterDescription, b: RouterDescription)

Register a BGP peering between two nodes

class ipmininet.router.config.RouterConfig(node: Router, sysctl=None, *args, **kwargs)

Bases: ipmininet.router.config.base.NodeConfig

compute_routerid() → str

Computes the default router id for all daemons. If a router ids were explicitly set for some of its daemons, the router id set to the daemon with the highest priority is chosen as the global router id. Otherwise if it has IPv4 addresses, it returns the most-visible one among its router interfaces. If both conditions are wrong, it generates a unique router id.

static incr_last_routerid()
post_register_daemons()

Method called after all daemon classes were instantiated

ipmininet.router.config.bgp_fullmesh(topo, routers: Sequence[str])

Establish a full-mesh set of BGP peerings between routers

Parameters:
  • topo – The current topology
  • routers – The set of routers peering within each other
ipmininet.router.config.ebgp_session(topo: IPTopo, a: RouterDescription, b: RouterDescription, link_type: Optional[str] = None)

Register an eBGP peering between two nodes, and disable IGP adjacencies between them.

Parameters:
  • topo – The current topology
  • a – Local router
  • b – Peer router
  • link_type – Can be set to SHARE or CLIENT_PROVIDER. In this case ebgp_session will create import and export filter and set local pref based on the link type
class ipmininet.router.config.CommunityList(name: Optional[str] = None, action='permit', community: Union[int, str] = 0)

Bases: object

A zebra community-list entry

Parameters:
  • name
  • action
  • community
count = 0
ipmininet.router.config.set_rr(topo: IPTopo, rr: str, peers: Sequence[str] = ())

Set rr as route reflector for all router r

Parameters:
  • topo – The current topology
  • rr – The route reflector
  • peers – Clients of the route reflector
class ipmininet.router.config.AccessList(family, entries: Sequence[Union[ZebraList.Entry, str, ipaddress.IPv4Network, ipaddress.IPv6Network]] = (), name=None)

Bases: ipmininet.router.config.zebra.ZebraList

A zebra access-list class. It contains a set of AccessListEntry, which describes all prefix belonging or not to this ACL

Setup a new zebra-list :param name: The name of the acl, which will default to acl## where ##

is the instance number
Parameters:entries

A sequence of ZebraListEntry instance, or of ip_interface which describes which prefixes

are composing the list
Entry
prefix_name
zebra_family
class ipmininet.router.config.IPTables(node: IPNode, template_lookup: mako.lookup.TemplateLookup = <mako.lookup.TemplateLookup object>, **kwargs)

Bases: ipmininet.router.config.base.Daemon

iptables: the default Linux firewall/ACL engine for IPv4. This is currently mainly a proxy class to generate a list of static rules to pass to iptables.

As such, see man iptables and man iptables-extensions to see the various table names, commands, pre-existing chains, …

Parameters:
  • node – The node for which we build the config
  • template_lookup – The TemplateLookup object of the template directory
  • kwargs – Pre-set options for the daemon, see defaults()
NAME = 'iptables'
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
dry_run

The startup line to use to check that the daemon is well-configured

has_started(node_exec=None) → bool

Return whether this daemon has started or not :param node_exec:

set_defaults(defaults)
Parameters:rules – The (ordered) list of iptables Rules that should be executed or the list of Chain objects each containing rules. If a rule is an iterable of strings, these will be joined using a space.
startup_line

Return the corresponding startup_line for this daemon

class ipmininet.router.config.IP6Tables(node: IPNode, template_lookup: mako.lookup.TemplateLookup = <mako.lookup.TemplateLookup object>, **kwargs)

Bases: ipmininet.router.config.iptables.IPTables

The IPv6 counterpart to iptables …

Parameters:
  • node – The node for which we build the config
  • template_lookup – The TemplateLookup object of the template directory
  • kwargs – Pre-set options for the daemon, see defaults()
NAME = 'ip6tables'
class ipmininet.router.config.SSHd(node: IPNode, template_lookup: mako.lookup.TemplateLookup = <mako.lookup.TemplateLookup object>, **kwargs)

Bases: ipmininet.router.config.base.Daemon

Parameters:
  • node – The node for which we build the config
  • template_lookup – The TemplateLookup object of the template directory
  • kwargs – Pre-set options for the daemon, see defaults()
KILL_PATTERNS = ('None -D -u0',)
NAME = 'sshd'
STARTUP_LINE_BASE = 'None -D -u0'
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
dry_run

The startup line to use to check that the daemon is well-configured

set_defaults(defaults)

Update defaults to contain the defaults specific to this daemon

startup_line

Return the corresponding startup_line for this daemon

class ipmininet.router.config.RADVD(node: IPNode, template_lookup: mako.lookup.TemplateLookup = <mako.lookup.TemplateLookup object>, **kwargs)

Bases: ipmininet.router.config.base.RouterDaemon

The class representing the radvd daemon, used for router advertisements

Parameters:
  • node – The node for which we build the config
  • template_lookup – The TemplateLookup object of the template directory
  • kwargs – Pre-set options for the daemon, see defaults()
KILL_PATTERNS = ('radvd',)
NAME = 'radvd'
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
cleanup()

Cleanup the files belonging to this daemon

dry_run

The startup line to use to check that the daemon is well-configured

set_defaults(defaults)
Parameters:debuglevel – Turn on debugging information. Takes an integer between 0 and 5, where 0 completely turns off debugging, and 5 is extremely verbose. (see radvd(8) for more details)
startup_line

Return the corresponding startup_line for this daemon

class ipmininet.router.config.AdvPrefix(prefix: Sequence[Union[str, ipaddress.IPv6Network]] = (), valid_lifetime=86400, preferred_lifetime=14400)

Bases: ipmininet.router.config.utils.ConfigDict

The class representing advertised prefixes in a Router Advertisement

Parameters:
  • prefix – the list of IPv6 prefixes to advertise
  • valid_lifetime – corresponds to the AdvValidLifetime in radvd.conf(5) for this prefix
  • preferred_lifetime – corresponds to the AdvPreferredLifetime in radvd.conf(5) for this prefix
class ipmininet.router.config.AdvConnectedPrefix(valid_lifetime=86400, preferred_lifetime=14400)

Bases: ipmininet.router.config.radvd.AdvPrefix

This class forces the advertisement of all prefixes on the interface

Parameters:
  • valid_lifetime – corresponds to the AdvValidLifetime in radvd.conf(5) for this prefix
  • preferred_lifetime – corresponds to the AdvPreferredLifetime in radvd.conf(5) for this prefix
class ipmininet.router.config.AdvRDNSS(node: Union[str, ipaddress.IPv6Address], max_lifetime=25)

Bases: ipmininet.router.config.utils.ConfigDict

The class representing an advertised DNS server in a Router Advertisement

Parameters:
  • node – Either the IPv6 address of the DNS server or the node name
  • max_lifetime – corresponds to the AdvValidLifetime in radvd.conf(5) for this dns server address
class ipmininet.router.config.PIMD(node, *args, **kwargs)

Bases: ipmininet.router.config.zebra.QuaggaDaemon

This class configures a PIM daemon to responds to IGMP queries in order to setup multicast routing in the network.

DEPENDS = (<class 'ipmininet.router.config.zebra.Zebra'>,)
KILL_PATTERNS = ('pimd',)
NAME = 'pimd'
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
set_defaults(defaults)
Parameters:
  • debug – the set of debug events that should be logged
  • multicast_ssm – Enable pim ssm mode by default or not
  • multicast_igmp – Enable igmp by default or not
class ipmininet.router.config.RIPng(node: IPNode, template_lookup: mako.lookup.TemplateLookup = <mako.lookup.TemplateLookup object>, **kwargs)

Bases: ipmininet.router.config.zebra.QuaggaDaemon

This class provides a simple configuration for an RIP daemon. It advertizes one network per interface (the primary one), and set interfaces not facing another L3Router to passive

Parameters:
  • node – The node for which we build the config
  • template_lookup – The TemplateLookup object of the template directory
  • kwargs – Pre-set options for the daemon, see defaults()
DEPENDS = (<class 'ipmininet.router.config.zebra.Zebra'>,)
KILL_PATTERNS = ('ripngd',)
NAME = 'ripngd'
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
static is_active_interface(itf) → bool

Return whether an interface is active or not for the RIPng daemon

set_defaults(defaults)
Parameters:
  • debug – the set of debug events that should be logged (default: []).
  • redistribute – set of RIPngRedistributedRoute sources (default: []).
  • split_horizon – the daemon uses the split-horizon method (default: False).
  • split_horizon_with_poison – the daemon uses the split-horizon. with reversed poison method. If both split_horizon_with_poison and split_horizon are set to True, RIPng will use the split-horizon with reversed poison method (default: True).
  • update_timer – routing table timer value in second (default value:30).
  • timeout_timer – routing information timeout timer (default value:180).
  • garbage_timer – garbage collection timer (default value:120).
class ipmininet.router.config.STATIC(node: IPNode, template_lookup: mako.lookup.TemplateLookup = <mako.lookup.TemplateLookup object>, **kwargs)

Bases: ipmininet.router.config.zebra.QuaggaDaemon

Parameters:
  • node – The node for which we build the config
  • template_lookup – The TemplateLookup object of the template directory
  • kwargs – Pre-set options for the daemon, see defaults()
DEPENDS = (<class 'ipmininet.router.config.zebra.Zebra'>,)
KILL_PATTERNS = ('staticd',)
NAME = 'staticd'
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
set_defaults(defaults)
Parameters:
  • debug – the set of debug events that should be logged
  • static_routes – The set of StaticRoute to create
class ipmininet.router.config.StaticRoute(prefix: Union[str, ipaddress.IPv4Network, ipaddress.IPv6Network], nexthop: Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address], distance=1)

Bases: object

A class representing a static route

Parameters:
  • prefix – The prefix for this static route
  • nexthop – The nexthop for this prefix, one of: <IP address, interface name, null0, blackhole, reject>
  • distance – The distance metric of the route
class ipmininet.router.config.ExaBGPDaemon(node, port=179, *args, **kwargs)

Bases: ipmininet.router.config.bgp.AbstractBGP

KILL_PATTERNS = ('exabgp',)
NAME = 'exabgp'
STARTUP_LINE_EXTRA
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
cfg_filenames

Return the list of filenames in which this daemon config should be stored

dry_run

The startup line to use to check that the daemon is well-configured

env_filename
set_defaults(defaults)

Modifies the default configuration of this ExaBGP daemon

Parameters:
  • env

    a dictionary of all the environment variables that configure ExaBGP. Type “exabgp –help” to take a look on every environment variable. env.tcp.delay is set by default to 2 min as FRRouting BGPD daemon seems to reject routes if ExaBGP injects routes to early. Each environment variable is either a string or an int.

    The following environment variable are set :

    • daemon.user = ‘root’
    • daemon.drop = ‘false’
    • daemon.daemonize = ‘false’
    • daemon.pid = <default configuration folder /tmp/exabgp_<node>.pid>
    • log.level = ‘CRIT’
    • log.destination = <default configuration folder /tmp/exabgp_<node>.log>
    • log.reactor = ‘false’
    • log.processes = false’
    • log.network = ‘false’
    • api.cli = ‘false’
    • tcp.delay = 2 # waits at most 2 minutes
  • address_families – the routes to inject for both IPv4 and IPv6 unicast AFI.
  • passive – Tells to ExaBGP to not send active BGP Open messages. The daemon waits until the remote peer sends first the Open message to start the BGP session. Its default value is set to True.
startup_line

Return the corresponding startup_line for this daemon

template_filenames
class ipmininet.router.config.ExaList(lst: List[Union[str, int]])

Bases: ipmininet.router.config.exabgp.HexRepresentable

List that can be represented in a form of string for BGP routes attributes. This class is only used for string representable attribute. That is attribute already defined and known from ExaBGP. If the list is used for an hexadecimal attribute, it raises a ValueError

hex_repr() → str
Returns:The Hexadecimal representation of an BGP attribute value
val
class ipmininet.router.config.BGPRoute(network: ipmininet.router.config.exabgp.Representable, attributes: Sequence[BGPAttribute])

Bases: ipmininet.router.config.exabgp.Representable

A BGP route as represented in ExaBGP

class ipmininet.router.config.BGPAttributeFlags(optional, transitive, partial, extended)

Bases: ipmininet.router.config.exabgp.HexRepresentable

Represents the flags part of a BGP attribute (RFC 4271 section 4.3) The flags are an 8-bits integer value in the form O T P E 0 0 0 0. When :

  • bit O is set to 0: the attribute is Well-Known. If 1, it is optional
  • bit T is set to 0: the attribute is not Transitive. If 1, it is transitive
  • bit P is set to 0: the attribute is complete; If 1, partial
  • bit E is set to 0: the attribute is of length < 256 bits. If set to 1: 256 <= length < 2^{16}

The last 4 bits are unused

This class is notably used to define new attributes unknown from ExaBGP or change the flags of a already known attribute. For example, the MED value is not transitive. To make it transitive, put the transitive bit to 1.

hex_repr()
Returns:The Hexadecimal representation of an BGP attribute value
static to_hex_flags(a, b, c, d)
class ipmininet.router.config.BGPAttribute(attr_type: Union[str, int], val: Union[HexRepresentable, int, str], flags: Optional[BGPAttributeFlags] = None)

Bases: ipmininet.router.config.exabgp.Representable

A BGP attribute as represented in ExaBGP. Either the Attribute is known from ExaBGP and so the class uses its string representation. Or the attribute is not known, then the class uses its hexadecimal representation. The latter representation is also useful to modify flags of already known attributes. For example the MED value is a known attribute which is not transitive. By passing a BGPAttributeFlags object to the constructor, it is now possible to make is transitive with BGPAttributeFlags(1, 1, 0, 0) (both optional and transitive bits are set to 1)

Constructs an Attribute known from ExaBGP or an unknown attribute if flags is not None. It raises a ValueError if the initialisation of BGPAttribute fails. Either because type_attr is not an int (for an unknown attribute), or the string of type_attr is not recognised by ExaBGP (for a known attribute)

Parameters:
  • attr_type – In the case of a Known attribute, attr_type is a valid string recognised by ExaBGP. In the case of an unknown attribute, attr_type is the integer ID of the attribute. If attr_type is a string it must be a valid string recognized by ExaBGP. Valid strings are: ‘next-hop’, ‘origin’, ‘med’, ‘as-path’, ‘local-preference’, ‘atomic-aggregate’, ‘aggregator’, ‘originator-id’, ‘cluster-list’,’community’, ‘large-community’, ‘extended-community’, ‘name’, ‘aigp’
  • val – The actual value of the attribute
  • flags – If None, the BGPAttribute object contains a known attribute from ExaBGP. In this case, the representation of this attribute will be a string. If flags is an instance of BGPAttribute, the hexadecimal representation will be used
hex_repr() → str
str_repr() → str
class ipmininet.router.config.Representable

Bases: abc.ABC

String representation for ExaBGP configuration Each sub-part of any ExaBGP route must be representable and must override the default __str__ function

class ipmininet.router.config.HexRepresentable

Bases: ipmininet.router.config.exabgp.Representable

Representation of an hexadecimal value for ExaBGP.

In the case of an unknown ExaBGP attribute, the value cannot be interpreted by ExaBGP. Then it is needed to use its hexadecimal representation. This Abstract class must be implemented by any “unrepresentable” BGP attribute.

Example

Imagine you want to represent a new 64-bits attribute. All you have to do is to extend the HexRepresentable class and then create a new BGPAttribute as usual. The following code shows an example:

class LongAttr(HexRepresentable):
    _uint64_max = 18446744073709551615

    def __init__(self, my_long):
        assert 0 <= my_long < LongAttr._uint64_max
        self.val = my_long

    def hex_repr(self):
        return '{0:#0{1}X}'.format(self.val, 18)

    def __str__(self):
        return self.hex_repr()

# your new attribute
my_new_attr = BGPAttribute(42, LongAttr(2658), BGPAttributesFlags(1,1,0,0))
hex_repr() → str
Returns:The Hexadecimal representation of an BGP attribute value
class ipmininet.router.config.OpenrDaemon(node: IPNode, template_lookup: mako.lookup.TemplateLookup = <mako.lookup.TemplateLookup object>, **kwargs)

Bases: ipmininet.router.config.base.RouterDaemon

The base class for the OpenR daemon

Parameters:
  • node – The node for which we build the config
  • template_lookup – The TemplateLookup object of the template directory
  • kwargs – Pre-set options for the daemon, see defaults()
NAME = 'openr'
STARTUP_LINE_EXTRA
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
dry_run

The OpenR dryrun runs the daemon and does not shutdown the daemon. As a workaround we only show the version of the openr daemon

set_defaults(defaults)
Parameters:
  • logfile – the path to the logfile for the daemon
  • routerid – the router id for this daemon
startup_line

Return the corresponding startup_line for this daemon

class ipmininet.router.config.Openr(node, *args, **kwargs)

Bases: ipmininet.router.config.openrd.OpenrDaemon

This class provides a simple configuration for an OpenR daemon.

DEPENDS = (<class 'ipmininet.router.config.openrd.OpenrDaemon'>,)
KILL_PATTERNS = ('openr',)
NAME = 'openr'
build()

Build the configuration tree for this daemon

Returns:ConfigDict-like object describing this configuration
static is_active_interface(itf)

Return whether an interface is active or not for the OpenR daemon

logdir
set_defaults(defaults)

Updates some options of the OpenR daemon to run a network of routers in mininet. For a full list of parameters see OpenrDaemon:_defaults in openrd.py

class ipmininet.router.config.OpenrRouterConfig(node: OpenrRouter, daemons: Iterable[Union[Daemon, Type[Daemon], Tuple[Union[Daemon, Type[Daemon]], Dict[KT, VT]]]] = (), additional_daemons: Iterable[Union[Daemon, Type[Daemon], Tuple[Union[Daemon, Type[Daemon]], Dict[KT, VT]]]] = (), *args, **kwargs)

Bases: ipmininet.router.config.base.RouterConfig

A basic router that will run an OpenR daemon

A simple router made of at least an OpenR daemon

Parameters:additional_daemons – Other daemons that should be used
class ipmininet.router.config.OpenrDomain(domain, routers=(), links=(), **props)

Bases: ipmininet.overlay.Overlay

An overlay to group OpenR links and routers by domain

Parameters:
  • domain – the domain for this overlay
  • routers – the set of routers for which all their interfaces belong to that area
  • links – individual links belonging to this area
apply(topo)

Apply the Overlay properties to the given topology

domain
ipmininet.router.config.AF_INET(*args, **kwargs)

The ipv4 (unicast) address family

ipmininet.router.config.AF_INET6(*args, **kwargs)

The ipv6 (unicast) address family

class ipmininet.router.config.BorderRouterConfig(node: Router, daemons: Iterable[Union[Daemon, Type[Daemon], Tuple[Union[Daemon, Type[Daemon]], Dict[KT, VT]]]] = (), additional_daemons: Iterable[Union[Daemon, Type[Daemon], Tuple[Union[Daemon, Type[Daemon]], Dict[KT, VT]]]] = (), *args, **kwargs)

Bases: ipmininet.router.config.base.BasicRouterConfig

A router config that will run both OSPF and BGP, and redistribute all connected router into BGP.

A simple router made of at least an OSPF daemon and a BGP daemon

Parameters:additional_daemons – Other daemons that should be used
class ipmininet.router.config.Rule(*args, **kw)

Bases: object

A Simple wrapper to represent an IPTable rule

Parameters:
  • args – the rule members, which will joined by a whitespace
  • table – Specify the table in which the rule should be installed. Defaults to filter.
class ipmininet.router.config.Chain(table='filter', name='INPUT', default='DROP', rules=())

Bases: object

Chains are the hooks location for the respective tables. Tables support a limited subset of the available chains, see man iptables.

Build a chain description. For convenience, most parameters have more intuitive aliases than their one-letter CLI params.

Params table:The table on which the chain applies.
Params name:The chain name
Params default:The default verdict if nothing matches
Params rules:The ordered list of ChainRule to apply
TABLE_CHAINS = {'filter': {'FORWARD', 'INPUT', 'OUTPUT'}, 'mangle': {'FORWARD', 'INTPUT', 'OUTPUT', 'POSTROUTING', 'PREROUTING'}, 'nat': {'INTPUT', 'OUTPUT', 'POSTROUTING', 'PREROUTING'}, 'raw': {'OUTPUT', 'PREROUTING'}, 'security': {'CONNSECMARK', 'FORWARD', 'INPUT', 'OUTPUT', 'SECMARK'}}
build()
class ipmininet.router.config.ChainRule(action='DROP', **kwargs)

Bases: object

Describe one set of matching criteria and the corresponding action when embedded in a chain.

Params action:The action to perform on matching packets.
Params oif:match in the output interface (optional)
Params iif:match on the input interface (optional)
Params src:match on the source address/network (optional)
Params dst:match on the destination address/network (optional)
Params proto:match on the protocol name/number (optional)
Params match:additional matching clauses, per man iptables (optional)
Params port:match on the source or destination port number/range (optional)
Params sport:match on the source port number/range/name (optional)
Params dport:match on the destination port number/range/name (optional)
ALIASES = {'d': 'd', 'destination': 'd', 'destination_port': 'dport', 'destination_ports': 'dport', 'dport': 'dport', 'dports': 'dport', 'dst': 'd', 'i': 'i', 'iif': 'i', 'in_interface': 'i', 'in_intf': 'i', 'm': 'm', 'match': 'm', 'matching': 'm', 'o': 'o', 'oif': 'o', 'out_interface': 'o', 'out_intf': 'o', 'p': 'p', 'port': 'port', 'proto': 'p', 'protocol': 'p', 'r': 'port', 's': 's', 'source': 's', 'source_port': 'sport', 'source_ports': 'sport', 'sport': 'sport', 'sports': 'sport', 'src': 's', 't': 'port'}
build()
class ipmininet.router.config.NOT(clause)

Bases: object

Negates the match clause :param clause: The value of the match clause to negate

class ipmininet.router.config.PortClause(code, val)

Bases: ipmininet.router.config.iptables.MatchClause

class ipmininet.router.config.InterfaceClause(code, args)

Bases: ipmininet.router.config.iptables.MatchClause

class ipmininet.router.config.AddressClause(code, args)

Bases: ipmininet.router.config.iptables.MatchClause

class ipmininet.router.config.Filter(**kwargs)

Bases: ipmininet.router.config.iptables.Chain

The filter table acts as inbound, outbound, and forwarding firewall.

class ipmininet.router.config.InputFilter(**kwargs)

Bases: ipmininet.router.config.iptables.Filter

The inbound firewall.

class ipmininet.router.config.OutputFilter(**kwargs)

Bases: ipmininet.router.config.iptables.Filter

The outbound firewall.

class ipmininet.router.config.TransitFilter(**kwargs)

Bases: ipmininet.router.config.iptables.Filter

The forward firewall.

class ipmininet.router.config.Allow(**kwargs)

Bases: ipmininet.router.config.iptables.ChainRule

Shorthand for ChainRule(action=’ACCEPT’, …). Expresses a whitelisting rule.

class ipmininet.router.config.Deny(**kwargs)

Bases: ipmininet.router.config.iptables.ChainRule

Shorthand for ChainRule(action=’DROP’, …). Expresses a blacklisting rule.