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 | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 29 | # INV_IGNORE_LIST A comma-delimited list of colon-delimited pairs that |
| 30 | # indicate what to ignore if there are inventory |
| 31 | # differences. For example, "processor:size,network:speed" |
| 32 | # If differences are found during inventory checking |
| 33 | # and those items are in this string, the |
| 34 | # differences will be ignored. This parameter is |
| 35 | # optional. If not specified the default value is |
| 36 | # "processor: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 |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 40 | |
George Keishing | ae5d978 | 2017-06-12 13:35:59 -0500 | [diff] [blame] | 41 | Suite Setup Run Key Start SOL Console Logging |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 42 | Test Setup Pre Test Case Execution |
| 43 | Test Teardown Post Test Case Execution |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 44 | |
Steven Sombar | 6f9d41d | 2017-08-08 13:35:30 -0500 | [diff] [blame] | 45 | |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 46 | *** Variables **** |
| 47 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 48 | ${stack_mode} skip |
Steven Sombar | 6f9d41d | 2017-08-08 13:35:30 -0500 | [diff] [blame] | 49 | ${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json |
| 50 | ${json_final_file_path} ${EXECDIR}/os_inventory_final.json |
| 51 | ${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 52 | ${last_inventory_file_path} ${EMPTY} |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 53 | ${CHECK_INVENTORY} True |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 54 | ${INV_IGNORE_LIST} processor:size |
| 55 | ${PREV_INV_FILE_PATH} ${EMPTY} |
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 | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 64 | # Set last inventory file to PREV_INV_FILE_PATH otherwise set it |
| 65 | # to ${EMPTY}. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 66 | ${last_inventory_file_path}= Get Variable Value ${PREV_INV_FILE_PATH} |
| 67 | ... ${EMPTY} |
| 68 | |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 69 | Rprintn |
| 70 | Rpvars HTX_DURATION HTX_INTERVAL CHECK_INVENTORY INV_IGNORE_LIST |
| 71 | ... PREV_INV_FILE_PATH |
| 72 | |
| 73 | Run Keyword If '${last_inventory_file_path}' != '${EMPTY}' |
| 74 | ... OperatingSystem.File Should Exist ${last_inventory_file_path} |
| 75 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 76 | Set Suite Variable ${last_inventory_file_path} children=true |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 77 | Set Suite Variable ${INV_IGNORE_LIST} children=true |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 78 | |
| 79 | Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 80 | |
| 81 | |
| 82 | *** Keywords *** |
| 83 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 84 | Run HTX Exerciser |
| 85 | [Documentation] Run HTX exerciser. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 86 | # Test Flow: |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 87 | # - Power on. |
| 88 | # - Establish SSH connection session. |
| 89 | # - Do inventory collection, compare with |
| 90 | # previous inventory run if applicable. |
| 91 | # - Create HTX mdt profile. |
| 92 | # - Run HTX exerciser. |
| 93 | # - Check HTX status for errors. |
| 94 | # - Do inventory collection, compare with |
| 95 | # previous inventory run. |
| 96 | # - Power off. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 97 | |
| 98 | Boot To OS |
| 99 | |
| 100 | # 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] | 101 | Login To OS |
| 102 | |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 103 | Run Keyword If '${CHECK_INVENTORY}' == 'True' |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 104 | ... Do Inventory And Compare ${json_initial_file_path} |
| 105 | ... ${last_inventory_file_path} |
| 106 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 107 | Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu' |
| 108 | ... Create Default MDT Profile |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 109 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 110 | Run MDT Profile |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 111 | |
| 112 | Loop HTX Health Check |
| 113 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 114 | Shutdown HTX Exerciser |
| 115 | |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 116 | Run Keyword If '${CHECK_INVENTORY}' == 'True' |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 117 | ... Do Inventory And Compare ${json_final_file_path} |
| 118 | ... ${last_inventory_file_path} |
| 119 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 120 | Power Off Host |
| 121 | |
George Keishing | ae5d978 | 2017-06-12 13:35:59 -0500 | [diff] [blame] | 122 | # Close all SSH and REST active sessions. |
| 123 | Close All Connections |
| 124 | Flush REST Sessions |
| 125 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 126 | Rprint Timen HTX Test ran for: ${HTX_DURATION} |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 127 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 128 | |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 129 | Do Inventory And Compare |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 130 | [Documentation] Do inventory and compare. |
| 131 | [Arguments] ${inventory_file_path} ${last_inventory_file_path} |
| 132 | # Description of argument(s): |
| 133 | # inventory_file_path The file to receive the inventory snapshot. |
| 134 | # last_inventory_file_path The previous inventory to compare with. |
| 135 | |
| 136 | Create JSON Inventory File ${inventory_file_path} |
| 137 | Run Keyword If '${last_inventory_file_path}' != '${EMPTY}' |
| 138 | ... Compare Json Inventory Files ${inventory_file_path} |
| 139 | ... ${last_inventory_file_path} |
| 140 | ${last_inventory_file_path}= Set Variable ${inventory_file_path} |
| 141 | Set Suite Variable ${last_inventory_file_path} children=true |
| 142 | |
| 143 | |
| 144 | Compare Json Inventory Files |
| 145 | [Documentation] Compare JSON inventory files. |
| 146 | [Arguments] ${file1} ${file2} |
| 147 | # Description of argument(s): |
| 148 | # file1 A file that has an inventory snapshot in JSON format. |
| 149 | # file2 A file that has an inventory snapshot, to compare with file1. |
| 150 | |
| 151 | ${diff_rc}= JSON_Inv_File_Diff_Check ${file1} |
Steven Sombar | 48ad01d | 2017-08-17 14:17:37 -0500 | [diff] [blame] | 152 | ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST} |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 153 | Run Keyword If '${diff_rc}' != '${0}' |
| 154 | ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path} |
| 155 | |
| 156 | |
| 157 | Report Inventory Mismatch |
| 158 | [Documentation] Report inventory mismatch. |
| 159 | [Arguments] ${diff_rc} ${json_diff_file_path} |
| 160 | # Description of argument(s): |
| 161 | # diff_rc The failing return code from the difference check. |
| 162 | # json_diff_file_path The file that has the latest inventory snapshot. |
| 163 | |
Steven Sombar | a2216d2 | 2017-08-09 12:18:00 -0500 | [diff] [blame] | 164 | Log To Console Significant difference in inventory found, rc=${diff_rc} |
| 165 | Log To Console Differences are listed in file: no_newline=true |
| 166 | Log To Console ${json_diff_file_path} |
| 167 | Log To Console File Contents: |
| 168 | Wait Until Created ${json_diff_file_path} |
| 169 | ${file_contents}= OperatingSystem.Get File ${json_diff_file_path} |
| 170 | Log ${file_contents} level=WARN |
| 171 | Fail Significant difference in inventory found, rc=${diff_rc} |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 172 | |
| 173 | |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 174 | Loop HTX Health Check |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 175 | [Documentation] Run until HTX exerciser fails. |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 176 | Repeat Keyword ${HTX_DURATION} |
| 177 | ... Run Keywords Check HTX Run Status |
| 178 | ... AND Sleep ${HTX_INTERVAL} |
| 179 | |
| 180 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 181 | Post Test Case Execution |
| 182 | [Documentation] Do the post test teardown. |
| 183 | # 1. Shut down HTX exerciser if test Failed. |
| 184 | # 2. Capture FFDC on test failure. |
| 185 | # 3. Close all open SSH connections. |
| 186 | |
George Keishing | 1a23b69 | 2017-05-06 12:19:41 -0500 | [diff] [blame] | 187 | # Keep HTX running if user set HTX_KEEP_RUNNING to 1. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 188 | Run Keyword If |
| 189 | ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0} |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 190 | ... Shutdown HTX Exerciser |
| 191 | |
George Keishing | ae5d978 | 2017-06-12 13:35:59 -0500 | [diff] [blame] | 192 | ${keyword_buf}= Catenate Stop SOL Console Logging |
| 193 | ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log |
| 194 | Run Key ${keyword_buf} |
| 195 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 196 | FFDC On Test Case Fail |
| 197 | Close All Connections |