diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2018-11-25 16:09:26 -0800 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-02-26 09:38:12 +0000 |
commit | 1e18eb20c34d2b5e3b815c34831a78a14af98259 (patch) | |
tree | 3e7bab8c6c9376b3f9ef1a225f1ad1f5594e170b /test/test_ip_ecmp.py | |
parent | 9338fc644da4e1d9d9ac9f1e3886f555918026f8 (diff) |
VPP-1508 python tests: unicode
Change unicode references to use text_type
Change-Id: Ia71c16e3235bc509abd3b1c651ae125f892ab108
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/test_ip_ecmp.py')
-rw-r--r-- | test/test_ip_ecmp.py | 10 |
1 files changed, 8 insertions, 2 deletions
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 + |