From 87066abcf81612c3ff055a2c6793071c6b2b6e27 Mon Sep 17 00:00:00 2001 From: abdosi <58047199+abdosi@users.noreply.github.com> Date: Fri, 7 Jul 2023 11:10:35 -0700 Subject: [PATCH] Enable BFD for Static Route for chassis-packet. (#15383) *What I did: Enable BFD for Static Route for chassis-packet. This will trigger the use of the feature as defined in here: #13789 Signed-off-by: Abhishek Dosi --- src/sonic-config-engine/minigraph.py | 4 ++++ src/sonic-config-engine/tests/test_cfggen.py | 4 ++-- src/sonic-yang-models/yang-models/sonic-static-route.yang | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 558c7e24e929..625e11c012c3 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1982,6 +1982,10 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw port['mux_cable'] = "true" if static_routes: + # Enable static Route BFD by default for static route in chassis-packet + if switch_type == "chassis-packet": + for pfx, data in static_routes.items(): + data.update({"bfd":"true"}) results['STATIC_ROUTE'] = static_routes for nghbr in list(neighbors.keys()): diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 50e3c2758a1e..9c1c56d28fce 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -1032,14 +1032,14 @@ def test_minigraph_bgp_packet_chassis_static_route(self): 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', 'ifname': 'PortChannel40,PortChannel50', 'advertise':'false'}}") + utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'ifname': 'PortChannel40,PortChannel50', 'advertise':'false', 'bfd':'true'}}") ) 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', 'ifname': 'PortChannel40,PortChannel50', 'advertise':'false'}}") + utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'ifname': 'PortChannel40,PortChannel50', 'advertise':'false', 'bfd':'true'}}") ) def test_minigraph_bgp_packet_chassis_vlan_subintf(self): diff --git a/src/sonic-yang-models/yang-models/sonic-static-route.yang b/src/sonic-yang-models/yang-models/sonic-static-route.yang index 019825b78881..0134d5fe6cd5 100644 --- a/src/sonic-yang-models/yang-models/sonic-static-route.yang +++ b/src/sonic-yang-models/yang-models/sonic-static-route.yang @@ -54,6 +54,12 @@ module sonic-static-route { } default "false"; } + leaf bfd { + type string { + pattern "((true|false),)*(true|false)"; + } + default "false"; + } } list STATIC_ROUTE_LIST { key "vrf_name prefix";