Page MenuHomeVyOS Platform

Route reflector client check not working for peer-group
In progress, NormalPublicBUG

Description

Currently in conf_mode/protocols_bgp.py the check for route_reflector_client is like so :

if 'route_reflector_client' in afi_config:
  peer_group_as = peer_config.get('remote_as')

  if peer_group_as is None or (peer_group_as != 'internal' and peer_group_as != bgp['system_as']):
      raise ConfigError('route-reflector-client only supported for iBGP peers')
  else:
      if 'peer_group' in peer_config:
          peer_group_as = dict_search(f'peer_group.{peer_group}.remote_as', bgp)
          if peer_group_as is None or (peer_group_as != 'internal' and peer_group_as != bgp['system_as']):
              raise ConfigError('route-reflector-client only supported for iBGP peers')

The issue with this code is that is is searching for the remote_as and if it doesn't find it (None), it raise the config error, instead of using the condition in else

What would work instead :

if 'route_reflector_client' in afi_config:                     
  peer_as = peer_config.get('remote_as')

  if peer_as is not None and (peer_group_as != 'internal' and peer_group_as != bgp['system_as']):
      raise ConfigError('route-reflector-client only supported for iBGP peers')
  else:                                          
      if 'peer_group' in peer_config:                
          peer_group_as = dict_search(f'peer_group.{peer_group}.remote_as', bgp)
          print('peer_group_as', peer_group_as)
          if peer_group_as is None or (peer_group_as != 'internal' and peer_group_as != bgp['system_as']):
              raise ConfigError('route-reflector-client only supported for iBGP peers')

That would fix the impossiblity to use the route reflector client argument with peer groups

Details

Version
1.5-rolling-202502220006
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)