Skip to content

Commit 4d5783a

Browse files
authored
Merge pull request #4383 from oniko94/fix/T7219-fix-vxlan-verify
T7219: Add check for remote and group command to verify
2 parents 2b0b323 + c9ddcc6 commit 4d5783a

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

smoketest/scripts/cli/test_interfaces_vxlan.py

+27
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from vyos.utils.network import get_vxlan_vlan_tunnels
2626
from vyos.utils.network import get_vxlan_vni_filter
2727
from vyos.template import is_ipv6
28+
from vyos import ConfigError
2829
from base_interfaces_test import BasicInterfaceTest
2930

3031
def convert_to_list(ranges_to_convert):
@@ -114,6 +115,32 @@ def test_vxlan_parameters(self):
114115
self.assertEqual(Interface(interface).get_admin_state(), 'up')
115116
ttl += 10
116117

118+
119+
def test_vxlan_group_remote_error(self):
120+
intf = 'vxlan60'
121+
options = [
122+
'group 239.4.4.5',
123+
'mtu 1420',
124+
'remote 192.168.0.254',
125+
'source-address 192.168.0.1',
126+
'source-interface eth0',
127+
'vni 60'
128+
]
129+
params = []
130+
for option in options:
131+
opts = option.split()
132+
params.append(opts[0])
133+
self.cli_set(self._base_path + [ intf ] + opts)
134+
135+
with self.assertRaises(ConfigSessionError) as cm:
136+
self.cli_commit()
137+
138+
exception = cm.exception
139+
self.assertIn('Both group and remote cannot be specified', str(exception))
140+
for param in params:
141+
self.cli_delete(self._base_path + [intf, param])
142+
143+
117144
def test_vxlan_external(self):
118145
interface = 'vxlan0'
119146
source_address = '192.0.2.1'

src/conf_mode/interfaces_vxlan.py

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ def verify(vxlan):
9595
if 'group' in vxlan:
9696
if 'source_interface' not in vxlan:
9797
raise ConfigError('Multicast VXLAN requires an underlaying interface')
98+
if 'remote' in vxlan:
99+
raise ConfigError('Both group and remote cannot be specified')
98100
verify_source_interface(vxlan)
99101

100102
if not any(tmp in ['group', 'remote', 'source_address', 'source_interface'] for tmp in vxlan):

0 commit comments

Comments
 (0)