George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 2 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 3 | Documentation Stress the system using HTX exerciser. |
| 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. |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 10 | # HTX_DURATION Duration of HTX run, for example, 2h, or 30m. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 11 | # HTX_LOOP The number of times to loop HTX. |
| 12 | # HTX_INTERVAL The time delay between consecutive checks of HTX |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 13 | # status, for example, 15m. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 14 | # In summary: Run HTX for $HTX_DURATION, looping |
Steven Sombar | 0278b13 | 2018-01-09 14:41:32 -0600 | [diff] [blame] | 15 | # $HTX_LOOP times checking for errors every |
| 16 | # $HTX_INTERVAL. Then allow extra time for OS |
| 17 | # Boot, HTX startup, shutdown. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 18 | # HTX_KEEP_RUNNING If set to 1, this indicates that the HTX is to |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 19 | # continue running after an error was found. |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 20 | # CHECK_INVENTORY If set to 0 or False, OS inventory checking before |
| 21 | # and after each HTX run will be disabled. This |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 22 | # parameter is optional. The default value is True. |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 23 | # PREV_INV_FILE_PATH The file path and name of an initial previous |
| 24 | # inventory snapshot file in JSON format. Inventory |
| 25 | # snapshots taken before and after each HTX run will |
| 26 | # be compared to this file. |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 27 | # This parameter is optional. If not specified an |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 28 | # initial inventory snapshot will be taken before |
| 29 | # HTX startup. |
Steven Sombar | b6749a6 | 2017-10-06 08:34:23 -0500 | [diff] [blame] | 30 | # INV_IGNORE_LIST A comma-delimited list of strings that |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 31 | # indicate what to ignore if there are inventory |
Steven Sombar | b6749a6 | 2017-10-06 08:34:23 -0500 | [diff] [blame] | 32 | # differences, (e.g., processor "size"). |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 33 | # If differences are found during inventory checking |
Steven Sombar | b6749a6 | 2017-10-06 08:34:23 -0500 | [diff] [blame] | 34 | # and those items are in this list, the |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 35 | # differences will be ignored. This parameter is |
| 36 | # optional. If not specified the default value is |
Steven Sombar | b6749a6 | 2017-10-06 08:34:23 -0500 | [diff] [blame] | 37 | # "size". |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 38 | |
| 39 | Resource ../syslib/utils_os.robot |
George Keishing | dc1691d | 2017-12-07 12:17:46 -0600 | [diff] [blame] | 40 | Resource ../lib/openbmc_ffdc_utils.robot |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 41 | Library ../syslib/utils_keywords.py |
Steven Sombar | b6749a6 | 2017-10-06 08:34:23 -0500 | [diff] [blame] | 42 | Library ../lib/utils_files.py |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 43 | |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 44 | Suite Setup Run Keyword Start SOL Console Logging |
George Keishing | dc1691d | 2017-12-07 12:17:46 -0600 | [diff] [blame] | 45 | Test Setup Test Setup Execution |
| 46 | Test Teardown Test Teardown Execution |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 47 | |
Steven Sombar | 6f9d41d | 2017-08-08 13:35:30 -0500 | [diff] [blame] | 48 | |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 49 | *** Variables **** |
| 50 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 51 | ${stack_mode} skip |
Steven Sombar | 6f9d41d | 2017-08-08 13:35:30 -0500 | [diff] [blame] | 52 | ${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json |
| 53 | ${json_final_file_path} ${EXECDIR}/os_inventory_final.json |
| 54 | ${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 55 | ${CHECK_INVENTORY} True |
Steven Sombar | b6749a6 | 2017-10-06 08:34:23 -0500 | [diff] [blame] | 56 | ${INV_IGNORE_LIST} size |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 57 | ${PREV_INV_FILE_PATH} NONE |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 58 | |
Steven Sombar | 6f9d41d | 2017-08-08 13:35:30 -0500 | [diff] [blame] | 59 | |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 60 | *** Test Cases *** |
| 61 | |
| 62 | Hard Bootme Test |
| 63 | [Documentation] Stress the system using HTX exerciser. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 64 | [Tags] Hard_Bootme_Test |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 65 | |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 66 | Rprintn |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 67 | Rpvars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY |
| 68 | ... INV_IGNORE_LIST PREV_INV_FILE_PATH |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 69 | |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 70 | Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE' |
| 71 | ... OperatingSystem.File Should Exist ${PREV_INV_FILE_PATH} |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 72 | |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 73 | Set Suite Variable ${PREV_INV_FILE_PATH} children=true |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 74 | Set Suite Variable ${INV_IGNORE_LIST} children=true |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 75 | |
| 76 | # Set up the iteration (loop) counter. |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 77 | Set Suite Variable ${iteration} ${0} children=true |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 78 | |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 79 | # Estimate the time required for a single iteration loop. |
| 80 | # HTX_DURATION + 10 minutes for OS boot, HTX startup, shutdown. |
| 81 | ${loop_body_seconds}= Add Time To Time ${HTX_DURATION} 10m |
| 82 | Set Suite Variable ${loop_body_seconds} children=true |
| 83 | # And save it in printable (compact) format. |
| 84 | ${estimated_loop_time}= Convert Time |
| 85 | ... ${loop_body_seconds} result_format=compact |
| 86 | Set Suite Variable ${estimated_loop_time} children=true |
| 87 | |
| 88 | # Estimated time remaining = loop_body_seconds * HTX_LOOP + 5m |
| 89 | ${est_seconds_left}= Evaluate ${loop_body_seconds}*${HTX_LOOP}+(5*60) |
| 90 | Set Suite Variable ${est_seconds_left} children=true |
| 91 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 92 | Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 93 | |
| 94 | |
| 95 | *** Keywords *** |
| 96 | |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 97 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 98 | Run HTX Exerciser |
| 99 | [Documentation] Run HTX exerciser. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 100 | # Test Flow: |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 101 | # - Power on. |
| 102 | # - Establish SSH connection session. |
| 103 | # - Do inventory collection, compare with |
| 104 | # previous inventory run if applicable. |
| 105 | # - Create HTX mdt profile. |
| 106 | # - Run HTX exerciser. |
| 107 | # - Check HTX status for errors. |
| 108 | # - Do inventory collection, compare with |
| 109 | # previous inventory run. |
| 110 | # - Power off. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 111 | |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 112 | Set Suite Variable ${iteration} ${iteration + 1} |
| 113 | ${loop_count}= Catenate Starting iteration: ${iteration} |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 114 | ${estimated_time_remaining}= Convert Time |
| 115 | ... ${est_seconds_left} result_format=compact |
| 116 | Rprintn |
| 117 | Rpvars loop_count estimated_loop_time estimated_time_remaining |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 118 | |
Steven Sombar | 0278b13 | 2018-01-09 14:41:32 -0600 | [diff] [blame] | 119 | REST Power On stack_mode=skip |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 120 | |
| 121 | # Post Power off and on, the OS SSH session needs to be established. |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 122 | Login To OS |
| 123 | |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 124 | Run Keyword If '${CHECK_INVENTORY}' == 'True' |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 125 | ... Do Inventory And Compare ${json_initial_file_path} |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 126 | ... ${PREV_INV_FILE_PATH} |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 127 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 128 | Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu' |
| 129 | ... Create Default MDT Profile |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 130 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 131 | Run MDT Profile |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 132 | |
| 133 | Loop HTX Health Check |
| 134 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 135 | Shutdown HTX Exerciser |
| 136 | |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 137 | Run Keyword If '${CHECK_INVENTORY}' == 'True' |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 138 | ... Do Inventory And Compare ${json_final_file_path} |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 139 | ... ${PREV_INV_FILE_PATH} |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 140 | |
George Keishing | dc1691d | 2017-12-07 12:17:46 -0600 | [diff] [blame] | 141 | Error Logs Should Not Exist |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 142 | Power Off Host |
| 143 | |
George Keishing | ae5d978 | 2017-06-12 13:35:59 -0500 | [diff] [blame] | 144 | # Close all SSH and REST active sessions. |
| 145 | Close All Connections |
| 146 | Flush REST Sessions |
| 147 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 148 | Rprint Timen HTX Test ran for: ${HTX_DURATION} |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 149 | |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 150 | ${loop_count}= Catenate Ending iteration: ${iteration} |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 151 | |
| 152 | ${est_seconds_left}= Evaluate ${est_seconds_left}-${loop_body_seconds} |
| 153 | Set Suite Variable ${est_seconds_left} children=true |
| 154 | ${estimated_time_remaining}= Convert Time |
| 155 | ... ${est_seconds_left} result_format=compact |
| 156 | |
| 157 | Rpvars loop_count estimated_time_remaining |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 158 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 159 | |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 160 | Do Inventory And Compare |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 161 | [Documentation] Do inventory and compare. |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 162 | [Arguments] ${inventory_file_path} ${PREV_INV_FILE_PATH} |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 163 | # Description of argument(s): |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 164 | # inventory_file_path The file to receive the inventory snapshot. |
| 165 | # PREV_INV_FILE_PATH The previous inventory to compare with. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 166 | |
| 167 | Create JSON Inventory File ${inventory_file_path} |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 168 | Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE' |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 169 | ... Compare Json Inventory Files ${inventory_file_path} |
Steven Sombar | 2c97f81 | 2017-10-31 09:55:13 -0500 | [diff] [blame] | 170 | ... ${PREV_INV_FILE_PATH} |
| 171 | ${PREV_INV_FILE_PATH}= Set Variable ${inventory_file_path} |
| 172 | Set Suite Variable ${PREV_INV_FILE_PATH} children=true |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 173 | |
| 174 | |
| 175 | Compare Json Inventory Files |
| 176 | [Documentation] Compare JSON inventory files. |
| 177 | [Arguments] ${file1} ${file2} |
| 178 | # Description of argument(s): |
| 179 | # file1 A file that has an inventory snapshot in JSON format. |
| 180 | # file2 A file that has an inventory snapshot, to compare with file1. |
| 181 | |
Steven Sombar | b6749a6 | 2017-10-06 08:34:23 -0500 | [diff] [blame] | 182 | ${diff_rc}= File_Diff ${file1} |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 183 | ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST} |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 184 | Run Keyword If '${diff_rc}' != '${0}' |
| 185 | ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path} |
| 186 | |
| 187 | |
| 188 | Report Inventory Mismatch |
| 189 | [Documentation] Report inventory mismatch. |
| 190 | [Arguments] ${diff_rc} ${json_diff_file_path} |
| 191 | # Description of argument(s): |
| 192 | # diff_rc The failing return code from the difference check. |
| 193 | # json_diff_file_path The file that has the latest inventory snapshot. |
| 194 | |
Steven Sombar | a2216d2 | 2017-08-09 12:18:00 -0500 | [diff] [blame] | 195 | Log To Console Significant difference in inventory found, rc=${diff_rc} |
| 196 | Log To Console Differences are listed in file: no_newline=true |
| 197 | Log To Console ${json_diff_file_path} |
| 198 | Log To Console File Contents: |
| 199 | Wait Until Created ${json_diff_file_path} |
| 200 | ${file_contents}= OperatingSystem.Get File ${json_diff_file_path} |
| 201 | Log ${file_contents} level=WARN |
| 202 | Fail Significant difference in inventory found, rc=${diff_rc} |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 203 | |
| 204 | |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 205 | Loop HTX Health Check |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 206 | [Documentation] Run until HTX exerciser fails. |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 207 | Repeat Keyword ${HTX_DURATION} |
| 208 | ... Run Keywords Check HTX Run Status |
| 209 | ... AND Sleep ${HTX_INTERVAL} |
| 210 | |
| 211 | |
Steven Sombar | 0278b13 | 2018-01-09 14:41:32 -0600 | [diff] [blame] | 212 | Test Setup Execution |
| 213 | [Documentation] Do the initial test setup. |
| 214 | |
| 215 | REST Power On stack_mode=skip |
| 216 | Delete All Error Logs |
| 217 | Tool Exist htxcmdline |
| 218 | |
| 219 | # Shutdown if HTX is running. |
| 220 | ${status}= Run Keyword And Return Status Is HTX Running |
| 221 | Run Keyword If '${status}' == 'True' |
| 222 | ... Shutdown HTX Exerciser |
| 223 | |
| 224 | |
George Keishing | dc1691d | 2017-12-07 12:17:46 -0600 | [diff] [blame] | 225 | Test Teardown Execution |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 226 | [Documentation] Do the post test teardown. |
| 227 | # 1. Shut down HTX exerciser if test Failed. |
| 228 | # 2. Capture FFDC on test failure. |
| 229 | # 3. Close all open SSH connections. |
| 230 | |
George Keishing | 1a23b69 | 2017-05-06 12:19:41 -0500 | [diff] [blame] | 231 | # Keep HTX running if user set HTX_KEEP_RUNNING to 1. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 232 | Run Keyword If |
| 233 | ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0} |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 234 | ... Shutdown HTX Exerciser |
| 235 | |
George Keishing | ae5d978 | 2017-06-12 13:35:59 -0500 | [diff] [blame] | 236 | ${keyword_buf}= Catenate Stop SOL Console Logging |
| 237 | ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log |
| 238 | Run Key ${keyword_buf} |
| 239 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 240 | FFDC On Test Case Fail |
| 241 | Close All Connections |