From a65b93d9e338c7d586d95f839c2240ecd8262aa7 Mon Sep 17 00:00:00 2001 From: Liping Xu <108326363+lipxu@users.noreply.github.com> Date: Wed, 24 Dec 2025 04:55:53 +1100 Subject: [PATCH] [frr]: update next hop group support by metadata value with disabled as the default value (#23500) * [202411][frr]: Force disable next hop group support (#23292) Signed-off-by: Liping Xu --------- Signed-off-by: Liping Xu --- dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 | 10 ++++++++++ platform/vs/docker-sonic-vs/frr/zebra.conf | 3 +-- .../tests/data/sonic-cfggen/zebra/zebra.conf | 3 +++ .../sample_output/py2/t2-chassis-fe-vni-zebra.conf | 3 +++ .../tests/sample_output/py2/t2-chassis-fe-zebra.conf | 3 +++ .../tests/sample_output/py2/zebra_frr.conf | 3 +++ .../tests/sample_output/py2/zebra_frr_dualtor.conf | 3 +++ .../sample_output/py3/t2-chassis-fe-vni-zebra.conf | 3 +++ .../tests/sample_output/py3/t2-chassis-fe-zebra.conf | 3 +++ .../tests/sample_output/py3/zebra_frr.conf | 3 +++ .../tests/sample_output/py3/zebra_frr_dualtor.conf | 3 +++ .../tests/files/sample_config_db.json | 3 ++- .../tests/yang_model_tests/tests/device_metadata.json | 3 +++ .../yang_model_tests/tests_config/device_metadata.json | 9 +++++++++ .../yang-models/sonic-device_metadata.yang | 9 +++++++++ 15 files changed, 61 insertions(+), 3 deletions(-) diff --git a/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 b/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 index 759cd2f8c38..36432752e29 100644 --- a/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 +++ b/dockers/docker-fpm-frr/frr/zebra/zebra.conf.j2 @@ -6,6 +6,16 @@ ! {% endblock banner %} ! +{% block zebra_nexthop %} +{% if (('localhost' in DEVICE_METADATA) and ('zebra_nexthop' in DEVICE_METADATA['localhost']) and + (DEVICE_METADATA['localhost']['zebra_nexthop'] == 'enabled')) %} +zebra nexthop kernel enable +{% else %} +! Force disable next hop group support +no zebra nexthop kernel enable +{% endif %} +{% endblock zebra_nexthop %} +! {% block fpm %} {% if ( ('localhost' in DEVICE_METADATA) and ('nexthop_group' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['nexthop_group'] == 'enabled') ) %} diff --git a/platform/vs/docker-sonic-vs/frr/zebra.conf b/platform/vs/docker-sonic-vs/frr/zebra.conf index 695d339cdeb..9e3bd42315d 100644 --- a/platform/vs/docker-sonic-vs/frr/zebra.conf +++ b/platform/vs/docker-sonic-vs/frr/zebra.conf @@ -1,5 +1,4 @@ +no zebra nexthop kernel enable no fpm use-next-hop-groups - fpm address 127.0.0.1 zebra nexthop-group keep 1 - diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf index c22fa8c7f93..db6d35f20eb 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf @@ -4,6 +4,9 @@ ! file: zebra.conf ! ! +! Force disable next hop group support +no zebra nexthop kernel enable +! ! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages no fpm use-next-hop-groups ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf index 0761e4b2049..8c29a8289a3 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-vni-zebra.conf @@ -4,6 +4,9 @@ ! file: zebra.conf ! ! +! Force disable next hop group support +no zebra nexthop kernel enable +! ! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages no fpm use-next-hop-groups ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf index ad04eacbc8c..03e18a4a519 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-zebra.conf @@ -4,6 +4,9 @@ ! file: zebra.conf ! ! +! Force disable next hop group support +no zebra nexthop kernel enable +! ! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages no fpm use-next-hop-groups ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf b/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf index 129a98e3c23..a4c50cf6796 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/zebra_frr.conf @@ -4,6 +4,9 @@ ! file: zebra.conf ! ! +! Force disable next hop group support +no zebra nexthop kernel enable +! ! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages no fpm use-next-hop-groups ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/zebra_frr_dualtor.conf b/src/sonic-config-engine/tests/sample_output/py2/zebra_frr_dualtor.conf index a6cf1c42b07..c8bc3658420 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/zebra_frr_dualtor.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/zebra_frr_dualtor.conf @@ -4,6 +4,9 @@ ! file: zebra.conf ! ! +! Force disable next hop group support +no zebra nexthop kernel enable +! ! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages no fpm use-next-hop-groups ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf index a238f3362ad..f047976b5a3 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-vni-zebra.conf @@ -4,6 +4,9 @@ ! file: zebra.conf ! ! +! Force disable next hop group support +no zebra nexthop kernel enable +! ! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages no fpm use-next-hop-groups ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf index 55576c57349..91aa73b8369 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-zebra.conf @@ -4,6 +4,9 @@ ! file: zebra.conf ! ! +! Force disable next hop group support +no zebra nexthop kernel enable +! ! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages no fpm use-next-hop-groups ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf b/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf index dadb8972345..7db3d3f42d3 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/zebra_frr.conf @@ -4,6 +4,9 @@ ! file: zebra.conf ! ! +! Force disable next hop group support +no zebra nexthop kernel enable +! ! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages no fpm use-next-hop-groups ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/zebra_frr_dualtor.conf b/src/sonic-config-engine/tests/sample_output/py3/zebra_frr_dualtor.conf index 3bdb18fbc56..584b761905a 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/zebra_frr_dualtor.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/zebra_frr_dualtor.conf @@ -4,6 +4,9 @@ ! file: zebra.conf ! ! +! Force disable next hop group support +no zebra nexthop kernel enable +! ! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages no fpm use-next-hop-groups ! diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 9794d5fae81..7ba4e05d47e 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -413,7 +413,8 @@ "bgp_router_id": "8.8.8.8", "chassis_hostname": "str-sonic-chassis-1", "slice_type": "AZNG_Production", - "nexthop_group": "disabled" + "nexthop_group": "disabled", + "zebra_nexthop": "disabled" } }, "VLAN": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json index df168d70629..8b951576e92 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -233,6 +233,9 @@ "DEVICE_METADATA_VALID_NEXTHOP_GROUP": { "desc": "Verifying nexthop_group configuration." }, + "DEVICE_METADATA_VALID_ZEBRA_NEXTHOP": { + "desc": "Verifying valid zebra_nexthop configuration." + }, "DEVICE_METADATA_VALID_T2_GROUP_ASNS": { "desc": "Verifying valid t2_group_asns." }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json index 263367515fc..31fbcb7ab36 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -744,5 +744,14 @@ } } } + }, + "DEVICE_METADATA_VALID_ZEBRA_NEXTHOP": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "zebra_nexthop": "disabled" + } + } + } } } diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index 6b06311a8e7..9f5394113dc 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -329,6 +329,15 @@ module sonic-device_metadata { description "Enable syslog counter feature."; default "false"; } + + leaf zebra_nexthop { + description "Enable or disable next hop group support. This value only takes effect during boot time"; + type enumeration { + enum enabled; + enum disabled; + } + default disabled; + } } /* end of container localhost */ }