From 3082b678c88f74801fc4e9a57e23f25a53619467 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 25 Jan 2021 19:53:04 +0100 Subject: smoketest: bgp: add rpki tests --- smoketest/scripts/cli/test_protocols_bgp.py | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'smoketest/scripts') diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py index 66ca3cdd7..87d10eb85 100755 --- a/smoketest/scripts/cli/test_protocols_bgp.py +++ b/smoketest/scripts/cli/test_protocols_bgp.py @@ -98,6 +98,9 @@ peer_group_config = { def getFRRBGPconfig(): return cmd(f'vtysh -c "show run" | sed -n "/router bgp {ASN}/,/^!/p"') +def getFRRRPKIconfig(): + return cmd(f'vtysh -c "show run" | sed -n "/rpki/,/^!/p"') + class TestProtocolsBGP(unittest.TestCase): def setUp(self): self.session = ConfigSession(os.getpid()) @@ -416,5 +419,39 @@ class TestProtocolsBGP(unittest.TestCase): for prefix in listen_ranges: self.assertIn(f' bgp listen range {prefix} peer-group {peer_group}', frrconfig) + + def test_bgp_07_rpki(self): + rpki_path = ['protocols', 'rpki'] + init_tmo = '50' + polling = '400' + preference = '100' + timeout = '900' + + cache = { + 'foo' : { 'address' : '1.1.1.1', 'port' : '8080' }, +# T3253 only one peer supported +# 'bar' : { 'address' : '2.2.2.2', 'port' : '9090' }, + } + + self.session.set(rpki_path + ['polling-period', polling]) + self.session.set(rpki_path + ['preference', preference]) + + for name, config in cache.items(): + self.session.set(rpki_path + ['cache', name, 'address', config['address']]) + self.session.set(rpki_path + ['cache', name, 'port', config['port']]) + + # commit changes + self.session.commit() + + # Verify FRR bgpd configuration + frrconfig = getFRRRPKIconfig() + self.assertIn(f'rpki polling_period {polling}', frrconfig) + + for name, config in cache.items(): + self.assertIn('rpki cache {address} {port} preference 1'.format(**config), frrconfig) + + self.session.delete(rpki_path) + + if __name__ == '__main__': unittest.main(verbosity=2) -- cgit v1.2.3