diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-06-23 19:18:35 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-06-23 19:18:35 +0200 |
commit | d9a34de19f2e447ef20efe8429d7d5d9c10f8821 (patch) | |
tree | 6e3a033d1c19adc9a8a84257933e5ba6bac7c9d9 /tests | |
parent | Merge pull request #6625 from ton31337/fix/network_check_import_for_static_bgp (diff) | |
download | frr-d9a34de19f2e447ef20efe8429d7d5d9c10f8821.tar.xz frr-d9a34de19f2e447ef20efe8429d7d5d9c10f8821.zip |
tests: the pbr topo1 test is failing gather data to help debug
This may be expanded in the future as we figure out more things
to gather when the test has gone south.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/topotests/pbr-topo1/test_pbr_topo1.py | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/tests/topotests/pbr-topo1/test_pbr_topo1.py b/tests/topotests/pbr-topo1/test_pbr_topo1.py index 63d1f26d1..a0ee6377c 100755 --- a/tests/topotests/pbr-topo1/test_pbr_topo1.py +++ b/tests/topotests/pbr-topo1/test_pbr_topo1.py @@ -144,7 +144,9 @@ def test_pbr_data(): test_func = partial(topotest.router_json_cmp, router, "show pbr interface json", expected) _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) assertmsg = '"show pbr interface" mismatches on {}'.format(router.name) - assert result is None, assertmsg + if result is not None: + gather_pbr_data_on_error(router) + assert result is None, assertmsg map_file = "{}/{}/pbr-map.json".format(CWD, router.name) logger.info(map_file) @@ -156,7 +158,9 @@ def test_pbr_data(): test_func = partial(topotest.router_json_cmp, router, "show pbr map json", expected) _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) assertmsg = '"show pbr map" mismatches on {}'.format(router.name) - assert result is None, assertmsg + if result is not None: + gather_pbr_data_on_error(router) + assert result is None, assertmsg nexthop_file = "{}/{}/pbr-nexthop-groups.json".format(CWD, router.name) logger.info(nexthop_file) @@ -168,7 +172,9 @@ def test_pbr_data(): test_func = partial(topotest.router_json_cmp, router, "show pbr nexthop-groups json", expected) _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) assertmsg = '"show pbr nexthop-groups" mismatches on {}'.format(router.name) - assert result is None, assertmsg + if result is not None: + gather_pbr_data_on_error(router) + assert result is None, assertmsg def test_pbr_flap(): "Test PBR interface flapping" @@ -203,7 +209,9 @@ def test_pbr_flap(): test_func = partial(topotest.router_json_cmp, router, "show pbr interface json", expected) _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) assertmsg = '"show pbr interface" mismatches on {}'.format(router.name) - assert result is None, assertmsg + if result is not None: + gather_pbr_data_on_error(router) + assert result is None, assertmsg def test_rule_linux_installation(): @@ -230,3 +238,24 @@ def test_rule_linux_installation(): if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) + +# +# EXTRA SAUCE +# +def gather_pbr_data_on_error(router): + logger.info(router.vtysh_cmd("show ip route")) + logger.info(router.vtysh_cmd("show ip nexthop")) + logger.info(router.vtysh_cmd("show pbr interface")) + logger.info(router.vtysh_cmd("show pbr map")) + logger.info(router.vtysh_cmd("show pbr nexthop-groups")) + logger.info(router.vtysh_cmd("show nexthop-group rib singleton")) + logger.info(router.vtysh_cmd("show nexthop-group rib")) + logger.info(router.run("ip nexthop show")) + logger.info(router.run("ip route show")) + logger.info(router.run("ip route show table 10000")) + logger.info(router.run("ip route show table 10001")) + logger.info(router.run("ip route show table 10002")) + logger.info(router.run("ip route show table 10003")) + logger.info(router.run("ip route show table 10004")) + logger.info(router.run("ip rule show")) + |