From b2089e76aed939b4b923ef00291f11dd1570b2d3 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Fri, 14 Jul 2023 06:57:11 +0200 Subject: bgp: T5338: bugfix MPLS VRF error handling Commit 6e621e42f ("bgp: T5338: simplify XML and code handling") hat a wrong if branch when handling the check if an interface belongs to the proper VRF when MPLS forwarding is used. This has been fixed. --- src/conf_mode/protocols_bgp.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') 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']: -- cgit v1.2.3