-
Notifications
You must be signed in to change notification settings - Fork 727
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance Mellanox reboot cause test case (#6944)
Add new script to cover following reboot cause scenarios: BIOS - In case the BIOS upgrade process ended with failure and cause the switch to reset. CPU - Reset is initiated by SW on the CPU. it could be that SW encountered some catastrophic situation like a memory leak, eventually, the kernel reset the whole switch. Reset from ASIC - Reset which is caused by ASIC. - What is the motivation for this PR? Add test for sonic-net/sonic-platform-common#277 - How did you do it? - How did you verify/test it? Add test script for enhance reboot cause - Any platform specific information? Mellanox platforms, except for SPC1 and SIMX - Supported testbed topology if it's a new test case? Any topology
- Loading branch information
Showing
3 changed files
with
131 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import allure | ||
import logging | ||
import pytest | ||
from tests.common.reboot import REBOOT_TYPE_CPU, REBOOT_TYPE_BIOS, REBOOT_TYPE_ASIC, check_reboot_cause | ||
from tests.platform_tests.thermal_control_test_helper import mocker_factory # noqa: F401 | ||
|
||
pytestmark = [ | ||
pytest.mark.asic('mellanox'), | ||
pytest.mark.topology('any') | ||
] | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
mocker = None | ||
REBOOT_CAUSE_TYPES = [REBOOT_TYPE_CPU, REBOOT_TYPE_BIOS, REBOOT_TYPE_ASIC] | ||
|
||
|
||
@pytest.mark.parametrize("reboot_cause", REBOOT_CAUSE_TYPES) | ||
def test_reboot_cause(rand_selected_dut, mocker_factory, reboot_cause): # noqa: F811 | ||
""" | ||
Validate reboot cause from cpu/bios/asic | ||
:param rand_selected_dut: The fixture returns a randomly selected DUT | ||
:param mocker_factory: The fixture returns a mocker | ||
:param reboot_cause: The specific reboot cause | ||
""" | ||
duthost = rand_selected_dut | ||
with allure.step('Create mocker - RebootCauseMocker'): | ||
mocker = mocker_factory(duthost, 'RebootCauseMocker') | ||
|
||
with allure.step('Mock reset from {}'.format(reboot_cause)): | ||
if reboot_cause == REBOOT_TYPE_CPU: | ||
mocker.mock_reset_from_comex() | ||
elif reboot_cause == REBOOT_TYPE_BIOS: | ||
mocker.mock_reset_reload_bios() | ||
elif reboot_cause == REBOOT_TYPE_ASIC: | ||
mocker.mock_reset_from_asic() | ||
|
||
with allure.step('Restart determine-reboot-cause service'): | ||
duthost.restart_service('determine-reboot-cause') | ||
|
||
with allure.step('Check Reboot cause is {}'.format(reboot_cause)): | ||
check_reboot_cause(duthost, reboot_cause) |