|
def test_reset_power_cycle(self, redfish_client, cpu_running): |
test_reset_power_cycle asserts that SWITCH-HOST oper status transitions to
Offline during a Redfish PowerCycle. That assertion is not satisfiable:
- Per pmon-bmc-design.md,
oper status "reflects power state only", and in-progress state is
designated to HOST_STATE|switch-host → device_power_state = POWER_CYCLING
(not yet implemented in sonic-buildimage or sonic-utilities).
The assumption entered in #26849, whose fixture docstring states oper status
"Reads the hardware reset pin" — true for Nokia h6-128 (live CPLD bit), not for
NVIDIA AST2700 (power-down latch). It was validated on nexthop hardware only.
Proposed change
Keep the test's intent — catching a BMC that accepts the API and silently
no-ops — but prove it with an oracle that survives a pwr_cycle pulse. The
host's boot id changes across a power cycle and is stable otherwise:
boot_id_before = _host_boot_id(bmc_host) # cat /proc/sys/kernel/random/boot_id
response = redfish_client.post(RESET_PATH, json={"ResetType": "PowerCycle"})
pytest_assert(response.status_code in (200, 204), ...)
# No off-transition poll: oper status derives from the power-down latch, which
# a pwr_cycle pulse never sets. Prove the cycle by the host restarting instead.
wait_until(HOST_BACK_TIMEOUT, POLL_INTERVAL, 0, _host_reachable, bmc_host)
pytest_assert(
_host_boot_id(bmc_host) != boot_id_before,
"host boot id unchanged after PowerCycle — the BMC silently no-op'd the API",
)
bmc_host comes from duthost.get_bmc_host()
(tests/common/devices/multi_asic.py L372-387)
sonic-mgmt/tests/redfish/test_redfish_computer_reset.py
Line 207 in 5ed0dc0
test_reset_power_cycleasserts thatSWITCH-HOSToper status transitions toOfflineduring a RedfishPowerCycle. That assertion is not satisfiable:oper status "reflects power state only", and in-progress state is
designated to
HOST_STATE|switch-host→device_power_state = POWER_CYCLING(not yet implemented in sonic-buildimage or sonic-utilities).
The assumption entered in #26849, whose fixture docstring states oper status
"Reads the hardware reset pin" — true for Nokia h6-128 (live CPLD bit), not for
NVIDIA AST2700 (power-down latch). It was validated on nexthop hardware only.
Proposed change
Keep the test's intent — catching a BMC that accepts the API and silently
no-ops — but prove it with an oracle that survives a
pwr_cyclepulse. Thehost's boot id changes across a power cycle and is stable otherwise: