diff options
author | Shwetha Bhandari <shwethab@cisco.com> | 2016-07-11 23:08:54 +0100 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2016-07-12 15:21:33 +0000 |
commit | f24e5d79d47e8ccd5a83aea5595dbdfd1a0f5e0b (patch) | |
tree | af8048107bba87e5555d76702b192ca9bd178905 | |
parent | 4ac74c9599c73510900c18ff4c86ca390993adac (diff) |
Show cli for plugin path, name filter and loaded plugins
Change-Id: If6ab5f08bcdcf5e24bb8b31926894d2a56cb6c14
Signed-off-by: Shwetha Bhandari <shwethab@cisco.com>
-rw-r--r-- | vlib/vlib/unix/plugin.c | 32 |
1 files changed, 32 insertions, 0 deletions
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 * |