diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-01-21 18:44:49 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-01-21 18:44:49 +0100 |
commit | 891bb78c1222d7acdff14d56c6c5aad0139536f3 (patch) | |
tree | ffe274224b89f0226b03f6fd762677ccf0bd8c17 /smoketest/scripts/cli/test_protocols_bgp.py | |
parent | a80cd3058cb8d9a9152c8c205d41175056c6fa52 (diff) | |
download | vyos-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/test_protocols_bgp.py')
-rwxr-xr-x | smoketest/scripts/cli/test_protocols_bgp.py | 30 |
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) |