diff options
author | Juraj Sloboda <jsloboda@cisco.com> | 2017-04-14 03:24:45 +0200 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2017-04-19 08:01:59 +0000 |
commit | 012e4bab6cee95144275d5d3e08ac00d84259bfb (patch) | |
tree | 4e4ba56dbcfa2c4718a7c2d91a63d2500de1e180 /test | |
parent | 1604a9c0cad2b69492545e04aaf46de304fa5705 (diff) |
Support ping from outside network in 1:1 NAT (VPP-695)
Change-Id: Iec8fd4c2bd26874bd8bda82172af797e9b92592c
Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/test_snat.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/test/test_snat.py b/test/test_snat.py index e1dd576e991..c07d8c4621b 100644 --- a/test/test_snat.py +++ b/test/test_snat.py @@ -548,7 +548,7 @@ class TestSNAT(VppTestCase): self.verify_capture_out_with_icmp_errors(capture) def test_ping_out_interface_from_outside(self): - """ Ping SNAT out interface from outside """ + """ Ping SNAT out interface from outside network """ self.snat_add_address(self.snat_addr) self.vapi.snat_interface_add_del_feature(self.pg0.sw_if_index) @@ -575,6 +575,36 @@ class TestSNAT(VppTestCase): "(outside network):", packet)) raise + def test_ping_internal_host_from_outside(self): + """ Ping internal host from outside network """ + + self.snat_add_static_mapping(self.pg0.remote_ip4, self.snat_addr) + self.vapi.snat_interface_add_del_feature(self.pg0.sw_if_index) + self.vapi.snat_interface_add_del_feature(self.pg1.sw_if_index, + is_inside=0) + + # out2in + pkt = (Ether(dst=self.pg1.local_mac, src=self.pg1.remote_mac) / + IP(src=self.pg1.remote_ip4, dst=self.snat_addr, ttl=64) / + ICMP(id=self.icmp_id_out, type='echo-request')) + self.pg1.add_stream(pkt) + self.pg_enable_capture(self.pg_interfaces) + self.pg_start() + capture = self.pg0.get_capture(1) + self.verify_capture_in(capture, self.pg0, packet_num=1) + self.assert_equal(capture[0][IP].proto, IP_PROTOS.icmp) + + # in2out + pkt = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) / + IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4, ttl=64) / + ICMP(id=self.icmp_id_in, type='echo-reply')) + self.pg0.add_stream(pkt) + self.pg_enable_capture(self.pg_interfaces) + self.pg_start() + capture = self.pg1.get_capture(1) + self.verify_capture_out(capture, same_port=True, packet_num=1) + self.assert_equal(capture[0][IP].proto, IP_PROTOS.icmp) + def test_static_in(self): """ SNAT 1:1 NAT initialized from inside network """ |