aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_papi_provider.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/vpp_papi_provider.py')
-rw-r--r--test/vpp_papi_provider.py187
1 files changed, 87 insertions, 100 deletions
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 95de0be6f2c..61db4d6b14b 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -1061,41 +1061,41 @@ class VppPapiProvider(object):
'mt_next_hop_table_id': next_hop_table_id,
'mt_next_hop_out_label_stack': next_hop_out_label_stack})
- def snat_interface_add_del_feature(
+ def nat44_interface_add_del_feature(
self,
sw_if_index,
is_inside=1,
is_add=1):
- """Enable/disable S-NAT feature on the interface
+ """Enable/disable NAT44 feature on the interface
:param sw_if_index: Software 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.snat_interface_add_del_feature,
+ self.papi.nat44_interface_add_del_feature,
{'is_add': is_add,
'is_inside': is_inside,
'sw_if_index': sw_if_index})
- def snat_interface_add_del_output_feature(
+ def nat44_interface_add_del_output_feature(
self,
sw_if_index,
is_inside=1,
is_add=1):
- """Enable/disable S-NAT output feature on the interface
+ """Enable/disable NAT44 output feature on the interface
:param sw_if_index: Software 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.snat_interface_add_del_output_feature,
+ self.papi.nat44_interface_add_del_output_feature,
{'is_add': is_add,
'is_inside': is_inside,
'sw_if_index': sw_if_index})
- def snat_add_static_mapping(
+ def nat44_add_del_static_mapping(
self,
local_ip,
external_ip=0,
@@ -1105,9 +1105,8 @@ class VppPapiProvider(object):
addr_only=1,
vrf_id=0,
protocol=0,
- is_add=1,
- is_ip4=1):
- """Add/delete S-NAT static mapping
+ is_add=1):
+ """Add/delete NAT44 static mapping
:param local_ip: Local IP address
:param external_ip: External IP address
@@ -1118,12 +1117,10 @@ class VppPapiProvider(object):
:param vrf_id: VRF ID
:param protocol: IP protocol (Default value = 0)
:param is_add: 1 if add, 0 if delete (Default value = 1)
- :param is_ip4: 1 if address type is IPv4 (Default value = 1)
"""
return self.api(
- self.papi.snat_add_static_mapping,
+ self.papi.nat44_add_del_static_mapping,
{'is_add': is_add,
- 'is_ip4': is_ip4,
'addr_only': addr_only,
'local_ip_address': local_ip,
'external_ip_address': external_ip,
@@ -1133,100 +1130,96 @@ class VppPapiProvider(object):
'vrf_id': vrf_id,
'protocol': protocol})
- def snat_add_address_range(
+ def nat44_add_del_address_range(
self,
first_ip_address,
last_ip_address,
is_add=1,
- is_ip4=1,
vrf_id=0xFFFFFFFF):
- """Add/del S-NAT address range
+ """Add/del NAT44 address range
:param first_ip_address: First IP address
:param last_ip_address: Last IP address
:param vrf_id: VRF id for the address range
:param is_add: 1 if add, 0 if delete (Default value = 1)
- :param is_ip4: 1 if address type is IPv4 (Default value = 1)
"""
return self.api(
- self.papi.snat_add_address_range,
- {'is_ip4': is_ip4,
- 'first_ip_address': first_ip_address,
+ self.papi.nat44_add_del_address_range,
+ {'first_ip_address': first_ip_address,
'last_ip_address': last_ip_address,
'vrf_id': vrf_id,
'is_add': is_add})
- def snat_address_dump(self):
- """Dump S-NAT addresses
- :return: Dictionary of S-NAT addresses
+ def nat44_address_dump(self):
+ """Dump NAT44 addresses
+ :return: Dictionary of NAT44 addresses
"""
- return self.api(self.papi.snat_address_dump, {})
+ return self.api(self.papi.nat44_address_dump, {})
- def snat_interface_dump(self):
- """Dump interfaces with S-NAT feature
- :return: Dictionary of interfaces with S-NAT feature
+ def nat44_interface_dump(self):
+ """Dump interfaces with NAT44 feature
+ :return: Dictionary of interfaces with NAT44 feature
"""
- return self.api(self.papi.snat_interface_dump, {})
+ return self.api(self.papi.nat44_interface_dump, {})
- def snat_interface_output_feature_dump(self):
- """Dump interfaces with S-NAT output feature
- :return: Dictionary of interfaces with S-NAT output feature
+ def nat44_interface_output_feature_dump(self):
+ """Dump interfaces with NAT44 output feature
+ :return: Dictionary of interfaces with NAT44 output feature
"""
- return self.api(self.papi.snat_interface_output_feature_dump, {})
+ return self.api(self.papi.nat44_interface_output_feature_dump, {})
- def snat_static_mapping_dump(self):
- """Dump S-NAT static mappings
- :return: Dictionary of S-NAT static mappings
+ def nat44_static_mapping_dump(self):
+ """Dump NAT44 static mappings
+ :return: Dictionary of NAT44 static mappings
"""
- return self.api(self.papi.snat_static_mapping_dump, {})
+ return self.api(self.papi.nat44_static_mapping_dump, {})
- def snat_show_config(self):
- """Show S-NAT config
- :return: S-NAT config parameters
+ def nat_show_config(self):
+ """Show NAT plugin config
+ :return: NAT plugin config parameters
"""
- return self.api(self.papi.snat_show_config, {})
+ return self.api(self.papi.nat_show_config, {})
- def snat_add_interface_addr(
+ def nat44_add_interface_addr(
self,
sw_if_index,
is_add=1):
- """Add/del S-NAT address from interface
+ """Add/del NAT44 address from interface
:param sw_if_index: Software index of the interface
:param is_add: 1 if add, 0 if delete (Default value = 1)
"""
- return self.api(self.papi.snat_add_del_interface_addr,
+ return self.api(self.papi.nat44_add_del_interface_addr,
{'is_add': is_add, 'sw_if_index': sw_if_index})
- def snat_interface_addr_dump(self):
- """Dump S-NAT addresses interfaces
- :return: Dictionary of S-NAT addresses interfaces
+ def nat44_interface_addr_dump(self):
+ """Dump NAT44 addresses interfaces
+ :return: Dictionary of NAT44 addresses interfaces
"""
- return self.api(self.papi.snat_interface_addr_dump, {})
+ return self.api(self.papi.nat44_interface_addr_dump, {})
- def snat_ipfix(
+ def nat_ipfix(
self,
domain_id=1,
src_port=4739,
enable=1):
- """Enable/disable S-NAT IPFIX logging
+ """Enable/disable NAT IPFIX logging
:param domain_id: Observation domain ID (Default value = 1)
:param src_port: Source port number (Default value = 4739)
:param enable: 1 if enable, 0 if disable (Default value = 1)
"""
return self.api(
- self.papi.snat_ipfix_enable_disable,
+ self.papi.nat_ipfix_enable_disable,
{'domain_id': domain_id,
'src_port': src_port,
'enable': enable})
- def snat_user_session_dump(
+ def nat44_user_session_dump(
self,
ip_address,
- vrf_id,
- is_ip4=1):
- """Dump S-NAT user's sessions
+ vrf_id):
+ """Dump NAT44 user's sessions
:param ip_address: ip adress of the user to be dumped
:param cpu_index: cpu_index on which the user is
@@ -1234,26 +1227,25 @@ class VppPapiProvider(object):
:return: Dictionary of S-NAT sessions
"""
return self.api(
- self.papi.snat_user_session_dump,
+ self.papi.nat44_user_session_dump,
{'ip_address': ip_address,
- 'vrf_id': vrf_id,
- 'is_ip4': is_ip4})
+ 'vrf_id': vrf_id})
- def snat_user_dump(self):
- """Dump S-NAT users
+ def nat44_user_dump(self):
+ """Dump NAT44 users
- :return: Dictionary of S-NAT users
+ :return: Dictionary of NAT44 users
"""
- return self.api(self.papi.snat_user_dump, {})
+ return self.api(self.papi.nat44_user_dump, {})
- def snat_add_det_map(
+ def nat_det_add_del_map(
self,
in_addr,
in_plen,
out_addr,
out_plen,
is_add=1):
- """Add/delete S-NAT deterministic mapping
+ """Add/delete deterministic NAT mapping
:param is_add - 1 if add, 0 if delete
:param in_addr - inside IP address
@@ -1262,14 +1254,15 @@ class VppPapiProvider(object):
:param out_plen - outside IP address prefix length
"""
return self.api(
- self.papi.snat_add_det_map,
+ self.papi.nat_det_add_del_map,
{'is_add': is_add,
+ 'is_nat44': 1,
'in_addr': in_addr,
'in_plen': in_plen,
'out_addr': out_addr,
'out_plen': out_plen})
- def snat_det_forward(
+ def nat_det_forward(
self,
in_addr):
"""Get outside address and port range from inside address
@@ -1277,10 +1270,11 @@ class VppPapiProvider(object):
:param in_addr - inside IP address
"""
return self.api(
- self.papi.snat_det_forward,
- {'in_addr': in_addr})
+ self.papi.nat_det_forward,
+ {'in_addr': in_addr,
+ 'is_nat44': 1})
- def snat_det_reverse(
+ def nat_det_reverse(
self,
out_addr,
out_port):
@@ -1290,18 +1284,18 @@ class VppPapiProvider(object):
:param out_port - outside port
"""
return self.api(
- self.papi.snat_det_reverse,
+ self.papi.nat_det_reverse,
{'out_addr': out_addr,
'out_port': out_port})
- def snat_det_map_dump(self):
- """Dump S-NAT deterministic mappings
+ def nat_det_map_dump(self):
+ """Dump deterministic NAT mappings
- :return: Dictionary of S-NAT deterministic mappings
+ :return: Dictionary of deterministic NAT mappings
"""
- return self.api(self.papi.snat_det_map_dump, {})
+ return self.api(self.papi.nat_det_map_dump, {})
- def snat_det_set_timeouts(
+ def nat_det_set_timeouts(
self,
udp=300,
tcp_established=7440,
@@ -1315,78 +1309,71 @@ class VppPapiProvider(object):
:param icmp - ICMP timeout (Default value = 60)
"""
return self.api(
- self.papi.snat_det_set_timeouts,
+ self.papi.nat_det_set_timeouts,
{'udp': udp,
'tcp_established': tcp_established,
'tcp_transitory': tcp_transitory,
'icmp': icmp})
- def snat_det_get_timeouts(self):
+ def nat_det_get_timeouts(self):
"""Get values of timeouts for deterministic NAT
:return: Timeouts for deterministic NAT (in seconds)
"""
- return self.api(self.papi.snat_det_get_timeouts, {})
+ return self.api(self.papi.nat_det_get_timeouts, {})
- def snat_det_close_session_out(
+ def nat_det_close_session_out(
self,
out_addr,
out_port,
ext_addr,
- ext_port,
- is_ip4=1):
- """Close CGN session using outside address and port
+ ext_port):
+ """Close deterministic NAT session using outside address and port
:param out_addr - outside IP address
:param out_port - outside port
:param ext_addr - external host IP address
:param ext_port - external host port
- :param is_ip4: 1 if address type is IPv4 (Default value = 1)
"""
return self.api(
- self.papi.snat_det_close_session_out,
+ self.papi.nat_det_close_session_out,
{'out_addr': out_addr,
'out_port': out_port,
'ext_addr': ext_addr,
- 'ext_port': ext_port,
- 'is_ip4': is_ip4})
+ 'ext_port': ext_port})
- def snat_det_close_session_in(
+ def nat_det_close_session_in(
self,
in_addr,
in_port,
ext_addr,
- ext_port,
- is_ip4=1):
- """Close CGN session using inside address and port
+ ext_port):
+ """Close deterministic NAT session using inside address and port
:param in_addr - inside IP address
:param in_port - inside port
:param ext_addr - external host IP address
:param ext_port - external host port
- :param is_ip4: 1 if address type is IPv4 (Default value = 1)
"""
return self.api(
- self.papi.snat_det_close_session_in,
+ self.papi.nat_det_close_session_in,
{'in_addr': in_addr,
'in_port': in_port,
'ext_addr': ext_addr,
'ext_port': ext_port,
- 'is_ip4': is_ip4})
+ 'is_nat44': 1})
- def snat_det_session_dump(
+ def nat_det_session_dump(
self,
- user_addr,
- is_ip4=1):
- """Dump S-NAT deterministic sessions belonging to a user
+ user_addr):
+ """Dump deterministic NAT sessions belonging to a user
:param user_addr - inside IP address of the user
- :param is_ip4: - 1 if address type is IPv4 (Default value = 1)
- :return: Dictionary of S-NAT deterministic sessions
+ :return: Dictionary of deterministic NAT sessions
"""
return self.api(
- self.papi.snat_det_session_dump,
- {'is_ip4': is_ip4,
+ self.papi.nat_det_session_dump,
+ {'is_nat44': 1,
'user_addr': user_addr})
def nat64_add_del_pool_addr_range(