summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2026-05-26 18:27:56 +0300
committerNataliia Solomko <natalirs1985@gmail.com>2026-06-09 18:41:56 +0300
commitb49e8f00560bdbd69f85539396afb6391b281519 (patch)
tree57990da78f634de549947fd28f408a137061aaa7 /smoketest/scripts/cli
parent6a5f1961cde6116457cb9e6b958bee7b66603c3b (diff)
downloadvyos-1x-b49e8f00560bdbd69f85539396afb6391b281519.tar.gz
vyos-1x-b49e8f00560bdbd69f85539396afb6391b281519.zip
bgp: T8223: Prevent `advertise-all-vni` in multiple BGP VRF instances simultaneously
FRR only allows one BGP instance to hold `advertise-all-vni` at a time (FRR issue #9405). When a default BGP instance is present it is always started before named VRF instances, so if a named VRF holds the flag FRR silently rejects it on every boot (regardless of default EVPN config), causing the running config to diverge from what is stored in VyOS. Enforce the following policy in verify(): - Default BGP instance may always hold `advertise-all-vni`. - A named VRF may hold it only when no default BGP instance exists. - Only one BGP instance (default or named VRF) may hold it at a time. The default BGP verify path additionally scans dependent VRFs so that adding or modifying the default BGP instance while a named VRF already holds the flag is caught even when the VRF node is not part of the current commit.
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index c7c0dc6f0..e9f615921 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -1018,6 +1018,78 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
for route_target in route_targets:
self.assertIn(f' ead-es-route-target export {route_target}', frrconfig)
+ def test_bgp_08_l2vpn_evpn_advertise_all_vni_restriction(self):
+ # T8223: FRR only allows advertise-all-vni in one BGP instance at a time
+ # (FRR issue #9405).
+ vrf = 'VRF-A'
+ vrf2 = 'VRF-B'
+ vrf_path = ['vrf', 'name', vrf]
+ vrf2_path = ['vrf', 'name', vrf2]
+
+ # advertise-all-vni in default BGP is valid
+ self.cli_set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-all-vni'])
+ self.cli_commit()
+
+ # Verify FRR bgpd configuration
+ frrconfig = self.getFRRconfig(f'router bgp {ASN}', stop_section='^exit')
+ self.assertIn(f'router bgp {ASN}', frrconfig)
+ self.assertIn(' advertise-all-vni', frrconfig)
+
+ # delete advertise-all-vni
+ self.cli_delete(
+ base_path + ['address-family', 'l2vpn-evpn', 'advertise-all-vni']
+ )
+ self.cli_commit()
+
+ # advertise-all-vni in a named VRF is rejected when default BGP exists
+ self.cli_set(vrf_path + ['table', '1001'])
+ self.cli_set(vrf_path + ['protocols', 'bgp', 'system-as', ASN])
+ self.cli_set(
+ vrf_path
+ + ['protocols', 'bgp', 'address-family', 'l2vpn-evpn', 'advertise-all-vni']
+ )
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+
+ self.cli_delete(base_path)
+ self.cli_delete(vrf_path)
+ self.cli_commit()
+
+ # reapply VRF and advertise-all-vni in VRF
+ self.cli_set(vrf_path + ['table', '1001'])
+ self.cli_set(vrf_path + ['protocols', 'bgp', 'system-as', ASN])
+ self.cli_set(
+ vrf_path
+ + ['protocols', 'bgp', 'address-family', 'l2vpn-evpn', 'advertise-all-vni']
+ )
+ self.cli_commit()
+
+ # Verify BGP VRF configuration
+ frr_vrf_config = self.getFRRconfig(
+ f'router bgp {ASN} vrf {vrf}', stop_section='^exit'
+ )
+ self.assertIn(f'router bgp {ASN} vrf {vrf}', frr_vrf_config)
+ self.assertIn(' advertise-all-vni', frr_vrf_config)
+
+ # two named VRFs cannot both have advertise-all-vni simultaneously
+ self.cli_set(vrf2_path + ['table', '1002'])
+ self.cli_set(vrf2_path + ['protocols', 'bgp', 'system-as', ASN])
+ self.cli_set(
+ vrf2_path
+ + ['protocols', 'bgp', 'address-family', 'l2vpn-evpn', 'advertise-all-vni']
+ )
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+ self.cli_delete(vrf2_path)
+
+ # default BGP is rejected when a named VRF has advertise-all-vni
+ self.cli_set(base_path + ['system-as', ASN])
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+
+ # delete advertise-all-vni from VRF and verify default BGP can be created
+ self.cli_delete(vrf_path + ['protocols', 'bgp', 'address-family'])
+ self.cli_commit()
def test_bgp_09_distance_and_flowspec(self):
distance_external = '25'