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. |
| 10 | # HTX_DURATION Duration of HTX run, for example, 8 hours, or |
| 11 | # 30 minutes. |
| 12 | # HTX_LOOP The number of times to loop HTX. |
| 13 | # HTX_INTERVAL The time delay between consecutive checks of HTX |
| 14 | # status, for example, 30s. |
| 15 | # In summary: Run HTX for $HTX_DURATION, looping |
| 16 | # $HTX_LOOP times checking every $HTX_INTERVAL. |
| 17 | # HTX_KEEP_RUNNING If set to 1, this indicates that the HTX is to |
| 18 | # continue running after an error. |
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 |
| 21 | # parameter is optional. |
| 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. |
| 26 | # This parameter is optional. If not specified, an |
| 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 | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 53 | ${last_inventory_file_path} ${EMPTY} |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 54 | ${CHECK_INVENTORY} True |
Steven Sombar | b6749a6 | 2017-10-06 08:34:23 -0500 | [diff] [blame] | 55 | ${INV_IGNORE_LIST} size |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 56 | ${PREV_INV_FILE_PATH} ${EMPTY} |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 57 | |
Steven Sombar | 6f9d41d | 2017-08-08 13:35:30 -0500 | [diff] [blame] | 58 | |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 59 | *** Test Cases *** |
| 60 | |
| 61 | Hard Bootme Test |
| 62 | [Documentation] Stress the system using HTX exerciser. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 63 | [Tags] Hard_Bootme_Test |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 64 | |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 65 | # Set last inventory file to PREV_INV_FILE_PATH otherwise set it |
| 66 | # to ${EMPTY}. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 67 | ${last_inventory_file_path}= Get Variable Value ${PREV_INV_FILE_PATH} |
| 68 | ... ${EMPTY} |
| 69 | |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 70 | Rprintn |
| 71 | Rpvars HTX_DURATION HTX_INTERVAL CHECK_INVENTORY INV_IGNORE_LIST |
| 72 | ... PREV_INV_FILE_PATH |
| 73 | |
| 74 | Run Keyword If '${last_inventory_file_path}' != '${EMPTY}' |
| 75 | ... OperatingSystem.File Should Exist ${last_inventory_file_path} |
| 76 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 77 | Set Suite Variable ${last_inventory_file_path} children=true |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 78 | Set Suite Variable ${INV_IGNORE_LIST} children=true |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 79 | Set Suite Variable ${iteration} ${0} children=true |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 80 | |
| 81 | Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 82 | |
| 83 | |
| 84 | *** Keywords *** |
| 85 | |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 86 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 87 | Run HTX Exerciser |
| 88 | [Documentation] Run HTX exerciser. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 89 | # Test Flow: |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 90 | # - Power on. |
| 91 | # - Establish SSH connection session. |
| 92 | # - Do inventory collection, compare with |
| 93 | # previous inventory run if applicable. |
| 94 | # - Create HTX mdt profile. |
| 95 | # - Run HTX exerciser. |
| 96 | # - Check HTX status for errors. |
| 97 | # - Do inventory collection, compare with |
| 98 | # previous inventory run. |
| 99 | # - Power off. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 100 | |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 101 | Set Suite Variable ${iteration} ${iteration + 1} |
| 102 | ${loop_count}= Catenate Starting iteration: ${iteration} |
| 103 | Rpvars loop_count |
| 104 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 105 | Boot To OS |
| 106 | |
| 107 | # 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] | 108 | Login To OS |
| 109 | |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 110 | Run Keyword If '${CHECK_INVENTORY}' == 'True' |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 111 | ... Do Inventory And Compare ${json_initial_file_path} |
| 112 | ... ${last_inventory_file_path} |
| 113 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 114 | Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu' |
| 115 | ... Create Default MDT Profile |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 116 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 117 | Run MDT Profile |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 118 | |
| 119 | Loop HTX Health Check |
| 120 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 121 | Shutdown HTX Exerciser |
| 122 | |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 123 | Run Keyword If '${CHECK_INVENTORY}' == 'True' |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 124 | ... Do Inventory And Compare ${json_final_file_path} |
| 125 | ... ${last_inventory_file_path} |
| 126 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 127 | Power Off Host |
| 128 | |
George Keishing | ae5d978 | 2017-06-12 13:35:59 -0500 | [diff] [blame] | 129 | # Close all SSH and REST active sessions. |
| 130 | Close All Connections |
| 131 | Flush REST Sessions |
| 132 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 133 | Rprint Timen HTX Test ran for: ${HTX_DURATION} |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 134 | |
Steven Sombar | 16dba51 | 2017-10-20 07:20:08 -0500 | [diff] [blame] | 135 | ${loop_count}= Catenate Ending iteration: ${iteration} |
| 136 | Rpvars loop_count |
| 137 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 138 | |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 139 | Do Inventory And Compare |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 140 | [Documentation] Do inventory and compare. |
| 141 | [Arguments] ${inventory_file_path} ${last_inventory_file_path} |
| 142 | # Description of argument(s): |
| 143 | # inventory_file_path The file to receive the inventory snapshot. |
| 144 | # last_inventory_file_path The previous inventory to compare with. |
| 145 | |
| 146 | Create JSON Inventory File ${inventory_file_path} |
| 147 | Run Keyword If '${last_inventory_file_path}' != '${EMPTY}' |
| 148 | ... Compare Json Inventory Files ${inventory_file_path} |
| 149 | ... ${last_inventory_file_path} |
| 150 | ${last_inventory_file_path}= Set Variable ${inventory_file_path} |
| 151 | Set Suite Variable ${last_inventory_file_path} children=true |
| 152 | |
| 153 | |
| 154 | Compare Json Inventory Files |
| 155 | [Documentation] Compare JSON inventory files. |
| 156 | [Arguments] ${file1} ${file2} |
| 157 | # Description of argument(s): |
| 158 | # file1 A file that has an inventory snapshot in JSON format. |
| 159 | # file2 A file that has an inventory snapshot, to compare with file1. |
| 160 | |
Steven Sombar | b6749a6 | 2017-10-06 08:34:23 -0500 | [diff] [blame] | 161 | ${diff_rc}= File_Diff ${file1} |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 162 | ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST} |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 163 | Run Keyword If '${diff_rc}' != '${0}' |
| 164 | ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path} |
| 165 | |
| 166 | |
| 167 | Report Inventory Mismatch |
| 168 | [Documentation] Report inventory mismatch. |
| 169 | [Arguments] ${diff_rc} ${json_diff_file_path} |
| 170 | # Description of argument(s): |
| 171 | # diff_rc The failing return code from the difference check. |
| 172 | # json_diff_file_path The file that has the latest inventory snapshot. |
| 173 | |
Steven Sombar | a2216d2 | 2017-08-09 12:18:00 -0500 | [diff] [blame] | 174 | Log To Console Significant difference in inventory found, rc=${diff_rc} |
| 175 | Log To Console Differences are listed in file: no_newline=true |
| 176 | Log To Console ${json_diff_file_path} |
| 177 | Log To Console File Contents: |
| 178 | Wait Until Created ${json_diff_file_path} |
| 179 | ${file_contents}= OperatingSystem.Get File ${json_diff_file_path} |
| 180 | Log ${file_contents} level=WARN |
| 181 | Fail Significant difference in inventory found, rc=${diff_rc} |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 182 | |
| 183 | |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 184 | Loop HTX Health Check |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 185 | [Documentation] Run until HTX exerciser fails. |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 186 | Repeat Keyword ${HTX_DURATION} |
| 187 | ... Run Keywords Check HTX Run Status |
| 188 | ... AND Sleep ${HTX_INTERVAL} |
| 189 | |
| 190 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 191 | Post Test Case Execution |
| 192 | [Documentation] Do the post test teardown. |
| 193 | # 1. Shut down HTX exerciser if test Failed. |
| 194 | # 2. Capture FFDC on test failure. |
| 195 | # 3. Close all open SSH connections. |
| 196 | |
George Keishing | 1a23b69 | 2017-05-06 12:19:41 -0500 | [diff] [blame] | 197 | # Keep HTX running if user set HTX_KEEP_RUNNING to 1. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 198 | Run Keyword If |
| 199 | ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0} |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 200 | ... Shutdown HTX Exerciser |
| 201 | |
George Keishing | ae5d978 | 2017-06-12 13:35:59 -0500 | [diff] [blame] | 202 | ${keyword_buf}= Catenate Stop SOL Console Logging |
| 203 | ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log |
| 204 | Run Key ${keyword_buf} |
| 205 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 206 | FFDC On Test Case Fail |
| 207 | Close All Connections |