aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_papi_provider.py
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2019-04-25 14:55:32 +0200
committerOle Trøan <otroan@employees.org>2019-05-02 14:04:07 +0000
commitf4749ca4d26206bb16cced12be7e73ab7b9cdf74 (patch)
tree9759de70aead403e398f20655e2a5951fb9d367e /test/vpp_papi_provider.py
parent9a29f795a845ccb2b45e15f726cc7b151da83093 (diff)
NAT: VPP-1661 - test case cleanup and refactoring
Change-Id: I0eb85252d4b489ba25dcf59252e2bcf3b0cd5c6a Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'test/vpp_papi_provider.py')
-rw-r--r--test/vpp_papi_provider.py459
1 files changed, 0 insertions, 459 deletions
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 86f13d1c54e..a3d20bf3088 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -66,7 +66,6 @@ defaultmapping = {
'dhcp_client_config': {'is_add': 1, 'set_broadcast_flag': 1, },
'dhcp_proxy_config': {'is_add': 1, },
'dhcp_proxy_set_vss': {'vss_type': 255, 'is_add': 1, },
- 'dslite_add_del_pool_addr_range': {'is_add': 1, },
'gbp_subnet_add_del': {'sw_if_index': 4294967295, 'epg_id': 65535, },
'geneve_add_del_tunnel': {'mcast_sw_if_index': 4294967295, 'is_add': 1,
'decap_next_index': 4294967295, },
@@ -122,35 +121,6 @@ defaultmapping = {
'next_hop_via_label': 1048576,
'is_add': 1, },
'mpls_tunnel_dump': {'sw_if_index': 4294967295, },
- 'nat44_add_del_address_range': {'is_add': 1, 'vrf_id': 4294967295, },
- 'nat44_add_del_identity_mapping': {'ip': b'0', 'sw_if_index': 4294967295,
- 'is_add': 1, },
- 'nat44_add_del_interface_addr': {'is_add': 1, },
- 'nat44_add_del_lb_static_mapping': {'is_add': 1, },
- 'nat44_add_del_static_mapping': {'external_sw_if_index': 4294967295,
- 'is_add': 1, },
- 'nat44_interface_add_del_feature': {'is_add': 1, },
- 'nat44_interface_add_del_output_feature': {'is_add': 1, },
- 'nat44_lb_static_mapping_add_del_local': {'is_add': 1, },
- 'nat64_add_del_interface': {'is_add': 1, },
- 'nat64_add_del_interface_addr': {'is_add': 1, },
- 'nat64_add_del_pool_addr_range': {'vrf_id': 4294967295, 'is_add': 1, },
- 'nat64_add_del_prefix': {'is_add': 1, },
- 'nat64_add_del_static_bib': {'is_add': 1, },
- 'nat64_bib_dump': {'protocol': 255, },
- 'nat64_st_dump': {'protocol': 255, },
- 'nat66_add_del_interface': {'is_add': 1, },
- 'nat66_add_del_static_mapping': {'is_add': 1, },
- 'nat_det_add_del_map': {'is_add': 1, },
- 'nat_ha_resync': {'want_resync_event': 1, },
- 'nat_ha_set_failover': {'refresh': 10, },
- 'nat_ha_set_listener': {'path_mtu': 512, },
- 'nat_ipfix_enable_disable': {'domain_id': 1, 'src_port': 4739,
- 'enable': 1, },
- 'nat_set_mss_clamping': {'mss_value': 1500, },
- 'nat_set_reass': {'timeout': 2, 'max_reass': 1024, 'max_frag': 5, },
- 'nat_set_timeouts': {'udp': 300, 'tcp_established': 7440,
- 'tcp_transitory': 240, 'icmp': 60, },
'output_acl_set_interface': {'ip4_table_index': 4294967295,
'ip6_table_index': 4294967295,
'l2_table_index': 4294967295, },
@@ -761,435 +731,6 @@ class VppPapiProvider(object):
'mt_next_hop_via_label': next_hop_via_label,
'mt_next_hop_out_label_stack': next_hop_out_label_stack})
- def nat44_interface_add_del_feature(
- self,
- sw_if_index,
- is_add=1,
- flags=0):
- """Enable/disable NAT44 feature on the interface
-
- :param sw_if_index: Software index of the interface
- :param is_add: 1 if add, 0 if delete (Default value = 1)
- :param flags: NAT_IS_INSIDE if inside else outside
- """
- return self.api(
- self.papi.nat44_interface_add_del_feature,
- {'is_add': is_add,
- 'flags': flags,
- 'sw_if_index': sw_if_index})
-
- def nat44_interface_add_del_output_feature(
- self,
- sw_if_index,
- is_add=1,
- flags=0):
- """Enable/disable NAT44 output feature on the interface
-
- :param sw_if_index: Software index of the interface
- :param is_add: 1 if add, 0 if delete (Default value = 1)
- :param flags: NAT_IS_INSIDE if inside else outside
- """
- return self.api(
- self.papi.nat44_interface_add_del_output_feature,
- {'is_add': is_add,
- 'flags': flags,
- 'sw_if_index': sw_if_index})
-
- def nat44_add_del_static_mapping(
- self,
- local_ip,
- external_ip=0,
- external_sw_if_index=0xFFFFFFFF,
- local_port=0,
- external_port=0,
- vrf_id=0,
- protocol=0,
- is_add=1,
- flags=0,
- tag=""):
- """Add/delete NAT44 static mapping
-
- :param local_ip: Local IP address
- :param external_ip: External IP address
- :param external_sw_if_index: External interface instead of IP address
- :param local_port: Local port number (Default value = 0)
- :param external_port: External port number (Default value = 0)
- :param vrf_id: VRF ID
- :param protocol: IP protocol (Default value = 0)
- :param flags: NAT configuration flags
- :param is_add: 1 if add, 0 if delete (Default value = 1)
- :param tag: Opaque string tag
- """
- return self.api(
- self.papi.nat44_add_del_static_mapping,
- {'is_add': is_add,
- 'flags': flags,
- 'local_ip_address': local_ip,
- 'external_ip_address': external_ip,
- 'protocol': protocol,
- 'local_port': local_port,
- 'external_port': external_port,
- 'external_sw_if_index': external_sw_if_index,
- 'vrf_id': vrf_id,
- 'tag': tag})
-
- def nat44_add_del_identity_mapping(
- self,
- ip=b'0',
- sw_if_index=0xFFFFFFFF,
- port=0,
- flags=0,
- vrf_id=0,
- protocol=0,
- tag='',
- is_add=1):
- """Add/delete NAT44 identity mapping
-
- :param ip: IP address (Default value = 0)
- :param sw_if_index: Interface instead of IP address
- :param port: Port number (Default value = 0)
- :param flags: NAT configuration flags (NAT_IS_ADDR_ONLY)
- :param vrf_id: VRF ID
- :param protocol: IP protocol (Default value = 0)
- :param tag: Opaque string tag
- :param is_add: 1 if add, 0 if delete (Default value = 1)
- """
- return self.api(
- self.papi.nat44_add_del_identity_mapping,
- {'is_add': is_add,
- 'flags': flags,
- 'ip_address': ip,
- 'protocol': protocol,
- 'port': port,
- 'sw_if_index': sw_if_index,
- 'vrf_id': vrf_id,
- 'tag': tag})
-
- def nat44_add_del_address_range(
- self,
- first_ip_address,
- last_ip_address,
- is_add=1,
- vrf_id=0xFFFFFFFF,
- flags=0):
- """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 flags: NAT configuration flags (NAT_IS_TWICE_NAT)
- """
- return self.api(
- 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,
- 'flags': flags})
-
- def nat44_add_del_interface_addr(
- self,
- sw_if_index,
- flags=0,
- is_add=1):
- """Add/del NAT44 address from interface
-
- :param sw_if_index: Software index of the interface
- :param flags: NAT configuration flags (NAT_IS_TWICE_NAT)
- :param is_add: 1 if add, 0 if delete (Default value = 1)
- """
- return self.api(
- self.papi.nat44_add_del_interface_addr,
- {'is_add': is_add,
- 'sw_if_index': sw_if_index,
- 'flags': flags})
-
- def nat44_add_del_lb_static_mapping(
- self,
- external_addr,
- external_port,
- protocol,
- tag='',
- affinity=0,
- local_num=0,
- locals=[],
- flags=0,
- is_add=1):
- """Add/delete NAT44 load balancing static mapping
-
- :param tag: Opaque string tag
- :param affinity: if 0 disabled, otherwise client IP affinity timeout
- :param flags: NAT configuration flags (NAT_IS_TWICE_NAT)
- :param is_add - 1 if add, 0 if delete
- """
- return self.api(
- self.papi.nat44_add_del_lb_static_mapping,
- {'is_add': is_add,
- 'flags': flags,
- 'external_addr': external_addr,
- 'external_port': external_port,
- 'protocol': protocol,
- 'affinity': affinity,
- 'local_num': local_num,
- 'locals': locals,
- 'tag': tag})
-
- def nat44_lb_static_mapping_add_del_local(
- self,
- external_addr,
- external_port,
- local_addr,
- local_port,
- protocol,
- probability,
- vrf_id=0,
- is_add=1):
- """Add/delete NAT44 load-balancing static mapping rule backend
-
- :param external_addr: external IPv4 address of the service
- :param external_port: external L4 port number of the service
- :param local_addr: IPv4 address of the internal node
- :param local_port: L4 port number of the internal node
- :param protocol: IP protocol number
- :param probability: probability of the internal node
- :param vrf_id: VRF id of the internal node
- :param is_add: 1 if add, 0 if delete
- """
- return self.api(
- self.papi.nat44_lb_static_mapping_add_del_local,
- {'is_add': is_add,
- 'external_addr': external_addr,
- 'external_port': external_port,
- 'local': {
- 'addr': local_addr,
- 'port': local_port,
- 'probability': probability,
- 'vrf_id': vrf_id},
- 'protocol': protocol})
-
- def nat44_del_session(
- self,
- addr,
- port,
- protocol,
- vrf_id=0,
- flags=0,
- ext_host_address=None,
- ext_host_port=0):
- """Delete NAT44 session
-
- :param addr: IPv4 address
- :param por: port number
- :param protocol: IP protocol number
- :param vrf_id: VRF ID
- :param flags: NAT configuration flags (NAT_IS_INSIDE)
- :param ext_host_address: external host IPv4 address
- :param ext_host_port: external host port
- """
- return self.api(
- self.papi.nat44_del_session,
- {'address': addr,
- 'protocol': protocol,
- 'port': port,
- 'vrf_id': vrf_id,
- 'flags': flags,
- 'ext_host_address': ext_host_address,
- 'ext_host_port': ext_host_port})
-
- def nat44_forwarding_enable_disable(
- self,
- enable):
- """Enable/disable forwarding for NAT44
-
- :param enable: 1 for enable, 0 for disable
- """
- return self.api(
- self.papi.nat44_forwarding_enable_disable,
- {'enable': enable})
-
- def nat_det_map_dump(self):
- """Dump deterministic NAT mappings
-
- :return: Dictionary of deterministic NAT mappings
- """
- return self.api(self.papi.nat_det_map_dump, {})
-
- def nat_set_mss_clamping(self, enable=0, mss_value=1500):
- """Set TCP MSS rewriting configuration
-
- :param enable: disable(0)/enable(1) MSS rewriting feature
- :param mss_value: MSS value to be used for MSS rewriting
- """
- return self.api(
- self.papi.nat_set_mss_clamping,
- {'enable': enable, 'mss_value': mss_value})
-
- 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=255):
- """Dump NAT64 BIB
-
- :param protocol: IP protocol (Default value = 255, all BIBs)
- :returns: Dictionary of NAT64 BIB entries
- """
- return self.api(self.papi.nat64_bib_dump, {'proto': protocol})
-
- def nat64_st_dump(self, protocol=255):
- """Dump NAT64 session table
-
- :param protocol: IP protocol (Default value = 255, all STs)
- :returns: Dictionary of NAT64 session table entries
- """
- return self.api(self.papi.nat64_st_dump, {'proto': protocol})
-
- def nat64_add_del_prefix(self, prefix, vrf_id=0, is_add=1):
- """Add/del NAT64 prefix
-
- :param prefix: NAT64 prefix
- :param vrf_id: VRF id of tenant (Default 0)
- :param is_add: 1 if add, 0 if delete (Default value = 1)
- """
- return self.api(
- self.papi.nat64_add_del_prefix,
- {'prefix': prefix,
- 'vrf_id': vrf_id,
- 'is_add': is_add})
-
- def nat64_add_del_interface_addr(
- self,
- sw_if_index,
- is_add=1):
- """Add/del NAT64 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.nat64_add_del_interface_addr,
- {'is_add': is_add, 'sw_if_index': sw_if_index})
-
- def dslite_set_aftr_addr(self, ip6, ip4):
- """Set DS-Lite AFTR addresses
-
- :param ip4: IPv4 address
- :param ip6: IPv6 address
- """
- return self.api(
- self.papi.dslite_set_aftr_addr,
- {'ip4_addr': ip4,
- 'ip6_addr': ip6})
-
- def dslite_set_b4_addr(self, ip6, ip4):
- """Set DS-Lite B4 IPv6 address
-
- :param ip4: IPv4 address
- :param ip6: IPv6 address
- """
- return self.api(
- self.papi.dslite_set_b4_addr,
- {'ip4_addr': ip4,
- 'ip6_addr': ip6})
-
- def nat66_add_del_interface(
- self,
- sw_if_index,
- flags=0,
- is_add=1):
- """Enable/disable NAT66 feature on the interface
-
- :param sw_if_index: Index of the interface
- :param flags: NAT configuration flags (NAT_IS_INSIDE)
- :param is_add: 1 if add, 0 if delete (Default value = 1)
- """
- return self.api(
- self.papi.nat66_add_del_interface,
- {'is_add': is_add,
- 'flags': flags,
- 'sw_if_index': sw_if_index})
-
- def nat66_add_del_static_mapping(
- self,
- in_ip,
- out_ip,
- vrf_id=0,
- is_add=1):
- """Add/delete NAT66 static mapping
-
- :param in_ip: Inside IPv6 address
- :param out_ip: Outside IPv6 address
- :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.nat66_add_del_static_mapping,
- {'local_ip_address': in_ip,
- 'external_ip_address': out_ip,
- 'vrf_id': vrf_id,
- 'is_add': is_add})
-
- def nat_ha_set_listener(self, addr, port, path_mtu=512):
- """Set HA listener (local settings)
-
- :param addr: local IP4 address
- :param port: local UDP port number
- :param path_mtu: path MTU (Default value = 512)
- """
- return self.api(self.papi.nat_ha_set_listener,
- {'ip_address': addr,
- 'port': port,
- 'path_mtu': path_mtu})
-
- def nat_ha_get_listener(self):
- """Get HA listener/local configuration"""
- return self.api(self.papi.nat_ha_get_listener, {})
-
- def nat_ha_set_failover(self, addr, port, refresh=10):
- """Set HA failover (remote settings)
-
- :param addr: failover IP4 address
- :param port: failover UDP port number
- :param refresh: number of seconds after which to send session refresh
- """
- return self.api(self.papi.nat_ha_set_failover,
- {'ip_address': addr,
- 'port': port,
- 'session_refresh_interval': refresh})
-
- def nat_ha_resync(self, want_resync_event=1):
- """Resync HA (resend existing sessions to new failover)
- :param want_resync_event: if non-zero resync completed event sent
- """
- return self.api(self.papi.nat_ha_resync,
- {'want_resync_event': want_resync_event,
- 'pid': os.getpid()})
-
def bfd_udp_add(self, sw_if_index, desired_min_tx, required_min_rx,
detect_mult, local_addr, peer_addr, is_ipv6=0,
bfd_key_id=None, conf_key_id=None):