diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-03-21 14:43:10 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-03-21 14:43:10 +0100 |
commit | 018eda75b6202dc2006b62ad0132298087d696bc (patch) | |
tree | 46097a25b4b6e02a7e5ed6f88255db3fcf029ecf /src/conf_mode/protocols_isis.py | |
parent | 7bf608edf7e37b03e6b6ea9149d168a33b0818b5 (diff) | |
download | vyos-1x-018eda75b6202dc2006b62ad0132298087d696bc.tar.gz vyos-1x-018eda75b6202dc2006b62ad0132298087d696bc.zip |
isis: T3417: verify route-map used in redistribute exists
Diffstat (limited to 'src/conf_mode/protocols_isis.py')
-rwxr-xr-x | src/conf_mode/protocols_isis.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/conf_mode/protocols_isis.py b/src/conf_mode/protocols_isis.py index 34cd392f6..68934b565 100755 --- a/src/conf_mode/protocols_isis.py +++ b/src/conf_mode/protocols_isis.py @@ -20,7 +20,9 @@ from sys import exit from sys import argv from vyos.config import Config +from vyos.configdict import dict_merge from vyos.configdict import node_changed +from vyos.configverify import verify_interface_exists from vyos.util import call from vyos.util import dict_search from vyos.util import get_interface_config @@ -67,6 +69,13 @@ def get_config(config=None): isis.update({'deleted' : ''}) return isis + # We also need some additional information from the config, prefix-lists + # and route-maps for instance. They will be used in verify() + base = ['policy'] + tmp = conf.get_config_dict(base, key_mangling=('-', '_')) + # Merge policy dict into OSPF dict + isis = dict_merge(tmp, isis) + return isis def verify(isis): @@ -85,6 +94,7 @@ def verify(isis): raise ConfigError('Interface used for routing updates is mandatory!') for interface in isis['interface']: + verify_interface_exists(interface) if 'vrf' in isis: # If interface specific options are set, we must ensure that the # interface is bound to our requesting VRF. Due to the VyOS @@ -129,6 +139,12 @@ def verify(isis): raise ConfigError(f'"protocols isis {process} redistribute {afi} {proto} {redistr_level}" ' \ f'can not be used with \"protocols isis {process} level {proc_level}\"') + if 'route_map' in redistr_config: + name = redistr_config['route_map'] + tmp = name.replace('-', '_') + if dict_search(f'policy.route_map.{tmp}', isis) == None: + raise ConfigError(f'Route-map {name} does not exist!') + # Segment routing checks if dict_search('segment_routing.global_block', isis): high_label_value = dict_search('segment_routing.global_block.high_label_value', isis) |