2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 option version = "5.2.0";
17 import "vnet/ip/ip_types.api";
18 import "vnet/interface_types.api";
22 * @brief VPP control-plane API messages.
24 * This file defines VPP control-plane API messages which are generally
25 * called through a shared memory interface.
29 * Common NAT plugin APIs
32 enum nat_config_flags : u8
35 NAT_IS_TWICE_NAT = 0x01,
36 NAT_IS_SELF_TWICE_NAT = 0x02,
37 NAT_IS_OUT2IN_ONLY = 0x04,
38 NAT_IS_ADDR_ONLY = 0x08,
39 NAT_IS_OUTSIDE = 0x10,
42 NAT_IS_EXT_HOST_VALID = 0x80,
45 /** \brief Control ping from client to api server request
46 @param client_index - opaque cookie to identify the sender
47 @param context - sender context, to match reply w/ request
49 define nat_control_ping
55 /** \brief Control ping from the client to the server response
56 @param client_index - opaque cookie to identify the sender
57 @param context - sender context, to match reply w/ request
58 @param retval - return code for the request
59 @param vpe_pid - the pid of the vpe, returned by the server
61 define nat_control_ping_reply
69 /** \brief Show NAT plugin startup config
70 @param client_index - opaque cookie to identify the sender
71 @param context - sender context, to match reply w/ request
73 define nat_show_config
79 /** \brief Show NAT plugin startup config reply
80 @param context - sender context, to match reply w/ request
81 @param retval - return code for the request
82 @param static_mapping_only - if true dynamic translations disabled
83 @param static_mapping_connection_tracking - if true create session data
84 @param deterministic - if true deterministic mapping
85 @param endpoint_dependent - if true endpoint-dependent mode
86 @param out2in_dpo - if true out2in dpo mode
87 @param dslite_ce - if true DS-Lite is CE/B4 element, if false AFTR elemet
88 @param translation_buckets - number of translation hash buckets
89 @param translation_memory_size - translation hash memory size
90 @param user_buckets - number of user hash buckets
91 @param user_memory_size - user hash memory size
92 @param max_translations_per_user - maximum number of translations per user
93 @param outside_vrf_id - outside VRF id
94 @param inside_vrf_id - default inside VRF id
95 @param nat64_bib_buckets - number of NAT64 BIB hash buckets
96 @param nat64_bib_memory_size - memory size of NAT64 BIB hash
97 @param nat64_st_buckets - number of NAT64 session table hash buckets
98 @param nat64_st_memory_size - memory size of NAT64 session table hash
100 define nat_show_config_reply
104 bool static_mapping_only;
105 bool static_mapping_connection_tracking;
107 bool endpoint_dependent;
110 u32 translation_buckets;
111 u32 translation_memory_size;
113 u32 user_memory_size;
114 u32 max_translations_per_user;
117 u32 nat64_bib_buckets;
118 u32 nat64_bib_memory_size;
119 u32 nat64_st_buckets;
120 u32 nat64_st_memory_size;
123 enum nat_log_level : u8
126 NAT_LOG_ERROR = 0x01,
127 NAT_LOG_WARNING = 0x02,
128 NAT_LOG_NOTICE = 0x03,
130 NAT_LOG_DEBUG = 0x05,
133 /** \brief Run nat44 garbage collection
134 @param client_index - opaque cookie to identify the sender
135 @param context - sender context, to match reply w/ request
137 autoreply define nat44_session_cleanup {
142 /** \brief Set NAT logging level
143 @param client_index - opaque cookie to identify the sender
144 @param context - sender context, to match reply w/ request
145 @param log_level - logging level
147 autoreply define nat_set_log_level {
150 vl_api_nat_log_level_t log_level;
153 /** \brief Set NAT workers
154 @param client_index - opaque cookie to identify the sender
155 @param context - sender context, to match reply w/ request
156 @param worker_mask - NAT workers mask
158 autoreply define nat_set_workers {
164 /** \brief Dump NAT workers
165 @param client_index - opaque cookie to identify the sender
166 @param context - sender context, to match reply w/ request
168 define nat_worker_dump {
173 /** \brief NAT workers details response
174 @param context - sender context, to match reply w/ request
175 @param worker_index - worker index
176 @param lcore_id - lcore ID
177 @param name - worker name
179 define nat_worker_details {
186 /** \brief Enable/disable NAT IPFIX logging
187 @param client_index - opaque cookie to identify the sender
188 @param context - sender context, to match reply w/ request
189 @param domain_id - observation domain ID
190 @param src_port - source port number
191 @param enable - true if enable, false if disable
193 autoreply define nat_ipfix_enable_disable {
201 /** \brief Set values of timeouts for NAT sessions (seconds)
202 @param client_index - opaque cookie to identify the sender
203 @param context - sender context, to match reply w/ request
204 @param udp - UDP timeout (default 300sec)
205 @param tcp_established - TCP established timeout (default 7440sec)
206 @param tcp_transitory - TCP transitory timeout (default 240sec)
207 @param icmp - ICMP timeout (default 60sec)
209 autoreply define nat_set_timeouts {
218 /** \brief Get values of timeouts for NAT sessions (seconds)
219 @param client_index - opaque cookie to identify the sender
220 @param context - sender context, to match reply w/ request
222 define nat_get_timeouts {
227 /** \brief Get values of timeouts for NAT sessions reply
228 @param context - sender context, to match reply w/ request
229 @param retval - return code
230 @param udp - UDP timeout
231 @param tcp_established - TCP established timeout
232 @param tcp_transitory - TCP transitory timeout
233 @param icmp - ICMP timeout
235 define nat_get_timeouts_reply {
244 /** \brief Set address and port assignment algorithm
245 @param client_index - opaque cookie to identify the sender
246 @param context - sender context, to match reply w/ request
247 @param alg - address and port assignment algorithm:
248 0 - default, 1 - MAP-E, 2 - port range
249 (see nat_addr_and_port_alloc_alg_t in nat.h)
250 @param psid_offset - number of offset bits (valid only for MAP-E alg)
251 @param psid_length - length of PSID (valid only for MAP-E alg)
252 @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
253 @param start_port - beginning of the port range
254 @param end_port - end of the port range
256 autoreply define nat_set_addr_and_port_alloc_alg {
267 /** \brief Get address and port assignment algorithm
268 @param client_index - opaque cookie to identify the sender
269 @param context - sender context, to match reply w/ request
271 define nat_get_addr_and_port_alloc_alg {
276 /** \brief Get address and port assignment algorithm reply
277 @param context - sender context, to match reply w/ request
278 @param retval - return code
279 @param alg - address and port assignment algorithm:
280 0 - default, 1 - MAP-E, 2 - port range
281 (see nat_addr_and_port_alloc_alg_t in nat.h)
282 @param psid_offset - number of offset bits (valid only for MAP-E alg)
283 @param psid_length - length of PSID (valid only for MAP-E alg)
284 @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
285 @param start_port - beginning of the port range
286 @param end_port - end of the port range
288 define nat_get_addr_and_port_alloc_alg_reply {
299 /** \brief Set TCP MSS rewriting configuration
300 @param client_index - opaque cookie to identify the sender
301 @param context - sender context, to match reply w/ request
302 @param mss_value - MSS value to be used for MSS rewriting
303 @param enable - if true enable MSS rewriting feature else disable
305 autoreply define nat_set_mss_clamping {
312 /** \brief Get TCP MSS rewriting configuration
313 @param client_index - opaque cookie to identify the sender
314 @param context - sender context, to match reply w/ request
316 define nat_get_mss_clamping {
321 /** \brief Get TCP MSS rewriting configuration reply
322 @param context - sender context, to match reply w/ request
323 @param retval - return code
324 @param mss_value - MSS value to be used for MSS rewriting
325 @param enable - if true enable MSS rewriting feature else disable
327 define nat_get_mss_clamping_reply {
334 /** \brief Set HA listener (local settings)
335 @param client_index - opaque cookie to identify the sender
336 @param context - sender context, to match reply w/ request
337 @param ip_address - local IP4 address
338 @param port - local UDP port number
339 @param path_mtu - path MTU between local and failover
341 autoreply define nat_ha_set_listener {
344 vl_api_ip4_address_t ip_address;
349 /** \brief Set HA failover (remote settings)
350 @param client_index - opaque cookie to identify the sender
351 @param context - sender context, to match reply w/ request
352 @param ip_address - failover IP4 address
353 @param port - failvoer UDP port number
354 @param session_refresh_interval - number of seconds after which to send
355 session counters refresh
357 autoreply define nat_ha_set_failover {
360 vl_api_ip4_address_t ip_address;
362 u32 session_refresh_interval;
365 /** \brief Get HA listener/local configuration
366 @param client_index - opaque cookie to identify the sender
367 @param context - sender context, to match reply w/ request
369 define nat_ha_get_listener {
374 /** \brief Get HA listener/local configuration reply
375 @param context - sender context, to match reply w/ request
376 @param retval - return code
377 @param ip_address - local IP4 address
378 @param port - local UDP port number
379 @param path_mtu - Path MTU between local and failover
381 define nat_ha_get_listener_reply {
384 vl_api_ip4_address_t ip_address;
389 /** \brief Get HA failover/remote settings
390 @param client_index - opaque cookie to identify the sender
391 @param context - sender context, to match reply w/ request
393 define nat_ha_get_failover {
398 /** \brief Get HA failover/remote settings reply
399 @param context - sender context, to match reply w/ request
400 @param retval - return code
401 @param ip_address - failover IP4 address
402 @param port - failvoer UDP port number
403 @param session_refresh_interval - number of seconds after which to send
404 session counters refresh
406 define nat_ha_get_failover_reply {
409 vl_api_ip4_address_t ip_address;
411 u32 session_refresh_interval;
414 /** \brief Flush the current HA data (for testing)
415 @param client_index - opaque cookie to identify the sender
416 @param context - sender context, to match reply w/ request
418 autoreply define nat_ha_flush {
423 /** \brief Resync HA (resend existing sessions to new failover)
424 @param client_index - opaque cookie to identify the sender
425 @param context - sender context, to match reply w/ request
426 @param want_resync_event - resync completed event sent to the sender via
427 nat_ha_resync_completed_event API message if
429 @param pid - sender's pid
431 autoreply define nat_ha_resync
435 u8 want_resync_event;
439 /** \brief Tell client about a HA resync completion event
440 @param client_index - opaque cookie to identify the sender
441 @param pid - client pid registered to receive notification
442 @param missed_count - number of missed (not ACKed) messages
444 define nat_ha_resync_completed_event
452 rpc nat_ha_resync returns nat_ha_resync_reply events nat_ha_resync_completed_event;
459 /** \brief Add/del NAT44 address range
460 @param client_index - opaque cookie to identify the sender
461 @param context - sender context, to match reply w/ request
462 @param first_ip_address - first IPv4 address
463 @param last_ip_address - last IPv4 address
464 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
465 @param is_add - true if add, false if delete
466 @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
469 autoreply define nat44_add_del_address_range {
472 vl_api_ip4_address_t first_ip_address;
473 vl_api_ip4_address_t last_ip_address;
476 vl_api_nat_config_flags_t flags;
479 /** \brief Dump NAT44 addresses
480 @param client_index - opaque cookie to identify the sender
481 @param context - sender context, to match reply w/ request
483 define nat44_address_dump {
488 /** \brief NAT44 address details response
489 @param context - sender context, to match reply w/ request
490 @param ip_address - IPv4 address
491 @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
492 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
494 define nat44_address_details {
496 vl_api_ip4_address_t ip_address;
497 vl_api_nat_config_flags_t flags;
501 /** \brief Enable/disable NAT44 feature on the interface
502 @param client_index - opaque cookie to identify the sender
503 @param context - sender context, to match reply w/ request
504 @param is_add - true if add, false if delete
505 @param flags - flag NAT_IS_INSIDE if interface is inside else
507 @param sw_if_index - software index of the interface
509 autoreply define nat44_interface_add_del_feature {
513 vl_api_nat_config_flags_t flags;
514 vl_api_interface_index_t sw_if_index;
517 /** \brief Dump interfaces with NAT44 feature
518 @param client_index - opaque cookie to identify the sender
519 @param context - sender context, to match reply w/ request
521 define nat44_interface_dump {
526 /** \brief NAT44 interface details response
527 @param context - sender context, to match reply w/ request
528 @param sw_if_index - software index of the interface
529 @param flags - flag NAT_IS_INSIDE if interface is inside,
530 flag NAT_IS_OUTSIDE if interface is outside
531 and if both flags are set the interface is
532 both inside and outside
534 define nat44_interface_details {
536 vl_api_nat_config_flags_t flags;
537 vl_api_interface_index_t sw_if_index;
540 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
542 @param client_index - opaque cookie to identify the sender
543 @param context - sender context, to match reply w/ request
544 @param is_add - true if add, false if delete
545 @param flags - flag NAT_IS_INSIDE if interface is inside else
547 @param sw_if_index - software index of the interface
549 autoreply define nat44_interface_add_del_output_feature {
553 vl_api_nat_config_flags_t flags;
554 vl_api_interface_index_t sw_if_index;
557 /** \brief Dump interfaces with NAT44 output feature
558 @param client_index - opaque cookie to identify the sender
559 @param context - sender context, to match reply w/ request
561 define nat44_interface_output_feature_dump {
566 /** \brief NAT44 interface with output feature details response
567 @param context - sender context, to match reply w/ request
568 @param flags - flag NAT_IS_INSIDE if interface is inside else
570 @param sw_if_index - software index of the interface
572 define nat44_interface_output_feature_details {
574 vl_api_nat_config_flags_t flags;
575 vl_api_interface_index_t sw_if_index;
578 /** \brief Add/delete NAT44 static mapping
579 @param client_index - opaque cookie to identify the sender
580 @param context - sender context, to match reply w/ request
581 @param is_add - true if add, false if delete
582 @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
583 flag nat_is_twice_nat if nat address range for external hosts,
584 flag NAT_IS_SELF_TWICE_NAT if translate external host address
585 and port whenever external host address equals local
586 address of internal host,
587 flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
588 @param local_ip_address - local IPv4 address
589 @param external_ip_address - external IPv4 address
590 @param protocol - IP protocol, used only if addr_only=0
591 @param local_port - local port number, used only if addr_only=0
592 @param external_port - external port number, used only if addr_only=0
593 @param external_sw_if_index - external interface (if set
594 external_ip_address is ignored, ~0 means not
596 @param vfr_id - VRF ID
597 @param tag - opaque string tag
599 autoreply define nat44_add_del_static_mapping {
603 vl_api_nat_config_flags_t flags;
604 vl_api_ip4_address_t local_ip_address;
605 vl_api_ip4_address_t external_ip_address;
609 vl_api_interface_index_t external_sw_if_index;
614 /** \brief Dump NAT44 static mappings
615 @param client_index - opaque cookie to identify the sender
616 @param context - sender context, to match reply w/ request
618 define nat44_static_mapping_dump {
623 /** \brief NAT44 static mapping details response
624 @param context - sender context, to match reply w/ request
625 @param flags - flag NAT_ADDR_ONLY if address only mapping,
626 flag NAT_TWICE_NAT if NAT address range for external hosts,
627 flag NAT_SELF_TWICE_NAT if translate external host address
628 and port whenever external host address equals local
629 address of internal host,
630 flag NAT_OUT2IN_ONLY if rule match only out2in direction
631 @param local_ip_address - local IPv4 address
632 @param external_ip_address - external IPv4 address
633 @param protocol - IP protocol, valid only if no NAT_ADDR_ONLY flag
634 @param local_port - local port number, valid only if no NAT_ADDR_ONLY flag
635 @param external_port - external port number, valid only if no NAT_ADDR_ONLY flag
636 @param external_sw_if_index - external interface
637 @param vfr_id - VRF ID
638 @param tag - opaque string tag
640 define nat44_static_mapping_details {
642 vl_api_nat_config_flags_t flags;
643 vl_api_ip4_address_t local_ip_address;
644 vl_api_ip4_address_t external_ip_address;
648 vl_api_interface_index_t external_sw_if_index;
653 /** \brief Add/delete NAT44 identity mapping
654 @param client_index - opaque cookie to identify the sender
655 @param context - sender context, to match reply w/ request
656 @param is_add - true if add, false if delete
657 @param flags - flag NAT_ADDR_ONLY if address only mapping
658 @param ip_address - IPv4 address
659 @param protocol - IP protocol
660 @param port - port number
661 @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
663 @param vfr_id - VRF ID (if ~0 use default VRF)
664 @param tag - opaque string tag
666 autoreply define nat44_add_del_identity_mapping {
670 vl_api_nat_config_flags_t flags;
671 vl_api_ip4_address_t ip_address;
674 vl_api_interface_index_t sw_if_index;
679 /** \brief Dump NAT44 identity mappings
680 @param client_index - opaque cookie to identify the sender
681 @param context - sender context, to match reply w/ request
683 define nat44_identity_mapping_dump {
688 /** \brief NAT44 identity mapping details response
689 @param context - sender context, to match reply w/ request
690 @param flags - flag NAT_ADDR_ONLY if address only mapping
691 @param ip_address - IPv4 address
692 @param protocol - IP protocol
693 @param port - port number
694 @param sw_if_index - interface
695 @param vfr_id - VRF ID
696 @param tag - opaque string tag
698 define nat44_identity_mapping_details {
700 vl_api_nat_config_flags_t flags;
701 vl_api_ip4_address_t ip_address;
704 vl_api_interface_index_t sw_if_index;
709 /** \brief Add/delete NAT44 pool address from specific interfce
710 @param client_index - opaque cookie to identify the sender
711 @param context - sender context, to match reply w/ request
712 @param is_add - true if add, false if delete
713 @param sw_if_index - software index of the interface
714 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
716 autoreply define nat44_add_del_interface_addr {
720 vl_api_interface_index_t sw_if_index;
721 vl_api_nat_config_flags_t flags;
724 /** \brief Dump NAT44 pool addresses interfaces
725 @param client_index - opaque cookie to identify the sender
726 @param context - sender context, to match reply w/ request
728 define nat44_interface_addr_dump {
733 /** \brief NAT44 pool addresses interfaces details response
734 @param context - sender context, to match reply w/ request
735 @param sw_if_index - software index of the interface
736 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
739 define nat44_interface_addr_details {
741 vl_api_interface_index_t sw_if_index;
742 vl_api_nat_config_flags_t flags;
745 /** \brief Dump NAT44 users
746 @param client_index - opaque cookie to identify the sender
747 @param context - sender context, to match reply w/ request
749 define nat44_user_dump {
754 /** \brief NAT44 users response
755 @param context - sender context, to match reply w/ request
757 @param ip_address - IPv4 address
758 @param nsessions - number of dynamic sessions
759 @param nstaticsessions - number of static sessions
761 define nat44_user_details {
764 vl_api_ip4_address_t ip_address;
769 /** \brief NAT44 user's sessions
770 @param client_index - opaque cookie to identify the sender
771 @param context - sender context, to match reply w/ request
772 @param ip_address - IPv4 address of the user to dump
773 @param vrf_id - VRF_ID
775 define nat44_user_session_dump {
778 vl_api_ip4_address_t ip_address;
782 /** \brief NAT44 user's sessions response
783 @param context - sender context, to match reply w/ request
784 @param outside_ip_address - outside IPv4 address
785 @param outside_port - outside port
786 @param inside_ip_address - inside IPv4 address
787 @param inside_port - inside port
788 @param protocol - protocol
789 @param flags - flag NAT_IS_STATIC if session is static,
790 flag NAT_IS_TWICE_NAT if session is twice-nat,
791 flag NAT_IS_EXT_HOST_VALID if external host address
793 @param last_heard - last heard timer
794 @param total_bytes - count of bytes sent through session
795 @param total_pkts - count of pakets sent through session
796 @param ext_host_address - external host IPv4 address
797 @param ext_host_port - external host port
798 @param ext_host_nat_address - post-NAT external host IPv4 address (valid
799 only if twice-nat session)
800 @param ext_host_nat_port - post-NAT external host port (valid only if
803 define nat44_user_session_details {
805 vl_api_ip4_address_t outside_ip_address;
807 vl_api_ip4_address_t inside_ip_address;
810 vl_api_nat_config_flags_t flags;
814 vl_api_ip4_address_t ext_host_address;
816 vl_api_ip4_address_t ext_host_nat_address;
817 u16 ext_host_nat_port;
820 /** \brief NAT44 load-balancing address and port pair
821 @param addr - IPv4 address of the internal node
822 @param port - L4 port number of the internal node
823 @param probability - probability of the internal node to be randomly matched
824 @param vrf_id - VRF id
826 typedef nat44_lb_addr_port {
827 vl_api_ip4_address_t addr;
833 /** \brief Add/delete NAT44 load-balancing static mapping rule
834 @param client_index - opaque cookie to identify the sender
835 @param context - sender context, to match reply w/ request
836 @param is_add - true if add, false if delete
837 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
838 flag NAT_SELF_TWICE_NAT if translate external host address
839 and port whenever external host address equals local
840 address of internal host,
841 flag NAT_OUT2IN_ONLY if rule match only out2in direction
842 @param external_addr - external IPv4 address of the service
843 @param external_port - external L4 port number of the service
844 @param protocol - IP protocol number of the service
845 @param affinity - if 0 disabled, otherwise client IP affinity sticky time
847 @param local_num - number of local network nodes
848 @param locals - local network nodes
849 @param tag - opaque string tag
851 autoreply manual_endian define nat44_add_del_lb_static_mapping {
855 vl_api_nat_config_flags_t flags;
856 vl_api_ip4_address_t external_addr;
862 vl_api_nat44_lb_addr_port_t locals[local_num];
865 /** \brief Add/delete NAT44 load-balancing static mapping rule backend
866 @param client_index - opaque cookie to identify the sender
867 @param context - sender context, to match reply w/ request
868 @param is_add - true if add, false if delete
869 @param external_addr - external IPv4 address of the service
870 @param external_port - external L4 port number of the service
871 @param protocol - IP protocol number of the service
872 @param local - local network node
874 autoreply define nat44_lb_static_mapping_add_del_local {
878 vl_api_ip4_address_t external_addr;
881 vl_api_nat44_lb_addr_port_t local;
884 /** \brief Dump NAT44 load-balancing static mapping rules
885 @param client_index - opaque cookie to identify the sender
886 @param context - sender context, to match reply w/ request
888 define nat44_lb_static_mapping_dump {
893 /** \brief NAT44 load-balancing static mapping rule details response
894 @param context - sender context, to match reply w/ request
895 @param external_addr - external IPv4 address of the service
896 @param external_port - external L4 port number of the service
897 @param protocol - IP protocol number of the service
898 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
899 flag NAT_SELF_TWICE_NAT if translate external host address
900 and port whenever external host address equals local
901 address of internal host,
902 flag NAT_OUT2IN_ONLY if rule match only out2in direction
903 @param affinity - if 0 disabled, otherwise client IP affinity sticky time
905 @param local_num - number of local network nodes
906 @param locals - local network nodes
907 @param tag - opaque string tag
909 manual_endian define nat44_lb_static_mapping_details {
911 vl_api_ip4_address_t external_addr;
914 vl_api_nat_config_flags_t flags;
918 vl_api_nat44_lb_addr_port_t locals[local_num];
921 /** \brief Delete NAT44 session
922 @param client_index - opaque cookie to identify the sender
923 @param context - sender context, to match reply w/ request
924 @param ip_address - IPv4 address
925 @param protocol - IP protocol
926 @param port - port number
927 @param vfr_id - VRF ID
928 @param flags - flag NAT_IS_INSIDE if interface is inside or
929 interface is outside,
930 flag NAT_IS_EXT_HOST_VALID if external host address and
932 @param ext_host_address - external host IPv4 address
933 @param ext_host_port - external host port
935 autoreply define nat44_del_session {
938 vl_api_ip4_address_t address;
942 vl_api_nat_config_flags_t flags;
943 vl_api_ip4_address_t ext_host_address;
947 /** \brief Enable/disable forwarding for NAT44
948 Forward packets which don't match existing translation
949 or static mapping instead of dropping them.
950 @param client_index - opaque cookie to identify the sender
951 @param context - sender context, to match reply w/ request
952 @param enable - true for enable, false for disable
954 autoreply define nat44_forwarding_enable_disable {
960 /** \brief Check if forwarding is enabled or disabled
961 @param client_index - opaque cookie to identify the sender
962 @param context - sender context, to match reply w/ request
964 define nat44_forwarding_is_enabled {
969 /** \brief Response to check if forwarding is enabled or disabled
970 @param context - sender context, to match reply w/ request
971 @param enabled - true if enabled, false if disabled
973 define nat44_forwarding_is_enabled_reply {
980 * Deterministic NAT (CGN) APIs
983 /** \brief Add/delete NAT deterministic mapping
984 @param client_index - opaque cookie to identify the sender
985 @param context - sender context, to match reply w/ request
986 @param is_add - true if add, false if delete
987 @param in_addr - inside IPv4 address
988 @param in_plen - inside IPv4 address prefix length
989 @param out_addr - outside IPv4 address
990 @param out_plen - outside IPv4 address prefix length
992 autoreply define nat_det_add_del_map {
996 vl_api_ip4_address_t in_addr;
998 vl_api_ip4_address_t out_addr;
1002 /** \brief Get outside address and port range from inside address
1003 @param client_index - opaque cookie to identify the sender
1004 @param context - sender context, to match reply w/ request
1005 @param in_addr - inside IP address
1007 define nat_det_forward {
1010 vl_api_ip4_address_t in_addr;
1013 /** \brief Get outside address and port range from inside address
1014 @param context - sender context, to match reply w/ request
1015 @param retval - return code
1016 @param out_port_lo - outside port range start
1017 @param out_port_hi - outside port range end
1018 @param out_addr - outside IPv4 address
1020 define nat_det_forward_reply {
1025 vl_api_ip4_address_t out_addr;
1028 /** \brief Get inside address from outside address and port
1029 @param client_index - opaque cookie to identify the sender
1030 @param context - sender context, to match reply w/ request
1031 @param out_port - outside port
1032 @param out_addr - outside IPv4 address
1034 define nat_det_reverse {
1038 vl_api_ip4_address_t out_addr;
1041 /** \brief Get inside address from outside address and port reply
1042 @param context - sender context, to match reply w/ request
1043 @param retval - return code
1044 @param in_addr - inside IP address
1046 define nat_det_reverse_reply {
1049 vl_api_ip4_address_t in_addr;
1052 /** \brief Dump NAT deterministic mappings
1053 @param client_index - opaque cookie to identify the sender
1054 @param context - sender context, to match reply w/ request
1056 define nat_det_map_dump {
1061 /** \brief NAT users response
1062 @param context - sender context, to match reply w/ request
1063 @param in_addr - inside IPv4 address
1064 @param in_plen - inside IPv4 address prefix length
1065 @param out_addr - outside IPv4 address
1066 @param out_plen - outside IPv4 address prefix length
1067 @param sharing_ratio - outside to inside address sharing ratio
1068 @param ports_per_host - number of ports available to a host
1069 @param ses_num - number of sessions belonging to this mapping
1071 define nat_det_map_details {
1073 vl_api_ip4_address_t in_addr;
1075 vl_api_ip4_address_t out_addr;
1082 /** \brief Close deterministic NAT session by outside address and port
1083 @param client_index - opaque cookie to identify the sender
1084 @param context - sender context, to match reply w/ request
1085 @param out_addr - outside IPv4 address
1086 @param out_port - outside port
1087 @param ext_addr - external host IPv4 address
1088 @param ext_port - external host port
1090 autoreply define nat_det_close_session_out {
1093 vl_api_ip4_address_t out_addr;
1095 vl_api_ip4_address_t ext_addr;
1099 /** \brief Close deterministic NAT session by inside address and port
1100 @param client_index - opaque cookie to identify the sender
1101 @param context - sender context, to match reply w/ request
1102 @param in_addr - inside IP address
1103 @param in_port - inside port
1104 @param ext_addr - external host IP address
1105 @param ext_port - external host port
1107 autoreply define nat_det_close_session_in {
1110 vl_api_ip4_address_t in_addr;
1112 vl_api_ip4_address_t ext_addr;
1116 /** \brief Dump determinstic NAT sessions
1117 @param client_index - opaque cookie to identify the sender
1118 @param context - sender context, to match reply w/ request
1119 @param user_addr - address of an inside user whose sessions to dump
1121 define nat_det_session_dump {
1124 vl_api_ip4_address_t user_addr;
1127 /** \brief Deterministic NAT sessions reply
1128 @param context - sender context, to match reply w/ request
1129 @param in_port - inside port
1130 @param ext_addr - external host IPv4 address
1131 @param ext_port - external host port
1132 @param out_port - outside NAT port
1133 @param state - session state
1134 @param expire - session expiration timestamp
1136 define nat_det_session_details {
1139 vl_api_ip4_address_t ext_addr;
1150 /** \brief Add/delete address range to NAT64 pool
1151 @param client_index - opaque cookie to identify the sender
1152 @param context - sender context, to match reply w/ request
1153 @param start_addr - start IPv4 address of the range
1154 @param end_addr - end IPv4 address of the range
1155 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
1156 @param is_add - true if add, false if delete
1158 autoreply define nat64_add_del_pool_addr_range {
1161 vl_api_ip4_address_t start_addr;
1162 vl_api_ip4_address_t end_addr;
1167 /** \brief Dump NAT64 pool addresses
1168 @param client_index - opaque cookie to identify the sender
1169 @param context - sender context, to match reply w/ request
1171 define nat64_pool_addr_dump {
1176 /** \brief NAT64 pool address details response
1177 @param context - sender context, to match reply w/ request
1178 @param address - IPv4 address
1179 @param vfr_id - VRF id of tenant, ~0 means independent of VRF
1181 define nat64_pool_addr_details {
1183 vl_api_ip4_address_t address;
1187 /** \brief Enable/disable NAT64 feature on the interface
1188 @param client_index - opaque cookie to identify the sender
1189 @param context - sender context, to match reply w/ request
1190 @param is_add - true if add, false if delete
1191 @param flags - flag NAT_IS_INSIDE if interface is inside else
1192 interface is outside
1193 @param sw_if_index - index of the interface
1195 autoreply define nat64_add_del_interface {
1199 vl_api_nat_config_flags_t flags;
1200 vl_api_interface_index_t sw_if_index;
1203 /** \brief Dump interfaces with NAT64 feature
1204 @param client_index - opaque cookie to identify the sender
1205 @param context - sender context, to match reply w/ request
1207 define nat64_interface_dump {
1212 /** \brief NAT64 interface details response
1213 @param context - sender context, to match reply w/ request
1214 @param flags - flag NAT_IS_INSIDE if interface is inside,
1215 flag NAT_IS_OUTSIDE if interface is outside
1216 and if both flags are set the interface is
1217 both inside and outside
1218 @param sw_if_index - index of the interface
1220 define nat64_interface_details {
1222 vl_api_nat_config_flags_t flags;
1223 vl_api_interface_index_t sw_if_index;
1226 /** \brief Add/delete NAT64 static BIB entry
1227 @param client_index - opaque cookie to identify the sender
1228 @param context - sender context, to match reply w/ request
1229 @param i_addr - inside IPv6 address
1230 @param o_addr - outside IPv4 address
1231 @param i_port - inside port number
1232 @param o_port - outside port number
1233 @param vrf_id - VRF id of tenant
1234 @param proto - protocol number
1235 @param is_add - true if add, false if delete
1237 autoreply define nat64_add_del_static_bib {
1240 vl_api_ip6_address_t i_addr;
1241 vl_api_ip4_address_t o_addr;
1249 /** \brief Dump NAT64 BIB
1250 @param client_index - opaque cookie to identify the sender
1251 @param context - sender context, to match reply w/ request
1252 @param proto - protocol of the BIB: 255 - all BIBs
1256 otherwise - "unknown" protocol BIB
1258 define nat64_bib_dump {
1264 /** \brief NAT64 BIB details response
1265 @param context - sender context, to match reply w/ request
1266 @param i_addr - inside IPv6 address
1267 @param o_addr - outside IPv4 address
1268 @param i_port - inside port number
1269 @param o_port - outside port number
1270 @param vrf_id - VRF id of tenant
1271 @param proto - protocol number
1272 @param flags - flag NAT_IS_STATIC if BIB entry is static
1273 or BIB entry is dynamic
1274 @param ses_num - number of sessions associated with the BIB entry
1276 define nat64_bib_details {
1278 vl_api_ip6_address_t i_addr;
1279 vl_api_ip4_address_t o_addr;
1284 vl_api_nat_config_flags_t flags;
1288 /** \brief Dump NAT64 session table
1289 @param client_index - opaque cookie to identify the sender
1290 @param context - sender context, to match reply w/ request
1291 @param proto - protocol of the session table: 255 - all STs
1295 otherwise - "unknown" proto ST
1297 define nat64_st_dump {
1303 /** \brief NAT64 session table details response
1304 @param context - sender context, to match reply w/ request
1305 @param il_addr - inside IPv6 address of the local host
1306 @param ol_addr - outside IPv4 address of the local host
1307 @param il_port - inside port number id of the local host/inside ICMP id
1308 @param ol_port - outside port number of the local host/outside ICMP id
1309 @param ir_addr - inside IPv6 address of the remote host
1310 @param or_addr - outside IPv4 address of the remote host
1311 @param r_port - port number of the remote host (not used for ICMP)
1312 @param vrf_id - VRF id of tenant
1313 @param proto - protocol number
1315 define nat64_st_details {
1317 vl_api_ip6_address_t il_addr;
1318 vl_api_ip4_address_t ol_addr;
1321 vl_api_ip6_address_t ir_addr;
1322 vl_api_ip4_address_t or_addr;
1328 /** \brief Add/del NAT64 prefix
1329 @param client_index - opaque cookie to identify the sender
1330 @param context - sender context, to match reply w/ request
1331 @param prefix - NAT64 prefix
1332 @param vrf_id - VRF id of tenant
1333 @param is_add - true if add, false if delete
1335 autoreply define nat64_add_del_prefix {
1338 vl_api_ip6_prefix_t prefix;
1343 /** \brief Dump NAT64 prefix
1344 @param client_index - opaque cookie to identify the sender
1345 @param context - sender context, to match reply w/ request
1347 define nat64_prefix_dump {
1352 /** \brief Dump NAT64 prefix details response
1353 @param context - sender context, to match reply w/ request
1354 @param prefix - NAT64 prefix
1355 @param vrf_id - VRF id of tenant
1357 define nat64_prefix_details {
1359 vl_api_ip6_prefix_t prefix;
1363 /** \brief Add/delete NAT64 pool address from specific interfce
1364 @param client_index - opaque cookie to identify the sender
1365 @param context - sender context, to match reply w/ request
1366 @param is_add - true if add, false if delete
1367 @param sw_if_index - software index of the interface
1369 autoreply define nat64_add_del_interface_addr {
1373 vl_api_interface_index_t sw_if_index;
1379 /** \brief Enable/disable NAT66 feature on the interface
1380 @param client_index - opaque cookie to identify the sender
1381 @param context - sender context, to match reply w/ request
1382 @param is_add - true if add, false if delete
1383 @param flags - flag NAT_IS_INSIDE if interface is inside or
1384 interface is outside,
1385 @param sw_if_index - software index of the interface
1387 autoreply define nat66_add_del_interface {
1391 vl_api_nat_config_flags_t flags;
1392 vl_api_interface_index_t sw_if_index;
1395 /** \brief Dump interfaces with NAT66 feature
1396 @param client_index - opaque cookie to identify the sender
1397 @param context - sender context, to match reply w/ request
1399 define nat66_interface_dump {
1404 /** \brief NAT66 interface details response
1405 @param context - sender context, to match reply w/ request
1406 @param flags - flag NAT_IS_INSIDE if interface is inside or
1407 interface is outside,
1408 @param sw_if_index - software index of the interface
1410 define nat66_interface_details {
1412 vl_api_nat_config_flags_t flags;
1413 vl_api_interface_index_t sw_if_index;
1416 /** \brief Add/delete 1:1 NAT66
1417 @param client_index - opaque cookie to identify the sender
1418 @param context - sender context, to match reply w/ request
1419 @param is_add - true if add, false if delete
1420 @param local_ip_address - local IPv6 address
1421 @param external_ip_address - external IPv6 address
1422 @param vrf_id - VRF id of tenant
1424 autoreply define nat66_add_del_static_mapping {
1428 vl_api_ip6_address_t local_ip_address;
1429 vl_api_ip6_address_t external_ip_address;
1433 /** \brief Dump NAT66 static mappings
1434 @param client_index - opaque cookie to identify the sender
1435 @param context - sender context, to match reply w/ request
1437 define nat66_static_mapping_dump {
1442 /** \brief NAT66 static mapping details response
1443 @param context - sender context, to match reply w/ request
1444 @param local_ip_address - local IPv6 address
1445 @param external_ip_address - external IPv6 address
1446 @param vrf_id - VRF id of tenant
1447 @param total_bytes - count of bytes sent through static mapping
1448 @param total_pkts - count of pakets sent through static mapping
1450 define nat66_static_mapping_details {
1452 vl_api_ip6_address_t local_ip_address;
1453 vl_api_ip6_address_t external_ip_address;