]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: Avoid importing unused modules
authorY Bharath <y.bharath@samsung.com>
Sat, 15 Jun 2024 17:06:32 +0000 (22:36 +0530)
committerY Bharath <y.bharath@samsung.com>
Mon, 17 Jun 2024 10:12:59 +0000 (15:42 +0530)
Signed-off-by: y-bharath14 <y.bharath@samsung.com>
131 files changed:
tests/topotests/eigrp_topo1/test_eigrp_topo1.py
tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py
tests/topotests/fpm_testing_topo1/test_fpm_topo1.py
tests/topotests/grpc_basic/test_basic_grpc.py
tests/topotests/isis_advertise_high_metrics/test_isis_advertise_high_metrics.py
tests/topotests/isis_lfa_topo1/test_isis_lfa_topo1.py
tests/topotests/isis_lsp_bits_topo1/test_isis_lsp_bits_topo1.py
tests/topotests/isis_rlfa_topo1/test_isis_rlfa_topo1.py
tests/topotests/isis_snmp/test_isis_snmp.py
tests/topotests/isis_sr_flex_algo_topo1/test_isis_sr_flex_algo_topo1.py
tests/topotests/isis_sr_flex_algo_topo2/test_isis_sr_flex_algo_topo2.py
tests/topotests/isis_sr_te_topo1/test_isis_sr_te_topo1.py
tests/topotests/isis_sr_topo1/test_isis_sr_topo1.py
tests/topotests/isis_srv6_topo1/test_isis_srv6_topo1.py
tests/topotests/isis_tilfa_topo1/test_isis_tilfa_topo1.py
tests/topotests/isis_topo1/test_isis_topo1.py
tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.py
tests/topotests/key_sendaccept/test_keychain.py
tests/topotests/ldp_oc_acl_topo1/test_ldp_oc_acl_topo1.py
tests/topotests/ldp_oc_topo1/test_ldp_oc_topo1.py
tests/topotests/ldp_snmp/test_ldp_snmp_topo1.py
tests/topotests/ldp_sync_isis_topo1/test_ldp_sync_isis_topo1.py
tests/topotests/ldp_sync_ospf_topo1/test_ldp_sync_ospf_topo1.py
tests/topotests/ldp_vpls_topo1/test_ldp_vpls_topo1.py
tests/topotests/lib/bgp.py
tests/topotests/lib/checkping.py
tests/topotests/lib/common_config.py
tests/topotests/lib/fe_client.py
tests/topotests/lib/ospf.py
tests/topotests/lib/pim.py
tests/topotests/mgmt_debug_flags/test_debug.py
tests/topotests/mgmt_notif/test_notif.py
tests/topotests/mgmt_oper/oper.py
tests/topotests/mgmt_oper/test_oper.py
tests/topotests/mgmt_rpc/test_rpc.py
tests/topotests/mgmt_tests/test_yang_mgmt.py
tests/topotests/msdp_topo1/test_msdp_topo1.py
tests/topotests/multicast_pim6_sm_topo1/test_multicast_pim6_sm1.py
tests/topotests/multicast_pim6_sm_topo1/test_multicast_pim6_sm2.py
tests/topotests/multicast_pim_dr_nondr_test/test_pim_dr_nondr_with_ospf_topo2.py
tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py
tests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py
tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo3.py
tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py
tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py
tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp1.py
tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp2.py
tests/topotests/multicast_pim_uplink_topo1/test_multicast_pim_uplink_topo1.py
tests/topotests/multicast_pim_uplink_topo2/test_multicast_pim_uplink_topo2.py
tests/topotests/nb_config/test_nb_config.py
tests/topotests/nhrp_redundancy/test_nhrp_redundancy.py
tests/topotests/ospf6_gr_topo1/test_ospf6_gr_topo1.py
tests/topotests/ospf6_loopback_cost/test_ospf6_loopback_cost.py
tests/topotests/ospf6_point_to_multipoint/test_ospf6_point_to_multipoint.py
tests/topotests/ospf6_topo1/test_ospf6_topo1.py
tests/topotests/ospf6_topo1_vrf/test_ospf6_topo1_vrf.py
tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py
tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_type7_lsa.py
tests/topotests/ospf_basic_functionality/test_ospf_authentication.py
tests/topotests/ospf_basic_functionality/test_ospf_chaos.py
tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py
tests/topotests/ospf_basic_functionality/test_ospf_flood_reduction.py
tests/topotests/ospf_basic_functionality/test_ospf_nssa.py
tests/topotests/ospf_basic_functionality/test_ospf_p2mp.py
tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py
tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py
tests/topotests/ospf_basic_functionality/test_ospf_single_area.py
tests/topotests/ospf_dual_stack/test_ospf_dual_stack.py
tests/topotests/ospf_gr_helper/test_ospf_gr_helper1.py
tests/topotests/ospf_gr_helper/test_ospf_gr_helper3.py
tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py
tests/topotests/ospf_instance_redistribute/test_ospf_instance_redistribute.py
tests/topotests/ospf_metric_propagation/test_ospf_metric_propagation.py
tests/topotests/ospf_multi_vrf_bgp_route_leak/test_ospf_multi_vrf_bgp_route_leak.py
tests/topotests/ospf_netns_vrf/test_ospf_netns_vrf.py
tests/topotests/ospf_nssa_topo1/test_ospf_nssa_topo1.py
tests/topotests/ospf_p2mp/test_ospf_p2mp_broadcast.py
tests/topotests/ospf_p2mp/test_ospf_p2mp_non_broadcast.py
tests/topotests/ospf_prefix_suppression/test_ospf_prefix_suppression.py
tests/topotests/ospf_single_switch/test_ospf_single_switch.py
tests/topotests/ospf_sr_te_topo1/test_ospf_sr_te_topo1.py
tests/topotests/ospf_sr_topo1/test_ospf_sr_topo1.py
tests/topotests/ospf_suppress_fa/test_ospf_suppress_fa.py
tests/topotests/ospf_tilfa_topo1/test_ospf_tilfa_topo1.py
tests/topotests/ospf_topo1/test_ospf_topo1.py
tests/topotests/ospf_topo2/test_ospf_topo2.py
tests/topotests/ospf_unnumbered/test_ospf_unnumbered.py
tests/topotests/ospf_unnumbered_point_to_multipoint/test_ospf_unnumbered_point_to_multipoint.py
tests/topotests/ospfapi/test_ospf_clientapi.py
tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py
tests/topotests/ospfv3_basic_functionality/test_ospfv3_authentication.py
tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp.py
tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp_lan.py
tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa.py
tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa2.py
tests/topotests/ospfv3_basic_functionality/test_ospfv3_routemaps.py
tests/topotests/ospfv3_basic_functionality/test_ospfv3_rte_calc.py
tests/topotests/ospfv3_basic_functionality/test_ospfv3_single_area.py
tests/topotests/pim_acl/test_pim_acl.py
tests/topotests/pim_basic/test_pim.py
tests/topotests/pim_igmp_vrf/test_pim_vrf.py
tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py
tests/topotests/rip_bfd_topo1/test_rip_bfd_topo1.py
tests/topotests/rip_passive_interface/test_rip_passive_interface.py
tests/topotests/ripng_allow_ecmp/test_ripng_allow_ecmp.py
tests/topotests/ripng_route_map/test_ripng_route_map.py
tests/topotests/route_scale/scale_test_common.py
tests/topotests/route_scale/test_route_scale1.py
tests/topotests/route_scale/test_route_scale2.py
tests/topotests/simple_snmp_test/test_simple_snmp.py
tests/topotests/srv6_encap_src_addr/test_srv6_encap_src_addr.py
tests/topotests/srv6_locator/test_srv6_locator.py
tests/topotests/srv6_locator_custom_bits_length/test_srv6_locator_custom_bits_length.py
tests/topotests/srv6_locator_usid/test_srv6_locator_usid.py
tests/topotests/srv6_static_route/test_srv6_route.py
tests/topotests/static_routing_mpls/test_static_routing_mpls.py
tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py
tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py
tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py
tests/topotests/static_routing_with_ibgp/test_static_routes_topo1_ibgp.py
tests/topotests/static_routing_with_ibgp/test_static_routes_topo2_ibgp.py
tests/topotests/static_routing_with_ibgp/test_static_routes_topo3_ibgp.py
tests/topotests/static_routing_with_ibgp/test_static_routes_topo4_ibgp.py
tests/topotests/static_simple/test_static_simple.py
tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py
tests/topotests/zebra_netlink/test_zebra_netlink.py
tests/topotests/zebra_nht_resolution/test_verify_nh_resolution.py
tests/topotests/zebra_opaque/test_zebra_opaque.py
tests/topotests/zebra_rib/test_zebra_rib.py
tests/topotests/zebra_seg6_route/test_zebra_seg6_route.py
tests/topotests/zebra_seg6local_route/test_zebra_seg6local_route.py

index b3152f43bcb97079abe2509a1faa1fe300b6843f..7ab1572daedd1f721de047091e0b669e8c6890a0 100644 (file)
@@ -143,7 +143,6 @@ def test_zebra_ipv4_routingTable():
     if tgen.routers_have_failure():
         pytest.skip(tgen.errors)
 
-    failures = 0
     router_list = tgen.routers().values()
     for router in router_list:
         output = router.vtysh_cmd("show ip route json", isjson=True)
index 10d216ab1ed4746a93e2be63d27eaf974bd6fe82..beb4de432e226d4e8d8319dd25a2e449c7a01040 100644 (file)
@@ -22,7 +22,6 @@ Following tests are covered to test EVPN-Type5 functionality:
 
 import os
 import sys
-import json
 import time
 import pytest
 import platform
@@ -69,7 +68,7 @@ from lib.bgp import (
     verify_attributes_for_evpn_routes,
     verify_evpn_routes,
 )
-from lib.topojson import build_topo_from_json, build_config_from_json
+from lib.topojson import build_config_from_json
 
 pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
 
index 22fc50b91427920d80ccf16c1f32559e7e255a91..66cefcc2a06f0bc57604cd869423f8f463625506 100644 (file)
@@ -14,7 +14,6 @@ test_fpm_topo1.py: Testing FPM module
 
 """
 import os
-import re
 import sys
 import pytest
 import json
@@ -28,7 +27,6 @@ sys.path.append(os.path.join(CWD, "../"))
 # Import topogen and topotest helpers
 from lib import topotest
 from lib.topogen import Topogen, TopoRouter, get_topogen
-from lib.topolog import logger
 
 
 pytestmark = [pytest.mark.fpm, pytest.mark.sharpd]
index cf1c6d0ec75b3109054c602c853e838388b41e27..5ff2894fd1abb6647cafbaa3632b58f8a36c670f 100644 (file)
@@ -19,7 +19,6 @@ import pytest
 from lib.common_config import step
 from lib.micronet import commander
 from lib.topogen import Topogen, TopoRouter
-from lib.topolog import logger
 from lib.topotest import json_cmp
 
 CWD = os.path.dirname(os.path.realpath(__file__))
@@ -60,7 +59,7 @@ def tgen(request):
     tgen.start_topology()
     router_list = tgen.routers()
 
-    for rname, router in router_list.items():
+    for _, router in router_list.items():
         router.load_config(TopoRouter.RD_ZEBRA, "zebra.conf", f"-M grpc:{GRPCP_ZEBRA}")
         router.load_config(TopoRouter.RD_STATIC, "", f"-M grpc:{GRPCP_STATICD}")
         # router.load_config(TopoRouter.RD_BFDD, "", f"-M grpc:{GRPCP_BFDD}")
index ada8c0f5fbdaafd3eaa2d558b45d85efc6c13c3f..ad896b7422afb478427ea7ed8e53272e2b5949a4 100644 (file)
@@ -30,8 +30,6 @@ import re
 import sys
 import pytest
 import json
-from time import sleep
-from functools import partial
 
 # Save the Current Working Directory to find configuration files.
 CWD = os.path.dirname(os.path.realpath(__file__))
@@ -39,7 +37,6 @@ sys.path.append(os.path.join(CWD, "../"))
 
 # pylint: disable=C0413
 # Import topogen and topotest helpers
-from lib import topotest
 from lib.common_config import (
     retry,
     stop_router,
index 44b3dd0b7927597e485bfe8b2a15805e63294b40..af28dbdf3ce3a4a52c7e4dd88dea29a9d89b0d0b 100755 (executable)
@@ -42,7 +42,6 @@ import os
 import sys
 import pytest
 import json
-import time
 import tempfile
 from functools import partial
 
@@ -169,7 +168,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
@@ -832,7 +831,7 @@ def test_rib_ipv6_step18():
     rname = "rt1"
     router = tgen.gears[rname]
     test_func = partial(_rt2_neigh_down, router)
-    success, result = topotest.run_and_expect(test_func, None, count=200, wait=0.05)
+    _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.05)
     assert result is None, 'rt2 neighbor is still present on "{}"'.format(router)
 
     router_compare_json_output(
@@ -1034,7 +1033,7 @@ def test_rib_ipv6_step24():
     rname = "rt1"
     router = tgen.gears[rname]
     test_func = partial(_bfd_down, router)
-    success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.3)
+    _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.3)
     assert result is None, 'BFD session is still up on "{}"'.format(router)
 
     router_compare_json_output(
index c4ce6a30cd4348e9e734df99901f86e53ae4421d..6f4653d2c2952f64ce1dfab822c66f9bfcc5e316 100755 (executable)
@@ -131,7 +131,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 15327fe03adfe72a11fe6ffdfcf1bda3744f003e..f97c7d2c9c9ce21e6225bb13e6f5bdf4d191657c 100755 (executable)
@@ -170,7 +170,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index ddef08008b4394fe0fedd5614673b7912f20fd03..81c96b3daf17c00e316943a171a19cfbdc404c03 100755 (executable)
@@ -147,7 +147,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index c81f63942bde51a7ef79e202b2a92f746654f599..d1fc68291ea786bda8befa7886b98422da15ab25 100755 (executable)
@@ -37,7 +37,6 @@ import os
 import sys
 import pytest
 import json
-import tempfile
 from copy import deepcopy
 from functools import partial
 
@@ -121,7 +120,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
index 6689cf4c5ebaa43b12a0ec4950381ae512dcf4f5..7d063910d0f314ddae7d8ad70b4a52019d977a82 100755 (executable)
@@ -47,7 +47,6 @@ import os
 import sys
 import pytest
 import json
-import time
 from functools import partial
 
 # Save the Current Working Directory to find configuration files.
@@ -67,7 +66,6 @@ pytestmark = [pytest.mark.isisd]
 def build_topo(tgen):
     "Build function"
 
-    routers = []
     for i in range(0, 10):
         rt = tgen.add_router("rt{}".format(i))
         rt.run("sysctl -w net.ipv4.fib_multipath_hash_policy=1")
@@ -140,7 +138,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
@@ -174,7 +172,7 @@ def check_rib(name, cmd, expected_file):
     logger.info('[+] check {} "{}" {}'.format(name, cmd, expected_file))
     tgen = get_topogen()
     func = partial(_check, name, cmd, expected_file)
-    success, result = topotest.run_and_expect(func, None, count=120, wait=0.5)
+    _, result = topotest.run_and_expect(func, None, count=120, wait=0.5)
     assert result is None, "Failed"
 
 
index fc2ce7cb4b666bd915d6e828f05de29644374b79..cb4f4ffa56efcd16e83a05478152253e09b6277e 100755 (executable)
@@ -164,7 +164,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
@@ -641,7 +641,7 @@ def test_srte_route_map_with_sr_policy_check_nextop_step5():
     )
 
     # (re-)build the SR Policy two times to ensure that reinstalling still works
-    for i in [1, 2]:
+    for _ in [1, 2]:
         cmp_json_output(
             "rt1", "show ip route bgp json", "step5/show_ip_route_bgp_inactive_srte.ref"
         )
index 9a4085ab5593be2b25f5bf1b6d71bc8531119e70..baf7e98ba10a498022050db70eedacb1b9702c8b 100644 (file)
@@ -137,7 +137,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 1a7505dd123a283db614bb0ee5d916bfd17682b4..9c1a23f54f42f8ef8d4d835fcfef5703a6edc2c3 100644 (file)
@@ -60,7 +60,6 @@ test_isis_srv6_topo1.py:
 """
 
 import os
-import re
 import sys
 import json
 import functools
@@ -212,7 +211,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
 
     # Teardown the topology
@@ -250,7 +249,7 @@ def check_ping6(name, dest_addr, expect_connected):
     logger.info("[+] check {} {} {}".format(name, dest_addr, match))
     tgen = get_topogen()
     func = functools.partial(_check, name, dest_addr, match)
-    success, result = topotest.run_and_expect(func, None, count=10, wait=1)
+    _, result = topotest.run_and_expect(func, None, count=10, wait=1)
     assert result is None, "Failed"
 
 
index aaf6af0be4cbf4cdc64b36ec38db6a10500aabc3..c8e66befa5c07fa09ae928e8bbb7fadbb562bfdc 100755 (executable)
@@ -54,7 +54,6 @@ import os
 import sys
 import pytest
 import json
-import tempfile
 from functools import partial
 from time import sleep
 
@@ -144,7 +143,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index b388f52bd9bd283015786ea43cf4674666081a9f..cea284963d1ed2b1415f0b12ad0dec5aa01658b1 100644 (file)
@@ -104,7 +104,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
@@ -160,7 +160,7 @@ def test_isis_route_installation():
             return topotest.json_cmp(actual, expected)
 
         test_func = functools.partial(compare_isis_installed_routes, router, expected)
-        (result, diff) = topotest.run_and_expect(test_func, None, wait=1, count=10)
+        (result, _) = topotest.run_and_expect(test_func, None, wait=1, count=10)
         assertmsg = "Router '{}' routes mismatch".format(rname)
         assert result, assertmsg
 
@@ -205,7 +205,7 @@ def test_isis_route6_installation():
         test_func = functools.partial(
             compare_isis_v6_installed_routes, router, expected
         )
-        (result, diff) = topotest.run_and_expect(test_func, None, wait=1, count=10)
+        (result, _) = topotest.run_and_expect(test_func, None, wait=1, count=10)
         assertmsg = "Router '{}' routes mismatch".format(rname)
         assert result, assertmsg
 
@@ -237,7 +237,7 @@ def test_isis_summary_json():
         pytest.skip(tgen.errors)
 
     logger.info("Checking 'show isis summary json'")
-    for rname, router in tgen.routers().items():
+    for rname, _ in tgen.routers().items():
         logger.info("Checking router %s", rname)
         json_output = tgen.gears[rname].vtysh_cmd("show isis summary json", isjson=True)
         assertmsg = "Test isis summary json failed in '{}' data '{}'".format(
@@ -257,7 +257,7 @@ def test_isis_interface_json():
         pytest.skip(tgen.errors)
 
     logger.info("Checking 'show isis interface json'")
-    for rname, router in tgen.routers().items():
+    for rname, _ in tgen.routers().items():
         logger.info("Checking router %s", rname)
         json_output = tgen.gears[rname].vtysh_cmd(
             "show isis interface json", isjson=True
@@ -294,7 +294,7 @@ def test_isis_neighbor_json():
 
     # tgen.mininet_cli()
     logger.info("Checking 'show isis neighbor json'")
-    for rname, router in tgen.routers().items():
+    for rname, _ in tgen.routers().items():
         logger.info("Checking router %s", rname)
         json_output = tgen.gears[rname].vtysh_cmd(
             "show isis neighbor json", isjson=True
@@ -330,7 +330,7 @@ def test_isis_database_json():
 
     # tgen.mininet_cli()
     logger.info("Checking 'show isis database json'")
-    for rname, router in tgen.routers().items():
+    for rname, _ in tgen.routers().items():
         logger.info("Checking router %s", rname)
         json_output = tgen.gears[rname].vtysh_cmd(
             "show isis database json", isjson=True
@@ -755,7 +755,7 @@ def dict_merge(dct, merge_dct):
     Source:
     https://gist.github.com/angstwad/bf22d1822c38a92ec0a9
     """
-    for k, v in merge_dct.items():
+    for k, _ in merge_dct.items():
         if k in dct and isinstance(dct[k], dict) and topotest.is_mapping(merge_dct[k]):
             dict_merge(dct[k], merge_dct[k])
         else:
index 032319c446a111614b569bda913e45d72ea54741..7aac7c704da9f45e7fc2e9db2c7316c6eebbf1ab 100644 (file)
@@ -118,7 +118,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     # move back rx-eth0 to default VRF
@@ -287,7 +287,7 @@ def dict_merge(dct, merge_dct):
     Source:
     https://gist.github.com/angstwad/bf22d1822c38a92ec0a9
     """
-    for k, v in merge_dct.items():
+    for k, _ in merge_dct.items():
         if k in dct and isinstance(dct[k], dict) and topotest.is_mapping(merge_dct[k]):
             dict_merge(dct[k], merge_dct[k])
         else:
index b11d31b981a6b4a36740d28e2fc683a90fbe25ae..1d24c170042fff5dcc5b1fdc52bcbf411a3058c3 100644 (file)
@@ -27,7 +27,7 @@ def tgen(request):
     tgen.start_topology()
 
     router_list = tgen.routers()
-    for rname, router in router_list.items():
+    for _, router in router_list.items():
         router.load_frr_config("frr.conf")
 
     tgen.start_router()
index c2bcaa84ceb2929fe9cf42429b43fb3264507b4f..8123e0498260aab3ac8171e97fd9f9dbe5824f12 100644 (file)
@@ -117,7 +117,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 387fd89c20d37674aef9722b37323b49781a8acd..bfb93d55889aac5d21905a20dd5810ec627dc77b 100644 (file)
@@ -116,7 +116,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 52a67d8bb8da55fea4372879c1939fd732ec1ece..ea404beae4faa76f7f0029e958a95bfc94853e00 100644 (file)
@@ -136,7 +136,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index cb6b784d6d3625180f34ec48efdcab9239741a7b..f2c41ebe301fd8c98b514c60cc4b31b704dd8e6a 100644 (file)
@@ -129,7 +129,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 760b4e3df566ec40e183b90f817f9ae9d7bd1686..9e41e06c6a851fd0b1808bde35b23a44f39bc4e8 100644 (file)
@@ -128,7 +128,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 1f4a4b5fd59526abb7a15f1a0ef0a2b4924eb772..c14c79e6d4f2d471040ebb155929f86f5fdaa116 100644 (file)
@@ -129,7 +129,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 3a16ed5a090d2c2e0f5a8a1b32149d6677f0b6ec..4250c405f3dcfd3c448e445c187f532d3be4619e 100644 (file)
@@ -333,7 +333,7 @@ def __create_bgp_global(tgen, input_dict, router, build=False):
             else:
                 del_action = False
 
-            for rs_timer, value in timer.items():
+            for rs_timer, _ in timer.items():
                 rs_timer_value = timer.setdefault(rs_timer, None)
 
                 if rs_timer_value and rs_timer != "delete":
@@ -1229,7 +1229,7 @@ def modify_bgp_config_when_bgpd_down(tgen, topo, input_dict):
         # Copy bgp config file to /etc/frr
         for dut in input_dict.keys():
             router_list = tgen.routers()
-            for router, rnode in router_list.items():
+            for router, _ in router_list.items():
                 if router != dut:
                     continue
 
@@ -1750,7 +1750,7 @@ def verify_as_numbers(tgen, topo, input_dict, expected=True):
 
             for bgp_neighbor, peer_data in bgp_neighbors.items():
                 remote_as = input_dict[bgp_neighbor]["bgp"]["local_as"]
-                for dest_link, peer_dict in peer_data["dest_link"].items():
+                for dest_link, _ in peer_data["dest_link"].items():
                     neighbor_ip = None
                     data = topo["routers"][bgp_neighbor]["links"]
 
@@ -1833,7 +1833,7 @@ def verify_bgp_convergence_from_running_config(tgen, dut=None, expected=True):
             return errormsg
 
         for vrf, addr_family_data in show_bgp_json.items():
-            for address_family, neighborship_data in addr_family_data.items():
+            for _, neighborship_data in addr_family_data.items():
                 total_peer = 0
                 no_of_peer = 0
 
@@ -1980,7 +1980,7 @@ def clear_bgp_and_verify(tgen, topo, router, rid=None):
             bgp_neighbors = bgp_addr_type[addr_type]["unicast"]["neighbor"]
 
             for bgp_neighbor, peer_data in bgp_neighbors.items():
-                for dest_link, peer_dict in peer_data["dest_link"].items():
+                for dest_link, _ in peer_data["dest_link"].items():
                     data = topo["routers"][bgp_neighbor]["links"]
 
                     if dest_link in data:
@@ -3231,7 +3231,7 @@ def verify_graceful_restart(
                 if bgp_neighbor != peer:
                     continue
 
-                for dest_link, peer_dict in peer_data["dest_link"].items():
+                for dest_link, _ in peer_data["dest_link"].items():
                     data = topo["routers"][bgp_neighbor]["links"]
 
                     if dest_link in data:
@@ -3479,7 +3479,7 @@ def verify_r_bit(tgen, topo, addr_type, input_dict, dut, peer, expected=True):
                 if bgp_neighbor != peer:
                     continue
 
-                for dest_link, peer_dict in peer_data["dest_link"].items():
+                for dest_link, _ in peer_data["dest_link"].items():
                     data = topo["routers"][bgp_neighbor]["links"]
 
                     if dest_link in data:
@@ -3597,7 +3597,7 @@ def verify_eor(tgen, topo, addr_type, input_dict, dut, peer, expected=True):
                 if bgp_neighbor != peer:
                     continue
 
-                for dest_link, peer_dict in peer_data["dest_link"].items():
+                for dest_link, _ in peer_data["dest_link"].items():
                     data = topo["routers"][bgp_neighbor]["links"]
 
                     if dest_link in data:
@@ -3762,7 +3762,7 @@ def verify_f_bit(tgen, topo, addr_type, input_dict, dut, peer, expected=True):
                 if bgp_neighbor != peer:
                     continue
 
-                for dest_link, peer_dict in peer_data["dest_link"].items():
+                for dest_link, _ in peer_data["dest_link"].items():
                     data = topo["routers"][bgp_neighbor]["links"]
 
                     if dest_link in data:
@@ -3890,7 +3890,7 @@ def verify_graceful_restart_timers(tgen, topo, addr_type, input_dict, dut, peer)
                 if bgp_neighbor != peer:
                     continue
 
-                for dest_link, peer_dict in peer_data["dest_link"].items():
+                for dest_link, _ in peer_data["dest_link"].items():
                     data = topo["routers"][bgp_neighbor]["links"]
 
                     if dest_link in data:
index 5500807fabe365eb6a9b79b67868535a23ff0e37..aa95f45b29677605585e6b459f31f3cea42f6301 100644 (file)
@@ -33,5 +33,5 @@ def check_ping(name, dest_addr, expect_connected, count, wait, source_addr=None)
     logger.info("[+] check {} {} {}".format(name, dest_addr, match))
     tgen = get_topogen()
     func = functools.partial(_check, name, dest_addr, source_addr, match)
-    success, result = topotest.run_and_expect(func, None, count=count, wait=wait)
+    _, result = topotest.run_and_expect(func, None, count=count, wait=wait)
     assert result is None, "Failed"
index 7787b6f74b1de658586738a67d0e0d5c9665983b..e856c23d363215560631c287488241847d9ef585 100644 (file)
@@ -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)
@@ -3095,7 +3094,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
 
@@ -4942,7 +4941,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
 
index d61bc850b4d223915092ef05c61faafca3b8ec33..784f7d17eb29da6902e50bc2a52e40863a84fefb 100755 (executable)
@@ -9,7 +9,6 @@
 # noqa: E501
 #
 import argparse
-import json
 import logging
 import os
 import socket
@@ -216,7 +215,7 @@ class Session:
             self.sess_id = reply.session_reply.session_id
         else:
             self.sess_id = 0
-            mdata, req_id = self.get_native_msg_header(MSG_CODE_SESSION_REQ)
+            mdata, _ = self.get_native_msg_header(MSG_CODE_SESSION_REQ)
             mdata += struct.pack(MSG_SESSION_REQ_FMT)
             mdata += "test-client".encode("utf-8") + b"\x00"
 
@@ -324,7 +323,7 @@ class Session:
 
     def get_data(self, query, data=True, config=False):
         # Create the message
-        mdata, req_id = self.get_native_msg_header(MSG_CODE_GET_DATA)
+        mdata, _ = self.get_native_msg_header(MSG_CODE_GET_DATA)
         flags = GET_DATA_FLAG_STATE if data else 0
         flags |= GET_DATA_FLAG_CONFIG if config else 0
         mdata += struct.pack(MSG_GET_DATA_FMT, MSG_FORMAT_JSON, flags)
@@ -333,7 +332,7 @@ class Session:
         self.send_native_msg(mdata)
         logging.debug("Sent GET-TREE")
 
-        mhdr, mfixed, mdata = self.recv_native_msg()
+        _, mfixed, mdata = self.recv_native_msg()
         assert mdata[-1] == 0
         result = mdata[:-1].decode("utf-8")
 
@@ -342,7 +341,7 @@ class Session:
 
     def add_notify_select(self, replace, notif_xpaths):
         # Create the message
-        mdata, req_id = self.get_native_msg_header(MSG_CODE_NOTIFY_SELECT)
+        mdata, _ = self.get_native_msg_header(MSG_CODE_NOTIFY_SELECT)
         mdata += struct.pack(MSG_NOTIFY_SELECT_FMT, replace)
 
         for xpath in notif_xpaths:
@@ -355,7 +354,7 @@ class Session:
         if xpaths:
             self.add_notify_select(True, xpaths)
 
-        for remaining in Timeout(60):
+        for _ in Timeout(60):
             logging.debug("Waiting for Notify Message")
             mhdr, mfixed, mdata = self.recv_native_msg()
             if mhdr[HDR_FIELD_CODE] == MSG_CODE_NOTIFY:
index 5b18f8b679ceaae656f615b6e5f18dceff43e162..2c876e198926e44771484c87b4a8468cbc092d25 100644 (file)
@@ -1545,7 +1545,7 @@ def verify_ospf_database(
                             )
                             return errormsg
     if ospf_external_lsa:
-        for ospf_ext_lsa, ext_lsa_data in ospf_external_lsa.items():
+        for ospf_ext_lsa, _ in ospf_external_lsa.items():
             if ospf_ext_lsa in show_ospf_json["AS External Link States"]:
                 logger.info(
                     "[DUT: %s]  OSPF LSDB:External LSA %s", router, ospf_ext_lsa
@@ -2509,7 +2509,7 @@ def verify_ospf_gr_helper(tgen, topo, dut, input_dict=None):
         raise ValueError(errormsg)
         return errormsg
 
-    for ospf_gr, gr_data in input_dict.items():
+    for ospf_gr, _ in input_dict.items():
         try:
             if input_dict[ospf_gr] == show_ospf_json[ospf_gr]:
                 logger.info(
index f7440efd6d57b5c8274e234a0e075a4246c225df..cc56ffdd8c9f15e7dac75a1c2015ec37a98c6b88 100644 (file)
@@ -149,7 +149,7 @@ def _add_pim_rp_config(tgen, topo, input_dict, router, build, config_data_dict):
         # At least one interface must be enabled for PIM on the router
         pim_if_enabled = False
         pim6_if_enabled = False
-        for destLink, data in topo[dut]["links"].items():
+        for _, data in topo[dut]["links"].items():
             if "pim" in data:
                 pim_if_enabled = True
             if "pim6" in data:
@@ -603,7 +603,7 @@ def find_rp_details(tgen, topo):
                 # ip address of RP
                 rp_addr = rp_dict["rp_addr"]
 
-                for link, data in topo["routers"][router]["links"].items():
+                for _, data in topo["routers"][router]["links"].items():
                     if data["ipv4"].split("/")[0] == rp_addr:
                         rp_details[router] = rp_addr
 
@@ -2089,7 +2089,7 @@ def verify_pim_interface(
                     )
                     return True
         else:
-            for destLink, data in topo["routers"][dut]["links"].items():
+            for _, data in topo["routers"][dut]["links"].items():
                 if "type" in data and data["type"] == "loopback":
                     continue
 
@@ -2292,7 +2292,7 @@ def clear_pim_interfaces(tgen, dut):
 
     # Waiting for maximum 60 sec
     fail_intf = []
-    for retry in range(1, 13):
+    for _ in range(1, 13):
         sleep(5)
         logger.info("[DUT: %s]: Waiting for 5 sec for PIM neighbors" " to come up", dut)
         run_json_after = run_frr_cmd(rnode, "show ip pim neighbor json", isjson=True)
@@ -2368,7 +2368,7 @@ def clear_igmp_interfaces(tgen, dut):
 
     total_groups_before_clear = igmp_json["totalGroups"]
 
-    for key, value in igmp_json.items():
+    for _, value in igmp_json.items():
         if type(value) is not dict:
             continue
 
@@ -2381,7 +2381,7 @@ def clear_igmp_interfaces(tgen, dut):
     result = run_frr_cmd(rnode, "clear ip igmp interfaces")
 
     # Waiting for maximum 60 sec
-    for retry in range(1, 13):
+    for _ in range(1, 13):
         logger.info(
             "[DUT: %s]: Waiting for 5 sec for igmp interfaces" " to come up", dut
         )
@@ -2460,7 +2460,7 @@ def clear_mroute_verify(tgen, dut, expected=True):
 
     # RFC 3376: 8.2. Query Interval - Default: 125 seconds
     # So waiting for maximum 130 sec to get the igmp report
-    for retry in range(1, 26):
+    for _ in range(1, 26):
         logger.info("[DUT: %s]: Waiting for 2 sec for mroutes" " to come up", dut)
         sleep(5)
         keys_json1 = mroute_json_1.keys()
@@ -2671,7 +2671,7 @@ def add_rp_interfaces_and_pim_config(tgen, topo, interface, rp, rp_mapping):
     try:
         config_data = []
 
-        for group, rp_list in rp_mapping.items():
+        for _, rp_list in rp_mapping.items():
             for _rp in rp_list:
                 config_data.append("interface {}".format(interface))
                 config_data.append("ip address {}".format(_rp))
@@ -2720,7 +2720,7 @@ def scapy_send_bsr_raw_packet(tgen, topo, senderRouter, receiverRouter, packet=N
     script_path = os.path.join(CWD, "send_bsr_packet.py")
     node = tgen.net[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
 
@@ -2795,12 +2795,12 @@ def find_rp_from_bsrp_info(tgen, dut, bsr, grp=None):
 
         # RP with lowest priority
         if len(priority_dict) != 1:
-            rp_p, lowest_priority = sorted(rp_priority.items(), key=lambda x: x[1])[0]
+            rp_p, _ = sorted(rp_priority.items(), key=lambda x: x[1])[0]
             rp_details[group] = rp_p
 
         # RP with highest hash value
         if len(priority_dict) == 1:
-            rp_h, highest_hash = sorted(rp_hash.items(), key=lambda x: x[1])[-1]
+            rp_h, _ = sorted(rp_hash.items(), key=lambda x: x[1])[-1]
             rp_details[group] = rp_h
 
         # RP with highest IP address
@@ -3239,7 +3239,7 @@ def verify_pim_join(
         interface_json = show_pim_join_json[interface]
 
         grp_addr = grp_addr.split("/")[0]
-        for source, data in interface_json[grp_addr].items():
+        for _, data in interface_json[grp_addr].items():
             # Verify pim join
             if pim_join:
                 if data["group"] == grp_addr and data["channelJoinName"] == "JOIN":
index e49d9b7beb41dfa24344cebc812f4b92fee360d7..fe659e54cabbea2e694a9ef28bb587c348980805 100644 (file)
@@ -27,7 +27,7 @@ def tgen(request):
     tgen = Topogen(topodef, request.module.__name__)
     tgen.start_topology()
 
-    for rname, router in tgen.routers().items():
+    for _, router in tgen.routers().items():
         router.load_frr_config("frr.conf")
 
     tgen.start_router()
index 01466892a880af656dcf2329fdc612323752a9c3..e5286faae208c285caefe73b6ef5f95ec491e7dd 100644 (file)
@@ -10,7 +10,6 @@
 Test YANG Notifications
 """
 import json
-import logging
 import os
 
 import pytest
@@ -35,7 +34,7 @@ def tgen(request):
     tgen.start_topology()
 
     router_list = tgen.routers()
-    for rname, router in router_list.items():
+    for _, router in router_list.items():
         router.load_frr_config("frr.conf")
 
     tgen.start_router()
index 162c1eb5ccb5a09d09edecb143cfb5f63112c2b9..934093aeee0ed001c11a7e9d4ceafc662d21abd5 100644 (file)
@@ -146,7 +146,7 @@ def check_kernel(r1, super_prefix, count, add, is_blackhole, vrf, matchvia):
 
     # logger.debug("checking kernel routing table%s:\n%s", vrfstr, kernel)
 
-    for i, net in enumerate(get_ip_networks(super_prefix, count)):
+    for _, net in enumerate(get_ip_networks(super_prefix, count)):
         if not add:
             assert str(net) not in kernel
             continue
@@ -233,7 +233,7 @@ def do_config(
         if vrf:
             f.write("vrf {}\n".format(vrf))
 
-        for i, net in enumerate(get_ip_networks(super_prefix, count)):
+        for _, net in enumerate(get_ip_networks(super_prefix, count)):
             if add:
                 f.write("ip route {} {}\n".format(net, via))
             else:
index 8b8a51c29e0b42d18acebdfd596ed384501a5861..e4ceabf3527552c095b2158fb78f7467c737441a 100644 (file)
@@ -12,17 +12,11 @@ Test static route functionality
 
 import ipaddress
 import math
-import time
 
 import pytest
 from lib.topogen import Topogen
 from oper import check_kernel_32, do_oper_test
 
-try:
-    from deepdiff import DeepDiff as dd_json_cmp
-except ImportError:
-    dd_json_cmp = None
-
 pytestmark = [pytest.mark.staticd, pytest.mark.mgmtd]
 
 
index 618d9022cea09daaa1aa7ce3ab8b408715af8b59..839db97379a0f9262861cbf2eb33dcee82bb77c1 100644 (file)
@@ -32,7 +32,7 @@ def tgen(request):
     tgen.start_topology()
 
     router_list = tgen.routers()
-    for rname, router in router_list.items():
+    for _, router in router_list.items():
         router.load_frr_config("frr.conf")
 
     tgen.start_router()
index 605c14285fa99e59dda97ed321a30fe8db62817a..52f6ba4db74586736d53853f54afd2efd5fb5ba8 100644 (file)
@@ -66,7 +66,6 @@ from lib.common_config import (
     start_router_daemons,
 )
 from lib.topolog import logger
-from lib.bgp import verify_bgp_convergence, create_router_bgp, verify_bgp_rib
 from lib.topojson import build_config_from_json
 
 pytestmark = [pytest.mark.bgpd, pytest.mark.staticd, pytest.mark.mgmtd]
index 1af58b0a010fe48fc5dbb287237020772207c662..08c37617cf76b0ff96eef4e7145de650e45f434f 100755 (executable)
@@ -101,7 +101,7 @@ def setup_module(mod):
     app_helper.init(tgen)
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     app_helper.cleanup()
index 7eb583803715a69208bf25b82a7a744d1ef8b8d4..b8eb67a32eca3a0e6368377d834086f5fece5eff 100644 (file)
@@ -221,7 +221,7 @@ def verify_state_incremented(state_before, state_after):
     """
 
     for router, state_data in state_before.items():
-        for state, value in state_data.items():
+        for state, _ in state_data.items():
             if state_before[router][state] >= state_after[router][state]:
                 errormsg = (
                     "[DUT: %s]: state %s value has not"
index 8b174bf9b83322826eb8d1d17c12d98700de3d30..bab7fddf9e7367ee0514f351ed48a6eec740a55b 100644 (file)
@@ -175,7 +175,7 @@ def verify_state_incremented(state_before, state_after):
     """
 
     for router, state_data in state_before.items():
-        for state, value in state_data.items():
+        for state, _ in state_data.items():
             if state_before[router][state] >= state_after[router][state]:
                 errormsg = (
                     "[DUT: %s]: state %s value has not"
index 00d38fe647dcb2d0864f472b77e58472896b13b2..5aa2ea65f7b539dfeb25d4007cff605ad9c7cedc 100755 (executable)
@@ -20,10 +20,7 @@ Following tests are covered:
 
 import os
 import sys
-import json
 import time
-import datetime
-from time import sleep
 import pytest
 
 # Save the Current Working Directory to find configuration files.
@@ -43,14 +40,9 @@ from lib.common_config import (
     write_test_footer,
     step,
     reset_config_on_routers,
-    shutdown_bringup_interface,
     apply_raw_config,
     add_interfaces_to_vlan,
-    kill_router_daemons,
-    start_router_daemons,
-    create_static_routes,
     check_router_status,
-    topo_daemons,
     required_linux_kernel_version,
 )
 from lib.pim import (
@@ -59,9 +51,6 @@ from lib.pim import (
     verify_mroutes,
     clear_mroute,
     clear_pim_interface_traffic,
-    verify_pim_config,
-    verify_upstream_iif,
-    verify_multicast_traffic,
     verify_multicast_flag_state,
     verify_igmp_groups,
     McastTesterHelper,
index f87a90d19822809572c57d780b1b03726995b2c6..eefa96a389625db9f57da074ce60e4af511665a9 100755 (executable)
@@ -64,7 +64,6 @@ from lib.common_config import (
     reset_config_on_routers,
     shutdown_bringup_interface,
     required_linux_kernel_version,
-    topo_daemons,
 )
 from lib.pim import (
     create_pim_config,
@@ -214,7 +213,7 @@ def verify_state_incremented(state_before, state_after):
     """
 
     for router, state_data in state_before.items():
-        for state, value in state_data.items():
+        for state, _ in state_data.items():
             if state_before[router][state] >= state_after[router][state]:
                 errormsg = (
                     "[DUT: %s]: state %s value has not"
index b62f7bbfc987f4c213f62d407dc203fd2ced647e..0af2efcc7e36f7c18a3632c2de3f597a15136c29 100755 (executable)
@@ -62,7 +62,6 @@ from lib.common_config import (
     start_router_daemons,
     stop_router,
     required_linux_kernel_version,
-    topo_daemons,
 )
 from lib.pim import (
     create_pim_config,
@@ -211,7 +210,7 @@ def verify_state_incremented(state_before, state_after):
     """
 
     for router, state_data in state_before.items():
-        for state, value in state_data.items():
+        for state, _ in state_data.items():
             if state_before[router][state] >= state_after[router][state]:
                 errormsg = (
                     "[DUT: %s]: state %s value has not"
index ae275467035d430d345afd4790a179d5eb33e97d..9488ae02bf2744ccb35ec492f0c542869159b7a2 100755 (executable)
@@ -57,7 +57,7 @@ sys.path.append(os.path.join(CWD, "../lib/"))
 # pylint: disable=C0413
 # Import topogen and topotest helpers
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 from lib.common_config import (
     start_topology,
     write_test_header,
@@ -68,7 +68,6 @@ from lib.common_config import (
     apply_raw_config,
     check_router_status,
     required_linux_kernel_version,
-    topo_daemons,
 )
 from lib.pim import (
     create_pim_config,
@@ -354,7 +353,7 @@ def verify_pim_stats_increament(stats_before, stats_after):
     """
 
     for router, stats_data in stats_before.items():
-        for stats, value in stats_data.items():
+        for stats, _ in stats_data.items():
             if stats_before[router][stats] >= stats_after[router][stats]:
                 errormsg = (
                     "[DUT: %s]: state %s value has not"
index 825281afbb0171879ce6e6d24701db5b5d100fe0..11f3cc4254aa4962522b41d52862f74854358528 100755 (executable)
@@ -55,7 +55,6 @@ from lib.common_config import (
     apply_raw_config,
     create_static_routes,
     required_linux_kernel_version,
-    topo_daemons,
 )
 from lib.pim import (
     create_pim_config,
@@ -191,7 +190,7 @@ def reset_stats(stats):
     """
 
     for router, state_data in stats.items():
-        for state, value in state_data.items():
+        for state, _ in state_data.items():
             stats[router][state] = 0
             logger.info(
                 "[DUT: %s]: stats %s value has reset" " reset, Current value: %s",
@@ -214,7 +213,7 @@ def verify_state_incremented(state_before, state_after):
     """
 
     for router, state_data in state_before.items():
-        for state, value in state_data.items():
+        for state, _ in state_data.items():
             if state_before[router][state] >= state_after[router][state]:
                 errormsg = (
                     "[DUT: %s]: state %s value has not"
index c492d95d40afd273a5d9c16226c2b46b6694c591..38b9b2ecb13a4e50dd6f0ca02d3b78b58da46b3e 100755 (executable)
@@ -87,7 +87,6 @@ TC_32 : Verify RP info and (*,G) mroute after deleting the RP and shut / no
 import os
 import sys
 import time
-from time import sleep
 import datetime
 import pytest
 
@@ -112,10 +111,7 @@ from lib.common_config import (
     reset_config_on_routers,
     step,
     shutdown_bringup_interface,
-    kill_router_daemons,
-    start_router_daemons,
     create_static_routes,
-    topo_daemons,
 )
 from lib.pim import (
     create_pim_config,
@@ -128,10 +124,7 @@ from lib.pim import (
     verify_pim_rp_info,
     verify_pim_state,
     clear_pim_interface_traffic,
-    clear_igmp_interfaces,
-    clear_pim_interfaces,
     clear_mroute,
-    clear_mroute_verify,
     McastTesterHelper,
 )
 
index 690c92f58087aa81d06dbe25dd2ee1bfb8374776..6f078a68d8d29525e7cef447c88148b8ee68aaf2 100755 (executable)
@@ -112,9 +112,6 @@ from lib.common_config import (
     reset_config_on_routers,
     step,
     shutdown_bringup_interface,
-    kill_router_daemons,
-    start_router_daemons,
-    create_static_routes,
 )
 from lib.pim import (
     create_pim_config,
@@ -123,9 +120,7 @@ from lib.pim import (
     verify_join_state_and_timer,
     verify_mroutes,
     verify_pim_neighbors,
-    get_pim_interface_traffic,
     verify_pim_rp_info,
-    verify_pim_state,
     clear_pim_interface_traffic,
     clear_igmp_interfaces,
     clear_pim_interfaces,
index 8aa2e4efa1eb839c270690cc97ae6afd538703fd..48c0a78f9805c7920bb81f10912b4c4dad32f95f 100755 (executable)
@@ -123,14 +123,9 @@ from lib.pim import (
     verify_join_state_and_timer,
     verify_mroutes,
     verify_pim_neighbors,
-    get_pim_interface_traffic,
     verify_pim_rp_info,
-    verify_pim_state,
     clear_pim_interface_traffic,
-    clear_igmp_interfaces,
-    clear_pim_interfaces,
     clear_mroute,
-    clear_mroute_verify,
     McastTesterHelper,
 )
 
index 5728a4d08eee0bc4fa5884708083a16513fe4bbe..bbd5501dbb64ca34af404215759067bf2dd4ee13 100644 (file)
@@ -25,7 +25,6 @@ Following tests are covered to test multicast pim uplink:
 
 import os
 import sys
-import json
 import time
 import pytest
 
@@ -356,7 +355,7 @@ def verify_state_incremented(state_before, state_after):
     """
 
     for router, state_data in state_before.items():
-        for state, value in state_data.items():
+        for state, _ in state_data.items():
             if state_before[router][state] > state_after[router][state]:
                 errormsg = (
                     "[DUT: %s]: state %s value has not"
@@ -1682,7 +1681,7 @@ def test_mroutes_updated_correctly_after_source_interface_shut_noshut_p1(request
 
     step("Shut and No shut source interface multiple time")
 
-    for i in range(0, 2):
+    for _ in range(0, 2):
         step("Shut and no shut the source interface from DUT")
         intf_r1_i2 = topo["routers"]["r1"]["links"]["i2"]["interface"]
         shutdown_bringup_interface(tgen, "r1", intf_r1_i2, False)
index 1fb81c0d70919a247d32d718e434960c14dbf70c..893b80083ea7ca4e90c63ff0948c1873671c04eb 100644 (file)
@@ -213,7 +213,7 @@ def verify_state_incremented(state_before, state_after):
     """
 
     for router, state_data in state_before.items():
-        for state, value in state_data.items():
+        for state, _ in state_data.items():
             if state_before[router][state] > state_after[router][state]:
                 errormsg = (
                     "[DUT: %s]: state %s value has not"
index 9099ef10b8c43762ea1567e03c9fbc3120773f5b..09d6407d5b07b552ef6db4751a0b281ee017cb56 100644 (file)
@@ -30,7 +30,7 @@ def tgen(request):
     tgen.start_topology()
 
     router_list = tgen.routers()
-    for rname, router in router_list.items():
+    for _, router in router_list.items():
         router.load_frr_config("frr.conf")
 
     tgen.start_router()
index 81a22ebfaf5d9f042084e161c6f181bbbcadd385..ffd9abc9d471e4b893c1f787cfef46653cb4a308 100644 (file)
@@ -10,7 +10,6 @@
 import os
 import sys
 import json
-from time import sleep
 from functools import partial
 import pytest
 
@@ -207,7 +206,7 @@ def test_protocols_convergence():
     router_list = tgen.routers()
 
     # Check NHRP cache on servers and clients
-    for rname, router in router_list.items():
+    for _, router in router_list.items():
 
         json_file = "{}/{}/nhrp_cache.json".format(CWD, router.name)
         if not os.path.isfile(json_file):
index 45e1bc8db387bbc3958919e1b00a9b085a1cd698..ba705e3dfc798ea244f3ba77c7ff1bd978d230c4 100755 (executable)
@@ -135,7 +135,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 8e7a7ea40ac38fe96359d04b075773a1556ef2bf..077a9e4205e13c365bb3082ad4d7db983f15234f 100644 (file)
@@ -30,7 +30,7 @@ sys.path.append(os.path.join(CWD, "../"))
 
 # pylint: disable=C0413
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 
 
 def setup_module(mod):
@@ -46,7 +46,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
index 142acf1eb47d133465d1d2f5d127fd5e9ceda6fb..73a9022442511ece0e128362dfd4e45509f2820c 100644 (file)
@@ -153,7 +153,7 @@ def setup_module(mod):
     # tgen.mininet_cli()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
@@ -229,7 +229,7 @@ def test_ospfv3_routingTable():
     # tgen.mininet_cli()
 
     # Verify OSPFv3 Routing Table
-    for router, rnode in tgen.routers().items():
+    for router, _ in tgen.routers().items():
         logger.info('Waiting for router "%s" convergence', router)
 
         # Load expected results from the command
index 5649757010c3172b9c64b37da2cdce938b1bb50d..85075a79aaf85a7c30c21270e22857eea299e270 100644 (file)
@@ -153,7 +153,7 @@ def setup_module(mod):
     # tgen.mininet_cli()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
@@ -229,7 +229,7 @@ def test_ospfv3_routingTable():
     # tgen.mininet_cli()
 
     # Verify OSPFv3 Routing Table
-    for router, rnode in tgen.routers().items():
+    for router, _ in tgen.routers().items():
         logger.info('Waiting for router "%s" convergence', router)
 
         # Load expected results from the command
@@ -351,7 +351,7 @@ def test_ospfv3_routingTable_write_multiplier():
     r1.vtysh_cmd("clear ipv6 ospf interface r1-sw5")
 
     # Verify OSPFv3 Routing Table
-    for router, rnode in tgen.routers().items():
+    for router, _ in tgen.routers().items():
         logger.info('Waiting for router "%s" convergence', router)
 
         # Load expected results from the command
index f982990987b5427540310e0d3ef67f75e6f80b07..ccf25a0fc84bad068085e5917e5e0e1ac0c0fcb1 100755 (executable)
@@ -186,7 +186,7 @@ def setup_module(mod):
     # tgen.mininet_cli()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
@@ -260,7 +260,7 @@ def test_ospfv3_routingTable():
     # For debugging, uncomment the next line
     # tgen.mininet_cli()
     # Verify OSPFv3 Routing Table
-    for router, rnode in tgen.routers().items():
+    for router, _ in tgen.routers().items():
         logger.info('Waiting for router "%s" convergence', router)
 
         # Load expected results from the command
@@ -391,7 +391,7 @@ def test_ospfv3_routingTable_write_multiplier():
     r1.vtysh_cmd("clear ipv6 ospf interface r1-sw5")
 
     # Verify OSPFv3 Routing Table
-    for router, rnode in tgen.routers().items():
+    for router, _ in tgen.routers().items():
         logger.info('Waiting for router "%s" convergence', router)
 
         # Load expected results from the command
index 0531e81d4431d4fbe2093cbf3a42cd7d8bea3cce..18b72772fe4923097e215171992590e1106b7f70 100644 (file)
@@ -147,7 +147,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
@@ -2893,7 +2893,7 @@ def test_ospf_type5_summary_tc51_p2(request):
 
     step("Configure and re configure all the commands 10 times in a loop.")
 
-    for itrate in range(0, 10):
+    for _ in range(0, 10):
         ospf_summ_r1 = {
             "r0": {
                 "ospf": {
index 603aeadb855b7735fae6109d403495aa9d3bcf7a..cdc5d126b47f17a8ebe7424db3614432fd00f49e 100644 (file)
@@ -139,7 +139,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index 8dd103013b4eb4df5832603778a083554df3ee8d..922c5a0e0b3c344caf983b808555807128bc2f05 100644 (file)
@@ -109,7 +109,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index e58f081f96366790df597f63e3dbc532789b2819..dc237e9512cd587ab0caad90b1a891531feee221 100644 (file)
@@ -118,7 +118,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index aba313db9f73fe8452f40f008dffb2cfe13b13a1..21e767522adba97c9b4875af7f7b4f6f78098050 100644 (file)
@@ -121,7 +121,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
@@ -193,7 +193,7 @@ def test_ospf_ecmp_tc16_p0(request):
 
     step("Verify that route in R2 in stalled with 8 next hops.")
     nh = []
-    for item in range(1, 7):
+    for _ in range(1, 7):
         nh.append(topo["routers"]["r0"]["links"]["r1-link1"]["ipv4"].split("/")[0])
 
     nh2 = topo["routers"]["r0"]["links"]["r1"]["ipv4"].split("/")[0]
index 62b821220334db2771b8329dc6569a5bb484dd91..7c37af02ace8db362f5164b4019197e2bbd61fdc 100644 (file)
@@ -51,7 +51,6 @@ from lib.common_config import (
     create_static_routes,
     step,
     topo_daemons,
-    shutdown_bringup_interface,
     check_router_status,
     start_topology,
     write_test_header,
@@ -65,8 +64,6 @@ from lib.common_config import (
     write_test_header,
     write_test_footer,
     reset_config_on_routers,
-    stop_router,
-    start_router,
     step,
     create_static_routes,
     kill_router_daemons,
@@ -163,7 +160,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index 4a40b3e9ecaeec31ab2953987d661cc7dbea6d27..9c531c03abae8bc22e1c80c011a9914297af3744 100644 (file)
@@ -119,7 +119,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index a90d7dbdc05fad5db3da7ce1c11e7eda7864dacc..6aec98c71bb2b493e2bfe51816f09059f23398cc 100644 (file)
@@ -105,7 +105,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index c9f43cdfe497711cc55f2e528c8e68c3b77936d6..eee51796c929a56b2b98c4a0f6b8f6f37d7c82fd 100644 (file)
@@ -134,7 +134,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index d169245f4e43a3db1129355e67ac0a9e763d15b5..193f5c8c5f0860babc3864560f7de1579c5cf633 100644 (file)
@@ -130,7 +130,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
@@ -208,7 +208,7 @@ def test_ospf_redistribution_tc5_p0(request):
     assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
 
     dut = "r1"
-    for num in range(0, nretry):
+    for _ in range(0, nretry):
         result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh, expected=False)
         if result is not True:
             break
@@ -332,7 +332,7 @@ def test_ospf_redistribution_tc6_p0(request):
     assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
 
     dut = "r1"
-    for num in range(0, nretry):
+    for _ in range(0, nretry):
         result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh, expected=False)
         if result is not True:
             break
index 59afc7a8afcd7d7080f5fa3ecd906b6dffad0a06..33841b9ab20a6c6aa500c2daf6ca27067cbef167 100644 (file)
@@ -115,7 +115,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index ade55321f9b6e2c1ad2b39eaedf61dfc00e47f57..2d1637995269623b0ecc0870e9eb6af575330d11 100644 (file)
@@ -72,7 +72,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index 79374281cb7a3ff289c792186f888be22c9b7089..3bed390b1882ab597119fe93af9b115cb8b711c9 100644 (file)
@@ -29,7 +29,6 @@ from lib.common_config import (
     write_test_footer,
     reset_config_on_routers,
     step,
-    create_interfaces_cfg,
     scapy_send_raw_packet,
 )
 
@@ -38,7 +37,6 @@ from lib.topojson import build_config_from_json
 
 from lib.ospf import (
     verify_ospf_neighbor,
-    clear_ospf,
     verify_ospf_gr_helper,
     create_router_ospf,
 )
index 3be28196d884f9eb0211d7fed03c5797d4968102..a9028673d20530424a67337e0da42d39323a9b3a 100644 (file)
@@ -29,7 +29,6 @@ from lib.common_config import (
     write_test_footer,
     reset_config_on_routers,
     step,
-    create_interfaces_cfg,
     scapy_send_raw_packet,
 )
 
@@ -38,7 +37,6 @@ from lib.topojson import build_config_from_json
 
 from lib.ospf import (
     verify_ospf_neighbor,
-    clear_ospf,
     verify_ospf_gr_helper,
     create_router_ospf,
 )
index 73185d501def086c575e586df767989ffb23c2bd..73b660e59031b976d94c1e6c99ee8ab9d18dc194 100755 (executable)
@@ -144,7 +144,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 590b0d5e68d4a8bbcdd1db1ebc27a7af1f8adf8b..ea4507736e74674c2748438fcb7e802366b60beb 100644 (file)
@@ -15,7 +15,6 @@ test_ospf_instance_redistribute
 """
 
 import os
-import re
 import sys
 import pytest
 import json
index 085eb1f9c123c26955d3c1a93153d007b61123a7..b9c63622f019278d74a6d778aad32d8c5a8121d4 100644 (file)
 import os
 import sys
 import json
-from time import sleep
 from functools import partial
 import pytest
 
 # pylint: disable=C0413
 # Import topogen and topotest helpers
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 from lib.topolog import logger
 
 
@@ -166,7 +165,7 @@ def setup_module(mod):
             tgen.set_error("unsupported version")
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
index ee0a0f6c3be0f3d1c080c28fdb75bbf06c445da4..10a0051a472b3482df4eef721a76f7654bdae17c 100644 (file)
@@ -16,7 +16,7 @@ import pytest
 # pylint: disable=C0413
 # Import topogen and topotest helpers
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 from lib.topolog import logger
 
 
@@ -139,7 +139,7 @@ def setup_module(mod):
             tgen.set_error("unsupported version")
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
index 23eef8f5a6337d8f9cccc890c93948d277829e85..eae8806a5943eac30fca5b1930180616d8f8e31b 100644 (file)
@@ -104,13 +104,13 @@ def setup_module(mod):
             tgen.set_error("unsupported version")
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
     # Move interfaces out of vrf namespace and delete the namespace
     router_list = tgen.routers()
-    for rname, router in router_list.items():
+    for rname, _ in router_list.items():
         tgen.net[rname].reset_intf_netns(rname + "-eth0")
         tgen.net[rname].reset_intf_netns(rname + "-eth1")
         tgen.net[rname].delete_netns(rname + "-ospf-cust1")
index d8cd1322bd5c07cf56b914b43df450ea336012a8..4a67fa33a6fe6f1b5843dbc92e056f9222aa8a0d 100644 (file)
@@ -106,7 +106,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 1f0f87959af190bb31b43f7fa94fa7accea65503..cce116e9748b7a04aeda88668988f9042d9caafd 100644 (file)
@@ -9,21 +9,16 @@
 
 import os
 import sys
-import json
-from time import sleep
 from functools import partial
 import pytest
 
 # pylint: disable=C0413
 # Import topogen and topotest helpers
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 from lib.topolog import logger
 
 from lib.common_config import (
-    run_frr_cmd,
-    shutdown_bringup_interface,
-    start_router_daemons,
     step,
 )
 
@@ -112,7 +107,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
index 175dca74e7a99e88d2dfa8ecce0bc801e3674638..3c9e1b1a6f4f5b726a97dd6a097ddf27a5b2e779 100644 (file)
@@ -10,7 +10,6 @@
 
 import os
 import sys
-import json
 from time import sleep
 from functools import partial
 import pytest
@@ -18,13 +17,10 @@ import pytest
 # pylint: disable=C0413
 # Import topogen and topotest helpers
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 from lib.topolog import logger
 
 from lib.common_config import (
-    run_frr_cmd,
-    shutdown_bringup_interface,
-    start_router_daemons,
     step,
 )
 
@@ -116,7 +112,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
index d5ea7ebc40480bb4355bad3feb7188de2e5a957b..f91cba8d3c570b588d28d10a696a7b2d40e546f4 100644 (file)
 
 import os
 import sys
-import json
-from time import sleep
 from functools import partial
 import pytest
 
 # pylint: disable=C0413
 # Import topogen and topotest helpers
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 from lib.topolog import logger
 
 from lib.common_config import (
-    run_frr_cmd,
-    shutdown_bringup_interface,
-    start_router_daemons,
     step,
 )
 
@@ -125,7 +120,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
index e53b5f5b1e5285494e03c1d513d3d1b8c9047be5..0a8d8456daab74c610c46b9dc234f71a21ff1c96 100644 (file)
@@ -14,12 +14,11 @@ from functools import partial
 import pytest
 
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 from lib.topolog import logger
 
 from lib.common_config import verify_rib
 from lib.ospf import verify_ospf_rib
-from _ast import Try
 
 pytestmark = pytest.mark.ospfd
 
@@ -86,7 +85,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Tear-down the test environment"
     tgen = get_topogen()
     tgen.stop_topology()
index 21ae14323137c9671a35a59e8897ce0c994630e9..ec076bb3ccfd0b7865da4cc623a4d8c8262d9c4a 100755 (executable)
@@ -164,7 +164,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 936b438e9d7c28bcfeaf41e1000890a2b5ceae97..bac585dd8f9668cf6199fed64fc4e95c1219fd41 100644 (file)
@@ -136,7 +136,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 8b3fc5808aad15f5e451bc063e6a59ad2f5c17ec..7f9ad27eab99cafeb182a5db78ecef33b9231948 100644 (file)
@@ -24,7 +24,6 @@ import os
 import sys
 import json
 from functools import partial
-import re
 import pytest
 
 # Save the Current Working Directory to find configuration files.
index f939f3f578f087b48f87696f36beeb2b72796f41..246672488844917ea873555f80f2c22cee8d7896 100644 (file)
@@ -110,7 +110,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index a079f5698ff1113d1e942d522c758831cb73309c..b9bdee3db467c2bebb070bf49a42d261297567c1 100644 (file)
@@ -93,7 +93,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
index 8be06e41aff27ef21e75de43725097bbe04a885c..45ae338a245d22eaf5e2989e0837a62bb359c799 100644 (file)
@@ -66,7 +66,7 @@ def tgen(request):
 
     router_list = tgen.routers()
 
-    for rname, router in router_list.items():
+    for _, router in router_list.items():
         router.load_frr_config("frr.conf")
 
     tgen.start_router()
index d07f5dc5c9a0225db42c18c91cc5fad09d2c5d32..712c4e1d7c0e0b208d8813628d5fbbb9b981d141 100644 (file)
@@ -89,7 +89,7 @@ def setup_module(mod):
     # tgen.mininet_cli()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
index c0dd85cba077d8f112e4ad698c9a870999e7a9b4..a97b1145476e82d608c0968cde302a5a49d91154 100644 (file)
@@ -92,7 +92,7 @@ def setup_module(mod):
     # tgen.mininet_cli()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
index 626a9d31854b6000e1b5c573b15230cd9f30dbec..89a34ff9b58d438691e7191e31544a16b0cdfa1a 100644 (file)
@@ -16,7 +16,6 @@ import signal
 import subprocess
 import sys
 import time
-from datetime import datetime, timedelta
 from functools import partial
 
 import pytest
@@ -35,8 +34,7 @@ from lib.topotest import interface_set_status, json_cmp
 # pylint: disable=C0413
 # Import topogen and topotest helpers
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
-from lib.topolog import logger
+from lib.topogen import Topogen, TopoRouter
 
 pytestmark = [pytest.mark.ospfd]
 
index 49c25ab8f6da6da0ed922c126d9b049b336244de..c431147e5591b3df3a6e83f11bd89af5cedea765 100644 (file)
@@ -29,7 +29,6 @@ from time import sleep
 from lib.common_config import (
     start_topology,
     write_test_header,
-    kill_router_daemons,
     write_test_footer,
     reset_config_on_routers,
     stop_router,
@@ -37,7 +36,6 @@ from lib.common_config import (
     verify_rib,
     create_static_routes,
     step,
-    start_router_daemons,
     create_route_maps,
     shutdown_bringup_interface,
     create_prefix_lists,
@@ -163,7 +161,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
@@ -2456,7 +2454,7 @@ def test_ospfv3_type5_summary_tc51_p2(request):
 
     step("Configure and re configure all the commands 10 times in a loop.")
 
-    for itrate in range(0, 10):
+    for _ in range(0, 10):
         ospf_summ_r1 = {
             "r0": {
                 "ospf6": {
index 00c98ac97c2609470ab7739e7a9c8c23c6cdbb31..5f88f6d8357ca3041a8fa22da9d93d800a4d58ec 100644 (file)
@@ -14,9 +14,7 @@ import sys
 import time
 import pytest
 from time import sleep
-from copy import deepcopy
 import json
-from lib.topotest import frr_unicode
 
 pytestmark = pytest.mark.ospf6d
 
@@ -39,11 +37,8 @@ from lib.common_config import (
     shutdown_bringup_interface,
 )
 from lib.topolog import logger
-from lib.topojson import build_topo_from_json, build_config_from_json
-from lib.ospf import verify_ospf6_neighbor, config_ospf6_interface, clear_ospf
-from ipaddress import IPv4Address
-
-# Global variables
+from lib.topojson import build_config_from_json
+from lib.ospf import verify_ospf6_neighbor, config_ospf6_interface
 topo = None
 # Reading the data from JSON File for topology creation
 jsonFile = "{}/ospfv3_authentication.json".format(CWD)
@@ -118,7 +113,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
     * `mod`: module name
index 0c1e3fa43e878cc6455b0225c7844ba922506cdb..45652a3ee8e623bdf4b98deebc37ca2dad94285d 100644 (file)
@@ -122,7 +122,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
@@ -285,7 +285,7 @@ def test_ospfv3_ecmp_tc16_p0(request):
 
     step("Verify that route in R2 in stalled with 8 next hops.")
     nh = []
-    for item in range(1, 7):
+    for _ in range(1, 7):
         nh.append(llip)
 
     llip = get_llip("r0", "r1")
index 7c6773260edf8f924b7c89da2f09772597ccacac..95f2493c2a8b85de0767aa2ea97ec032308a9231 100644 (file)
@@ -13,11 +13,6 @@ import os
 import sys
 import time
 import pytest
-import json
-from copy import deepcopy
-from ipaddress import IPv4Address
-from lib.topotest import frr_unicode
-import ipaddress
 
 # Save the Current Working Directory to find configuration files.
 CWD = os.path.dirname(os.path.realpath(__file__))
@@ -37,9 +32,6 @@ from lib.common_config import (
     verify_rib,
     create_static_routes,
     step,
-    create_route_maps,
-    shutdown_bringup_interface,
-    create_interfaces_cfg,
     get_frr_ipv6_linklocal,
 )
 from lib.topolog import logger
@@ -47,16 +39,11 @@ from lib.topojson import build_config_from_json
 
 from lib.ospf import (
     verify_ospf6_neighbor,
-    config_ospf_interface,
     clear_ospf,
     verify_ospf6_rib,
     create_router_ospf,
-    verify_ospf6_interface,
-    verify_ospf6_database,
-    config_ospf6_interface,
 )
 
-from ipaddress import IPv6Address
 
 pytestmark = [pytest.mark.ospfd, pytest.mark.staticd]
 
@@ -137,7 +124,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index dc4ce888306e846b4860cf5d635f05db658b5705..cc96cd1731b7a36db846d603f795dcaeaba79821 100644 (file)
@@ -78,7 +78,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index 5a6c377aefe060b23b3b0e505fef6f4fc2ef06ec..4ad725e3e69ad683ce68b612e70ffed04d300237 100644 (file)
@@ -13,15 +13,10 @@ import os
 import sys
 import time
 import pytest
-from copy import deepcopy
 import ipaddress
 from lib.ospf import (
     verify_ospf6_neighbor,
-    config_ospf6_interface,
-    clear_ospf,
     verify_ospf6_rib,
-    verify_ospf6_interface,
-    verify_ospf6_database,
     create_router_ospf,
 )
 
@@ -29,12 +24,6 @@ from lib.ospf import (
 # Import topogen and topotest helpers
 from lib.topogen import Topogen, get_topogen
 
-from lib.bgp import (
-    verify_bgp_convergence,
-    create_router_bgp,
-    clear_bgp_and_verify,
-    verify_bgp_rib,
-)
 from lib.topolog import logger
 from lib.common_config import (
     start_topology,
@@ -44,12 +33,9 @@ from lib.common_config import (
     verify_rib,
     create_static_routes,
     step,
-    create_route_maps,
-    shutdown_bringup_interface,
     create_interfaces_cfg,
     check_router_status,
 )
-from ipaddress import IPv4Address
 from lib.topolog import logger
 from lib.topojson import build_config_from_json
 
index 069806a3ef46cfa548b98eafe1bb35011aeec5f2..ff88badeebcc3bcc7a9d28454f8cdfc89e28f364 100644 (file)
@@ -136,7 +136,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index 916f655550b5e9450d5cba46d628c371adab6951..06989db894de84eb4efbd12154f85def3273c023 100644 (file)
@@ -45,7 +45,6 @@ from lib.ospf import (
     verify_ospf6_neighbor,
     clear_ospf,
     verify_ospf6_rib,
-    verify_ospf_database,
     create_router_ospf,
     config_ospf6_interface,
     verify_ospf6_interface,
@@ -127,7 +126,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index 3bafd27f24e463cc9b37828ef9a36bd060911439..15e0f5316ea0f22c47709575133078351950e9a7 100644 (file)
@@ -36,7 +36,6 @@ from lib.common_config import (
     step,
     create_interfaces_cfg,
     create_debug_log_config,
-    apply_raw_config,
 )
 from lib.topolog import logger
 from lib.topojson import build_config_from_json
@@ -121,7 +120,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index 6e5092dabb5044fb9700996a9b9cb8d6376b00ed..d8eececf81513aafeeb054be6d409ffaacdd4bea 100755 (executable)
@@ -169,7 +169,7 @@ def setup_module(module):
     tgen.start_router()
 
 
-def teardown_module(module):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
index 85b49aacc665ec92f5f62ccead2b424aca9edeb7..ce1abe42bb0985e23ee91a677e2cc6bd00740a18 100644 (file)
@@ -88,7 +88,7 @@ def setup_module(mod):
     # tgen.mininet_cli()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index 01c496d70388f12bd3acbb048fd0fb75672a0f7c..d6d879d45fe76da6834ffd311488b1e8764c1c13 100755 (executable)
@@ -92,7 +92,7 @@ from lib import topotest
 from lib.topogen import Topogen, TopoRouter, get_topogen
 from lib.topolog import logger
 from lib.topotest import iproute2_is_vrf_capable
-from lib.common_config import required_linux_kernel_version, retry
+from lib.common_config import required_linux_kernel_version
 from lib.pim import McastTesterHelper
 
 
@@ -205,7 +205,7 @@ def setup_module(module):
         )
 
 
-def teardown_module(module):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
index 7d958fd496d6b9f4949f45a452176819a99c8399..c07b1ffc152187c68817959b0d4f3b8ac67f8a52 100644 (file)
@@ -20,7 +20,7 @@ sys.path.append(os.path.join(CWD, "../"))
 
 # pylint: disable=C0413
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 from lib.common_config import step
 
 pytestmark = [pytest.mark.ripd]
@@ -39,7 +39,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
index d03d5479fd81ec4e076e3571ed541c99530d9ea3..26680f54600eedc389e8b0a75b69dbede5cde248 100644 (file)
@@ -20,7 +20,6 @@ import pytest
 from functools import partial
 from lib import topotest
 from lib.topogen import Topogen, TopoRouter
-from lib.topolog import logger
 
 pytestmark = [
     pytest.mark.bfdd,
index c2b28c4a3efeccbac6b1ca87801009e73f68762c..ebc36d1fdc1c11ad2ae5156f241bc38683691401 100644 (file)
@@ -21,7 +21,7 @@ sys.path.append(os.path.join(CWD, "../"))
 
 # pylint: disable=C0413
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 from lib.common_config import step
 
 pytestmark = [pytest.mark.ripd]
@@ -40,7 +40,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
index 08bb9999288e62071cf7bcc3e63653b77f2f64db..060b558f0df3eb6a6f9fb3d7e4be25ecd6843fd8 100644 (file)
@@ -20,7 +20,7 @@ sys.path.append(os.path.join(CWD, "../"))
 
 # pylint: disable=C0413
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topogen import Topogen, get_topogen
 from lib.common_config import step
 
 pytestmark = [pytest.mark.ripngd]
@@ -39,7 +39,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
index e1cc88e9b68ddcbf41110f4f776329f2540cd64c..4fadb5fbcf7f5bfd6e263c331cf5242f8bd05c18 100644 (file)
@@ -20,8 +20,7 @@ sys.path.append(os.path.join(CWD, "../"))
 
 # pylint: disable=C0413
 from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
-from lib.common_config import step
+from lib.topogen import Topogen, get_topogen
 
 pytestmark = [pytest.mark.ripngd]
 
@@ -39,7 +38,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
index b3cba1cb4e3f17ef6ab24dc039ecece6fa976753..3e20296018dd6af020b061a42c3a98d5896e3427 100644 (file)
@@ -182,7 +182,6 @@ def route_install_helper(iter):
 
     # Build up a list of dicts with params for each step of the test;
     # use defaults where the step doesn't supply a value
-    scale_setups = []
     s = scale_steps[iter]
 
     d = dict(zip(scale_keys, s))
index ccbdd515954e0cabfd6a5b3c3b3e51f7152a73b6..68af979c2ffdd69ea2f7fdcd43c0b05f9a702a10 100644 (file)
@@ -14,11 +14,8 @@ test_route_scale1.py: Testing route scale
 
 """
 import os
-import re
 import sys
 import pytest
-import json
-from functools import partial
 
 # Save the Current Working Directory to find configuration files.
 CWD = os.path.dirname(os.path.realpath(__file__))
@@ -26,9 +23,6 @@ sys.path.append(os.path.join(CWD, "../"))
 
 # pylint: disable=C0413
 # Import topogen and topotest helpers
-from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
-from lib.topolog import logger
 
 from scale_test_common import (
     scale_build_common,
index e244d4fbbc02f154f2276330b7472fb337de053c..4be8554a0f2b090d7a230dd150911336ca0a2ae1 100644 (file)
@@ -14,11 +14,8 @@ test_route_scale2.py: Testing route scale
 
 """
 import os
-import re
 import sys
 import pytest
-import json
-from functools import partial
 
 # Save the Current Working Directory to find configuration files.
 CWD = os.path.dirname(os.path.realpath(__file__))
@@ -26,9 +23,6 @@ sys.path.append(os.path.join(CWD, "../"))
 
 # pylint: disable=C0413
 # Import topogen and topotest helpers
-from lib import topotest
-from lib.topogen import Topogen, TopoRouter, get_topogen
-from lib.topolog import logger
 
 from scale_test_common import (
     scale_build_common,
index ee02c7b519938856e37c70d97b4747fb87390719..0387e29274054fd38889f232c1afa6739de1f73a 100755 (executable)
@@ -79,7 +79,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
 
index b8bcab8d93e1b850dd354d281721e7d57f97b1cb..854bc1cdade94748ba4c02de8f5834962493baef 100755 (executable)
@@ -18,7 +18,6 @@ import os
 import sys
 import json
 import pytest
-import functools
 
 CWD = os.path.dirname(os.path.realpath(__file__))
 sys.path.append(os.path.join(CWD, "../"))
@@ -56,7 +55,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
index 3a27d9c2fc5f00af5e3acd879ed57f7a4b3a308b..bab6746409ab93e7d15c17e860d678cf45600ea9 100755 (executable)
@@ -56,7 +56,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
@@ -81,12 +81,12 @@ def test_srv6():
 
     def check_srv6_locator(router, expected_file):
         func = functools.partial(_check_srv6_locator, router, expected_file)
-        success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
+        _, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
         assert result is None, "Failed"
 
     def check_sharpd_chunk(router, expected_file):
         func = functools.partial(_check_sharpd_chunk, router, expected_file)
-        success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
+        _, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
         assert result is None, "Failed"
 
     # FOR DEVELOPER:
index 92980d3b179e75505ba814cdb7166335f5453707..d3df902aaed19dc18db54a2be96860a37fcea03c 100755 (executable)
@@ -52,7 +52,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
@@ -77,12 +77,12 @@ def test_srv6():
 
     def check_srv6_locator(router, expected_file):
         func = functools.partial(_check_srv6_locator, router, expected_file)
-        success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
+        _, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
         assert result is None, "Failed"
 
     def check_sharpd_chunk(router, expected_file):
         func = functools.partial(_check_sharpd_chunk, router, expected_file)
-        success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
+        _, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
         assert result is None, "Failed"
 
     # FOR DEVELOPER:
index 54187351b2f491296c1b42c00522e8b31b1433a6..e0c05c517991667eabfbb9c29b7a95c50b9e60e7 100755 (executable)
@@ -49,7 +49,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
@@ -70,13 +70,13 @@ def _check_sharpd_chunk(router, expected_chunk_file):
 
 def check_srv6_locator(router, expected_file):
     func = functools.partial(_check_srv6_locator, router, expected_file)
-    success, result = topotest.run_and_expect(func, None, count=5, wait=3)
+    _, result = topotest.run_and_expect(func, None, count=5, wait=3)
     assert result is None, "Failed"
 
 
 def check_sharpd_chunk(router, expected_file):
     func = functools.partial(_check_sharpd_chunk, router, expected_file)
-    success, result = topotest.run_and_expect(func, None, count=5, wait=3)
+    _, result = topotest.run_and_expect(func, None, count=5, wait=3)
     assert result is None, "Failed"
 
 
index 7a4cd39f2dddfd7071d1b30fce8f734d2f984715..f23e199d4a6f1b8c6aa23b0c6f26529d666e32d6 100755 (executable)
@@ -55,7 +55,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
@@ -74,7 +74,7 @@ def test_srv6_static_route():
 
     def check_srv6_static_route(router, expected_file):
         func = functools.partial(_check_srv6_static_route, router, expected_file)
-        success, result = topotest.run_and_expect(func, None, count=15, wait=1)
+        _, result = topotest.run_and_expect(func, None, count=15, wait=1)
         assert result is None, "Failed"
 
     # FOR DEVELOPER:
index c1e249cc8f0fc0afe4e62f5ddc931ff4ade487f2..a0f11c0126bcc4c2f23973f29760c87460b2030d 100644 (file)
@@ -14,11 +14,8 @@ test_static_routing_mpls.py: Testing MPLS configuration with mpls interface sett
 """
 
 import os
-import re
 import sys
 import pytest
-import json
-from functools import partial
 import functools
 
 # Save the Current Working Directory to find configuration files.
@@ -113,7 +110,7 @@ def _check_mpls_state(router, interface, configured=True):
     test_func = functools.partial(
         _check_mpls_state_interface, router, interface, up=configured
     )
-    success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+    success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
     return success
 
 
index e01351506d9e626d18b11ff0eb1a4f621969e1f7..0d6b3e7b1d68587474b3ad49483733802732f997 100644 (file)
@@ -150,7 +150,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment
 
index 9d35b7dcd3c8d72693200a378d0fb3f6dc9c10c1..ff349f279ec14696a7c3b79653770100631dcc0f 100644 (file)
@@ -134,7 +134,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment
 
index 3e03055acdc00a05f6e56060465a7527c0b71916..c74d8d70a6d150434a1e6aaec5d52233adf4bc2a 100644 (file)
@@ -113,7 +113,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index abae75e76e2ff36c4840a49115b770e401779ae4..926a9909e1c4ed57508fa247fc427d2e245e034b 100644 (file)
@@ -110,7 +110,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment
 
index 820a736ad7c19b949002547aa1e6f3df6050f577..933e5410958b1d4d0718d7bc1a2df3107baea98e 100644 (file)
@@ -152,7 +152,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment
 
index 1ad963f314e1d3a9a247323a3528da5a220ad77d..9fabd9d5714b689df9807e6ca0d7d23e03f89dab 100644 (file)
@@ -133,7 +133,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment
 
index 0fc81aaf1ed28f9ba260213763ee45455aee91b0..f1b7606e79f6630f8c3ac2dafbeb117125222ed8 100644 (file)
@@ -111,7 +111,7 @@ def setup_module(mod):
     logger.info("Running setup_module() done")
 
 
-def teardown_module(mod):
+def teardown_module():
     """
     Teardown the pytest environment.
 
index f862d81239c9091c6030f0fc604cc3a9f9c77cfc..bb3580a1d8b243b9a041efd18372a57e8b625bb8 100644 (file)
@@ -13,11 +13,10 @@ import datetime
 import ipaddress
 import math
 import os
-import sys
 import re
 
 import pytest
-from lib.topogen import TopoRouter, Topogen, get_topogen
+from lib.topogen import TopoRouter, Topogen
 from lib.topolog import logger
 from lib.common_config import retry, step
 
@@ -80,7 +79,7 @@ def check_kernel(r1, super_prefix, count, add, is_blackhole, vrf, matchvia):
         kernel = r1.run(f"ip -4 route show{vrfstr}")
 
     logger.debug("checking kernel routing table%s:\n%s", vrfstr, kernel)
-    for i, net in enumerate(get_ip_networks(super_prefix, count)):
+    for _, net in enumerate(get_ip_networks(super_prefix, count)):
         if not add:
             assert str(net) not in kernel
             continue
@@ -116,7 +115,6 @@ def do_config(
     else:
         super_prefix = "2001::/48" if do_ipv6 else "10.0.0.0/8"
 
-    matchtype = ""
     matchvia = ""
     if via == "blackhole":
         pass
@@ -146,7 +144,7 @@ def do_config(
         if vrf:
             f.write("vrf {}\n".format(vrf))
 
-        for i, net in enumerate(get_ip_networks(super_prefix, count)):
+        for _, net in enumerate(get_ip_networks(super_prefix, count)):
             if add:
                 f.write("ip route {} {}\n".format(net, via))
             else:
index 0b2937c12a283eacf519867f6529c7a6917065ce..dc47527c74c2a9658cc09616b369d8115bcd15f5 100644 (file)
@@ -15,7 +15,6 @@ test_zebra_multiple_connected.py: Testing multiple connected
 """
 
 import os
-import re
 import sys
 import pytest
 import json
@@ -29,7 +28,6 @@ sys.path.append(os.path.join(CWD, "../"))
 # Import topogen and topotest helpers
 from lib import topotest
 from lib.topogen import Topogen, TopoRouter, get_topogen
-from lib.topolog import logger
 
 # Required to instantiate the topology builder class.
 
@@ -157,7 +155,7 @@ def test_zebra_noprefix_connected():
     test_func = partial(
         topotest.router_output_cmp, router, "show ip route 192.168.44.0/24", expected
     )
-    result, diff = topotest.run_and_expect(test_func, "", count=20, wait=1)
+    result, _ = topotest.run_and_expect(test_func, "", count=20, wait=1)
     assert result, "Connected Route should not have been added"
 
 
index d970c04ee2d843332d6ccb0a2a933b67160efa9f..3748f9c4e3a66f95aab4735eebb9731db730cd7c 100644 (file)
@@ -13,9 +13,7 @@ test_zebra_netlink.py: Test some basic interactions with kernel using Netlink
 """
 # pylint: disable=C0413
 import ipaddress
-import json
 import sys
-from functools import partial
 
 import pytest
 from lib import topotest
@@ -42,7 +40,7 @@ def tgen(request):
 
     # Initialize all routers.
     router_list = tgen.routers()
-    for rname, router in router_list.items():
+    for _, router in router_list.items():
         router.load_config(TopoRouter.RD_ZEBRA, "zebra.conf")
         router.load_config(TopoRouter.RD_SHARP)
 
index fbef0fefc7c99d891860a644e7c133f0630d880a..16e458062d335179cd3d2f736c7014a29dee916e 100644 (file)
@@ -16,7 +16,6 @@ import sys
 import pytest
 
 from lib.common_config import (
-    start_topology,
     verify_rib,
     verify_ip_nht,
     step,
@@ -24,7 +23,6 @@ from lib.common_config import (
 )
 
 # pylint: disable=C0413
-from lib import topotest
 from lib.topogen import Topogen, TopoRouter, get_topogen
 from lib.topolog import logger
 
index 25fbb97806deeb52a59caf363317bf580edbdc09..4f49a69bdcaf8c1413ca1012ef12aecc731218cb 100644 (file)
@@ -32,7 +32,7 @@ def setup_module(mod):
 
     router_list = tgen.routers()
 
-    for i, (rname, router) in enumerate(router_list.items(), 1):
+    for _, (rname, router) in enumerate(router_list.items(), 1):
         router.load_config(
             TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
         )
@@ -49,7 +49,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     tgen = get_topogen()
     tgen.stop_topology()
 
@@ -98,17 +98,17 @@ def test_zebra_opaque():
 
     router = tgen.gears["r1"]
     test_func = functools.partial(_bgp_converge, router)
-    success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+    _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
     assert result is None, 'Cannot see BGP community aliases "{}"'.format(router)
 
     router = tgen.gears["r3"]
     test_func = functools.partial(_ospf_converge, router)
-    success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+    _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
     assert result is None, 'Cannot see OSPFv2 opaque attributes "{}"'.format(router)
 
     router = tgen.gears["r3"]
     test_func = functools.partial(_ospf6_converge, router)
-    success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+    _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
     assert result is None, 'Cannot see OSPFv3 opaque attributes "{}"'.format(router)
 
 
index 05036fa7ad47cb6c743f92eac5531ffaab05f1f9..93296cd51aa69f8bddd591caade0a37a75388cae 100644 (file)
@@ -71,7 +71,7 @@ def setup_module(mod):
     tgen.start_router()
 
 
-def teardown_module(mod):
+def teardown_module():
     "Teardown the pytest environment"
     tgen = get_topogen()
     tgen.stop_topology()
@@ -235,7 +235,7 @@ def test_route_map_usage():
         return topotest.json_cmp(output, expected)
 
     test_func = partial(check_initial_routes_installed, r1)
-    success, result = topotest.run_and_expect(test_func, None, count=40, wait=1)
+    _, result = topotest.run_and_expect(test_func, None, count=40, wait=1)
 
     static_rmapfile = "%s/r1/static_rmap.ref" % (thisDir)
     expected = open(static_rmapfile).read().rstrip()
index 4a4cf0624f6b27784f14041cee72815950d76d84..f94b7d4a9c439bccf98916c108f819f1b572345b 100755 (executable)
@@ -80,7 +80,7 @@ def test_zebra_seg6_routes():
 
     expected = open_json_file(os.path.join(CWD, "{}/routes_setup.json".format("r1")))
     test_func = partial(check_connected, r1, "2001::/64", expected)
-    success, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
+    _, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
     assert result is None, "Failed to fully setup connected routes needed"
 
     manifests = open_json_file(os.path.join(CWD, "{}/routes.json".format("r1")))
@@ -96,7 +96,7 @@ def test_zebra_seg6_routes():
         )
         logger.info("CHECK {} {} {}".format(dest, nh, sid))
         test_func = partial(check, r1, dest, manifest["out"])
-        success, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
+        _, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
         assert result is None, "Failed"
 
 
index 0dc87741aacc982efc4668bb9b062e65787faa97..a90f5c9c9818ef53840b9547688da4504ea693cf 100755 (executable)
@@ -101,7 +101,7 @@ def test_zebra_seg6local_routes():
             dest,
             manifest["out"],
         )
-        success, result = topotest.run_and_expect(test_func, None, count=25, wait=1)
+        _, result = topotest.run_and_expect(test_func, None, count=25, wait=1)
         assert result is None, "Failed"