Skip to content

Commit

Permalink
[chassis-packet] Fixed BGP Internal Peer template (#9106)
Browse files Browse the repository at this point in the history
What I did:

Fix the typo in Internal Peer Group template for Packet-based Chassis.
Address Review comments of PR: [chassis-packet] minigraph parsing and BGP template changes #8966
- Static Route Parsing for Host
- Formatting of chassis port_config.ini
  • Loading branch information
abdosi authored Oct 29, 2021
1 parent 1c07d39 commit 919b3e5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
exit-address-family
address-family ipv6
{% if CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
neighbor INTERNAL_PEER_V4 update-source {{ get_ipv6_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }}
neighbor INTERNAL_PEER_V6 update-source {{ get_ipv6_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }}
{% elif CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
neighbor INTERNAL_PEER_V6 route-reflector-client
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out
exit-address-family
address-family ipv6
neighbor INTERNAL_PEER_V4 update-source 2603:10e2:400::3
neighbor INTERNAL_PEER_V6 update-source 2603:10e2:400::3
neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound
neighbor INTERNAL_PEER_V6 allowas-in 1
neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def parse_png(png, hname, dpg_ecmp_content = None):

mux_cable_ports[intf_name] = "true"

if (len(dpg_ecmp_content)):
if dpg_ecmp_content and (len(dpg_ecmp_content)):
for version, content in dpg_ecmp_content.items(): # version is ipv4 or ipv6
fine_grained_content = formulate_fine_grained_ecmp(version, content, port_device_map, port_alias_map) # port_alias_map
FG_NHG_MEMBER.update(fine_grained_content['FG_NHG_MEMBER'])
Expand Down
15 changes: 13 additions & 2 deletions src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<MplsInterfaces/>
<MplsTeInterfaces/>
<RsvpInterfaces/>
<Hostname>str2-88</Hostname>
<Hostname>str2-8808-lc2-1</Hostname>
<PortChannelInterfaces>
</PortChannelInterfaces>
<IPInterfaces>
Expand All @@ -114,7 +114,18 @@
<AttachTo>Eth1/1/47</AttachTo>
<Prefix>27.1.1.1/24</Prefix>
</IPInterface>
</IPInterfaces>
</IPInterfaces>
<VlanInterfaces>
</VlanInterfaces>
<IPNextHops>
<IPNextHop>
<ElementType>IPNextHop</ElementType>
<Name i:nil="true"/>
<AttachTo>8.0.0.1/32</AttachTo>
<Address>192.168.1.2,192.168.2.2</Address>
<Type>StaticRoute</Type>
</IPNextHop>
</IPNextHops>
<DataAcls/>
<AclInterfaces>
</AclInterfaces>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name lanes alias index speed asic_port_name role source_npu target_npu
# name lanes alias index speed asic_port_name role
Ethernet13 1280,1281,1282,1283 Eth1/1/13 13 100000 Eth13-ASIC1 Ext
Ethernet14 1284,1285,1286,1287 Eth1/1/14 14 100000 Eth14-ASIC1 Ext
Ethernet16 1288,1289,1290,1291 Eth1/1/16 16 100000 Eth16-ASIC1 Ext
Expand Down
7 changes: 7 additions & 0 deletions src/sonic-config-engine/tests/test_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,13 @@ def test_minigraph_bgp_packet_chassis_peer(self):
)

def test_minigraph_bgp_packet_chassis_static_route(self):
argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -v "STATIC_ROUTE"'
output = self.run_script(argument)
self.assertEqual(
utils.to_dict(output.strip()),
utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2'}}")
)

argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "STATIC_ROUTE"'
output = self.run_script(argument)
self.assertEqual(
Expand Down

0 comments on commit 919b3e5

Please sign in to comment.