summaryrefslogtreecommitdiffstats
path: root/tests/topotests/lib/common_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/topotests/lib/common_config.py')
-rw-r--r--tests/topotests/lib/common_config.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py
index 7787b6f7..f34c48b8 100644
--- a/tests/topotests/lib/common_config.py
+++ b/tests/topotests/lib/common_config.py
@@ -7,7 +7,6 @@
import functools
import ipaddress
-import json
import os
import platform
import socket
@@ -442,7 +441,7 @@ def check_router_status(tgen):
try:
router_list = tgen.routers()
- for router, rnode in router_list.items():
+ for _, rnode in router_list.items():
result = rnode.check_router_running()
if result != "":
daemons = []
@@ -686,7 +685,7 @@ def prep_load_config_to_routers(tgen, *config_name_list):
"""
routers = tgen.routers()
- for rname, router in routers.items():
+ for rname, _ in routers.items():
destname = "{}/{}/{}".format(tgen.logdir, rname, FRRCFG_FILE)
wmode = "w"
for cfbase in config_name_list:
@@ -871,7 +870,7 @@ def get_frr_ipv6_linklocal(tgen, router, intf=None, vrf=None):
"""
router_list = tgen.routers()
- for rname, rnode in router_list.items():
+ for rname, _ in router_list.items():
if rname != router:
continue
@@ -887,7 +886,7 @@ def get_frr_ipv6_linklocal(tgen, router, intf=None, vrf=None):
cmd = "show interface vrf {}".format(vrf)
else:
cmd = "show interface"
- for chk_ll in range(0, 60):
+ for _ in range(0, 60):
sleep(1 / 4)
ifaces = router_list[router].run('vtysh -c "{}"'.format(cmd))
# Fix newlines (make them all the same)
@@ -937,7 +936,7 @@ def generate_support_bundle():
tgen = get_topogen()
if tgen is None:
- logger.warn(
+ logger.warning(
"Support bundle attempted to be generated, but topogen is not being used"
)
return True
@@ -1848,7 +1847,13 @@ def retry(retry_timeout, initial_wait=0, expected=True, diag_pct=0.75):
while True:
seconds_left = (retry_until - datetime.now()).total_seconds()
try:
- ret = func(*args, **kwargs)
+ try:
+ ret = func(*args, seconds_left=seconds_left, **kwargs)
+ except TypeError as error:
+ if "seconds_left" not in str(error):
+ raise
+ ret = func(*args, **kwargs)
+
logger.debug("Function returned %s", ret)
negative_result = ret is False or is_string(ret)
@@ -1869,7 +1874,7 @@ def retry(retry_timeout, initial_wait=0, expected=True, diag_pct=0.75):
return saved_failure
except Exception as error:
- logger.info("Function raised exception: %s", str(error))
+ logger.info('Function raised exception: "%s"', repr(error))
ret = error
if seconds_left < 0 and saved_failure:
@@ -3095,7 +3100,7 @@ def configure_brctl(tgen, topo, input_dict):
"{} dev {} master {}".format(ip_cmd, brctl_name, vrf)
)
- for intf_name, data in topo["routers"][dut]["links"].items():
+ for _, data in topo["routers"][dut]["links"].items():
if "vrf" not in data:
continue
@@ -3366,7 +3371,7 @@ def verify_rib(
found_hops = [
rib_r["ip"]
for rib_r in rib_routes_json[st_rt][0]["nexthops"]
- if "ip" in rib_r
+ if "ip" in rib_r and "active" in rib_r
]
# If somehow key "ip" is not found in nexthops JSON
@@ -4942,7 +4947,7 @@ def scapy_send_raw_packet(tgen, topo, senderRouter, intf, packet=None):
sender_interface = intf
rnode = tgen.routers()[senderRouter]
- for destLink, data in topo["routers"][senderRouter]["links"].items():
+ for _, data in topo["routers"][senderRouter]["links"].items():
if "type" in data and data["type"] == "loopback":
continue