From 91144fbf54764feb005a33419d0129febd2365d4 Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Tue, 17 Aug 2021 12:57:00 +0200 Subject: vat2: add shared memory argument Add prefix argument to specifiy shared memory segment. Add long arguments. Add argument to dump apis. Add help. Add template argument E.g: vat2 --template sw_interface_add_del_address { "_msgname": "sw_interface_add_del_address", "sw_if_index": 0, "is_add": false, "del_all": false, "prefix": "0.0.0.0" } Usage: vat2 [OPTION] Send API message to VPP and print reply -d, --debug Print additional information -p, --prefix Specify shared memory prefix to connect to a given VPP instance -f, --file File containing a JSON object with the arguments for the message to send --dump-apis List all APIs available from connected VPP instance Type: improvement Signed-off-by: Ole Troan Change-Id: I2d32483a727bc16990c9a30dfa9bc1fa7b1fa85a Signed-off-by: Ole Troan --- src/vat2/jsonconvert.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/vat2/jsonconvert.c') diff --git a/src/vat2/jsonconvert.c b/src/vat2/jsonconvert.c index 645f7d4ca20..1437b90688a 100644 --- a/src/vat2/jsonconvert.c +++ b/src/vat2/jsonconvert.c @@ -501,24 +501,15 @@ uword unformat_vl_api_gbp_scope_t(unformat_input_t * input, va_list * args) cJSON * vl_api_ip4_address_with_prefix_t_tojson (vl_api_ip4_prefix_t *a) { - u8 *s = format(0, "%U", format_vl_api_ip4_address_t, a); - cJSON *o = cJSON_CreateString((char *)s); - vec_free(s); - return o; + return vl_api_ip4_prefix_t_tojson (a); } cJSON * vl_api_ip6_address_with_prefix_t_tojson (vl_api_ip6_prefix_t *a) { - u8 *s = format(0, "%U", format_vl_api_ip6_address_t, a); - cJSON *o = cJSON_CreateString((char *)s); - vec_free(s); - return o; + return vl_api_ip6_prefix_t_tojson (a); } cJSON * vl_api_address_with_prefix_t_tojson (vl_api_prefix_t *a) { - u8 *s = format(0, "%U", format_vl_api_address_t, a); - cJSON *o = cJSON_CreateString((char *)s); - vec_free(s); - return o; + return vl_api_prefix_t_tojson (a); } u8 * format_vl_api_mac_address_t (u8 * s, va_list * args) -- cgit 1.2.3-korg