vppapigen: expose the values of per-message "options" in the api.json files 23/31523/4
authorAndrew Yourtchenko <ayourtch@gmail.com>
Thu, 4 Mar 2021 10:04:41 +0000 (10:04 +0000)
committerOle Tr�an <otroan@employees.org>
Fri, 5 Mar 2021 21:12:56 +0000 (21:12 +0000)
Also fix the vapi parser's assumption about what
the container with CRC is supposed to look like..

Change-Id: I3a23ef6c1502232742c03d227eb3654fb757709c
Type: improvement
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
src/tools/vppapigen/vppapigen_json.py
src/vpp-api/vapi/vapi_json_parser.py

index 93ec21f..5fa839f 100644 (file)
@@ -77,6 +77,7 @@ def walk_defs(s, is_message=False):
         if is_message and t.crc:
             c = {}
             c['crc'] = "{0:#0{1}x}".format(t.crc, 10)
+            c['options'] = t.options
             d.append(c)
 
         r.append(d)
index 6d2db42..1383d45 100644 (file)
@@ -164,7 +164,7 @@ class Message(object):
             raise ParseError("While parsing message `%s': could not find all "
                              "common header fields" % name)
         for field in m[1:]:
-            if len(field) == 1 and 'crc' in field:
+            if isinstance(field, dict) and 'crc' in field:
                 self.crc = field['crc']
                 logger.debug("Found CRC `%s'" % self.crc)
                 continue