aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJuraj Sloboda <jsloboda@cisco.com>2018-04-13 12:00:46 +0200
committerNeale Ranns <nranns@cisco.com>2018-04-13 14:21:08 +0000
commit9341e34b500ce7c68fc6857a24ee7b67cac121b1 (patch)
tree687609bb47e28a42e0916bd61338ed08ef1586c2 /test
parent609b5d41b02c950f942b5382992c6c7937f91f8f (diff)
NAT66: Do not translate if packet not aimed at outside interface
Change-Id: Id5a2a90d81cc9cb87cb6fb89ac2f4ca3cbcb51e2 Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_nat.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_nat.py b/test/test_nat.py
index 4470a054bed..7c126199072 100644
--- a/test/test_nat.py
+++ b/test/test_nat.py
@@ -6436,6 +6436,29 @@ class TestNAT66(MethodHolder):
self.assertEqual(len(sm), 1)
self.assertEqual(sm[0].total_pkts, 8)
+ def test_check_no_translate(self):
+ """ NAT66 translate only when egress interface is outside interface """
+ self.vapi.nat66_add_del_interface(self.pg0.sw_if_index)
+ self.vapi.nat66_add_del_interface(self.pg1.sw_if_index)
+ self.vapi.nat66_add_del_static_mapping(self.pg0.remote_ip6n,
+ self.nat_addr_n)
+
+ # in2out
+ p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
+ IPv6(src=self.pg0.remote_ip6, dst=self.pg1.remote_ip6) /
+ UDP())
+ self.pg0.add_stream([p])
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+ capture = self.pg1.get_capture(1)
+ packet = capture[0]
+ try:
+ self.assertEqual(packet[IPv6].src, self.pg0.remote_ip6)
+ self.assertEqual(packet[IPv6].dst, self.pg1.remote_ip6)
+ except:
+ self.logger.error(ppp("Unexpected or invalid packet:", packet))
+ raise
+
def clear_nat66(self):
"""
Clear NAT66 configuration.