ipmininet.router.config package¶
This module holds the configuration generators for routing daemons that can be used in a router.
-
class
ipmininet.router.config.
BasicRouterConfig
(node, daemons=(), additional_daemons=(), *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.
Zebra
(*args, **kwargs)¶ Bases:
ipmininet.router.config.zebra.QuaggaDaemon
-
KILL_PATTERNS
= ('zebra',)¶
-
NAME
= 'zebra'¶
-
PRIO
= 0¶
-
STARTUP_LINE_EXTRA
= '-k'¶
-
build
()¶ Build the configuration tree for this daemon
Returns: ConfigDict-like object describing this configuration
-
has_started
()¶ Return whether this daemon has started or not
-
listening
()¶
-
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
-
is_active_interface
(itf)¶ 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, routers=(), links=(), **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
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
-
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, 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-vals to set on all routers of this AS
-
asn
¶
-
class
ipmininet.router.config.
iBGPFullMesh
(asn, 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-vals to set on all routers of this AS
-
apply
(topo)¶ Apply the Overlay properties to the given topology
-
ipmininet.router.config.
bgp_peering
(topo, a, b)¶ Register a BGP peering between two nodes
-
class
ipmininet.router.config.
RouterConfig
(node, daemons=(), sysctl=None, *args, **kwargs)¶ Bases:
object
This class manages a set of daemons, and generates the global configuration for a router
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 dictionnary of sysctl to set for this node. By default, it enables IPv4/IPv6 forwarding on all interfaces.
-
build
()¶ Build the configuration for each daemon, then write the configuration files
-
cleanup
()¶ Cleanup all temporary files for the daemons
-
compute_routerid
()¶ 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.
-
daemon
(key)¶ 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
¶
-
static
incr_last_routerid
()¶
-
register_daemon
(cls, **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
-
ipmininet.router.config.
bgp_fullmesh
(topo, routers)¶ Establish a full-mesh set of BGP peerings between routers
Parameters: routers – The set of routers peering within each other
-
ipmininet.router.config.
ebgp_session
(topo, a, b)¶ Register an eBGP peering between two nodes, and disable IGP adjacencies between them.
-
class
ipmininet.router.config.
IPTables
(node, **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
- 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
-
set_defaults
(defaults)¶ Parameters: rules – The (ordered) list of iptables rules that should be executed. 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, **kwargs)¶ Bases:
ipmininet.router.config.iptables.IPTables
The IPv6 counterpart to iptables …
Parameters: - node – The node for which we build the config
- kwargs – Pre-set options for the daemon, see defaults()
-
NAME
= 'ip6tables'¶
-
class
ipmininet.router.config.
SSHd
(node, **kwargs)¶ Bases:
ipmininet.router.config.base.Daemon
Parameters: - node – The node for which we build the config
- 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, **kwargs)¶ Bases:
ipmininet.router.config.base.Daemon
The class representing the radvd daemon, used for router advertisements
Parameters: - node – The node for which we build the config
- 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=(), 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, 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.
STATIC
(node, **kwargs)¶ Bases:
ipmininet.router.config.zebra.QuaggaDaemon
Parameters: - node – The node for which we build the config
- 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, nexthop, distance=10)¶ 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.
OpenrDaemon
(node, **kwargs)¶ Bases:
ipmininet.router.config.base.Daemon
The base class for the OpenR daemon
Parameters: - node – The node for which we build the config
- 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)¶ Update defaults to contain the defaults specific to 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
-
is_active_interface
(itf)¶ Return whether an interface is active or not for the OpenR daemon
-
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.
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
¶
Submodules¶
- ipmininet.router.config.base module
- ipmininet.router.config.bgp module
- ipmininet.router.config.iptables module
- ipmininet.router.config.openr module
- ipmininet.router.config.openrd module
- ipmininet.router.config.ospf module
- ipmininet.router.config.ospf6 module
- ipmininet.router.config.pimd module
- ipmininet.router.config.radvd module
- ipmininet.router.config.sshd module
- ipmininet.router.config.staticd module
- ipmininet.router.config.utils module
- ipmininet.router.config.zebra module