diff options
Diffstat (limited to 'src')
-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 79d97860b..6a33a2794 100755 --- a/src/conf_mode/protocols_bgp.py +++ b/src/conf_mode/protocols_bgp.py @@ -242,9 +242,14 @@ def verify(bgp): # Verify vrf on interface and bgp section if 'interface' in bgp: for interface in bgp['interface']: + error_msg = f'Interface "{interface}" belongs to different VRF instance' tmp = get_interface_vrf(interface) - if ('vrf' in bgp and bgp['vrf'] != tmp) or tmp != 'default': - raise ConfigError(f'Interface "{interface}" belongs to different VRF instance!') + if 'vrf' in bgp: + if bgp['vrf'] != tmp: + vrf = bgp['vrf'] + raise ConfigError(f'{error_msg} "{vrf}"!') + elif tmp != 'default': + raise ConfigError(f'{error_msg} "{tmp}"!') # Common verification for both peer-group and neighbor statements for neighbor in ['neighbor', 'peer_group']: |