ipmininet.router.config.zebra module

class ipmininet.router.config.zebra.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.zebra.AccessListEntry(prefix: Union[str, ipaddress.IPv4Network, ipaddress.IPv6Network], action='permit', family=None)

Bases: ipmininet.router.config.zebra.Entry

A zebra access-list entry

class ipmininet.router.config.zebra.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
class ipmininet.router.config.zebra.Entry(prefix: Union[str, ipaddress.IPv4Network, ipaddress.IPv6Network], action='permit', family=None)

Bases: object

Parameters:
  • prefix – The ip_interface prefix for that ACL entry
  • action – Whether that prefix belongs to the ACL (PERMIT) or not (DENY)
zebra_family
class ipmininet.router.config.zebra.PrefixList(family, entries: Sequence[Union[ZebraList.Entry, str, ipaddress.IPv4Network, ipaddress.IPv6Network]] = (), name=None)

Bases: ipmininet.router.config.zebra.ZebraList

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.zebra.PrefixListEntry(prefix: Union[str, ipaddress.IPv4Network, ipaddress.IPv6Network], action='permit', family=None, le=None, ge=None)

Bases: ipmininet.router.config.zebra.Entry

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

Bases: ipmininet.router.config.base.RouterDaemon

The base class for all Quagga-derived daemons

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()
STARTUP_LINE_EXTRA = ''
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:debug – the set of debug events that should be logged
startup_line

Return the corresponding startup_line for this daemon

zebra_socket

Return the path towards the zebra API socket for the given node

class ipmininet.router.config.zebra.RouteMap(family: str, name: Optional[str] = None, proto: Set[str] = (), neighbor: Optional[str] = None, direction: str = 'in')

Bases: object

A class representing a set of route maps applied to a given protocol

Parameters:
  • name – The name of the route-map, defaulting to rm##
  • proto – The set of protocols to which this route-map applies
  • neighbor – List of peers this route map is applied to
  • direction – Direction of the routemap(in, out, both)
DEFAULT_POLICY = 65535
count = 0
default_policy_set()
describe

Return the zebra description of this route map and apply it to the relevant protocols

entry(rm_entry: ipmininet.router.config.zebra.RouteMapEntry, order: Optional[int] = None)
find_entry_by_match_condition(condition: Sequence[RouteMapMatchCond])
remove_default_policy()
remove_entry(order: int)
update(rm: ipmininet.router.config.zebra.RouteMap)
class ipmininet.router.config.zebra.RouteMapEntry(family: str, match_policy='permit', match_cond: Sequence[Union[ipmininet.router.config.zebra.RouteMapMatchCond, Tuple]] = (), set_actions: Sequence[Union[ipmininet.router.config.zebra.RouteMapSetAction, Tuple]] = (), call_action: Optional[str] = None, exit_policy: Optional[str] = None)

Bases: object

Parameters:
  • match_policy – Deny or permit the actions if the route match the condition
  • match_cond – Specify one or more conditions which must be matched if the entry is to be considered further
  • set_actions – Specify one or more actions to do if there is a match
  • call_action – call to an other route map
  • exit_policy – An entry may, optionally specify an alternative exit policy if the entry matched or of (action, [acl, acl, …]) tuples that will compose the route map
append_match_cond(match_conditions)
Returns:
append_set_action(set_actions)
Parameters:set_actions
Returns:
can_merge(rm_entry)
update(rm_entry: ipmininet.router.config.zebra.RouteMapEntry)
class ipmininet.router.config.zebra.RouteMapMatchCond(cond_type: str, condition, family: Optional[str] = None)

Bases: object

A class representing a RouteMap matching condition

Parameters:
  • condition – Can be an ip address, the id of an access or prefix list
  • cond_type – The type of condition access list, prefix list, peer …
  • family – if cond_type is an access-list or a prefix-list, specify the family of the list (either ipv4 or ipv6)
zebra_family
class ipmininet.router.config.zebra.RouteMapSetAction(action_type: str, value)

Bases: object

A class representing a RouteMap set action

Parameters:
  • action_type – Type of value to me modified
  • value – Value to be modified
class ipmininet.router.config.zebra.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.zebra.ZebraList(family, entries: Sequence[Union[ZebraList.Entry, str, ipaddress.IPv4Network, ipaddress.IPv6Network]] = (), name=None)

Bases: abc.ABC

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
count = 0
prefix_name
zebra_family
ipmininet.router.config.zebra.get_family(prefix: Union[str, ipaddress.IPv4Network, ipaddress.IPv6Network]) → Optional[str]