API: Add support for "defaults"
Add support in the API language for specifying a field default.
Add default support in Python binding.
define foo {
u16 mtu [default = 1500];
};
This is client side only. I.e. if the mtu argument is not passed to the foo function,
the client language binding will set it default to 1500.
Change-Id: I5df43f3cd87cb300b40ca38e15dcab25b40e424a
Signed-off-by: Ole Troan <ot@cisco.com>
diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py
index 76ccf10..de72249 100644
--- a/src/vpp-api/python/vpp_papi/vpp_stats.py
+++ b/src/vpp-api/python/vpp_papi/vpp_stats.py
@@ -73,7 +73,8 @@
uint32_t *stat_segment_ls_r (uint8_t ** patterns, stat_client_main_t * sm);
uint32_t *stat_segment_ls (uint8_t ** pattern);
-stat_segment_data_t *stat_segment_dump_r (uint32_t * stats, stat_client_main_t * sm);
+stat_segment_data_t *stat_segment_dump_r (uint32_t * stats,
+ stat_client_main_t * sm);
stat_segment_data_t *stat_segment_dump (uint32_t * counter_vec);
void stat_segment_data_free (stat_segment_data_t * res);
@@ -133,7 +134,9 @@
return vec
def name_vec_list(api, e):
- return [ffi.string(e[i]).decode('utf-8') for i in range(api.stat_segment_vec_len(e)) if e[i] != ffi.NULL]
+ return [ffi.string(e[i]).decode('utf-8') for i in
+ range(api.stat_segment_vec_len(e)) if e[i] != ffi.NULL]
+
def stat_entry_to_python(api, e):
# Scalar index
@@ -222,7 +225,8 @@
if rv == ffi.NULL:
raise VPPStatsIOError()
- return [ffi.string(self.api.stat_segment_index_to_name_r(rv[i], self.client)).decode('utf-8')
+ return [ffi.string(self.api.stat_segment_index_to_name_r(
+ rv[i], self.client)).decode('utf-8')
for i in range(self.api.stat_segment_vec_len(rv))]
def dump(self, counters):