[redfish] Prove PowerCycle by the switch host boot id - #27960
Open
shreyansh-nexthop wants to merge 1 commit into
Open
shreyansh-nexthop wants to merge 1 commit into
shreyansh-nexthop wants to merge 1 commit into
Conversation
test_reset_power_cycle asserted that the switch host's oper status goes Offline during a Redfish PowerCycle. That off-window is not observable through the platform API on every platform: get_oper_status() reflects power state, which on some BMCs derives from a power-down latch that a pwr_cycle pulse never sets. Where it is observable, catching the one to two second window with a one second poll is a race. Read the switch host's boot id before the reset and wait for it to change. The boot id changes only on an actual restart, so a BMC that silently no-ops the API still fails the test, without depending on a platform-specific reset-pin reading. Signed-off-by: Shreyansh Jain <shreyansh@nexthop.ai>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
shreyansh-nexthop
marked this pull request as ready for review
September 16, 2026 08:08
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
shreyansh-nexthop
marked this pull request as draft
September 16, 2026 08:54
shreyansh-nexthop
marked this pull request as ready for review
September 16, 2026 14:12
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
@nhe-NV would you please ask someone to review? |
nh-grecs Bot
pushed a commit
to nexthop-ai/sonic-mgmt
that referenced
this pull request
Sep 17, 2026
rebuild-source: sonic-net#27960 @ nexthop-ai/sonic-mgmt 5b0dd01 [case: upstream:open]
nh-grecs Bot
pushed a commit
to nexthop-ai/sonic-mgmt
that referenced
this pull request
Sep 17, 2026
rebuild-source: sonic-net/pull/27960 @ nexthop-ai/sonic-mgmt 5b0dd01 [case: upstream:open]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
Summary:
test_reset_power_cycleasserted that the switch host's oper status goes Offline during a Redfish PowerCycle. That off-window is not observable through the platform API on every platform:get_oper_status()reflects power state, which on some BMCs derives from a power-down latch that apwr_cyclepulse never sets. Where the window is observable, catching one to two seconds of it with a one second poll is a race.This replaces the two transition polls with a boot-id oracle. The switch host's boot id changes only on an actual restart, so the test proves the cycle happened without depending on a platform-specific reset-pin reading.
Related: #27212
Type of change
Back port request
Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO):
Failure type:
Tested branch
Test result
master: verified on a SONiC BMC testbed (bmc-shared-mgmt topology). All 5 tests in
tests/redfish/test_redfish_computer_reset.pypass, includingtest_reset_power_cycle, which now proves the cycle by the switch host boot id changing.Approach
What is the motivation for this PR?
The old assertion is not guaranteed by the platform contract. Oper status for the switch host module reflects power state, and on latch-based platforms a power-cycle pulse never drives it Offline, so the assertion cannot be satisfied there. On platforms where it is observable, the window is short enough that the poll can miss it.
How did you do it?
Read the switch host's boot id from
/proc/sys/kernel/random/boot_idbefore issuing the reset, then wait for it to change. A host that is down mid-cycle is unreachable rather than returning a value, so the read reports None in that state and the wait continues instead of registering a change. A BMC that silently no-ops the API leaves the boot id untouched and the test fails, which is the case the original assertion existed to catch.The host object is resolved lazily through a fixture, because a preceding test in the class can leave the host still booting, and building the object gathers facts over SSH. The resolve wait and the post-reset boot wait use separate budgets so a host that never returns cannot consume both.
How did you verify/test it?
Ran the full
tests/redfish/test_redfish_computer_reset.pysuite on a SONiC BMC testbed; all 5 tests pass.Any platform specific information?
The test targets BMC topologies (
pytest.mark.topology('bmc')). The change removes a dependency on platform-specific reset-pin observability, so it applies to BMC platforms whose oper status does not expose the power-cycle window.Supported testbed topology if it's a new test case?
Not a new test case.
Documentation
No documentation change needed.