[minigraph] Enhanced parser to parse interface name for static route nexthop (#9707)
What I did:- Enhanced minigraph parser to parse interface name associated with static route nexthop Why I did:- One of the use case to support interface name is Chassis Packet. For Chassis Packet we have Static Routes configured to route traffic across line-card. If the FRR programs static route without the interface name then in case if the ip interface that is associated with the nexthop goes down FRR resolves static route nexthop over the default route as we have FRR config ip nht-resolve-via-default which causes undesired behavior. Having interface name with Static Route prevents recursive lookup on default route. How I verify: Updated unit-test cases Manual verification
This commit is contained in:
parent
945278f6d8
commit
649e6c7307
@ -510,10 +510,11 @@ def parse_dpg(dpg, hname):
|
||||
elif ":" in ipnhaddr:
|
||||
port_nhipv6_map[ipnhfmbr] = ipnhaddr
|
||||
elif ipnh.find(str(QName(ns, "Type"))).text == 'StaticRoute':
|
||||
prefix = ipnh.find(str(QName(ns, "AttachTo"))).text
|
||||
prefix = ipnh.find(str(QName(ns, "AssociatedTo"))).text
|
||||
ifname = ipnh.find(str(QName(ns, "AttachTo"))).text
|
||||
nexthop = ipnh.find(str(QName(ns, "Address"))).text
|
||||
advertise = ipnh.find(str(QName(ns, "Advertise"))).text
|
||||
static_routes[prefix] = {'nexthop': nexthop, 'advertise': advertise}
|
||||
static_routes[prefix] = {'nexthop': nexthop, 'ifname': ifname, 'advertise': advertise}
|
||||
|
||||
if port_nhipv4_map and port_nhipv6_map:
|
||||
subnet_check_ip = list(port_nhipv4_map.values())[0]
|
||||
|
@ -121,8 +121,9 @@
|
||||
<IPNextHop>
|
||||
<ElementType>IPNextHop</ElementType>
|
||||
<Name i:nil="true"/>
|
||||
<AttachTo>8.0.0.1/32</AttachTo>
|
||||
<AssociatedTo>8.0.0.1/32</AssociatedTo>
|
||||
<Address>192.168.1.2,192.168.2.2</Address>
|
||||
<AttachTo>PortChannel40,PortChannel50</AttachTo>
|
||||
<Type>StaticRoute</Type>
|
||||
<Advertise>false</Advertise>
|
||||
</IPNextHop>
|
||||
@ -212,8 +213,9 @@
|
||||
<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>
|
||||
<AssociatedTo>8.0.0.1/32</AssociatedTo>
|
||||
<Address>192.168.1.2,192.168.2.2</Address>
|
||||
<AttachTo>PortChannel40,PortChannel50</AttachTo>
|
||||
<Type>StaticRoute</Type>
|
||||
<Advertise>false</Advertise>
|
||||
</IPNextHop>
|
||||
|
@ -904,14 +904,14 @@ class TestCfgGen(TestCase):
|
||||
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', 'advertise':'false'}}")
|
||||
utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'ifname': 'PortChannel40,PortChannel50', 'advertise':'false'}}")
|
||||
)
|
||||
|
||||
argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -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', 'advertise':'false'}}")
|
||||
utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'ifname': 'PortChannel40,PortChannel50', 'advertise':'false'}}")
|
||||
)
|
||||
|
||||
def test_minigraph_bgp_packet_chassis_vlan_subintf(self):
|
||||
|
Reference in New Issue
Block a user