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