2 *------------------------------------------------------------------
5 * Copyright (c) 2019 Cisco and/or its affiliates.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at:
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *------------------------------------------------------------------
21 #include <vlibapi/api.h>
22 #include <vlibmemory/api.h>
23 #include <vppinfra/error.h>
25 #include <vnet/ip/ip_format_fns.h>
27 #include <vpp/api/types.h>
31 /* API message ID base */
37 arp_test_main_t arp_test_main;
39 #define __plugin_msg_base arp_test_main.msg_id_base
40 #include <vlibapi/vat_helper_macros.h>
41 uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
43 /* Declare message IDs */
44 #include <arp/arp.api_enum.h>
45 #include <arp/arp.api_types.h>
46 #include <vpp/api/vpe.api_types.h>
49 api_proxy_arp_dump (vat_main_t * vam)
55 api_proxy_arp_intfc_dump (vat_main_t * vam)
61 vl_api_proxy_arp_details_t_handler (vl_api_proxy_arp_details_t * mp)
66 vl_api_proxy_arp_intfc_details_t_handler (vl_api_proxy_arp_intfc_details_t *
72 api_proxy_arp_add_del (vat_main_t * vam)
74 unformat_input_t *i = vam->input;
75 vl_api_proxy_arp_add_del_t *mp;
78 vl_api_ip4_address_t lo, hi;
82 while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
84 if (unformat (i, "vrf %d", &vrf_id))
86 else if (unformat (i, "%U - %U", unformat_vl_api_ip4_address, &lo,
87 unformat_vl_api_ip4_address, &hi))
89 else if (unformat (i, "del"))
93 clib_warning ("parse error '%U'", format_unformat_error, i);
100 errmsg ("address range not set");
104 M (PROXY_ARP_ADD_DEL, mp);
106 mp->proxy.table_id = ntohl (vrf_id);
108 clib_memcpy (mp->proxy.low, &lo, sizeof (lo));
109 clib_memcpy (mp->proxy.hi, &hi, sizeof (hi));
117 api_proxy_arp_intfc_enable_disable (vat_main_t * vam)
119 unformat_input_t *i = vam->input;
120 vl_api_proxy_arp_intfc_enable_disable_t *mp;
123 u8 sw_if_index_set = 0;
126 while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
128 if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
130 else if (unformat (i, "sw_if_index %d", &sw_if_index))
132 else if (unformat (i, "enable"))
134 else if (unformat (i, "disable"))
138 clib_warning ("parse error '%U'", format_unformat_error, i);
143 if (sw_if_index_set == 0)
145 errmsg ("missing interface name or sw_if_index");
149 M (PROXY_ARP_INTFC_ENABLE_DISABLE, mp);
151 mp->sw_if_index = ntohl (sw_if_index);
159 #include <arp/arp.api_test.c>
163 * fd.io coding-style-patch-verification: ON
166 * eval: (c-set-style "gnu")