From 806338445fcb20788b791d4980cd44a0531cb0ea Mon Sep 17 00:00:00 2001 From: Brad House Date: Sun, 15 Dec 2024 21:12:34 -0500 Subject: [PATCH] [yang] bgp address family l2vpn advertise-all-vni (#21054) Why I did it Cannot configure unified bgp for vxlan evpn without specifying advertise-all-vpn. The setting appears to have been introduced as part of PR #5142, can be seen it is already honored as an option here: sonic-buildimage/src/sonic-frr-mgmt-framework/templates/bgpd/bgpd.conf.db.addr_family.evpn.j2 Lines 1 to 3 in 8e0f1c6 {% if 'advertise-all-vni' in af_val and af_val['advertise-all-vni'] == 'true' %} advertise-all-vni {% endif %} Work item tracking How I did it Added basic yang rule How to verify it Configure "BGP_GLOBALS_AF": { "default|l2vpn_evpn": { "advertise-all-vni": "true" } } and run config replace. Tested branch (Please provide the tested image version) master as of 20241205 Description for the changelog [yang] bgp address family l2vpn advertise-all-vni --- .../tests/files/sample_config_db.json | 3 + .../tests/yang_model_tests/tests/bgp.json | 10 +++ .../yang_model_tests/tests_config/bgp.json | 64 ++++++++++++++++++- .../yang-models/sonic-bgp-global.yang | 5 ++ 4 files changed, 81 insertions(+), 1 deletion(-) 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 4c76237ddb46..6f7e90c229ff 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1771,6 +1771,9 @@ "default|ipv6_unicast": { "max_ebgp_paths": "2", "max_ibgp_paths": "2" + }, + "default|l2vpn_evpn": { + "advertise-all-vni": "true" } }, "BGP_GLOBALS_AF_AGGREGATE_ADDR": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json index d8ab57f61074..b360ce6309a9 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json @@ -2,6 +2,16 @@ "BGP_GLOBAL_VALID": { "desc": "Configure BGP global table." }, + "BGP_GLOBALS_AF_ADVERTISE_ALL_VNI_TRUE": { + "desc": "BGP Address Family l2vpn_evpn with advertise-all-vni set to true" + }, + "BGP_GLOBALS_AF_ADVERTISE_ALL_VNI_FALSE": { + "desc": "BGP Address Family l2vpn_evpn with advertise-all-vni set to false" + }, + "BGP_GLOBALS_AF_ADVERTISE_ALL_VNI_INVALID": { + "desc": "BGP Address Family l2vpn_evpn with advertise-all-vni set to an invalid value", + "eStr": "Invalid value \"invalid value\" in \"advertise-all-vni\" element." + }, "BGP_NEIGHBOR_ALL_VALID": { "desc": "Configure BGP neighbor table." }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp.json index 4c06316deede..fbc41ae127c5 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp.json @@ -81,7 +81,69 @@ } } }, - + "BGP_GLOBALS_AF_ADVERTISE_ALL_VNI_TRUE": { + "sonic-bgp-global:sonic-bgp-global": { + "sonic-bgp-global:BGP_GLOBALS": { + "BGP_GLOBALS_LIST": [ + { + "vrf_name":"default", + "local_asn": 65001 + } + ] + }, + "sonic-bgp-global:BGP_GLOBALS_AF": { + "BGP_GLOBALS_AF_LIST": [ + { + "vrf_name": "default", + "afi_safi": "l2vpn_evpn", + "advertise-all-vni": "true" + } + ] + } + } + }, + "BGP_GLOBALS_AF_ADVERTISE_ALL_VNI_FALSE": { + "sonic-bgp-global:sonic-bgp-global": { + "sonic-bgp-global:BGP_GLOBALS": { + "BGP_GLOBALS_LIST": [ + { + "vrf_name":"default", + "local_asn": 65001 + } + ] + }, + "sonic-bgp-global:BGP_GLOBALS_AF": { + "BGP_GLOBALS_AF_LIST": [ + { + "vrf_name": "default", + "afi_safi": "l2vpn_evpn", + "advertise-all-vni": "false" + } + ] + } + } + }, + "BGP_GLOBALS_AF_ADVERTISE_ALL_VNI_INVALID": { + "sonic-bgp-global:sonic-bgp-global": { + "sonic-bgp-global:BGP_GLOBALS": { + "BGP_GLOBALS_LIST": [ + { + "vrf_name":"default", + "local_asn": 65001 + } + ] + }, + "sonic-bgp-global:BGP_GLOBALS_AF": { + "BGP_GLOBALS_AF_LIST": [ + { + "vrf_name": "default", + "afi_safi": "l2vpn_evpn", + "advertise-all-vni": "invalid value" + } + ] + } + } + }, "BGP_NEIGHBOR_ALL_VALID": { "sonic-port:sonic-port": { "sonic-port:PORT": { diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-global.yang b/src/sonic-yang-models/yang-models/sonic-bgp-global.yang index db6c02356aa6..fe10d0ad65bf 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-global.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-global.yang @@ -445,6 +445,11 @@ module sonic-bgp-global { } description "Maximum duration to suppress a stable route"; } + + leaf advertise-all-vni { + type boolean; + description "L2VPN advertise all VNIs"; + } } }