2 * Copyright (c) 2023 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vlib/vlib.h>
17 #include <tracenode/tracenode.h>
20 tracenode_feature_cmd_fn (vlib_main_t *vm, unformat_input_t *input,
21 vlib_cli_command_t *cmd)
23 unformat_input_t _line_input, *line_input = &_line_input;
25 int enable = 1, is_pcap = 0;
28 /* Get a line of input. */
29 if (!unformat_user (input, unformat_line_input, line_input))
32 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
34 if (unformat (line_input, "disable"))
36 else if (unformat (line_input, "pcap"))
38 else if (unformat (line_input, "%U", unformat_vnet_sw_interface,
39 vnet_get_main (), &sw_if_index))
42 return clib_error_return (0, "Local interface not supported...");
49 if (sw_if_index == ~0)
50 return clib_error_return (0, "Software interface required");
52 if ((rv = tracenode_feature_enable_disable (sw_if_index, is_pcap, enable)) !=
54 return clib_error_return (
55 0, "vnet_enable_disable_tracenode_feature returned %d", rv);
60 VLIB_CLI_COMMAND (tracenode_feature, static) = {
61 .path = "tracenode feature",
62 .short_help = "tracenode feature <intfc> [disable] [pcap]",
63 .function = tracenode_feature_cmd_fn,
67 * fd.io coding-style-patch-verification: ON
70 * eval: (c-set-style "gnu")