aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vapi/vapi_json_parser.py
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2018-02-25 18:48:04 +0100
committerNeale Ranns <nranns@cisco.com>2018-02-25 20:35:10 +0000
commit329a1c10b7120f0be75aa0e0187fbc9f87e760f9 (patch)
tree130e5cd9de38e2bff6859922156a807945335311 /src/vpp-api/vapi/vapi_json_parser.py
parent04e5d64c454ec53103fa1f4b7f3634bb61a65d0f (diff)
vapi: handle more magic
Change-Id: I25cbf947d6aabadbf637387497104cb301762def Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/vpp-api/vapi/vapi_json_parser.py')
-rw-r--r--src/vpp-api/vapi/vapi_json_parser.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/vpp-api/vapi/vapi_json_parser.py b/src/vpp-api/vapi/vapi_json_parser.py
index a9186a15334..3c9bff10824 100644
--- a/src/vpp-api/vapi/vapi_json_parser.py
+++ b/src/vpp-api/vapi/vapi_json_parser.py
@@ -195,15 +195,27 @@ class StructType (Type, Struct):
if len(field) == 1 and 'crc' in field:
self.crc = field['crc']
continue
- elif len(field) == 2:
+ field_type = field[0]
+ if field_type in typedict:
+ field_type = typedict[field_type]
+ else:
+ mundane_field_type = remove_magic(field_type)
+ if mundane_field_type in typedict:
+ field_type = typedict[mundane_field_type]
+ else:
+ raise ParseError(
+ "While parsing message `%s': could not find "
+ "type by magic name `%s' nor by mundane name "
+ "`%s'" % (name, field_type, mundane_field_type))
+ if len(field) == 2:
p = field_class(field_name=field[1],
- field_type=typedict[field[0]])
+ field_type=field_type)
elif len(field) == 3:
if field[2] == 0:
raise ParseError("While parsing type `%s': array `%s' has "
"variable length" % (name, field[1]))
p = field_class(field_name=field[1],
- field_type=typedict[field[0]],
+ field_type=field_type,
array_len=field[2])
else:
raise ParseError(