1 /* Hey Emacs use -*- mode: C -*- */
3 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Copyright (c) 2022 Nordix Foundation.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 option version = "3.2.0";
20 import "vnet/ip/ip_types.api";
21 import "vnet/ethernet/ethernet_types.api";
22 import "vnet/interface_types.api";
24 /** \brief Reply to l2_xconnect_dump
25 @param context - sender context which was passed in the request
26 @param rx_sw_if_index - Receive interface index
27 @param tx_sw_if_index - Transmit interface index
29 define l2_xconnect_details
32 vl_api_interface_index_t rx_sw_if_index;
33 vl_api_interface_index_t tx_sw_if_index;
36 /** \brief Dump L2 XConnects
37 @param client_index - opaque cookie to identify the sender
38 @param context - sender context, to match reply w/ request
40 define l2_xconnect_dump
46 /** \brief l2 fib table details structure
47 @param bd_id - the l2 fib / bridge domain table id
48 @param mac - the entry's mac address
49 @param sw_if_index - index of the interface
50 @param static_mac - the entry is statically configured.
51 @param filter_mac - the entry is a mac filter entry.
52 @param bvi_mac - the mac address is a bridge virtual interface
54 define l2_fib_table_details
58 vl_api_mac_address_t mac;
59 vl_api_interface_index_t sw_if_index;
65 /** \brief Dump l2 fib (aka bridge domain) table
66 @param client_index - opaque cookie to identify the sender
67 @param bd_id - the l2 fib / bridge domain table identifier
69 define l2_fib_table_dump
76 /** \brief L2 fib clear table request, clear all mac entries in the l2 fib
77 @param client_index - opaque cookie to identify the sender
78 @param context - sender context, to match reply w/ request
80 autoreply define l2_fib_clear_table
86 /** \brief L2 FIB flush all entries
87 @param client_index - opaque cookie to identify the sender
88 @param context - sender context, to match reply w/ request
90 autoreply define l2fib_flush_all
96 /** \brief L2 FIB flush bridge domain entries
97 @param client_index - opaque cookie to identify the sender
98 @param context - sender context, to match reply w/ request
99 @param bd_id - the entry's bridge domain id
101 autoreply define l2fib_flush_bd
108 /** \brief L2 FIB flush interface entries
109 @param client_index - opaque cookie to identify the sender
110 @param context - sender context, to match reply w/ request
111 @param bd_id - the entry's bridge domain id
113 autoreply define l2fib_flush_int
117 vl_api_interface_index_t sw_if_index;
120 /** \brief L2 FIB add entry request
121 @param client_index - opaque cookie to identify the sender
122 @param context - sender context, to match reply w/ request
123 @param mac - the entry's mac address
124 @param bd_id - the entry's bridge domain id
125 @param sw_if_index - the interface
126 @param is_add - If non zero add the entry, else delete it
131 autoreply define l2fib_add_del
135 vl_api_mac_address_t mac;
137 vl_api_interface_index_t sw_if_index;
138 bool is_add [default=true];
144 /** \brief Register to receive L2 MAC events for learned and aged MAC
145 @param client_index - opaque cookie to identify the sender
146 @param context - sender context, to match reply w/ request
147 @param learn_limit - MAC learn limit
148 @param scan_delay - event scan delay in 10 msec unit
149 @param max_macs_in_event - in units of 10 mac entries
150 @param enable_disable - 1 => register for MAC events, 0 => cancel registration
151 @param pid - sender's pid
153 autoreply define want_l2_macs_events
158 u32 learn_limit [default=1000];
159 u8 scan_delay [default=10];
160 u8 max_macs_in_event [default=10];
161 bool enable_disable [default=true];
165 /** \brief Register to receive L2 MAC events for learned and aged MAC
166 @param client_index - opaque cookie to identify the sender
167 @param context - sender context, to match reply w/ request
168 @param max_macs_in_event - in units of 10 mac entries
169 @param enable_disable - 1 => register for MAC events, 0 => cancel registration
170 @param pid - sender's pid
172 autoreply define want_l2_macs_events2
176 u8 max_macs_in_event [default=10];
177 bool enable_disable [default=true];
181 /** \brief set l2 table scan delay
182 @param client_index - opaque cookie to identify the sender
183 @param context - sender context, to match reply w/ request
184 @param scan_delay - event scan delay in 10 msec unit
186 autoreply define l2fib_set_scan_delay
190 u16 scan_delay [default=10];
194 enum mac_event_action
196 MAC_EVENT_ACTION_API_ADD = 0,
197 MAC_EVENT_ACTION_API_DELETE = 1,
198 MAC_EVENT_ACTION_API_MOVE = 2,
201 /** \brief Entry for learned or aged MAC in L2 MAC Events
202 @param sw_if_index - sw_if_index in the domain
203 @param mac_addr - mac_address
204 @param action - 0 => newly learned MAC, 1 => MAC deleted by ager
205 2 => MAC move (sw_if_index changed)
206 @param flags - flag bits to provide other info, not yet used
210 vl_api_interface_index_t sw_if_index;
211 vl_api_mac_address_t mac_addr;
212 vl_api_mac_event_action_t action;
216 /** \brief L2 MAC event for a list of learned or aged MACs
217 @param client_index - opaque cookie to identify the sender
218 @param pid - client pid registered to receive notification
219 @param n_macs - number of learned/aged MAC entries
220 @param mac - array of learned/aged MAC entries
227 vl_api_mac_entry_t mac[n_macs];
231 rpc want_l2_macs_events returns want_l2_macs_events_reply
232 events l2_macs_event;
235 /** \brief Set interface L2 flags (such as L2_LEARN, L2_FWD,
236 L2_FLOOD, L2_UU_FLOOD, or L2_ARP_TERM bits). This can be used
237 to disable one or more of the features represented by the
238 flag bits on an interface to override what is set as default
239 for all interfaces in the bridge domain
240 @param client_index - opaque cookie to identify the sender
241 @param context - sender context, to match reply w/ request
242 @param sw_if_index - interface
243 @param is_set - if non-zero, set the bits, else clear them
244 @param feature_bitmap - non-zero bits (as above) to set or clear
250 vl_api_interface_index_t sw_if_index;
255 /** \brief Set interface L2 flags response
256 @param context - sender context, to match reply w/ request
257 @param retval - return code for the set l2 bits request
258 @param resulting_feature_bitmap - the internal l2 feature bitmap after the request is implemented
260 define l2_flags_reply
264 u32 resulting_feature_bitmap;
267 /** \brief L2 bridge domain set mac age
268 @param client_index - opaque cookie to identify the sender
269 @param context - sender context, to match reply w/ request
270 @param bd_id - the bridge domain to create
271 @param mac_age - mac aging time in min, 0 for disabled
273 autoreply define bridge_domain_set_mac_age
281 /** \brief L2 bridge domain set default learn limit
282 @param client_index - opaque cookie to identify the sender
283 @param context - sender context, to match reply w/ request
284 @param learn limit - maximum number of entries by default for bridge domains
286 autoreply define bridge_domain_set_default_learn_limit
294 /** \brief L2 bridge domain set learn limit
295 @param client_index - opaque cookie to identify the sender
296 @param context - sender context, to match reply w/ request
297 @param bd_id - the bridge domain idenntifier
298 @param learn limit - maximum number of entries for this bd
300 autoreply define bridge_domain_set_learn_limit
308 /** \brief L2 bridge domain add or delete request - will be deprecated
309 @param client_index - opaque cookie to identify the sender
310 @param context - sender context, to match reply w/ request
311 @param bd_id - the bridge domain to create
312 @param flood - enable/disable bcast/mcast flooding in the bd
313 @param uu_flood - enable/disable unknown unicast flood in the bd
314 @param forward - enable/disable forwarding on all interfaces in the bd
315 @param learn - enable/disable learning on all interfaces in the bd
316 @param arp_term - enable/disable arp termination in the bd
317 @param arp_ufwd - enable/disable arp unicast forwarding in the bd
318 @param mac_age - mac aging time in min, 0 for disabled
319 @param is_add - add or delete flag
321 autoreply define bridge_domain_add_del
335 bool is_add [default=true];
338 /** \brief L2 bridge domain add delete request version 2
339 @param client_index - opaque cookie to identify the sender
340 @param context - sender context, to match reply w/ request
341 @param bd_id - if the id == ~0 creates a bridge domain with an unused id
342 if the id != ~0 the id of the bridge domain to create/delete
343 @param flood - enable/disable bcast/mcast flooding in the bd
344 @param uu_flood - enable/disable unknown unicast flood in the bd
345 @param forward - enable/disable forwarding on all interfaces in the bd
346 @param learn - enable/disable learning on all interfaces in the bd
347 @param arp_term - enable/disable arp termination in the bd
348 @param arp_ufwd - enable/disable arp unicast forwarding in the bd
349 @param mac_age - mac aging time in min, 0 for disabled
350 @param is_add - add or delete flag
352 define bridge_domain_add_del_v2
365 bool is_add [default=true];
368 /** \brief L2 bridge domain add delete version 2 response
369 @param context - sender context, to match reply w/ request
370 @param retval - return code for the set bridge flags request
371 @param resulting_id - the id for the new bridge domain
373 define bridge_domain_add_del_v2_reply
381 /** \brief L2 bridge domain request operational state details
382 @param client_index - opaque cookie to identify the sender
383 @param context - sender context, to match reply w/ request
384 @param bd_id - the bridge domain id desired or ~0 to request all bds
385 @param sw_if_index - filter by sw_if_index UNIMPLEMENTED
387 define bridge_domain_dump
391 u32 bd_id [default=0xffffffff];
392 vl_api_interface_index_t sw_if_index [default=0xffffffff];
395 /** \brief L2 bridge domain sw interface operational state response
396 @param bd_id - the bridge domain id
397 @param sw_if_index - sw_if_index in the domain
398 @param shg - split horizon group for the interface
400 typedef bridge_domain_sw_if
403 vl_api_interface_index_t sw_if_index;
404 /* FIXME: set_int_l2_mode() u32/ api u8 */
408 /** \brief L2 bridge domain operational state response
409 @param bd_id - the bridge domain id
410 @param flood - bcast/mcast flooding state on all interfaces in the bd
411 @param uu_flood - unknown unicast flooding state on all interfaces in the bd
412 @param forward - forwarding state on all interfaces in the bd
413 @param learn - learning state on all interfaces in the bd
414 @param arp_term - arp termination state on all interfaces in the bd
415 @param arp_ufwd - arp unicast forwarding state on all interfaces in the bd
416 @param mac_age - mac aging time in min, 0 for disabled
417 @param bd_tag - optional textual tag for the bridge domain
418 @param n_sw_ifs - number of sw_if_index's in the domain
420 define bridge_domain_details
432 vl_api_interface_index_t bvi_sw_if_index;
433 vl_api_interface_index_t uu_fwd_sw_if_index;
435 vl_api_bridge_domain_sw_if_t sw_if_details[n_sw_ifs];
438 /** \brief Flags that can be changed on a bridge domain */
441 BRIDGE_API_FLAG_NONE = 0x0,
442 BRIDGE_API_FLAG_LEARN = 0x1,
443 BRIDGE_API_FLAG_FWD = 0x2,
444 BRIDGE_API_FLAG_FLOOD = 0x4,
445 BRIDGE_API_FLAG_UU_FLOOD = 0x8,
446 BRIDGE_API_FLAG_ARP_TERM = 0x10,
447 BRIDGE_API_FLAG_ARP_UFWD = 0x20,
450 /** \brief Set bridge flags request
451 @param client_index - opaque cookie to identify the sender
452 @param context - sender context, to match reply w/ request
453 @param bd_id - the bridge domain to set the flags for
454 @param is_set - if non-zero, set the flags, else clear them
455 @param flags - flags that are non-zero to set or clear
463 vl_api_bd_flags_t flags;
466 /** \brief Set bridge flags response
467 @param context - sender context, to match reply w/ request
468 @param retval - return code for the set bridge flags request
469 @param resulting_feature_bitmap - the internal L2 feature bitmap after the request is implemented
471 define bridge_flags_reply
475 u32 resulting_feature_bitmap;
478 /** \brief L2 interface vlan tag rewrite configure request
479 @param client_index - opaque cookie to identify the sender
480 @param context - sender context, to match reply w/ request
481 @param sw_if_index - interface the operation is applied to
482 @param vtr_op - Choose from l2_vtr_op_t enum values
483 @param push_dot1q - first pushed flag dot1q id set, else dot1ad
484 @param tag1 - Needed for any push or translate vtr op
485 @param tag2 - Needed for any push 2 or translate x-2 vtr ops
487 autoreply define l2_interface_vlan_tag_rewrite
491 vl_api_interface_index_t sw_if_index;
493 u32 push_dot1q; // ethertype of first pushed tag is dot1q/dot1ad
494 u32 tag1; // first pushed tag
495 u32 tag2; // second pushed tag
498 /** \brief L2 interface pbb tag rewrite configure request
499 @param client_index - opaque cookie to identify the sender
500 @param context - sender context, to match reply w/ request
501 @param sw_if_index - interface the operation is applied to
502 @param vtr_op - Choose from l2_vtr_op_t enum values
503 @param inner_tag - needed for translate_qinq vtr op only
504 @param outer_tag - needed for translate_qinq vtr op only
505 @param b_dmac - B-tag remote mac address, needed for any push or translate_qinq vtr op
506 @param b_smac - B-tag local mac address, needed for any push or translate qinq vtr op
507 @param b_vlanid - B-tag vlanid, needed for any push or translate qinq vtr op
508 @param i_sid - I-tag service id, needed for any push or translate qinq vtr op
510 autoreply define l2_interface_pbb_tag_rewrite
514 vl_api_interface_index_t sw_if_index;
517 vl_api_mac_address_t b_dmac;
518 vl_api_mac_address_t b_smac;
523 /** \brief L2 interface patch add / del request
524 @param client_index - opaque cookie to identify the sender
525 @param context - sender context, to match reply w/ request
526 @param rx_sw_if_index - receive side interface
527 @param tx_sw_if_index - transmit side interface
528 @param is_add - if non-zero set up the interface patch, else remove it
530 autoreply define l2_patch_add_del
534 vl_api_interface_index_t rx_sw_if_index;
535 vl_api_interface_index_t tx_sw_if_index;
536 bool is_add [default=true];
539 /** \brief Set L2 XConnect between two interfaces request
540 @param client_index - opaque cookie to identify the sender
541 @param context - sender context, to match reply w/ request
542 @param rx_sw_if_index - Receive interface index
543 @param tx_sw_if_index - Transmit interface index
544 @param enable - enable xconnect if not 0, else set to L3 mode
546 autoreply define sw_interface_set_l2_xconnect
550 vl_api_interface_index_t rx_sw_if_index;
551 vl_api_interface_index_t tx_sw_if_index;
552 bool enable [default=true];
556 * @brief An enumeration of the type of ports that can be added
561 /* a 'normal' interface, i.e. not BVI or UU-Flood */
562 L2_API_PORT_TYPE_NORMAL = 0,
563 /* a BVI interface in the BD */
564 L2_API_PORT_TYPE_BVI = 1,
565 /* The interface on which to forward unknown unicast packets
566 * If this is not set for a BD then UU is flooded */
567 L2_API_PORT_TYPE_UU_FWD = 2,
570 /** \brief Interface bridge mode request
571 @param client_index - opaque cookie to identify the sender
572 @param context - sender context, to match reply w/ request
573 @param rx_sw_if_index - the interface
574 @param bd_id - bridge domain id
575 @param port_type - port_mode, see #l2_port_type
576 @param shg - Split horizon group, for bridge mode only
577 @param enable - Enable beige mode if not 0, else set to L3 mode
580 autoreply define sw_interface_set_l2_bridge
584 vl_api_interface_index_t rx_sw_if_index;
586 vl_api_l2_port_type_t port_type;
588 bool enable [default=true];
591 /** \brief Set bridge domain ip to mac entry request
592 @param client_index - opaque cookie to identify the sender
593 @param context - sender context, to match reply w/ request
594 @param bd_id - the bridge domain to set the flags for
595 @param is_add - if non-zero, add the entry, else clear it
596 @param ip - ipv4 or ipv6 address
597 @param mac - MAC address
604 vl_api_mac_address_t mac;
607 autoreply define bd_ip_mac_add_del
611 bool is_add [default=true];
612 vl_api_bd_ip_mac_t entry;
615 /** \brief Flush bridge domain IP to MAC entries
616 @param client_index - opaque cookie to identify the sender
617 @param bd_id - bridge domain identifier
619 autoreply define bd_ip_mac_flush
626 /** \brief bridge domain IP to MAC entry details structure
627 @param bd_id - bridge domain table id
628 @param is_ipv6 - if non-zero, ipv6 address, else ipv4 address
629 @param ip_address - ipv4 or ipv6 address
630 @param mac_address - MAC address
632 define bd_ip_mac_details
635 vl_api_bd_ip_mac_t entry;
638 /** \brief Dump bridge domain IP to MAC entries
639 @param client_index - opaque cookie to identify the sender
640 @param bd_id - bridge domain identifier
642 define bd_ip_mac_dump
649 /** \brief L2 interface ethernet flow point filtering enable/disable request
650 @param client_index - opaque cookie to identify the sender
651 @param context - sender context, to match reply w/ request
652 @param sw_if_index - interface to enable/disable filtering on
653 @param enable_disable - if non-zero enable filtering, else disable
655 autoreply define l2_interface_efp_filter
659 vl_api_interface_index_t sw_if_index;
660 bool enable_disable [default=true];
663 /** \brief Interface set vpath request
664 @param client_index - opaque cookie to identify the sender
665 @param context - sender context, to match reply w/ request
666 @param sw_if_index - interface used to reach neighbor
667 @param enable - if non-zero enable, else disable
669 autoreply define sw_interface_set_vpath
673 vl_api_interface_index_t sw_if_index;
674 bool enable [default=0xffffffff];
677 /** \brief Create BVI interface instance request
678 @param client_index - opaque cookie to identify the sender
679 @param context - sender context, to match reply w/ request
680 @param mac_address - mac addr to assign to the interface if none-zero
681 @param user_instance - requested instance, ~0 => dynamically allocate
687 vl_api_mac_address_t mac;
688 u32 user_instance [default=0xffffffff];
691 /** \brief Create BVI interface instance response
692 @param context - sender context, to match reply w/ request
693 @param sw_if_index - sw index of the interface that was created
694 @param retval - return code for the request
696 define bvi_create_reply
700 vl_api_interface_index_t sw_if_index;
703 /** \brief Delete BVI interface request
704 @param client_index - opaque cookie to identify the sender
705 @param context - sender context, to match reply w/ request
706 @param sw_if_index - sw index of the interface that was created
708 autoreply define bvi_delete
712 vl_api_interface_index_t sw_if_index;
715 /** \brief Register for IP4 ARP resolution event on receiving ARP reply or
716 MAC/IP info from ARP requests in L2 BDs
717 @param client_index - opaque cookie to identify the sender
718 @param context - sender context, to match reply w/ request
719 @param enable - 1 => register for events, 0 => cancel registration
720 @param pid - sender's pid
722 autoreply define want_l2_arp_term_events
730 /** \brief Tell client about an IP4 ARP resolution event or
731 MAC/IP info from ARP requests in L2 BDs
732 @param client_index - opaque cookie to identify the sender
733 @param pid - client pid registered to receive notification
734 @param ip - IP address of new ARP term entry
735 @param sw_if_index - interface of new ARP term entry
736 @param mac - MAC address of new ARP term entry
738 define l2_arp_term_event
743 vl_api_interface_index_t sw_if_index;
744 vl_api_mac_address_t mac;
748 rpc want_l2_arp_term_events returns want_l2_arp_term_events_reply
749 events l2_arp_term_event;
754 * eval: (c-set-style "gnu")