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