aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/lisp.py28
-rw-r--r--test/test_gbp.py6
-rw-r--r--test/test_ip4.py4
-rw-r--r--test/test_ip6.py6
-rw-r--r--test/test_lisp.py6
-rw-r--r--test/test_memif.py31
-rw-r--r--test/test_nat.py18
-rw-r--r--test/test_punt.py73
-rw-r--r--test/test_sctp.py4
-rw-r--r--test/test_session.py4
-rw-r--r--test/test_tcp.py4
-rw-r--r--test/test_vcl.py8
-rw-r--r--test/test_vhost.py6
-rw-r--r--test/vpp_memif.py7
-rw-r--r--test/vpp_papi_provider.py4
15 files changed, 122 insertions, 87 deletions
diff --git a/test/lisp.py b/test/lisp.py
index 339493cb457..86f0009ead1 100644
--- a/test/lisp.py
+++ b/test/lisp.py
@@ -25,7 +25,7 @@ class VppLispLocatorSet(VppObject):
def get_lisp_locator_sets_dump_entry(self):
result = self.test.vapi.lisp_locator_set_dump()
for ls in result:
- if ls.ls_name.strip('\x00') == self._ls_name:
+ if ls.ls_name.strip(b'\x00') == self._ls_name:
return ls
return None
@@ -137,7 +137,8 @@ class LispEID(object):
else:
raise Exception('Unsupported EID format {!s}!'.format(eid))
- def __str__(self):
+ @property
+ def packed(self):
if self.eid_type == LispEIDType.IP4:
return socket.inet_pton(socket.AF_INET, self.eid_address)
elif self.eid_type == LispEIDType.IP6:
@@ -179,8 +180,9 @@ class VppLispMapping(VppObject):
def get_lisp_mapping_dump_entry(self):
return self.test.vapi.lisp_eid_table_dump(
- eid_set=1, prefix_length=self._eid.prefix_length,
- vni=self._vni, eid_type=self._eid.eid_type, eid=str(self._eid))
+ eid_set=1, prefix_length=self._eid.prefix_length,
+ vni=self._vni, eid_type=self._eid.eid_type,
+ eid=self._eid.packed)
def query_vpp_config(self):
mapping = self.get_lisp_mapping_dump_entry()
@@ -215,14 +217,14 @@ class VppLocalMapping(VppLispMapping):
def add_vpp_config(self):
self.test.vapi.lisp_add_del_local_eid(
ls_name=self._ls_name, eid_type=self._eid.eid_type,
- eid=str(self._eid), prefix_len=self._eid.prefix_length,
+ eid=self._eid.packed, prefix_len=self._eid.prefix_length,
vni=self._vni, key_id=self._key_id, key=self._key)
self._test.registry.register(self, self.test.logger)
def remove_vpp_config(self):
self.test.vapi.lisp_add_del_local_eid(
ls_name=self._ls_name, eid_type=self._eid.eid_type,
- eid=str(self._eid), prefix_len=self._eid.prefix_length,
+ eid=self._eid.packed, prefix_len=self._eid.prefix_length,
vni=self._vni, is_add=0)
def object_id(self):
@@ -243,13 +245,13 @@ class VppRemoteMapping(VppLispMapping):
def add_vpp_config(self):
self.test.vapi.lisp_add_del_remote_mapping(
rlocs=self._rlocs, eid_type=self._eid.eid_type,
- eid=str(self._eid), eid_prefix_len=self._eid.prefix_length,
+ eid=self._eid.packed, eid_prefix_len=self._eid.prefix_length,
vni=self._vni, rlocs_num=len(self._rlocs))
self._test.registry.register(self, self.test.logger)
def remove_vpp_config(self):
self.test.vapi.lisp_add_del_remote_mapping(
- eid_type=self._eid.eid_type, eid=str(self._eid),
+ eid_type=self._eid.eid_type, eid=self._eid.packed,
eid_prefix_len=self._eid.prefix_length, vni=self._vni,
is_add=0, rlocs_num=0)
@@ -286,8 +288,8 @@ class VppLispAdjacency(VppObject):
def add_vpp_config(self):
self.test.vapi.lisp_add_del_adjacency(
- leid=str(self._leid),
- reid=str(self._reid), eid_type=self._leid.eid_type,
+ leid=self._leid.packed,
+ reid=self._reid.packed, eid_type=self._leid.eid_type,
leid_len=self._leid.prefix_length,
reid_len=self._reid.prefix_length, vni=self._vni)
self._test.registry.register(self, self.test.logger)
@@ -301,7 +303,7 @@ class VppLispAdjacency(VppObject):
if eid.prefix_length != prefix_len:
return False
- if str(eid) != eid_data[0:eid.data_length]:
+ if eid.packed != eid_data[0:eid.data_length]:
return False
return True
@@ -318,8 +320,8 @@ class VppLispAdjacency(VppObject):
def remove_vpp_config(self):
self.test.vapi.lisp_add_del_adjacency(
- leid=str(self._leid),
- reid=str(self._reid), eid_type=self._leid.eid_type,
+ leid=self._leid.packed,
+ reid=self._reid.packed, eid_type=self._leid.eid_type,
leid_len=self._leid.prefix_length,
reid_len=self._reid.prefix_length, vni=self._vni, is_add=0)
diff --git a/test/test_gbp.py b/test/test_gbp.py
index a5f053dcacc..09d218d8ac3 100644
--- a/test/test_gbp.py
+++ b/test/test_gbp.py
@@ -545,8 +545,8 @@ class VppGbpAcl(VppObject):
self.acl_index = 4294967295
def create_rule(self, is_ipv6=0, permit_deny=0, proto=-1,
- s_prefix=0, s_ip='\x00\x00\x00\x00', sport_from=0,
- sport_to=65535, d_prefix=0, d_ip='\x00\x00\x00\x00',
+ s_prefix=0, s_ip=b'\x00\x00\x00\x00', sport_from=0,
+ sport_to=65535, d_prefix=0, d_ip=b'\x00\x00\x00\x00',
dport_from=0, dport_to=65535):
if proto == -1 or proto == 0:
sport_to = 0
@@ -569,7 +569,7 @@ class VppGbpAcl(VppObject):
reply = self._test.vapi.acl_add_replace(self.acl_index,
r=rules,
- tag='GBPTest')
+ tag=b'GBPTest')
self.acl_index = reply.acl_index
return self.acl_index
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 57005f79355..ab733ac1bb6 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -1146,7 +1146,7 @@ class TestIPPunt(VppTestCase):
#
# add a policer
#
- policer = self.vapi.policer_add_del("ip4-punt", 400, 0, 10, 0,
+ policer = self.vapi.policer_add_del(b"ip4-punt", 400, 0, 10, 0,
rate_type=1)
self.vapi.ip_punt_police(policer.policer_index)
@@ -1167,7 +1167,7 @@ class TestIPPunt(VppTestCase):
# remove the poilcer. back to full rx
#
self.vapi.ip_punt_police(policer.policer_index, is_add=0)
- self.vapi.policer_add_del("ip4-punt", 400, 0, 10, 0,
+ self.vapi.policer_add_del(b"ip4-punt", 400, 0, 10, 0,
rate_type=1, is_add=0)
self.send_and_expect(self.pg0, pkts, self.pg1)
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 07e3c7834c5..2f330c56d67 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -972,7 +972,7 @@ class TestICMPv6Echo(VppTestCase):
icmpv6_id = 0xb
icmpv6_seq = 5
- icmpv6_data = '\x0a' * 18
+ icmpv6_data = b'\x0a' * 18
p_echo_request = (Ether(src=self.pg0.remote_mac,
dst=self.pg0.local_mac) /
IPv6(src=self.pg0.remote_ip6,
@@ -1951,7 +1951,7 @@ class TestIP6Punt(VppTestCase):
#
# add a policer
#
- policer = self.vapi.policer_add_del("ip6-punt", 400, 0, 10, 0,
+ policer = self.vapi.policer_add_del(b"ip6-punt", 400, 0, 10, 0,
rate_type=1)
self.vapi.ip_punt_police(policer.policer_index, is_ip6=1)
@@ -1972,7 +1972,7 @@ class TestIP6Punt(VppTestCase):
# remove the policer. back to full rx
#
self.vapi.ip_punt_police(policer.policer_index, is_add=0, is_ip6=1)
- self.vapi.policer_add_del("ip6-punt", 400, 0, 10, 0,
+ self.vapi.policer_add_del(b"ip6-punt", 400, 0, 10, 0,
rate_type=1, is_add=0)
self.send_and_expect(self.pg0, pkts, self.pg1)
diff --git a/test/test_lisp.py b/test/test_lisp.py
index 03a5c2a526d..561e589bc62 100644
--- a/test/test_lisp.py
+++ b/test/test_lisp.py
@@ -160,12 +160,12 @@ class TestLisp(VppTestCase):
test_cases = [
{
'name': 'basic ip4 over ip4',
- 'locator-sets': [VppLispLocatorSet(self, 'ls-4o4')],
+ 'locator-sets': [VppLispLocatorSet(self, b'ls-4o4')],
'locators': [
- VppLispLocator(self, self.pg1.sw_if_index, 'ls-4o4')
+ VppLispLocator(self, self.pg1.sw_if_index, b'ls-4o4')
],
'local-mappings': [
- VppLocalMapping(self, self.seid_ip4, 'ls-4o4')
+ VppLocalMapping(self, self.seid_ip4, b'ls-4o4')
],
'remote-mappings': [
VppRemoteMapping(self, self.deid_ip4_net,
diff --git a/test/test_memif.py b/test/test_memif.py
index 6da8bf541d3..1f98e3f2215 100644
--- a/test/test_memif.py
+++ b/test/test_memif.py
@@ -3,6 +3,7 @@ import unittest
from scapy.layers.l2 import Ether
from scapy.layers.inet import IP, ICMP
+import six
from framework import VppTestCase, VppTestRunner, running_extended_tests
from remote_test import RemoteClass, RemoteVppTestCase
@@ -45,7 +46,7 @@ class TestMemif(VppTestCase):
def _check_socket_filename(self, dump, socket_id, filename):
for d in dump:
if (d.socket_id == socket_id) and (
- d.socket_filename.rstrip("\0") == filename):
+ d.socket_filename.rstrip(b"\0") == filename):
return True
return False
@@ -56,26 +57,28 @@ class TestMemif(VppTestCase):
dump = self.vapi.memif_socket_filename_dump()
self.assertTrue(
self._check_socket_filename(
- dump, 0, self.tempdir + "/memif.sock"))
+ dump, 0, b"%s/memif.sock" % six.ensure_binary(
+ self.tempdir, encoding='utf-8')))
memif_sockets = []
# existing path
memif_sockets.append(
VppSocketFilename(
- self, 1, self.tempdir + "/memif1.sock"))
+ self, 1, b"%s/memif1.sock" % six.ensure_binary(
+ self.tempdir, encoding='utf-8')))
# default path (test tempdir)
memif_sockets.append(
VppSocketFilename(
self,
2,
- "memif2.sock",
+ b"memif2.sock",
add_default_folder=True))
# create new folder in default folder
memif_sockets.append(
VppSocketFilename(
self,
3,
- "sock/memif3.sock",
+ b"sock/memif3.sock",
add_default_folder=True))
for sock in memif_sockets:
@@ -93,7 +96,8 @@ class TestMemif(VppTestCase):
dump = self.vapi.memif_socket_filename_dump()
self.assertTrue(
self._check_socket_filename(
- dump, 0, self.tempdir + "/memif.sock"))
+ dump, 0, b"%s/memif.sock" % six.ensure_binary(
+ self.tempdir, encoding='utf-8')))
def _create_delete_test_one_interface(self, memif):
memif.add_vpp_config()
@@ -146,26 +150,27 @@ class TestMemif(VppTestCase):
self._create_delete_test_one_interface(memif)
def test_memif_create_custom_socket(self):
- """ Memif create with non-default socket filname """
+ """ Memif create with non-default socket filename """
memif_sockets = []
# existing path
memif_sockets.append(
VppSocketFilename(
- self, 1, self.tempdir + "/memif1.sock"))
+ self, 1, b"%s/memif1.sock" % six.ensure_binary(
+ self.tempdir, encoding='utf-8')))
# default path (test tempdir)
memif_sockets.append(
VppSocketFilename(
self,
2,
- "memif2.sock",
+ b"memif2.sock",
add_default_folder=True))
# create new folder in default folder
memif_sockets.append(
VppSocketFilename(
self,
3,
- "sock/memif3.sock",
+ b"sock/memif3.sock",
add_default_folder=True))
memif = VppMemif(self, MEMIF_ROLE.SLAVE, MEMIF_MODE.ETHERNET)
@@ -184,7 +189,8 @@ class TestMemif(VppTestCase):
ring_size=1024, buffer_size=2048)
remote_socket = VppSocketFilename(self.remote_test, 1,
- self.tempdir + "/memif.sock")
+ b"%s/memif.sock" % six.ensure_binary(
+ self.tempdir, encoding='utf-8'))
remote_socket.add_vpp_config()
remote_memif = VppMemif(self.remote_test, MEMIF_ROLE.MASTER,
@@ -222,7 +228,8 @@ class TestMemif(VppTestCase):
memif = VppMemif(self, MEMIF_ROLE.SLAVE, MEMIF_MODE.ETHERNET)
remote_socket = VppSocketFilename(self.remote_test, 1,
- self.tempdir + "/memif.sock")
+ b"%s/memif.sock" % six.ensure_binary(
+ self.tempdir, encoding='utf-8'))
remote_socket.add_vpp_config()
remote_memif = VppMemif(self.remote_test, MEMIF_ROLE.MASTER,
diff --git a/test/test_nat.py b/test/test_nat.py
index 160890a078e..f4978cfe223 100644
--- a/test/test_nat.py
+++ b/test/test_nat.py
@@ -1866,7 +1866,7 @@ class TestNAT44(MethodHolder):
is_inside=0)
sm = self.vapi.nat44_static_mapping_dump()
self.assertEqual(len(sm), 1)
- self.assertEqual((sm[0].tag).split('\0', 1)[0], '')
+ self.assertEqual((sm[0].tag).split(b'\0', 1)[0], b'')
self.assertEqual(sm[0].protocol, 0)
self.assertEqual(sm[0].local_port, 0)
self.assertEqual(sm[0].external_port, 0)
@@ -1894,7 +1894,7 @@ class TestNAT44(MethodHolder):
self.tcp_port_out = 6303
self.udp_port_out = 6304
self.icmp_id_out = 6305
- tag = "testTAG"
+ tag = b"testTAG"
self.nat44_add_static_mapping(self.pg0.remote_ip4, nat_ip, tag=tag)
self.vapi.nat44_interface_add_del_feature(self.pg0.sw_if_index)
@@ -1902,7 +1902,7 @@ class TestNAT44(MethodHolder):
is_inside=0)
sm = self.vapi.nat44_static_mapping_dump()
self.assertEqual(len(sm), 1)
- self.assertEqual((sm[0].tag).split('\0', 1)[0], tag)
+ self.assertEqual((sm[0].tag).split(b'\0', 1)[0], tag)
# out2in
pkts = self.create_stream_out(self.pg1, nat_ip)
@@ -2600,7 +2600,7 @@ class TestNAT44(MethodHolder):
def test_interface_addr_static_mapping(self):
""" Static mapping with addresses from interface """
- tag = "testTAG"
+ tag = b"testTAG"
self.vapi.nat44_add_del_interface_addr(self.pg7.sw_if_index)
self.nat44_add_static_mapping(
@@ -2613,7 +2613,7 @@ class TestNAT44(MethodHolder):
self.assertEqual(1, len(static_mappings))
self.assertEqual(self.pg7.sw_if_index,
static_mappings[0].external_sw_if_index)
- self.assertEqual((static_mappings[0].tag).split('\0', 1)[0], tag)
+ self.assertEqual((static_mappings[0].tag).split(b'\0', 1)[0], tag)
# configure interface address and check static mappings
self.pg7.config_ip4()
@@ -2624,7 +2624,7 @@ class TestNAT44(MethodHolder):
if sm.external_sw_if_index == 0xFFFFFFFF:
self.assertEqual(sm.external_ip_address[0:4],
self.pg7.local_ip4n)
- self.assertEqual((sm.tag).split('\0', 1)[0], tag)
+ self.assertEqual((sm.tag).split(b'\0', 1)[0], tag)
resolved = True
self.assertTrue(resolved)
@@ -2634,7 +2634,7 @@ class TestNAT44(MethodHolder):
self.assertEqual(1, len(static_mappings))
self.assertEqual(self.pg7.sw_if_index,
static_mappings[0].external_sw_if_index)
- self.assertEqual((static_mappings[0].tag).split('\0', 1)[0], tag)
+ self.assertEqual((static_mappings[0].tag).split(b'\0', 1)[0], tag)
# configure interface address again and check static mappings
self.pg7.config_ip4()
@@ -2645,7 +2645,7 @@ class TestNAT44(MethodHolder):
if sm.external_sw_if_index == 0xFFFFFFFF:
self.assertEqual(sm.external_ip_address[0:4],
self.pg7.local_ip4n)
- self.assertEqual((sm.tag).split('\0', 1)[0], tag)
+ self.assertEqual((sm.tag).split(b'\0', 1)[0], tag)
resolved = True
self.assertTrue(resolved)
@@ -6458,7 +6458,7 @@ class TestNAT44Out2InDPO(MethodHolder):
cls.pg1.config_ip6()
cls.pg1.resolve_ndp()
- cls.vapi.ip_add_del_route(is_ipv6=True, dst_address='\x00' * 16,
+ cls.vapi.ip_add_del_route(is_ipv6=True, dst_address=b'\x00' * 16,
dst_address_length=0,
next_hop_address=cls.pg1.remote_ip6n,
next_hop_sw_if_index=cls.pg1.sw_if_index)
diff --git a/test/test_punt.py b/test/test_punt.py
index e265dc01f9b..2a245385d85 100644
--- a/test/test_punt.py
+++ b/test/test_punt.py
@@ -2,20 +2,25 @@
import binascii
import random
import socket
-import unittest
import os
-import scapy.layers.inet6 as inet6
import threading
import struct
-
from struct import unpack, unpack_from
+
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+
from util import ppp, ppc
from re import compile
import scapy.compat
from scapy.packet import Raw
from scapy.layers.l2 import Ether
from scapy.layers.inet import IP, UDP, ICMP
+import scapy.layers.inet6 as inet6
from scapy.layers.inet6 import IPv6, ICMPv6DestUnreach
+import six
from framework import VppTestCase, VppTestRunner
@@ -189,8 +194,10 @@ class TestIP4PuntSocket(TestPuntSocket):
#
# configure a punt socket
#
- self.vapi.punt_socket_register(1111, self.tempdir+"/socket_punt_1111")
- self.vapi.punt_socket_register(2222, self.tempdir+"/socket_punt_2222")
+ self.vapi.punt_socket_register(1111, b"%s/socket_punt_1111" %
+ six.ensure_binary(self.tempdir))
+ self.vapi.punt_socket_register(2222, b"%s/socket_punt_2222" %
+ six.ensure_binary(self.tempdir))
punts = self.vapi.punt_socket_dump(is_ip6=0)
self.assertEqual(len(punts), 2)
self.assertEqual(punts[0].punt.l4_port, 1111)
@@ -206,8 +213,10 @@ class TestIP4PuntSocket(TestPuntSocket):
#
# configure a punt socket again
#
- self.vapi.punt_socket_register(1111, self.tempdir+"/socket_punt_1111")
- self.vapi.punt_socket_register(3333, self.tempdir+"/socket_punt_3333")
+ self.vapi.punt_socket_register(1111, b"%s/socket_punt_1111" %
+ six.ensure_binary(self.tempdir))
+ self.vapi.punt_socket_register(3333, b"%s/socket_punt_3333" %
+ six.ensure_binary(self.tempdir))
punts = self.vapi.punt_socket_dump(is_ip6=0)
self.assertEqual(len(punts), 3)
@@ -253,9 +262,10 @@ class TestIP4PuntSocket(TestPuntSocket):
#
# configure a punt socket
#
- self.socket_client_create(self.tempdir+"/socket_" + str(port))
- self.vapi.punt_socket_register(port, self.tempdir+"/socket_" +
- str(port))
+ self.socket_client_create(b"%s/socket_%d" % (
+ six.ensure_binary(self.tempdir), port))
+ self.vapi.punt_socket_register(port, b"%s/socket_%d" % (
+ six.ensure_binary(self.tempdir), port))
punts = self.vapi.punt_socket_dump(is_ip6=0)
self.assertEqual(len(punts), 1)
@@ -316,8 +326,10 @@ class TestIP4PuntSocket(TestPuntSocket):
# configure a punt socket
#
for p in self.ports:
- self.socket_client_create(self.tempdir+"/socket_" + str(p))
- self.vapi.punt_socket_register(p, self.tempdir+"/socket_" + str(p))
+ self.socket_client_create(b"%s/socket_%d" % (
+ six.ensure_binary(self.tempdir), p))
+ self.vapi.punt_socket_register(p, b"%s/socket_%d" % (
+ six.ensure_binary(self.tempdir), p))
punts = self.vapi.punt_socket_dump(is_ip6=0)
self.assertEqual(len(punts), len(self.ports))
@@ -372,9 +384,12 @@ class TestIP4PuntSocket(TestPuntSocket):
# configure a punt socket
#
- self.socket_client_create(self.tempdir+"/socket_multi")
+ self.socket_client_create(b"%s/socket_multi" %
+ six.ensure_binary(self.tempdir))
for p in self.ports:
- self.vapi.punt_socket_register(p, self.tempdir+"/socket_multi")
+ self.vapi.punt_socket_register(p,
+ b"%s/socket_multi" %
+ six.ensure_binary(self.tempdir))
punts = self.vapi.punt_socket_dump(is_ip6=0)
self.assertEqual(len(punts), len(self.ports))
@@ -433,9 +448,11 @@ class TestIP6PuntSocket(TestPuntSocket):
#
# configure a punt socket
#
- self.vapi.punt_socket_register(1111, self.tempdir+"/socket_1111",
+ self.vapi.punt_socket_register(1111, b"%s/socket_1111" %
+ six.ensure_binary(self.tempdir),
is_ip4=0)
- self.vapi.punt_socket_register(2222, self.tempdir+"/socket_2222",
+ self.vapi.punt_socket_register(2222, b"%s/socket_2222" %
+ six.ensure_binary(self.tempdir),
is_ip4=0)
punts = self.vapi.punt_socket_dump(is_ip6=1)
self.assertEqual(len(punts), 2)
@@ -452,7 +469,8 @@ class TestIP6PuntSocket(TestPuntSocket):
#
# configure a punt socket again
#
- self.vapi.punt_socket_register(1111, self.tempdir+"/socket_1111",
+ self.vapi.punt_socket_register(1111, b"%s/socket_1111" %
+ six.ensure_binary(self.tempdir),
is_ip4=0)
punts = self.vapi.punt_socket_dump(is_ip6=1)
self.assertEqual(len(punts), 2)
@@ -499,9 +517,10 @@ class TestIP6PuntSocket(TestPuntSocket):
#
# configure a punt socket
#
- self.socket_client_create(self.tempdir+"/socket_" + str(port))
- self.vapi.punt_socket_register(port, self.tempdir+"/socket_" +
- str(port), is_ip4=0)
+ self.socket_client_create(b"%s/socket_%d" % (
+ six.ensure_binary(self.tempdir), port))
+ self.vapi.punt_socket_register(port, b"%s/socket_%d" % (
+ six.ensure_binary(self.tempdir), port), is_ip4=0)
punts = self.vapi.punt_socket_dump(is_ip6=1)
self.assertEqual(len(punts), 1)
@@ -562,9 +581,10 @@ class TestIP6PuntSocket(TestPuntSocket):
# configure a punt socket
#
for p in self.ports:
- self.socket_client_create(self.tempdir+"/socket_" + str(p))
- self.vapi.punt_socket_register(p, self.tempdir+"/socket_" + str(p),
- is_ip4=0)
+ self.socket_client_create(b"%s/socket_%d" % (
+ six.ensure_binary(self.tempdir), p))
+ self.vapi.punt_socket_register(p, b"%s/socket_%d" % (
+ six.ensure_binary(self.tempdir), p), is_ip4=0)
punts = self.vapi.punt_socket_dump(is_ip6=1)
self.assertEqual(len(punts), len(self.ports))
@@ -620,9 +640,12 @@ class TestIP6PuntSocket(TestPuntSocket):
#
# configure a punt socket
#
- self.socket_client_create(self.tempdir+"/socket_multi")
+ self.socket_client_create(b"%s/socket_multi" %
+ six.ensure_binary(self.tempdir))
for p in self.ports:
- self.vapi.punt_socket_register(p, self.tempdir+"/socket_multi",
+ self.vapi.punt_socket_register(p,
+ b"%s/socket_multi" %
+ six.ensure_binary(self.tempdir),
is_ip4=0)
punts = self.vapi.punt_socket_dump(is_ip6=1)
self.assertEqual(len(punts), len(self.ports))
diff --git a/test/test_sctp.py b/test/test_sctp.py
index 70201eba360..9680774819a 100644
--- a/test/test_sctp.py
+++ b/test/test_sctp.py
@@ -32,9 +32,9 @@ class TestSCTP(VppTestCase):
table_id += 1
# Configure namespaces
- self.vapi.app_namespace_add_del(namespace_id="0",
+ self.vapi.app_namespace_add_del(namespace_id=b"0",
sw_if_index=self.loop0.sw_if_index)
- self.vapi.app_namespace_add_del(namespace_id="1",
+ self.vapi.app_namespace_add_del(namespace_id=b"1",
sw_if_index=self.loop1.sw_if_index)
def tearDown(self):
diff --git a/test/test_session.py b/test/test_session.py
index afea5f6a90d..b8ae07440d4 100644
--- a/test/test_session.py
+++ b/test/test_session.py
@@ -33,9 +33,9 @@ class TestSession(VppTestCase):
table_id += 1
# Configure namespaces
- self.vapi.app_namespace_add_del(namespace_id="0",
+ self.vapi.app_namespace_add_del(namespace_id=b"0",
sw_if_index=self.loop0.sw_if_index)
- self.vapi.app_namespace_add_del(namespace_id="1",
+ self.vapi.app_namespace_add_del(namespace_id=b"1",
sw_if_index=self.loop1.sw_if_index)
def tearDown(self):
diff --git a/test/test_tcp.py b/test/test_tcp.py
index b7ce596bdd9..c5366282838 100644
--- a/test/test_tcp.py
+++ b/test/test_tcp.py
@@ -32,9 +32,9 @@ class TestTCP(VppTestCase):
table_id += 1
# Configure namespaces
- self.vapi.app_namespace_add_del(namespace_id="0",
+ self.vapi.app_namespace_add_del(namespace_id=b"0",
sw_if_index=self.loop0.sw_if_index)
- self.vapi.app_namespace_add_del(namespace_id="1",
+ self.vapi.app_namespace_add_del(namespace_id=b"1",
sw_if_index=self.loop1.sw_if_index)
def tearDown(self):
diff --git a/test/test_vcl.py b/test/test_vcl.py
index b60e0152051..f5a1c9c0855 100644
--- a/test/test_vcl.py
+++ b/test/test_vcl.py
@@ -103,9 +103,9 @@ class VCLTestCase(VppTestCase):
table_id += 1
# Configure namespaces
- self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
+ self.vapi.app_namespace_add_del(namespace_id=b"1", secret=1234,
sw_if_index=self.loop0.sw_if_index)
- self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
+ self.vapi.app_namespace_add_del(namespace_id=b"2", secret=5678,
sw_if_index=self.loop1.sw_if_index)
# Add inter-table routes
@@ -146,9 +146,9 @@ class VCLTestCase(VppTestCase):
table_id += 1
# Configure namespaces
- self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
+ self.vapi.app_namespace_add_del(namespace_id=b"1", secret=1234,
sw_if_index=self.loop0.sw_if_index)
- self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
+ self.vapi.app_namespace_add_del(namespace_id=b"2", secret=5678,
sw_if_index=self.loop1.sw_if_index)
# Add inter-table routes
diff --git a/test/test_vhost.py b/test/test_vhost.py
index 9a938214060..15eb0701f91 100644
--- a/test/test_vhost.py
+++ b/test/test_vhost.py
@@ -24,12 +24,12 @@ class TesVhostInterface(VppTestCase):
self.logger.info("Vhost User add interfaces")
# create interface 1 (VirtualEthernet0/0/0)
- vhost_if1 = VppVhostInterface(self, sock_filename='/tmp/sock1')
+ vhost_if1 = VppVhostInterface(self, sock_filename=b'/tmp/sock1')
vhost_if1.add_vpp_config()
vhost_if1.admin_up()
# create interface 2 (VirtualEthernet0/0/1)
- vhost_if2 = VppVhostInterface(self, sock_filename='/tmp/sock2')
+ vhost_if2 = VppVhostInterface(self, sock_filename=b'/tmp/sock2')
vhost_if2.add_vpp_config()
vhost_if2.admin_up()
@@ -86,7 +86,7 @@ class TesVhostInterface(VppTestCase):
# (like delete interface events from other tests)
self.vapi.collect_events()
- vhost_if = VppVhostInterface(self, sock_filename='/tmp/sock1')
+ vhost_if = VppVhostInterface(self, sock_filename=b'/tmp/sock1')
# create vhost interface
vhost_if.add_vpp_config()
diff --git a/test/vpp_memif.py b/test/vpp_memif.py
index c6e8142030b..4ad9ffde4d7 100644
--- a/test/vpp_memif.py
+++ b/test/vpp_memif.py
@@ -1,5 +1,7 @@
import socket
+import six
+
from vpp_object import VppObject
@@ -50,8 +52,9 @@ class VppSocketFilename(VppObject):
rv = self._test.vapi.memif_socket_filename_add_del(
1, self.socket_id, self.socket_filename)
if self.add_default_folder:
- self.socket_filename = self._test.tempdir + "/" \
- + self.socket_filename
+ self.socket_filename = b"%s/%s" % (
+ six.ensure_binary(self._test.tempdir, encoding='utf-8'),
+ self.socket_filename)
return rv
def remove_vpp_config(self):
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index fca57c37880..ad64da6b9f2 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -133,7 +133,7 @@ defaultmapping = {
'is_add': 1, },
'mpls_tunnel_dump': {'sw_if_index': 4294967295, },
'nat44_add_del_address_range': {'is_add': 1, 'vrf_id': 4294967295, },
- 'nat44_add_del_identity_mapping': {'ip': '0', 'sw_if_index': 4294967295,
+ 'nat44_add_del_identity_mapping': {'ip': b'0', 'sw_if_index': 4294967295,
'addr_only': 1, 'is_add': 1, },
'nat44_add_del_interface_addr': {'is_add': 1, },
'nat44_add_del_lb_static_mapping': {'is_add': 1, },
@@ -1247,7 +1247,7 @@ class VppPapiProvider(object):
def nat44_add_del_identity_mapping(
self,
- ip='0',
+ ip=b'0',
sw_if_index=0xFFFFFFFF,
port=0,
addr_only=1,