1*** Settings *** 2Documentation This suite tests IPMI SOL in OpenBMC. 3 4Resource ../lib/ipmi_client.robot 5Resource ../lib/openbmc_ffdc.robot 6Resource ../lib/state_manager.robot 7Resource ../lib/boot_utils.robot 8Resource ../lib/bmc_redfish_resource.robot 9Library ../lib/ipmi_utils.py 10 11Test Setup Start SOL Console Logging 12Test Teardown Test Teardown Execution 13 14Force Tags SOL_Test 15 16 17*** Variables *** 18 19*** Test Cases *** 20 21Set SOL Enabled 22 [Documentation] Verify enabling SOL via IPMI. 23 [Tags] Set_SOL_Enabled 24 25 ${msg}= Run Keyword Run IPMI Standard Command 26 ... sol set enabled true 27 28 # Verify SOL status from ipmitool sol info command. 29 ${sol_info_dict}= Get SOL Info 30 ${sol_enable_status}= Get From Dictionary 31 ... ${sol_info_dict} Enabled 32 33 Should Be Equal '${sol_enable_status}' 'true' 34 35 36Set SOL Disabled 37 [Documentation] Verify disabling SOL via IPMI. 38 [Tags] Set_SOL_Disabled 39 40 ${msg}= Run Keyword Run IPMI Standard Command 41 ... sol set enabled false 42 43 # Verify SOL status from ipmitool sol info command. 44 ${sol_info_dict}= Get SOL Info 45 ${sol_enable_status}= Get From Dictionary 46 ... ${sol_info_dict} Enabled 47 Should Be Equal '${sol_enable_status}' 'false' 48 49 # Verify error while activating SOL with SOL disabled. 50 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command 51 ... sol activate 52 Should Contain ${msg} SOL payload disabled ignore_case=True 53 54 55Set Valid SOL Privilege Level 56 [Documentation] Verify valid SOL's privilege level via IPMI. 57 [Tags] Set_Valid_SOL_Privilege_Level 58 59 ${privilege_level_list}= Create List user operator admin oem 60 61 FOR ${item} IN @{privilege_level_list} 62 Set SOL Setting privilege-level ${item} 63 ${output}= Get SOL Setting Privilege Level 64 Should Contain ${output} ${item} ignore_case=True 65 END 66 67 68Set Invalid SOL Privilege Level 69 [Documentation] Verify invalid SOL's retry count via IPMI. 70 [Tags] Set_Invalid_SOL_Privilege_Level 71 72 ${value}= Generate Random String ${8} 73 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command 74 ... sol set privilege-level ${value} 75 Should Contain ${msg} Invalid value ignore_case=True 76 77 78Set Invalid SOL Retry Count 79 [Documentation] Verify invalid SOL's retry count via IPMI. 80 [Tags] Set_Invalid_SOL_Retry_Count 81 82 # Any integer above 7 is invalid for SOL retry count. 83 ${value}= Evaluate random.randint(8, 10000) modules=random 84 85 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command 86 ... sol set retry-count ${value} 87 Should Contain ${msg} Invalid value ignore_case=True 88 89 90Set Invalid SOL Retry Interval 91 [Documentation] Verify invalid SOL's retry interval via IPMI. 92 [Tags] Set_Invalid_SOL_Retry_Interval 93 94 # Any integer above 255 is invalid for SOL retry interval. 95 ${value}= Evaluate random.randint(256, 10000) modules=random 96 97 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command 98 ... sol set retry-interval ${value} 99 Should Contain ${msg} Invalid value ignore_case=True 100 101 102Set Invalid SOL Character Accumulate Level 103 [Documentation] Verify invalid SOL's character accumulate level via IPMI. 104 [Tags] Set_Invalid_SOL_Character_Accumulate_Level 105 106 # Any integer above 255 is invalid for SOL character accumulate level. 107 ${value}= Evaluate random.randint(256, 10000) modules=random 108 109 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command 110 ... sol set character-accumulate-level ${value} 111 Should Contain ${msg} Invalid value ignore_case=True 112 113 114Set Invalid SOL Character Send Threshold 115 [Documentation] Verify invalid SOL's character send threshold via IPMI. 116 [Tags] Set_Invalid_SOL_Character_Send_Threshold 117 118 # Any integer above 255 is invalid for SOL character send threshold. 119 ${value}= Evaluate random.randint(256, 10000) modules=random 120 121 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command 122 ... sol set character-send-threshold ${value} 123 Should Contain ${msg} Invalid value ignore_case=True 124 125 126Verify SOL During Boot 127 [Documentation] Verify SOL during boot. 128 [Tags] Verify_SOL_During_Boot 129 130 IPMI Power Off stack_mode=skip 131 Activate SOL Via IPMI 132 Initiate Host Boot Via External IPMI wait=${0} 133 134 Wait Until Keyword Succeeds 3 mins 15 secs 135 ... Check IPMI SOL Output Content Welcome to Hostboot 136 137 Wait Until Keyword Succeeds 3 mins 15 secs 138 ... Check IPMI SOL Output Content ISTEP 139 140 IPMI Power Off 141 142 143Verify Deactivate Non Existing SOL 144 [Documentation] Verify deactivate non existing SOL session. 145 [Tags] Verify_Deactivate_Non_Existing_SOL 146 147 ${resp}= Deactivate SOL Via IPMI 148 Should Contain ${resp} SOL payload already de-activated 149 ... case_insensitive=True 150 151 152Set Valid SOL Retry Count 153 [Documentation] Verify valid SOL's retry count via IPMI. 154 [Tags] Set_Valid_SOL_Retry_Count 155 [Template] Verify SOL Setting 156 157 # Setting name Min valid value Max valid value 158 retry-count 0 7 159 160 161Set Valid SOL Retry Interval 162 [Documentation] Verify valid SOL's retry interval via IPMI. 163 [Tags] Set_Valid_SOL_Retry_Interval 164 [Template] Verify SOL Setting 165 166 # Setting name Min valid value Max valid value 167 retry-interval 0 255 168 169 170Set Valid SOL Character Accumulate Level 171 [Documentation] Verify valid SOL's character accumulate level via IPMI. 172 [Tags] Set_Valid_SOL_Character_Accumulate_Level 173 [Template] Verify SOL Setting 174 175 # Setting name Min valid value Max valid value 176 character-accumulate-level 1 255 177 178 179Set Valid SOL Character Send Threshold 180 [Documentation] Verify valid SOL's character send threshold via IPMI. 181 [Tags] Set_Valid_SOL_Character_Send_Threshold 182 [Template] Verify SOL Setting 183 184 # Setting name Min valid value Max valid value 185 character-send-threshold 0 255 186 187 188Verify Continuous Activation And Deactivation Of SOL 189 [Documentation] Continuously on and off SOL. 190 [Tags] Verify_Continuous_Activation_And_Deactivation_Of_SOL 191 192 ${iteration_count}= Evaluate random.randint(5,10) modules=random 193 FOR ${iter} IN RANGE ${iteration_count} 194 Activate SOL Via IPMI 195 Deactivate SOL Via IPMI 196 END 197 198 199*** Keywords *** 200 201Check IPMI SOL Output Content 202 [Documentation] Check if SOL has given content. 203 [Arguments] ${data} ${file_path}=${IPMI_SOL_LOG_FILE} 204 # Description of argument(s): 205 # data Content which need to be checked(e.g. Petitboot, ISTEP). 206 # file_path The file path on the local machine to check SOL content. 207 # By default it check SOL content from log/sol_<BMC_IP>. 208 209 ${output}= OperatingSystem.Get File ${file_path} encoding_errors=ignore 210 Should Contain ${output} ${data} case_insensitive=True 211 212 213Verify SOL Setting 214 [Documentation] Verify SOL Setting via IPMI. 215 [Arguments] ${setting_name} ${min_value} ${max_value} 216 # Description of Arguments: 217 # setting_name Setting to verify (e.g. "retry-count"). 218 # min_value min valid value for given setting. 219 # max_value max valid value for given setting. 220 221 ${value}= 222 ... Evaluate random.randint(${min_value}, ${max_value}) modules=random 223 224 # Character accumulate level setting is set in multiples of 5. 225 # Retry interval setting is set in multiples of 10. 226 # Reference IPMI specification v2.0 227 228 ${expected_value}= Run Keyword If 229 ... '${setting_name}' == 'character-accumulate-level' Evaluate ${value}*5 230 ... ELSE IF '${setting_name}' == 'retry-interval' Evaluate ${value}*10 231 ... ELSE Set Variable ${value} 232 233 Set SOL Setting ${setting_name} '${value}' 234 235 # Replace "-" with space " " in setting name. 236 # E.g. "retry-count" to "retry count" 237 ${setting_name}= Evaluate $setting_name.replace('-',' ') 238 239 ${sol_info_dict}= Get SOL Info 240 241 # Get exact SOL setting name from sol info output. 242 ${list}= Get Matches ${sol_info_dict} ${setting_name}* 243 ... case_insensitive=${True} 244 ${setting_name_from_dict}= Get From List ${list} 0 245 246 # Get SOL setting value from above setting name. 247 ${setting_value}= Get From Dictionary 248 ... ${sol_info_dict} ${setting_name_from_dict} 249 250 Should Be Equal '${setting_value}' '${expected_value}' 251 252 IPMI Power Off stack_mode=skip 253 254 Initiate Host Boot Via External IPMI wait=${0} 255 256 Activate SOL Via IPMI 257 Wait Until Keyword Succeeds 3 mins 15 secs 258 ... Check IPMI SOL Output Content Welcome to Hostboot 259 260 Wait Until Keyword Succeeds 3 mins 15 secs 261 ... Check IPMI SOL Output Content ISTEP 262 263 264Get SOL Setting 265 [Documentation] Returns status for given SOL setting. 266 [Arguments] ${setting} 267 # Description of argument(s): 268 # setting SOL setting which needs to be read(e.g. "Retry Count"). 269 270 ${sol_info_dict}= Get SOL Info 271 ${setting_status}= Get From Dictionary ${sol_info_dict} ${setting} 272 273 [Return] ${setting_status} 274 275 276Restore Default SOL Configuration 277 [Documentation] Restore default SOL configuration. 278 279 Set SOL Setting enabled true 280 Set SOL Setting retry-count 7 281 Set SOL Setting retry-interval 10 282 Set SOL Setting character-accumulate-level 20 283 Set SOL Setting character-send-threshold 1 284 Set SOL Setting privilege-level user 285 286 287Test Teardown Execution 288 [Documentation] Do the post test teardown. 289 290 Wait Until Keyword Succeeds 15 sec 5 sec Restore Default SOL Configuration 291 Deactivate SOL Via IPMI 292 ${sol_log}= Stop SOL Console Logging 293 Log ${sol_log} 294 FFDC On Test Case Fail 295