aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_papi_provider.py
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-06-06 04:53:28 -0700
committerOle Trøan <otroan@employees.org>2017-06-08 11:39:53 +0000
commit06596c54dc51e35222737b01c617cc675505a260 (patch)
tree0ee02baf650e9ab217ee4c3c64913dfac6ce68ff /test/vpp_papi_provider.py
parent2fcc49d9c6a66c49148d5790f6af38ab2f3b4be6 (diff)
NAT64: Add NAT64 support for snat plugin (VPP-699)
Basic NAT64 feature (no hairpinning, no multi-thread). Change-Id: I392fccbce93e70c117f4a9a7ec7cf08d6c537f2d Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'test/vpp_papi_provider.py')
-rw-r--r--test/vpp_papi_provider.py118
1 files changed, 118 insertions, 0 deletions
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index b310d094b3f..4c02a34903c 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -1327,6 +1327,124 @@ class VppPapiProvider(object):
{'is_ip4': is_ip4,
'user_addr': user_addr})
+ def nat64_add_del_pool_addr_range(
+ self,
+ start_addr,
+ end_addr,
+ vrf_id=0xFFFFFFFF,
+ is_add=1):
+ """Add/del address range to NAT64 pool
+
+ :param start_addr: First IP address
+ :param end_addr: Last IP address
+ :param vrf_id: VRF id for the address range
+ :param is_add: 1 if add, 0 if delete (Default value = 1)
+ """
+ return self.api(
+ self.papi.nat64_add_del_pool_addr_range,
+ {'start_addr': start_addr,
+ 'end_addr': end_addr,
+ 'vrf_id': vrf_id,
+ 'is_add': is_add})
+
+ def nat64_pool_addr_dump(self):
+ """Dump NAT64 pool addresses
+ :return: Dictionary of NAT64 pool addresses
+ """
+ return self.api(self.papi.nat64_pool_addr_dump, {})
+
+ def nat64_add_del_interface(
+ self,
+ sw_if_index,
+ is_inside=1,
+ is_add=1):
+ """Enable/disable NAT64 feature on the interface
+ :param sw_if_index: Index of the interface
+ :param is_inside: 1 if inside, 0 if outside (Default value = 1)
+ :param is_add: 1 if add, 0 if delete (Default value = 1)
+ """
+ return self.api(
+ self.papi.nat64_add_del_interface,
+ {'sw_if_index': sw_if_index,
+ 'is_inside': is_inside,
+ 'is_add': is_add})
+
+ def nat64_interface_dump(self):
+ """Dump interfaces with NAT64 feature
+ :return: Dictionary of interfaces with NAT64 feature
+ """
+ return self.api(self.papi.nat64_interface_dump, {})
+
+ def nat64_add_del_static_bib(
+ self,
+ in_ip,
+ out_ip,
+ in_port,
+ out_port,
+ protocol,
+ vrf_id=0,
+ is_add=1):
+ """Add/delete S-NAT static BIB entry
+
+ :param in_ip: Inside IPv6 address
+ :param out_ip: Outside IPv4 address
+ :param in_port: Inside port number
+ :param out_port: Outside port number
+ :param protocol: IP protocol
+ :param vrf_id: VRF ID (Default value = 0)
+ :param is_add: 1 if add, 0 if delete (Default value = 1)
+ """
+ return self.api(
+ self.papi.nat64_add_del_static_bib,
+ {'i_addr': in_ip,
+ 'o_addr': out_ip,
+ 'i_port': in_port,
+ 'o_port': out_port,
+ 'vrf_id': vrf_id,
+ 'proto': protocol,
+ 'is_add': is_add})
+
+ def nat64_bib_dump(self, protocol):
+ """Dump NAT64 BIB
+
+ :param protocol: IP protocol
+ :returns: Dictionary of NAT64 BIB entries
+ """
+ return self.api(self.papi.nat64_bib_dump, {'proto': protocol})
+
+ def nat64_set_timeouts(self, udp=300, icmp=60, tcp_trans=240, tcp_est=7440,
+ tcp_incoming_syn=6):
+ """Set values of timeouts for NAT64 (in seconds)
+
+ :param udp - UDP timeout (Default value = 300)
+ :param icmp - ICMP timeout (Default value = 60)
+ :param tcp_trans - TCP transitory timeout (Default value = 240)
+ :param tcp_est - TCP established timeout (Default value = 7440)
+ :param tcp_incoming_syn - TCP incoming SYN timeout (Default value = 6)
+ """
+ return self.api(
+ self.papi.nat64_set_timeouts,
+ {'udp': udp,
+ 'icmp': icmp,
+ 'tcp_trans': tcp_trans,
+ 'tcp_est': tcp_est,
+ 'tcp_incoming_syn': tcp_incoming_syn})
+
+ def nat64_get_timeouts(self):
+ """Get values of timeouts for NAT64
+
+ :return: Timeouts for NAT64 (in seconds)
+ """
+ return self.api(self.papi.nat64_get_timeouts, {})
+
+ def nat64_st_dump(self, protocol):
+ """Dump NAT64 session table
+
+ :param protocol: IP protocol
+ :returns: Dictionary of NAT64 sesstion table entries
+ """
+ return self.api(self.papi.nat64_st_dump, {'proto': protocol})
+
def control_ping(self):
self.api(self.papi.control_ping)