[docker-fpm-quagga]: Add support for PeerAsn and UpdateAddress (#2766)
This commit is contained in:
parent
4fcb3321b2
commit
602369126c
@ -98,14 +98,22 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
||||
{% for bgp_peer in BGP_PEER_RANGE.values() %}
|
||||
neighbor {{ bgp_peer['name'] }} peer-group
|
||||
neighbor {{ bgp_peer['name'] }} passive
|
||||
{% if bgp_peer['peer_asn'] is defined %}
|
||||
neighbor {{ bgp_peer['name'] }} remote-as {{ bgp_peer['peer_asn'] }}
|
||||
{% else %}
|
||||
neighbor {{ bgp_peer['name'] }} remote-as {{ deployment_id_asn_map[DEVICE_METADATA['localhost']['deployment_id']] }}
|
||||
{% endif %}
|
||||
neighbor {{ bgp_peer['name'] }} ebgp-multihop 255
|
||||
neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound
|
||||
{% if bgp_peer['src_address'] is defined %}
|
||||
neighbor {{ bgp_peer['name'] }} update-source {{ bgp_peer['src_address'] | ip }}
|
||||
{% else %}
|
||||
{% for (name, prefix) in LOOPBACK_INTERFACE %}
|
||||
{% if name == 'Loopback1' %}
|
||||
neighbor {{ bgp_peer['name'] }} update-source {{ prefix | ip }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in
|
||||
neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out
|
||||
{% for ip_range in bgp_peer['ip_range'] %}
|
||||
|
@ -336,7 +336,7 @@ def parse_cpg(cpg, hname):
|
||||
peers = router.find(str(QName(ns1, "Peers")))
|
||||
for bgpPeer in peers.findall(str(QName(ns, "BGPPeer"))):
|
||||
addr = bgpPeer.find(str(QName(ns, "Address"))).text
|
||||
if bgpPeer.find(str(QName(ns1, "PeersRange"))) is not None:
|
||||
if bgpPeer.find(str(QName(ns1, "PeersRange"))) is not None: # FIXME: is better to check for type BGPPeerPassive
|
||||
name = bgpPeer.find(str(QName(ns1, "Name"))).text
|
||||
ip_range = bgpPeer.find(str(QName(ns1, "PeersRange"))).text
|
||||
ip_range_group = ip_range.split(';') if ip_range and ip_range != "" else []
|
||||
@ -344,6 +344,10 @@ def parse_cpg(cpg, hname):
|
||||
'name': name,
|
||||
'ip_range': ip_range_group
|
||||
}
|
||||
if bgpPeer.find(str(QName(ns1, "Address"))) is not None:
|
||||
bgp_peers_with_range[name]['src_address'] = bgpPeer.find(str(QName(ns1, "Address"))).text
|
||||
if bgpPeer.find(str(QName(ns1, "PeerAsn"))) is not None:
|
||||
bgp_peers_with_range[name]['peer_asn'] = bgpPeer.find(str(QName(ns1, "PeerAsn"))).text
|
||||
else:
|
||||
for peer in bgp_sessions:
|
||||
bgp_session = bgp_sessions[peer]
|
||||
|
Loading…
Reference in New Issue
Block a user