summaryrefslogtreecommitdiff
path: root/tests/topotests/mgmt_oper/oper.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/topotests/mgmt_oper/oper.py')
-rw-r--r--tests/topotests/mgmt_oper/oper.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/topotests/mgmt_oper/oper.py b/tests/topotests/mgmt_oper/oper.py
index bca452d011..6e1866382b 100644
--- a/tests/topotests/mgmt_oper/oper.py
+++ b/tests/topotests/mgmt_oper/oper.py
@@ -62,7 +62,7 @@ def disable_debug(router):
router.vtysh_cmd("no debug northbound callbacks configuration")
-@retry(retry_timeout=30, initial_wait=1)
+@retry(retry_timeout=30, initial_wait=0.1)
def _do_oper_test(tgen, qr, seconds_left=None):
r1 = tgen.gears["r1"].net
@@ -113,6 +113,7 @@ def _do_oper_test(tgen, qr, seconds_left=None):
"-------DIFF---------\n%s\n---------DIFF----------",
pprint.pformat(cmpout),
)
+ cmpout = str(cmpout)
else:
cmpout = tt_json_cmp(ojson, ejson, exact=True)
if cmpout and ejson_alt is not None:
@@ -186,6 +187,20 @@ def addrgen(a, count, step=1):
@retry(retry_timeout=30, initial_wait=0.1)
+def check_kernel_net(r1, net, vrf):
+ addr = ipaddress.ip_network(net)
+ vrfstr = f" vrf {vrf}" if vrf else ""
+ if addr.version == 6:
+ kernel = r1.cmd_raises(f"ip -6 route show{vrfstr}")
+ else:
+ kernel = r1.cmd_raises(f"ip -4 route show{vrfstr}")
+
+ nentries = len(re.findall("\n", kernel))
+ logging.info("checking kernel routing table%s: (%s entries)", vrfstr, nentries)
+ assert str(net) in kernel, f"Failed to find '{net}' in {nentries} entries"
+
+
+@retry(retry_timeout=30, initial_wait=0.1)
def check_kernel_32(r1, start_addr, count, vrf, step=1):
start = ipaddress.ip_address(start_addr)
vrfstr = f" vrf {vrf}" if vrf else ""