aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_ip6.py11
-rw-r--r--test/test_ip_ecmp.py10
-rw-r--r--test/vpp_neighbor.py6
3 files changed, 21 insertions, 6 deletions
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 6793c8b0d94..6832498dc26 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -30,6 +30,11 @@ from ipaddress import IPv6Network, IPv4Network
AF_INET6 = socket.AF_INET6
+try:
+ text_type = unicode
+except NameError:
+ text_type = str
+
def mk_ll_addr(mac):
euid = in6_mactoifaceid(mac)
@@ -1060,9 +1065,9 @@ class TestIPv6RD(TestIPv6ND):
def verify_prefix_info(self, reported_prefix, prefix_option):
prefix = IPv6Network(
- unicode(prefix_option.getfieldval("prefix") +
- "/" +
- str(prefix_option.getfieldval("prefixlen"))),
+ text_type(prefix_option.getfieldval("prefix") +
+ "/" +
+ text_type(prefix_option.getfieldval("prefixlen"))),
strict=False)
self.assert_equal(reported_prefix.prefix.network_address,
prefix.network_address)
diff --git a/test/test_ip_ecmp.py b/test/test_ip_ecmp.py
index 60673ea6f3a..17b0a6c79c2 100644
--- a/test/test_ip_ecmp.py
+++ b/test/test_ip_ecmp.py
@@ -5,6 +5,7 @@ import random
import socket
from ipaddress import IPv4Address, IPv6Address, AddressValueError
+
from framework import VppTestCase, VppTestRunner
from util import ppp
@@ -13,6 +14,11 @@ from scapy.layers.l2 import Ether
from scapy.layers.inet import IP, UDP
from scapy.layers.inet6 import IPv6
+try:
+ text_type = unicode
+except NameError:
+ text_type = str
+
#
# The number of packets to sent.
#
@@ -79,10 +85,10 @@ class TestECMP(VppTestCase):
:return: Random IPv4 or IPv6 address from required range.
"""
try:
- ip_addr = IPv4Address(unicode(ip_addr_start))
+ ip_addr = IPv4Address(text_type(ip_addr_start))
ip_max_len = 32
except (AttributeError, AddressValueError):
- ip_addr = IPv6Address(unicode(ip_addr_start))
+ ip_addr = IPv6Address(text_type(ip_addr_start))
ip_max_len = 128
return str(ip_addr +
diff --git a/test/vpp_neighbor.py b/test/vpp_neighbor.py
index 7391447ff9b..b38aae89e74 100644
--- a/test/vpp_neighbor.py
+++ b/test/vpp_neighbor.py
@@ -7,10 +7,14 @@
from ipaddress import ip_address
from vpp_object import *
from vpp_papi import mac_pton, VppEnum
+try:
+ text_type = unicode
+except NameError:
+ text_type = str
def find_nbr(test, sw_if_index, nbr_addr, is_static=0, mac=None):
- ip_addr = ip_address(unicode(nbr_addr))
+ ip_addr = ip_address(text_type(nbr_addr))
e = VppEnum.vl_api_ip_neighbor_flags_t
nbrs = test.vapi.ip_neighbor_dump(sw_if_index,
is_ipv6=(6 is ip_addr.version))