summaryrefslogtreecommitdiff
path: root/src/conf_mode/vrf.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-10-06 15:19:28 +0200
committerChristian Breunig <christian@breunig.cc>2024-12-16 22:21:36 +0100
commit8b21fb0aecf46b6da4bac091d380d3c4927100bd (patch)
treefe684b5ca3b58d989516ad01ebe8d859e10d8a6a /src/conf_mode/vrf.py
parent6544973ae66bbecaea8b6194a8bf6cd3eadf4fa8 (diff)
downloadvyos-1x-8b21fb0aecf46b6da4bac091d380d3c4927100bd.tar.gz
vyos-1x-8b21fb0aecf46b6da4bac091d380d3c4927100bd.zip
vrf: T6747: ensure VNIs are unique on the system
Diffstat (limited to 'src/conf_mode/vrf.py')
-rwxr-xr-xsrc/conf_mode/vrf.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/conf_mode/vrf.py b/src/conf_mode/vrf.py
index 6d17c192c..3d3845fdf 100755
--- a/src/conf_mode/vrf.py
+++ b/src/conf_mode/vrf.py
@@ -158,6 +158,7 @@ def verify(vrf):
reserved_names = ["add", "all", "broadcast", "default", "delete", "dev",
"get", "inet", "mtu", "link", "type", "vrf"]
table_ids = []
+ vnis = []
for name, vrf_config in vrf['name'].items():
# Reserved VRF names
if name in reserved_names:
@@ -178,6 +179,13 @@ def verify(vrf):
raise ConfigError(f'VRF "{name}" table id is not unique!')
table_ids.append(vrf_config['table'])
+ # VRF VNIs must be unique on the system
+ if 'vni' in vrf_config:
+ vni = vrf_config['vni']
+ if vni in vnis:
+ raise ConfigError(f'VRF "{name}" VNI "{vni}" is not unique!')
+ vnis.append(vni)
+
tmp = dict_search('ip.protocol', vrf_config)
if tmp != None:
for protocol, protocol_options in tmp.items():