diff options
| author | Stephen Worley <sworley@nvidia.com> | 2023-02-13 18:09:54 -0500 |
|---|---|---|
| committer | Stephen Worley <sworley@nvidia.com> | 2023-02-13 18:12:05 -0500 |
| commit | 51c33a572442719a66c9f7e4582a22049cb2156f (patch) | |
| tree | 3732e659525c376e81da757ff8a595c126848d0e /tests/topotests/lib/topotest.py | |
| parent | cc07a819e47d9e151d49e44b627bad0f67fff87d (diff) | |
tests: add iproute2 API guard to svd test
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>
Diffstat (limited to 'tests/topotests/lib/topotest.py')
| -rw-r--r-- | tests/topotests/lib/topotest.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 7f68b4ccf3..699b53303a 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -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): """ |
