GBP: per-group EP retention policy
[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   /* hey Ole WTF */
104   GBP_API_ENDPOINT_FLAG_REMOTE_LEARNT = 0x6,
105   GBP_API_ENDPOINT_FLAG_EXTERNAL = 0x8,
106 };
107
108 typedef gbp_endpoint_tun
109 {
110   vl_api_address_t src;
111   vl_api_address_t dst;
112 };
113
114 typedef gbp_endpoint
115 {
116   u32 sw_if_index;
117   u16 epg_id;
118   vl_api_gbp_endpoint_flags_t flags;
119   vl_api_mac_address_t mac;
120   vl_api_gbp_endpoint_tun_t tun;
121   u8 n_ips;
122   vl_api_address_t ips[n_ips];
123 };
124
125 define gbp_endpoint_add
126 {
127   u32 client_index;
128   u32 context;
129   vl_api_gbp_endpoint_t endpoint;
130 };
131
132 define gbp_endpoint_add_reply
133 {
134   u32 context;
135   i32 retval;
136   u32 handle;
137 };
138
139 autoreply define gbp_endpoint_del
140 {
141   u32 client_index;
142   u32 context;
143   u32 handle;
144 };
145
146 define gbp_endpoint_dump
147 {
148   u32 client_index;
149   u32 context;
150 };
151
152 define gbp_endpoint_details
153 {
154   u32 context;
155   f64 age;
156   u32 handle;
157   vl_api_gbp_endpoint_t endpoint;
158 };
159
160 typedef gbp_endpoint_retention
161 {
162   u32 remote_ep_timeout;
163 };
164
165 typeonly define gbp_endpoint_group
166 {
167   u16 epg_id;
168   u16 sclass;
169   u32 bd_id;
170   u32 rd_id;
171   u32 uplink_sw_if_index;
172   vl_api_gbp_endpoint_retention_t retention;
173 };
174
175 autoreply define gbp_endpoint_group_add
176 {
177   u32 client_index;
178   u32 context;
179   vl_api_gbp_endpoint_group_t epg;
180 };
181 autoreply define gbp_endpoint_group_del
182 {
183   u32 client_index;
184   u32 context;
185   u16 epg_id;
186 };
187
188 define gbp_endpoint_group_dump
189 {
190   u32 client_index;
191   u32 context;
192 };
193
194 define gbp_endpoint_group_details
195 {
196   u32 context;
197   vl_api_gbp_endpoint_group_t epg;
198 };
199
200 typeonly define gbp_recirc
201 {
202   u32 sw_if_index;
203   u16 epg_id;
204   u8  is_ext;
205 };
206
207 autoreply define gbp_recirc_add_del
208 {
209   u32 client_index;
210   u32 context;
211   u8  is_add;
212   vl_api_gbp_recirc_t recirc;
213 };
214
215 define gbp_recirc_dump
216 {
217   u32 client_index;
218   u32 context;
219 };
220
221 define gbp_recirc_details
222 {
223   u32 context;
224   vl_api_gbp_recirc_t recirc;
225 };
226
227 enum gbp_subnet_type
228 {
229   GBP_API_SUBNET_TRANSPORT,
230   GBP_API_SUBNET_STITCHED_INTERNAL,
231   GBP_API_SUBNET_STITCHED_EXTERNAL,
232   GBP_API_SUBNET_L3_OUT,
233 };
234
235 typeonly define gbp_subnet
236 {
237   u32 rd_id;
238   u32 sw_if_index;
239   u16 epg_id;
240   vl_api_gbp_subnet_type_t type;
241   vl_api_prefix_t prefix;
242 };
243
244 autoreply define gbp_subnet_add_del
245 {
246   u32 client_index;
247   u32 context;
248   u8  is_add;
249   vl_api_gbp_subnet_t subnet;
250 };
251
252 define gbp_subnet_dump
253 {
254   u32 client_index;
255   u32 context;
256 };
257
258 define gbp_subnet_details
259 {
260   u32 context;
261   vl_api_gbp_subnet_t subnet;
262 };
263
264 typedef gbp_next_hop
265 {
266   vl_api_address_t ip;
267   vl_api_mac_address_t mac;
268   u32 bd_id;
269   u32 rd_id;
270 };
271
272 enum gbp_hash_mode
273 {
274   GBP_API_HASH_MODE_SRC_IP,
275   GBP_API_HASH_MODE_DST_IP,
276   GBP_API_HASH_MODE_SYMMETRIC,
277 };
278
279 typedef gbp_next_hop_set
280 {
281   vl_api_gbp_hash_mode_t hash_mode;
282   u8 n_nhs;
283   vl_api_gbp_next_hop_t nhs[8];
284 };
285
286 enum gbp_rule_action
287 {
288   GBP_API_RULE_PERMIT,
289   GBP_API_RULE_DENY,
290   GBP_API_RULE_REDIRECT,
291 };
292
293 typedef gbp_rule
294 {
295   vl_api_gbp_rule_action_t action;
296   vl_api_gbp_next_hop_set_t nh_set;
297 };
298
299 typedef gbp_contract
300 {
301   u16 src_epg;
302   u16 dst_epg;
303   u32 acl_index;
304   u8  n_rules;
305   vl_api_gbp_rule_t rules[n_rules];
306   u8 n_ether_types;
307   u16 allowed_ethertypes[n_ether_types];
308 };
309
310 autoreply define gbp_contract_add_del
311 {
312   u32 client_index;
313   u32 context;
314   u8  is_add;
315   vl_api_gbp_contract_t contract;
316 };
317
318 define gbp_contract_dump
319 {
320   u32 client_index;
321   u32 context;
322 };
323
324 define gbp_contract_details
325 {
326   u32 context;
327   vl_api_gbp_contract_t contract;
328 };
329
330 /**
331  * @brief Configure a 'base' tunnel from which learned tunnels
332  *        are permitted to derive
333  *        A base tunnel consists only of the VNI, any src,dst IP
334  *        pair is thus allowed.
335  */
336 enum gbp_vxlan_tunnel_mode
337 {
338   GBP_VXLAN_TUNNEL_MODE_L2,
339   GBP_VXLAN_TUNNEL_MODE_L3,
340 };
341
342 typedef gbp_vxlan_tunnel
343 {
344   u32 vni;
345   vl_api_gbp_vxlan_tunnel_mode_t mode;
346   u32 bd_rd_id;
347 };
348
349 define gbp_vxlan_tunnel_add
350 {
351   u32 client_index;
352   u32 context;
353   vl_api_gbp_vxlan_tunnel_t tunnel;
354 };
355
356 define gbp_vxlan_tunnel_add_reply
357 {
358   u32 context;
359   i32 retval;
360   u32 sw_if_index;
361 };
362
363 autoreply define gbp_vxlan_tunnel_del
364 {
365   u32 client_index;
366   u32 context;
367   u32 vni;
368 };
369
370 define gbp_vxlan_tunnel_dump
371 {
372   u32 client_index;
373   u32 context;
374 };
375
376 define gbp_vxlan_tunnel_details
377 {
378   u32 context;
379   vl_api_gbp_vxlan_tunnel_t tunnel;
380 };
381
382 typeonly define gbp_ext_itf
383 {
384   u32 sw_if_index;
385   u32 bd_id;
386   u32 rd_id;
387 };
388
389 autoreply define gbp_ext_itf_add_del
390 {
391   u32 client_index;
392   u32 context;
393   u8  is_add;
394   vl_api_gbp_ext_itf_t ext_itf;
395 };
396
397 define gbp_ext_itf_dump
398 {
399   u32 client_index;
400   u32 context;
401 };
402
403 define gbp_ext_itf_details
404 {
405   u32 context;
406   vl_api_gbp_ext_itf_t ext_itf;
407 };
408
409 /*
410  * Local Variables:
411  * eval: (c-set-style "gnu")
412  * End:
413  */