summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2025-11-28 16:30:41 +0200
committerNataliia Solomko <natalirs1985@gmail.com>2025-12-04 16:47:30 +0200
commite091fb8bd87da8c9cd56f3435b39134b917a57a2 (patch)
tree7301f3442e7c529509c9c74b38f73be1d3cc71d5 /smoketest/scripts/cli
parent81eb7510621b3aa478359117733204bc7f140931 (diff)
downloadvyos-1x-e091fb8bd87da8c9cd56f3435b39134b917a57a2.tar.gz
vyos-1x-e091fb8bd87da8c9cd56f3435b39134b917a57a2.zip
vpp: T7972: Make `nat44 no-forwarding` feature automatically configurable
If any dynamic rule is configured forwarding should be disabled because each packet must be processed through the NAT session table to apply proper translations
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_vpp.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/smoketest/scripts/cli/test_vpp.py b/smoketest/scripts/cli/test_vpp.py
index 51ada6cb1..9f67b79c8 100755
--- a/smoketest/scripts/cli/test_vpp.py
+++ b/smoketest/scripts/cli/test_vpp.py
@@ -1366,6 +1366,13 @@ class TestVPP(VyOSUnitTestSHIM.TestCase):
self.cli_set(
base_nat + ['address-pool', 'translation', 'address', translation_pool]
)
+ self.cli_commit()
+
+ # Forwarding is disabled when only dynamic NAT is configured
+ vpp = VPPControl()
+ out = vpp.api.nat44_show_running_config().forwarding_enabled
+ self.assertFalse(out)
+
self.cli_set(
base_nat + ['exclude', 'rule', '100', 'local-address', exclude_local_addr]
)
@@ -1386,7 +1393,6 @@ class TestVPP(VyOSUnitTestSHIM.TestCase):
base_nat + ['static', 'rule', '100', 'local', 'address', static_local_addr]
)
- self.cli_set(base_nat_settings + ['no-forwarding'])
self.cli_set(base_nat_settings + ['session-limit', sess_limit])
self.cli_set(base_nat_settings + ['timeout', 'icmp', timeout_icmp])
self.cli_set(
@@ -1426,6 +1432,20 @@ class TestVPP(VyOSUnitTestSHIM.TestCase):
_, out = rc_cmd('sudo vppctl show nat44 summary')
self.assertIn(f'max translations per thread: {sess_limit} fib 0', out)
+ # Forwarding should be disabled with statyc+dynamic NAT
+ vpp = VPPControl()
+ out = vpp.api.nat44_show_running_config().forwarding_enabled
+ self.assertFalse(out)
+
+ # Delete dynamic NAT and check forwarding
+ self.cli_delete(base_nat + ['address-pool'])
+ self.cli_commit()
+
+ # Forwarding should be enabled if only statyc NAT is configured
+ vpp = VPPControl()
+ out = vpp.api.nat44_show_running_config().forwarding_enabled
+ self.assertTrue(out)
+
def test_17_vpp_sflow(self):
base_sflow = ['system', 'sflow']
sampling_rate = '1500'