diff options
author | Ole Troan <ot@cisco.com> | 2018-12-07 14:31:16 +0100 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2018-12-10 08:02:24 +0000 |
commit | dfb984d4e82d3950bb7270a4e8c6b2dda26c10da (patch) | |
tree | 2cdf57c9078b7ecaba41c8b2b6e927b9fba2a0f3 /src/vpp-api/python/vpp_papi/vpp_papi.py | |
parent | 7f99183a20d60cd5c648cc23d7a2f30a594a215b (diff) |
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 <ot@cisco.com>
Diffstat (limited to 'src/vpp-api/python/vpp_papi/vpp_papi.py')
-rw-r--r-- | src/vpp-api/python/vpp_papi/vpp_papi.py | 15 |
1 files changed, 11 insertions, 4 deletions
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) |