From 8b21fb0aecf46b6da4bac091d380d3c4927100bd Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Sun, 6 Oct 2024 15:19:28 +0200 Subject: vrf: T6747: ensure VNIs are unique on the system --- src/conf_mode/vrf.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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(): -- cgit v1.2.3