Commit 275fb7066a for frr
commit 275fb7066a6e9ab7593f2bcd60f6e722a68888f7
Author: Donald Sharp <sharpd@nvidia.com>
Date: Sat Oct 3 11:39:33 2026 -0400
tests: Add platform_has[vrf|evpn]
Add the ability to know if hte platform has these tests
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
diff --git a/tests/topotests/lib/ltemplate.py b/tests/topotests/lib/ltemplate.py
index e897a81035..8ad0b0870f 100644
--- a/tests/topotests/lib/ltemplate.py
+++ b/tests/topotests/lib/ltemplate.py
@@ -139,9 +139,15 @@ def setup_module(mod):
def teardown_module(mod):
global _lt
"Teardown the pytest environment"
+ # setup_module may have been skipped before this template created a
+ # topology. global_tgen can still point at the previous test on this
+ # worker, whose hosts are already gone.
+ if _lt is None:
+ return
+
tgen = get_topogen()
- if _lt != None and _lt.scriptdir != None and _lt.prestarthooksuccess == True:
+ if _lt.scriptdir != None and _lt.prestarthooksuccess == True:
luShowResults(logger.info)
print(luFinish())
diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py
index 0b41efe38a..2df5b0a3bb 100644
--- a/tests/topotests/lib/topotest.py
+++ b/tests/topotests/lib/topotest.py
@@ -777,6 +777,26 @@ def is_linux():
return False
+def platform_has_vrf():
+ """Return whether this platform can create VRFs.
+
+ Linux supports L3 VRFs. FreeBSD does not.
+ """
+ if sys.platform.startswith("linux"):
+ return True
+ return False
+
+
+def platform_has_evpn():
+ """Return whether this platform can run EVPN.
+
+ EVPN topotests need Linux bridge, VXLAN, and VRF support. FreeBSD does not.
+ """
+ if sys.platform.startswith("linux"):
+ return True
+ return False
+
+
def iproute2_is_json_capable():
"""
Checks if the iproute2 version installed on the system is capable of