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