diff options
author | Ole Troan <ot@cisco.com> | 2019-10-18 03:39:26 +0200 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2019-10-18 11:53:32 +0000 |
commit | e5b83aa3ebb2617d5b081c425cd85569e508d5bf (patch) | |
tree | 63a05382903439a3da41ea664fcae110ee904029 /src/plugins/memif | |
parent | f158944cc4f1bfcc21bed16f5c6f9177734adecd (diff) |
memif: add python3 support to test
Committed from SK936 seat 1A.
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I717fafbdb9b8576508d6dd72a7e5653cecebfae0
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/plugins/memif')
-rw-r--r-- | src/plugins/memif/test/test_memif.py | 28 | ||||
-rw-r--r-- | src/plugins/memif/test/vpp_memif.py | 5 |
2 files changed, 13 insertions, 20 deletions
diff --git a/src/plugins/memif/test/test_memif.py b/src/plugins/memif/test/test_memif.py index 8182a41a620..a999b17678f 100644 --- a/src/plugins/memif/test/test_memif.py +++ b/src/plugins/memif/test/test_memif.py @@ -48,7 +48,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(b"\0") == filename): + d.socket_filename == filename): return True return False @@ -59,28 +59,26 @@ class TestMemif(VppTestCase): dump = self.vapi.memif_socket_filename_dump() self.assertTrue( self._check_socket_filename( - dump, 0, b"%s/memif.sock" % six.ensure_binary( - self.tempdir, encoding='utf-8'))) + dump, 0, "%s/memif.sock" % self.tempdir)) memif_sockets = [] # existing path memif_sockets.append( VppSocketFilename( - self, 1, b"%s/memif1.sock" % six.ensure_binary( - self.tempdir, encoding='utf-8'))) + self, 1, "%s/memif1.sock" % self.tempdir)) # default path (test tempdir) memif_sockets.append( VppSocketFilename( self, 2, - b"memif2.sock", + "memif2.sock", add_default_folder=True)) # create new folder in default folder memif_sockets.append( VppSocketFilename( self, 3, - b"sock/memif3.sock", + "sock/memif3.sock", add_default_folder=True)) for sock in memif_sockets: @@ -98,8 +96,7 @@ class TestMemif(VppTestCase): dump = self.vapi.memif_socket_filename_dump() self.assertTrue( self._check_socket_filename( - dump, 0, b"%s/memif.sock" % six.ensure_binary( - self.tempdir, encoding='utf-8'))) + dump, 0, "%s/memif.sock" % self.tempdir)) def _create_delete_test_one_interface(self, memif): memif.add_vpp_config() @@ -161,21 +158,20 @@ class TestMemif(VppTestCase): # existing path memif_sockets.append( VppSocketFilename( - self, 1, b"%s/memif1.sock" % six.ensure_binary( - self.tempdir, encoding='utf-8'))) + self, 1, "%s/memif1.sock" % self.tempdir)) # default path (test tempdir) memif_sockets.append( VppSocketFilename( self, 2, - b"memif2.sock", + "memif2.sock", add_default_folder=True)) # create new folder in default folder memif_sockets.append( VppSocketFilename( self, 3, - b"sock/memif3.sock", + "sock/memif3.sock", add_default_folder=True)) memif = VppMemif( @@ -202,8 +198,7 @@ class TestMemif(VppTestCase): secret="abc") remote_socket = VppSocketFilename(self.remote_test, 1, - b"%s/memif.sock" % six.ensure_binary( - self.tempdir, encoding='utf-8')) + "%s/memif.sock" % self.tempdir) remote_socket.add_vpp_config() remote_memif = VppMemif( @@ -250,8 +245,7 @@ class TestMemif(VppTestCase): VppEnum.vl_api_memif_mode_t.MEMIF_MODE_API_ETHERNET) remote_socket = VppSocketFilename(self.remote_test, 1, - b"%s/memif.sock" % six.ensure_binary( - self.tempdir, encoding='utf-8')) + "%s/memif.sock" % self.tempdir) remote_socket.add_vpp_config() remote_memif = VppMemif( diff --git a/src/plugins/memif/test/vpp_memif.py b/src/plugins/memif/test/vpp_memif.py index ba032c5fb6f..9bcac1fd5b6 100644 --- a/src/plugins/memif/test/vpp_memif.py +++ b/src/plugins/memif/test/vpp_memif.py @@ -43,9 +43,8 @@ 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 = b"%s/%s" % ( - six.ensure_binary(self._test.tempdir, encoding='utf-8'), - self.socket_filename) + self.socket_filename = "%s/%s" % (self._test.tempdir, + self.socket_filename) return rv def remove_vpp_config(self): |