summaryrefslogtreecommitdiffstats
path: root/src/plugins/cnat/test
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-02-26 18:12:20 +0100
committerDave Barach <openvpp@barachs.net>2021-03-04 12:35:15 +0000
commit8786a4cd4a62f2817da7060afd8523857f504912 (patch)
treee191304d55a70370bae6a869cbfb7de0c7f7a0cd /src/plugins/cnat/test
parent30ad571cc35e4dc6d4d7e50b81b97f83f8770eea (diff)
cnat: Fix snat with dhcp
Type: fix We didn't check that the srcEndpoint was resolved when creating the session, we could end up sNATing with 0.0.0.0 as src_addr Change-Id: If8dfa577e659cfe90b148657a44c0390a7d383e9 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/cnat/test')
-rw-r--r--src/plugins/cnat/test/test_cnat.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/cnat/test/test_cnat.py b/src/plugins/cnat/test/test_cnat.py
index 4398a63d5aa..ce32644a78c 100644
--- a/src/plugins/cnat/test/test_cnat.py
+++ b/src/plugins/cnat/test/test_cnat.py
@@ -527,8 +527,10 @@ class TestCNatTranslation(VppTestCase):
class TestCNatSourceNAT(VppTestCase):
""" CNat Source NAT """
extra_vpp_punt_config = ["cnat", "{",
+ "session-cleanup-timeout", "0.1",
"session-max-age", "1",
- "tcp-max-age", "1", "}"]
+ "tcp-max-age", "1",
+ "scanner", "off", "}"]
@classmethod
def setUpClass(cls):
@@ -556,10 +558,10 @@ class TestCNatSourceNAT(VppTestCase):
self.pg1.configure_ipv4_neighbors()
self.pg1.configure_ipv6_neighbors()
- self.vapi.cli("test cnat scanner off")
self.vapi.cnat_set_snat_addresses(
snat_ip4=self.pg2.remote_hosts[0].ip4,
- snat_ip6=self.pg2.remote_hosts[0].ip6)
+ snat_ip6=self.pg2.remote_hosts[0].ip6,
+ sw_if_index=INVALID_INDEX)
self.vapi.feature_enable_disable(
enable=1,
arc_name="ip6-unicast",
@@ -953,6 +955,7 @@ class TestCNatDHCP(VppTestCase):
self.pg0.sw_if_index, 1, True))
self.config_ips([1], is_add=0, is_v6=False)
self.config_ips([1], is_add=0, is_v6=True)
+ self.vapi.cnat_set_snat_addresses(sw_if_index=INVALID_INDEX)
if __name__ == '__main__':