devices: create dummy device-input node to keep nexts in sync
[vpp.git] / vppapigen / pyvppapigen.py
index 901510e..675712a 100755 (executable)
@@ -36,6 +36,7 @@ format_struct = {'u8': 'B',
                  'f64' : 'd',
                  'vl_api_ip4_fib_counter_t' : 'IBQQ',
                  'vl_api_ip6_fib_counter_t' : 'QQBQQ',
+                 'vl_api_lisp_adjacency_t' : 'B' * 35
                  };
 #
 # NB: If new types are introduced in vpe.api, these must be updated.
@@ -48,6 +49,7 @@ type_size = {'u8':   1,
              'f64' : 8,
              'vl_api_ip4_fib_counter_t' : 21,
              'vl_api_ip6_fib_counter_t' : 33,
+             'vl_api_lisp_adjacency_t' : 35
 };
 
 def eprint(*args, **kwargs):
@@ -148,11 +150,20 @@ def encode_print(name, id, t):
     # first, deal with all the other fields
     pack = '>' + ''.join([get_pack(f)[0] for f in t[:-1]])
 
-    # now see if the last field is a vla
-    if len(t[-1]) >= 3 and t[-1][2] == '0':
+    # named variable-length-array
+    if len(t[-1]) == 4 and t[-1][2] == '0' and t[-1][3] == t[-2][1]:
+        print(u"    vpp_api.write(pack('" + pack + "', base + "
+              + id + ", 0, context, " + ', '.join(args[3:-2] + ["len(" + args[-1] + ")"])
+              + ") + " + args[-1] + ")")
+
+    # unnamed variable-length-array
+    elif len(t[-1]) >= 3 and t[-1][2] == '0':
         print(u"    vpp_api.write(pack('" + pack + "', base + " +
               id + ", 0, context, " + ', '.join(args[3:-1]) + ") + "
               + args[-1] + ")")
+
+
+    # not a variable-length-array
     else:
         pack += get_pack(t[-1])[0]
         print(u"    vpp_api.write(pack('" + pack + "', base + " + id +