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