From: Donatas Abraitis Date: Thu, 2 Dec 2021 15:02:23 +0000 (+0200) Subject: tests: Test if BGP session is up additionally for route_server_client setup X-Git-Tag: frr-8.2.2~182^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=a4051cb28375a6c2653c7da2618071d8192a69ce;p=mirror_frr.git tests: Test if BGP session is up additionally for route_server_client setup Lower connect timer to 5 seconds as well. ``` FAILED test_bgp_route_server_client.py::test_bgp_route_server_client - AssertionError: Cannot see BGP GUA next hop from r3 in r1 ``` ``` 2021-12-02 14:41:21,115 INFO: topolog.r1: vtysh command => "show bgp 2001:db8:f::3/128 json" 2021-12-02 14:41:21,115 DEBUG: topolog.r1: LinuxNamespace(r1): cmd_status("['/bin/bash', '-c', 'vtysh -c "show bgp 2001:db8:f::3/128 json" 2>/dev/null']", kwargs: {'encoding': 'utf-8', 'stdout': -1, 'stderr': -2, 'shell': False, 'stdin': None}) 2021-12-02 14:41:21,159 INFO: topolog.r1: vtysh result: { } ``` At least can't reproduce a failure locally (before managed to catch it). Ran >2000 times, no failure. Signed-off-by: Donatas Abraitis --- diff --git a/tests/topotests/bgp_route_server_client/r1/bgpd.conf b/tests/topotests/bgp_route_server_client/r1/bgpd.conf index d6c83079f..9826b671f 100644 --- a/tests/topotests/bgp_route_server_client/r1/bgpd.conf +++ b/tests/topotests/bgp_route_server_client/r1/bgpd.conf @@ -4,6 +4,7 @@ router bgp 65001 no bgp ebgp-requires-policy neighbor 2001:db8:1::1 remote-as external neighbor 2001:db8:1::1 timers 3 10 + neighbor 2001:db8:1::1 timers connect 5 address-family ipv6 unicast redistribute connected neighbor 2001:db8:1::1 activate diff --git a/tests/topotests/bgp_route_server_client/r2/bgpd.conf b/tests/topotests/bgp_route_server_client/r2/bgpd.conf index bdcae4a99..3b0a24b8b 100644 --- a/tests/topotests/bgp_route_server_client/r2/bgpd.conf +++ b/tests/topotests/bgp_route_server_client/r2/bgpd.conf @@ -3,8 +3,10 @@ router bgp 65000 view RS no bgp ebgp-requires-policy neighbor 2001:db8:1::2 remote-as external neighbor 2001:db8:1::2 timers 3 10 + neighbor 2001:db8:1::2 timers connect 5 neighbor 2001:db8:3::2 remote-as external neighbor 2001:db8:3::2 timers 3 10 + neighbor 2001:db8:3::2 timers connect 5 address-family ipv6 unicast redistribute connected neighbor 2001:db8:1::2 activate diff --git a/tests/topotests/bgp_route_server_client/r3/bgpd.conf b/tests/topotests/bgp_route_server_client/r3/bgpd.conf index 4b565e7b7..60a5ffc55 100644 --- a/tests/topotests/bgp_route_server_client/r3/bgpd.conf +++ b/tests/topotests/bgp_route_server_client/r3/bgpd.conf @@ -4,6 +4,7 @@ router bgp 65003 no bgp ebgp-requires-policy neighbor 2001:db8:3::1 remote-as external neighbor 2001:db8:3::1 timers 3 10 + neighbor 2001:db8:3::1 timers connect 5 address-family ipv6 unicast redistribute connected neighbor 2001:db8:3::1 activate diff --git a/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py b/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py index c11bc119e..21088f700 100644 --- a/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py +++ b/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py @@ -85,6 +85,15 @@ def test_bgp_route_server_client(): r2 = tgen.gears["r2"] def _bgp_converge(router): + output = json.loads(router.vtysh_cmd("show bgp ipv6 unicast summary json")) + expected = {"peers": {"2001:db8:1::1": {"state": "Established", "pfxRcd": 2}}} + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_converge, r1) + _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + assert result is None, "Cannot see BGP sessions to be up" + + def _bgp_prefix_received(router): output = json.loads(router.vtysh_cmd("show bgp 2001:db8:f::3/128 json")) expected = { "prefix": "2001:db8:f::3/128", @@ -92,7 +101,7 @@ def test_bgp_route_server_client(): } return topotest.json_cmp(output, expected) - test_func = functools.partial(_bgp_converge, r1) + test_func = functools.partial(_bgp_prefix_received, r1) _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) assert result is None, "Cannot see BGP GUA next hop from r3 in r1"