diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2026-06-15 14:18:10 +0300 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2026-06-25 11:28:11 +0300 |
| commit | f04dfac8772c7a1326bad4f12ec3aedea9a4d8d9 (patch) | |
| tree | 3f58e675420a3daf4a04dc07f03af35e4f4385eb /smoketest/scripts/cli | |
| parent | d3826867554eb9dbd30d5c8c781516a8afcfd96b (diff) | |
| download | vyos-1x-f04dfac8772c7a1326bad4f12ec3aedea9a4d8d9.tar.gz vyos-1x-f04dfac8772c7a1326bad4f12ec3aedea9a4d8d9.zip | |
bgp: T5526: Fix BGP neighbor validation not raising when interface does not exist
Validation of interface-based BGP neighbors relied on checking physical
interface existence, which silently skipped the check when interface didn't
exist yet, letting invalid config reach FRR. Fix by checking whether the
neighbor is not an IP address instead, and improve the error messages to
show the correct command.
Diffstat (limited to 'smoketest/scripts/cli')
| -rwxr-xr-x | smoketest/scripts/cli/test_protocols_bgp.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py index 680829bce..5c2b724e6 100755 --- a/smoketest/scripts/cli/test_protocols_bgp.py +++ b/smoketest/scripts/cli/test_protocols_bgp.py @@ -1841,6 +1841,40 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase): self.assertIn(f' rt vpn import {ASN}:300', frrconfig) self.assertNotIn('route-target vpn', frrconfig) + def test_bgp_34_interface_neighbor(self): + peer_group = 'TESTPG' + interface = 'eth0' + self.cli_set(base_path + ['peer-group', peer_group, 'remote-as', ASN]) + + # Setting peer-group directly on an interface neighbor must be rejected + self.cli_set(base_path + ['neighbor', interface, 'peer-group', peer_group]) + with self.assertRaises(ConfigSessionError): + self.cli_commit() + self.cli_delete(base_path + ['neighbor', interface, 'peer-group']) + + # Correct syntax: peer-group under the interface sub-node must succeed + self.cli_set( + base_path + ['neighbor', interface, 'interface', 'peer-group', peer_group] + ) + self.cli_commit() + + # Remove remote-as from peer-group so the neighbor resolves it via interface node + self.cli_delete(base_path + ['peer-group', peer_group, 'remote-as']) + + # remote-as set directly on an interface neighbor must be rejected + self.cli_set(base_path + ['neighbor', interface, 'remote-as', ASN]) + with self.assertRaises(ConfigSessionError): + self.cli_commit() + self.cli_delete(base_path + ['neighbor', interface, 'remote-as']) + + # Correct syntax: remote-as under the interface sub-node must succeed + self.cli_set(base_path + ['neighbor', interface, 'interface', 'remote-as', ASN]) + self.cli_commit() + frrconfig = self.getFRRconfig(f'router bgp {ASN}', stop_section='^exit') + self.assertIn( + f' neighbor {interface} interface peer-group {peer_group}', frrconfig + ) + def test_bgp_99_bmp(self): target_name = 'instance-bmp' target_address = '127.0.0.1' |
