]> git.proxmox.com Git - mirror_frr.git/commitdiff
topotests: fix bgp lu explicit-null test
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 12 Apr 2023 13:55:52 +0000 (15:55 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 12 Apr 2023 15:45:52 +0000 (17:45 +0200)
The label value for the given prefix was ignored,
as the compare function always returns ok.
Do return the json compare output.

Fixes: eee086e6d24b ("topotests: add topotest to check bgp lu explicit-null service")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
tests/topotests/bgp_lu_explicitnull/test_bgp_lu_explicitnull.py

index d53ac68e84b399b87aaf768fd0de461fb6ddcd79..0656e1ed41e462fbaddf62c2755bdd149ed5903b 100644 (file)
@@ -115,11 +115,13 @@ def check_show_ip_label_prefix_found(router, ipversion, prefix, label):
     output = json.loads(
         router.vtysh_cmd("show {} route {} json".format(ipversion, prefix))
     )
-    expected = {prefix: [{"prefix": prefix, "nexthops": [{"fib": True, "labels": [label]}]}]}
-    ret = topotest.json_cmp(output, expected)
-    if ret is None:
-        return "not good"
-    return None
+    expected = {
+        prefix: [
+            {"prefix": prefix, "nexthops": [{"fib": True, "labels": [int(label)]}]}
+        ]
+    }
+    return topotest.json_cmp(output, expected)
+
 
 def test_converge_bgplu():
     "Wait for protocol convergence"
@@ -141,9 +143,7 @@ def test_converge_bgplu():
         "0",
     )
     success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
-    assert (
-        success
-    ), "r1, prefix 192.168.2.2/32 from r2 not present"
+    assert success, "r1, prefix 192.168.2.2/32 from r2 not present"
 
     # Check r2 gets prefix 192.168.2.1/32
     test_func = functools.partial(
@@ -154,9 +154,8 @@ def test_converge_bgplu():
         "0",
     )
     success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
-    assert (
-        success
-    ), "r2, prefix 192.168.2.1/32 from r1 not present"
+    assert success, "r2, prefix 192.168.2.1/32 from r1 not present"
+
 
 def test_traffic_connectivity():
     "Wait for protocol convergence"
@@ -168,7 +167,9 @@ def test_traffic_connectivity():
 
     def _check_ping(name, dest_addr, src_addr):
         tgen = get_topogen()
-        output = tgen.gears[name].run("ping {} -c 1 -w 1 -I {}".format(dest_addr, src_addr))
+        output = tgen.gears[name].run(
+            "ping {} -c 1 -w 1 -I {}".format(dest_addr, src_addr)
+        )
         logger.info(output)
         if " 0% packet loss" not in output:
             return True
@@ -180,6 +181,7 @@ def test_traffic_connectivity():
     success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
     assert result is None, "r1, ping to 192.168.2.2 from 192.168.2.1 fails"
 
+
 def test_memory_leak():
     "Run the memory leak test and report results."
     tgen = get_topogen()