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