Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bgpd]: support multiple peer range in single peer group #807

Merged
merged 1 commit into from
Jul 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dockers/docker-fpm-quagga/bgpd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
!
Expand Down
3 changes: 2 additions & 1 deletion src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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/>
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-config-engine/tests/test_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_minigraph_neighbors(self):
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'
Expand Down