Fix for PAPI async call registration
Introduce async API call registration Change-Id: Iccc89eca1b6e7dcce96a8e7bc5da80d9abc363fc Signed-off-by: Wojciech Dec <wdec@cisco.com>
This commit is contained in:
@ -241,10 +241,13 @@ class VPP():
|
|||||||
def add_type(self, name, typedef):
|
def add_type(self, name, typedef):
|
||||||
self.add_message('vl_api_' + name + '_t', typedef)
|
self.add_message('vl_api_' + name + '_t', typedef)
|
||||||
|
|
||||||
def make_function(self, i, msgdef, multipart):
|
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))
|
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_names = [None] * (self.vpp_dictionary_maxid + 1)
|
||||||
self.id_msgdef = [None] * (self.vpp_dictionary_maxid + 1)
|
self.id_msgdef = [None] * (self.vpp_dictionary_maxid + 1)
|
||||||
for name, msgdef in self.messages.iteritems():
|
for name, msgdef in self.messages.iteritems():
|
||||||
@ -257,7 +260,7 @@ class VPP():
|
|||||||
self.id_msgdef[i] = msgdef
|
self.id_msgdef[i] = msgdef
|
||||||
self.id_names[i] = name
|
self.id_names[i] = name
|
||||||
multipart = True if name.find('_dump') > 0 else False
|
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):
|
def _write (self, buf):
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
@ -289,7 +292,7 @@ class VPP():
|
|||||||
self.connected = True
|
self.connected = True
|
||||||
|
|
||||||
self._load_dictionary()
|
self._load_dictionary()
|
||||||
self._register_functions()
|
self._register_functions(async=async)
|
||||||
|
|
||||||
# Initialise control ping
|
# Initialise control ping
|
||||||
self.control_ping_index = self.vpp_dictionary['control_ping']['id']
|
self.control_ping_index = self.vpp_dictionary['control_ping']['id']
|
||||||
|
Reference in New Issue
Block a user