| 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 | 6fe52b9 | 2017-06-16 03:35:26 -0500 | [diff] [blame] | 76 | Set Valid SOL Privilege Level | 
|  | 77 | [Documentation]  Verify valid SOL's privilege level via IPMI. | 
|  | 78 | [Tags]  Set_Valid_SOL_Privilege_Level | 
|  | 79 |  | 
|  | 80 | ${privilege_level_list}=  Create List  user  operator  admin  oem | 
|  | 81 | : FOR  ${item}  IN  @{privilege_level_list} | 
|  | 82 | \  Set SOL Setting Value  privilege-level  ${item} | 
|  | 83 | \  ${output}=  Get SOL Setting Value  privilege level | 
|  | 84 | \  Should Contain  ${output}  ${item}  ignore_case=True | 
|  | 85 |  | 
|  | 86 |  | 
|  | 87 | Set Invalid SOL Privilege Level | 
|  | 88 | [Documentation]  Verify invalid SOL's retry count via IPMI. | 
|  | 89 | [Tags]  Set_Invalid_SOL_Privilege_Level | 
|  | 90 |  | 
|  | 91 | ${value}=  Generate Random String  ${8} | 
|  | 92 | ${msg}=  Run Keyword And Expect Error  *  Run IPMI Standard Command | 
|  | 93 | ...  sol set privilege-level ${value} | 
|  | 94 | Should Contain  ${msg}  Invalid value  ignore_case=True | 
|  | 95 |  | 
|  | 96 |  | 
| Rahul Maheshwari | 982fee4 | 2017-05-03 00:33:15 -0500 | [diff] [blame] | 97 | *** Keywords *** | 
|  | 98 |  | 
| Rahul Maheshwari | 982fee4 | 2017-05-03 00:33:15 -0500 | [diff] [blame] | 99 | Check IPMI SOL Output Content | 
|  | 100 | [Documentation]  Check if SOL has given content. | 
|  | 101 | [Arguments]  ${data}  ${file_path}=/tmp/sol_${OPENBMC_HOST} | 
|  | 102 | # Description of argument(s): | 
|  | 103 | # data       Content which need to be checked(e.g. Petitboot, ISTEP). | 
|  | 104 | # file_path  The file path on the local machine to check SOL content. | 
|  | 105 | #            By default it check SOL content from /tmp/sol_<BMC_IP>. | 
|  | 106 |  | 
|  | 107 | ${rc}  ${output}=  Run and Return RC and Output  cat ${file_path} | 
|  | 108 | Should Be Equal  ${rc}  ${0}  msg=${output} | 
|  | 109 |  | 
|  | 110 | Should Contain  ${output}  ${data}  case_insensitive=True | 
| Rahul Maheshwari | d629b5c | 2017-05-23 08:06:28 -0500 | [diff] [blame] | 111 |  | 
|  | 112 |  | 
|  | 113 | Verify SOL Setting | 
|  | 114 | [Documentation]  Verify SOL Setting via IPMI. | 
|  | 115 | [Arguments]  ${setting_name}  ${min_value}  ${max_value} | 
|  | 116 | # Description of Arguments: | 
|  | 117 | # setting_name    Setting to verify (e.g. "retry-count"). | 
|  | 118 | # min_value       min valid value for given setting. | 
|  | 119 | # max_value       max valid value for given setting. | 
|  | 120 |  | 
|  | 121 | ${value}= | 
|  | 122 | ...  Evaluate  random.randint(${min_value}, ${max_value})  modules=random | 
|  | 123 |  | 
|  | 124 | # Character accumulate level setting is set in multiples of 5. | 
|  | 125 | # Retry interval setting is set in multiples of 10. | 
|  | 126 | # Reference IPMI specification v2.0 | 
|  | 127 |  | 
|  | 128 | ${expected_value}=  Run Keyword If | 
|  | 129 | ...  '${setting_name}' == 'character-accumulate-level'  Evaluate  ${value}*5 | 
|  | 130 | ...  ELSE IF  '${setting_name}' == 'retry-interval'  Evaluate  ${value}*10 | 
|  | 131 | ...  ELSE  Set Variable  ${value} | 
|  | 132 |  | 
|  | 133 | Set SOL Setting  ${setting_name}  '${value}' | 
|  | 134 |  | 
|  | 135 | # Replace "-" with space " " in setting name. | 
|  | 136 | # E.g. "retry-count" to "retry count" | 
|  | 137 | ${setting_name}=  Evaluate  $setting_name.replace('-',' ') | 
|  | 138 |  | 
|  | 139 | ${sol_info_dict}=  Get SOL Info | 
|  | 140 |  | 
|  | 141 | # Get exact SOL setting name from sol info output. | 
|  | 142 | ${list}=  Get Matches  ${sol_info_dict}  ${setting_name}* | 
|  | 143 | ...  case_insensitive=${True} | 
|  | 144 | ${setting_name_from_dict}=  Get From List  ${list}  0 | 
|  | 145 |  | 
|  | 146 | # Get SOL setting value from above setting name. | 
|  | 147 | ${setting_value}=  Get From Dictionary | 
|  | 148 | ...  ${sol_info_dict}  ${setting_name_from_dict} | 
|  | 149 |  | 
|  | 150 | Should Be Equal  '${setting_value}'  '${expected_value}' | 
|  | 151 |  | 
|  | 152 | # Power on host to check if SOL is working fine with new setting. | 
|  | 153 | ${current_state}=  Get Host State Via External IPMI | 
|  | 154 | Run Keyword If  '${current_state}' == 'on' | 
|  | 155 | ...  Initiate Host PowerOff Via External IPMI | 
|  | 156 | Initiate Host Boot Via External IPMI  wait=${0} | 
|  | 157 |  | 
|  | 158 | Activate SOL Via IPMI | 
|  | 159 | Wait Until Keyword Succeeds  10 mins  30 secs | 
|  | 160 | ...  Check IPMI SOL Output Content  Petitboot | 
|  | 161 |  | 
|  | 162 |  | 
|  | 163 | Restore Default SOL Configuration | 
|  | 164 | [Documentation]  Restore default SOL configuration. | 
|  | 165 |  | 
|  | 166 | Open Connection And Log In | 
|  | 167 |  | 
|  | 168 | Set SOL Setting  retry-count  7 | 
|  | 169 | Set SOL Setting  retry-interval  10 | 
|  | 170 | Set SOL Setting  character-accumulate-level  20 | 
|  | 171 | Set SOL Setting  character-send-threshold  1 | 
| Rahul Maheshwari | 6fe52b9 | 2017-06-16 03:35:26 -0500 | [diff] [blame] | 172 | Set SOL Setting  privilege-level  user | 
| Rahul Maheshwari | d629b5c | 2017-05-23 08:06:28 -0500 | [diff] [blame] | 173 |  | 
|  | 174 | Close All Connections | 
|  | 175 |  | 
|  | 176 |  | 
|  | 177 | Post Test Case Execution | 
|  | 178 | [Documentation]  Do the post test teardown. | 
|  | 179 |  | 
|  | 180 | Deactivate SOL Via IPMI | 
|  | 181 | FFDC On Test Case Fail | 
|  | 182 | Restore Default SOL Configuration |