aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python/vpp_papi
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpp-api/python/vpp_papi')
-rwxr-xr-xsrc/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py4
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_papi.py9
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_stats.py6
3 files changed, 10 insertions, 9 deletions
diff --git a/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py b/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py
index ca3afc4dcef..4fbda2a01af 100755
--- a/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py
+++ b/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py
@@ -230,7 +230,7 @@ class TestAddType(unittest.TestCase):
inet_pton(AF_INET, '2.2.2.2'))
string = 'foobar foobar'
- b = s.pack({'length': len(string), 'string': string.encode()})
+ b = s.pack({'length': len(string), 'string': string.encode('utf-8')})
nt, size = s.unpack(b)
self.assertEqual(len(b), size)
@@ -239,7 +239,7 @@ class TestAddType(unittest.TestCase):
['u8', 'string', 0, 'length']])
string = ''
- b = s.pack({'length': len(string), 'string': string.encode()})
+ b = s.pack({'length': len(string), 'string': string.encode('utf-8')})
nt, size = s.unpack(b)
self.assertEqual(len(b), size)
diff --git a/src/vpp-api/python/vpp_papi/vpp_papi.py b/src/vpp-api/python/vpp_papi/vpp_papi.py
index 2e121386bb5..7e478e7a581 100644
--- a/src/vpp-api/python/vpp_papi/vpp_papi.py
+++ b/src/vpp-api/python/vpp_papi/vpp_papi.py
@@ -427,7 +427,7 @@ class VPP(object):
self._api = VppApiDynamicMethodHolder()
for name, msg in vpp_iterator(self.messages):
n = name + '_' + msg.crc[2:]
- i = self.transport.get_msg_index(n.encode())
+ i = self.transport.get_msg_index(n.encode('utf-8'))
if i > 0:
self.id_msgdef[i] = msg
self.id_names[i] = name
@@ -447,9 +447,10 @@ class VPP(object):
def connect_internal(self, name, msg_handler, chroot_prefix, rx_qlen,
do_async):
- pfx = chroot_prefix.encode() if chroot_prefix else None
+ pfx = chroot_prefix.encode('utf-8') if chroot_prefix else None
- rv = self.transport.connect(name.encode(), pfx, msg_handler, rx_qlen)
+ rv = self.transport.connect(name.encode('utf-8'), pfx,
+ msg_handler, rx_qlen)
if rv != 0:
raise VPPIOError(2, 'Connect failed')
self.vpp_dictionary_maxid = self.transport.msg_table_max_index()
@@ -458,7 +459,7 @@ class VPP(object):
# Initialise control ping
crc = self.messages['control_ping'].crc
self.control_ping_index = self.transport.get_msg_index(
- ('control_ping' + '_' + crc[2:]).encode())
+ ('control_ping' + '_' + crc[2:]).encode('utf-8'))
self.control_ping_msgdef = self.messages['control_ping']
if self.async_thread:
self.event_thread = threading.Thread(
diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py
index 0afed26215d..59c87dd6a81 100644
--- a/src/vpp-api/python/vpp_papi/vpp_stats.py
+++ b/src/vpp-api/python/vpp_papi/vpp_stats.py
@@ -89,7 +89,7 @@ def make_string_vector(api, strings):
strings = [strings]
for s in strings:
vec = api.stat_segment_string_vector(vec, ffi.new("char []",
- s.encode()))
+ s.encode('utf-8')))
return vec
@@ -184,7 +184,7 @@ class VPPStats(object):
poll_end_time = time.time() + timeout
while time.time() < poll_end_time:
- rv = self.api.stat_segment_connect_r(socketname.encode(),
+ rv = self.api.stat_segment_connect_r(socketname.encode('utf-8'),
self.client)
if rv == 0:
break
@@ -208,7 +208,7 @@ class VPPStats(object):
raise VPPStatsIOError()
rv_len = self.api.stat_segment_vec_len(rv)
for i in range(rv_len):
- n = ffi.string(rv[i].name).decode()
+ n = ffi.string(rv[i].name).decode('utf-8')
e = stat_entry_to_python(self.api, rv[i])
if e is not None:
stats[n] = e