diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-01-18 19:59:14 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-01-18 19:59:14 +0100 |
commit | 75e947ccc72d1532e1bf9c2f5011060a1043a14e (patch) | |
tree | 53dae719aac312105d4346ba10fea44d9b3d09d9 /src/conf_mode/protocols_bgp.py | |
parent | 66ec730d3bc54379bc558c90c45d5f97e5760a14 (diff) | |
download | vyos-1x-75e947ccc72d1532e1bf9c2f5011060a1043a14e.tar.gz vyos-1x-75e947ccc72d1532e1bf9c2f5011060a1043a14e.zip |
bgp: T2174: fix validator for neighbor interface config
Diffstat (limited to 'src/conf_mode/protocols_bgp.py')
-rwxr-xr-x | src/conf_mode/protocols_bgp.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py index 58fd32300..cdae23d27 100755 --- a/src/conf_mode/protocols_bgp.py +++ b/src/conf_mode/protocols_bgp.py @@ -88,8 +88,13 @@ def verify(bgp): if neighbor == 'neighbor': # remote-as must be either set explicitly for the neighbor # or for the entire peer-group - if 'remote_as' not in peer_config: - if 'peer_group' not in peer_config or 'remote_as' not in asn_config['peer_group'][peer_config['peer_group']]: + if 'interface' in peer_config: + if 'remote_as' not in peer_config['interface']: + if 'peer_group' not in peer_config['interface'] or 'remote_as' not in asn_config['peer_group'][ peer_config['interface']['peer_group'] ]: + raise ConfigError('Remote AS must be set for neighbor or peer-group!') + + elif 'remote_as' not in peer_config: + if 'peer_group' not in peer_config or 'remote_as' not in asn_config['peer_group'][ peer_config['peer_group'] ]: raise ConfigError('Remote AS must be set for neighbor or peer-group!') for afi in ['ipv4_unicast', 'ipv6_unicast']: |