summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session/session_cli.c')
-rw-r--r--src/vnet/session/session_cli.c63
1 files changed, 54 insertions, 9 deletions
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index b2943a1ccc5..b029ee6549a 100644
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -60,7 +60,7 @@ format_stream_session (u8 * s, va_list * args)
}
else
{
- clib_warning ("Session in unknown state!");
+ clib_warning ("Session in state: %d!", ss->session_state);
}
vec_free (str);
@@ -78,6 +78,11 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
stream_session_t *s;
u8 *str = 0;
+ if (!smm->is_enabled)
+ {
+ clib_error_return (0, "session layer is not enabled");
+ }
+
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "verbose"))
@@ -126,11 +131,14 @@ show_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
return 0;
}
-VLIB_CLI_COMMAND (show_uri_command, static) =
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (show_session_command, static) =
{
-.path = "show session",.short_help = "show session [verbose]",.function =
- show_session_command_fn,};
-
+ .path = "show session",
+ .short_help = "show session [verbose]",
+ .function = show_session_command_fn,
+};
+/* *INDENT-ON* */
static clib_error_t *
clear_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
@@ -142,6 +150,11 @@ clear_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
stream_session_t *pool, *session;
application_t *server;
+ if (!smm->is_enabled)
+ {
+ clib_error_return (0, "session layer is not enabled");
+ }
+
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "thread %d", &thread_index))
@@ -174,11 +187,43 @@ clear_session_command_fn (vlib_main_t * vm, unformat_input_t * input,
return 0;
}
-VLIB_CLI_COMMAND (clear_uri_session_command, static) =
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (clear_session_command, static) =
+{
+ .path = "clear session",
+ .short_help = "clear session thread <thread> session <index>",
+ .function = clear_session_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+session_enable_disable_fn (vlib_main_t * vm, unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ u8 is_en = 1;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ is_en = 1;
+ else if (unformat (input, "disable"))
+ is_en = 0;
+ else
+ return clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, input);
+ }
+
+ return vnet_session_enable_disable (vm, is_en);
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (session_enable_disable_command, static) =
{
-.path = "clear session",.short_help =
- "clear session thread <thread> session <index>",.function =
- clear_session_command_fn,};
+ .path = "session",
+ .short_help = "session [enable|disable]",
+ .function = session_enable_disable_fn,
+};
+/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON