From: Donatas Abraitis Date: Mon, 12 Jun 2023 12:20:08 +0000 (+0300) Subject: tests: Check if `neighbor X advertised-routes` cmd works for peer-groups X-Git-Tag: base_9.1~348^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F13769%2Fhead;p=mirror%2Ffrr.git tests: Check if `neighbor X advertised-routes` cmd works for peer-groups Signed-off-by: Donatas Abraitis --- diff --git a/tests/topotests/bgp_peer_group/r3/bgpd.conf b/tests/topotests/bgp_peer_group/r3/bgpd.conf index eb2fca15fb..5a1340fb0b 100644 --- a/tests/topotests/bgp_peer_group/r3/bgpd.conf +++ b/tests/topotests/bgp_peer_group/r3/bgpd.conf @@ -1,7 +1,11 @@ ! router bgp 65003 - neighbor PG peer-group - neighbor PG remote-as external - neighbor PG timers 3 10 - neighbor 192.168.255.1 peer-group PG + no bgp ebgp-requires-policy + neighbor PG peer-group + neighbor PG remote-as external + neighbor PG timers 3 10 + neighbor 192.168.255.1 peer-group PG + address-family ipv4 unicast + redistribute connected + exit-address-family ! diff --git a/tests/topotests/bgp_peer_group/test_bgp_peer-group.py b/tests/topotests/bgp_peer_group/test_bgp_peer-group.py index e8c3feb76f..a91fade049 100644 --- a/tests/topotests/bgp_peer_group/test_bgp_peer-group.py +++ b/tests/topotests/bgp_peer_group/test_bgp_peer-group.py @@ -74,9 +74,26 @@ def test_bgp_peer_group(): return topotest.json_cmp(output, expected) test_func = functools.partial(_bgp_peer_group_configured) - success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + assert result is None, "Failed bgp convergence in r1" - assert result is None, 'Failed bgp convergence in "{}"'.format(tgen.gears["r1"]) + def _bgp_peer_group_check_advertised_routes(): + output = json.loads( + tgen.gears["r3"].vtysh_cmd("show ip bgp neighbor PG advertised-routes json") + ) + expected = { + "advertisedRoutes": { + "192.168.255.0/24": { + "valid": True, + "best": True, + } + } + } + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_peer_group_check_advertised_routes) + _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + assert result is None, "Failed checking advertised routes from r3" if __name__ == "__main__":