Skip to content

bgpd: EVPN rd all or specific rd options based route table - #21843

Merged
ton31337 merged 6 commits into
FRRouting:masterfrom
chiragshah6:zdev
May 3, 2026
Merged

bgpd: EVPN rd all or specific rd options based route table #21843
ton31337 merged 6 commits into
FRRouting:masterfrom
chiragshah6:zdev

Conversation

@chiragshah6

@chiragshah6 chiragshah6 commented May 2, 2026

Copy link
Copy Markdown
Member
btor-11# show bgp l2vpn evpn route rd all prefix 2060:1:1:110::/64
Route Distinguisher: 144.1.1.6:9
BGP routing table entry for 144.1.1.6:9:[5]:[0]:[64]:[2060:1:1:110::]
Paths: (1 available, best https://github.com/FRRouting/frr/pull/1)
  Not advertised to any peer
  Route [5]:[0]:[64]:[2060:1:1:110::] VNI 104002
  Local
    6.0.0.1 (bordertor-11) from 0.0.0.0 (6.0.0.1)
      Origin incomplete, metric 0, weight 32768, valid,
      sourced, local, bestpath-from-AS Local, best (First path received)
      Extended Community: ET:8 RT:60176:104002 Rmac:00:01:00:00:01:08
      Last update: Sun Apr 26 00:12:25 2026

Displayed 1 prefixes (1 paths)

Json:

btor-11# show bgp l2vpn evpn route rd all prefix 2060:1:1:110::/64 json
{
  "144.1.1.6:9":{
    "rd":"144.1.1.6:9",
    "prefix":"[5]:[0]:[64]:[2060:1:1:110::]",
    "prefixLen":352,
    "routeType":5,
  ....
  },
  "numPrefix":1,
  "numPaths":1
}

specific rd routes:

btor-11# show bgp l2vpn evpn route rd 144.1.1.6:9                                                      
EVPN type-1 prefix: [1]:[EthTag]:[ESI]:[IPlen]:[VTEP-IP]:[Frag-id]
EVPN type-2 prefix: [2]:[EthTag]:[MAClen]:[MAC]
EVPN type-3 prefix: [3]:[EthTag]:[IPlen]:[OrigIP]
EVPN type-4 prefix: [4]:[ESI]:[IPlen]:[OrigIP]
EVPN type-5 prefix: [5]:[EthTag]:[IPlen]:[IP]
EVPN unreachable prefix: [254]:[EthTag]:[IPlen]:[IP]

BGP routing table entry for 144.1.1.6:9:[5]:[0]:[24]:[60.1.110.0]
Paths: (1 available, best #1)
  Advertised to peers:
  leaf-11(swp1) leaf-12(swp2)
  Route [5]:[0]:[24]:[60.1.110.0] VNI 104002
  Local
    6.0.0.1 (bordertor-11) from 0.0.0.0 (6.0.0.1)
      Origin incomplete, metric 0, weight 32768, valid, sourced, local, bestpath-from-AS Local, best (First path recei
ved)
      Extended Community: ET:8 RT:60176:104002 Rmac:00:01:00:00:01:08
      Last update: Thu Apr 30 17:46:29 2026
BGP routing table entry for 144.1.1.6:9:[5]:[0]:[24]:[81.1.1.0]
Paths: (1 available, best #1)
  Advertised to peers:
  leaf-11(swp1) leaf-12(swp2)
  Route [5]:[0]:[24]:[81.1.1.0] VNI 104002
  655000
    6.0.0.1 (bordertor-11) from 0.0.0.0 (6.0.0.1)
      Origin incomplete, metric 0, valid, sourced, local, bestpath-from-AS 655000, best (First path received)
      Extended Community: ET:8 RT:60176:104002 Rmac:00:01:00:00:01:08
      Last update: Thu Apr 30 17:46:31 2026
BGP routing table entry for 144.1.1.6:9:[5]:[0]:[24]:[81.1.2.0]
Paths: (1 available, best #1)
  Advertised to peers:
  leaf-11(swp1) leaf-12(swp2)
  Route [5]:[0]:[24]:[81.1.2.0] VNI 104002
  655000
    6.0.0.1 (bordertor-11) from 0.0.0.0 (6.0.0.1)
      Origin incomplete, metric 0, valid, sourced, local, bestpath-from-AS 655000, best (First path received)
      Extended Community: ET:8 RT:60176:104002 Rmac:00:01:00:00:01:08
      Last update: Thu Apr 30 17:46:31 2026
BGP routing table entry for 144.1.1.6:9:[5]:[0]:[24]:[81.1.3.0]
Paths: (1 available, best #1)
  Advertised to peers:
  leaf-11(swp1) leaf-12(swp2)
  Route [5]:[0]:[24]:[81.1.3.0] VNI 104002
  655000
    6.0.0.1 (bordertor-11) from 0.0.0.0 (6.0.0.1)
      Origin incomplete, metric 0, valid, sourced, local, bestpath-from-AS 655000, best (First path received)
      Extended Community: ET:8 RT:60176:104002 Rmac:00:01:00:00:01:08
      Last update: Thu Apr 30 17:46:31 2026
BGP routing table entry for 144.1.1.6:9:[5]:[0]:[24]:[81.1.2.0]
Paths: (1 available, best #1)
  Advertised to peers:
  leaf-11(swp1) leaf-12(swp2)
  Route [5]:[0]:[24]:[81.1.2.0] VNI 104002
  655000
    6.0.0.1 (bordertor-11) from 0.0.0.0 (6.0.0.1)
      Origin incomplete, metric 0, valid, sourced, local, bestpath-from-AS 655000, best (First path received)
      Extended Community: ET:8 RT:60176:104002 Rmac:00:01:00:00:01:08
      Last update: Thu Apr 30 17:46:31 2026
BGP routing table entry for 144.1.1.6:9:[5]:[0]:[24]:[81.1.3.0]
Paths: (1 available, best #1)
  Advertised to peers:
  leaf-11(swp1) leaf-12(swp2)
  Route [5]:[0]:[24]:[81.1.3.0] VNI 104002
  655000
    6.0.0.1 (bordertor-11) from 0.0.0.0 (6.0.0.1)
      Origin incomplete, metric 0, valid, sourced, local, bestpath-from-AS 655000, best (First path received)
      Extended Community: ET:8 RT:60176:104002 Rmac:00:01:00:00:01:08
      Last update: Thu Apr 30 17:46:31 2026
 ...
Displayed 12 prefixes (12 paths) with this RD

Signed-off-by: Vivek Venkatraman vivek@nvidia.com
Signed-off-by: Chirag Shah chirag@nvidia.com

vivek-cumulus and others added 2 commits May 2, 2026 13:29
Add support for command
show bgp l2vpn evpn route rd <rd> prefix <prefix> [json]

This is currently a Cumulus-specific change. Multiple of the EVPN operational
commands need to be unified with upstream changes which have now caught up
to display most of the needed information of the global EVPN table but differ
in some aspects from existing Cumulus commands. The unification also needs
to handle per-VNI (per-EVI) information and will be post CL 4.2.

Ticket: CM-26918
Reviewed By:  Output reviewed by Mahesh & Chirag
Testing Done:
1. Manual check
2. Precommit -
https://trdb.cumulusnetworks.com/trdb3/product/1/userjobs?user=vivek&job=32

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Signed-off-by: Vivek Venkatraman <vivek@nvidia.com>
Ticket: #4992460

Testing:

Before fix:

btor-11# show bgp l2vpn evpn route rd all prefix 2060:1:1:110::/64
% Malformed Route Distinguisher

After fix:

btor-11# show bgp l2vpn evpn route rd all prefix 2060:1:1:110::/64
Route Distinguisher: 144.1.1.6:9
BGP routing table entry for 144.1.1.6:9:[5]:[0]:[64]:[2060:1:1:110::]
Paths: (1 available, best FRRouting#1)
  Not advertised to any peer
  Route [5]:[0]:[64]:[2060:1:1:110::] VNI 104002
  Local
    6.0.0.1 (bordertor-11) from 0.0.0.0 (6.0.0.1)
      Origin incomplete, metric 0, weight 32768, valid,
      sourced, local, bestpath-from-AS Local, best (First path received)
      Extended Community: ET:8 RT:60176:104002 Rmac:00:01:00:00:01:08
      Last update: Sun Apr 26 00:12:25 2026

Displayed 1 prefixes (1 paths)

Json:

btor-11# show bgp l2vpn evpn route rd all prefix 2060:1:1:110::/64 json
{
  "144.1.1.6:9":{
    "rd":"144.1.1.6:9",
    "prefix":"[5]:[0]:[64]:[2060:1:1:110::]",
    "prefixLen":352,
    "routeType":5,
  ....
  },
  "numPrefix":1,
  "numPaths":1
}

Assisted-by: Cluade

Signed-off-by: Chirag Shah <chirag@nvidia.com>
@greptile-apps

greptile-apps Bot commented May 2, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds two new VTY show handlers β€” evpn_show_route_rd_all_prefix and evpn_show_route_rd_prefix β€” exposing show bgp l2vpn evpn route rd <all|RD> prefix <prefix> for EVPN Type-5 lookup. Topotest coverage is added for both hit and miss cases under IPv4 and IPv6 VTEP underlays. The previously flagged ref-count leaks and the unused prefix_str variable are no longer present in this version.

Confidence Score: 5/5

PR is safe to merge; prior lock-leak issues addressed and new code closely follows the evpn_show_route_rd_macip pattern

No new P0/P1 issues identified. The ref-count management concerns from previous review threads are resolved. Both new handler functions correctly mirror the existing evpn_show_route_rd_macip reference implementation, including proper bgp_dest_unlock_node calls on all paths.

No files require special attention

Important Files Changed

Filename Overview
bgpd/bgp_evpn_vty.c Adds evpn_show_route_rd_all_prefix and evpn_show_route_rd_prefix VTY handlers plus their DEFPY/ALIAS_HIDDEN wiring; prior-thread lock-leak issues are addressed
tests/topotests/bgp_evpn_three_tier_clos_topo1/test_bgp_evpn_v4_v6_vtep.py Adds test_evpn_rd_prefix_route_lookup and helper functions; correctly retries via run_and_expect and covers hit/miss cases for both rd-all and specific-RD commands
doc/user/bgp.rst Documents the new show bgp l2vpn evpn route rd <all
tests/topotests/bgp_evpn_three_tier_clos_topo1/README.md Updates README to document the new test case and renumbers subsequent tests; no functional issues

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["show bgp l2vpn evpn route rd <all|RD> prefix <prefix>"] --> B{rd_all?}
    B -- yes --> C["evpn_show_route_rd_all_prefix()"]
    B -- no --> D["evpn_show_route_rd_prefix()"]
    C --> E["build_type5_prefix_from_ip_prefix()"]
    E --> F["Iterate all RD entries in bgp->rib"]
    F --> G{table == NULL?}
    G -- yes --> F
    G -- no --> H["bgp_safi_node_lookup(rib, safi, prefix, rd)"]
    H --> I{rn found & has path info?}
    I -- no --> J["bgp_dest_unlock_node(rn)"] --> F
    I -- yes --> K["bgp_evpn_show_route_rd_header + route_vty_out_detail_header"]
    K --> L["Loop: route_vty_out_detail per pi"]
    L --> M["bgp_dest_unlock_node(rn)"] --> F
    F --> N["Print: Displayed N prefixes (M paths)"]
    D --> O["build_type5_prefix_from_ip_prefix()"]
    O --> P["bgp_safi_node_lookup(rib, safi, prefix, prd)"]
    P --> Q{rn found & has path info?}
    Q -- no --> R["bgp_dest_unlock_node(rn) / Network not in table"]
    Q -- yes --> S["route_vty_out_detail_header"]
    S --> T["Loop: route_vty_out_detail per pi"]
    T --> U["bgp_dest_unlock_node(rn) / Print: Displayed N paths"]
Loading

Reviews (2): Last reviewed commit: "tests: EVPN change assert msgs to f-stri..." | Re-trigger Greptile

Comment thread bgpd/bgp_evpn_vty.c
Comment thread bgpd/bgp_evpn_vty.c Outdated
Comment thread bgpd/bgp_evpn_vty.c Outdated
Comment thread bgpd/bgp_evpn_vty.c Outdated
@frrbot frrbot Bot added the documentation label May 2, 2026
@frrbot frrbot Bot added the tests Topotests, make check, etc label May 2, 2026
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
@chiragshah6

Copy link
Copy Markdown
Member Author

@greptileai

@ton31337
ton31337 merged commit 340906b into FRRouting:master May 3, 2026
24 checks passed
@chiragshah6
chiragshah6 deleted the zdev branch May 4, 2026 04:16
@chiragshah6

Copy link
Copy Markdown
Member Author

#20055

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants