Skip to content

tests: fix bgp_soo topotest by separating IPv4/IPv6 address families - #22128

Merged
donaldsharp merged 1 commit into
FRRouting:masterfrom
enkechen-panw:test-bgp-soo
May 31, 2026
Merged

tests: fix bgp_soo topotest by separating IPv4/IPv6 address families#22128
donaldsharp merged 1 commit into
FRRouting:masterfrom
enkechen-panw:test-bgp-soo

Conversation

@enkechen-panw

Copy link
Copy Markdown
Contributor

The bgp_soo topotest was flaky because IPv4 routes were being advertised over both IPv4 and IPv6 BGP sessions due to the default behavior of "bgp default ipv4-unicast" which auto-activates IPv4 unicast for all neighbors.

This caused inconsistent path counts depending on timing:

  • Sometimes multiPathCount showed 2 or 3 instead of expected values
  • The duplicate paths from IPv6 sessions carrying IPv4 routes caused the flakiness

Fix by adding "no bgp default ipv4-unicast" to all routers and explicitly activating only the appropriate neighbors in each address-family:

  • IPv4 unicast: only IPv4 peers activated
  • IPv6 unicast: only IPv6 peers activated

Update test expectations to reflect the correct path counts now that duplicate paths are eliminated.

Note: The core SoO functionality is validated by test_bgp_soo() which checks route filtering based on SoO extended community matching. The pathCount/multiPathCount changes in other tests only affect JSON output format validation, not SoO behavior. Updated docstrings to clarify this.

The bgp_soo topotest was flaky because IPv4 routes were being advertised
over both IPv4 and IPv6 BGP sessions due to the default behavior of
"bgp default ipv4-unicast" which auto-activates IPv4 unicast for all
neighbors.

This caused inconsistent path counts depending on timing:
- Sometimes multiPathCount showed 2 or 3 instead of expected values
- The duplicate paths from IPv6 sessions carrying IPv4 routes caused
  the flakiness

Fix by adding "no bgp default ipv4-unicast" to all routers and explicitly
activating only the appropriate neighbors in each address-family:
- IPv4 unicast: only IPv4 peers activated
- IPv6 unicast: only IPv6 peers activated

Update test expectations to reflect the correct path counts now that
duplicate paths are eliminated.

Note: The core SoO functionality is validated by test_bgp_soo() which
checks route filtering based on SoO extended community matching. The
pathCount/multiPathCount changes in other tests only affect JSON output
format validation, not SoO behavior. Updated docstrings to clarify this.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
@frrbot frrbot Bot added bugfix tests Topotests, make check, etc labels May 31, 2026
@greptile-apps

greptile-apps Bot commented May 31, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a flaky topotest in bgp_soo by disabling the default IPv4 unicast auto-activation (no bgp default ipv4-unicast) on all four routers and explicitly activating only the correct address-family peers for each neighbor. This eliminates spurious duplicate IPv4 paths that were being carried over IPv6 BGP sessions, making path counts deterministic.

  • BGP configs (cpe1, cpe2, pe1, pe2): Added no bgp default ipv4-unicast and explicit neighbor … activate statements per address-family so IPv4 peers are only active in address-family ipv4 unicast and IPv6 peers only in address-family ipv6 unicast.
  • Test expectations: totalPaths in PE1 neighbor-routes views drops from 12 β†’ 8, per-route multiPathCount drops from 2 β†’ 1, and pathCount/multiPathCount for a few CPE1 advertised routes are reduced to reflect the now-clean single-path-per-AF topology.

Confidence Score: 5/5

Safe to merge β€” the change tightens address-family peer activation and updates test expectations to match; no production routing code is touched.

All five changed files are topotest infrastructure. The BGP config changes correctly apply no bgp default ipv4-unicast and re-add explicit per-AF activations, precisely matching the intended topology. The updated path counts in the Python test are internally consistent (4 routes Γ— 2 total paths in VPN RIB = 8, single multipath per route after duplicate elimination). The core SoO filtering test logic is unchanged.

No files require special attention.

Important Files Changed

Filename Overview
tests/topotests/bgp_soo/test_bgp_soo.py Updated path-count expectations to match the now-deterministic topology; added module docstring clarifying which tests validate SoO behavior vs. JSON output format. Core SoO test logic is unchanged.
tests/topotests/bgp_soo/pe1/bgpd.conf Added no bgp default ipv4-unicast to VRF RED instance and explicitly activated IPv4 peer (192.168.1.1) in ipv4 unicast and IPv6 peer (2001:db8:1::1) in ipv6 unicast. Correct and complete.
tests/topotests/bgp_soo/pe2/bgpd.conf Added no bgp default ipv4-unicast to VRF RED instance and explicitly activated 192.168.2.1 in ipv4 unicast; IPv6 unicast already had explicit activation. Consistent with pe1 treatment.
tests/topotests/bgp_soo/cpe1/bgpd.conf Added no bgp default ipv4-unicast and activated IPv4-only neighbors (192.168.1.2 eBGP, 10.0.0.2 iBGP) in ipv4 unicast; IPv6 neighbors are already exclusively in ipv6 unicast.
tests/topotests/bgp_soo/cpe2/bgpd.conf Mirror of cpe1 changes: no bgp default ipv4-unicast, IPv4 peers activated in ipv4 unicast only. IPv6 neighbors correctly isolated in ipv6 unicast.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    CPE1["CPE1 (AS 65000)"]
    CPE2["CPE2 (AS 65000)"]
    PE1["PE1 VRF RED (AS 65001)"]
    PE2["PE2 VRF RED (AS 65001)"]

    CPE1 -- "IPv4 eBGP 192.168.1.x" --> PE1
    CPE1 -- "IPv6 eBGP 2001:db8:1::x" --> PE1
    CPE2 -- "IPv4 eBGP 192.168.2.x" --> PE2
    CPE2 -- "IPv6 eBGP 2001:db8:2::x" --> PE2
    PE1 -- "IPv4 VPN iBGP 10.10.10.x" --> PE2
    CPE1 -- "IPv4 iBGP 10.0.0.x" --> CPE2
    CPE1 -- "IPv6 iBGP 2001:db8:10::x" --> CPE2
Loading

Reviews (1): Last reviewed commit: "tests: fix bgp_soo topotest by separatin..." | Re-trigger Greptile

@donaldsharp
donaldsharp merged commit e865c3a into FRRouting:master May 31, 2026
25 checks passed
@enkechen-panw
enkechen-panw deleted the test-bgp-soo branch May 31, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix master size/M tests Topotests, make check, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants