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. |
| 19 | # CHECK_INVENTORY If set to 1, this enables OS inventory checking |
| 20 | # before and after each HTX run. This parameter |
| 21 | # is optional. |
| 22 | # PREV_INV_FILE_PATH The file path and name of a previous inventory |
| 23 | # snapshot file. After HTX start the system inventory |
| 24 | # is compared to the contents of this file. Setting this |
| 25 | # parameter is optional. CHECK_INVENTORY does not |
| 26 | # need to be set if PREV_INV_FILE_PATH is set. |
| 27 | |
| 28 | Resource ../syslib/utils_os.robot |
| 29 | Library ../syslib/utils_keywords.py |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 30 | |
George Keishing | ae5d978 | 2017-06-12 13:35:59 -0500 | [diff] [blame] | 31 | Suite Setup Run Key Start SOL Console Logging |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 32 | Test Setup Pre Test Case Execution |
| 33 | Test Teardown Post Test Case Execution |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 34 | |
| 35 | *** Variables **** |
| 36 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame^] | 37 | ${stack_mode} skip |
| 38 | ${json_initial_file_path} ${EXECDIR}/data/os_inventory_initial.json |
| 39 | ${json_final_file_path} ${EXECDIR}/data/os_inventory_final.json |
| 40 | ${json_diff_file_path} ${EXECDIR}/data/os_inventory_diff.json |
| 41 | ${last_inventory_file_path} ${EMPTY} |
| 42 | ${run_the_inventory} 0 |
| 43 | &{ignore_dict} processor=size |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 44 | |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 45 | *** Test Cases *** |
| 46 | |
| 47 | Hard Bootme Test |
| 48 | [Documentation] Stress the system using HTX exerciser. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 49 | [Tags] Hard_Bootme_Test |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 50 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 51 | Rprintn |
| 52 | Rpvars HTX_DURATION HTX_INTERVAL |
| 53 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame^] | 54 | # Set last inventory file to PREV_INV_FILE_PATH otherwise set |
| 55 | # it to ${EMPTY}. |
| 56 | ${last_inventory_file_path}= Get Variable Value ${PREV_INV_FILE_PATH} |
| 57 | ... ${EMPTY} |
| 58 | |
| 59 | # Set ${run_the_inventory} if PREV_INV_FILE_PATH was specified, |
| 60 | # else set ${run_the_inventory} from the ${CHECK_INVENTORY} parameter. |
| 61 | ${run_the_inventory}= Run Keyword If |
| 62 | ... '${last_inventory_file_path}' != '${EMPTY}' Set Variable ${1} |
| 63 | ... ELSE Run Keyword If '${last_inventory_file_path}' == '${EMPTY}' |
| 64 | ... Get Variable Value ${CHECK_INVENTORY} ${EMPTY} |
| 65 | |
| 66 | Set Suite Variable ${run_the_inventory} children=true |
| 67 | Set Suite Variable ${last_inventory_file_path} children=true |
| 68 | |
| 69 | Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 70 | |
| 71 | |
| 72 | *** Keywords *** |
| 73 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame^] | 74 | Run HTX Exerciser |
| 75 | [Documentation] Run HTX exerciser. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 76 | # Test Flow: |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame^] | 77 | # - Power on. |
| 78 | # - Establish SSH connection session. |
| 79 | # - Do inventory collection, compare with |
| 80 | # previous inventory run if applicable. |
| 81 | # - Create HTX mdt profile. |
| 82 | # - Run HTX exerciser. |
| 83 | # - Check HTX status for errors. |
| 84 | # - Do inventory collection, compare with |
| 85 | # previous inventory run. |
| 86 | # - Power off. |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 87 | |
| 88 | Boot To OS |
| 89 | |
| 90 | # 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] | 91 | Login To OS |
| 92 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame^] | 93 | Run Keyword If '${run_the_inventory}' != '${EMPTY}' |
| 94 | ... Do Inventory And Compare ${json_initial_file_path} |
| 95 | ... ${last_inventory_file_path} |
| 96 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 97 | Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu' |
| 98 | ... Create Default MDT Profile |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 99 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 100 | Run MDT Profile |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 101 | |
| 102 | Loop HTX Health Check |
| 103 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 104 | Shutdown HTX Exerciser |
| 105 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame^] | 106 | Run Keyword If '${run_the_inventory}' != '${EMPTY}' |
| 107 | ... Do Inventory And Compare ${json_final_file_path} |
| 108 | ... ${last_inventory_file_path} |
| 109 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 110 | Power Off Host |
| 111 | |
George Keishing | ae5d978 | 2017-06-12 13:35:59 -0500 | [diff] [blame] | 112 | # Close all SSH and REST active sessions. |
| 113 | Close All Connections |
| 114 | Flush REST Sessions |
| 115 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 116 | Rprint Timen HTX Test ran for: ${HTX_DURATION} |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 117 | |
George Keishing | 13f44e5 | 2017-05-12 15:28:12 -0500 | [diff] [blame] | 118 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame^] | 119 | Do Inventory and Compare |
| 120 | [Documentation] Do inventory and compare. |
| 121 | [Arguments] ${inventory_file_path} ${last_inventory_file_path} |
| 122 | # Description of argument(s): |
| 123 | # inventory_file_path The file to receive the inventory snapshot. |
| 124 | # last_inventory_file_path The previous inventory to compare with. |
| 125 | |
| 126 | Create JSON Inventory File ${inventory_file_path} |
| 127 | Run Keyword If '${last_inventory_file_path}' != '${EMPTY}' |
| 128 | ... Compare Json Inventory Files ${inventory_file_path} |
| 129 | ... ${last_inventory_file_path} |
| 130 | ${last_inventory_file_path}= Set Variable ${inventory_file_path} |
| 131 | Set Suite Variable ${last_inventory_file_path} children=true |
| 132 | |
| 133 | |
| 134 | Compare Json Inventory Files |
| 135 | [Documentation] Compare JSON inventory files. |
| 136 | [Arguments] ${file1} ${file2} |
| 137 | # Description of argument(s): |
| 138 | # file1 A file that has an inventory snapshot in JSON format. |
| 139 | # file2 A file that has an inventory snapshot, to compare with file1. |
| 140 | |
| 141 | ${diff_rc}= JSON_Inv_File_Diff_Check ${file1} |
| 142 | ... ${file2} ${json_diff_file_path} ${ignore_dict} |
| 143 | Run Keyword If '${diff_rc}' != '${0}' |
| 144 | ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path} |
| 145 | |
| 146 | |
| 147 | Report Inventory Mismatch |
| 148 | [Documentation] Report inventory mismatch. |
| 149 | [Arguments] ${diff_rc} ${json_diff_file_path} |
| 150 | # Description of argument(s): |
| 151 | # diff_rc The failing return code from the difference check. |
| 152 | # json_diff_file_path The file that has the latest inventory snapshot. |
| 153 | |
| 154 | Log To Console Difference in inventory found, return code: |
| 155 | ... no_newline=true |
| 156 | Log to Console ${diff_rc} |
| 157 | Log to Console Differences are listed in file: no_newline=true |
| 158 | Log to Console ${json_diff_file_path} |
| 159 | Fail Inventory mismatch, rc=${diff_rc} |
| 160 | |
| 161 | |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 162 | Loop HTX Health Check |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 163 | [Documentation] Run until HTX exerciser fails. |
George Keishing | 8b082fd | 2017-05-03 13:42:39 -0500 | [diff] [blame] | 164 | Repeat Keyword ${HTX_DURATION} |
| 165 | ... Run Keywords Check HTX Run Status |
| 166 | ... AND Sleep ${HTX_INTERVAL} |
| 167 | |
| 168 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 169 | Post Test Case Execution |
| 170 | [Documentation] Do the post test teardown. |
| 171 | # 1. Shut down HTX exerciser if test Failed. |
| 172 | # 2. Capture FFDC on test failure. |
| 173 | # 3. Close all open SSH connections. |
| 174 | |
George Keishing | 1a23b69 | 2017-05-06 12:19:41 -0500 | [diff] [blame] | 175 | # Keep HTX running if user set HTX_KEEP_RUNNING to 1. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame^] | 176 | Run Keyword If |
| 177 | ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0} |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 178 | ... Shutdown HTX Exerciser |
| 179 | |
George Keishing | ae5d978 | 2017-06-12 13:35:59 -0500 | [diff] [blame] | 180 | ${keyword_buf}= Catenate Stop SOL Console Logging |
| 181 | ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log |
| 182 | Run Key ${keyword_buf} |
| 183 | |
George Keishing | ffbe8ce | 2017-05-04 12:08:54 -0500 | [diff] [blame] | 184 | FFDC On Test Case Fail |
| 185 | Close All Connections |