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 Del NAT44 user
460 @param client_index - opaque cookie to identify the sender
461 @param context - sender context, to match reply w/ request
462 @param ip_address - IPv4 address
463 @param fib_index - FIB index
465 autoreply define nat44_del_user {
468 vl_api_ip4_address_t ip_address;
472 /** \brief Add/del NAT44 address range
473 @param client_index - opaque cookie to identify the sender
474 @param context - sender context, to match reply w/ request
475 @param first_ip_address - first IPv4 address
476 @param last_ip_address - last IPv4 address
477 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
478 @param is_add - true if add, false if delete
479 @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
482 autoreply define nat44_add_del_address_range {
485 vl_api_ip4_address_t first_ip_address;
486 vl_api_ip4_address_t last_ip_address;
489 vl_api_nat_config_flags_t flags;
492 /** \brief Dump NAT44 addresses
493 @param client_index - opaque cookie to identify the sender
494 @param context - sender context, to match reply w/ request
496 define nat44_address_dump {
501 /** \brief NAT44 address details response
502 @param context - sender context, to match reply w/ request
503 @param ip_address - IPv4 address
504 @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
505 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
507 define nat44_address_details {
509 vl_api_ip4_address_t ip_address;
510 vl_api_nat_config_flags_t flags;
514 /** \brief Enable/disable NAT44 feature on the interface
515 @param client_index - opaque cookie to identify the sender
516 @param context - sender context, to match reply w/ request
517 @param is_add - true if add, false if delete
518 @param flags - flag NAT_IS_INSIDE if interface is inside else
520 @param sw_if_index - software index of the interface
522 autoreply define nat44_interface_add_del_feature {
526 vl_api_nat_config_flags_t flags;
527 vl_api_interface_index_t sw_if_index;
530 /** \brief Dump interfaces with NAT44 feature
531 @param client_index - opaque cookie to identify the sender
532 @param context - sender context, to match reply w/ request
534 define nat44_interface_dump {
539 /** \brief NAT44 interface details response
540 @param context - sender context, to match reply w/ request
541 @param sw_if_index - software index of the interface
542 @param flags - flag NAT_IS_INSIDE if interface is inside,
543 flag NAT_IS_OUTSIDE if interface is outside
544 and if both flags are set the interface is
545 both inside and outside
547 define nat44_interface_details {
549 vl_api_nat_config_flags_t flags;
550 vl_api_interface_index_t sw_if_index;
553 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
555 @param client_index - opaque cookie to identify the sender
556 @param context - sender context, to match reply w/ request
557 @param is_add - true if add, false if delete
558 @param flags - flag NAT_IS_INSIDE if interface is inside else
560 @param sw_if_index - software index of the interface
562 autoreply define nat44_interface_add_del_output_feature {
566 vl_api_nat_config_flags_t flags;
567 vl_api_interface_index_t sw_if_index;
570 /** \brief Dump interfaces with NAT44 output feature
571 @param client_index - opaque cookie to identify the sender
572 @param context - sender context, to match reply w/ request
574 define nat44_interface_output_feature_dump {
579 /** \brief NAT44 interface with output feature details response
580 @param context - sender context, to match reply w/ request
581 @param flags - flag NAT_IS_INSIDE if interface is inside else
583 @param sw_if_index - software index of the interface
585 define nat44_interface_output_feature_details {
587 vl_api_nat_config_flags_t flags;
588 vl_api_interface_index_t sw_if_index;
591 /** \brief Add/delete NAT44 static mapping
592 @param client_index - opaque cookie to identify the sender
593 @param context - sender context, to match reply w/ request
594 @param is_add - true if add, false if delete
595 @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
596 flag nat_is_twice_nat if nat address range for external hosts,
597 flag NAT_IS_SELF_TWICE_NAT if translate external host address
598 and port whenever external host address equals local
599 address of internal host,
600 flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
601 @param local_ip_address - local IPv4 address
602 @param external_ip_address - external IPv4 address
603 @param protocol - IP protocol, used only if addr_only=0
604 @param local_port - local port number, used only if addr_only=0
605 @param external_port - external port number, used only if addr_only=0
606 @param external_sw_if_index - external interface (if set
607 external_ip_address is ignored, ~0 means not
609 @param vfr_id - VRF ID
610 @param tag - opaque string tag
612 autoreply define nat44_add_del_static_mapping {
616 vl_api_nat_config_flags_t flags;
617 vl_api_ip4_address_t local_ip_address;
618 vl_api_ip4_address_t external_ip_address;
622 vl_api_interface_index_t external_sw_if_index;
627 /** \brief Dump NAT44 static mappings
628 @param client_index - opaque cookie to identify the sender
629 @param context - sender context, to match reply w/ request
631 define nat44_static_mapping_dump {
636 /** \brief NAT44 static mapping details response
637 @param context - sender context, to match reply w/ request
638 @param flags - flag NAT_ADDR_ONLY if address only mapping,
639 flag NAT_TWICE_NAT if NAT address range for external hosts,
640 flag NAT_SELF_TWICE_NAT if translate external host address
641 and port whenever external host address equals local
642 address of internal host,
643 flag NAT_OUT2IN_ONLY if rule match only out2in direction
644 @param local_ip_address - local IPv4 address
645 @param external_ip_address - external IPv4 address
646 @param protocol - IP protocol, valid only if no NAT_ADDR_ONLY flag
647 @param local_port - local port number, valid only if no NAT_ADDR_ONLY flag
648 @param external_port - external port number, valid only if no NAT_ADDR_ONLY flag
649 @param external_sw_if_index - external interface
650 @param vfr_id - VRF ID
651 @param tag - opaque string tag
653 define nat44_static_mapping_details {
655 vl_api_nat_config_flags_t flags;
656 vl_api_ip4_address_t local_ip_address;
657 vl_api_ip4_address_t external_ip_address;
661 vl_api_interface_index_t external_sw_if_index;
666 /** \brief Add/delete NAT44 identity mapping
667 @param client_index - opaque cookie to identify the sender
668 @param context - sender context, to match reply w/ request
669 @param is_add - true if add, false if delete
670 @param flags - flag NAT_ADDR_ONLY if address only mapping
671 @param ip_address - IPv4 address
672 @param protocol - IP protocol
673 @param port - port number
674 @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
676 @param vfr_id - VRF ID (if ~0 use default VRF)
677 @param tag - opaque string tag
679 autoreply define nat44_add_del_identity_mapping {
683 vl_api_nat_config_flags_t flags;
684 vl_api_ip4_address_t ip_address;
687 vl_api_interface_index_t sw_if_index;
692 /** \brief Dump NAT44 identity mappings
693 @param client_index - opaque cookie to identify the sender
694 @param context - sender context, to match reply w/ request
696 define nat44_identity_mapping_dump {
701 /** \brief NAT44 identity mapping details response
702 @param context - sender context, to match reply w/ request
703 @param flags - flag NAT_ADDR_ONLY if address only mapping
704 @param ip_address - IPv4 address
705 @param protocol - IP protocol
706 @param port - port number
707 @param sw_if_index - interface
708 @param vfr_id - VRF ID
709 @param tag - opaque string tag
711 define nat44_identity_mapping_details {
713 vl_api_nat_config_flags_t flags;
714 vl_api_ip4_address_t ip_address;
717 vl_api_interface_index_t sw_if_index;
722 /** \brief Add/delete NAT44 pool address from specific interfce
723 @param client_index - opaque cookie to identify the sender
724 @param context - sender context, to match reply w/ request
725 @param is_add - true if add, false if delete
726 @param sw_if_index - software index of the interface
727 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
729 autoreply define nat44_add_del_interface_addr {
733 vl_api_interface_index_t sw_if_index;
734 vl_api_nat_config_flags_t flags;
737 /** \brief Dump NAT44 pool addresses interfaces
738 @param client_index - opaque cookie to identify the sender
739 @param context - sender context, to match reply w/ request
741 define nat44_interface_addr_dump {
746 /** \brief NAT44 pool addresses interfaces details response
747 @param context - sender context, to match reply w/ request
748 @param sw_if_index - software index of the interface
749 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
752 define nat44_interface_addr_details {
754 vl_api_interface_index_t sw_if_index;
755 vl_api_nat_config_flags_t flags;
758 /** \brief Dump NAT44 users
759 @param client_index - opaque cookie to identify the sender
760 @param context - sender context, to match reply w/ request
762 define nat44_user_dump {
767 /** \brief NAT44 users response
768 @param context - sender context, to match reply w/ request
770 @param ip_address - IPv4 address
771 @param nsessions - number of dynamic sessions
772 @param nstaticsessions - number of static sessions
774 define nat44_user_details {
777 vl_api_ip4_address_t ip_address;
782 /** \brief NAT44 user's sessions
783 @param client_index - opaque cookie to identify the sender
784 @param context - sender context, to match reply w/ request
785 @param ip_address - IPv4 address of the user to dump
786 @param vrf_id - VRF_ID
788 define nat44_user_session_dump {
791 vl_api_ip4_address_t ip_address;
795 /** \brief NAT44 user's sessions response
796 @param context - sender context, to match reply w/ request
797 @param outside_ip_address - outside IPv4 address
798 @param outside_port - outside port
799 @param inside_ip_address - inside IPv4 address
800 @param inside_port - inside port
801 @param protocol - protocol
802 @param flags - flag NAT_IS_STATIC if session is static,
803 flag NAT_IS_TWICE_NAT if session is twice-nat,
804 flag NAT_IS_EXT_HOST_VALID if external host address
806 @param last_heard - last heard timer
807 @param total_bytes - count of bytes sent through session
808 @param total_pkts - count of pakets sent through session
809 @param ext_host_address - external host IPv4 address
810 @param ext_host_port - external host port
811 @param ext_host_nat_address - post-NAT external host IPv4 address (valid
812 only if twice-nat session)
813 @param ext_host_nat_port - post-NAT external host port (valid only if
816 define nat44_user_session_details {
818 vl_api_ip4_address_t outside_ip_address;
820 vl_api_ip4_address_t inside_ip_address;
823 vl_api_nat_config_flags_t flags;
827 vl_api_ip4_address_t ext_host_address;
829 vl_api_ip4_address_t ext_host_nat_address;
830 u16 ext_host_nat_port;
833 /** \brief NAT44 load-balancing address and port pair
834 @param addr - IPv4 address of the internal node
835 @param port - L4 port number of the internal node
836 @param probability - probability of the internal node to be randomly matched
837 @param vrf_id - VRF id
839 typedef nat44_lb_addr_port {
840 vl_api_ip4_address_t addr;
846 /** \brief Add/delete NAT44 load-balancing static mapping rule
847 @param client_index - opaque cookie to identify the sender
848 @param context - sender context, to match reply w/ request
849 @param is_add - true if add, false if delete
850 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
851 flag NAT_SELF_TWICE_NAT if translate external host address
852 and port whenever external host address equals local
853 address of internal host,
854 flag NAT_OUT2IN_ONLY if rule match only out2in direction
855 @param external_addr - external IPv4 address of the service
856 @param external_port - external L4 port number of the service
857 @param protocol - IP protocol number of the service
858 @param affinity - if 0 disabled, otherwise client IP affinity sticky time
860 @param local_num - number of local network nodes
861 @param locals - local network nodes
862 @param tag - opaque string tag
864 autoreply manual_endian define nat44_add_del_lb_static_mapping {
868 vl_api_nat_config_flags_t flags;
869 vl_api_ip4_address_t external_addr;
875 vl_api_nat44_lb_addr_port_t locals[local_num];
878 /** \brief Add/delete NAT44 load-balancing static mapping rule backend
879 @param client_index - opaque cookie to identify the sender
880 @param context - sender context, to match reply w/ request
881 @param is_add - true if add, false if delete
882 @param external_addr - external IPv4 address of the service
883 @param external_port - external L4 port number of the service
884 @param protocol - IP protocol number of the service
885 @param local - local network node
887 autoreply define nat44_lb_static_mapping_add_del_local {
891 vl_api_ip4_address_t external_addr;
894 vl_api_nat44_lb_addr_port_t local;
897 /** \brief Dump NAT44 load-balancing static mapping rules
898 @param client_index - opaque cookie to identify the sender
899 @param context - sender context, to match reply w/ request
901 define nat44_lb_static_mapping_dump {
906 /** \brief NAT44 load-balancing static mapping rule details response
907 @param context - sender context, to match reply w/ request
908 @param external_addr - external IPv4 address of the service
909 @param external_port - external L4 port number of the service
910 @param protocol - IP protocol number of the service
911 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
912 flag NAT_SELF_TWICE_NAT if translate external host address
913 and port whenever external host address equals local
914 address of internal host,
915 flag NAT_OUT2IN_ONLY if rule match only out2in direction
916 @param affinity - if 0 disabled, otherwise client IP affinity sticky time
918 @param local_num - number of local network nodes
919 @param locals - local network nodes
920 @param tag - opaque string tag
922 manual_endian define nat44_lb_static_mapping_details {
924 vl_api_ip4_address_t external_addr;
927 vl_api_nat_config_flags_t flags;
931 vl_api_nat44_lb_addr_port_t locals[local_num];
934 /** \brief Delete NAT44 session
935 @param client_index - opaque cookie to identify the sender
936 @param context - sender context, to match reply w/ request
937 @param ip_address - IPv4 address
938 @param protocol - IP protocol
939 @param port - port number
940 @param vfr_id - VRF ID
941 @param flags - flag NAT_IS_INSIDE if interface is inside or
942 interface is outside,
943 flag NAT_IS_EXT_HOST_VALID if external host address and
945 @param ext_host_address - external host IPv4 address
946 @param ext_host_port - external host port
948 autoreply define nat44_del_session {
951 vl_api_ip4_address_t address;
955 vl_api_nat_config_flags_t flags;
956 vl_api_ip4_address_t ext_host_address;
960 /** \brief Enable/disable forwarding for NAT44
961 Forward packets which don't match existing translation
962 or static mapping instead of dropping them.
963 @param client_index - opaque cookie to identify the sender
964 @param context - sender context, to match reply w/ request
965 @param enable - true for enable, false for disable
967 autoreply define nat44_forwarding_enable_disable {
973 /** \brief Check if forwarding is enabled or disabled
974 @param client_index - opaque cookie to identify the sender
975 @param context - sender context, to match reply w/ request
977 define nat44_forwarding_is_enabled {
982 /** \brief Response to check if forwarding is enabled or disabled
983 @param context - sender context, to match reply w/ request
984 @param enabled - true if enabled, false if disabled
986 define nat44_forwarding_is_enabled_reply {
993 * Deterministic NAT (CGN) APIs
996 /** \brief Add/delete NAT deterministic mapping
997 @param client_index - opaque cookie to identify the sender
998 @param context - sender context, to match reply w/ request
999 @param is_add - true if add, false if delete
1000 @param in_addr - inside IPv4 address
1001 @param in_plen - inside IPv4 address prefix length
1002 @param out_addr - outside IPv4 address
1003 @param out_plen - outside IPv4 address prefix length
1005 autoreply define nat_det_add_del_map {
1009 vl_api_ip4_address_t in_addr;
1011 vl_api_ip4_address_t out_addr;
1015 /** \brief Get outside address and port range from inside address
1016 @param client_index - opaque cookie to identify the sender
1017 @param context - sender context, to match reply w/ request
1018 @param in_addr - inside IP address
1020 define nat_det_forward {
1023 vl_api_ip4_address_t in_addr;
1026 /** \brief Get outside address and port range from inside address
1027 @param context - sender context, to match reply w/ request
1028 @param retval - return code
1029 @param out_port_lo - outside port range start
1030 @param out_port_hi - outside port range end
1031 @param out_addr - outside IPv4 address
1033 define nat_det_forward_reply {
1038 vl_api_ip4_address_t out_addr;
1041 /** \brief Get inside address from outside address and port
1042 @param client_index - opaque cookie to identify the sender
1043 @param context - sender context, to match reply w/ request
1044 @param out_port - outside port
1045 @param out_addr - outside IPv4 address
1047 define nat_det_reverse {
1051 vl_api_ip4_address_t out_addr;
1054 /** \brief Get inside address from outside address and port reply
1055 @param context - sender context, to match reply w/ request
1056 @param retval - return code
1057 @param in_addr - inside IP address
1059 define nat_det_reverse_reply {
1062 vl_api_ip4_address_t in_addr;
1065 /** \brief Dump NAT deterministic mappings
1066 @param client_index - opaque cookie to identify the sender
1067 @param context - sender context, to match reply w/ request
1069 define nat_det_map_dump {
1074 /** \brief NAT users response
1075 @param context - sender context, to match reply w/ request
1076 @param in_addr - inside IPv4 address
1077 @param in_plen - inside IPv4 address prefix length
1078 @param out_addr - outside IPv4 address
1079 @param out_plen - outside IPv4 address prefix length
1080 @param sharing_ratio - outside to inside address sharing ratio
1081 @param ports_per_host - number of ports available to a host
1082 @param ses_num - number of sessions belonging to this mapping
1084 define nat_det_map_details {
1086 vl_api_ip4_address_t in_addr;
1088 vl_api_ip4_address_t out_addr;
1095 /** \brief Close deterministic NAT session by outside address and port
1096 @param client_index - opaque cookie to identify the sender
1097 @param context - sender context, to match reply w/ request
1098 @param out_addr - outside IPv4 address
1099 @param out_port - outside port
1100 @param ext_addr - external host IPv4 address
1101 @param ext_port - external host port
1103 autoreply define nat_det_close_session_out {
1106 vl_api_ip4_address_t out_addr;
1108 vl_api_ip4_address_t ext_addr;
1112 /** \brief Close deterministic NAT session by inside address and port
1113 @param client_index - opaque cookie to identify the sender
1114 @param context - sender context, to match reply w/ request
1115 @param in_addr - inside IP address
1116 @param in_port - inside port
1117 @param ext_addr - external host IP address
1118 @param ext_port - external host port
1120 autoreply define nat_det_close_session_in {
1123 vl_api_ip4_address_t in_addr;
1125 vl_api_ip4_address_t ext_addr;
1129 /** \brief Dump determinstic NAT sessions
1130 @param client_index - opaque cookie to identify the sender
1131 @param context - sender context, to match reply w/ request
1132 @param user_addr - address of an inside user whose sessions to dump
1134 define nat_det_session_dump {
1137 vl_api_ip4_address_t user_addr;
1140 /** \brief Deterministic NAT sessions reply
1141 @param context - sender context, to match reply w/ request
1142 @param in_port - inside port
1143 @param ext_addr - external host IPv4 address
1144 @param ext_port - external host port
1145 @param out_port - outside NAT port
1146 @param state - session state
1147 @param expire - session expiration timestamp
1149 define nat_det_session_details {
1152 vl_api_ip4_address_t ext_addr;
1163 /** \brief Add/delete address range to NAT64 pool
1164 @param client_index - opaque cookie to identify the sender
1165 @param context - sender context, to match reply w/ request
1166 @param start_addr - start IPv4 address of the range
1167 @param end_addr - end IPv4 address of the range
1168 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
1169 @param is_add - true if add, false if delete
1171 autoreply define nat64_add_del_pool_addr_range {
1174 vl_api_ip4_address_t start_addr;
1175 vl_api_ip4_address_t end_addr;
1180 /** \brief Dump NAT64 pool addresses
1181 @param client_index - opaque cookie to identify the sender
1182 @param context - sender context, to match reply w/ request
1184 define nat64_pool_addr_dump {
1189 /** \brief NAT64 pool address details response
1190 @param context - sender context, to match reply w/ request
1191 @param address - IPv4 address
1192 @param vfr_id - VRF id of tenant, ~0 means independent of VRF
1194 define nat64_pool_addr_details {
1196 vl_api_ip4_address_t address;
1200 /** \brief Enable/disable NAT64 feature on the interface
1201 @param client_index - opaque cookie to identify the sender
1202 @param context - sender context, to match reply w/ request
1203 @param is_add - true if add, false if delete
1204 @param flags - flag NAT_IS_INSIDE if interface is inside else
1205 interface is outside
1206 @param sw_if_index - index of the interface
1208 autoreply define nat64_add_del_interface {
1212 vl_api_nat_config_flags_t flags;
1213 vl_api_interface_index_t sw_if_index;
1216 /** \brief Dump interfaces with NAT64 feature
1217 @param client_index - opaque cookie to identify the sender
1218 @param context - sender context, to match reply w/ request
1220 define nat64_interface_dump {
1225 /** \brief NAT64 interface details response
1226 @param context - sender context, to match reply w/ request
1227 @param flags - flag NAT_IS_INSIDE if interface is inside,
1228 flag NAT_IS_OUTSIDE if interface is outside
1229 and if both flags are set the interface is
1230 both inside and outside
1231 @param sw_if_index - index of the interface
1233 define nat64_interface_details {
1235 vl_api_nat_config_flags_t flags;
1236 vl_api_interface_index_t sw_if_index;
1239 /** \brief Add/delete NAT64 static BIB entry
1240 @param client_index - opaque cookie to identify the sender
1241 @param context - sender context, to match reply w/ request
1242 @param i_addr - inside IPv6 address
1243 @param o_addr - outside IPv4 address
1244 @param i_port - inside port number
1245 @param o_port - outside port number
1246 @param vrf_id - VRF id of tenant
1247 @param proto - protocol number
1248 @param is_add - true if add, false if delete
1250 autoreply define nat64_add_del_static_bib {
1253 vl_api_ip6_address_t i_addr;
1254 vl_api_ip4_address_t o_addr;
1262 /** \brief Dump NAT64 BIB
1263 @param client_index - opaque cookie to identify the sender
1264 @param context - sender context, to match reply w/ request
1265 @param proto - protocol of the BIB: 255 - all BIBs
1269 otherwise - "unknown" protocol BIB
1271 define nat64_bib_dump {
1277 /** \brief NAT64 BIB details response
1278 @param context - sender context, to match reply w/ request
1279 @param i_addr - inside IPv6 address
1280 @param o_addr - outside IPv4 address
1281 @param i_port - inside port number
1282 @param o_port - outside port number
1283 @param vrf_id - VRF id of tenant
1284 @param proto - protocol number
1285 @param flags - flag NAT_IS_STATIC if BIB entry is static
1286 or BIB entry is dynamic
1287 @param ses_num - number of sessions associated with the BIB entry
1289 define nat64_bib_details {
1291 vl_api_ip6_address_t i_addr;
1292 vl_api_ip4_address_t o_addr;
1297 vl_api_nat_config_flags_t flags;
1301 /** \brief Dump NAT64 session table
1302 @param client_index - opaque cookie to identify the sender
1303 @param context - sender context, to match reply w/ request
1304 @param proto - protocol of the session table: 255 - all STs
1308 otherwise - "unknown" proto ST
1310 define nat64_st_dump {
1316 /** \brief NAT64 session table details response
1317 @param context - sender context, to match reply w/ request
1318 @param il_addr - inside IPv6 address of the local host
1319 @param ol_addr - outside IPv4 address of the local host
1320 @param il_port - inside port number id of the local host/inside ICMP id
1321 @param ol_port - outside port number of the local host/outside ICMP id
1322 @param ir_addr - inside IPv6 address of the remote host
1323 @param or_addr - outside IPv4 address of the remote host
1324 @param r_port - port number of the remote host (not used for ICMP)
1325 @param vrf_id - VRF id of tenant
1326 @param proto - protocol number
1328 define nat64_st_details {
1330 vl_api_ip6_address_t il_addr;
1331 vl_api_ip4_address_t ol_addr;
1334 vl_api_ip6_address_t ir_addr;
1335 vl_api_ip4_address_t or_addr;
1341 /** \brief Add/del NAT64 prefix
1342 @param client_index - opaque cookie to identify the sender
1343 @param context - sender context, to match reply w/ request
1344 @param prefix - NAT64 prefix
1345 @param vrf_id - VRF id of tenant
1346 @param is_add - true if add, false if delete
1348 autoreply define nat64_add_del_prefix {
1351 vl_api_ip6_prefix_t prefix;
1356 /** \brief Dump NAT64 prefix
1357 @param client_index - opaque cookie to identify the sender
1358 @param context - sender context, to match reply w/ request
1360 define nat64_prefix_dump {
1365 /** \brief Dump NAT64 prefix details response
1366 @param context - sender context, to match reply w/ request
1367 @param prefix - NAT64 prefix
1368 @param vrf_id - VRF id of tenant
1370 define nat64_prefix_details {
1372 vl_api_ip6_prefix_t prefix;
1376 /** \brief Add/delete NAT64 pool address from specific interfce
1377 @param client_index - opaque cookie to identify the sender
1378 @param context - sender context, to match reply w/ request
1379 @param is_add - true if add, false if delete
1380 @param sw_if_index - software index of the interface
1382 autoreply define nat64_add_del_interface_addr {
1386 vl_api_interface_index_t sw_if_index;
1392 /** \brief Enable/disable NAT66 feature on the interface
1393 @param client_index - opaque cookie to identify the sender
1394 @param context - sender context, to match reply w/ request
1395 @param is_add - true if add, false if delete
1396 @param flags - flag NAT_IS_INSIDE if interface is inside or
1397 interface is outside,
1398 @param sw_if_index - software index of the interface
1400 autoreply define nat66_add_del_interface {
1404 vl_api_nat_config_flags_t flags;
1405 vl_api_interface_index_t sw_if_index;
1408 /** \brief Dump interfaces with NAT66 feature
1409 @param client_index - opaque cookie to identify the sender
1410 @param context - sender context, to match reply w/ request
1412 define nat66_interface_dump {
1417 /** \brief NAT66 interface details response
1418 @param context - sender context, to match reply w/ request
1419 @param flags - flag NAT_IS_INSIDE if interface is inside or
1420 interface is outside,
1421 @param sw_if_index - software index of the interface
1423 define nat66_interface_details {
1425 vl_api_nat_config_flags_t flags;
1426 vl_api_interface_index_t sw_if_index;
1429 /** \brief Add/delete 1:1 NAT66
1430 @param client_index - opaque cookie to identify the sender
1431 @param context - sender context, to match reply w/ request
1432 @param is_add - true if add, false if delete
1433 @param local_ip_address - local IPv6 address
1434 @param external_ip_address - external IPv6 address
1435 @param vrf_id - VRF id of tenant
1437 autoreply define nat66_add_del_static_mapping {
1441 vl_api_ip6_address_t local_ip_address;
1442 vl_api_ip6_address_t external_ip_address;
1446 /** \brief Dump NAT66 static mappings
1447 @param client_index - opaque cookie to identify the sender
1448 @param context - sender context, to match reply w/ request
1450 define nat66_static_mapping_dump {
1455 /** \brief NAT66 static mapping details response
1456 @param context - sender context, to match reply w/ request
1457 @param local_ip_address - local IPv6 address
1458 @param external_ip_address - external IPv6 address
1459 @param vrf_id - VRF id of tenant
1460 @param total_bytes - count of bytes sent through static mapping
1461 @param total_pkts - count of pakets sent through static mapping
1463 define nat66_static_mapping_details {
1465 vl_api_ip6_address_t local_ip_address;
1466 vl_api_ip6_address_t external_ip_address;