X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2Fnat44_cli.c;h=4dcfb8d8e57c1b49e575fec92fbecf9ffdeed844;hb=e6e09a4acef2c38bc31e89c05bd1f40f1829debb;hp=cfa294f2222ef0184548a5966b7c53ce75fb283a;hpb=c343a17df5bba800ecd7cca92acdd2bd1f984ebf;p=vpp.git diff --git a/src/plugins/nat/nat44_cli.c b/src/plugins/nat/nat44_cli.c index cfa294f2222..4dcfb8d8e57 100644 --- a/src/plugins/nat/nat44_cli.c +++ b/src/plugins/nat/nat44_cli.c @@ -115,6 +115,39 @@ nat_show_workers_commnad_fn (vlib_main_t * vm, unformat_input_t * input, return 0; } +static clib_error_t * +snat_set_log_level_command_fn (vlib_main_t * vm, + unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + unformat_input_t _line_input, *line_input = &_line_input; + snat_main_t *sm = &snat_main; + u8 log_level = SNAT_LOG_NONE; + clib_error_t *error = 0; + + /* Get a line of input. */ + if (!unformat_user (input, unformat_line_input, line_input)) + return 0; + + if (!unformat (line_input, "level %d", &log_level)) + { + error = clib_error_return (0, "unknown input '%U'", + format_unformat_error, line_input); + goto done; + } + if (log_level > SNAT_LOG_DEBUG) + { + error = clib_error_return (0, "unknown logging level '%d'", log_level); + goto done; + } + sm->log_level = log_level; + +done: + unformat_free (line_input); + + return error; +} + static clib_error_t * snat_ipfix_logging_enable_disable_command_fn (vlib_main_t * vm, unformat_input_t * input, @@ -1943,6 +1976,19 @@ VLIB_CLI_COMMAND (nat_show_timeouts_command, static) = { .function = nat_show_timeouts_command_fn, }; +/*? + * @cliexpar + * @cliexstart{nat set logging level} + * To set NAT logging level use: + * Set nat logging level + * @cliexend +?*/ +VLIB_CLI_COMMAND (snat_set_log_level_command, static) = { + .path = "nat set logging level", + .function = snat_set_log_level_command_fn, + .short_help = "nat set logging level ", +}; + /*? * @cliexpar * @cliexstart{snat ipfix logging}