summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-12-10 21:15:18 +0100
committerChristian Poessinger <christian@poessinger.com>2021-12-10 21:15:18 +0100
commit544e73ff26bb0b9d282159e4a734ad531213d816 (patch)
treeb8ac31c99f93df1a6be72b85c91d552eb4698035
parenteb29d8d5a0bc536364b4024ec6c336451b58ba49 (diff)
downloadvyos-1x-544e73ff26bb0b9d282159e4a734ad531213d816.tar.gz
vyos-1x-544e73ff26bb0b9d282159e4a734ad531213d816.zip
vxlan: T3700: can not specify both "external" and "VNI"
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_vxlan.py6
-rwxr-xr-xsrc/conf_mode/interfaces-vxlan.py3
2 files changed, 9 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_vxlan.py b/smoketest/scripts/cli/test_interfaces_vxlan.py
index 17874af89..9278adadd 100755
--- a/smoketest/scripts/cli/test_interfaces_vxlan.py
+++ b/smoketest/scripts/cli/test_interfaces_vxlan.py
@@ -95,6 +95,12 @@ class VXLANInterfaceTest(BasicInterfaceTest.TestCase):
self.cli_set(self._base_path + [interface, 'external'])
self.cli_set(self._base_path + [interface, 'source-address', source_address])
+ # Both 'VNI' and 'external' can not be specified at the same time.
+ self.cli_set(self._base_path + [interface, 'vni', '111'])
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+ self.cli_delete(self._base_path + [interface, 'vni'])
+
# Now add some more interfaces - this must fail and a CLI error needs
# to be generated as Linux can only handle one VXLAN tunnel when using
# external mode.
diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py
index b197d08a6..95d982f38 100755
--- a/src/conf_mode/interfaces-vxlan.py
+++ b/src/conf_mode/interfaces-vxlan.py
@@ -81,6 +81,9 @@ def verify(vxlan):
raise ConfigError(
'Must either configure VXLAN "vni" or use "external" CLI option!')
+ if {'external', 'vni'} <= set(vxlan):
+ raise ConfigError('Can not specify both "external" and "VNI"!')
+
if {'external', 'other_tunnels'} <= set(vxlan):
other_tunnels = ', '.join(vxlan['other_tunnels'])
raise ConfigError(f'Only one VXLAN tunnel is supported when "external" '\