aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_memif.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_memif.py')
-rw-r--r--test/test_memif.py31
1 files changed, 19 insertions, 12 deletions
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,