summaryrefslogtreecommitdiffstats
path: root/test/vpp_papi_provider.py
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-02-10 03:48:01 -0800
committerOle Trøan <otroan@employees.org>2017-03-07 12:47:12 +0000
commit066f034b903bda6e938bec1b12f01edef65ee9c4 (patch)
treeddb4a1eb0878fe7ac58f25056f3bb7c6ad0bae3a /test/vpp_papi_provider.py
parenteab38d91e8db5ad271598a63781a7afa3bd8b5ea (diff)
CGN: Deterministic NAT (VPP-623)
Inside user is statically mapped to a set of outside ports. Support endpoint dependent mapping to deal with overloading of the outside ports. Change-Id: I8014438744597a976f8ae459283e8b91f63b7f72 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'test/vpp_papi_provider.py')
-rw-r--r--test/vpp_papi_provider.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index c7e875f0481..b9c4d0c1be6 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -1123,6 +1123,54 @@ class VppPapiProvider(object):
"""
return self.api(self.papi.snat_user_dump, {})
+ def snat_add_det_map(
+ self,
+ in_addr,
+ in_plen,
+ out_addr,
+ out_plen,
+ is_add=1):
+ """Add/delete S-NAT deterministic mapping
+
+ :param is_add - 1 if add, 0 if delete
+ :param in_addr - inside IP address
+ :param in_plen - inside IP address prefix length
+ :param out_addr - outside IP address
+ :param out_plen - outside IP address prefix length
+ """
+ return self.api(
+ self.papi.snat_add_det_map,
+ {'is_add': is_add,
+ 'in_addr': in_addr,
+ 'in_plen': in_plen,
+ 'out_addr': out_addr,
+ 'out_plen': out_plen})
+
+ def snat_det_forward(
+ self,
+ in_addr):
+ """Get outside address and port range from inside address
+
+ :param in_addr - inside IP address
+ """
+ return self.api(
+ self.papi.snat_det_forward,
+ {'in_addr': in_addr})
+
+ def snat_det_reverse(
+ self,
+ out_addr,
+ out_port):
+ """Get inside address from outside address and port
+
+ :param out_addr - outside IP address
+ :param out_port - outside port
+ """
+ return self.api(
+ self.papi.snat_det_reverse,
+ {'out_addr': out_addr,
+ 'out_port': out_port})
+
def control_ping(self):
self.api(self.papi.control_ping)