diff options
author | Christian Breunig <christian@breunig.cc> | 2024-10-06 15:19:28 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2024-12-16 22:21:36 +0100 |
commit | 8b21fb0aecf46b6da4bac091d380d3c4927100bd (patch) | |
tree | fe684b5ca3b58d989516ad01ebe8d859e10d8a6a /src/conf_mode/vrf.py | |
parent | 6544973ae66bbecaea8b6194a8bf6cd3eadf4fa8 (diff) | |
download | vyos-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-x | src/conf_mode/vrf.py | 8 |
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(): |