lisp: fix lisp/one enable/disable
Type: fix Change-Id: Iefe6b3a1a0a999d89ef9812fc14d31159043e60c Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit 508dc51bd075f6bb16862265c0c43e8efb76349c)
This commit is contained in:
Florin Coras
committed by
Andrew Yourtchenko
parent
0e67a25052
commit
554159af58
@ -418,14 +418,16 @@ done:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
VLIB_CLI_COMMAND (lisp_add_del_remote_mapping_command) =
|
/* *INDENT-OFF* */
|
||||||
{
|
VLIB_CLI_COMMAND (lisp_add_del_remote_mapping_command) = {
|
||||||
.path = "lisp remote-mapping",.short_help =
|
.path = "lisp remote-mapping",
|
||||||
"lisp remote-mapping add|del [del-all] vni <vni> "
|
.short_help = "lisp remote-mapping add|del [del-all] vni <vni> "
|
||||||
"eid <est-eid> [action <no-action|natively-forward|"
|
"eid <est-eid> [action <no-action|natively-forward|"
|
||||||
"send-map-request|drop>] rloc <dst-locator> p <prio> w <weight> "
|
"send-map-request|drop>] rloc <dst-locator> p <prio> "
|
||||||
"[rloc <dst-locator> ... ]",.function =
|
"w <weight> [rloc <dst-locator> ... ]",
|
||||||
lisp_add_del_remote_mapping_command_fn,};
|
.function = lisp_add_del_remote_mapping_command_fn,
|
||||||
|
};
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for add/del adjacency CLI.
|
* Handler for add/del adjacency CLI.
|
||||||
@ -892,54 +894,44 @@ VLIB_CLI_COMMAND (lisp_cp_show_eid_table_command) = {
|
|||||||
|
|
||||||
|
|
||||||
static clib_error_t *
|
static clib_error_t *
|
||||||
lisp_enable_disable_command_fn (vlib_main_t * vm, unformat_input_t * input,
|
lisp_enable_command_fn (vlib_main_t * vm, unformat_input_t * input,
|
||||||
vlib_cli_command_t * cmd)
|
vlib_cli_command_t * cmd)
|
||||||
{
|
{
|
||||||
unformat_input_t _line_input, *line_input = &_line_input;
|
if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
||||||
u8 is_enabled = 0;
|
return clib_error_return (0, "parse error: '%U'", format_unformat_error,
|
||||||
u8 is_set = 0;
|
input);
|
||||||
clib_error_t *error = NULL;
|
|
||||||
|
|
||||||
/* Get a line of input. */
|
vnet_lisp_enable_disable (1);
|
||||||
if (!unformat_user (input, unformat_line_input, line_input))
|
|
||||||
return clib_error_return (0, "expected enable | disable");
|
|
||||||
|
|
||||||
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
|
return 0;
|
||||||
{
|
|
||||||
if (unformat (line_input, "enable"))
|
|
||||||
{
|
|
||||||
is_set = 1;
|
|
||||||
is_enabled = 1;
|
|
||||||
}
|
|
||||||
else if (unformat (line_input, "disable"))
|
|
||||||
is_set = 1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
error = clib_error_return (0, "parse error: '%U'",
|
|
||||||
format_unformat_error, line_input);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_set)
|
|
||||||
{
|
|
||||||
error = clib_error_return (0, "state not set");
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
vnet_lisp_enable_disable (is_enabled);
|
|
||||||
|
|
||||||
done:
|
|
||||||
unformat_free (line_input);
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
VLIB_CLI_COMMAND (lisp_cp_enable_disable_command) = {
|
VLIB_CLI_COMMAND (lisp_cp_enable_command) = {
|
||||||
.path = "lisp",
|
.path = "lisp enable",
|
||||||
.short_help = "lisp [enable|disable]",
|
.short_help = "lisp enable",
|
||||||
.function = lisp_enable_disable_command_fn,
|
.function = lisp_enable_command_fn,
|
||||||
|
};
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
static clib_error_t *
|
||||||
|
lisp_disable_command_fn (vlib_main_t * vm, unformat_input_t * input,
|
||||||
|
vlib_cli_command_t * cmd)
|
||||||
|
{
|
||||||
|
if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
||||||
|
return clib_error_return (0, "parse error: '%U'", format_unformat_error,
|
||||||
|
input);
|
||||||
|
|
||||||
|
vnet_lisp_enable_disable (0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
|
VLIB_CLI_COMMAND (lisp_cp_disable_command) = {
|
||||||
|
.path = "lisp disable",
|
||||||
|
.short_help = "lisp disable",
|
||||||
|
.function = lisp_disable_command_fn,
|
||||||
};
|
};
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
@ -1163,7 +1155,7 @@ lisp_add_del_locator_set_command_fn (vlib_main_t * vm,
|
|||||||
|
|
||||||
/* Get a line of input. */
|
/* Get a line of input. */
|
||||||
if (!unformat_user (input, unformat_line_input, line_input))
|
if (!unformat_user (input, unformat_line_input, line_input))
|
||||||
return 0;
|
return clib_error_return (0, "missing parameters");
|
||||||
|
|
||||||
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
|
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
|
||||||
{
|
{
|
||||||
|
@ -1369,54 +1369,44 @@ VLIB_CLI_COMMAND (one_cp_enable_disable_xtr_mode_command) = {
|
|||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
static clib_error_t *
|
static clib_error_t *
|
||||||
lisp_enable_disable_command_fn (vlib_main_t * vm, unformat_input_t * input,
|
one_enable_command_fn (vlib_main_t * vm, unformat_input_t * input,
|
||||||
vlib_cli_command_t * cmd)
|
vlib_cli_command_t * cmd)
|
||||||
{
|
{
|
||||||
unformat_input_t _line_input, *line_input = &_line_input;
|
if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
||||||
u8 is_enabled = 0;
|
return clib_error_return (0, "parse error: '%U'", format_unformat_error,
|
||||||
u8 is_set = 0;
|
input);
|
||||||
clib_error_t *error = NULL;
|
|
||||||
|
|
||||||
/* Get a line of input. */
|
vnet_lisp_enable_disable (1);
|
||||||
if (!unformat_user (input, unformat_line_input, line_input))
|
|
||||||
return clib_error_return (0, "expected enable | disable");
|
|
||||||
|
|
||||||
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
|
return 0;
|
||||||
{
|
|
||||||
if (unformat (line_input, "enable"))
|
|
||||||
{
|
|
||||||
is_set = 1;
|
|
||||||
is_enabled = 1;
|
|
||||||
}
|
|
||||||
else if (unformat (line_input, "disable"))
|
|
||||||
is_set = 1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
error = clib_error_return (0, "parse error: '%U'",
|
|
||||||
format_unformat_error, line_input);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_set)
|
|
||||||
{
|
|
||||||
error = clib_error_return (0, "state not set");
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
vnet_lisp_enable_disable (is_enabled);
|
|
||||||
|
|
||||||
done:
|
|
||||||
unformat_free (line_input);
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
VLIB_CLI_COMMAND (one_cp_enable_disable_command) = {
|
VLIB_CLI_COMMAND (one_cp_enable_command) = {
|
||||||
.path = "one",
|
.path = "one enable",
|
||||||
.short_help = "one [enable|disable]",
|
.short_help = "one enable",
|
||||||
.function = lisp_enable_disable_command_fn,
|
.function = one_enable_command_fn,
|
||||||
|
};
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
static clib_error_t *
|
||||||
|
one_disable_command_fn (vlib_main_t * vm, unformat_input_t * input,
|
||||||
|
vlib_cli_command_t * cmd)
|
||||||
|
{
|
||||||
|
if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
||||||
|
return clib_error_return (0, "parse error: '%U'", format_unformat_error,
|
||||||
|
input);
|
||||||
|
|
||||||
|
vnet_lisp_enable_disable (0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
|
VLIB_CLI_COMMAND (one_cp_disable_command) = {
|
||||||
|
.path = "one disable",
|
||||||
|
.short_help = "one disable",
|
||||||
|
.function = one_disable_command_fn,
|
||||||
};
|
};
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user