From 068dfd62a2f8bb14a204372dc3d15a78c866a276 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 29 Jul 2022 13:40:36 -0400 Subject: [PATCH] tests: Fix test_ospf_topo1 as that it sometimes fails This test is sometimes failing when it looks at the v6 routes in the fib. Since the step before is ensuring that v3 ospf has just converged let's give it a bit of time to find and see if things have had a chance to install the routes too. Signed-off-by: Donald Sharp --- tests/topotests/ospf_topo1/test_ospf_topo1.py | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tests/topotests/ospf_topo1/test_ospf_topo1.py b/tests/topotests/ospf_topo1/test_ospf_topo1.py index e2a6ff64a4..37facfc5da 100644 --- a/tests/topotests/ospf_topo1/test_ospf_topo1.py +++ b/tests/topotests/ospf_topo1/test_ospf_topo1.py @@ -316,17 +316,26 @@ def test_ospf6_kernel_route(): for router in rlist: logger.info('Checking OSPF IPv6 kernel routes in "%s"', router.name) - routes = topotest.ip6_route(router) - expected = { - "2001:db8:1::/64": {}, - "2001:db8:2::/64": {}, - "2001:db8:3::/64": {}, - "2001:db8:100::/64": {}, - "2001:db8:200::/64": {}, - "2001:db8:300::/64": {}, - } + def _routes_in_fib6(): + routes = topotest.ip6_route(router) + expected = { + "2001:db8:1::/64": {}, + "2001:db8:2::/64": {}, + "2001:db8:3::/64": {}, + "2001:db8:100::/64": {}, + "2001:db8:200::/64": {}, + "2001:db8:300::/64": {}, + } + logger.info("Routes:") + logger.info(routes) + logger.info(topotest.json_cmp(routes, expected)) + logger.info("ENd:") + return topotest.json_cmp(routes, expected) + + _, result = topotest.run_and_expect(_routes_in_fib6, None, count=20, wait=1) + assertmsg = 'OSPF IPv6 route mismatch in router "{}"'.format(router.name) - assert topotest.json_cmp(routes, expected) is None, assertmsg + assert result is None, assertmsg def test_ospf_json(): @@ -337,6 +346,7 @@ def test_ospf_json(): for rnum in range(1, 5): router = tgen.gears["r{}".format(rnum)] + logger.info(router.vtysh_cmd("show ip ospf database")) logger.info('Comparing router "%s" "show ip ospf json" output', router.name) expected = { "routerId": "10.0.255.{}".format(rnum), -- 2.39.5