2 * Copyright (c) 2020 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";
19 import "plugins/nat/nat_types.api";
23 * @brief VPP control-plane API messages.
25 * This file defines VPP control-plane API messages which are generally
26 * called through a shared memory interface.
30 * Common NAT plugin APIs
33 enum nat44_config_flags : u8
35 NAT44_IS_ENDPOINT_INDEPENDENT = 0x00,
36 NAT44_IS_ENDPOINT_DEPENDENT = 0x01,
37 NAT44_IS_STATIC_MAPPING_ONLY = 0x02,
38 NAT44_IS_CONNECTION_TRACKING = 0x04,
39 NAT44_IS_OUT2IN_DPO = 0x08,
42 /** \brief Enable/disable NAT44 plugin
43 @param client_index - opaque cookie to identify the sender
44 @param context - sender context, to match reply w/ request
45 @param inside_vrf - inside vrf id
46 @param outside_vrf - outside vrf id
47 @param users - maximum number of users per thread
48 (NAT44_IS_ENDPOINT_INDEPENDENT)
49 @param user_memory - overwrite hash allocation parameter
50 (NAT44_IS_ENDPOINT_INDEPENDENT)
51 @param sessions - maximum number of sessions per thread
52 @param session_memory - overwrite hash allocation parameter
53 @param user_sessions - maximum number of sessions per user
54 (NAT44_IS_ENDPOINT_INDEPENDENT)
55 @param enable - true if enable, false if disable
56 @param flags - flag NAT44_IS_ENDPOINT_INDEPENDENT,
57 NAT44_IS_ENDPOINT_DEPENDENT,
58 NAT44_IS_STATIC_MAPPING_ONLY,
59 NAT44_IS_CONNECTION_TRACKING,
62 autoreply define nat44_plugin_enable_disable {
73 vl_api_nat44_config_flags_t flags;
76 /** \brief Control ping from client to api server request
77 @param client_index - opaque cookie to identify the sender
78 @param context - sender context, to match reply w/ request
80 define nat_control_ping
87 /** \brief Control ping from the client to the server response
88 @param client_index - opaque cookie to identify the sender
89 @param context - sender context, to match reply w/ request
90 @param retval - return code for the request
91 @param vpe_pid - the pid of the vpe, returned by the server
93 define nat_control_ping_reply
102 /** \brief Show NAT plugin startup config
103 @param client_index - opaque cookie to identify the sender
104 @param context - sender context, to match reply w/ request
106 define nat_show_config
113 /** \brief DEPRECATED: Show NAT plugin startup config reply
114 @param context - sender context, to match reply w/ request
115 @param retval - return code for the request
116 @param static_mapping_only - if true dynamic translations disabled
117 @param static_mapping_connection_tracking - if true create session data
118 @param deterministic - if true deterministic mapping
119 @param endpoint_dependent - if true endpoint-dependent mode
120 @param out2in_dpo - if true out2in dpo mode
121 @param dslite_ce - if true DS-Lite is CE/B4 element, if false AFTR elemet
122 @param translation_buckets - number of translation hash buckets
123 @param translation_memory_size - translation hash memory size
124 @param user_buckets - number of user hash buckets
125 @param user_memory_size - user hash memory size
126 @param max_translations_per_user - maximum number of translations per user
127 @param outside_vrf_id - outside VRF id
128 @param inside_vrf_id - default inside VRF id
129 @param nat64_bib_buckets - number of NAT64 BIB hash buckets
130 @param nat64_bib_memory_size - memory size of NAT64 BIB hash
131 @param nat64_st_buckets - number of NAT64 session table hash buckets
132 @param nat64_st_memory_size - memory size of NAT64 session table hash
134 define nat_show_config_reply
139 bool static_mapping_only;
140 bool static_mapping_connection_tracking;
142 bool endpoint_dependent;
145 u32 translation_buckets;
146 u32 translation_memory_size;
148 u64 user_memory_size;
149 u32 max_translations_per_user;
152 u32 nat64_bib_buckets;
153 u64 nat64_bib_memory_size;
154 u32 nat64_st_buckets;
155 u64 nat64_st_memory_size;
158 /** \brief Show NAT plugin startup config
159 @param client_index - opaque cookie to identify the sender
160 @param context - sender context, to match reply w/ request
162 define nat_show_config_2
169 /** \brief Show NAT plugin startup config reply
170 @param context - sender context, to match reply w/ request
171 @param retval - return code for the request
172 @param static_mapping_only - if true dynamic translations disabled
173 @param static_mapping_connection_tracking - if true create session data
174 @param deterministic - if true deterministic mapping
175 @param endpoint_dependent - if true endpoint-dependent mode
176 @param out2in_dpo - if true out2in dpo mode
177 @param dslite_ce - if true DS-Lite is CE/B4 element, if false AFTR elemet
178 @param translation_buckets - number of translation hash buckets
179 @param translation_memory_size - translation hash memory size
180 @param user_buckets - number of user hash buckets
181 @param user_memory_size - user hash memory size
182 @param max_translations_per_user - maximum number of translations per user
183 @param outside_vrf_id - outside VRF id
184 @param inside_vrf_id - default inside VRF id
185 @param nat64_bib_buckets - number of NAT64 BIB hash buckets
186 @param nat64_bib_memory_size - memory size of NAT64 BIB hash
187 @param nat64_st_buckets - number of NAT64 session table hash buckets
188 @param nat64_st_memory_size - memory size of NAT64 session table hash
189 @param max_translations_per_thread - max translations per worker thread
190 @param max_users_per_thread - max users per worker thread
192 define nat_show_config_2_reply
197 bool static_mapping_only;
198 bool static_mapping_connection_tracking;
200 bool endpoint_dependent;
203 u32 translation_buckets;
204 u64 translation_memory_size;
206 u64 user_memory_size;
207 u32 max_translations_per_user;
210 u32 nat64_bib_buckets;
211 u64 nat64_bib_memory_size;
212 u32 nat64_st_buckets;
213 u64 nat64_st_memory_size;
214 u32 max_translations_per_thread;
215 u32 max_users_per_thread;
218 /** \brief Show NAT44 plugin running config
219 @param client_index - opaque cookie to identify the sender
220 @param context - sender context, to match reply w/ request
222 define nat44_show_running_config
229 /** \brief Show NAT44 plugin running config reply
230 @param context - sender context, to match reply w/ request
231 @param retval - return code for the request
232 @param inside_vrf - default inside VRF id
233 @param outside_vrf - outside VRF id
234 @param users - maximum number of users per worker thread
235 (NAT44_IS_ENDPOINT_INDEPENDENT)
236 @param sessions - maximum number of sessions per worker thread
237 @param user_sessions - maximum number of sessions per user
238 (NAT44_IS_ENDPOINT_INDEPENDENT)
239 @param user_buckets - number of user hash buckets
240 (NAT44_IS_ENDPOINT_INDEPENDENT)
241 @param translation_buckets - number of translation hash buckets
242 @param flags - flag NAT44_IS_ENDPOINT_INDEPENDENT,
243 NAT44_IS_ENDPOINT_DEPENDENT,
244 NAT44_IS_STATIC_MAPPING_ONLY,
245 NAT44_IS_CONNECTION_TRACKING,
248 define nat44_show_running_config_reply
262 u32 translation_buckets;
264 vl_api_nat44_config_flags_t flags;
267 enum nat_log_level : u8
270 NAT_LOG_ERROR = 0x01,
271 NAT_LOG_WARNING = 0x02,
272 NAT_LOG_NOTICE = 0x03,
274 NAT_LOG_DEBUG = 0x05,
277 /** \brief Run nat44 garbage collection
278 @param client_index - opaque cookie to identify the sender
279 @param context - sender context, to match reply w/ request
281 autoreply define nat44_session_cleanup {
287 /** \brief NAT44 set session limit
288 @param client_index - opaque cookie to identify the sender
289 @param context - sender context, to match reply w/ request
290 @param session_limit - session limit
291 @param vrf_id - vrf id
293 autoreply define nat44_set_session_limit {
300 /** \brief Set NAT logging level
301 @param client_index - opaque cookie to identify the sender
302 @param context - sender context, to match reply w/ request
303 @param log_level - logging level
305 autoreply define nat_set_log_level {
308 vl_api_nat_log_level_t log_level;
311 /** \brief Set NAT workers
312 @param client_index - opaque cookie to identify the sender
313 @param context - sender context, to match reply w/ request
314 @param worker_mask - NAT workers mask
316 autoreply define nat_set_workers {
322 /** \brief Dump NAT workers
323 @param client_index - opaque cookie to identify the sender
324 @param context - sender context, to match reply w/ request
326 define nat_worker_dump {
331 /** \brief NAT workers details response
332 @param context - sender context, to match reply w/ request
333 @param worker_index - worker index
334 @param lcore_id - lcore ID
335 @param name - worker name
337 define nat_worker_details {
344 /** \brief Enable/disable NAT IPFIX logging
345 @param client_index - opaque cookie to identify the sender
346 @param context - sender context, to match reply w/ request
347 @param domain_id - observation domain ID
348 @param src_port - source port number
349 @param enable - true if enable, false if disable
351 autoreply define nat_ipfix_enable_disable {
359 /** \brief Set values of timeouts for NAT sessions (seconds)
360 @param client_index - opaque cookie to identify the sender
361 @param context - sender context, to match reply w/ request
362 @param udp - UDP timeout (default 300sec)
363 @param tcp_established - TCP established timeout (default 7440sec)
364 @param tcp_transitory - TCP transitory timeout (default 240sec)
365 @param icmp - ICMP timeout (default 60sec)
367 autoreply define nat_set_timeouts {
376 /** \brief Get values of timeouts for NAT sessions (seconds)
377 @param client_index - opaque cookie to identify the sender
378 @param context - sender context, to match reply w/ request
380 define nat_get_timeouts {
385 /** \brief Get values of timeouts for NAT sessions reply
386 @param context - sender context, to match reply w/ request
387 @param retval - return code
388 @param udp - UDP timeout
389 @param tcp_established - TCP established timeout
390 @param tcp_transitory - TCP transitory timeout
391 @param icmp - ICMP timeout
393 define nat_get_timeouts_reply {
402 /** \brief Set address and port assignment algorithm
403 @param client_index - opaque cookie to identify the sender
404 @param context - sender context, to match reply w/ request
405 @param alg - address and port assignment algorithm:
406 0 - default, 1 - MAP-E, 2 - port range
407 (see nat_addr_and_port_alloc_alg_t in nat.h)
408 @param psid_offset - number of offset bits (valid only for MAP-E alg)
409 @param psid_length - length of PSID (valid only for MAP-E alg)
410 @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
411 @param start_port - beginning of the port range
412 @param end_port - end of the port range
414 autoreply define nat_set_addr_and_port_alloc_alg {
425 /** \brief Get address and port assignment algorithm
426 @param client_index - opaque cookie to identify the sender
427 @param context - sender context, to match reply w/ request
429 define nat_get_addr_and_port_alloc_alg {
434 /** \brief Get address and port assignment algorithm reply
435 @param context - sender context, to match reply w/ request
436 @param retval - return code
437 @param alg - address and port assignment algorithm:
438 0 - default, 1 - MAP-E, 2 - port range
439 (see nat_addr_and_port_alloc_alg_t in nat.h)
440 @param psid_offset - number of offset bits (valid only for MAP-E alg)
441 @param psid_length - length of PSID (valid only for MAP-E alg)
442 @param psid - Port Set Identifier (PSID) value (valid only for MAP-E alg)
443 @param start_port - beginning of the port range
444 @param end_port - end of the port range
446 define nat_get_addr_and_port_alloc_alg_reply {
457 /** \brief Set TCP MSS rewriting configuration
458 @param client_index - opaque cookie to identify the sender
459 @param context - sender context, to match reply w/ request
460 @param mss_value - MSS value to be used for MSS rewriting
461 @param enable - if true enable MSS rewriting feature else disable
463 autoreply define nat_set_mss_clamping {
470 /** \brief Get TCP MSS rewriting configuration
471 @param client_index - opaque cookie to identify the sender
472 @param context - sender context, to match reply w/ request
474 define nat_get_mss_clamping {
479 /** \brief Get TCP MSS rewriting configuration reply
480 @param context - sender context, to match reply w/ request
481 @param retval - return code
482 @param mss_value - MSS value to be used for MSS rewriting
483 @param enable - if true enable MSS rewriting feature else disable
485 define nat_get_mss_clamping_reply {
492 /** \brief Set HA listener (local settings)
493 @param client_index - opaque cookie to identify the sender
494 @param context - sender context, to match reply w/ request
495 @param ip_address - local IP4 address
496 @param port - local UDP port number
497 @param path_mtu - path MTU between local and failover
499 autoreply define nat_ha_set_listener {
502 vl_api_ip4_address_t ip_address;
507 /** \brief Set HA failover (remote settings)
508 @param client_index - opaque cookie to identify the sender
509 @param context - sender context, to match reply w/ request
510 @param ip_address - failover IP4 address
511 @param port - failvoer UDP port number
512 @param session_refresh_interval - number of seconds after which to send
513 session counters refresh
515 autoreply define nat_ha_set_failover {
518 vl_api_ip4_address_t ip_address;
520 u32 session_refresh_interval;
523 /** \brief Get HA listener/local configuration
524 @param client_index - opaque cookie to identify the sender
525 @param context - sender context, to match reply w/ request
527 define nat_ha_get_listener {
532 /** \brief Get HA listener/local configuration reply
533 @param context - sender context, to match reply w/ request
534 @param retval - return code
535 @param ip_address - local IP4 address
536 @param port - local UDP port number
537 @param path_mtu - Path MTU between local and failover
539 define nat_ha_get_listener_reply {
542 vl_api_ip4_address_t ip_address;
547 /** \brief Get HA failover/remote settings
548 @param client_index - opaque cookie to identify the sender
549 @param context - sender context, to match reply w/ request
551 define nat_ha_get_failover {
556 /** \brief Get HA failover/remote settings reply
557 @param context - sender context, to match reply w/ request
558 @param retval - return code
559 @param ip_address - failover IP4 address
560 @param port - failvoer UDP port number
561 @param session_refresh_interval - number of seconds after which to send
562 session counters refresh
564 define nat_ha_get_failover_reply {
567 vl_api_ip4_address_t ip_address;
569 u32 session_refresh_interval;
572 /** \brief Flush the current HA data (for testing)
573 @param client_index - opaque cookie to identify the sender
574 @param context - sender context, to match reply w/ request
576 autoreply define nat_ha_flush {
581 /** \brief Resync HA (resend existing sessions to new failover)
582 @param client_index - opaque cookie to identify the sender
583 @param context - sender context, to match reply w/ request
584 @param want_resync_event - resync completed event sent to the sender via
585 nat_ha_resync_completed_event API message if
587 @param pid - sender's pid
589 autoreply define nat_ha_resync
593 u8 want_resync_event;
597 /** \brief Tell client about a HA resync completion event
598 @param client_index - opaque cookie to identify the sender
599 @param pid - client pid registered to receive notification
600 @param missed_count - number of missed (not ACKed) messages
602 define nat_ha_resync_completed_event
610 rpc nat_ha_resync returns nat_ha_resync_reply events nat_ha_resync_completed_event;
617 /** \brief Del NAT44 user
618 @param client_index - opaque cookie to identify the sender
619 @param context - sender context, to match reply w/ request
620 @param ip_address - IPv4 address
621 @param fib_index - FIB index
623 autoreply define nat44_del_user {
626 vl_api_ip4_address_t ip_address;
630 /** \brief Add/del NAT44 address range
631 @param client_index - opaque cookie to identify the sender
632 @param context - sender context, to match reply w/ request
633 @param first_ip_address - first IPv4 address
634 @param last_ip_address - last IPv4 address
635 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
636 @param is_add - true if add, false if delete
637 @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
640 autoreply define nat44_add_del_address_range {
643 vl_api_ip4_address_t first_ip_address;
644 vl_api_ip4_address_t last_ip_address;
647 vl_api_nat_config_flags_t flags;
650 /** \brief Dump NAT44 addresses
651 @param client_index - opaque cookie to identify the sender
652 @param context - sender context, to match reply w/ request
654 define nat44_address_dump {
659 /** \brief NAT44 address details response
660 @param context - sender context, to match reply w/ request
661 @param ip_address - IPv4 address
662 @param flags - flag NAT_IS_TWICE_NAT if NAT address range for external hosts
663 @param vrf_id - VRF id of tenant, ~0 means independent of VRF
665 define nat44_address_details {
667 vl_api_ip4_address_t ip_address;
668 vl_api_nat_config_flags_t flags;
672 /** \brief Enable/disable NAT44 feature on the interface
673 @param client_index - opaque cookie to identify the sender
674 @param context - sender context, to match reply w/ request
675 @param is_add - true if add, false if delete
676 @param flags - flag NAT_IS_INSIDE if interface is inside else
678 @param sw_if_index - software index of the interface
680 autoreply define nat44_interface_add_del_feature {
684 vl_api_nat_config_flags_t flags;
685 vl_api_interface_index_t sw_if_index;
688 /** \brief Dump interfaces with NAT44 feature
689 @param client_index - opaque cookie to identify the sender
690 @param context - sender context, to match reply w/ request
692 define nat44_interface_dump {
697 /** \brief NAT44 interface details response
698 @param context - sender context, to match reply w/ request
699 @param sw_if_index - software index of the interface
700 @param flags - flag NAT_IS_INSIDE if interface is inside,
701 flag NAT_IS_OUTSIDE if interface is outside
702 and if both flags are set the interface is
703 both inside and outside
705 define nat44_interface_details {
707 vl_api_nat_config_flags_t flags;
708 vl_api_interface_index_t sw_if_index;
711 /** \brief Enable/disbale NAT44 as an interface output feature (postrouting
713 @param client_index - opaque cookie to identify the sender
714 @param context - sender context, to match reply w/ request
715 @param is_add - true if add, false if delete
716 @param flags - flag NAT_IS_INSIDE if interface is inside else
718 @param sw_if_index - software index of the interface
720 autoreply define nat44_interface_add_del_output_feature {
724 vl_api_nat_config_flags_t flags;
725 vl_api_interface_index_t sw_if_index;
728 /** \brief Dump interfaces with NAT44 output feature
729 @param client_index - opaque cookie to identify the sender
730 @param context - sender context, to match reply w/ request
732 define nat44_interface_output_feature_dump {
737 /** \brief NAT44 interface with output feature details response
738 @param context - sender context, to match reply w/ request
739 @param flags - flag NAT_IS_INSIDE if interface is inside else
741 @param sw_if_index - software index of the interface
743 define nat44_interface_output_feature_details {
745 vl_api_nat_config_flags_t flags;
746 vl_api_interface_index_t sw_if_index;
749 /** \brief Add/delete NAT44 static mapping
750 @param client_index - opaque cookie to identify the sender
751 @param context - sender context, to match reply w/ request
752 @param is_add - true if add, false if delete
753 @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
754 flag nat_is_twice_nat if nat address range for external hosts,
755 flag NAT_IS_SELF_TWICE_NAT if translate external host address
756 and port whenever external host address equals local
757 address of internal host,
758 flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
759 @param local_ip_address - local IPv4 address
760 @param external_ip_address - external IPv4 address
761 @param protocol - IP protocol, used only if addr_only=0
762 @param local_port - local port number, used only if addr_only=0
763 @param external_port - external port number, used only if addr_only=0
764 @param external_sw_if_index - external interface (if set
765 external_ip_address is ignored, ~0 means not
767 @param vfr_id - VRF ID
768 @param tag - opaque string tag
770 autoreply define nat44_add_del_static_mapping {
774 vl_api_nat_config_flags_t flags;
775 vl_api_ip4_address_t local_ip_address;
776 vl_api_ip4_address_t external_ip_address;
780 vl_api_interface_index_t external_sw_if_index;
785 /** \brief Add/delete NAT44 static mapping
786 @param client_index - opaque cookie to identify the sender
787 @param context - sender context, to match reply w/ request
788 @param is_add - true if add, false if delete
789 @param match_pool - true if use specific pool_ip_address
790 @param flags - flag NAT_IS_ADDR_ONLY if address only mapping,
791 flag nat_is_twice_nat if nat address range for external hosts,
792 flag NAT_IS_SELF_TWICE_NAT if translate external host address
793 and port whenever external host address equals local
794 address of internal host,
795 flag NAT_IS_OUT2IN_ONLY if rule match only out2in direction
796 @param pool_ip_address - pool IPv4 address to match with pool
797 @param local_ip_address - local IPv4 address
798 @param external_ip_address - external IPv4 address
799 @param protocol - IP protocol, used only if addr_only=0
800 @param local_port - local port number, used only if addr_only=0
801 @param external_port - external port number, used only if addr_only=0
802 @param external_sw_if_index - external interface (if set
803 external_ip_address is ignored, ~0 means not
805 @param vfr_id - VRF ID
806 @param tag - opaque string tag
808 autoreply define nat44_add_del_static_mapping_v2 {
814 vl_api_nat_config_flags_t flags;
815 vl_api_ip4_address_t pool_ip_address;
816 vl_api_ip4_address_t local_ip_address;
817 vl_api_ip4_address_t external_ip_address;
821 vl_api_interface_index_t external_sw_if_index;
826 /** \brief Dump NAT44 static mappings
827 @param client_index - opaque cookie to identify the sender
828 @param context - sender context, to match reply w/ request
830 define nat44_static_mapping_dump {
835 /** \brief NAT44 static mapping details response
836 @param context - sender context, to match reply w/ request
837 @param flags - flag NAT_ADDR_ONLY if address only mapping,
838 flag NAT_TWICE_NAT if NAT address range for external hosts,
839 flag NAT_SELF_TWICE_NAT if translate external host address
840 and port whenever external host address equals local
841 address of internal host,
842 flag NAT_OUT2IN_ONLY if rule match only out2in direction
843 @param local_ip_address - local IPv4 address
844 @param external_ip_address - external IPv4 address
845 @param protocol - IP protocol, valid only if no NAT_ADDR_ONLY flag
846 @param local_port - local port number, valid only if no NAT_ADDR_ONLY flag
847 @param external_port - external port number, valid only if no NAT_ADDR_ONLY flag
848 @param external_sw_if_index - external interface
849 @param vfr_id - VRF ID
850 @param tag - opaque string tag
852 define nat44_static_mapping_details {
854 vl_api_nat_config_flags_t flags;
855 vl_api_ip4_address_t local_ip_address;
856 vl_api_ip4_address_t external_ip_address;
860 vl_api_interface_index_t external_sw_if_index;
865 /** \brief Add/delete NAT44 identity mapping
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 flags - flag NAT_ADDR_ONLY if address only mapping
870 @param ip_address - IPv4 address
871 @param protocol - IP protocol
872 @param port - port number
873 @param sw_if_index - interface (if set ip_address is ignored, ~0 means not
875 @param vfr_id - VRF ID (if ~0 use default VRF)
876 @param tag - opaque string tag
878 autoreply define nat44_add_del_identity_mapping {
882 vl_api_nat_config_flags_t flags;
883 vl_api_ip4_address_t ip_address;
886 vl_api_interface_index_t sw_if_index;
891 /** \brief Dump NAT44 identity mappings
892 @param client_index - opaque cookie to identify the sender
893 @param context - sender context, to match reply w/ request
895 define nat44_identity_mapping_dump {
900 /** \brief NAT44 identity mapping details response
901 @param context - sender context, to match reply w/ request
902 @param flags - flag NAT_ADDR_ONLY if address only mapping
903 @param ip_address - IPv4 address
904 @param protocol - IP protocol
905 @param port - port number
906 @param sw_if_index - interface
907 @param vfr_id - VRF ID
908 @param tag - opaque string tag
910 define nat44_identity_mapping_details {
912 vl_api_nat_config_flags_t flags;
913 vl_api_ip4_address_t ip_address;
916 vl_api_interface_index_t sw_if_index;
921 /** \brief Add/delete NAT44 pool address from specific interfce
922 @param client_index - opaque cookie to identify the sender
923 @param context - sender context, to match reply w/ request
924 @param is_add - true if add, false if delete
925 @param sw_if_index - software index of the interface
926 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
928 autoreply define nat44_add_del_interface_addr {
932 vl_api_interface_index_t sw_if_index;
933 vl_api_nat_config_flags_t flags;
936 /** \brief Dump NAT44 pool addresses interfaces
937 @param client_index - opaque cookie to identify the sender
938 @param context - sender context, to match reply w/ request
940 define nat44_interface_addr_dump {
945 /** \brief NAT44 pool addresses interfaces details response
946 @param context - sender context, to match reply w/ request
947 @param sw_if_index - software index of the interface
948 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts
951 define nat44_interface_addr_details {
953 vl_api_interface_index_t sw_if_index;
954 vl_api_nat_config_flags_t flags;
957 /** \brief Dump NAT44 users
958 @param client_index - opaque cookie to identify the sender
959 @param context - sender context, to match reply w/ request
961 define nat44_user_dump {
966 /** \brief NAT44 users response
967 @param context - sender context, to match reply w/ request
969 @param ip_address - IPv4 address
970 @param nsessions - number of dynamic sessions
971 @param nstaticsessions - number of static sessions
973 define nat44_user_details {
976 vl_api_ip4_address_t ip_address;
981 /** \brief NAT44 user's sessions
982 @param client_index - opaque cookie to identify the sender
983 @param context - sender context, to match reply w/ request
984 @param ip_address - IPv4 address of the user to dump
985 @param vrf_id - VRF_ID
987 define nat44_user_session_dump {
990 vl_api_ip4_address_t ip_address;
994 /** \brief NAT44 user's sessions response
995 @param context - sender context, to match reply w/ request
996 @param outside_ip_address - outside IPv4 address
997 @param outside_port - outside port
998 @param inside_ip_address - inside IPv4 address
999 @param inside_port - inside port
1000 @param protocol - protocol
1001 @param flags - flag NAT_IS_STATIC if session is static,
1002 flag NAT_IS_TWICE_NAT if session is twice-nat,
1003 flag NAT_IS_EXT_HOST_VALID if external host address
1005 @param last_heard - last heard timer
1006 @param total_bytes - count of bytes sent through session
1007 @param total_pkts - count of pakets sent through session
1008 @param ext_host_address - external host IPv4 address
1009 @param ext_host_port - external host port
1010 @param ext_host_nat_address - post-NAT external host IPv4 address (valid
1011 only if twice-nat session)
1012 @param ext_host_nat_port - post-NAT external host port (valid only if
1015 define nat44_user_session_details {
1017 vl_api_ip4_address_t outside_ip_address;
1019 vl_api_ip4_address_t inside_ip_address;
1022 vl_api_nat_config_flags_t flags;
1026 vl_api_ip4_address_t ext_host_address;
1028 vl_api_ip4_address_t ext_host_nat_address;
1029 u16 ext_host_nat_port;
1032 /** \brief NAT44 load-balancing address and port pair
1033 @param addr - IPv4 address of the internal node
1034 @param port - L4 port number of the internal node
1035 @param probability - probability of the internal node to be randomly matched
1036 @param vrf_id - VRF id
1038 typedef nat44_lb_addr_port {
1039 vl_api_ip4_address_t addr;
1045 /** \brief Add/delete NAT44 load-balancing static mapping rule
1046 @param client_index - opaque cookie to identify the sender
1047 @param context - sender context, to match reply w/ request
1048 @param is_add - true if add, false if delete
1049 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
1050 flag NAT_SELF_TWICE_NAT if translate external host address
1051 and port whenever external host address equals local
1052 address of internal host,
1053 flag NAT_OUT2IN_ONLY if rule match only out2in direction
1054 @param external_addr - external IPv4 address of the service
1055 @param external_port - external L4 port number of the service
1056 @param protocol - IP protocol number of the service
1057 @param affinity - if 0 disabled, otherwise client IP affinity sticky time
1059 @param local_num - number of local network nodes
1060 @param locals - local network nodes
1061 @param tag - opaque string tag
1063 autoreply manual_endian define nat44_add_del_lb_static_mapping {
1067 vl_api_nat_config_flags_t flags;
1068 vl_api_ip4_address_t external_addr;
1074 vl_api_nat44_lb_addr_port_t locals[local_num];
1077 /** \brief Add/delete NAT44 load-balancing static mapping rule backend
1078 @param client_index - opaque cookie to identify the sender
1079 @param context - sender context, to match reply w/ request
1080 @param is_add - true if add, false if delete
1081 @param external_addr - external IPv4 address of the service
1082 @param external_port - external L4 port number of the service
1083 @param protocol - IP protocol number of the service
1084 @param local - local network node
1086 autoreply define nat44_lb_static_mapping_add_del_local {
1090 vl_api_ip4_address_t external_addr;
1093 vl_api_nat44_lb_addr_port_t local;
1096 /** \brief Dump NAT44 load-balancing static mapping rules
1097 @param client_index - opaque cookie to identify the sender
1098 @param context - sender context, to match reply w/ request
1100 define nat44_lb_static_mapping_dump {
1105 /** \brief NAT44 load-balancing static mapping rule details response
1106 @param context - sender context, to match reply w/ request
1107 @param external_addr - external IPv4 address of the service
1108 @param external_port - external L4 port number of the service
1109 @param protocol - IP protocol number of the service
1110 @param flags - flag NAT_TWICE_NAT if NAT address range for external hosts,
1111 flag NAT_SELF_TWICE_NAT if translate external host address
1112 and port whenever external host address equals local
1113 address of internal host,
1114 flag NAT_OUT2IN_ONLY if rule match only out2in direction
1115 @param affinity - if 0 disabled, otherwise client IP affinity sticky time
1117 @param local_num - number of local network nodes
1118 @param locals - local network nodes
1119 @param tag - opaque string tag
1121 manual_endian define nat44_lb_static_mapping_details {
1123 vl_api_ip4_address_t external_addr;
1126 vl_api_nat_config_flags_t flags;
1130 vl_api_nat44_lb_addr_port_t locals[local_num];
1133 /** \brief Delete NAT44 session
1134 @param client_index - opaque cookie to identify the sender
1135 @param context - sender context, to match reply w/ request
1136 @param ip_address - IPv4 address
1137 @param protocol - IP protocol
1138 @param port - port number
1139 @param vfr_id - VRF ID
1140 @param flags - flag NAT_IS_INSIDE if interface is inside or
1141 interface is outside,
1142 flag NAT_IS_EXT_HOST_VALID if external host address and
1144 @param ext_host_address - external host IPv4 address
1145 @param ext_host_port - external host port
1147 autoreply define nat44_del_session {
1150 vl_api_ip4_address_t address;
1154 vl_api_nat_config_flags_t flags;
1155 vl_api_ip4_address_t ext_host_address;
1159 /** \brief Enable/disable forwarding for NAT44
1160 Forward packets which don't match existing translation
1161 or static mapping instead of dropping them.
1162 @param client_index - opaque cookie to identify the sender
1163 @param context - sender context, to match reply w/ request
1164 @param enable - true for enable, false for disable
1166 autoreply define nat44_forwarding_enable_disable {
1172 /** \brief Check if forwarding is enabled or disabled
1173 @param client_index - opaque cookie to identify the sender
1174 @param context - sender context, to match reply w/ request
1176 define nat44_forwarding_is_enabled {
1181 /** \brief Response to check if forwarding is enabled or disabled
1182 @param context - sender context, to match reply w/ request
1183 @param enabled - true if enabled, false if disabled
1185 define nat44_forwarding_is_enabled_reply {