diff options
| author | Oleksandr Kuchmystyi <o.kuchmystyi@vyos.io> | 2026-04-30 15:57:27 +0300 |
|---|---|---|
| committer | Oleksandr Kuchmystyi <o.kuchmystyi@vyos.io> | 2026-06-22 15:36:19 +0300 |
| commit | d90693fd0da03f8de4ccc4a5a85e2f2c9823e682 (patch) | |
| tree | b4f1dc220fab2047bbd88c3cc27b6040974e7373 /smoketest/scripts | |
| parent | 02f8c17a56518157e48048fb39b69f373ee9c829 (diff) | |
| download | vyos-1x-d90693fd0da03f8de4ccc4a5a85e2f2c9823e682.tar.gz vyos-1x-d90693fd0da03f8de4ccc4a5a85e2f2c9823e682.zip | |
pseudo-ethernet: T8540: Add anycast-gateway support for EVPN
Introduce 'anycast-gateway' leafNode for pseudo-ethernet interfaces.
When set, a local FDB entry is installed on the parent bridge to
prevent the shared anycast MAC from leaking over the VXLAN overlay.
Diffstat (limited to 'smoketest/scripts')
| -rwxr-xr-x | smoketest/scripts/cli/test_interfaces_pseudo-ethernet.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_pseudo-ethernet.py b/smoketest/scripts/cli/test_interfaces_pseudo-ethernet.py index 3be8e024f..c70d19474 100755 --- a/smoketest/scripts/cli/test_interfaces_pseudo-ethernet.py +++ b/smoketest/scripts/cli/test_interfaces_pseudo-ethernet.py @@ -19,6 +19,8 @@ import unittest from base_interfaces_test import BasicInterfaceTest from base_vyostest_shim import VyOSUnitTestSHIM +from vyos.configsession import ConfigSessionError +from vyos.utils.process import cmd from vyos.ifconfig import Section @@ -44,5 +46,55 @@ class PEthInterfaceTest(BasicInterfaceTest.TestCase): # call base-classes classmethod super(PEthInterfaceTest, cls).setUpClass() + def test_anycast_gateway(self): + # Create the underlying bridge and sub-interface in the test + + for i, peth in enumerate(self._interfaces): + eth = peth[1:] # Convert peth0 -> eth0 + br = f'br{i}' + vlan = str(i + 100) + + # Format the MAC using index as a two-digit hexadecimal + mac_address = f'00:aa:aa:aa:aa:{i:02x}' + + with self.subTest(peth=peth, eth=eth, mac_address=mac_address, i=i): + base_bridge_path = ['interfaces', 'bridge', br] + base_br_member_path = base_bridge_path + ['member', 'interface'] + + self.cli_set(base_bridge_path + ['enable-vlan']) + self.cli_set(base_br_member_path + [eth, 'native-vlan', vlan]) + self.cli_set(base_br_member_path + [f'vxlan{i}']) + self.cli_set(base_bridge_path + ['vif', vlan]) + + self.cli_set( + self._base_path + [peth, 'source-interface', f'{br}.{vlan}'] + ) + self.cli_set(self._base_path + [peth, 'anycast-gateway']) + + # Anycast gateway requires MAC + with self.assertRaises(ConfigSessionError): + self.cli_commit() + + self.cli_set(self._base_path + [peth, 'mac', mac_address]) + self.cli_commit() + + # Verify FDB entry exists with flag + fdb = cmd(f'bridge fdb show dev {br}') + self.assertIn(f'{mac_address} master {br} permanent', fdb) + self.assertIn(f'{mac_address} self permanent', fdb) + + # Then remove just the anycast-gateway flag + self.cli_delete(self._base_path + [peth, 'anycast-gateway']) + self.cli_commit() + + fdb = cmd(f'bridge fdb show dev {br}') + self.assertNotIn(f'{mac_address} master {br} permanent', fdb) + + # Clean up temp bridge and peth + self.cli_delete(self._base_path + [peth]) + self.cli_delete(base_bridge_path) + self.cli_commit() + + if __name__ == '__main__': unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on()) |
