From 37410a6285223a871700698f11a12a6856b7b3c7 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 12 Dec 2021 13:44:20 +0100 Subject: bgp: smoketest: add proper peer-group assignment tests In the past a peer-group was only assigned to the BGP process but not bound to any neighbor. This has been changed. (cherry picked from commit ab27bb6edd44e5ab49c1bab28c9a6bc2cafb2e36) --- smoketest/scripts/cli/test_protocols_bgp.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'smoketest/scripts/cli/test_protocols_bgp.py') diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py index 073064939..afb74f2a5 100755 --- a/smoketest/scripts/cli/test_protocols_bgp.py +++ b/smoketest/scripts/cli/test_protocols_bgp.py @@ -46,6 +46,7 @@ neighbor_config = { 'no_cap_nego' : '', 'port' : '667', 'cap_strict' : '', + 'peer_group' : 'foo', }, '192.0.2.3' : { # XXX: not available in current Perl backend @@ -54,6 +55,7 @@ neighbor_config = { 'passive' : '', 'multi_hop' : '5', 'update_src' : 'lo', + 'peer_group' : 'foo_bar_baz', }, } @@ -67,7 +69,8 @@ peer_group_config = { # XXX: not available in current Perl backend # 'ttl_security': '5', }, - 'bar' : { +# XXX: Perl backend supports no hyphens in peer-group names + 'foo_bar' : { # XXX: not available in current Perl backend # 'description' : 'foo peer bar group', 'remote_as' : '200', @@ -75,7 +78,8 @@ peer_group_config = { 'no_cap_nego' : '', 'local_as' : '300', }, - 'baz' : { +# XXX: Perl backend supports no hyphens in peer-group names + 'foo_bar_baz' : { 'cap_dynamic' : '', 'cap_ext_next': '', 'remote_as' : '200', @@ -85,6 +89,7 @@ peer_group_config = { }, } + def getFRRBGPconfig(): return cmd(f'vtysh -c "show run" | sed -n "/router bgp {ASN}/,/^!/p"') @@ -231,6 +236,10 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase): if 'update_src' in config: self.cli_set(base_path + ['peer-group', peer_group, 'update-source', config["update_src"]]) + for peer, peer_config in neighbor_config.items(): + if 'peer_group' in peer_config: + self.cli_set(base_path + ['neighbor', peer, 'peer-group', peer_config['peer_group']]) + # commit changes self.cli_commit() @@ -242,6 +251,10 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase): self.assertIn(f' neighbor {peer_group} peer-group', frrconfig) self.verify_frr_config(peer, peer_config, frrconfig) + for peer, peer_config in neighbor_config.items(): + if 'peer_group' in peer_config: + self.assertIn(f' neighbor {peer} peer-group {peer_config["peer_group"]}', frrconfig) + def test_bgp_04_afi_ipv4(self): networks = { @@ -313,7 +326,7 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase): 'network', network]) if 'summary_only' in network_config: self.cli_set(base_path + ['address-family', 'ipv6-unicast', - 'aggregate-address', network, 'summary-only']) + 'aggregate-address', network, 'summary-only']) # commit changes self.cli_commit() -- cgit v1.2.3