tests: move defaults from defaultmapping to .api files
[vpp.git] / src / plugins / acl / acl.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2016 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /** \file
18     This file defines the vpp control-plane API messages
19     used to control the ACL plugin
20 */
21
22 option version = "2.0.0";
23
24 import "plugins/acl/acl_types.api";
25 import "vnet/interface_types.api";
26
27 /** \brief Get the plugin version
28     @param client_index - opaque cookie to identify the sender
29     @param context - sender context, to match reply w/ request
30 */
31
32 define acl_plugin_get_version
33 {
34   u32 client_index;
35   u32 context;
36 };
37
38 /** \brief Reply to get the plugin version
39     @param context - returned sender context, to match reply w/ request
40     @param major - Incremented every time a known breaking behavior change is introduced
41     @param minor - Incremented with small changes, may be used to avoid buggy versions
42 */
43
44 define acl_plugin_get_version_reply
45 {
46   u32 context;
47   u32 major;
48   u32 minor;
49 };
50
51 /** \brief Control ping from client to api server request
52     @param client_index - opaque cookie to identify the sender
53     @param context - sender context, to match reply w/ request
54 */
55 define acl_plugin_control_ping
56 {
57   u32 client_index;
58   u32 context;
59 };
60
61 /** \brief Control ping from the client to the server response
62     @param client_index - opaque cookie to identify the sender
63     @param context - sender context, to match reply w/ request
64     @param retval - return code for the request
65     @param vpe_pid - the pid of the vpe, returned by the server
66 */
67 define acl_plugin_control_ping_reply
68 {
69   u32 context;
70   i32 retval;
71   u32 client_index;
72   u32 vpe_pid;
73 };
74
75 /** \brief Get Connection table max entries
76     @param client_index - opaque cookie to identify the sender
77     @param context - sender context, to match reply w/ request
78 */
79
80 define acl_plugin_get_conn_table_max_entries
81 {
82   u32 client_index;
83   u32 context;
84 };
85
86 /** \brief Reply to get connection table max entries
87     @param context - sender context, to match reply w/ request
88     @param conn_table_max_entries - the value of maximum entries of connection table
89 */
90 define acl_plugin_get_conn_table_max_entries_reply
91 {
92   u32 context;
93   u64 conn_table_max_entries;
94 };
95
96 /** \brief Replace an existing ACL in-place or create a new ACL
97     @param client_index - opaque cookie to identify the sender
98     @param context - sender context, to match reply w/ request
99     @param acl_index - an existing ACL entry (0..0xfffffffe) to replace, or 0xffffffff to make new ACL
100     @param tag - a string value stored along with the ACL, for descriptive purposes
101     @param count - number of ACL rules
102     @r - Rules for this access-list
103 */
104
105 manual_print manual_endian define acl_add_replace
106 {
107   u32 client_index;
108   u32 context;
109   u32 acl_index; /* ~0 to add, existing ACL# to replace */
110   string tag[64]; /* What gets in here gets out in the corresponding tag field when dumping the ACLs. */
111   u32 count;
112   vl_api_acl_rule_t r[count];
113   option vat_help = "<acl-idx> [<ipv4|ipv6>] <permit|permit+reflect|deny|action N> [src IP/plen] [dst IP/plen] [sport X-Y] [dport X-Y] [proto P] [tcpflags FL MASK], ... , ...";
114 };
115
116 /** \brief Reply to add/replace ACL
117     @param context - returned sender context, to match reply w/ request
118     @param acl_index - index of the updated or newly created ACL
119     @param retval 0 - no error
120 */
121
122 define acl_add_replace_reply
123 {
124   u32 context;
125   u32 acl_index;
126   i32 retval;
127 };
128
129 /** \brief Delete an ACL
130     @param client_index - opaque cookie to identify the sender
131     @param context - sender context, to match reply w/ request
132     @param acl_index - ACL index to delete
133 */
134
135 autoreply manual_print define acl_del
136 {
137   u32 client_index;
138   u32 context;
139   u32 acl_index;
140   option vat_help = "<acl-idx>";
141 };
142
143 /* acl_interface_add_del(_reply) to be deprecated in lieu of acl_interface_set_acl_list */
144 /** \brief Use acl_interface_set_acl_list instead
145     Append/remove an ACL index to/from the list of ACLs checked for an interface
146     @param client_index - opaque cookie to identify the sender
147     @param context - sender context, to match reply w/ request
148     @param is_add - add or delete the ACL index from the list
149     @param is_input - check the ACL on input (1) or output (0)
150     @param sw_if_index - the interface to alter the list of ACLs on
151     @param acl_index - index of ACL for the operation
152 */
153
154 autoreply manual_print define acl_interface_add_del
155 {
156   u32 client_index;
157   u32 context;
158   bool is_add [default=true];
159 /*
160  * is_input = 0 => ACL applied on interface egress
161  * is_input = 1 => ACL applied on interface ingress
162  */
163   bool is_input;
164   vl_api_interface_index_t sw_if_index;
165   u32 acl_index;
166   option vat_help = "<intfc> | sw_if_index <if-idx> [add|del] [input|output] acl <acl-idx>";
167 };
168
169 /** \brief Set the vector of input/output ACLs checked for an interface
170     @param client_index - opaque cookie to identify the sender
171     @param context - sender context, to match reply w/ request
172     @param sw_if_index - the interface to alter the list of ACLs on
173     @param count - total number of ACL indices in the vector
174     @param n_input - this many first elements correspond to input ACLs, the rest - output
175     @param acls - vector of ACL indices
176 */
177
178 autoreply manual_print define acl_interface_set_acl_list
179 {
180   u32 client_index;
181   u32 context;
182   vl_api_interface_index_t sw_if_index;
183   u8 count;
184   u8 n_input; /* First n_input ACLs are set as a list of input ACLs, the rest are applied as output */
185   u32 acls[count];
186   option vat_help = "<intfc> | sw_if_index <if-idx> input [acl-idx list] output [acl-idx list]";
187 };
188
189 /** \brief Reply to set the ACL list on an interface
190     @param context - returned sender context, to match reply w/ request
191     @param retval 0 - no error
192 */
193
194 /** \brief Dump the specific ACL contents or all of the ACLs' contents
195     @param client_index - opaque cookie to identify the sender
196     @param context - sender context, to match reply w/ request
197     @param acl_index - ACL index to dump, ~0 to dump all ACLs
198 */
199
200 define acl_dump
201 {
202   u32 client_index;
203   u32 context;
204   u32 acl_index; /* ~0 for all ACLs */
205   option vat_help = "[<acl-idx>]";
206 };
207
208 /** \brief Details about a single ACL contents
209     @param context - returned sender context, to match reply w/ request
210     @param acl_index - ACL index whose contents are being sent in this message
211     @param tag - Descriptive tag value which was supplied at ACL creation
212     @param count - Number of rules in this ACL
213     @param r - Array of rules within this ACL
214 */
215
216 manual_endian manual_print define acl_details
217 {
218   u32 context;
219   u32 acl_index;
220   string tag[64]; /* Same blob that was supplied to us when creating the ACL, one hopes. */
221   u32 count;
222   vl_api_acl_rule_t r[count];
223 };
224
225 /** \brief Dump the list(s) of ACL applied to specific or all interfaces
226     @param client_index - opaque cookie to identify the sender
227     @param context - sender context, to match reply w/ request
228     @param sw_if_index - interface for which to dump the ACL list. Default: 0xffffffff (All interfaces)
229 */
230
231 define acl_interface_list_dump
232 {
233   u32 client_index;
234   u32 context;
235   vl_api_interface_index_t sw_if_index [default=0xffffffff];
236   option vat_help = "[<intfc> | sw_if_index <if-idx>]";
237 };
238
239 /** \brief Details about a single ACL contents
240     @param context - returned sender context, to match reply w/ request
241     @param sw_if_index - interface for which the list of ACLs is applied
242     @param count - total length of acl indices vector
243     @param n_input - this many of indices in the beginning are input ACLs, the rest - output
244     @param acls - the vector of ACL indices
245 */
246
247 define acl_interface_list_details
248 {
249   u32 context;
250   vl_api_interface_index_t sw_if_index;
251   u8 count;
252   u8 n_input;
253   u32 acls[count];
254 };
255
256 /** \brief Add a MACIP ACL
257     @param client_index - opaque cookie to identify the sender
258     @param context - sender context, to match reply w/ request
259     @param tag - descriptive value for this MACIP ACL
260     @param count - number of rules in this MACIP ACL
261     @param r - vector of MACIP ACL rules
262 */
263
264 manual_endian manual_print define macip_acl_add
265 {
266   u32 client_index;
267   u32 context;
268   string tag[64];
269   u32 count;
270   vl_api_macip_acl_rule_t r[count];
271   option vat_help = "...";
272 };
273
274 /** \brief Reply to add MACIP ACL
275     @param context - returned sender context, to match reply w/ request
276     @param acl_index - index of the newly created MACIP ACL
277     @param retval 0 - no error
278 */
279
280 define macip_acl_add_reply
281 {
282   u32 context;
283   u32 acl_index;
284   i32 retval;
285 };
286
287 /** \brief Add/Replace a MACIP ACL
288     @param client_index - opaque cookie to identify the sender
289     @param context - sender context, to match reply w/ request
290     @param acl_index - an existing MACIP ACL entry (0..0xfffffffe) to replace, or 0xffffffff to make new MACIP ACL Default: 0xffffffff
291     @param tag - descriptive value for this MACIP ACL
292     @param count - number of rules in this MACIP ACL
293     @param r - vector of MACIP ACL rules
294 */
295
296 manual_endian manual_print define macip_acl_add_replace
297 {
298   u32 client_index;
299   u32 context;
300   u32 acl_index [default=0xffffffff]; /* ~0 to add, existing MACIP ACL# to replace */
301   string tag[64];
302   u32 count;
303   vl_api_macip_acl_rule_t r[count];
304   option vat_help = "<acl-idx> [<ipv4|ipv6>] <permit|deny|action N> [count <count>] [src] ip <ipaddress/[plen]> mac <mac> mask <mac_mask>, ... , ...";
305 };
306
307 /** \brief Reply to add/replace MACIP ACL
308     @param context - returned sender context, to match reply w/ request
309     @param acl_index - index of the newly created MACIP ACL
310     @param retval 0 - no error
311 */
312
313 define macip_acl_add_replace_reply
314 {
315   u32 context;
316   u32 acl_index;
317   i32 retval;
318 };
319
320 /** \brief Delete a MACIP ACL
321     @param client_index - opaque cookie to identify the sender
322     @param context - sender context, to match reply w/ request
323     @param acl_index - MACIP ACL index to delete
324 */
325
326 autoreply manual_print define macip_acl_del
327 {
328   u32 client_index;
329   u32 context;
330   u32 acl_index;
331   option vat_help = "<acl-idx>";
332 };
333
334 /** \brief Add or delete a MACIP ACL to/from interface
335     @param client_index - opaque cookie to identify the sender
336     @param context - sender context, to match reply w/ request
337     @param is_add - add (1) or delete (0) MACIP ACL from being used on an interface
338     @param sw_if_index - interface to apply the action to
339     @param acl_index - MACIP ACL index
340 */
341
342 autoreply manual_print define macip_acl_interface_add_del
343 {
344   u32 client_index;
345   u32 context;
346   bool is_add [default=true];
347   /* MACIP ACLs are always input */
348   vl_api_interface_index_t sw_if_index;
349   u32 acl_index;
350   option vat_help = "<intfc> | sw_if_index <if-idx> [add|del] acl <acl-idx>";
351 };
352
353 /** \brief Dump one or all defined MACIP ACLs
354     @param client_index - opaque cookie to identify the sender
355     @param context - sender context, to match reply w/ request
356     @param acl_index - MACIP ACL index or ~0 to dump all MACIP ACLs Default: 0xffffffff
357 */
358
359 define macip_acl_dump
360 {
361   u32 client_index;
362   u32 context;
363   u32 acl_index [default=0xffffffff]; /* ~0 for all ACLs */
364   option vat_help = "[<acl-idx>]";
365 };
366
367 /** \brief Details about one MACIP ACL
368     @param context - returned sender context, to match reply w/ request
369     @param acl_index - index of this MACIP ACL
370     @param tag - descriptive tag which was supplied during the creation
371     @param count - length of the vector of MACIP ACL rules
372     @param r - rules comprising this MACIP ACL
373 */
374
375 manual_endian manual_print define macip_acl_details
376 {
377   u32 context;
378   u32 acl_index;
379   string tag[64];
380   u32 count;
381   vl_api_macip_acl_rule_t r[count];
382 };
383
384 /** \brief Get the vector of MACIP ACL IDs applied to the interfaces
385     @param client_index - opaque cookie to identify the sender
386     @param context - sender context, to match reply w/ request
387 */
388
389 define macip_acl_interface_get
390 {
391   u32 client_index;
392   u32 context;
393 };
394
395 /** \brief Reply with the vector of MACIP ACLs by sw_if_index
396     @param context - returned sender context, to match reply w/ request
397     @param count - total number of elements in the vector
398     @param acls - the vector of active MACIP ACL indices per sw_if_index
399 */
400
401 define macip_acl_interface_get_reply
402 {
403   u32 context;
404   u32 count;
405   u32 acls[count];
406 };
407
408 /** \brief Dump the list(s) of MACIP ACLs applied to specific or all interfaces
409     @param client_index - opaque cookie to identify the sender
410     @param context - sender context, to match reply w/ request
411     @param sw_if_index - interface to dump the MACIP ACL list for
412 */
413
414 define macip_acl_interface_list_dump
415 {
416   u32 client_index;
417   u32 context;
418   vl_api_interface_index_t sw_if_index; /* ~0 for all interfaces */
419 };
420
421 /** \brief Details about a single MACIP ACL contents
422     @param context - returned sender context, to match reply w/ request
423     @param sw_if_index - interface for which the list of MACIP ACLs is applied
424     @param count - total length of acl indices vector
425     @param acls - the vector of MACIP ACL indices
426 */
427
428 define macip_acl_interface_list_details
429 {
430   u32 context;
431   vl_api_interface_index_t sw_if_index;
432   u8 count;
433   u32 acls[count];
434 };
435
436 /** \brief Set the ethertype whitelists on an interface. Takes effect when applying ACLs on the interface, so must be given prior.
437     @param client_index - opaque cookie to identify the sender
438     @param context - sender context, to match reply w/ request
439     @param sw_if_index - the interface to alter the list of ACLs on
440     @param count - total number of whitelisted ethertypes in the vector
441     @param n_input - this many first elements correspond to input whitelisted ethertypes, the rest - output
442     @param whitelist - vector of whitelisted ethertypes
443 */
444
445 autoreply manual_print define acl_interface_set_etype_whitelist
446 {
447   u32 client_index;
448   u32 context;
449   vl_api_interface_index_t sw_if_index;
450   u8 count; /* Total number of ethertypes in the whitelist */
451   u8 n_input; /* first n_input ethertypes are input, the rest - output */
452   u16 whitelist[count];
453   option vat_help = "<intfc> | sw_if_index <if-idx> input [ethertype list] output [ethertype list]";
454 };
455
456 /** \brief Dump the list(s) of Ethertype whitelists applied to specific or all interfaces
457     @param client_index - opaque cookie to identify the sender
458     @param context - sender context, to match reply w/ request
459     @param sw_if_index - interface to dump the ethertype whitelist for
460 */
461
462 define acl_interface_etype_whitelist_dump
463 {
464   u32 client_index;
465   u32 context;
466   vl_api_interface_index_t sw_if_index; /* ~0 for all interfaces */
467   option vat_help = "[<intfc> | sw_if_index <if-idx>]";
468 };
469
470 /** \brief Details about ethertype whitelist on a single interface
471     @param context - returned sender context, to match reply w/ request
472     @param sw_if_index - interface for which the list of MACIP ACLs is applied
473     @param count - total number of whitelisted ethertypes in the vector
474     @param n_input - this many first elements correspond to input whitelisted ethertypes, the rest - output
475     @param whitelist - vector of whitelisted ethertypes
476 */
477
478 define acl_interface_etype_whitelist_details
479 {
480   u32 context;
481   vl_api_interface_index_t sw_if_index;
482   u8 count;
483   u8 n_input; /* first n_input ethertypes are input, the rest - output */
484   u16 whitelist[count];
485 };
486
487 /** \brief Enable or disable incrementing ACL counters in stats segment by interface processing
488     @param client_index - opaque cookie to identify the sender
489     @param context - sender context, to match reply w/ request
490     @param enable - whether to enable or disable incrementing the counters
491 */
492
493 autoreply define acl_stats_intf_counters_enable
494 {
495   u32 client_index;
496   u32 context;
497   bool enable;
498   option vat_help = "[disable]";
499 };