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