xref: /openbmc/openbmc-test-automation/extended/test_bmc_reset_loop.robot (revision 1e9f2f3ad99a95d660bd97af35b0ef76cab257fc)
1*** Settings ***
2Documentation   Power cycle loop. This is to test where network service
3...             becomes unavailable during AC-Cycle stress test.
4
5Resource        ../lib/rest_client.robot
6Resource        ../lib/pdu/pdu.robot
7Resource        ../lib/utils.robot
8Resource        ../lib/openbmc_ffdc.robot
9Resource        ../lib/state_manager.robot
10Resource        ../lib/boot_utils.robot
11Resource        ../lib/code_update_utils.robot
12Library         ../lib/bmc_ssh_utils.py
13
14Test Teardown   Test Teardown Execution
15Suite Setup     Suite Setup Execution
16
17*** Variables ***
18${LOOP_COUNT}          ${50}
19${CHECK_FOR_ERRORS}    ${1}
20
21# Error strings to check from journald.
22${ERROR_REGEX}     SEGV|core-dump|FAILURE|Failed to start|Found ordering cycle
23
24*** Test Cases ***
25
26Run Multiple Power Cycle
27    [Documentation]  Execute multiple power cycles.
28    [Setup]  Validate Parameters
29    [Tags]  Run_Multiple_Power_Cycle
30
31    # By default run test for 50 loops, else user input iteration.
32    # Fails immediately if any of the execution rounds fail and
33    # check if BMC is still pinging and FFDC is collected.
34    Repeat Keyword  ${LOOP_COUNT} times  Power Cycle System Via PDU
35
36
37Run Multiple BMC Reset Via Redfish
38    [Documentation]  Execute multiple reboots via REST.
39    [Tags]  Run_Multiple_BMC_Reset_Via_Redfish
40
41    # By default run test for 50 loops, else user input iteration.
42    # Fails immediately if any of the execution rounds fail and
43    # check if BMC is still pinging and FFDC is collected.
44    Repeat Keyword  ${LOOP_COUNT} times  BMC Redfish Reset Cycle
45
46
47Run Multiple BMC Reset Via Reboot
48    [Documentation]  Execute multiple reboots via "reboot" command.
49    [Tags]  Run_Multiple_BMC_Reset_Via_Reboot
50
51    # By default run test for 50 loops, else user input iteration.
52    # Fails immediately if any of the execution rounds fail and
53    # check if BMC is still pinging and FFDC is collected.
54    Repeat Keyword  ${LOOP_COUNT} times  BMC Reboot Cycle
55
56
57Run Multiple BMC Reset When Host Is Booted Via Redfish
58    [Documentation]  Execute multiple reboots via redfish.
59    [Tags]  Run_Multiple_BMC_Reset_When_Host_Is_Booted_Via_Redfish
60
61    # By default run test for 50 loops, else user input iteration.
62    # Fails immediately if any of the execution rounds fail and
63    # check if BMC is still pinging and FFDC is collected.
64    Repeat Keyword  ${LOOP_COUNT} times  BMC Redfish Reset Runtime Cycle
65
66*** Keywords ***
67
68Power Cycle System Via PDU
69    [Documentation]  Power cycle system and wait for BMC to reach Ready state.
70
71    PDU Power Cycle
72    Check If BMC Is Up  5 min  10 sec
73
74    Wait Until Keyword Succeeds  10 min  10 sec  Is BMC Ready
75    Verify BMC RTC And UTC Time Drift
76
77
78BMC Redfish Reset Cycle
79    [Documentation]  Reset BMC via Redfish and verify required states.
80
81    Redfish OBMC Reboot (off)
82
83    ${bmc_version}=  Get BMC Version
84    Valid Value  bmc_version  valid_values=['${initial_bmc_version}']
85
86    IF  '${CHECK_FOR_ERRORS}' == '${1}'
87        Check For Regex In Journald  ${ERROR_REGEX}  error_check=${0}  boot=-b
88    END
89
90    Verify BMC RTC And UTC Time Drift
91
92
93BMC Redfish Reset Runtime Cycle
94    [Documentation]  Reset BMC via Redfish and verify required states.
95
96    Redfish OBMC Reboot (run)
97
98    ${bmc_version}=  Get BMC Version
99    Valid Value  bmc_version  valid_values=['${initial_bmc_version}']
100
101    IF  '${CHECK_FOR_ERRORS}' == '${1}'
102        Check For Regex In Journald  ${ERROR_REGEX}  error_check=${0}  boot=-b
103    END
104
105    Verify BMC RTC And UTC Time Drift
106
107
108BMC Reboot Cycle
109    [Documentation]  Reboot BMC and wait for ready state.
110
111    OBMC Reboot (off)  stack_mode=normal
112    ${bmc_version}=  Get BMC Version
113    Valid Value  bmc_version  ["${initial_bmc_version}"]
114    Verify BMC RTC And UTC Time Drift
115    Check For Regex In Journald  ${ERROR_REGEX}  error_check=${0}  boot=-b
116    ${boot_side}=  Get BMC Flash Chip Boot Side
117    Valid Value  boot_side  ['0']
118
119
120Test Teardown Execution
121    [Documentation]  Do test case tear-down.
122    Ping Host  ${OPENBMC_HOST}
123    FFDC On Test Case Fail
124
125
126Validate Parameters
127    [Documentation]  Validate PDU parameters.
128    Should Not Be Empty   ${PDU_IP}
129    Should Not Be Empty   ${PDU_TYPE}
130    Should Not Be Empty   ${PDU_SLOT_NO}
131    Should Not Be Empty   ${PDU_USERNAME}
132    Should Not Be Empty   ${PDU_PASSWORD}
133
134
135Suite Setup Execution
136    [Documentation]  Do suite setup.
137
138    ${bmc_version}=  Get BMC Version
139    Set Suite Variable  ${initial_bmc_version}  ${bmc_version}
140