bmp msg stats#1646
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughChangesBMP startup is separated from router construction. BMP mirroring updates BGP counters, peer transitions emit router control events, and BGP status models plus Kubernetes conversion reflect required counters and optional reset reasons. BMP and BGP integration
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR improves BGP message-level statistics and session visibility by enabling BMP route mirroring and emitting router events on BGP neighbor state changes, so non-UPDATE message types (OPEN/KEEPALIVE/NOTIFICATION/etc.) can be accounted for.
Changes:
- Add BMP “route mirroring” configuration/rendering and consume mirrored BGP messages to update per-neighbor message counters.
- Generate and record BGP neighbor session state-change events (log + router eventlog) based on BMP peer up/down notifications.
- Refactor BMP server lifecycle: remove BMP task ownership from
Router, exposespawn_bmp_server, and start BMP from the dataplane runtime with aRouterCtlSenderfor event emission.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| routing/src/router/revent.rs | Adds a new router event for BGP neighbor state changes; increases eventlog capacity. |
| routing/src/router/mod.rs | Removes BMP server ownership/config from Router construction and shutdown. |
| routing/src/router/ctl.rs | Adds a control message path for BGP neighbor events; makes sender APIs take &self. |
| routing/src/lib.rs | Re-exports spawn_bmp_server from the routing crate. |
| routing/src/frr/test.rs | Updates router construction for the new Router::new signature. |
| routing/src/frr/renderer/bgp.rs | Renders bmp mirror when configured. |
| routing/src/bmp/mod.rs | Renames/exports BMP spawn function and wires RouterCtlSender into the handler. |
| routing/src/bmp/handler.rs | Calls async BMP processing that can now emit router control events. |
| routing/src/bmp/bmp_render.rs | Adds route mirroring handling, counts mirrored message types, and emits session-change events. |
| mgmt/src/tests/mgmt.rs | Updates router construction for the new Router::new signature. |
| mgmt/src/processor/proc.rs | Adjusts status-population/config paths to use &RouterCtlSender instead of &mut. |
| mgmt/src/processor/launch.rs | Updates interface notify loop to not require mutable RouterCtlSender. |
| dataplane/src/runtime.rs | Starts BMP server from dataplane runtime and enables mirroring in BMP options. |
| dataplane/src/packet_processor/mod.rs | Updates router startup for the new Router::new signature. |
| config/src/internal/status/mod.rs | Makes BGP message counters non-optional; makes last reset reason optional; adds Display for session state. |
| config/src/internal/routing/bmp.rs | Adds mirror option to internal BMP config model. |
| config/src/converters/k8s/status/bgp.rs | Updates K8s conversion to match new non-optional BGP message counter structs. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@routing/src/bmp/bmp_render.rs`:
- Around line 156-173: The BGP event currently identifies peers with
remote_router_id instead of the neighbor address. Update generate_bgp_event to
accept the status-map key as key, pass that address at its call site, and use
key for BgpNeighEvent.peer while leaving the session-state transition handling
unchanged.
- Around line 359-362: Remove the received.update increment from the UPDATE
handling in the route-monitoring path around BgpMessage::Update and
neigh.messages.received, so mirrored UPDATEs are not counted twice. Preserve
Route Monitoring’s prefix-statistics processing, and rely on the Route Mirroring
path as the sole source for the message counter.
In `@routing/src/bmp/handler.rs`:
- Around line 40-43: Update on_message and bmp_render::handle_bmp_message so
rendering returns an optional router-control event instead of awaiting while the
dp_status write guard is held. Release the guard after rendering, then await
sending the returned event through rtr_ctl; preserve existing behavior when no
event is produced.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 54e51e10-35cb-4ecf-9c32-077e6ef821c4
📒 Files selected for processing (17)
config/src/converters/k8s/status/bgp.rsconfig/src/internal/routing/bmp.rsconfig/src/internal/status/mod.rsdataplane/src/packet_processor/mod.rsdataplane/src/runtime.rsmgmt/src/processor/launch.rsmgmt/src/processor/proc.rsmgmt/src/tests/mgmt.rsrouting/src/bmp/bmp_render.rsrouting/src/bmp/handler.rsrouting/src/bmp/mod.rsrouting/src/frr/renderer/bgp.rsrouting/src/frr/test.rsrouting/src/lib.rsrouting/src/router/ctl.rsrouting/src/router/mod.rsrouting/src/router/revent.rs
💤 Files with no reviewable changes (1)
- routing/src/router/mod.rs
7cb0b9c to
e9f9fc9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@routing/src/bmp/bmp_render.rs`:
- Around line 236-240: Enable the received-OPEN counter update in the
BgpMessage::Open branch of the PeerUp handling, incrementing
neigh.messages.received.open with saturating arithmetic so the OPEN is recorded
without overflow.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9d13d436-eaa2-4397-b694-80a627f61c67
📒 Files selected for processing (7)
config/src/converters/k8s/status/bgp.rsconfig/src/internal/routing/bmp.rsconfig/src/internal/status/mod.rsdataplane/src/runtime.rsrouting/src/bmp/bmp_render.rsrouting/src/bmp/handler.rsrouting/src/frr/renderer/bgp.rs
🚧 Files skipped from review as they are similar to previous changes (5)
- routing/src/bmp/handler.rs
- routing/src/frr/renderer/bgp.rs
- config/src/internal/status/mod.rs
- config/src/converters/k8s/status/bgp.rs
- dataplane/src/runtime.rs
af03742 to
a3f8a1c
Compare
49819bc to
0ca0ef1
Compare
0ca0ef1 to
c7fc043
Compare
Making them optional overcomplicates the code for no real benefit. Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Process route mirrored packets to provide better message stats. This comes with limitations due to FRR's incomplete BMP implementation. Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
This is needed for the msg stats to be populated. Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
a3f8a1c to
b65d004
Compare
This goes on top of #1645
Note: