ipmininet.router.config.bgp module¶
Base classes to configure a BGP daemon
-
ipmininet.router.config.bgp.
AF_INET
(*args, **kwargs)¶ The ipv4 (unicast) address family
-
ipmininet.router.config.bgp.
AF_INET6
(*args, **kwargs)¶ The ipv6 (unicast) address family
-
class
ipmininet.router.config.bgp.
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.bgp.
AddressFamily
(af_name, redistribute=(), networks=())¶ Bases:
object
An address family that is exchanged through BGP
-
class
ipmininet.router.config.bgp.
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
-
build_access_list
()¶ Build and return a list of acess_filter :return:
-
build_community_list
()¶ Build and return a list of community_filter
-
build_route_map
(neigbors)¶ Build and return a list of route map for the current node
-
classmethod
get_config
(topo, router, **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.bgp.
BGPConfig
(topo, router)¶ Bases:
object
-
add_set_action
(peer, set_action, matching, direction)¶ Add a ‘RouteMapSetAction’ to a BGP peering between two nodes
Parameters: - peer – The peer to which the routemap is applied
- set_action – The RouteMapSetAction to set
- matching – A list of filter, can be empty
- direction – direction of the route map: ‘in’, ‘out’ or ‘both’
Returns: self
-
deny
(name=None, from_peer=None, to_peer=None, matching=(), order=10)¶ - Deny all routes received from ‘from_peer’
- and routes sent to ‘to_peer’ matching all of the access and community lists in ‘matching’
Parameters: - name – The name of the route-map
- from_peer – The peer on which received routes have to have the community
- to_peer – The peer on which sent routes have to have the community
- matching – A list of AccessList and/or CommunityList
- order – The order in which route-maps are applied, i.e., lower order means applied before
Returns: self
-
filter
(name=None, policy='deny', from_peer=None, to_peer=None, matching=(), order=10)¶ - Either accept or deny all routes received from ‘from_peer’
- and routes sent to ‘to_peer’ matching all of the access and community lists in ‘matching’
Parameters: - name – The name of the route-map
- policy – Either ‘deny’ or ‘permit’
- from_peer – The peer on which received routes have to have the community
- to_peer – The peer on which sent routes have to have the community
- matching – A list of AccessList and/or CommunityList
- order – The order in which route-maps are applied, i.e., lower order means applied before
Returns: self
-
filters_to_match_cond
(filter_list)¶
-
permit
(name=None, from_peer=None, to_peer=None, matching=(), order=10)¶ - Accept all routes received from ‘from_peer’
- and routes sent to ‘to_peer’ matching all of the access and community lists in ‘matching’
Parameters: - name – The name of the route-map
- from_peer – The peer on which received routes have to have the community
- to_peer – The peer on which sent routes have to have the community
- matching – A list of AccessList and/or CommunityList
- order – The order in which route-maps are applied, i.e., lower order means applied before
Returns: self
-
set_community
(community, from_peer=None, to_peer=None, matching=())¶ - Set community on a routes received from ‘from_peer’
- and routes sent to ‘to_peer’ on routes matching all of the access and community lists in ‘matching’
Parameters: - community – The community value to set
- from_peer – The peer on which received routes have to have the community
- to_peer – The peer on which sent routes have to have the community
- matching – A list of AccessList and/or CommunityList
Returns: self
-
set_local_pref
(local_pref, from_peer, matching=())¶ - Set local pref on a peering with ‘from_peer’ on routes
- matching all of the access and community lists in ‘matching’
Parameters: - local_pref – The local pref value to set
- from_peer – The peer on which the local pref is applied
- matching – A list of AccessList and/or CommunityList
Returns: self
-
set_med
(med, to_peer, matching=())¶ - Set MED on a peering with ‘to_peer’ on routes
- matching all of the access and community lists in ‘matching’
Parameters: - med – The local pref value to set
- to_peer – The peer to which the med is applied
- matching – A list of AccessList and/or CommunityList
Returns: self
-
-
class
ipmininet.router.config.bgp.
Peer
(base, node, v6=False)¶ Bases:
object
A BGP peer
Parameters: - base – The base router that has this peer
- node – The actual peer
-
ipmininet.router.config.bgp.
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.bgp.
bgp_peering
(topo, a, b)¶ Register a BGP peering between two nodes
-
ipmininet.router.config.bgp.
ebgp_session
(topo, a, b, link_type=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.bgp.
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.
set_rr
(topo, rr, peers=())¶ Set rr as route reflector for all router r
Parameters: - topo – The current topology
- rr – The route reflector
- peers – Clients of the route reflector