Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vrf: T6602: verify supplied VRF name on all interface types (backport #3856) #3870

Merged
merged 1 commit into from
Jul 25, 2024
Merged
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
18 changes: 18 additions & 0 deletions smoketest/scripts/cli/base_interfaces_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,24 @@ def test_move_interface_between_vrf_instances(self):
self.cli_delete(['vrf', 'name', vrf1_name])
self.cli_delete(['vrf', 'name', vrf2_name])

def test_add_to_invalid_vrf(self):
if not self._test_vrf:
self.skipTest('not supported')

# move interface into first VRF
for interface in self._interfaces:
for option in self._options.get(interface, []):
self.cli_set(self._base_path + [interface] + option.split())
self.cli_set(self._base_path + [interface, 'vrf', 'invalid'])

# check validate() - can not use a non-existing VRF
with self.assertRaises(ConfigSessionError):
self.cli_commit()

for interface in self._interfaces:
self.cli_delete(self._base_path + [interface, 'vrf', 'invalid'])
self.cli_set(self._base_path + [interface, 'description', 'test_add_to_invalid_vrf'])

def test_span_mirror(self):
if not self._mirror_interfaces:
self.skipTest('not supported')
Expand Down
2 changes: 2 additions & 0 deletions src/conf_mode/interfaces_geneve.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from vyos.configverify import verify_bridge_delete
from vyos.configverify import verify_mirror_redirect
from vyos.configverify import verify_bond_bridge_member
from vyos.configverify import verify_vrf
from vyos.ifconfig import GeneveIf
from vyos.utils.network import interface_exists
from vyos import ConfigError
Expand Down Expand Up @@ -59,6 +60,7 @@ def verify(geneve):

verify_mtu_ipv6(geneve)
verify_address(geneve)
verify_vrf(geneve)
verify_bond_bridge_member(geneve)
verify_mirror_redirect(geneve)

Expand Down
2 changes: 2 additions & 0 deletions src/conf_mode/interfaces_l2tpv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from vyos.configverify import verify_mtu_ipv6
from vyos.configverify import verify_mirror_redirect
from vyos.configverify import verify_bond_bridge_member
from vyos.configverify import verify_vrf
from vyos.ifconfig import L2TPv3If
from vyos.utils.kernel import check_kmod
from vyos.utils.network import is_addr_assigned
Expand Down Expand Up @@ -76,6 +77,7 @@ def verify(l2tpv3):

verify_mtu_ipv6(l2tpv3)
verify_address(l2tpv3)
verify_vrf(l2tpv3)
verify_bond_bridge_member(l2tpv3)
verify_mirror_redirect(l2tpv3)
return None
Expand Down
2 changes: 2 additions & 0 deletions src/conf_mode/interfaces_vti.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from vyos.config import Config
from vyos.configdict import get_interface_dict
from vyos.configverify import verify_mirror_redirect
from vyos.configverify import verify_vrf
from vyos.ifconfig import VTIIf
from vyos import ConfigError
from vyos import airbag
Expand All @@ -38,6 +39,7 @@ def get_config(config=None):
return vti

def verify(vti):
verify_vrf(vti)
verify_mirror_redirect(vti)
return None

Expand Down
2 changes: 2 additions & 0 deletions src/conf_mode/interfaces_vxlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from vyos.configverify import verify_mirror_redirect
from vyos.configverify import verify_source_interface
from vyos.configverify import verify_bond_bridge_member
from vyos.configverify import verify_vrf
from vyos.ifconfig import Interface
from vyos.ifconfig import VXLANIf
from vyos.template import is_ipv6
Expand Down Expand Up @@ -193,6 +194,7 @@ def verify(vxlan):

verify_mtu_ipv6(vxlan)
verify_address(vxlan)
verify_vrf(vxlan)
verify_bond_bridge_member(vxlan)
verify_mirror_redirect(vxlan)

Expand Down
Loading