summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-21 18:44:49 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-21 18:44:49 +0100
commit891bb78c1222d7acdff14d56c6c5aad0139536f3 (patch)
treeffe274224b89f0226b03f6fd762677ccf0bd8c17 /smoketest/scripts/cli
parenta80cd3058cb8d9a9152c8c205d41175056c6fa52 (diff)
downloadvyos-1x-891bb78c1222d7acdff14d56c6c5aad0139536f3.tar.gz
vyos-1x-891bb78c1222d7acdff14d56c6c5aad0139536f3.zip
bgp: T1875: validate() that peer-group specified via listen range exists
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index ccb9268fe..fef32741e 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -336,5 +336,35 @@ class TestProtocolsBGP(unittest.TestCase):
self.assertIn(f' aggregate-address {network} summary-only', frrconfig)
+ def test_bgp_06_listen_range(self):
+ # Implemented via T1875
+ limit = '64'
+ listen_ranges = ['192.0.2.0/25', '192.0.2.128/25']
+ peer_group = 'listenfoobar'
+ self.session.set(base_path + ['listen', 'limit', limit])
+ for prefix in listen_ranges:
+ self.session.set(base_path + ['listen', 'range', prefix])
+ # check validate() - peer-group must be defined for range/prefix
+ with self.assertRaises(ConfigSessionError):
+ self.session.commit()
+ self.session.set(base_path + ['listen', 'range', prefix, 'peer-group', peer_group])
+
+ # check validate() - peer-group does yet not exist!
+ with self.assertRaises(ConfigSessionError):
+ self.session.commit()
+ self.session.set(base_path + ['peer-group', peer_group, 'remote-as', ASN])
+
+ # commit changes
+ self.session.commit()
+
+ # Verify FRR bgpd configuration
+ frrconfig = getFRRBGPconfig()
+ self.assertIn(f'router bgp {ASN}', frrconfig)
+ self.assertIn(f' neighbor {peer_group} peer-group', frrconfig)
+ self.assertIn(f' neighbor {peer_group} remote-as {ASN}', frrconfig)
+ self.assertIn(f' bgp listen limit {limit}', frrconfig)
+ for prefix in listen_ranges:
+ self.assertIn(f' bgp listen range {prefix} peer-group {peer_group}', frrconfig)
+
if __name__ == '__main__':
unittest.main(verbosity=2)