summaryrefslogtreecommitdiffstats
path: root/test/test_nat.py
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-11-08 01:59:38 -0800
committerOle Trøan <otroan@employees.org>2017-11-08 11:01:46 +0000
commit0938dcf192d203dcbe89d2819d3819d2f93408bf (patch)
tree1e3044664b7a3e84bdf0bc353b366916d9411f29 /test/test_nat.py
parent2ea2e423a95d497b97b858ebadc0b6aca1027e66 (diff)
NAT64 to use IPv4 address from interface (VPP-1051)
Change-Id: I326429c31dea6958a342ee152ef86cb975f4b12c Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'test/test_nat.py')
-rw-r--r--test/test_nat.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/test_nat.py b/test/test_nat.py
index 3c002bb8eca..76c52828ad9 100644
--- a/test/test_nat.py
+++ b/test/test_nat.py
@@ -3428,7 +3428,7 @@ class TestNAT64(MethodHolder):
cls.vrf1_nat_addr_n = socket.inet_pton(socket.AF_INET,
cls.vrf1_nat_addr)
- cls.create_pg_interfaces(range(4))
+ cls.create_pg_interfaces(range(5))
cls.ip6_interfaces = list(cls.pg_interfaces[0:1])
cls.ip6_interfaces.append(cls.pg_interfaces[2])
cls.ip4_interfaces = list(cls.pg_interfaces[1:2])
@@ -4337,6 +4337,25 @@ class TestNAT64(MethodHolder):
self.assertEqual(p[TCP].dport, self.tcp_port_in)
self.assertEqual(data, p[Raw].load)
+ def test_interface_addr(self):
+ """ Acquire NAT64 pool addresses from interface """
+ self.vapi.nat64_add_interface_addr(self.pg4.sw_if_index)
+
+ # no address in NAT64 pool
+ adresses = self.vapi.nat44_address_dump()
+ self.assertEqual(0, len(adresses))
+
+ # configure interface address and check NAT64 address pool
+ self.pg4.config_ip4()
+ addresses = self.vapi.nat64_pool_addr_dump()
+ self.assertEqual(len(addresses), 1)
+ self.assertEqual(addresses[0].address, self.pg4.local_ip4n)
+
+ # remove interface address and check NAT64 address pool
+ self.pg4.unconfig_ip4()
+ addresses = self.vapi.nat64_pool_addr_dump()
+ self.assertEqual(0, len(adresses))
+
def nat64_get_ses_num(self):
"""
Return number of active NAT64 sessions.