summaryrefslogtreecommitdiff
path: root/tests/topotests/lib/topotest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/topotests/lib/topotest.py')
-rw-r--r--tests/topotests/lib/topotest.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py
index 087d8454fc..5a8c2e5964 100644
--- a/tests/topotests/lib/topotest.py
+++ b/tests/topotests/lib/topotest.py
@@ -602,6 +602,30 @@ def is_linux():
return False
+def iproute2_is_json_capable():
+ """
+ Checks if the iproute2 version installed on the system is capable of
+ handling JSON outputss
+
+ Returns True if capability can be detected, returns False otherwise.
+ """
+ if is_linux():
+ try:
+ subp = subprocess.Popen(
+ ["ip", "-json", "route", "show"],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ stdin=subprocess.PIPE,
+ )
+ iproute2_err = subp.communicate()[1].splitlines()[0].split()[0]
+
+ if iproute2_err != "Error:":
+ return True
+ except Exception:
+ pass
+ return False
+
+
def iproute2_is_vrf_capable():
"""
Checks if the iproute2 version installed on the system is capable of
@@ -1406,7 +1430,7 @@ class Router(Node):
self.daemondir = None
self.hasmpls = False
self.routertype = "frr"
- self.unified_config = None
+ self.unified_config = False
self.daemons = {
"zebra": 0,
"ripd": 0,
@@ -1629,7 +1653,7 @@ class Router(Node):
# print "Daemons before:", self.daemons
if daemon in self.daemons.keys() or daemon == "frr":
if daemon == "frr":
- self.unified_config = 1
+ self.unified_config = True
else:
self.daemons[daemon] = 1
if param is not None: