summaryrefslogtreecommitdiffstats
path: root/vpp-api
diff options
context:
space:
mode:
authorWojciech Dec <wdec@cisco.com>2016-12-12 11:32:25 +0100
committerWojciech Dec <wdec@cisco.com>2016-12-12 11:37:15 +0100
commit64bc612d4ce682fdd4a6e1c8a47b7538f200b24f (patch)
tree520b60909161321411bc94f3c406d63eedb03843 /vpp-api
parent9ca18c604a5bf10dbfdbdec4613f62170b27e79b (diff)
Fix for PAPI async call registration
Introduce async API call registration Change-Id: Iccc89eca1b6e7dcce96a8e7bc5da80d9abc363fc Signed-off-by: Wojciech Dec <wdec@cisco.com>
Diffstat (limited to 'vpp-api')
-rw-r--r--vpp-api/python/vpp_papi/vpp_papi.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/vpp-api/python/vpp_papi/vpp_papi.py b/vpp-api/python/vpp_papi/vpp_papi.py
index 27d4315aae4..312aa335572 100644
--- a/vpp-api/python/vpp_papi/vpp_papi.py
+++ b/vpp-api/python/vpp_papi/vpp_papi.py
@@ -241,10 +241,13 @@ class VPP():
def add_type(self, name, typedef):
self.add_message('vl_api_' + name + '_t', typedef)
- def make_function(self, i, msgdef, multipart):
- return lambda **kwargs: (self._call_vpp(i, msgdef, multipart, **kwargs))
+ def make_function(self, i, msgdef, multipart, async):
+ if (async):
+ return lambda **kwargs: (self._call_vpp_async(i, msgdef, multipart, **kwargs))
+ else:
+ return lambda **kwargs: (self._call_vpp(i, msgdef, multipart, **kwargs))
- def _register_functions(self):
+ def _register_functions(self, async=False):
self.id_names = [None] * (self.vpp_dictionary_maxid + 1)
self.id_msgdef = [None] * (self.vpp_dictionary_maxid + 1)
for name, msgdef in self.messages.iteritems():
@@ -257,7 +260,7 @@ class VPP():
self.id_msgdef[i] = msgdef
self.id_names[i] = name
multipart = True if name.find('_dump') > 0 else False
- setattr(self, name, self.make_function(i, msgdef, multipart))
+ setattr(self, name, self.make_function(i, msgdef, multipart, async))
def _write (self, buf):
if not self.connected:
@@ -289,7 +292,7 @@ class VPP():
self.connected = True
self._load_dictionary()
- self._register_functions()
+ self._register_functions(async=async)
# Initialise control ping
self.control_ping_index = self.vpp_dictionary['control_ping']['id']