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