GBP: contracts API fixed length of allowed ethertypes
[vpp.git] / src / plugins / gbp / gbp.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2018 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 option version = "2.0.0";
18
19 import "vnet/ip/ip_types.api";
20 import "vnet/ethernet/ethernet_types.api";
21
22 enum gbp_bridge_domain_flags
23 {
24   GBP_BD_API_FLAG_NONE = 0,
25   GBP_BD_API_FLAG_DO_NOT_LEARN = 1,
26 };
27
28 typedef gbp_bridge_domain
29 {
30   u32 bd_id;
31   vl_api_gbp_bridge_domain_flags_t flags;
32   u32 bvi_sw_if_index;
33   u32 uu_fwd_sw_if_index;
34   u32 bm_flood_sw_if_index;
35 };
36
37 autoreply define gbp_bridge_domain_add
38 {
39   u32 client_index;
40   u32 context;
41   vl_api_gbp_bridge_domain_t bd;
42 };
43 autoreply define gbp_bridge_domain_del
44 {
45   u32 client_index;
46   u32 context;
47   u32 bd_id;
48 };
49 autoreply define gbp_bridge_domain_dump
50 {
51   u32 client_index;
52   u32 context;
53 };
54 define gbp_bridge_domain_details
55 {
56   u32 context;
57   vl_api_gbp_bridge_domain_t bd;
58 };
59
60 typedef gbp_route_domain
61 {
62   u32 rd_id;
63   u32 ip4_table_id;
64   u32 ip6_table_id;
65   u32 ip4_uu_sw_if_index;
66   u32 ip6_uu_sw_if_index;
67 };
68
69 autoreply define gbp_route_domain_add
70 {
71   u32 client_index;
72   u32 context;
73   vl_api_gbp_route_domain_t rd;
74 };
75 autoreply define gbp_route_domain_del
76 {
77   u32 client_index;
78   u32 context;
79   u32 rd_id;
80 };
81 autoreply define gbp_route_domain_dump
82 {
83   u32 client_index;
84   u32 context;
85 };
86 define gbp_route_domain_details
87 {
88   u32 context;
89   vl_api_gbp_route_domain_t rd;
90 };
91
92 /** \brief Endpoint
93     @param client_index - opaque cookie to identify the sender
94     @param context - sender context, to match reply w/ request
95 */
96
97 enum gbp_endpoint_flags
98 {
99   GBP_API_ENDPOINT_FLAG_NONE = 0,
100   GBP_API_ENDPOINT_FLAG_BOUNCE = 0x1,
101   GBP_API_ENDPOINT_FLAG_REMOTE = 0x2,
102   GBP_API_ENDPOINT_FLAG_LEARNT = 0x4,
103   GBP_API_ENDPOINT_FLAG_EXTERNAL = 0x8,
104 };
105
106 typedef gbp_endpoint_tun
107 {
108   vl_api_address_t src;
109   vl_api_address_t dst;
110 };
111
112 typedef gbp_endpoint
113 {
114   u32 sw_if_index;
115   u16 sclass;
116   vl_api_gbp_endpoint_flags_t flags;
117   vl_api_mac_address_t mac;
118   vl_api_gbp_endpoint_tun_t tun;
119   u8 n_ips;
120   vl_api_address_t ips[n_ips];
121 };
122
123 define gbp_endpoint_add
124 {
125   u32 client_index;
126   u32 context;
127   vl_api_gbp_endpoint_t endpoint;
128 };
129
130 define gbp_endpoint_add_reply
131 {
132   u32 context;
133   i32 retval;
134   u32 handle;
135 };
136
137 autoreply define gbp_endpoint_del
138 {
139   u32 client_index;
140   u32 context;
141   u32 handle;
142 };
143
144 define gbp_endpoint_dump
145 {
146   u32 client_index;
147   u32 context;
148 };
149
150 define gbp_endpoint_details
151 {
152   u32 context;
153   f64 age;
154   u32 handle;
155   vl_api_gbp_endpoint_t endpoint;
156 };
157
158 typedef gbp_endpoint_retention
159 {
160   u32 remote_ep_timeout;
161 };
162
163 typeonly define gbp_endpoint_group
164 {
165   u32 vnid;
166   u16 sclass;
167   u32 bd_id;
168   u32 rd_id;
169   u32 uplink_sw_if_index;
170   vl_api_gbp_endpoint_retention_t retention;
171 };
172
173 autoreply define gbp_endpoint_group_add
174 {
175   u32 client_index;
176   u32 context;
177   vl_api_gbp_endpoint_group_t epg;
178 };
179 autoreply define gbp_endpoint_group_del
180 {
181   u32 client_index;
182   u32 context;
183   u16 sclass;
184 };
185
186 define gbp_endpoint_group_dump
187 {
188   u32 client_index;
189   u32 context;
190 };
191
192 define gbp_endpoint_group_details
193 {
194   u32 context;
195   vl_api_gbp_endpoint_group_t epg;
196 };
197
198 typeonly define gbp_recirc
199 {
200   u32 sw_if_index;
201   u16 sclass;
202   u8  is_ext;
203 };
204
205 autoreply define gbp_recirc_add_del
206 {
207   u32 client_index;
208   u32 context;
209   u8  is_add;
210   vl_api_gbp_recirc_t recirc;
211 };
212
213 define gbp_recirc_dump
214 {
215   u32 client_index;
216   u32 context;
217 };
218
219 define gbp_recirc_details
220 {
221   u32 context;
222   vl_api_gbp_recirc_t recirc;
223 };
224
225 enum gbp_subnet_type
226 {
227   GBP_API_SUBNET_TRANSPORT,
228   GBP_API_SUBNET_STITCHED_INTERNAL,
229   GBP_API_SUBNET_STITCHED_EXTERNAL,
230   GBP_API_SUBNET_L3_OUT,
231 };
232
233 typeonly define gbp_subnet
234 {
235   u32 rd_id;
236   u32 sw_if_index;
237   u16 sclass;
238   vl_api_gbp_subnet_type_t type;
239   vl_api_prefix_t prefix;
240 };
241
242 autoreply define gbp_subnet_add_del
243 {
244   u32 client_index;
245   u32 context;
246   u8  is_add;
247   vl_api_gbp_subnet_t subnet;
248 };
249
250 define gbp_subnet_dump
251 {
252   u32 client_index;
253   u32 context;
254 };
255
256 define gbp_subnet_details
257 {
258   u32 context;
259   vl_api_gbp_subnet_t subnet;
260 };
261
262 typedef gbp_next_hop
263 {
264   vl_api_address_t ip;
265   vl_api_mac_address_t mac;
266   u32 bd_id;
267   u32 rd_id;
268 };
269
270 enum gbp_hash_mode
271 {
272   GBP_API_HASH_MODE_SRC_IP,
273   GBP_API_HASH_MODE_DST_IP,
274   GBP_API_HASH_MODE_SYMMETRIC,
275 };
276
277 typedef gbp_next_hop_set
278 {
279   vl_api_gbp_hash_mode_t hash_mode;
280   u8 n_nhs;
281   vl_api_gbp_next_hop_t nhs[8];
282 };
283
284 enum gbp_rule_action
285 {
286   GBP_API_RULE_PERMIT,
287   GBP_API_RULE_DENY,
288   GBP_API_RULE_REDIRECT,
289 };
290
291 typedef gbp_rule
292 {
293   vl_api_gbp_rule_action_t action;
294   vl_api_gbp_next_hop_set_t nh_set;
295 };
296
297 typedef gbp_contract
298 {
299   u16 sclass;
300   u16 dclass;
301   u32 acl_index;
302   u8 n_ether_types;
303   u16 allowed_ethertypes[16];
304   u8  n_rules;
305   vl_api_gbp_rule_t rules[n_rules];
306 };
307
308 autoreply define gbp_contract_add_del
309 {
310   u32 client_index;
311   u32 context;
312   u8  is_add;
313   vl_api_gbp_contract_t contract;
314 };
315
316 define gbp_contract_dump
317 {
318   u32 client_index;
319   u32 context;
320 };
321
322 define gbp_contract_details
323 {
324   u32 context;
325   vl_api_gbp_contract_t contract;
326 };
327
328 /**
329  * @brief Configure a 'base' tunnel from which learned tunnels
330  *        are permitted to derive
331  *        A base tunnel consists only of the VNI, any src,dst IP
332  *        pair is thus allowed.
333  */
334 enum gbp_vxlan_tunnel_mode
335 {
336   GBP_VXLAN_TUNNEL_MODE_L2,
337   GBP_VXLAN_TUNNEL_MODE_L3,
338 };
339
340 typedef gbp_vxlan_tunnel
341 {
342   u32 vni;
343   vl_api_gbp_vxlan_tunnel_mode_t mode;
344   u32 bd_rd_id;
345   vl_api_ip4_address_t src;
346 };
347
348 define gbp_vxlan_tunnel_add
349 {
350   u32 client_index;
351   u32 context;
352   vl_api_gbp_vxlan_tunnel_t tunnel;
353 };
354
355 define gbp_vxlan_tunnel_add_reply
356 {
357   u32 context;
358   i32 retval;
359   u32 sw_if_index;
360 };
361
362 autoreply define gbp_vxlan_tunnel_del
363 {
364   u32 client_index;
365   u32 context;
366   u32 vni;
367 };
368
369 define gbp_vxlan_tunnel_dump
370 {
371   u32 client_index;
372   u32 context;
373 };
374
375 define gbp_vxlan_tunnel_details
376 {
377   u32 context;
378   vl_api_gbp_vxlan_tunnel_t tunnel;
379 };
380
381 typeonly define gbp_ext_itf
382 {
383   u32 sw_if_index;
384   u32 bd_id;
385   u32 rd_id;
386 };
387
388 autoreply define gbp_ext_itf_add_del
389 {
390   u32 client_index;
391   u32 context;
392   u8  is_add;
393   vl_api_gbp_ext_itf_t ext_itf;
394 };
395
396 define gbp_ext_itf_dump
397 {
398   u32 client_index;
399   u32 context;
400 };
401
402 define gbp_ext_itf_details
403 {
404   u32 context;
405   vl_api_gbp_ext_itf_t ext_itf;
406 };
407
408 /*
409  * Local Variables:
410  * eval: (c-set-style "gnu")
411  * End:
412  */