summaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-cp/one_cli.c
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2017-03-08 08:46:51 +0100
committerFlorin Coras <florin.coras@gmail.com>2017-03-08 08:54:39 +0000
commit7eaf0e57415615b56904e0054bf0b856db6f9bc1 (patch)
treeeacc48dcf6b1960663f697f791714919a1ab96be /src/vnet/lisp-cp/one_cli.c
parent6f19c695583f9d7bd8b39f575e03f01d27e51f64 (diff)
LISP: add stats API/CLI
Change-Id: I5c5b4d680359cf3635c2d7b0088ea2ba6a428f93 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vnet/lisp-cp/one_cli.c')
-rw-r--r--src/vnet/lisp-cp/one_cli.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/vnet/lisp-cp/one_cli.c b/src/vnet/lisp-cp/one_cli.c
index 05821306a66..2ceeaf42fa7 100644
--- a/src/vnet/lisp-cp/one_cli.c
+++ b/src/vnet/lisp-cp/one_cli.c
@@ -1642,6 +1642,62 @@ VLIB_CLI_COMMAND (one_show_rloc_probe_state_command) = {
};
/* *INDENT-ON* */
+static clib_error_t *
+lisp_show_stats_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ u8 is_enabled = vnet_lisp_stats_enable_disable_state ();
+ vlib_cli_output (vm, "%s\n", is_enabled ? "enabled" : "disabled");
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_stats_command) = {
+ .path = "show one stats",
+ .short_help = "show ONE statistics",
+ .function = lisp_show_stats_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_stats_enable_disable_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ unformat_input_t _line_input, *line_input = &_line_input;
+ u8 enable = 0;
+
+ /* Get a line of input. */
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return 0;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "enable"))
+ enable = 1;
+ else if (unformat (line_input, "disable"))
+ enable = 0;
+ else
+ {
+ clib_warning ("Error: expected enable/disable!");
+ goto done;
+ }
+ }
+ vnet_lisp_stats_enable_disable (enable);
+done:
+ unformat_free (line_input);
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_stats_enable_disable_command) = {
+ .path = "one stats",
+ .short_help = "enable/disable ONE statistics collecting",
+ .function = lisp_stats_enable_disable_command_fn,
+};
+/* *INDENT-ON* */
+
/*
* fd.io coding-style-patch-verification: ON
*