summaryrefslogtreecommitdiffstats
path: root/test/test_snat.py
diff options
context:
space:
mode:
authorMartin Gálik <magalik@cisco.com>2017-04-27 02:13:26 -0700
committerOle Trøan <otroan@employees.org>2017-04-27 12:03:46 +0000
commitf7e655d69a3325b8050eb09bc6065fac10bcb81b (patch)
tree26a37d5b9edc9b724988c8cad94e503f54598879 /test/test_snat.py
parent3ef16710dc33b5b27730ced10008e2a69f81e147 (diff)
CGN: Send ICMP error packet if user is out of sessions available
Change-Id: I19a6015fde7342588cfa9c7a4f07016aa339cc72 Signed-off-by: Martin Gálik <magalik@cisco.com>
Diffstat (limited to 'test/test_snat.py')
-rw-r--r--test/test_snat.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/test_snat.py b/test/test_snat.py
index f90d9067850..da9f1b0bd04 100644
--- a/test/test_snat.py
+++ b/test/test_snat.py
@@ -1895,12 +1895,24 @@ class TestDeterministicNAT(MethodHolder):
p = (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) /
IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4) /
- UDP(sport=3000, dport=3000))
+ UDP(sport=3001, dport=3002))
self.pg0.add_stream(p)
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
capture = self.pg1.assert_nothing_captured()
+ # verify ICMP error packet
+ capture = self.pg0.get_capture(1)
+ p = capture[0]
+ self.assertTrue(p.haslayer(ICMP))
+ icmp = p[ICMP]
+ self.assertEqual(icmp.type, 3)
+ self.assertEqual(icmp.code, 1)
+ self.assertTrue(icmp.haslayer(IPerror))
+ inner_ip = icmp[IPerror]
+ self.assertEqual(inner_ip[UDPerror].sport, 3001)
+ self.assertEqual(inner_ip[UDPerror].dport, 3002)
+
dms = self.vapi.snat_det_map_dump()
self.assertEqual(1000, dms[0].ses_num)