Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion interface-definitions/include/version/vpp-version.xml.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- include start from include/version/vpp-version.xml.i -->
<syntaxVersion component='vpp' version='3'></syntaxVersion>
<syntaxVersion component='vpp' version='4'></syntaxVersion>
<!-- include end -->
6 changes: 0 additions & 6 deletions interface-definitions/vpp.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -1033,12 +1033,6 @@
<multi/>
</properties>
</leafNode>
<leafNode name="no-forwarding">
<properties>
<help>Do not forward packets which do not match existing NAT translations (static or dynamic)</help>
<valueless/>
</properties>
</leafNode>
</children>
</node>
<node name="physmem">
Expand Down
13 changes: 12 additions & 1 deletion smoketest/scripts/cli/test_vpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,13 @@ def test_16_vpp_nat(self):
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]
)
Expand All @@ -1386,7 +1393,6 @@ def test_16_vpp_nat(self):
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(
Expand Down Expand Up @@ -1426,6 +1432,11 @@ def test_16_vpp_nat(self):
_, out = rc_cmd('sudo vppctl show nat44 summary')
self.assertIn(f'max translations per thread: {sess_limit} fib 0', out)

# Forwarding should be enabled with statyc NAT
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'
Expand Down
4 changes: 1 addition & 3 deletions src/conf_mode/vpp_nat.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,7 @@ def apply(config):
n.enable_nat44_ed()

# Enable/disable forwarding
enable_forwarding = True
if 'no_forwarding' in config:
enable_forwarding = False
enable_forwarding = bool(config.get('static', {}).get('rule'))
n.enable_disable_nat44_forwarding(enable_forwarding)

# Add inside interfaces
Expand Down
30 changes: 30 additions & 0 deletions src/migration-scripts/vpp/3-to-4
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library. If not, see <http://www.gnu.org/licenses/>.

# Delete 'vpp settings nat44 no-forwarding'
# because it will be set automatically (T7972)


from vyos.configtree import ConfigTree

base = ['vpp', 'settings', 'nat44']

def migrate(config: ConfigTree) -> None:

if config.exists(base + ['no-forwarding']):
# Delete no-forwarding option from NAT44 settings
config.delete(base + ['no-forwarding'])
if config.exists(base) and len(config.list_nodes(base)) == 0:
config.delete(base)
Loading