[bgpd]: support multiple peer range in single peer group (#807)
This commit is contained in:
parent
f49cac086f
commit
1176508858
@ -84,7 +84,9 @@ router bgp {{ minigraph_bgp_asn }}
|
||||
neighbor {{ bgp_peer['name'] }} update-source Loopback0
|
||||
neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in
|
||||
neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out
|
||||
bgp listen range {{ bgp_peer['ip_range'] }} peer-group {{ bgp_peer['name'] }}
|
||||
{% for ip_range in bgp_peer['ip_range'] %}
|
||||
bgp listen range {{ip_range}} peer-group {{ bgp_peer['name'] }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endblock bgp_peers_with_range %}
|
||||
!
|
||||
|
@ -281,9 +281,10 @@ def parse_cpg(cpg, hname):
|
||||
if bgpPeer.find(str(QName(ns1, "PeersRange"))) is not None:
|
||||
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 []
|
||||
bgp_peers_with_range.append({
|
||||
'name': name,
|
||||
'ip_range': ip_range
|
||||
'ip_range': ip_range_group
|
||||
})
|
||||
else:
|
||||
for bgp_session in bgp_sessions:
|
||||
|
@ -111,7 +111,7 @@
|
||||
<BGPPeer>
|
||||
<Address>10.1.0.32</Address>
|
||||
<a:Name>BGPSLBPassive</a:Name>
|
||||
<a:PeersRange>10.10.10.10/26</a:PeersRange>
|
||||
<a:PeersRange>10.10.10.10/26;100.100.100.100/26</a:PeersRange>
|
||||
</BGPPeer>
|
||||
</a:Peers>
|
||||
<a:RouteMaps/>
|
||||
|
@ -113,7 +113,7 @@ class TestCfgGen(TestCase):
|
||||
def test_minigraph_peers_with_range(self):
|
||||
argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v minigraph_bgp_peers_with_range'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': '10.10.10.10/26'}]")
|
||||
self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]")
|
||||
|
||||
def test_minigraph_deployment_id(self):
|
||||
argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v deployment_id'
|
||||
|
Loading…
Reference in New Issue
Block a user