diff options
author | Ole Troan <ot@cisco.com> | 2018-09-18 10:23:01 +0200 |
---|---|---|
committer | Ole Troan <ot@cisco.com> | 2018-09-18 10:32:48 +0200 |
commit | 45d5c87d86d8ac5268e08f743eb032f5a66a82f8 (patch) | |
tree | 355c069ac69ddff3679740d703b44b35e5bab6cb /src | |
parent | 58492a83722caf1c49977d73abf931418ce1f8f2 (diff) |
STATS: Add Python 3 support to vpp_stats.py.
Change-Id: Iad0b0315fbd493b67e6ca490206ec8e8422790ea
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vpp-api/python/setup.py | 2 | ||||
-rw-r--r-- | src/vpp-api/python/vpp_papi/vpp_stats.py | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/vpp-api/python/setup.py b/src/vpp-api/python/setup.py index 0d8c149679e..a719d10df28 100644 --- a/src/vpp-api/python/setup.py +++ b/src/vpp-api/python/setup.py @@ -18,7 +18,7 @@ except ImportError: from distutils.core import setup, find_packages setup(name='vpp_papi', - version='1.6.1', + version='1.6.2', description='VPP Python binding', author='Ole Troan', author_email='ot@cisco.com', diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py index 9bdb79f5178..ecd734bbf7d 100644 --- a/src/vpp-api/python/vpp_papi/vpp_stats.py +++ b/src/vpp-api/python/vpp_papi/vpp_stats.py @@ -62,7 +62,7 @@ def make_string_vector(api, strings): if type(strings) is not list: strings = [strings] for s in strings: - vec = api.stat_segment_string_vector(vec, ffi.new("char []", s)) + vec = api.stat_segment_string_vector(vec, ffi.new("char []", s.encode())) return vec @@ -114,7 +114,7 @@ def stat_entry_to_python(api, e): class VPPStats: def __init__(self, socketname='/var/run/stats.sock'): self.api = ffi.dlopen('libvppapiclient.so') - rv = self.api.stat_segment_connect(socketname) + rv = self.api.stat_segment_connect(socketname.encode()) if rv != 0: raise IOError() @@ -129,7 +129,7 @@ class VPPStats: rv = self.api.stat_segment_dump(counters) rv_len = self.api.stat_segment_vec_len(rv) for i in range(rv_len): - n = ffi.string(rv[i].name) + n = ffi.string(rv[i].name).decode() e = stat_entry_to_python(self.api, rv[i]) stats[n] = e return stats |