diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-03-14 15:27:59 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-03-14 15:28:57 +0100 |
commit | cb1b2c462f8bab5733441c057ddb1a0ec887801f (patch) | |
tree | 735b44e911bea97fecc2270a958d18d57a4e107e /src/conf_mode/protocols_bgp.py | |
parent | fece992339e696b7d133682bb37cf3c88b6f358a (diff) | |
download | vyos-1x-cb1b2c462f8bab5733441c057ddb1a0ec887801f.tar.gz vyos-1x-cb1b2c462f8bab5733441c057ddb1a0ec887801f.zip |
bgp: T3325: fix missleading error message on listen-range verify() steps
Diffstat (limited to 'src/conf_mode/protocols_bgp.py')
-rwxr-xr-x | src/conf_mode/protocols_bgp.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py index 43ca37f9d..d5cc169c2 100755 --- a/src/conf_mode/protocols_bgp.py +++ b/src/conf_mode/protocols_bgp.py @@ -189,11 +189,13 @@ def verify(bgp): # we can not use dict_search() here as prefix contains dots ... if 'peer_group' not in asn_config['listen']['range'][prefix]: raise ConfigError(f'Listen range for prefix "{prefix}" has no peer group configured.') - else: - peer_group = asn_config['listen']['range'][prefix]['peer_group'] - # the peer group must also exist - if not dict_search(f'peer_group.{peer_group}', asn_config): - raise ConfigError(f'Peer-group "{peer_group}" for listen range "{prefix}" does not exist!') + + peer_group = asn_config['listen']['range'][prefix]['peer_group'] + if 'peer_group' not in asn_config or peer_group not in asn_config['peer_group']: + raise ConfigError(f'Peer-group "{peer_group}" for listen range "{prefix}" does not exist!') + + if not verify_remote_as(asn_config['listen']['range'][prefix], asn_config): + raise ConfigError(f'Peer-group "{peer_group}" requires remote-as to be set!') return None |