2 * cdp.c - vpp-api-test cdp protocol plug-in
4 * Copyright (c) 2011-2018 by Cisco and/or its affiliates.
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 <cdp/cdp.api_enum.h>
26 #include <cdp/cdp.api_types.h>
30 /* API message ID base */
35 cdp_test_main_t cdp_test_main;
37 #define __plugin_msg_base cdp_test_main.msg_id_base
38 #include <vlibapi/vat_helper_macros.h>
41 * Table of message reply handlers, must include boilerplate handlers
44 #define foreach_vpe_api_reply_msg \
45 _(CDP_ENABLE_DISABLE_REPLY, cdp_enable_disable_reply)
48 api_cdp_enable_disable (vat_main_t * vam)
50 unformat_input_t *i = vam->input;
51 int enable_disable = 1;
52 vl_api_cdp_enable_disable_t *mp;
55 /* Parse args required to build the message */
56 while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
58 if (unformat (i, "disable"))
60 else if (unformat (i, "enable"))
66 /* Construct the API message */
67 M (CDP_ENABLE_DISABLE, mp);
68 mp->enable_disable = enable_disable;
73 /* Wait for a reply... */
78 #include <cdp/cdp.api_test.c>
81 * fd.io coding-style-patch-verification: ON
84 * eval: (c-set-style "gnu")