summaryrefslogtreecommitdiff
path: root/tests/topotests/lib/common_config.py
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-07-09 20:20:36 -0400
committerGitHub <noreply@github.com>2020-07-09 20:20:36 -0400
commitaf83fd8b7b0e9d18384bc6f0ff16542d7fd204b5 (patch)
tree5bf98debe8e21acbb239fbcb268f5b03c0df8b74 /tests/topotests/lib/common_config.py
parent4030687aab47da7ea11ff2420fdda016e0e7f9d5 (diff)
parent8b547a6dab841c878bdd3c048e5d89cb96ed70f4 (diff)
Merge pull request #6709 from mjstapp/fix_topo_ipaddr
tests: use ipaddress module; tolerate missing support bundle file
Diffstat (limited to 'tests/topotests/lib/common_config.py')
-rw-r--r--tests/topotests/lib/common_config.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py
index 21ed47fc4b..fb82b50628 100644
--- a/tests/topotests/lib/common_config.py
+++ b/tests/topotests/lib/common_config.py
@@ -36,7 +36,7 @@ import sys
import ConfigParser
import traceback
import socket
-import ipaddr
+import ipaddress
from lib.topolog import logger, logger_config
from lib.topogen import TopoRouter, get_topogen
@@ -1066,10 +1066,10 @@ def generate_ips(network, no_of_ips):
addr_type = validate_ip_address(start_ip)
if addr_type == "ipv4":
- start_ip = ipaddr.IPv4Address(unicode(start_ip))
+ start_ip = ipaddress.IPv4Address(unicode(start_ip))
step = 2 ** (32 - mask)
if addr_type == "ipv6":
- start_ip = ipaddr.IPv6Address(unicode(start_ip))
+ start_ip = ipaddress.IPv6Address(unicode(start_ip))
step = 2 ** (128 - mask)
next_ip = start_ip
@@ -1077,7 +1077,7 @@ def generate_ips(network, no_of_ips):
while count < no_of_ips:
ipaddress_list.append("{}/{}".format(next_ip, mask))
if addr_type == "ipv6":
- next_ip = ipaddr.IPv6Address(int(next_ip) + step)
+ next_ip = ipaddress.IPv6Address(int(next_ip) + step)
else:
next_ip += step
count += 1
@@ -2273,7 +2273,7 @@ def verify_rib(
nh_found = False
for st_rt in ip_list:
- st_rt = str(ipaddr.IPNetwork(unicode(st_rt)))
+ st_rt = str(ipaddress.ip_network(unicode(st_rt)))
_addr_type = validate_ip_address(st_rt)
if _addr_type != addr_type:
@@ -2469,7 +2469,7 @@ def verify_rib(
nh_found = False
for st_rt in ip_list:
- st_rt = str(ipaddr.IPNetwork(unicode(st_rt)))
+ st_rt = str(ipaddress.ip_network(unicode(st_rt)))
_addr_type = validate_ip_address(st_rt)
if _addr_type != addr_type: