From f78e87bf82868716ef77bc82d7cd5d60758ebbe6 Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Wed, 26 Jun 2019 15:32:43 -0700 Subject: lacp: custom dump for sw_interface_lacp_dump Add custom dump code for sw_interface_lacp_dump Type: fix Change-Id: Ifa76192ec65f596391c07b151d2a7fceed502665 Signed-off-by: Steven Luong --- src/plugins/lacp/lacp_api.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/plugins/lacp/lacp_api.c b/src/plugins/lacp/lacp_api.c index d23bf217bac..ed3ead626c9 100644 --- a/src/plugins/lacp/lacp_api.c +++ b/src/plugins/lacp/lacp_api.c @@ -41,15 +41,19 @@ /* instantiate all the print functions we know about */ #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) -#define vl_printfun -#include -#undef vl_printfun /* Get the API version number */ #define vl_api_version(n,v) static u32 api_version=(v); #include #undef vl_api_version +/* Macro to finish up custom dump fns */ +#define FINISH \ + vec_add1 (s, 0); \ + vl_print (handle, (char *)s); \ + vec_free (s); \ + return handle; + #define REPLY_MSG_ID_BASE lm->msg_id_base #include @@ -126,6 +130,17 @@ vl_api_sw_interface_lacp_dump_t_handler (vl_api_sw_interface_lacp_dump_t * mp) vec_free (lacpifs); } +static void * +vl_api_sw_interface_lacp_dump_t_print (vl_api_sw_interface_lacp_dump_t * mp, + void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: sw_interface_lacp_dump "); + + FINISH; +} + #define vl_msg_name_crc_list #include #undef vl_msg_name_crc_list @@ -139,6 +154,16 @@ setup_message_id_table (lacp_main_t * lm, api_main_t * am) #undef _ } +static void +plugin_custom_dump_configure (lacp_main_t * lm) +{ +#define _(n,f) api_main.msg_print_handlers \ + [VL_API_##n + lm->msg_id_base] \ + = (void *) vl_api_##f##_t_print; + foreach_lacp_plugin_api_msg; +#undef _ +} + /* Set up the API message handling tables */ clib_error_t * lacp_plugin_api_hookup (vlib_main_t * vm) @@ -170,6 +195,8 @@ lacp_plugin_api_hookup (vlib_main_t * vm) */ setup_message_id_table (lm, am); + plugin_custom_dump_configure (lm); + vec_free (name); return 0; } -- cgit 1.2.3-korg