Skip to content

T7364: Fixing Route reflector client check not working for peer-group #4452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2025

Conversation

Hanarion
Copy link
Contributor

@Hanarion Hanarion commented Apr 14, 2025

Change summary

Fixing the route reflector client check in order for it to work when using a peer-group

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

https://vyos.dev/T7364

Related PR(s)

None

How to test / Smoketest result

Create a peer group, add a neighbour using this peer group and try to add the route-reflector-client attribute.

set protocols bgp neighbor 10.0.0.1 address-family ipv4-unicast nexthop-self force
set protocols bgp neighbor 10.0.0.1 address-family ipv4-unicast route-reflector-client
set protocols bgp neighbor 10.0.0.1 peer-group 'NBRGRP-EXAMPLE-IBGP-V4'
set protocols bgp neighbor 10.0.0.1 update-source '10.0.0.2'

set protocols bgp peer-group NBRGRP-EXAMPLE-IBGP-V4 remote-as '65000'
set protocols bgp system-as '65000'

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Copy link

github-actions bot commented Apr 14, 2025

👍
No issues in PR Title / Commit Title

@sever-sever
Copy link
Member

sever-sever commented Apr 14, 2025

Update please the commit-message It has to include the task number as in the PR title
com-mes

Use git commit --amend + force-push

@Hanarion
Copy link
Contributor Author

Hanarion commented Apr 14, 2025

Update please the commit-message It has to include the task number as in the PR title

My bad, just fixed it

@sever-sever
Copy link
Member

Smoketest does not like your changes :)

 DEBUG - Running Testcase: /usr/libexec/vyos/tests/smoke/cli/test_protocols_bgp.py
DEBUG - test_bgp_01_simple (__main__.TestProtocolsBGP.test_bgp_01_simple) ... ok
DEBUG - test_bgp_02_neighbors (__main__.TestProtocolsBGP.test_bgp_02_neighbors) ... ok
DEBUG - test_bgp_03_peer_groups (__main__.TestProtocolsBGP.test_bgp_03_peer_groups) ... ok
DEBUG - test_bgp_04_afi_ipv4 (__main__.TestProtocolsBGP.test_bgp_04_afi_ipv4) ... ok
DEBUG - test_bgp_05_afi_ipv6 (__main__.TestProtocolsBGP.test_bgp_05_afi_ipv6) ... ok
DEBUG - test_bgp_06_listen_range (__main__.TestProtocolsBGP.test_bgp_06_listen_range) ... ok
DEBUG - test_bgp_07_l2vpn_evpn (__main__.TestProtocolsBGP.test_bgp_07_l2vpn_evpn) ... ok
DEBUG - test_bgp_09_distance_and_flowspec (__main__.TestProtocolsBGP.test_bgp_09_distance_and_flowspec) ... ok
DEBUG - test_bgp_10_vrf_simple (__main__.TestProtocolsBGP.test_bgp_10_vrf_simple) ... ok
DEBUG - test_bgp_11_confederation (__main__.TestProtocolsBGP.test_bgp_11_confederation) ... ok
DEBUG - test_bgp_12_v6_link_local (__main__.TestProtocolsBGP.test_bgp_12_v6_link_local) ... ok
DEBUG - test_bgp_13_vpn (__main__.TestProtocolsBGP.test_bgp_13_vpn) ... ok
DEBUG - test_bgp_14_remote_as_peer_group_override (__main__.TestProtocolsBGP.test_bgp_14_remote_as_peer_group_override) ... ok
DEBUG - test_bgp_15_local_as_ebgp (__main__.TestProtocolsBGP.test_bgp_15_local_as_ebgp) ... ok
DEBUG - test_bgp_16_import_rd_rt_compatibility (__main__.TestProtocolsBGP.test_bgp_16_import_rd_rt_compatibility) ... ok
DEBUG - test_bgp_17_import_rd_rt_compatibility (__main__.TestProtocolsBGP.test_bgp_17_import_rd_rt_compatibility) ... ok
DEBUG - test_bgp_18_deleting_import_vrf (__main__.TestProtocolsBGP.test_bgp_18_deleting_import_vrf) ... ok
DEBUG - test_bgp_19_deleting_default_vrf (__main__.TestProtocolsBGP.test_bgp_19_deleting_default_vrf) ... ok
DEBUG - test_bgp_20_import_rd_rt_compatibility (__main__.TestProtocolsBGP.test_bgp_20_import_rd_rt_compatibility) ... ok
DEBUG - test_bgp_21_import_unspecified_vrf (__main__.TestProtocolsBGP.test_bgp_21_import_unspecified_vrf) ... ok
DEBUG - test_bgp_22_interface_mpls_forwarding (__main__.TestProtocolsBGP.test_bgp_22_interface_mpls_forwarding) ... ok
DEBUG - test_bgp_23_vrf_interface_mpls_forwarding (__main__.TestProtocolsBGP.test_bgp_23_vrf_interface_mpls_forwarding) ... ok
DEBUG - test_bgp_24_srv6_sid (__main__.TestProtocolsBGP.test_bgp_24_srv6_sid) ... ok
DEBUG - test_bgp_25_ipv4_labeled_unicast_peer_group (__main__.TestProtocolsBGP.test_bgp_25_ipv4_labeled_unicast_peer_group) ... ok
DEBUG - test_bgp_26_ipv6_labeled_unicast_peer_group (__main__.TestProtocolsBGP.test_bgp_26_ipv6_labeled_unicast_peer_group) ... ok
DEBUG - test_bgp_27_route_reflector_client (__main__.TestProtocolsBGP.test_bgp_27_route_reflector_client) ... FAIL
DEBUG - test_bgp_28_peer_group_member_all_internal_or_external (__main__.TestProtocolsBGP.test_bgp_28_peer_group_member_all_internal_or_external) ... ok
DEBUG - test_bgp_29_peer_group_remote_as_equal_local_as (__main__.TestProtocolsBGP.test_bgp_29_peer_group_remote_as_equal_local_as) ... ok
DEBUG - test_bgp_30_import_vrf_routemap (__main__.TestProtocolsBGP.test_bgp_30_import_vrf_routemap) ... ok
DEBUG - test_bgp_99_bmp (__main__.TestProtocolsBGP.test_bgp_99_bmp) ... ok
DEBUG - 
DEBUG - ======================================================================
DEBUG - FAIL: test_bgp_27_route_reflector_client (__main__.TestProtocolsBGP.test_bgp_27_route_reflector_client)
DEBUG - ----------------------------------------------------------------------
DEBUG - Traceback (most recent call last):
DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/test_protocols_bgp.py", line 1440, in test_bgp_27_route_reflector_client
DEBUG -     with self.assertRaises(ConfigSessionError) as e:
DEBUG - AssertionError: ConfigSessionError not raised
DEBUG - 
DEBUG - ----------------------------------------------------------------------
DEBUG - Ran 30 tests in 425.225s
DEBUG - 
DEBUG - FAILED (failures=1)
DEBUG - Running Testcase: /usr/libexec/vyos/tests/smoke/cli/test_protocols_igmp-proxy.py
DEBUG - test_igmpproxy (__main__.TestProtocolsIGMPProxy.test_igmpproxy) ... ok
DEBUG - 
DEBUG - ----------------------------------------------------------------------
DEBUG - Ran 1 test in 10.505s

@Hanarion
Copy link
Contributor Author

Just looked into it quickly, seems to be because the fix i did is only working when using the route reflector client on the neighbor directly, not in a peer group, i'll check if i can add a condition to fix it

@Hanarion
Copy link
Contributor Author

Should be fixed, when changing the condition, there was no check if we were in a peer group, so it tried to find the peer group of a peer group to find the ASN, failing to do so and exiting the if.
I added a

elif neighbor == 'peer_group':
    peer_group_as = peer_config.get('remote_as')

Copy link

CI integration ❌ failed!

Details

CI logs

  • CLI Smoketests (no interfaces) 👍 passed
  • CLI Smoketests (interfaces only) ❌ failed
  • Config tests 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

@Hanarion Hanarion removed their assignment Apr 18, 2025
@Hanarion
Copy link
Contributor Author

The failing in the tests seems unrelated :

DEBUG - ======================================================================
DEBUG - FAIL: test_ethtool_evpn_uplink_tracking (__main__.EthernetInterfaceTest.test_ethtool_evpn_uplink_tracking)
DEBUG - ----------------------------------------------------------------------
DEBUG - Traceback (most recent call last):
DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/test_interfaces_ethernet.py", line 231, in test_ethtool_evpn_uplink_tracking
DEBUG -     self.assertIn(' evpn mh uplink', frrconfig)
DEBUG - AssertionError: ' evpn mh uplink' not found in ''
DEBUG - 
DEBUG - ----------------------------------------------------------------------
DEBUG - Ran 34 tests in 985.054s
DEBUG - 
DEBUG - FAILED (failures=1)
def test_ethtool_evpn_uplink_tracking(self):
        for interface in self._interfaces:
            self.cli_set(self._base_path + [interface, 'evpn', 'uplink'])

        self.cli_commit()

        for interface in self._interfaces:
            frrconfig = self.getFRRconfig(f'interface {interface}', endsection='^exit')
            self.assertIn(' evpn mh uplink', frrconfig)

Maybe a change in current that affected the tests ?

@c-po
Copy link
Member

c-po commented Apr 24, 2025

Maybe a change in current that affected the tests ?

It's a false positive caused by a timing error when reading back the bgpd configuration. You can omit this.

@sever-sever sever-sever requested a review from Copilot April 25, 2025 15:46
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the route reflector client validation when using a peer-group in BGP configurations. The changes update variable names and the conditional logic to correctly validate the remote AS values from both the peer and its peer-group.

  • Rename variable from peer_group_as to peer_as for clarity.
  • Adjust conditional checks to verify remote AS values correctly.
  • Add a fallback check into the peer group if the direct check does not pass.
Comments suppressed due to low confidence (1)

src/conf_mode/protocols_bgp.py:422

  • The variable 'peer_group' is not defined in this context. Consider using 'peer_config["peer_group"]' to retrieve the peer group name before passing it to dict_search.
peer_group_as = dict_search(f'peer_group.{peer_group}.remote_as', bgp)

@sever-sever
Copy link
Member

sever-sever commented Apr 30, 2025

@Hanarion, can you add an example of the set commands to reproduce when it failed? (which exac issue solves this PR)

@Hanarion
Copy link
Contributor Author

Hanarion commented May 1, 2025

@Hanarion, can you add an example of the set commands to reproduce when it failed? (which exac issue solves this PR)

Sure, here is an example (Also added in the original PR content) :

set protocols bgp neighbor 10.0.0.1 address-family ipv4-unicast nexthop-self force
set protocols bgp neighbor 10.0.0.1 address-family ipv4-unicast route-reflector-client
set protocols bgp neighbor 10.0.0.1 peer-group 'NBRGRP-EXAMPLE-IBGP-V4'
set protocols bgp neighbor 10.0.0.1 update-source '10.0.0.2'

set protocols bgp peer-group NBRGRP-EXAMPLE-IBGP-V4 remote-as '65000'
set protocols bgp system-as '65000'

Copy link
Member

@sever-sever sever-sever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue when the peer in the group and has its own specific neighbor route-reflector-client configuration

vyos@r14# commit
[ protocols bgp ]
route-reflector-client only supported for iBGP peers
[[protocols bgp]] failed
Commit failed
[edit]
vyos@r14# 

@sever-sever sever-sever added the bp/circinus Create automatic backport for circinus label May 1, 2025
@github-actions github-actions bot added the rebase label May 1, 2025
Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests pass and the logic is straightforward, no objections.

@dmbaturin dmbaturin added the bp/sagitta Create automatic backport for sagitta LTS version label May 1, 2025
@dmbaturin dmbaturin merged commit 625c6a1 into vyos:current May 1, 2025
15 of 17 checks passed
@github-actions github-actions bot added the mirror-initiated This PR initiated for mirror sync workflow label May 1, 2025
@vyosbot vyosbot added mirror-completed and removed mirror-initiated This PR initiated for mirror sync workflow labels May 1, 2025
@sever-sever
Copy link
Member

@Hanarion there is a bug after this commit https://vyos.dev/T7497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bp/circinus Create automatic backport for circinus bp/sagitta Create automatic backport for sagitta LTS version current mirror-completed rebase
Development

Successfully merging this pull request may close these issues.

5 participants