vom: Add support for redirect contracts in gbp
[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   NONE = 0,
99   BOUNCE = 0x1,
100   REMOTE = 0x2,
101   LEARNT = 0x4,
102   /* hey Ole WTF */
103   REMOTE_LEARNT = 0x6,
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 epg_id;
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 typeonly define gbp_endpoint_group
159 {
160   u16 epg_id;
161   u32 bd_id;
162   u32 rd_id;
163   u32 uplink_sw_if_index;
164 };
165
166 autoreply define gbp_endpoint_group_add
167 {
168   u32 client_index;
169   u32 context;
170   vl_api_gbp_endpoint_group_t epg;
171 };
172 autoreply define gbp_endpoint_group_del
173 {
174   u32 client_index;
175   u32 context;
176   u16 epg_id;
177 };
178
179 define gbp_endpoint_group_dump
180 {
181   u32 client_index;
182   u32 context;
183 };
184
185 define gbp_endpoint_group_details
186 {
187   u32 context;
188   vl_api_gbp_endpoint_group_t epg;
189 };
190
191 typeonly define gbp_recirc
192 {
193   u32 sw_if_index;
194   u16 epg_id;
195   u8  is_ext;
196 };
197
198 autoreply define gbp_recirc_add_del
199 {
200   u32 client_index;
201   u32 context;
202   u8  is_add;
203   vl_api_gbp_recirc_t recirc;
204 };
205
206 define gbp_recirc_dump
207 {
208   u32 client_index;
209   u32 context;
210 };
211
212 define gbp_recirc_details
213 {
214   u32 context;
215   vl_api_gbp_recirc_t recirc;
216 };
217
218 enum gbp_subnet_type
219 {
220   GBP_API_SUBNET_TRANSPORT,
221   GBP_API_SUBNET_STITCHED_INTERNAL,
222   GBP_API_SUBNET_STITCHED_EXTERNAL,
223 };
224
225 typeonly define gbp_subnet
226 {
227   u32 rd_id;
228   u32 sw_if_index;
229   u16 epg_id;
230   vl_api_gbp_subnet_type_t type;
231   vl_api_prefix_t prefix;
232 };
233
234 autoreply define gbp_subnet_add_del
235 {
236   u32 client_index;
237   u32 context;
238   u8  is_add;
239   vl_api_gbp_subnet_t subnet;
240 };
241
242 define gbp_subnet_dump
243 {
244   u32 client_index;
245   u32 context;
246 };
247
248 define gbp_subnet_details
249 {
250   u32 context;
251   vl_api_gbp_subnet_t subnet;
252 };
253
254 typedef gbp_next_hop
255 {
256   vl_api_address_t ip;
257   vl_api_mac_address_t mac;
258   u32 bd_id;
259   u32 rd_id;
260 };
261
262 enum gbp_hash_mode
263 {
264   GBP_API_HASH_MODE_SRC_IP,
265   GBP_API_HASH_MODE_DST_IP,
266   GBP_API_HASH_MODE_SYMMETRIC,
267 };
268
269 typedef gbp_next_hop_set
270 {
271   vl_api_gbp_hash_mode_t hash_mode;
272   u8 n_nhs;
273   vl_api_gbp_next_hop_t nhs[8];
274 };
275
276 enum gbp_rule_action
277 {
278   GBP_API_RULE_PERMIT,
279   GBP_API_RULE_DENY,
280   GBP_API_RULE_REDIRECT,
281 };
282
283 typedef gbp_rule
284 {
285   vl_api_gbp_rule_action_t action;
286   vl_api_gbp_next_hop_set_t nh_set;
287 };
288
289 typedef gbp_contract
290 {
291   u16 src_epg;
292   u16 dst_epg;
293   u32 acl_index;
294   u8  n_rules;
295   vl_api_gbp_rule_t rules[n_rules];
296 };
297
298 autoreply define gbp_contract_add_del
299 {
300   u32 client_index;
301   u32 context;
302   u8  is_add;
303   vl_api_gbp_contract_t contract;
304 };
305
306 define gbp_contract_dump
307 {
308   u32 client_index;
309   u32 context;
310 };
311
312 define gbp_contract_details
313 {
314   u32 context;
315   vl_api_gbp_contract_t contract;
316 };
317
318 /**
319  * @brief Set the time throeshold after which an endpoint is
320           considered inative and is aged/reaped by the scanner
321  * @param threshold In seconds
322  */
323 autoreply define gbp_endpoint_learn_set_inactive_threshold
324 {
325   u32 client_index;
326   u32 context;
327   u32 threshold;
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 /*
383  * Local Variables:
384  * eval: (c-set-style "gnu")
385  * End:
386  */