Skip to content

tests: add BGP unnumbered VLAN subinterface topotest - #22488

Merged
riw777 merged 5 commits into
FRRouting:masterfrom
sudharr86:bgp-unnumbered-vlan-subintf-topotest
Jul 5, 2026
Merged

riw777 merged 5 commits into
FRRouting:masterfrom
sudharr86:bgp-unnumbered-vlan-subintf-topotest

Conversation

@sudharr86

@sudharr86 sudharr86 commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a topotest for BGP unnumbered sessions over VLAN subinterfaces.

Why

BGP unnumbered should continue to establish sessions and exchange routes when the peering interface is a VLAN subinterface. The test coverage makes that behavior explicit.

Changes

  • Add a two-router BGP unnumbered topology using VLAN subinterfaces.
  • Verify neighbor establishment and route propagation through the topology.

Related

Validation

  • git diff --check upstream/master..HEAD
  • PYTHONPYCACHEPREFIX=/private/tmp/codex-pycache-frr python3 -m py_compile tests/topotests/bgp_unnumbered_subif/test_bgp_unnumbered_subif.py
  • Reviewed the diff for unintended references.

Add a topotest that forms eBGP unnumbered sessions over VLAN subinterfaces, verifies route exchange, exercises link shutdown and restore, and removes an interface peer.

Signed-off-by: Sudharsan Rajagopalan <sudharr@cisco.com>
@riw777

riw777 commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

Please use the unified config rather that protocol config files

@riw777
riw777 self-requested a review June 30, 2026 12:52
Replace per-daemon bgpd.conf and zebra.conf files with integrated frr.conf files and load them with load_frr_config().

Signed-off-by: Sudharsan Rajagopalan <203154411+sudharr86@users.noreply.github.com>
@github-actions github-actions Bot added the rebase PR needs rebase label Jun 30, 2026
@sudharr86

Copy link
Copy Markdown
Contributor Author

Please use the unified config rather that protocol config files

yes fixing it. thanks

@sudharr86

Copy link
Copy Markdown
Contributor Author

Updated this to use unified frr.conf files for both routers and load them with load_frr_config. Thanks.

@riw777

riw777 commented Jul 1, 2026

Copy link
Copy Markdown
Member

Updated this to use unified frr.conf files for both routers and load them with load_frr_config. Thanks.

Thanks! Please let me know when you're ready for final review on this ... this far everything looks good, just waiting on the move from draft to "ready" state.

@sudharr86
sudharr86 marked this pull request as ready for review July 1, 2026 17:31
@sudharr86

Copy link
Copy Markdown
Contributor Author

Updated this to use unified frr.conf files for both routers and load them with load_frr_config. Thanks.

Thanks! Please let me know when you're ready for final review on this ... this far everything looks good, just waiting on the move from draft to "ready" state.

@riw777 this can be merged. Thanks.

@greptile-apps

greptile-apps Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR adds a new topotest (bgp_unnumbered_subif) verifying that BGP unnumbered sessions establish and exchange routes over VLAN subinterfaces, filling a gap left by the existing bgp_unnumbered test which only covers physical interfaces.

  • Adds five test cases covering session bring-up, route propagation, link-down/restore, and BGP peer removal without crash, using VLAN subinterfaces (r1-eth0.100, r1-eth0.200) created via router.net.add_vlan.
  • The add_vlan/del_iface lifecycle and the BGP helper functions (_bgp_summary_check, _check_route_present) follow the same patterns used in bfd_vrflite_topo1 and other existing FRR topotests; previously flagged issues (unused _check_route_absent helper and unread success bindings) have been resolved.

Confidence Score: 5/5

Safe to merge — this is a new self-contained topotest with no changes to existing code or configs.

The test adds five well-scoped cases, follows the same add_vlan/del_iface lifecycle used in bfd_vrflite_topo1, and checks BGP state via the correct JSON keys (interface name for unnumbered peers in show bgp summary, prefix keys in show bgp ipv4 unicast). Previously flagged dead code and unread return values have both been cleaned up. No defects found.

No files require special attention.

Important Files Changed

Filename Overview
tests/topotests/bgp_unnumbered_subif/test_bgp_unnumbered_subif.py Core test logic: five test cases covering session establishment, route exchange, link-down/restore, and peer removal. Uses well-established FRR topotest patterns; helpers are used correctly and previously flagged dead code has been removed.
tests/topotests/bgp_unnumbered_subif/r1/frr.conf R1 FRR config: BGP AS 65001 with unnumbered peers on r1-eth0.100 and r1-eth0.200, loopback 10.10.10.1/32 redistributed into BGP. Config is correct.
tests/topotests/bgp_unnumbered_subif/r2/frr.conf R2 FRR config: BGP AS 65002 with unnumbered peers on r2-eth0.100 and r2-eth0.200, loopback 10.10.10.2/32 redistributed. Symmetric and correct.
tests/topotests/bgp_unnumbered_subif/init.py Empty init file marking the directory as a Python package — standard for FRR topotests.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant T as Test Runner
    participant R1 as R1 (AS 65001)
    participant R2 as R2 (AS 65002)

    Note over T,R2: setup_module
    T->>R1: add_vlan r1-eth0.100 / r1-eth0.200
    T->>R2: add_vlan r2-eth0.100 / r2-eth0.200
    T->>R1: load_frr_config (r1/frr.conf)
    T->>R2: load_frr_config (r2/frr.conf)
    R1-->>R2: IPv6 ND RA on .100 and .200
    R2-->>R1: IPv6 ND RA on .100 and .200

    Note over T,R2: Test 1 - Sessions
    R1->>R2: BGP OPEN (r1-eth0.100)
    R2->>R1: BGP OPEN (r2-eth0.100)
    R1->>R2: BGP OPEN (r1-eth0.200)
    R2->>R1: BGP OPEN (r2-eth0.200)
    T->>R1: show bgp summary json → Established
    T->>R2: show bgp summary json → Established

    Note over T,R2: Test 2 - Routes
    R1->>R2: UPDATE 10.10.10.1/32 (connected)
    R2->>R1: UPDATE 10.10.10.2/32 (connected)
    T->>R1: show bgp ipv4 unicast json → 10.10.10.2/32 present
    T->>R2: show bgp ipv4 unicast json → 10.10.10.1/32 present

    Note over T,R2: Test 3 - Link Down
    T->>R1: interface r1-eth0.100 shutdown
    R1-->>R2: BGP NOTIFICATION (r1-eth0.100 down)
    T->>R1: .100 not Established, .200 still Established
    T->>R2: r2-eth0.100 not Established

    Note over T,R2: Test 4 - Link Restore
    T->>R1: interface r1-eth0.100 no shutdown
    R1->>R2: BGP OPEN (r1-eth0.100 re-establishes)
    T->>R1: both .100 and .200 Established
    T->>R1: 10.10.10.2/32 re-learned

    Note over T,R2: Test 5 - Peer Removal
    T->>R1: no neighbor r1-eth0.200 interface remote-as external
    T->>R1: .100 Established, .200 gone from peers
    T->>R1: 10.10.10.2/32 still present (via .100)

    Note over T,R2: teardown_module
    T->>R1: del_iface r1-eth0.100 / r1-eth0.200
    T->>R2: del_iface r2-eth0.100 / r2-eth0.200
    T->>T: stop_topology
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant T as Test Runner
    participant R1 as R1 (AS 65001)
    participant R2 as R2 (AS 65002)

    Note over T,R2: setup_module
    T->>R1: add_vlan r1-eth0.100 / r1-eth0.200
    T->>R2: add_vlan r2-eth0.100 / r2-eth0.200
    T->>R1: load_frr_config (r1/frr.conf)
    T->>R2: load_frr_config (r2/frr.conf)
    R1-->>R2: IPv6 ND RA on .100 and .200
    R2-->>R1: IPv6 ND RA on .100 and .200

    Note over T,R2: Test 1 - Sessions
    R1->>R2: BGP OPEN (r1-eth0.100)
    R2->>R1: BGP OPEN (r2-eth0.100)
    R1->>R2: BGP OPEN (r1-eth0.200)
    R2->>R1: BGP OPEN (r2-eth0.200)
    T->>R1: show bgp summary json → Established
    T->>R2: show bgp summary json → Established

    Note over T,R2: Test 2 - Routes
    R1->>R2: UPDATE 10.10.10.1/32 (connected)
    R2->>R1: UPDATE 10.10.10.2/32 (connected)
    T->>R1: show bgp ipv4 unicast json → 10.10.10.2/32 present
    T->>R2: show bgp ipv4 unicast json → 10.10.10.1/32 present

    Note over T,R2: Test 3 - Link Down
    T->>R1: interface r1-eth0.100 shutdown
    R1-->>R2: BGP NOTIFICATION (r1-eth0.100 down)
    T->>R1: .100 not Established, .200 still Established
    T->>R2: r2-eth0.100 not Established

    Note over T,R2: Test 4 - Link Restore
    T->>R1: interface r1-eth0.100 no shutdown
    R1->>R2: BGP OPEN (r1-eth0.100 re-establishes)
    T->>R1: both .100 and .200 Established
    T->>R1: 10.10.10.2/32 re-learned

    Note over T,R2: Test 5 - Peer Removal
    T->>R1: no neighbor r1-eth0.200 interface remote-as external
    T->>R1: .100 Established, .200 gone from peers
    T->>R1: 10.10.10.2/32 still present (via .100)

    Note over T,R2: teardown_module
    T->>R1: del_iface r1-eth0.100 / r1-eth0.200
    T->>R2: del_iface r2-eth0.100 / r2-eth0.200
    T->>T: stop_topology
Loading

Reviews (5): Last reviewed commit: "tests: honor expected BGP peer state in ..." | Re-trigger Greptile

Comment thread tests/topotests/bgp_unnumbered_subif/test_bgp_unnumbered_subif.py Outdated
Comment thread tests/topotests/bgp_unnumbered_subif/test_bgp_unnumbered_subif.py Outdated
Signed-off-by: Sudharsan Rajagopalan <203154411+sudharr86@users.noreply.github.com>
@sudharr86

Copy link
Copy Markdown
Contributor Author

Addressed the review cleanup and the PR is ready for final review.

@sudharr86

Copy link
Copy Markdown
Contributor Author

@greptile-apps review

Signed-off-by: Sudharsan Rajagopalan <203154411+sudharr86@users.noreply.github.com>
@sudharr86

Copy link
Copy Markdown
Contributor Author

Added the missing topotest package marker. @greptile-apps review

@sudharr86

Copy link
Copy Markdown
Contributor Author

@greptileai rereview

Signed-off-by: Sudharsan Rajagopalan <203154411+sudharr86@users.noreply.github.com>
@sudharr86

Copy link
Copy Markdown
Contributor Author

Addressed the helper-state check noted in the rereview. @greptileai rereview

@riw777 riw777 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good

@pbrisset
pbrisset self-requested a review July 3, 2026 17:56
@riw777
riw777 merged commit 96892d4 into FRRouting:master Jul 5, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

master rebase PR needs rebase size/L tests Topotests, make check, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants