From f24e5d79d47e8ccd5a83aea5595dbdfd1a0f5e0b Mon Sep 17 00:00:00 2001 From: Shwetha Bhandari Date: Mon, 11 Jul 2016 23:08:54 +0100 Subject: Show cli for plugin path, name filter and loaded plugins Change-Id: If6ab5f08bcdcf5e24bb8b31926894d2a56cb6c14 Signed-off-by: Shwetha Bhandari --- vlib/vlib/unix/plugin.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/vlib/vlib/unix/plugin.c b/vlib/vlib/unix/plugin.c index 1869953d723..f8805b803cc 100644 --- a/vlib/vlib/unix/plugin.c +++ b/vlib/vlib/unix/plugin.c @@ -221,6 +221,38 @@ vlib_plugin_early_init (vlib_main_t * vm) return vlib_load_new_plugins (pm, 1 /* from_early_init */ ); } +static clib_error_t * +vlib_plugins_show_cmd_fn (vlib_main_t * vm, + unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + plugin_main_t *pm = &vlib_plugin_main; + u8 *s = 0; + u8 *key = 0; + uword *value = 0; + int index = 1; + + s = format(s, " Plugin path is: %s\n",pm->plugin_path); + if (vlib_plugin_name_filter) + s = format(s," Plugin filter: %s\n",vlib_plugin_name_filter); + + s = format(s, " Plugins loaded: \n"); + hash_foreach_mem (key, value, pm->plugin_by_name_hash, { + if (key != 0) + s = format(s, " %d.%s\n",index, key); + index++; + }); + + vlib_cli_output(vm, "%v", s); + vec_free(s); + return 0; +} + +VLIB_CLI_COMMAND (plugins_show_cmd, static) = { + .path = "show plugins", + .short_help = "show loaded plugins", + .function = vlib_plugins_show_cmd_fn, +}; /* * fd.io coding-style-patch-verification: ON * -- cgit 1.2.3-korg