Skip to content

test(site-explorer): cover VR BF4 pairing from chassis inventory#3318

Merged
poroh merged 1 commit into
NVIDIA:mainfrom
poroh:bmc-mock-vr-bf4-chassis-pairing
Jul 10, 2026
Merged

test(site-explorer): cover VR BF4 pairing from chassis inventory#3318
poroh merged 1 commit into
NVIDIA:mainfrom
poroh:bmc-mock-vr-bf4-chassis-pairing

Conversation

@poroh

@poroh poroh commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

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>
@poroh
poroh requested a review from a team as a code owner July 9, 2026 16:52
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • Bug Fixes
    • Improved discovery of managed hosts and DPUs so BlueField-based systems are paired more reliably.
    • Fixed report generation for mock-backed exploration flows, including adapter and MAC address details.
  • Tests
    • Added broader integration coverage for Vera Rubin and BlueField 4 exploration scenarios.
    • Added a new managed-host pairing test to verify DPU ingestion and matching behavior.

Walkthrough

This PR adds test-support infrastructure to bmc-explorer for generating mock exploration reports (host and DPU), gated behind a new test-support feature that pulls in bmc-mock. It extends BlueField4 and DgxVrNvl mock Redfish configs with network adapter and chassis data, and updates bmc-explorer and site-explorer integration tests to validate BF4/VR base-MAC derivation, BlueField chassis inventory, and end-to-end DPU pairing.

Changes

VR/BF4 mock and test-support enhancements

Layer / File(s) Summary
test-support feature and dependency wiring
crates/bmc-explorer/Cargo.toml, crates/site-explorer/Cargo.toml
Adds optional bmc-mock dependency gated by test-support feature in bmc-explorer; enables that feature as a dev-dependency in site-explorer.
Mock exploration report generation helpers
crates/bmc-explorer/src/test_support.rs
Adds MockExplorerError, GeneratedEndpointReport, GeneratedManagedHostReports types and async functions (generate_report_for_machine, generate_managed_host_reports, generate_managed_host_reports_from_info) plus internal mock inventory/config/error-classifier helpers.
BlueField4 network adapter and MAC offset logic
crates/bmc-mock/src/hw/bluefield4.rs
Adds NDF0 offset constants, populates network_adapters in chassis config, and derives PermanentMACAddress via checked big-endian MAC offset.
DgxVrNvl BlueField chassis and PCIe device configuration
crates/bmc-mock/src/hw/dgx_vr_nvl.rs
Replaces inlined HGX chassis entry with bluefield_chassis_config(), adds bluefield_network_adapter() building device functions and PCIe device from host NIC.
bmc-explorer integration test updates for BF4/VR
crates/bmc-explorer/tests/integration/bluefield4_explore.rs, crates/bmc-explorer/tests/integration/vera_rubin_explore.rs
Updates test machine construction and adds assertions for base_mac matching and BlueField chassis inventory (part number, serial, network adapters).
site-explorer VR/BF4 pairing integration test
crates/site-explorer/tests/integration/site_explorer.rs
Adds a new integration test generating VR BF4 managed-host reports and validating end-to-end DPU pairing and metrics.

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
Loading
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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title succinctly identifies the main change: VR BF4 pairing coverage from chassis inventory in site-explorer tests.
Description check ✅ Passed The description matches the change set by summarizing mock report helpers, VR chassis modeling, and the pairing regression test.
Linked Issues check ✅ Passed The PR addresses #3287 by strengthening VR mock inventory and pre-ingestion test coverage so pairing uses chassis serials as intended.
Out of Scope Changes check ✅ Passed All changes are centered on VR/BF4 mock support and related tests; no unrelated functionality was introduced.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/bmc-explorer/src/test_support.rs (1)

140-149: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate MAC-pool/DPU-generation logic vs. bmc-mock's existing host_info helper.

host_info_for_hw_type re-implements the same MAC-pool allocation and per-DPU construction sequence already present (privately) in crates/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 returning HostMachineInfo directly) as pub, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 356dd0b and b01c873.

📒 Files selected for processing (8)
  • crates/bmc-explorer/Cargo.toml
  • crates/bmc-explorer/src/test_support.rs
  • crates/bmc-explorer/tests/integration/bluefield4_explore.rs
  • crates/bmc-explorer/tests/integration/vera_rubin_explore.rs
  • crates/bmc-mock/src/hw/bluefield4.rs
  • crates/bmc-mock/src/hw/dgx_vr_nvl.rs
  • crates/site-explorer/Cargo.toml
  • crates/site-explorer/tests/integration/site_explorer.rs

Comment thread crates/bmc-mock/src/hw/bluefield4.rs
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🔍 Container Scan Summary

Service Total Critical High Medium Low Other
boot-artifacts-aarch64 3 0 0 3 0 0
boot-artifacts-x86_64 3 0 0 3 0 0
forge-admin-cli-x86_64 271 13 34 91 7 126
machine-validation-runner 800 37 234 291 43 195
machine_validation 800 37 234 291 43 195
machine_validation-aarch64 800 37 234 291 43 195
nvmetal-carbide 800 37 234 291 43 195
TOTAL 3477 161 970 1261 179 906

Per-CVE detail lives in the per-service grype-* artifacts (JSON + SARIF). Severity counts only — no CVE IDs published here.

@poroh
poroh merged commit 0918258 into NVIDIA:main Jul 10, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Support pre-ingestion of VR simulation in bmc-mock / machine-a-tron

2 participants