]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: the pbr topo1 test is failing gather data to help debug 6632/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 23 Jun 2020 17:18:35 +0000 (13:18 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 23 Jun 2020 17:18:35 +0000 (13:18 -0400)
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>
tests/topotests/pbr-topo1/test_pbr_topo1.py

index 63d1f26d1cc3783f9e5c266410ef00685c2526d7..a0ee6377c52e89001fa9b5aa04280b7cf45e037b 100755 (executable)
@@ -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"))
+