-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new reboot cause script for bios cpu and asic causes
- 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) |