Skip to content

test_reset_power_cycle fails to observe the switch-host offline #27212

Description

@nikamirrr

def test_reset_power_cycle(self, redfish_client, cpu_running):

### Problem

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-hostdevice_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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions