ipmininet.router.config.zebra module

class ipmininet.router.config.zebra.AccessList(name=None, entries=())

Bases: object

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

Setup a new access-list

Parameters:
  • name – The name of the acl, which will default to acl## where ## is the instance number
  • entries – A sequence of AccessListEntry instance, or of ip_interface which describes which prefixes are composing the ACL
count = 0
class ipmininet.router.config.zebra.AccessListEntry(prefix, action='permit')

Bases: object

A zebra access-list entry

Parameters:
  • prefix – The ip_interface prefix for that ACL entry
  • action – Wether that prefix belongs to the ACL (PERMIT) or not (DENY)
class ipmininet.router.config.zebra.CommunityList(name=None, action='permit', community=0)

Bases: object

A zebra community-list entry

Parameters:
  • name
  • action
  • community
count = 0
class ipmininet.router.config.zebra.QuaggaDaemon(node, template_lookup=<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(name=None, match_policy='permit', match_cond=(), set_actions=(), call_action=None, exit_policy=None, order=10, proto=(), neighbor=(), direction='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##
  • 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
  • order – Priority of the route map compare to others
  • 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)
append_match_cond(match_conditions)
Returns:
append_set_action(set_actions)
Parameters:set_actions
Returns:
count = 0
describe

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

class ipmininet.router.config.zebra.RouteMapMatchCond(cond_type, condition)

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 …
class ipmininet.router.config.zebra.RouteMapSetAction(action_type, 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 = '-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