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