summaryrefslogtreecommitdiffstats
path: root/test/test_nat.py
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-03-07 04:57:22 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-03-14 18:45:50 +0000
commit341b469c4ded91870ae9cfe45ddd1affa227cf14 (patch)
tree419cdf7c83b98d3050ba0434faec968e970baf5e /test/test_nat.py
parentdadcc849136b6a0bcd9eb8c100695aba139b2831 (diff)
NAT44: fix nat_not_translate_output_feature for ICMP (VPP-1191)
Change-Id: I1552e1418b704fdf1f1fa2c0174313b9b82a37a3 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'test/test_nat.py')
-rw-r--r--test/test_nat.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/test/test_nat.py b/test/test_nat.py
index aeeb5aa2bd5..c89180609fe 100644
--- a/test/test_nat.py
+++ b/test/test_nat.py
@@ -1381,10 +1381,36 @@ class TestNAT44(MethodHolder):
self.logger.error(ppp("Unexpected or invalid packet:", p))
raise
- # multiple clients
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_static_lb_multi_clients(self):
+ """ NAT44 local service load balancing - multiple clients"""
+
+ external_addr_n = socket.inet_pton(socket.AF_INET, self.nat_addr)
+ external_port = 80
+ local_port = 8080
+ server1 = self.pg0.remote_hosts[0]
+ server2 = self.pg0.remote_hosts[1]
+
+ locals = [{'addr': server1.ip4n,
+ 'port': local_port,
+ 'probability': 90},
+ {'addr': server2.ip4n,
+ 'port': local_port,
+ 'probability': 10}]
+
+ self.nat44_add_address(self.nat_addr)
+ self.vapi.nat44_add_del_lb_static_mapping(external_addr_n,
+ external_port,
+ IP_PROTOS.tcp,
+ local_num=len(locals),
+ locals=locals)
+ self.vapi.nat44_interface_add_del_feature(self.pg0.sw_if_index)
+ self.vapi.nat44_interface_add_del_feature(self.pg1.sw_if_index,
+ is_inside=0)
+
server1_n = 0
server2_n = 0
- clients = ip4_range(self.pg1.remote_ip4, 10, 20)
+ clients = ip4_range(self.pg1.remote_ip4, 10, 50)
pkts = []
for client in clients:
p = (Ether(src=self.pg1.remote_mac, dst=self.pg1.local_mac) /