diff options
author | Christian Hopps <chopps@labn.net> | 2021-07-21 15:33:50 +0200 |
---|---|---|
committer | Christian Hopps <chopps@labn.net> | 2021-09-04 15:04:46 +0200 |
commit | c8e5983d8efa12eea0e91512802a84d46dd899e9 (patch) | |
tree | cef541c41d4cac9e0de71f946cebb3837844896f | |
parent | docker: update with micronet changes (diff) | |
download | frr-c8e5983d8efa12eea0e91512802a84d46dd899e9.tar.xz frr-c8e5983d8efa12eea0e91512802a84d46dd899e9.zip |
tests: fix pylint infra errors
Signed-off-by: Christian Hopps <chopps@labn.net>
-rw-r--r-- | tests/topotests/lib/bgp.py | 4 | ||||
-rw-r--r-- | tests/topotests/lib/bgprib.py | 2 | ||||
-rw-r--r-- | tests/topotests/lib/common_config.py | 3 | ||||
-rw-r--r-- | tests/topotests/lib/ospf.py | 6 | ||||
-rw-r--r-- | tests/topotests/lib/topojson.py | 5 | ||||
-rw-r--r-- | tests/topotests/lib/topotest.py | 6 |
6 files changed, 13 insertions, 13 deletions
diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py index 051b2eb97..753b24e52 100644 --- a/tests/topotests/lib/bgp.py +++ b/tests/topotests/lib/bgp.py @@ -25,8 +25,6 @@ import traceback from copy import deepcopy from time import sleep -import ipaddr - # Import common_config to use commomnly used APIs from lib.common_config import ( create_common_configurations, @@ -2268,7 +2266,7 @@ def verify_bgp_attributes( """ logger.debug("Entering lib API: {}".format(sys._getframe().f_code.co_name)) - for router, rnode in tgen.routers().iteritems(): + for router, rnode in tgen.routers().items(): if router != dut: continue diff --git a/tests/topotests/lib/bgprib.py b/tests/topotests/lib/bgprib.py index abab9600a..a216e3588 100644 --- a/tests/topotests/lib/bgprib.py +++ b/tests/topotests/lib/bgprib.py @@ -34,7 +34,7 @@ # ribRequireUnicastRoutes('r1','ipv4','','Customer routes in default',want_unicast_routes) # -from lutil import luCommand, luResult, LUtil +from lib.lutil import luCommand, luResult, LUtil import json import re diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py index df0fd8363..99a3a4a87 100644 --- a/tests/topotests/lib/common_config.py +++ b/tests/topotests/lib/common_config.py @@ -765,8 +765,7 @@ def get_frr_ipv6_linklocal(tgen, router, intf=None, vrf=None): ll_per_if_count = 0 # Interface ip - m1 = re_search('inet6 (fe80[:a-fA-F0-9]+[\/0-9]+)', - line) + m1 = re_search('inet6 (fe80[:a-fA-F0-9]+/[0-9]+)', line) if m1: local = m1.group(1) ll_per_if_count += 1 diff --git a/tests/topotests/lib/ospf.py b/tests/topotests/lib/ospf.py index ba926bf30..d6f1b0e00 100644 --- a/tests/topotests/lib/ospf.py +++ b/tests/topotests/lib/ospf.py @@ -25,8 +25,6 @@ from copy import deepcopy from ipaddress import IPv6Address from time import sleep -import ipaddr - # Import common_config to use commomnly used APIs from lib.common_config import ( create_common_configurations, @@ -1147,7 +1145,7 @@ def verify_ospf_rib( nh_found = False for st_rt in ip_list: - st_rt = str(ipaddr.IPNetwork(frr_unicode(st_rt))) + st_rt = str(ipaddress.ip_network(frr_unicode(st_rt))) _addr_type = validate_ip_address(st_rt) if _addr_type != "ipv4": @@ -1720,7 +1718,7 @@ def verify_ospf6_rib(tgen, dut, input_dict, next_hop=None, additional_nexthops_in_required_nhs = [] found_hops = [] for routerInput in input_dict.keys(): - for router, rnode in router_list.iteritems(): + for router, rnode in router_list.items(): if router != dut: continue diff --git a/tests/topotests/lib/topojson.py b/tests/topotests/lib/topojson.py index 710a7b0cc..1b00f83ab 100644 --- a/tests/topotests/lib/topojson.py +++ b/tests/topotests/lib/topojson.py @@ -25,7 +25,6 @@ from collections import OrderedDict from copy import deepcopy from re import search as re_search -import ipaddr import pytest from lib.bgp import create_router_bgp @@ -94,7 +93,7 @@ def build_topo_from_json(tgen, topo): # Physical Interfaces if "links" in topo["routers"][curRouter]: for destRouterLink, data in sorted( - topo["routers"][curRouter]["links"].iteritems() + topo["routers"][curRouter]["links"].items() ): currRouter_lo_json = topo["routers"][curRouter]["links"][destRouterLink] # Loopback interfaces @@ -275,7 +274,7 @@ def build_topo_from_json(tgen, topo): ] = "{}/{}".format( ipv6Next, topo["link_ip_start"]["v6mask"] ) - ipv6Next = ipaddr.IPv6Address(int(ipv6Next) + ipv6Step) + ipv6Next = ipaddress.IPv6Address(int(ipv6Next) + ipv6Step) logger.debug( "Generated link data for router: %s\n%s", diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 611230064..76a9430fa 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -44,8 +44,10 @@ from lib.topolog import logger if sys.version_info[0] > 2: import configparser + from collections.abc import Mapping else: import ConfigParser as configparser + from collections import Mapping from lib import micronet from lib.micronet_compat import Node @@ -2071,3 +2073,7 @@ def frr_unicode(s): return s else: return unicode(s) # pylint: disable=E0602 + + +def is_mapping(o): + return isinstance(o, Mapping) |