aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python/vpp_papi
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-08-09 12:50:55 +0200
committerNeale Ranns <nranns@cisco.com>2018-08-09 12:37:04 +0000
commiteabd607d3a58b6c54aeedf8b98e97bc7cb580a0f (patch)
tree2d75f36d08895b5850be9392ea8bd865ededfc43 /src/vpp-api/python/vpp_papi
parent68ba8807922f252a30991c294757bf818fd93f94 (diff)
PAPI: Python 3.7 uses async keyword.
Change-Id: I01e99c85598a7cb5bc1a506c7fd1fc3f6789d72e Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp-api/python/vpp_papi')
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_papi.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_papi.py b/src/vpp-api/python/vpp_papi/vpp_papi.py
index afaad484f8d..4afb6166f1b 100644
--- a/src/vpp-api/python/vpp_papi/vpp_papi.py
+++ b/src/vpp-api/python/vpp_papi/vpp_papi.py
@@ -388,8 +388,8 @@ class VPP():
raise Exception("Not connected, api definitions not available")
return self._api
- def make_function(self, msg, i, multipart, async):
- if (async):
+ def make_function(self, msg, i, multipart, do_async):
+ if (do_async):
def f(**kwargs):
return self._call_vpp_async(i, msg, **kwargs)
else:
@@ -402,7 +402,7 @@ class VPP():
for j, k in enumerate(msg.fields)])
return f
- def _register_functions(self, async=False):
+ def _register_functions(self, do_async=False):
self.id_names = [None] * (self.vpp_dictionary_maxid + 1)
self.id_msgdef = [None] * (self.vpp_dictionary_maxid + 1)
self._api = VppApiDynamicMethodHolder()
@@ -414,7 +414,7 @@ class VPP():
self.id_names[i] = name
# TODO: Fix multipart (use services)
multipart = True if name.find('_dump') > 0 else False
- f = self.make_function(msg, i, multipart, async)
+ f = self.make_function(msg, i, multipart, do_async)
setattr(self._api, name, FuncWrapper(f))
else:
self.logger.debug(
@@ -445,14 +445,14 @@ class VPP():
return msg
def connect_internal(self, name, msg_handler, chroot_prefix, rx_qlen,
- async):
+ do_async):
pfx = chroot_prefix.encode() if chroot_prefix else ffi.NULL
rv = vpp_api.vac_connect(name.encode(), pfx, msg_handler, rx_qlen)
if rv != 0:
raise IOError(2, 'Connect failed')
self.connected = True
self.vpp_dictionary_maxid = vpp_api.vac_msg_table_max_index()
- self._register_functions(async=async)
+ self._register_functions(do_async=do_async)
# Initialise control ping
crc = self.messages['control_ping'].crc
@@ -466,18 +466,18 @@ class VPP():
self.event_thread.start()
return rv
- def connect(self, name, chroot_prefix=None, async=False, rx_qlen=32):
+ def connect(self, name, chroot_prefix=None, do_async=False, rx_qlen=32):
"""Attach to VPP.
name - the name of the client.
chroot_prefix - if VPP is chroot'ed, the prefix of the jail
- async - if true, messages are sent without waiting for a reply
+ do_async - if true, messages are sent without waiting for a reply
rx_qlen - the length of the VPP message receive queue between
client and server.
"""
- msg_handler = vac_callback_sync if not async else vac_callback_async
+ msg_handler = vac_callback_sync if not do_async else vac_callback_async
return self.connect_internal(name, msg_handler, chroot_prefix, rx_qlen,
- async)
+ do_async)
def connect_sync(self, name, chroot_prefix=None, rx_qlen=32):
"""Attach to VPP in synchronous mode. Application must poll for events.
@@ -489,7 +489,7 @@ class VPP():
"""
return self.connect_internal(name, ffi.NULL, chroot_prefix, rx_qlen,
- async=False)
+ do_async=False)
def disconnect(self):
"""Detach from VPP."""