summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhramshinr <khramshinr@gmail.com>2024-03-29 22:38:27 +0800
committerkhramshinr <khramshinr@gmail.com>2024-03-29 22:38:27 +0800
commit84f05b1dd41bea5de16d707aa77a467f8d499323 (patch)
treef8e9abe0c13355b8200c987304512d2049c7914d
parentf30a22ebde92302916282be4fe40489efaaf3b3e (diff)
downloadvyos-1x-84f05b1dd41bea5de16d707aa77a467f8d499323.tar.gz
vyos-1x-84f05b1dd41bea5de16d707aa77a467f8d499323.zip
bgp: T6106: Valid commit error for route-reflector-client option defined in peer-group
changed exception condition Improved route_reflector_client test
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py7
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py8
2 files changed, 11 insertions, 4 deletions
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index 5f238b25a..e8556cf44 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -1241,6 +1241,13 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
with self.assertRaises(ConfigSessionError) as e:
self.cli_commit()
+ self.cli_set(base_path + ['peer-group', 'peer1', 'remote-as', 'internal'])
+ self.cli_commit()
+
+ conf = self.getFRRconfig(' address-family l2vpn evpn')
+
+ self.assertIn('neighbor peer1 route-reflector-client', conf)
+
def test_bgp_99_bmp(self):
target_name = 'instance-bmp'
target_address = '127.0.0.1'
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index f1c59cbde..512fa26e9 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -450,15 +450,15 @@ def verify(bgp):
verify_route_map(afi_config['route_map'][tmp], bgp)
if 'route_reflector_client' in afi_config:
- if 'remote_as' in peer_config and peer_config['remote_as'] != 'internal' and peer_config['remote_as'] != bgp['system_as']:
+ peer_group_as = peer_config.get('remote_as')
+
+ if peer_group_as is None or (peer_group_as != 'internal' and peer_group_as != bgp['system_as']):
raise ConfigError('route-reflector-client only supported for iBGP peers')
else:
if 'peer_group' in peer_config:
peer_group_as = dict_search(f'peer_group.{peer_group}.remote_as', bgp)
- if peer_group_as != None and peer_group_as != 'internal' and peer_group_as != bgp['system_as']:
+ if peer_group_as is None or (peer_group_as != 'internal' and peer_group_as != bgp['system_as']):
raise ConfigError('route-reflector-client only supported for iBGP peers')
- else:
- raise ConfigError('route-reflector-client only supported for iBGP peers')
# Throw an error if a peer group is not configured for allow range
for prefix in dict_search('listen.range', bgp) or []: