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