feat(bmc-mock): model the BlueField DPU/NIC mode flip#2689
Conversation
|
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
Summary by CodeRabbitRelease Notes
WalkthroughThe ChangesBlueField Staged Mode Change
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai PTAL, thank you! |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Fetch PR details
gh pr view 2689 --repo NVIDIA/infra-controller --json title,body,files,additions,deletions,changedFiles
echo "---FILES CHANGED---"
gh pr diff 2689 --repo NVIDIA/infra-controllerLength of output: 8471
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/bmc-mock/src/redfish/oem/nvidia/bluefield.rs (1)
164-188: 💤 Low valueConsider adding test coverage for invalid Mode rejection.
The
mode_sethandler validates strictly and rejects invalidModevalues (lines 151-158), but this branch is not exercised by the unit test. For a test harness where strict validation is a deliberate design choice, documenting this behavior through tests would make the contract self-evident.Given the table-driven test preference in this codebase, consider extracting the string-to-bool parsing logic and using
scenarios!to cover valid and invalid inputs.🤖 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-mock/src/redfish/oem/nvidia/bluefield.rs` around lines 164 - 188, The existing `mode_set_is_staged_and_applied_on_power_on` test does not cover the invalid Mode rejection logic in the `mode_set` handler, leaving that validation branch untested. Extract the string-to-bool parsing logic from the `mode_set` handler into a separate testable function, and then add table-driven test cases using the `scenarios!` macro to cover both valid Mode inputs that should succeed and invalid Mode inputs that should be rejected, ensuring the strict validation behavior is documented and exercised through tests.
🤖 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/redfish/oem/nvidia/bluefield.rs`:
- Line 161: The Mode.Set action endpoint currently uses
json!({}).into_ok_response() which returns HTTP 200 with an empty JSON body, but
Redfish specification requires HTTP 204 No Content for action endpoints with no
response payload. Replace the json!({}).into_ok_response() call with the
ok_no_content() function that is already available in the crate and used
elsewhere for this purpose.
---
Nitpick comments:
In `@crates/bmc-mock/src/redfish/oem/nvidia/bluefield.rs`:
- Around line 164-188: The existing `mode_set_is_staged_and_applied_on_power_on`
test does not cover the invalid Mode rejection logic in the `mode_set` handler,
leaving that validation branch untested. Extract the string-to-bool parsing
logic from the `mode_set` handler into a separate testable function, and then
add table-driven test cases using the `scenarios!` macro to cover both valid
Mode inputs that should succeed and invalid Mode inputs that should be rejected,
ensuring the strict validation behavior is documented and exercised through
tests.
🪄 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: 59545cbd-edfc-4087-9b37-beedabf199a7
📒 Files selected for processing (3)
crates/bmc-mock/src/bmc_state.rscrates/bmc-mock/src/http.rscrates/bmc-mock/src/redfish/oem/nvidia/bluefield.rs
The Bluefield OEM endpoint now accepts the BF-3 `Mode.Set` action and applies it the way real hardware does: the requested DPU/NIC mode is staged and only takes effect on the next power cycle, so a read-back before then still reports the old mode. The staged mode is applied on the `PowerOn` event, alongside the existing Dell BIOS-job completion. Until now the mock could report a Bluefield's mode but not change it, so a test could only stand up a host whose DPU was already in NIC mode -- never watch one get flipped through the same `set_nic_mode` + power-cycle path site-explorer drives. This is the harness piece the end-to-end DPU-to-NIC re-registration test (NVIDIA#2632) builds on. Adds a smoke test: a Bluefield starting in DPU mode reports NIC mode only after a staged `Mode.Set` followed by a power-on, and an unstaged power-on leaves the mode untouched. Signed-off-by: Chet Nichols III <chetn@nvidia.com>
|
🌿 Preview your docs: https://nvidia-preview-pull-request-2689.docs.buildwithfern.com/infra-controller |
The Bluefield OEM endpoint now accepts the BF-3
Mode.Setaction and applies it the way real hardware does: the requested DPU/NIC mode is staged and only takes effect on the next power cycle, so a read-back before then still reports the old mode. The staged mode is applied on thePowerOnevent, alongside the existing Dell BIOS-job completion.Until now the mock could report a Bluefield's mode but not change it, so a test could only stand up a host whose DPU was already in NIC mode -- never watch one get flipped through the same
set_nic_mode+ power-cycle path site-explorer drives. This is the harness piece the end-to-end DPU-to-NIC re-registration test (#2632) builds on.Adds a smoke test: a Bluefield starting in DPU mode reports NIC mode only after a staged
Mode.Setfollowed by a power-on, and an unstaged power-on leaves the mode untouched.Scope note: this is the bmc-mock half of #2661. The machine-a-tron side -- propagating a host power-cycle to its DPUs so a simulated host flips within a run -- is deferred to #2632, where the end-to-end test actually exercises it.
Supports #2661