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
11
12Test Teardown   Test Exit Logs
13
14*** Variables ***
15${LOOP_COUNT}    ${50}
16
17*** Test Cases ***
18
19Run Multiple Power Cycle
20    [Documentation]  Execute multiple power cycles.
21    [Setup]  Validate Parameters
22    [Tags]  Run_Multiple_Power_Cycle
23
24    # By default run test for 50 loops, else user input iteration.
25    # Fails immediately if any of the execution rounds fail and
26    # check if BMC is still pinging and FFDC is collected.
27    Repeat Keyword  ${LOOP_COUNT} times  Power Cycle System Via PDU
28
29
30Run Multiple BMC Reset Via REST
31    [Documentation]  Execute multiple reboots via REST.
32    [Tags]  Run_Multiple_BMC_Reset_Via_REST
33
34    # By default run test for 50 loops, else user input iteration.
35    # Fails immediately if any of the execution rounds fail and
36    # check if BMC is still pinging and FFDC is collected.
37    Repeat Keyword  ${LOOP_COUNT} times  BMC REST Reset Cycle
38
39
40Run Multiple BMC Reset Via Reboot
41    [Documentation]  Execute multiple reboots via "reboot" command.
42    [Tags]  Run_Multiple_BMC_Reset_Via_Reboot
43
44    # By default run test for 50 loops, else user input iteration.
45    # Fails immediately if any of the execution rounds fail and
46    # check if BMC is still pinging and FFDC is collected.
47    Repeat Keyword  ${LOOP_COUNT} times  BMC Reboot Cycle
48
49
50*** Keywords ***
51
52Power Cycle System Via PDU
53    [Documentation]  Power cycle system and wait for BMC to reach Ready state.
54    Log  "Doing power cycle"
55    PDU Power Cycle
56    Check If BMC Is Up  5 min  10 sec
57
58    Wait Until Keyword Succeeds  10 min  10 sec  Is BMC Ready
59    Verify BMC RTC And UTC Time Drift
60
61
62BMC REST Reset Cycle
63    [Documentation]  Reset BMC via REST and wait for ready state.
64    Log  "Doing Reboot cycle"
65    ${bmc_version_before}=  Get BMC Version
66    Initiate BMC Reboot
67    Wait Until Keyword Succeeds  10 min  10 sec  Is BMC Ready
68    ${bmc_version_after}=  Get BMC Version
69    Should Be Equal  ${bmc_version_before}  ${bmc_version_after}
70    Verify BMC RTC And UTC Time Drift
71
72
73BMC Reboot Cycle
74    [Documentation]  Reboot BMC and wait for ready state.
75    Log  "Doing Reboot cycle"
76    ${bmc_version_before}=  Get BMC Version
77    OBMC Reboot (off)  stack_mode=normal
78    ${bmc_version_after}=  Get BMC Version
79    Should Be Equal  ${bmc_version_before}  ${bmc_version_after}
80    Verify BMC RTC And UTC Time Drift
81
82
83Test Exit Logs
84    Ping Host  ${OPENBMC_HOST}
85    FFDC On Test Case Fail
86
87
88Validate Parameters
89    Should Not Be Empty   ${PDU_IP}
90    Should Not Be Empty   ${PDU_TYPE}
91    Should Not Be Empty   ${PDU_SLOT_NO}
92    Should Not Be Empty   ${PDU_USERNAME}
93    Should Not Be Empty   ${PDU_PASSWORD}
94
95