aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-01-25 09:53:31 +0100
committerNeale Ranns <nranns@cisco.com>2018-01-25 13:43:34 +0000
commit2eaf2d26fd844dc9e589069e587069756e2d1883 (patch)
tree46c5454c10d54bfb2420389f70c7f6397cdc3caf /src/vpp-api
parent9f30c1708f81985f1c4b22b4770e14f41d916485 (diff)
VPP-1144: PAPI Import leads to duplicate type definition.
Change-Id: I54c147004fd93681a6a9cf30fa5277c1dabce67c Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp-api')
-rw-r--r--src/vpp-api/python/vpp_papi.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vpp-api/python/vpp_papi.py b/src/vpp-api/python/vpp_papi.py
index 4d39d5f88ef..1d92a41a504 100644
--- a/src/vpp-api/python/vpp_papi.py
+++ b/src/vpp-api/python/vpp_papi.py
@@ -515,8 +515,23 @@ class VPP():
return self.messages[name]['return_tuple']
return None
+ def duplicate_check_ok(self, name, msgdef):
+ crc = None
+ for c in msgdef:
+ if type(c) is dict and 'crc' in c:
+ crc = c['crc']
+ break
+ if crc:
+ # We can get duplicates because of imports
+ if crc == self.messages[name]['crc']:
+ return True
+ return False
+
def add_message(self, name, msgdef, typeonly=False):
if name in self.messages:
+ if typeonly:
+ if self.duplicate_check_ok(name, msgdef):
+ return
raise ValueError('Duplicate message name: ' + name)
args = collections.OrderedDict()