From c0630467230b167ea0c4d77fb845ab8825f09726 Mon Sep 17 00:00:00 2001 From: Brad House Date: Mon, 6 Jan 2025 12:42:51 -0500 Subject: [PATCH] [frr-mgmt-framework]: VXLAN EVPN should support advertise-svi-ip [PR #21336] advertise-svi-ip allows the switch to participate in the L2 VXLAN via its unique IP address. Signed-off-by: Brad House (@bradh352) --- .../frrcfgd/frrcfgd.py | 1 + .../bgpd/bgpd.conf.db.addr_family.evpn.j2 | 5 +- .../tests/test_config.py | 2 + .../tests/files/sample_config_db.json | 3 +- .../tests/yang_model_tests/tests/bgp.json | 10 +++ .../yang_model_tests/tests_config/bgp.json | 63 +++++++++++++++++++ .../yang-models/sonic-bgp-global.yang | 5 ++ 7 files changed, 87 insertions(+), 2 deletions(-) diff --git a/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py b/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py index c91d71b471e7..06e1e8ab6b93 100755 --- a/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py +++ b/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py @@ -1822,6 +1822,7 @@ class BGPConfigDaemon: '+route_flap_dampen_suppress_threshold', '+route_flap_dampen_max_suppress'], '{no:no-prefix}bgp dampening {} {} {} {}', ['true', 'false']), ('advertise-all-vni', '{no:no-prefix}advertise-all-vni', ['true','false']), + ('advertise-svi-ip', '{no:no-prefix}advertise-svi-ip', ['true','false']), ('advertise-default-gw', '{no:no-prefix}advertise-default-gw', ['true','false']), ('advertise-ipv4-unicast', '{no:no-prefix}advertise ipv4 unicast', ['true','false']), ('advertise-ipv6-unicast', '{no:no-prefix}advertise ipv6 unicast', ['true','false']), diff --git a/src/sonic-frr-mgmt-framework/templates/bgpd/bgpd.conf.db.addr_family.evpn.j2 b/src/sonic-frr-mgmt-framework/templates/bgpd/bgpd.conf.db.addr_family.evpn.j2 index a0014ddb6528..5163a9cc763c 100644 --- a/src/sonic-frr-mgmt-framework/templates/bgpd/bgpd.conf.db.addr_family.evpn.j2 +++ b/src/sonic-frr-mgmt-framework/templates/bgpd/bgpd.conf.db.addr_family.evpn.j2 @@ -1,6 +1,9 @@ {% if 'advertise-all-vni' in af_val and af_val['advertise-all-vni'] == 'true' %} advertise-all-vni {% endif %} +{% if 'advertise-svi-ip' in af_val and af_val['advertise-svi-ip'] == 'true' %} + advertise-svi-ip +{% endif %} {% if 'autort' in af_val %} autort {{af_val['autort']}} {% endif %} @@ -75,4 +78,4 @@ exit-vni {% endif %} {% endfor %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/src/sonic-frr-mgmt-framework/tests/test_config.py b/src/sonic-frr-mgmt-framework/tests/test_config.py index 02dbf391e99d..6339adcf38cd 100644 --- a/src/sonic-frr-mgmt-framework/tests/test_config.py +++ b/src/sonic-frr-mgmt-framework/tests/test_config.py @@ -131,6 +131,8 @@ def hdl_confed_peers_cmd(is_del, cmd_list, chk_data): conf_bgp_af_cmd('default', 100, 'ipv4') + ['{}distance bgp 100 115 238']), CmdMapTestInfo('BGP_GLOBALS_AF', 'default|ipv6_unicast', {'advertise-all-vni': 'true'}, conf_bgp_af_cmd('default', 100, 'ipv6') + ['{}advertise-all-vni']), + CmdMapTestInfo('BGP_GLOBALS_AF', 'default|ipv6_unicast', {'advertise-svi-ip': 'true'}, + conf_bgp_af_cmd('default', 100, 'ipv6') + ['{}advertise-svi-ip']), CmdMapTestInfo('BGP_GLOBALS', 'Vrf_red', {'local_asn': 200}, conf_bgp_dft_cmd('Vrf_red', 200), False, conf_no_bgp_cmd('Vrf_red', 200), None, None, None), CmdMapTestInfo('BGP_GLOBALS', 'Vrf_red', {'med_confed': 'true'}, 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 be1b96a2885c..a41e937d5671 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1783,7 +1783,8 @@ "max_ibgp_paths": "2" }, "default|l2vpn_evpn": { - "advertise-all-vni": "true" + "advertise-all-vni": "true", + "advertise-svi-ip": "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 b360ce6309a9..476c9c2d47cc 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 @@ -12,6 +12,16 @@ "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_GLOBALS_AF_ADVERTISE_SVI_IP_TRUE": { + "desc": "BGP Address Family l2vpn_evpn with advertise-svi-ip set to true" + }, + "BGP_GLOBALS_AF_ADVERTISE_SVI_IP_FALSE": { + "desc": "BGP Address Family l2vpn_evpn with advertise-svi-ip set to false" + }, + "BGP_GLOBALS_AF_ADVERTISE_SVI_IP_INVALID": { + "desc": "BGP Address Family l2vpn_evpn with advertise-svi-ip set to an invalid value", + "eStr": "Invalid value \"invalid value\" in \"advertise-svi-ip\" 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 fbc41ae127c5..884caca5277e 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 @@ -144,6 +144,69 @@ } } }, + "BGP_GLOBALS_AF_ADVERTISE_SVI_IP_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-svi-ip": "true" + } + ] + } + } + }, + "BGP_GLOBALS_AF_ADVERTISE_SVI_IP_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-svi-ip": "false" + } + ] + } + } + }, + "BGP_GLOBALS_AF_ADVERTISE_SVI_IP_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-svi-ip": "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 fe10d0ad65bf..d717803184fc 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-global.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-global.yang @@ -450,6 +450,11 @@ module sonic-bgp-global { type boolean; description "L2VPN advertise all VNIs"; } + + leaf advertise-svi-ip { + type boolean; + description "L2VPN advertise the local SVI IP address so that it can be accessible from remote VTEPs"; + } } }