diff options
author | Lulu Cathrinus Grimalkin <me@erkin.party> | 2021-12-16 17:32:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-16 17:32:24 +0300 |
commit | 9737a55f6dde490e7fdf1c9d5c5733e48c94d141 (patch) | |
tree | d2c24363d921490bcef5cb3efb70ae794fbe22a5 /src/conf_mode/protocols_bfd.py | |
parent | 95b91627a6065b720365c9ae7d124d85fc8e493d (diff) | |
parent | 55f8ede2d09a9ad095f9ec5c2a729f8c5fb6aafa (diff) | |
download | vyos-1x-9737a55f6dde490e7fdf1c9d5c5733e48c94d141.tar.gz vyos-1x-9737a55f6dde490e7fdf1c9d5c5733e48c94d141.zip |
Merge branch 'vyos:current' into current
Diffstat (limited to 'src/conf_mode/protocols_bfd.py')
-rwxr-xr-x | src/conf_mode/protocols_bfd.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/conf_mode/protocols_bfd.py b/src/conf_mode/protocols_bfd.py index 94825ba10..4ebc0989c 100755 --- a/src/conf_mode/protocols_bfd.py +++ b/src/conf_mode/protocols_bfd.py @@ -18,6 +18,7 @@ import os from vyos.config import Config from vyos.configdict import dict_merge +from vyos.configverify import verify_vrf from vyos.template import is_ipv6 from vyos.template import render_to_string from vyos.validate import is_ipv6_link_local @@ -33,7 +34,9 @@ def get_config(config=None): else: conf = Config() base = ['protocols', 'bfd'] - bfd = conf.get_config_dict(base, get_first_key=True) + bfd = conf.get_config_dict(base, key_mangling=('-', '_'), + get_first_key=True, + no_tag_node_value_mangle=True) # Bail out early if configuration tree does not exist if not conf.exists(base): return bfd @@ -76,11 +79,19 @@ def verify(bfd): # multihop and echo-mode cannot be used together if 'echo_mode' in peer_config: - raise ConfigError('Multihop and echo-mode cannot be used together') + raise ConfigError('BFD multihop and echo-mode cannot be used together') # multihop doesn't accept interface names if 'source' in peer_config and 'interface' in peer_config['source']: - raise ConfigError('Multihop and source interface cannot be used together') + raise ConfigError('BFD multihop and source interface cannot be used together') + + if 'profile' in peer_config: + profile_name = peer_config['profile'] + if 'profile' not in bfd or profile_name not in bfd['profile']: + raise ConfigError(f'BFD profile "{profile_name}" does not exist!') + + if 'vrf' in peer_config: + verify_vrf(peer_config) return None |