]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: add iproute2 API guard to svd test 12364/head
authorStephen Worley <sworley@nvidia.com>
Mon, 13 Feb 2023 23:09:54 +0000 (18:09 -0500)
committerStephen Worley <sworley@nvidia.com>
Mon, 13 Feb 2023 23:12:05 +0000 (18:12 -0500)
Add a iproute2 API guard to the SVD test using `bridge fdb get`.

While it SHOULD be present on most systems based on their kernel
version it may not be present due to kernel/iproute2 version mismatch
weirdness.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
tests/topotests/bgp_evpn_vxlan_svd_topo1/test_bgp_evpn_vxlan_svd.py
tests/topotests/lib/topotest.py

index ae0b67ac655e649aac2ecc1239b39119d3dcdacf..f8af210ed73a257c4c275c50c5e84c24ce4d7d5f 100755 (executable)
@@ -205,6 +205,9 @@ def check_vni_macs_present(tgen, router, vni, maclist):
     return None
 
 def check_flood_entry_present(pe, vni, vtep):
+    if not topotest.iproute2_is_fdb_get_capable():
+        return None
+
     output = pe.run("bridge fdb get 00:00:00:00:00:00 dev vxlan0 vni {} self".format(vni))
 
     if str(vtep) not in output:
index 7f68b4ccf3e2760faf5d4c3ae27794ad41198e26..699b53303a3d2c8dbf5e038f85aa69e2183a34d0 100644 (file)
@@ -595,6 +595,29 @@ def iproute2_is_vrf_capable():
             pass
     return False
 
+def iproute2_is_fdb_get_capable():
+    """
+    Checks if the iproute2 version installed on the system is capable of
+    handling `bridge fdb get` commands to query neigh table resolution.
+
+    Returns True if capability can be detected, returns False otherwise.
+    """
+
+    if is_linux():
+        try:
+            subp = subprocess.Popen(
+                ["bridge", "fdb", "get", "help"],
+                stdout=subprocess.PIPE,
+                stderr=subprocess.PIPE,
+                stdin=subprocess.PIPE,
+            )
+            iproute2_out = subp.communicate()[1].splitlines()[0].split()[0]
+
+            if "Usage" in str(iproute2_out):
+                return True
+        except Exception:
+            pass
+    return False
 
 def module_present_linux(module, load):
     """