2 * ct6.c - skeleton vpp-api-test plug-in
4 * Copyright (c) <current-year> <your-organization>
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include <vlibapi/api.h>
19 #include <vlibmemory/api.h>
20 #include <vppinfra/error.h>
22 uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
24 /* Declare message IDs */
25 #include <ct6/ct6.api_enum.h>
26 #include <ct6/ct6.api_types.h>
30 /* API message ID base */
35 ct6_test_main_t ct6_test_main;
37 #define __plugin_msg_base ct6_test_main.msg_id_base
38 #include <vlibapi/vat_helper_macros.h>
41 api_ct6_enable_disable (vat_main_t * vam)
43 unformat_input_t *i = vam->input;
44 int enable_disable = 1;
46 vl_api_ct6_enable_disable_t *mp;
50 /* Parse args required to build the message */
51 while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
53 if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
55 else if (unformat (i, "sw_if_index %d", &sw_if_index))
57 else if (unformat (i, "disable"))
59 else if (unformat (i, "inside") || unformat (i, "in"))
61 else if (unformat (i, "outside") || unformat (i, "out"))
69 errmsg ("must specify inside or outside");
73 if (sw_if_index == ~0)
75 errmsg ("missing interface name / explicit sw_if_index number \n");
79 /* Construct the API message */
80 M (CT6_ENABLE_DISABLE, mp);
81 mp->sw_if_index = ntohl (sw_if_index);
82 mp->enable_disable = enable_disable;
83 mp->is_inside = (u8) inside;
88 /* Wait for a reply... */
93 #include <ct6/ct6.api_test.c>
96 * fd.io coding-style-patch-verification: ON
99 * eval: (c-set-style "gnu")