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

Enable BFD for Static Route for chassis-packet. #15383

Merged
merged 13 commits into from
Jul 7, 2023
4 changes: 4 additions & 0 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()):
Expand Down
4 changes: 2 additions & 2 deletions src/sonic-config-engine/tests/test_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 6 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-static-route.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down