1*** Settings *** 2 3Documentation 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 28Resource ../syslib/utils_os.robot 29Library ../syslib/utils_keywords.py 30 31Suite Setup Run Key Start SOL Console Logging 32Test Setup Pre Test Case Execution 33Test Teardown Post Test Case Execution 34 35*** Variables **** 36 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 44 45*** Test Cases *** 46 47Hard Bootme Test 48 [Documentation] Stress the system using HTX exerciser. 49 [Tags] Hard_Bootme_Test 50 51 Rprintn 52 Rpvars HTX_DURATION HTX_INTERVAL 53 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 70 71 72*** Keywords *** 73 74Run HTX Exerciser 75 [Documentation] Run HTX exerciser. 76 # Test Flow: 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. 87 88 Boot To OS 89 90 # Post Power off and on, the OS SSH session needs to be established. 91 Login To OS 92 93 Run Keyword If '${run_the_inventory}' != '${EMPTY}' 94 ... Do Inventory And Compare ${json_initial_file_path} 95 ... ${last_inventory_file_path} 96 97 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu' 98 ... Create Default MDT Profile 99 100 Run MDT Profile 101 102 Loop HTX Health Check 103 104 Shutdown HTX Exerciser 105 106 Run Keyword If '${run_the_inventory}' != '${EMPTY}' 107 ... Do Inventory And Compare ${json_final_file_path} 108 ... ${last_inventory_file_path} 109 110 Power Off Host 111 112 # Close all SSH and REST active sessions. 113 Close All Connections 114 Flush REST Sessions 115 116 Rprint Timen HTX Test ran for: ${HTX_DURATION} 117 118 119Do 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 134Compare 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 147Report 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 162Loop HTX Health Check 163 [Documentation] Run until HTX exerciser fails. 164 Repeat Keyword ${HTX_DURATION} 165 ... Run Keywords Check HTX Run Status 166 ... AND Sleep ${HTX_INTERVAL} 167 168 169Post 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 175 # Keep HTX running if user set HTX_KEEP_RUNNING to 1. 176 Run Keyword If 177 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0} 178 ... Shutdown HTX Exerciser 179 180 ${keyword_buf}= Catenate Stop SOL Console Logging 181 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log 182 Run Key ${keyword_buf} 183 184 FFDC On Test Case Fail 185 Close All Connections 186