test(site-explorer): cover VR BF4 pairing from chassis inventory#3318
Conversation
Add bmc-explorer test-support helpers for generating mock exploration reports, model the Vera Rubin BlueField chassis inventory in bmc-mock, and verify site-explorer pairs the DPU from the BlueField_0 chassis serial instead of Systems PCIe devices. Signed-off-by: Dmitry Porokh <dporokh@nvidia.com>
Summary by CodeRabbit
WalkthroughThis PR adds test-support infrastructure to bmc-explorer for generating mock exploration reports (host and DPU), gated behind a new ChangesVR/BF4 mock and test-support enhancements
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant Test
participant test_support
participant TestBmc
participant Explorer
Test->>test_support: generate_managed_host_reports(hw_type)
test_support->>TestBmc: bmc_for_machine(host_info)
test_support->>Explorer: nv_generate_exploration_report(explorer_config)
Explorer-->>test_support: EndpointExplorationReport (host)
loop for each DPU
test_support->>Explorer: generate_report_for_machine(dpu_info)
Explorer-->>test_support: EndpointExplorationReport (dpu)
end
test_support-->>Test: GeneratedManagedHostReports
sequenceDiagram
participant Test
participant test_support
participant SiteExplorer
participant Database
Test->>test_support: generate_managed_host_reports(NvidiaDgxVr)
test_support-->>Test: GeneratedManagedHostReports
Test->>Database: seed ExpectedMachine (host serial)
Test->>SiteExplorer: run iteration 1
Test->>SiteExplorer: run iteration 2
SiteExplorer->>Database: ingest managed host + DPU
Test->>Database: assert DPU BMC IP and host_pf_mac_address
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/bmc-explorer/src/test_support.rs (1)
140-149: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate MAC-pool/DPU-generation logic vs.
bmc-mock's existinghost_infohelper.
host_info_for_hw_typere-implements the same MAC-pool allocation and per-DPU construction sequence already present (privately) incrates/bmc-mock/src/test_support/mod.rs::host_info. The two copies can silently drift as hardware types gain more setup requirements.Consider exposing the existing
bmc_mock::test_support::host_info(or a variant returningHostMachineInfodirectly) aspub, and have this helper call into it instead of duplicating the pool-allocation sequence.As per coding guidelines, "Does an existing workspace dependency or local helper already solve it?" should be checked before adding new code.
🤖 Prompt for 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. In `@crates/bmc-explorer/src/test_support.rs` around lines 140 - 149, `host_info_for_hw_type` is duplicating the MAC-pool allocation and DPU construction flow already implemented by `bmc_mock::test_support::host_info`. Update this helper to reuse the existing `host_info` logic instead of rebuilding `HostMachineInfo` manually, and expose the shared helper as `pub` if needed. Keep the call sites in `host_info_for_hw_type`, `HostMachineInfo::new`, and `DpuMachineInfo::new` aligned so future hardware setup changes only happen in one place.Source: Coding guidelines
🤖 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 `@crates/bmc-mock/src/hw/bluefield4.rs`:
- Around line 157-166: The offset_mac helper in bluefield4::offset_mac only
checks u64 overflow and can still silently wrap past the 48-bit MAC space.
Change the logic to explicitly bound-check the 48-bit value before adding the
offset, and panic or error if the result would exceed the MAC range; keep the
fix localized to offset_mac and preserve the current MacAddress::new conversion
path.
---
Nitpick comments:
In `@crates/bmc-explorer/src/test_support.rs`:
- Around line 140-149: `host_info_for_hw_type` is duplicating the MAC-pool
allocation and DPU construction flow already implemented by
`bmc_mock::test_support::host_info`. Update this helper to reuse the existing
`host_info` logic instead of rebuilding `HostMachineInfo` manually, and expose
the shared helper as `pub` if needed. Keep the call sites in
`host_info_for_hw_type`, `HostMachineInfo::new`, and `DpuMachineInfo::new`
aligned so future hardware setup changes only happen in one place.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: bc4b1793-1d16-4770-be9e-762e873db2c2
📒 Files selected for processing (8)
crates/bmc-explorer/Cargo.tomlcrates/bmc-explorer/src/test_support.rscrates/bmc-explorer/tests/integration/bluefield4_explore.rscrates/bmc-explorer/tests/integration/vera_rubin_explore.rscrates/bmc-mock/src/hw/bluefield4.rscrates/bmc-mock/src/hw/dgx_vr_nvl.rscrates/site-explorer/Cargo.tomlcrates/site-explorer/tests/integration/site_explorer.rs
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
Add bmc-explorer test-support helpers for generating mock exploration reports, model the Vera Rubin BlueField chassis inventory in bmc-mock, and verify site-explorer pairs the DPU from the BlueField_0 chassis serial instead of Systems PCIe devices.
Related issues
Closes: #3287
Type of Change
Breaking Changes
Testing
Additional Notes