Skip to content

fix(site-explorer): generate BF4 machine IDs from chassis serial#2903

Merged
poroh merged 1 commit into
NVIDIA:mainfrom
poroh:bf4-machine-id-generation
Jun 26, 2026
Merged

fix(site-explorer): generate BF4 machine IDs from chassis serial#2903
poroh merged 1 commit into
NVIDIA:mainfrom
poroh:bf4-machine-id-generation

Conversation

@poroh

@poroh poroh commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Use the BlueField_BMC chassis serial as a DPU fallback when the
Redfish system serial is absent, and add BF4 mock coverage for machine
ID generation.

Related issues

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

@copy-pr-bot

copy-pr-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6dae25cd-a5dc-4d96-aa4e-7d10391b16a9

📥 Commits

Reviewing files that changed from the base of the PR and between 50a097b and 678715a.

📒 Files selected for processing (3)
  • crates/api-model/src/site_explorer/mod.rs
  • crates/bmc-explorer/tests/bluefield4_explore.rs
  • crates/bmc-mock/src/test_support/mod.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • crates/bmc-explorer/tests/bluefield4_explore.rs
  • crates/api-model/src/site_explorer/mod.rs
  • crates/bmc-mock/src/test_support/mod.rs

Summary by CodeRabbit

  • Bug Fixes

    • Improved DPU machine ID generation by trimming/validating the primary system serial and treating missing/blank values as absent.
    • When the primary serial is unusable, the machine ID now correctly falls back to the Bluefield_BMC chassis serial.
  • Tests

    • Added an integration test for BlueField4 exploration to verify endpoint type/vendor, chassis serial handling, and consistent machine ID output.
    • Added a dedicated test-support helper to build the mocked BlueField4 BMC setup.

Walkthrough

MachineId generation now falls back to a Bluefield_BMC chassis serial for DPUs when the system serial is absent. BlueField4 test support and integration coverage were added for this path.

Changes

BlueField4 MachineId fallback

Layer / File(s) Summary
MachineId serial selection
crates/api-model/src/site_explorer/mod.rs
generate_machine_id() now uses a helper that prefers the first system serial and falls back to the Bluefield_BMC chassis serial for DPU endpoints when needed.
BlueField4 test coverage
crates/bmc-mock/src/test_support/mod.rs, crates/bmc-explorer/tests/bluefield4_explore.rs
A new test-support helper builds a BlueField4 BMC handle from DpuMachineInfo, and the integration test validates the report shape, chassis data, firmware inventory, and generated machine ID.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: BF4 machine IDs now derive from the chassis serial fallback.
Description check ✅ Passed The description is directly aligned with the change set and test coverage for BF4 machine ID generation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@poroh
poroh force-pushed the bf4-machine-id-generation branch 2 times, most recently from eea4ddb to 45c683b Compare June 26, 2026 00:04
@poroh
poroh marked this pull request as ready for review June 26, 2026 00:04
@poroh
poroh requested a review from a team as a code owner June 26, 2026 00:04

@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

🤖 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/api-model/src/site_explorer/mod.rs`:
- Around line 886-901: Treat blank Redfish system serials as missing in
machine_id_serial_number before the BF4 fallback runs. Update the
self.systems.first().and_then(|system| system.serial_number.as_ref()) path to
also reject empty or whitespace-only values, matching the chassis serial
filtering used for Bluefield_BMC. Keep the fallback logic in
machine_id_serial_number and generate_machine_id() unchanged so BF4 reports with
blank system serials can still resolve via the chassis serial.
🪄 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: c80c5434-d508-40ee-bf71-0bc3695073d3

📥 Commits

Reviewing files that changed from the base of the PR and between 2acb7c3 and 45c683b.

📒 Files selected for processing (3)
  • crates/api-model/src/site_explorer/mod.rs
  • crates/bmc-explorer/tests/bluefield4_explore.rs
  • crates/bmc-mock/src/test_support/mod.rs

Comment thread crates/api-model/src/site_explorer/mod.rs Outdated
@github-actions

github-actions Bot commented Jun 26, 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 285 6 26 102 7 144
machine-validation-runner 744 32 188 267 36 221
machine_validation 744 32 188 267 36 221
machine_validation-aarch64 744 32 188 267 36 221
nvmetal-carbide 744 32 188 267 36 221
TOTAL 3267 134 778 1176 151 1028

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

Comment thread crates/api-model/src/site_explorer/mod.rs Outdated
@poroh
poroh force-pushed the bf4-machine-id-generation branch from 45c683b to a5cb2b2 Compare June 26, 2026 19:28
@krish-nvidia
krish-nvidia self-requested a review June 26, 2026 19:31
@poroh
poroh force-pushed the bf4-machine-id-generation branch from a5cb2b2 to 50a097b Compare June 26, 2026 21:10
Use the BlueField_BMC chassis serial as a DPU fallback when the
Redfish system serial is absent, and add BF4 mock coverage for machine
ID generation.

Signed-off-by: Dmitry Porokh <dporokh@nvidia.com>
@poroh
poroh force-pushed the bf4-machine-id-generation branch from 50a097b to 678715a Compare June 26, 2026 21:21
@poroh
poroh requested a review from krish-nvidia June 26, 2026 21:28
@poroh
poroh merged commit 45cb7a1 into NVIDIA:main Jun 26, 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.

3 participants