From dfb984d4e82d3950bb7270a4e8c6b2dda26c10da Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Fri, 7 Dec 2018 14:31:16 +0100 Subject: Python API: Use services to determine stream RPC The services {} definitions contain which APIs are streaming. In addition only create function definition for the client side (not for reply messages). Change-Id: I8e83d35386cdd9ebee83d4571eaebdc6dff19e82 Signed-off-by: Ole Troan --- src/vpp-api/python/vpp_papi/vpp_papi.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/vpp-api/python') diff --git a/src/vpp-api/python/vpp_papi/vpp_papi.py b/src/vpp-api/python/vpp_papi/vpp_papi.py index 3c3eb706bf9..c37334cd4e5 100644 --- a/src/vpp-api/python/vpp_papi/vpp_papi.py +++ b/src/vpp-api/python/vpp_papi/vpp_papi.py @@ -129,6 +129,7 @@ class VPP(object): types[t[0]] = {'type': 'type', 'data': t} for t, v in api['aliases'].items(): types['vl_api_' + t + '_t'] = {'type': 'alias', 'data': v} + self.services.update(api['services']) i = 0 while True: @@ -193,6 +194,7 @@ class VPP(object): self.logger = logger self.messages = {} + self.services = {} self.id_names = [] self.id_msgdef = [] self.header = VPPType('header', [['u16', 'msgid'], @@ -404,10 +406,15 @@ class VPP(object): if i > 0: self.id_msgdef[i] = msg 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, do_async) - setattr(self._api, name, FuncWrapper(f)) + + # Create function for client side messages. + if name in self.services: + if 'stream' in self.services[name] and self.services[name]['stream']: + multipart = True + else: + multipart = False + f = self.make_function(msg, i, multipart, do_async) + setattr(self._api, name, FuncWrapper(f)) else: self.logger.debug( 'No such message type or failed CRC checksum: %s', n) -- cgit 1.2.3-korg