aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_nat44_ed.py
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2021-06-21 12:59:41 +0200
committerOle Tr�an <otroan@employees.org>2021-07-14 16:56:47 +0000
commita0648b66df7579ff1b37feaece8d00984e9cf326 (patch)
tree1efa284868da5c77f11aecc05f0aca209d28b112 /test/test_nat44_ed.py
parent45c19733787ec7bc590d3d9a5cdb938be21ce02f (diff)
nat: adding support for icmp-error msg
Extending tests. Type: test Change-Id: I98cc1d214ead10ac53fed34a1492d9b5f37975a2 Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'test/test_nat44_ed.py')
-rw-r--r--test/test_nat44_ed.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test_nat44_ed.py b/test/test_nat44_ed.py
index 76561eabedd..b8774a20d3d 100644
--- a/test/test_nat44_ed.py
+++ b/test/test_nat44_ed.py
@@ -914,6 +914,41 @@ class NAT44EDTestCase(VppTestCase):
class TestNAT44ED(NAT44EDTestCase):
""" NAT44ED Test Case """
+ def test_icmp_error(self):
+ """ NAT44ED test ICMP error message with inner header"""
+
+ payload = "H" * 10
+
+ self.nat_add_address(self.nat_addr)
+ self.nat_add_inside_interface(self.pg0)
+ self.nat_add_outside_interface(self.pg1)
+
+ # in2out (initiate connection)
+ p1 = (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) /
+ IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4) /
+ UDP(sport=21, dport=20) / payload)
+
+ self.pg0.add_stream(p1)
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+ capture = self.pg1.get_capture(1)[0]
+
+ # out2in (send error message)
+ p2 = (Ether(src=self.pg1.remote_mac, dst=self.pg1.local_mac) /
+ IP(src=self.pg1.remote_ip4, dst=self.nat_addr) /
+ ICMP(type='dest-unreach', code='port-unreachable') /
+ capture[IP:])
+
+ self.pg1.add_stream(p2)
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+
+ capture = self.pg0.get_capture(1)[0]
+
+ self.logger.info(ppp("p1 packet:", p1))
+ self.logger.info(ppp("p2 packet:", p2))
+ self.logger.info(ppp("capture packet:", capture))
+
def test_users_dump(self):
""" NAT44ED API test - nat44_user_dump """