ip: use IPv6 flowlabel in flow hash computation
[vpp.git] / src / vnet / ip / ip.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 /** \file
18
19     This file defines vpp IP control-plane API messages which are generally
20     called through a shared memory interface.
21 */
22
23 option version = "3.0.2";
24
25 import "vnet/interface_types.api";
26 import "vnet/fib/fib_types.api";
27 import "vnet/ethernet/ethernet_types.api";
28 import "vnet/mfib/mfib_types.api";
29 import "vnet/interface_types.api";
30
31 /** \brief An IP table
32     @param is_ipv6 - V4 or V6 table
33     @param table_id - table ID associated with the route
34                      This table ID will apply to both the unicast
35                       and multicast FIBs
36     @param name - A client provided name/tag for the table. If this is
37                   not set by the client, then VPP will generate something
38                   meaningful.
39 */
40 typedef ip_table
41 {
42   u32 table_id;
43   bool is_ip6;
44   string name[64];
45 };
46
47 /** \brief Add / del table request
48            A table can be added multiple times, but need be deleted only once.
49     @param client_index - opaque cookie to identify the sender
50     @param context - sender context, to match reply w/ request
51 */
52 autoreply define ip_table_add_del
53 {
54   u32 client_index;
55   u32 context;
56   bool is_add [default=true];
57   vl_api_ip_table_t table;
58 };
59
60 /** \brief Dump IP all fib tables
61     @param client_index - opaque cookie to identify the sender
62     @param context - sender context, to match reply w/ request
63 */
64 define ip_table_dump
65 {
66   u32 client_index;
67   u32 context;
68 };
69
70 /** \brief IP table replace being
71
72     The use-case is that, for some unspecified reason, the control plane
73     has a very different set of entries it wants in the table than VPP
74     currently has. The CP would thus like to 'replace' VPP's current table
75     only by specifying what the new set of entries shall be, i.e. it is not
76     going to delete anything that already exists.
77     the CP declares the start of this procedure with this begin_replace
78     API Call, and when it has populated all the entries it wants, it calls
79     the below end_replace API. From this point on it is of course free
80     to add and delete entries as usual.
81     The underlying mechanism by which VPP implements this replace is
82     purposefully left unspecified.
83
84     @param client_index - opaque cookie to identify the sender
85     @param context - sender context, to match reply w/ request
86     @param table - The table to resync
87 */
88 autoreply define ip_table_replace_begin
89 {
90   u32 client_index;
91   u32 context;
92   vl_api_ip_table_t table;
93 };
94
95 /** \brief IP table replace end
96
97     see replace start/
98
99     @param client_index - opaque cookie to identify the sender
100     @param context - sender context, to match reply w/ request
101     @param table - The table that has converged
102 */
103 autoreply define ip_table_replace_end
104 {
105   u32 client_index;
106   u32 context;
107   vl_api_ip_table_t table;
108 };
109
110 /** \brief IP table flush
111     Flush a table of all routes
112     @param client_index - opaque cookie to identify the sender
113     @param context - sender context, to match reply w/ request
114     @param table - The table to flush
115 */
116 autoreply define ip_table_flush
117 {
118   u32 client_index;
119   u32 context;
120   vl_api_ip_table_t table;
121 };
122
123 /** \brief IP FIB table response
124     @param context - sender context
125     @param table - description of the table
126 */
127 define ip_table_details
128 {
129   u32 context;
130   vl_api_ip_table_t table;
131 };
132
133 /** \brief An IP route
134   @param table_id The IP table the route is in
135   @param stats_index The index of the route in the stats segment
136   @param prefix the prefix for the route
137   @param n_paths The number of paths the route has
138   @param paths The paths of the route
139 */
140 typedef ip_route
141 {
142   u32 table_id;
143   u32 stats_index;
144   vl_api_prefix_t prefix;
145   u8 n_paths;
146   vl_api_fib_path_t paths[n_paths];
147 };
148
149 /** \brief Add / del route request
150     @param client_index - opaque cookie to identify the sender
151     @param context - sender context, to match reply w/ request
152     @param is_multipath - Set to 1 if these paths will be added/removed
153                           to/from the existing set, or 0 to replace
154                           the existing set.
155                           is_add=0 & is_multipath=0 implies delete all paths
156     @param is_add - Are the paths being added or removed
157 */
158 define ip_route_add_del
159 {
160   u32 client_index;
161   u32 context;
162   bool is_add [default=true];
163   bool is_multipath;
164   vl_api_ip_route_t route;
165 };
166 define ip_route_add_del_reply
167 {
168   u32 context;
169   i32 retval;
170   u32 stats_index;
171 };
172
173 /** \brief Dump IP routes from a table
174     @param client_index - opaque cookie to identify the sender
175     @param table - The table from which to dump routes (ony ID an AF are needed)
176 */
177 define ip_route_dump
178 {
179   u32 client_index;
180   u32 context;
181   vl_api_ip_table_t table;
182 };
183
184 /** \brief IP FIB table entry response
185     @param route The route entry in the table
186 */
187 define ip_route_details
188 {
189   u32 context;
190   vl_api_ip_route_t route;
191 };
192
193 /** \brief Lookup IP route from a table
194     @param client_index - opaque cookie to identify the sender
195     @param table_id - The IP table to look the route up in
196     @param exact - 0 for normal route lookup, 1 for exact match only
197     @param prefix - The prefix (or host) for route lookup.
198 */
199 define ip_route_lookup
200 {
201   u32 client_index;
202   u32 context;
203   u32 table_id;
204   u8 exact;
205   vl_api_prefix_t prefix;
206 };
207
208 /** \brief IP FIB table lookup response
209     @param retval - return code of the lookup
210     @param route - The route entry in the table if found
211 */
212 define ip_route_lookup_reply
213 {
214   u32 context;
215   i32 retval;
216   vl_api_ip_route_t route;
217 };
218
219 /** \brief Set the ip flow hash config for a fib request
220     @param client_index - opaque cookie to identify the sender
221     @param context - sender context, to match reply w/ request
222     @param vrf_id - vrf/fib id
223     @param is_ipv6 - if non-zero the fib is ip6, else ip4
224     @param src - if non-zero include src in flow hash
225     @param dst - if non-zero include dst in flow hash
226     @param sport - if non-zero include sport in flow hash
227     @param dport - if non-zero include dport in flow hash
228     @param proto -if non-zero include proto in flow hash
229     @param reverse - if non-zero include reverse in flow hash
230     @param symmetric - if non-zero include symmetry in flow hash
231 */
232 autoreply define set_ip_flow_hash
233 {
234   option deprecated;
235   u32 client_index;
236   u32 context;
237   u32 vrf_id;
238   bool is_ipv6;
239   bool src;
240   bool dst;
241   bool sport;
242   bool dport;
243   bool proto;
244   bool reverse;
245   bool symmetric;
246 };
247
248 /**
249     @brief flow hash settings for an IP table
250     @param src - include src in flow hash
251     @param dst - include dst in flow hash
252     @param sport - include sport in flow hash
253     @param dport - include dport in flow hash
254     @param proto - include proto in flow hash
255     @param reverse - include reverse in flow hash
256     @param symmetric - include symmetry in flow hash
257     @param flowlabel - include flowlabel in flow hash
258 */
259 enumflag ip_flow_hash_config
260 {
261   IP_API_FLOW_HASH_SRC_IP = 0x01,
262   IP_API_FLOW_HASH_DST_IP = 0x02,
263   IP_API_FLOW_HASH_SRC_PORT = 0x04,
264   IP_API_FLOW_HASH_DST_PORT = 0x08,
265   IP_API_FLOW_HASH_PROTO = 0x10,
266   IP_API_FLOW_HASH_REVERSE = 0x20,
267   IP_API_FLOW_HASH_SYMETRIC = 0x40,
268   IP_API_FLOW_HASH_FLOW_LABEL = 0x80,
269 };
270
271 autoreply define set_ip_flow_hash_v2
272 {
273   u32 client_index;
274   u32 context;
275   u32 table_id;
276   vl_api_address_family_t af;
277   vl_api_ip_flow_hash_config_t flow_hash_config;
278 };
279
280 /** \brief IPv6 interface enable / disable request
281     @param client_index - opaque cookie to identify the sender
282     @param context - sender context, to match reply w/ request
283     @param sw_if_index - interface used to reach neighbor
284     @param enable - if non-zero enable ip6 on interface, else disable
285 */
286 autoreply define sw_interface_ip6_enable_disable
287 {
288   u32 client_index;
289   u32 context;
290   vl_api_interface_index_t sw_if_index;
291   bool enable;                  /* set to true if enable */
292 };
293
294 /** \brief Dump IP multicast fib table
295     @param client_index - opaque cookie to identify the sender
296 */
297 define ip_mtable_dump
298 {
299   u32 client_index;
300   u32 context;
301 };
302 define ip_mtable_details
303 {
304   u32 client_index;
305   u32 context;
306   vl_api_ip_table_t table;
307 };
308
309 /** \brief Add / del route request
310
311     Adds a route, consisting both of the MFIB entry to match packets
312     (which may already exist) and a path to send those packets down.
313     Routes can be entered repeatedly to add multiple paths.  Deletions are
314     per-path.
315
316     @param client_index - opaque cookie to identify the sender
317     @param context - sender context, to match reply w/ request
318     @param table_id - fib table /vrf associated with the route
319     @param is_add - true if adding a route; false if deleting one
320     @param is_ipv6 - true iff all the addresses are v6
321     @param entry_flags - see fib_entry_flag_t
322     @param itf_flags - see mfib_entry_flags_t
323     @param next_hop_afi - see dpo_proto_t; the type of destination description
324     @param src_address - the source of the packet
325     @param grp_address - the group the packet is destined to
326     @param nh_address - the nexthop to forward the packet to
327     @param next_hop_sw_if_index - interface to emit packet on
328
329     BIER AFIs use the BIER imposition ID.  v4 and v6 AFIs use either the
330     interface or the nexthop address.
331
332     Note that if the route is source-specific (S is supplied, not all 0s),
333     the prefix match is treated as exact (prefixlen /32 or /128).
334
335     FIXME not complete yet
336 */
337 typedef ip_mroute
338 {
339   u32 table_id;
340   vl_api_mfib_entry_flags_t entry_flags;
341   u32 rpf_id;
342   vl_api_mprefix_t prefix;
343   u8 n_paths;
344   vl_api_mfib_path_t paths[n_paths];
345 };
346
347 define ip_mroute_add_del
348 {
349   u32 client_index;
350   u32 context;
351   bool is_add [default=true];
352   bool is_multipath;
353   vl_api_ip_mroute_t route;
354 };
355 define ip_mroute_add_del_reply
356 {
357   u32 context;
358   i32 retval;
359   u32 stats_index;
360 };
361
362 /** \brief Dump IP multicast fib table
363     @param table - The table from which to dump routes (ony ID an AF are needed)
364 */
365 define ip_mroute_dump
366 {
367   u32 client_index;
368   u32 context;
369   vl_api_ip_table_t table;
370 };
371
372 /** \brief IP Multicast Route Details
373     @param route - Details of the route
374 */
375 define ip_mroute_details
376 {
377   u32 context;
378   vl_api_ip_mroute_t route;
379 };
380
381 define ip_address_details
382 {
383   u32 context;
384   vl_api_interface_index_t sw_if_index;
385   vl_api_address_with_prefix_t prefix;
386 };
387
388 define ip_address_dump
389 {
390   u32 client_index;
391   u32 context;
392   vl_api_interface_index_t sw_if_index;
393   bool is_ipv6;
394 };
395
396 /** \brief IP unnumbered configurations
397     @param sw_if_index The interface that has unnumbered configuration
398     @param ip_sw_if_index The IP interface that it is unnumbered to
399 */
400 define ip_unnumbered_details
401 {
402   u32 context;
403   vl_api_interface_index_t sw_if_index;
404   vl_api_interface_index_t ip_sw_if_index;
405 };
406
407 /** \brief Dump IP unnumbered configurations
408     @param sw_if_index ~0 for all interfaces, else the interface desired
409 */
410 define ip_unnumbered_dump
411 {
412   u32 client_index;
413   u32 context;
414   vl_api_interface_index_t sw_if_index [default=0xffffffff];
415 };
416
417 define ip_details
418 {
419   u32 context;
420   vl_api_interface_index_t sw_if_index;
421   bool is_ipv6;
422 };
423
424 define ip_dump
425 {
426   u32 client_index;
427   u32 context;
428   bool is_ipv6;
429 };
430
431 define mfib_signal_dump
432 {
433   u32 client_index;
434   u32 context;
435 };
436
437 define mfib_signal_details
438 {
439   u32 context;
440   vl_api_interface_index_t sw_if_index;
441   u32 table_id;
442   vl_api_mprefix_t prefix;
443   u16 ip_packet_len;
444   u8 ip_packet_data[256];
445 };
446
447 /** \brief IP punt policer
448     @param client_index - opaque cookie to identify the sender
449     @param context - sender context, to match reply w/ request
450     @param is_add - 1 to add neighbor, 0 to delete
451     @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4
452     @param policer_index - Index of policer to use
453 */
454 autoreply define ip_punt_police
455 {
456   u32 client_index;
457   u32 context;
458   u32 policer_index;
459   bool is_add [default=true];
460   bool is_ip6;
461 };
462
463 /** \brief Punt redirect type
464     @param rx_sw_if_index - specify the original RX interface of traffic
465                             that should be redirected. ~0 means any interface.
466     @param tx_sw_if_index - the TX interface to which traffic should be
467                             redirected.
468     @param nh - the next-hop to redirect the traffic to.
469     @param is_ipv6 - 1 for IPv6 neighbor, 0 for IPv4
470 */
471 typedef punt_redirect
472 {
473   vl_api_interface_index_t rx_sw_if_index;
474   vl_api_interface_index_t tx_sw_if_index;
475   vl_api_address_t nh;
476 };
477
478 /** \brief IP punt redirect
479     @param client_index - opaque cookie to identify the sender
480     @param context - sender context, to match reply w/ request
481     @param punt - punt definition
482     @param is_add - 1 to add neighbor, 0 to delete
483 */
484 autoreply define ip_punt_redirect
485 {
486   u32 client_index;
487   u32 context;
488   vl_api_punt_redirect_t punt;
489   bool is_add [default=true];
490 };
491
492 define ip_punt_redirect_dump
493 {
494   u32 client_index;
495   u32 context;
496   vl_api_interface_index_t sw_if_index;
497   bool is_ipv6;
498 };
499
500 define ip_punt_redirect_details
501 {
502   u32 context;
503   vl_api_punt_redirect_t punt;
504 };
505
506 autoreply define ip_container_proxy_add_del
507 {
508   u32 client_index;
509   u32 context;
510   vl_api_prefix_t pfx;
511   vl_api_interface_index_t sw_if_index;
512   bool is_add [default=true];
513 };
514
515 define ip_container_proxy_dump
516 {
517   u32 client_index;
518   u32 context;
519 };
520
521 define ip_container_proxy_details
522 {
523   u32 context;
524   vl_api_interface_index_t sw_if_index;
525   vl_api_prefix_t prefix;
526 };
527
528 /** \brief Configure IP source and L4 port-range check
529     @param client_index - opaque cookie to identify the sender
530     @param context - sender context, to match reply w/ request
531     @param is_ip6 - 1 if source address type is IPv6
532     @param is_add - 1 if add, 0 if delete
533     @param ip - prefix to match
534     @param number_of_ranges - length of low_port and high_port arrays (must match)
535     @param low_ports[32] - up to 32 low end of port range entries (must have corresponding high_ports entry)
536     @param high_ports[32] - up to 32 high end of port range entries (must have corresponding low_ports entry)
537     @param vrf_id - fib table/vrf id to associate the source and port-range check with
538     @note To specify a single port set low_port and high_port entry the same
539 */
540 autoreply define ip_source_and_port_range_check_add_del
541 {
542   u32 client_index;
543   u32 context;
544   bool is_add [default=true];
545   vl_api_prefix_t prefix;
546   u8 number_of_ranges;
547   u16 low_ports[32];
548   u16 high_ports[32];
549   u32 vrf_id;
550 };
551
552 /** \brief Set interface source and L4 port-range request
553     @param client_index - opaque cookie to identify the sender
554     @param context - sender context, to match reply w/ request
555     @param interface_id - interface index
556     @param tcp_vrf_id - VRF associated with source and TCP port-range check
557     @param udp_vrf_id - VRF associated with source and TCP port-range check
558 */
559 autoreply define ip_source_and_port_range_check_interface_add_del
560 {
561   u32 client_index;
562   u32 context;
563   bool is_add [default=true];
564   vl_api_interface_index_t sw_if_index;
565   u32 tcp_in_vrf_id;
566   u32 tcp_out_vrf_id;
567   u32 udp_in_vrf_id;
568   u32 udp_out_vrf_id;
569 };
570
571 /** \brief IPv6 set link local address on interface request
572     @param client_index - opaque cookie to identify the sender
573     @param context - sender context, to match reply w/ request
574     @param sw_if_index - interface to set link local on
575     @param ip - the new link local address
576 */
577 autoreply define sw_interface_ip6_set_link_local_address
578 {
579   u32 client_index;
580   u32 context;
581   vl_api_interface_index_t sw_if_index;
582   vl_api_ip6_address_t ip;
583 };
584
585 /** \brief IPv6 get link local address on interface request
586     @param client_index - opaque cookie to identify the sender
587     @param context - sender context, to match reply w/ request
588     @param sw_if_index - interface to set link local on
589 */
590 define sw_interface_ip6_get_link_local_address
591 {
592   u32 client_index;
593   u32 context;
594   vl_api_interface_index_t sw_if_index;
595 };
596
597 /** \brief IPv6 link local address detail
598     @param context - sender context, to match reply w/ request
599     @param ip - the link local address
600 */
601 define sw_interface_ip6_get_link_local_address_reply
602 {
603   u32 context;
604   i32 retval;
605   vl_api_ip6_address_t ip;
606 };
607
608 /** \brief IOAM enable : Enable in-band OAM
609     @param id - profile id
610     @param seqno - To enable Seqno Processing
611     @param analyse - Enabling analysis of iOAM at decap node
612     @param pow_enable - Proof of Work enabled or not flag
613     @param trace_enable - iOAM Trace enabled or not flag
614 */
615 autoreply define ioam_enable
616 {
617   u32 client_index;
618   u32 context;
619   u16 id;
620   bool seqno;
621   bool analyse;
622   bool pot_enable;
623   bool trace_enable;
624   u32 node_id;
625 };
626
627 /** \brief iOAM disable
628     @param client_index - opaque cookie to identify the sender
629     @param context - sender context, to match reply w/ request
630     @param index - MAP Domain index
631 */
632 autoreply define ioam_disable
633 {
634   u32 client_index;
635   u32 context;
636   u16 id;
637 };
638
639 enum ip_reass_type
640 {
641   IP_REASS_TYPE_FULL = 0,
642   IP_REASS_TYPE_SHALLOW_VIRTUAL = 0x1,
643 };
644
645 autoreply define ip_reassembly_set
646 {
647   u32 client_index;
648   u32 context;
649   u32 timeout_ms;
650   u32 max_reassemblies;
651   u32 max_reassembly_length;
652   u32 expire_walk_interval_ms;
653   bool is_ip6;
654   vl_api_ip_reass_type_t type;
655 };
656
657 define ip_reassembly_get
658 {
659   u32 client_index;
660   u32 context;
661   bool is_ip6;
662   vl_api_ip_reass_type_t type;
663 };
664
665 define ip_reassembly_get_reply
666 {
667   u32 context;
668   i32 retval;
669   u32 timeout_ms;
670   u32 max_reassemblies;
671   u32 max_reassembly_length;
672   u32 expire_walk_interval_ms;
673   bool is_ip6;
674 };
675
676 /** \brief Enable/disable reassembly feature
677     @param client_index - opaque cookie to identify the sender
678     @param context - sender context, to match reply w/ request
679     @param sw_if_index - interface to enable/disable feature on
680     @param enable_ip4 - enable ip4 reassembly if non-zero, disable if 0
681     @param enable_ip6 - enable ip6 reassembly if non-zero, disable if 0
682 */
683 autoreply define ip_reassembly_enable_disable
684 {
685   u32 client_index;
686   u32 context;
687   vl_api_interface_index_t sw_if_index;
688   bool enable_ip4;
689   bool enable_ip6;
690   vl_api_ip_reass_type_t type;
691 };
692
693 /*
694  * Local Variables:
695  * eval: (c-set-style "gnu")
696  * End:
697  */