summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-16 15:18:31 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-16 15:29:28 +0100
commit8953a14b01a4183ea890f1c3d569aae54e363614 (patch)
tree10df3b95cdc58eb17815b7797ed99bd20a2f74a7 /src/conf_mode
parent452a9c504f472dcaee8c93947a889dab4f8259ce (diff)
downloadvyos-1x-8953a14b01a4183ea890f1c3d569aae54e363614.tar.gz
vyos-1x-8953a14b01a4183ea890f1c3d569aae54e363614.zip
vrf: T31: add support for - and _ in VRF names
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/vrf.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/conf_mode/vrf.py b/src/conf_mode/vrf.py
index ebad7e246..6c6e219a5 100755
--- a/src/conf_mode/vrf.py
+++ b/src/conf_mode/vrf.py
@@ -74,18 +74,20 @@ def get_config(config=None):
conf = Config()
base = ['vrf']
- vrf = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True)
+ vrf = conf.get_config_dict(base, get_first_key=True)
# determine which VRF has been removed
- tmp = node_changed(conf, base + ['name'])
- for name in tmp:
- vrf.update({'vrf_remove' : { name : ''}})
+ for name in node_changed(conf, base + ['name']):
+ if 'vrf_remove' not in vrf:
+ vrf.update({'vrf_remove' : {}})
+
+ vrf['vrf_remove'][name] = {}
# get VRF bound interfaces
interfaces = vrf_interfaces(conf, name)
- if interfaces: vrf.update({'vrf_remove' : { name : {'interfaces' : ''}}})
+ if interfaces: vrf['vrf_remove'][name]['interface'] = interfaces
# get VRF bound routing instances
routes = vrf_routing(conf, name)
- if routes: vrf.update({'vrf_remove' : { name : {'routes' : routes}}})
+ if routes: vrf['vrf_remove'][name]['route'] = routes
return vrf
@@ -93,10 +95,10 @@ def verify(vrf):
# ensure VRF is not assigned to any interface
if 'vrf_remove' in vrf:
for name, config in vrf['vrf_remove'].items():
- if 'interfaces' in config:
+ if 'interface' in config:
raise ConfigError(f'Can not remove VRF "{name}", it still has '\
f'member interfaces!')
- if 'routes' in config:
+ if 'route' in config:
raise ConfigError(f'Can not remove VRF "{name}", it still has '\
f'static routes installed!')