Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Stress the system using HTX exerciser - bootme option. |
| 4 | |
| 5 | # Test Parameters: |
| 6 | # OPENBMC_HOST The BMC host name or IP address. |
| 7 | # OS_HOST The OS host name or IP Address. |
| 8 | # OS_USERNAME The OS login userid (usually root). |
| 9 | # OS_PASSWORD The password for the OS login. |
| 10 | # HTX_DURATION Duration of HTX run, for example, 2h, or 30m. |
| 11 | # HTX_LOOP The number of times to loop HTX. |
| 12 | |
| 13 | |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 14 | Resource ../syslib/resource.robot |
George Keishing | 343c95f | 2022-08-22 23:12:05 -0500 | [diff] [blame] | 15 | Resource ../syslib/utils_os.robot |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 16 | Library ../syslib/utils_keywords.py |
George Keishing | 343c95f | 2022-08-22 23:12:05 -0500 | [diff] [blame] | 17 | Resource ../lib/openbmc_ffdc_utils.robot |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 18 | Library ../syslib/utils_os.py |
| 19 | Library DateTime |
| 20 | |
George Keishing | 343c95f | 2022-08-22 23:12:05 -0500 | [diff] [blame] | 21 | Suite Setup Start SOL Console Logging |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 22 | Test Setup Test Setup Execution |
| 23 | Test Teardown Test Teardown Execution |
| 24 | |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 25 | *** Variables **** |
| 26 | |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 27 | ${rest_keyword} REST |
| 28 | |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 29 | *** Test Cases *** |
| 30 | |
| 31 | Soft Bootme Test |
| 32 | [Documentation] Using HTX exerciser soft boot option. |
| 33 | [Tags] Soft_Bootme_Test |
| 34 | |
| 35 | Printn |
sarandev3 | c6f5006 | 2023-08-10 06:07:22 -0500 | [diff] [blame] | 36 | Rprint Vars BOOTME_PERIOD HTX_LOOP |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 37 | |
| 38 | # Set up the (soft) bootme iteration (loop) counter. |
| 39 | Set Suite Variable ${iteration} ${0} children=true |
| 40 | |
| 41 | # Run test |
| 42 | Repeat Keyword ${HTX_LOOP} times Run HTX Soft Bootme Exerciser |
| 43 | |
| 44 | |
| 45 | *** Keywords *** |
| 46 | |
| 47 | |
| 48 | Run HTX Soft Bootme Exerciser |
| 49 | [Documentation] Run HTX Soft Bootme Exerciser. |
| 50 | # Test Flow: |
| 51 | # - Power on. |
| 52 | # - Create HTX mdt profile. |
| 53 | # - Run HTX exerciser. |
| 54 | # - Soft bootme (OS Reboot). |
| 55 | # - Check HTX status for errors. |
| 56 | |
George Keishing | 343c95f | 2022-08-22 23:12:05 -0500 | [diff] [blame] | 57 | # ********************************** |
| 58 | # HTX bootme_period: |
| 59 | # 1 - every 20 minutes |
| 60 | # 2 - every 30 minutes |
| 61 | # 3 - every hour |
| 62 | # 4 - every midnight |
| 63 | # ********************************** |
sarandev3 | c6f5006 | 2023-08-10 06:07:22 -0500 | [diff] [blame] | 64 | |
| 65 | # Set a boot interval based on the given boot me period. |
| 66 | |
| 67 | ${boot_interval}= Set Variable If |
| 68 | ... ${BOOTME_PERIOD} == 1 20m |
| 69 | ... ${BOOTME_PERIOD} == 2 30m |
| 70 | ... ${BOOTME_PERIOD} == 3 1h |
| 71 | |
| 72 | ${runtime}= Convert Time ${boot_interval} |
| 73 | |
| 74 | ${startTime} = Get Current Date |
| 75 | Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu' |
| 76 | ... Create Default MDT Profile |
| 77 | |
| 78 | Run MDT Profile |
| 79 | |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 80 | Run Soft Bootme ${BOOTME_PERIOD} |
| 81 | |
| 82 | FOR ${index} IN RANGE 999999 |
| 83 | ${l_ping}= |
| 84 | ... Run Keyword And Return Status Ping Host ${OS_HOST} |
| 85 | |
| 86 | IF '${l_ping}' == '${False}' |
| 87 | Log to console ("OS Host is rebooting") |
sarandev3 | 8c984ff | 2023-07-12 05:10:58 -0500 | [diff] [blame] | 88 | # Wait for OS (re) Boot - Max 20 minutes |
| 89 | FOR ${waitindex} IN RANGE 40 |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 90 | Run Key U Sleep \ 30s |
| 91 | ${l_ping}= |
| 92 | ... Run Keyword And Return Status Ping Host ${OS_HOST} |
| 93 | Exit For Loop If '${l_ping}' == '${True}' |
| 94 | END |
| 95 | |
sarandev3 | 8c984ff | 2023-07-12 05:10:58 -0500 | [diff] [blame] | 96 | Run Keyword If '${l_ping}' == '${False}' Fail msg=OS not pinging in 20 minutes |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 97 | |
sarandev3 | 8c984ff | 2023-07-12 05:10:58 -0500 | [diff] [blame] | 98 | Wait Until Keyword Succeeds |
| 99 | ... 1 min 30 sec Verify Ping SSH And Redfish Authentication |
| 100 | |
sarandev3 | 6216cb0 | 2023-08-02 06:04:38 -0500 | [diff] [blame] | 101 | Wait Until Keyword Succeeds |
| 102 | ... 3x 60 sec OS Execute Command uptime |
| 103 | Wait Until Keyword Succeeds |
| 104 | ... 1 min 30 sec Check HTX Run Status |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 105 | |
| 106 | Set Suite Variable ${iteration} ${iteration + 1} |
| 107 | ${loop_count}= Catenate Completed reboot number: ${iteration} |
| 108 | |
| 109 | Printn |
| 110 | Rprint Vars loop_count |
| 111 | END |
| 112 | |
| 113 | ${currentTime} = Get Current Date |
| 114 | ${elapsedTimeSec} = |
| 115 | ... Subtract Date From Date |
| 116 | ... ${currentTime} ${startTime} result_format=number exclude_millis=True |
| 117 | Exit For Loop If ${runtime} < ${elapsedTimeSec} |
| 118 | END |
| 119 | |
| 120 | Wait Until Keyword Succeeds |
sarandev3 | 6216cb0 | 2023-08-02 06:04:38 -0500 | [diff] [blame] | 121 | ... 15 min 30 sec Verify Ping SSH And Redfish Authentication |
George Keishing | 343c95f | 2022-08-22 23:12:05 -0500 | [diff] [blame] | 122 | |
sarandev3 | 772e7b2 | 2023-08-07 02:40:35 -0500 | [diff] [blame] | 123 | Wait Until Keyword Succeeds |
| 124 | ... 2 min 60 sec Shutdown Bootme |
George Keishing | 343c95f | 2022-08-22 23:12:05 -0500 | [diff] [blame] | 125 | |
| 126 | # If user needs to keep the HTX running to debug on failure or post processing. |
sarandev3 | 772e7b2 | 2023-08-07 02:40:35 -0500 | [diff] [blame] | 127 | Run Keyword If ${HTX_KEEP_RUNNING} == ${0} |
| 128 | ... Wait Until Keyword Succeeds |
| 129 | ... 2 min 60 sec Shutdown HTX Exerciser |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 130 | |
| 131 | |
| 132 | Test Setup Execution |
| 133 | [Documentation] Do the initial test setup. |
| 134 | |
| 135 | ${bmc_version} ${stderr} ${rc}= BMC Execute Command |
| 136 | ... cat /etc/os-release |
| 137 | Printn |
| 138 | Rprint Vars bmc_versionhtxcmdline -bootme |
| 139 | |
| 140 | ${fw_version}= Get BMC Version |
| 141 | Rprint Vars fw_version |
| 142 | |
| 143 | ${is_redfish}= Run Keyword And Return Status Redfish.Login |
| 144 | ${rest_keyword}= Set Variable If ${is_redfish} Redfish REST |
| 145 | Rprint Vars rest_keyword |
| 146 | Set Suite Variable ${rest_keyword} children=true |
| 147 | |
| 148 | Run Keyword ${rest_keyword} Power On stack_mode=skip |
| 149 | |
| 150 | Run Key U Sleep \ 15s |
| 151 | Run Keyword And Ignore Error Delete All Error Logs |
| 152 | Run Keyword And Ignore Error Redfish Purge Event Log |
| 153 | Tool Exist htxcmdline |
| 154 | |
| 155 | ${os_release_info}= utils_os.Get OS Release Info uname |
| 156 | Rprint Vars os_release_info fmt=1 |
| 157 | |
| 158 | # Shutdown if HTX is running. |
| 159 | ${status}= Is HTX Running |
| 160 | Run Keyword If '${status}' == 'True' |
sarandev3 | 32199df | 2023-08-07 04:31:04 -0500 | [diff] [blame] | 161 | ... Wait Until Keyword Succeeds |
| 162 | ... 2 min 60 sec Shutdown HTX Exerciser |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 163 | |
| 164 | Test Teardown Execution |
| 165 | [Documentation] Do the post-test teardown. |
| 166 | |
| 167 | # Keep HTX running if user set HTX_KEEP_RUNNING to 1. |
| 168 | Run Keyword If |
| 169 | ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0} |
sarandev3 | 32199df | 2023-08-07 04:31:04 -0500 | [diff] [blame] | 170 | ... Wait Until Keyword Succeeds |
| 171 | ... 2 min 60 sec Shutdown HTX Exerciser |
Peter D Phan | 028b8fd | 2022-04-19 11:20:28 -0500 | [diff] [blame] | 172 | |
| 173 | ${keyword_buf}= Catenate Stop SOL Console Logging |
| 174 | ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log |
| 175 | Run Key ${keyword_buf} |
| 176 | |
| 177 | Close All Connections |