Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test suite for OpenBMC IPMI user management. |
| 3 | |
| 4 | Resource ../lib/ipmi_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 6 | Resource ../lib/bmc_network_utils.robot |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 7 | Library ../lib/ipmi_utils.py |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 8 | Test Setup Printn |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 9 | |
Ashwini Chandrappa | 12be4b4 | 2022-03-15 23:02:07 -0500 | [diff] [blame] | 10 | Suite Setup Suite Setup Execution |
Rahul Maheshwari | f646baa | 2019-02-20 12:29:35 -0600 | [diff] [blame] | 11 | Test Teardown Test Teardown Execution |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 12 | |
| 13 | *** Variables *** |
| 14 | |
| 15 | ${invalid_username} user% |
| 16 | ${invalid_password} abc123 |
chithrag | c0582f7 | 2021-12-08 10:34:23 -0500 | [diff] [blame] | 17 | ${new_username} newuser |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 18 | ${root_userid} 1 |
| 19 | ${operator_level_priv} 0x3 |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 20 | ${user_priv} 2 |
| 21 | ${operator_priv} 3 |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 22 | ${admin_level_priv} 4 |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 23 | ${no_access_priv} 15 |
Rahul Maheshwari | c19f838 | 2019-02-20 08:19:22 -0600 | [diff] [blame] | 24 | ${valid_password} 0penBmc1 |
| 25 | ${max_password_length} 20 |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 26 | ${ipmi_setaccess_cmd} channel setaccess |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 27 | &{password_values} 16=0penBmc10penBmc2 17=0penBmc10penBmc2B |
| 28 | ... 20=0penBmc10penBmc2Bmc3 21=0penBmc10penBmc2Bmc34 |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 29 | ... 7=0penBmc 8=0penBmc0 |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 30 | |
Ashwini Chandrappa | 5cefabf | 2021-08-30 23:48:14 -0500 | [diff] [blame] | 31 | # User defined count. |
| 32 | ${USER_LOOP_COUNT} 20 |
| 33 | |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 34 | *** Test Cases *** |
| 35 | |
Rahul Maheshwari | ffc7735 | 2019-02-25 09:05:27 -0600 | [diff] [blame] | 36 | Verify IPMI User Summary |
| 37 | [Documentation] Verify IPMI maximum supported IPMI user ID and |
| 38 | ... enabled user form user summary |
| 39 | [Tags] Verify_IPMI_User_Summary |
Ashwini Chandrappa | 12be4b4 | 2022-03-15 23:02:07 -0500 | [diff] [blame] | 40 | [Teardown] Run Keywords FFDC On Test Case Fail AND Delete Created User ${random_userid} |
Rahul Maheshwari | ffc7735 | 2019-02-25 09:05:27 -0600 | [diff] [blame] | 41 | |
Ashwini Chandrappa | 12be4b4 | 2022-03-15 23:02:07 -0500 | [diff] [blame] | 42 | # Create random user |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 43 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 44 | Set Test Variable ${random_userid} |
Rahul Maheshwari | ffc7735 | 2019-02-25 09:05:27 -0600 | [diff] [blame] | 45 | Run IPMI Standard Command user enable ${random_userid} |
| 46 | |
Ashwini Chandrappa | 12be4b4 | 2022-03-15 23:02:07 -0500 | [diff] [blame] | 47 | ${output}= Run IPMI Standard Command user summary ${CHANNEL_NUMBER} |
| 48 | # TODO: Verification of enabled IPMI user needs to be done. |
| 49 | # https://github.com/openbmc/openbmc-test-automation/issues/2189 |
| 50 | |
| 51 | ${maximum_ids}= Get Lines Containing String ${output} Maximum IDs |
| 52 | |
Rahul Maheshwari | ffc7735 | 2019-02-25 09:05:27 -0600 | [diff] [blame] | 53 | Should Contain ${maximum_ids} 15 |
| 54 | |
| 55 | |
Tony Lee | 3d351ee | 2020-02-19 10:21:04 +0800 | [diff] [blame] | 56 | Verify IPMI User List |
| 57 | [Documentation] Verify user list via IPMI. |
| 58 | [Tags] Verify_IPMI_User_List |
| 59 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 60 | ... Delete Created User ${random_userid} |
| 61 | |
| 62 | ${random_userid} ${random_username}= Create Random IPMI User |
| 63 | Set Test Variable ${random_userid} |
| 64 | |
| 65 | Run IPMI Standard Command |
| 66 | ... user set password ${random_userid} ${valid_password} |
| 67 | Run IPMI Standard Command user enable ${random_userid} |
| 68 | # Delay added for IPMI user to get enabled. |
| 69 | Sleep 5s |
| 70 | # Set admin privilege and enable IPMI messaging for newly created user. |
| 71 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 72 | |
| 73 | ${users_access}= Get User Access Ipmi ${CHANNEL_NUMBER} |
| 74 | Rprint Vars users_access |
| 75 | |
| 76 | ${index}= Evaluate ${random_userid} - 1 |
| 77 | # Verify the user access of created user. |
| 78 | Valid Value users_access[${index}]['id'] ['${random_userid}'] |
| 79 | Valid Value users_access[${index}]['name'] ['${random_username}'] |
| 80 | Valid Value users_access[${index}]['callin'] ['true'] |
| 81 | Valid Value users_access[${index}]['link'] ['false'] |
| 82 | Valid Value users_access[${index}]['auth'] ['true'] |
| 83 | Valid Value users_access[${index}]['ipmi'] ['ADMINISTRATOR'] |
| 84 | |
| 85 | |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 86 | Verify IPMI User Creation With Valid Name And ID |
| 87 | [Documentation] Create user via IPMI and verify. |
George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 88 | [Tags] Verify_IPMI_User_Creation_With_Valid_Name_And_ID |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 89 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 90 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 91 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 92 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 93 | Set Test Variable ${random_userid} |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 94 | |
| 95 | |
| 96 | Verify IPMI User Creation With Invalid Name |
| 97 | [Documentation] Verify error while creating IPMI user with invalid |
George Keishing | c2a6f09 | 2019-02-20 12:26:54 -0600 | [diff] [blame] | 98 | ... name(e.g. user name with special characters). |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 99 | [Tags] Verify_IPMI_User_Creation_With_Invalid_Name |
| 100 | |
Rahul Maheshwari | 976a170 | 2019-02-21 01:47:58 -0600 | [diff] [blame] | 101 | ${random_userid}= Evaluate random.randint(2, 15) modules=random |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 102 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 103 | ... user set name ${random_userid} ${invalid_username} |
| 104 | Should Contain ${msg} Invalid data |
| 105 | |
| 106 | |
| 107 | Verify IPMI User Creation With Invalid ID |
| 108 | [Documentation] Verify error while creating IPMI user with invalid |
| 109 | ... ID(i.e. any number greater than 15 or 0). |
| 110 | [Tags] Verify_IPMI_User_Creation_With_Invalid_ID |
| 111 | |
| 112 | @{id_list}= Create List |
| 113 | ${random_invalid_id}= Evaluate random.randint(16, 1000) modules=random |
| 114 | Append To List ${id_list} ${random_invalid_id} |
| 115 | Append To List ${id_list} 0 |
| 116 | |
Sushil Singh | be97ffc | 2019-06-04 06:34:24 -0500 | [diff] [blame] | 117 | FOR ${id} IN @{id_list} |
| 118 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 119 | ... user set name ${id} newuser |
Tony Lee | c8ed753 | 2020-01-09 16:15:16 +0800 | [diff] [blame] | 120 | Should Contain Any ${msg} User ID is limited to range Parameter out of range |
Sushil Singh | be97ffc | 2019-06-04 06:34:24 -0500 | [diff] [blame] | 121 | END |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 122 | |
| 123 | Verify Setting IPMI User With Invalid Password |
| 124 | [Documentation] Verify error while setting IPMI user with invalid |
| 125 | ... password. |
| 126 | [Tags] Verify_Setting_IPMI_User_With_Invalid_Password |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 127 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 128 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 129 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 130 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 131 | Set Test Variable ${random_userid} |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 132 | |
| 133 | # Set invalid password for newly created user. |
| 134 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 135 | ... user set password ${random_userid} ${invalid_password} |
| 136 | |
Sushma M M | 97fccae | 2020-07-27 14:55:19 -0500 | [diff] [blame] | 137 | # Delay added for user password to get set. |
| 138 | Sleep 5s |
| 139 | |
Anusha Dathatri | a54cddc | 2019-08-07 10:01:16 -0500 | [diff] [blame] | 140 | Should Contain ${msg} Set User Password command failed |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 141 | |
| 142 | Verify Setting IPMI Root User With New Name |
| 143 | [Documentation] Verify error while setting IPMI root user with new |
| 144 | ... name. |
| 145 | [Tags] Verify_Setting_IPMI_Root_User_With_New_Name |
| 146 | |
| 147 | # Set invalid password for newly created user. |
| 148 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 149 | ... user set name ${root_userid} abcd |
| 150 | |
| 151 | Should Contain ${msg} Set User Name command failed |
| 152 | |
| 153 | |
Rahul Maheshwari | c19f838 | 2019-02-20 08:19:22 -0600 | [diff] [blame] | 154 | Verify IPMI User Password Via Test Command |
| 155 | [Documentation] Verify IPMI user password using test command. |
| 156 | [Tags] Verify_IPMI_User_Password_Via_Test_Command |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 157 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 158 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | c19f838 | 2019-02-20 08:19:22 -0600 | [diff] [blame] | 159 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 160 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 161 | Set Test Variable ${random_userid} |
Rahul Maheshwari | c19f838 | 2019-02-20 08:19:22 -0600 | [diff] [blame] | 162 | |
| 163 | # Set valid password for newly created user. |
| 164 | Run IPMI Standard Command |
| 165 | ... user set password ${random_userid} ${valid_password} |
| 166 | |
| 167 | # Verify newly set password using test command. |
| 168 | ${msg}= Run IPMI Standard Command |
| 169 | ... user test ${random_userid} ${max_password_length} ${valid_password} |
| 170 | |
| 171 | Should Contain ${msg} Success |
| 172 | |
| 173 | |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 174 | Verify Setting Valid Password For IPMI User |
| 175 | [Documentation] Set valid password for IPMI user and verify. |
| 176 | [Tags] Verify_Setting_Valid_Password_For_IPMI_User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 177 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 178 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 179 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 180 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 181 | Set Test Variable ${random_userid} |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 182 | |
| 183 | # Set valid password for newly created user. |
| 184 | Run IPMI Standard Command |
| 185 | ... user set password ${random_userid} ${valid_password} |
| 186 | |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 187 | Run IPMI Standard Command user enable ${random_userid} |
| 188 | |
Rahul Maheshwari | 7d232ab | 2019-08-29 06:44:16 -0500 | [diff] [blame] | 189 | # Delay added for IPMI user to get enable |
| 190 | Sleep 5s |
| 191 | |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 192 | # Set admin privilege and enable IPMI messaging for newly created user |
| 193 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 194 | |
| 195 | Verify IPMI Username And Password ${random_username} ${valid_password} |
| 196 | |
| 197 | |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 198 | Verify IPMI User Creation With Same Name |
| 199 | [Documentation] Verify error while creating two IPMI user with same name. |
| 200 | [Tags] Verify_IPMI_User_Creation_With_Same_Name |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 201 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 202 | ... Delete Created User 2 |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 203 | |
| 204 | ${random_username}= Generate Random String 8 [LETTERS] |
| 205 | IPMI Create User 2 ${random_username} |
| 206 | |
| 207 | # Set same username for another IPMI user. |
| 208 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 209 | ... user set name 3 ${random_username} |
| 210 | Should Contain ${msg} Invalid data field in request |
| 211 | |
| 212 | |
| 213 | Verify Setting IPMI User With Null Password |
| 214 | [Documentation] Verify error while setting IPMI user with null |
| 215 | ... password. |
| 216 | [Tags] Verify_Setting_IPMI_User_With_Null_Password |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 217 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 218 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 219 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 220 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 221 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 222 | |
| 223 | # Set null password for newly created user. |
| 224 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 225 | ... user set password ${random_userid} "" |
| 226 | |
| 227 | Should Contain ${msg} Invalid data field in request |
| 228 | |
| 229 | |
Rahul Maheshwari | 645a113 | 2019-02-18 03:29:27 -0600 | [diff] [blame] | 230 | Verify IPMI User Deletion |
| 231 | [Documentation] Delete user via IPMI and verify. |
| 232 | [Tags] Verify_IPMI_User_Deletion |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 233 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 234 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 645a113 | 2019-02-18 03:29:27 -0600 | [diff] [blame] | 235 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 236 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 237 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 645a113 | 2019-02-18 03:29:27 -0600 | [diff] [blame] | 238 | # Delete IPMI User and verify |
| 239 | Run IPMI Standard Command user set name ${random_userid} "" |
Rahul Maheshwari | 4f4688f | 2019-02-28 00:49:10 -0600 | [diff] [blame] | 240 | ${user_info}= Get User Info ${random_userid} |
Rahul Maheshwari | 645a113 | 2019-02-18 03:29:27 -0600 | [diff] [blame] | 241 | Should Be Equal ${user_info['user_name']} ${EMPTY} |
| 242 | |
| 243 | |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 244 | Test IPMI User Privilege Level |
| 245 | [Documentation] Verify IPMI user with user privilege can only run user level commands. |
| 246 | [Tags] Test_IPMI_User_Privilege_Level |
| 247 | [Template] Test IPMI User Privilege |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 248 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 249 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 250 | |
| 251 | #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status |
| 252 | ${user_priv} Passed Failed Failed |
| 253 | |
| 254 | |
| 255 | Test IPMI Operator Privilege Level |
| 256 | [Documentation] Verify IPMI user with operator privilege can only run user and operator levels commands. |
| 257 | ... level is set to operator. |
| 258 | [Tags] Test_IPMI_Operator_Privilege_Level |
| 259 | [Template] Test IPMI User Privilege |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 260 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 261 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 262 | |
| 263 | #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status |
| 264 | ${operator_priv} Passed Passed Failed |
| 265 | |
| 266 | |
| 267 | Test IPMI Administrator Privilege Level |
| 268 | [Documentation] Verify IPMI user with admin privilege can run all levels command. |
| 269 | [Tags] Test_IPMI_Administrator_Privilege_Level |
| 270 | [Template] Test IPMI User Privilege |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 271 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 272 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 273 | |
| 274 | #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status |
| 275 | ${admin_level_priv} Passed Passed Passed |
| 276 | |
| 277 | |
| 278 | Test IPMI No Access Privilege Level |
| 279 | [Documentation] Verify IPMI user with no access privilege can not run only any level command. |
| 280 | [Tags] Test_IPMI_No_Access_Privilege_Level |
| 281 | [Template] Test IPMI User Privilege |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 282 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 283 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 284 | |
| 285 | #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status |
| 286 | ${no_access_priv} Failed Failed Failed |
| 287 | |
| 288 | |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 289 | Enable IPMI User And Verify |
| 290 | [Documentation] Enable IPMI user and verify that the user is able |
| 291 | ... to run IPMI command. |
| 292 | [Tags] Enable_IPMI_User_And_Verify |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 293 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 294 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 295 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 296 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 297 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 298 | Run IPMI Standard Command |
| 299 | ... user set password ${random_userid} ${valid_password} |
| 300 | |
| 301 | # Set admin privilege and enable IPMI messaging for newly created user. |
| 302 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 303 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 304 | # Delay added for user privilege to get set. |
Rahul Maheshwari | 62c8aea | 2019-09-27 05:23:12 -0500 | [diff] [blame] | 305 | Sleep 5s |
| 306 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 307 | Enable IPMI User And Verify ${random_userid} |
Gene Ratzlaff | 3a3d5d5 | 2022-05-05 08:30:52 -0400 | [diff] [blame] | 308 | Wait And Confirm New Username And Password ${random_username} ${valid_password} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 309 | |
| 310 | # Verify that enabled IPMI user is able to run IPMI command. |
| 311 | Verify IPMI Username And Password ${random_username} ${valid_password} |
| 312 | |
| 313 | |
| 314 | Disable IPMI User And Verify |
| 315 | [Documentation] Disable IPMI user and verify that that the user |
| 316 | ... is unable to run IPMI command. |
| 317 | [Tags] Disable_IPMI_User_And_Verify |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 318 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 319 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 320 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 321 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 322 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 323 | Run IPMI Standard Command |
| 324 | ... user set password ${random_userid} ${valid_password} |
| 325 | |
| 326 | # Set admin privilege and enable IPMI messaging for newly created user. |
| 327 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 328 | |
| 329 | # Disable IPMI user and verify. |
| 330 | Run IPMI Standard Command user disable ${random_userid} |
| 331 | ${user_info}= Get User Info ${random_userid} |
| 332 | Should Be Equal ${user_info['enable_status']} disabled |
| 333 | |
| 334 | # Verify that disabled IPMI user is unable to run IPMI command. |
| 335 | ${msg}= Run Keyword And Expect Error * Verify IPMI Username And Password |
| 336 | ... ${random_username} ${valid_password} |
Rahul Maheshwari | c3d1e96 | 2019-03-06 23:53:21 -0600 | [diff] [blame] | 337 | Should Contain ${msg} Unable to establish IPMI |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 338 | |
Rahul Maheshwari | c19f838 | 2019-02-20 08:19:22 -0600 | [diff] [blame] | 339 | |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 340 | Verify IPMI Root User Password Change |
| 341 | [Documentation] Change IPMI root user password and verify that |
| 342 | ... root user is able to run IPMI command. |
| 343 | [Tags] Verify_IPMI_Root_User_Password_Change |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 344 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 345 | ... Wait Until Keyword Succeeds 15 sec 5 sec |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 346 | ... Set Default Password For IPMI Root User |
| 347 | |
Anusha Dathatri | 9f84bc8 | 2020-01-28 07:46:48 -0600 | [diff] [blame] | 348 | # User input password should be minimum 8 characters long. |
| 349 | Valid Length OPENBMC_PASSWORD min_length=8 |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 350 | # Set new password for root user. |
| 351 | Run IPMI Standard Command |
| 352 | ... user set password ${root_userid} ${valid_password} |
| 353 | |
Sushma M M | 97fccae | 2020-07-27 14:55:19 -0500 | [diff] [blame] | 354 | # Delay added for user password to get set. |
| 355 | Sleep 5s |
| 356 | |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 357 | # Verify that root user is able to run IPMI command using new password. |
Rahul Maheshwari | 62c8aea | 2019-09-27 05:23:12 -0500 | [diff] [blame] | 358 | Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password |
| 359 | ... root ${valid_password} |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 360 | |
| 361 | |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 362 | Verify Administrator And No Access Privilege For Different Channels |
| 363 | [Documentation] Set administrator and no access privilege for different channels and verify. |
| 364 | [Tags] Verify_Administrator_And_No_Access_Privilege_For_Different_Channels |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 365 | [Setup] Check Active Ethernet Channels |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 366 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 367 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 368 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 369 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 370 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 371 | Run IPMI Standard Command |
| 372 | ... user set password ${random_userid} ${valid_password} |
| 373 | |
| 374 | # Set admin privilege for newly created user with channel 1. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 375 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} ${CHANNEL_NUMBER} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 376 | |
| 377 | # Set no access privilege for newly created user with channel 2. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 378 | Set Channel Access ${random_userid} ipmi=on privilege=${no_access_priv} ${secondary_channel_number} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 379 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 380 | Enable IPMI User And Verify ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 381 | |
| 382 | # Verify that user is able to run administrator level IPMI command with channel 1. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 383 | Verify IPMI Command ${random_username} ${valid_password} Administrator ${CHANNEL_NUMBER} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 384 | |
| 385 | # Verify that user is unable to run IPMI command with channel 2. |
George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 386 | Run IPMI Standard Command |
| 387 | ... sel info ${secondary_channel_number} expected_rc=${1} U=${random_username} P=${valid_password} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 388 | |
| 389 | |
| 390 | Verify Operator And User Privilege For Different Channels |
| 391 | [Documentation] Set operator and user privilege for different channels and verify. |
| 392 | [Tags] Verify_Operator_And_User_Privilege_For_Different_Channels |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 393 | [Setup] Check Active Ethernet Channels |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 394 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 395 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 396 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 397 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 398 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 399 | Run IPMI Standard Command |
| 400 | ... user set password ${random_userid} ${valid_password} |
| 401 | |
| 402 | # Set operator privilege for newly created user with channel 1. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 403 | Set Channel Access ${random_userid} ipmi=on privilege=${operator_priv} ${CHANNEL_NUMBER} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 404 | |
| 405 | # Set user privilege for newly created user with channel 2. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 406 | Set Channel Access ${random_userid} ipmi=on privilege=${user_priv} ${secondary_channel_number} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 407 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 408 | Enable IPMI User And Verify ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 409 | |
| 410 | # Verify that user is able to run operator level IPMI command with channel 1. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 411 | Verify IPMI Command ${random_username} ${valid_password} Operator ${CHANNEL_NUMBER} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 412 | |
| 413 | # Verify that user is able to run user level IPMI command with channel 2. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 414 | Verify IPMI Command ${random_username} ${valid_password} User ${secondary_channel_number} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 415 | |
| 416 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 417 | Verify Setting IPMI User With Max Password Length |
| 418 | [Documentation] Verify IPMI user creation with password length of 20 characters. |
| 419 | [Tags] Verify_Setting_IPMI_User_With_Max_Password_Length |
| 420 | [Template] Set User Password And Verify |
| 421 | |
| 422 | # password_length password_option expected_status |
| 423 | 20 20 ${True} |
| 424 | |
| 425 | |
| 426 | Verify Setting IPMI User With Invalid Password Length |
| 427 | [Documentation] Verify that IPMI user cannot be set with 21 character password using 16 char |
| 428 | ... or 20 char password option. |
| 429 | [Tags] Verify_Setting_IPMI_User_With_Invalid_Password_Length |
| 430 | [Template] Set User Password And Verify |
| 431 | |
| 432 | # password_length password_option expected_status |
| 433 | 21 16 ${False} |
| 434 | 21 20 ${False} |
| 435 | |
| 436 | |
| 437 | Verify Setting IPMI User With 16 Character Password |
| 438 | [Documentation] Verify that IPMI user can create a 16 character password using 16 char or 20 |
| 439 | ... char password option. |
| 440 | [Tags] Verify_Setting_IPMI_User_With_16_Character_Password |
| 441 | [Template] Set User Password And Verify |
| 442 | |
| 443 | # password_length password_option expected_status |
| 444 | 16 16 ${True} |
| 445 | 16 20 ${True} |
| 446 | |
| 447 | |
| 448 | Verify Default Selection Of 16 Character Password For IPMI User |
| 449 | [Documentation] Verify that ipmitool by default opts for the 16 character option when given a |
| 450 | ... password whose length is in between 17 and 20. |
| 451 | [Tags] Verify_Default_Selection_Of_16_Character_Password_For_IPMI_User |
| 452 | [Template] Set User Password And Verify |
| 453 | |
| 454 | # password_length password_option expected_status |
| 455 | 17 16 ${True} |
| 456 | 20 16 ${True} |
| 457 | |
| 458 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 459 | Verify Minimum Password Length For IPMI User |
| 460 | [Documentation] Verify minimum password length of 8 characters. |
| 461 | [Tags] Verify_Minimum_Password_Length_For_IPMI_User |
| 462 | [Template] Set User Password And Verify |
| 463 | |
| 464 | # password_length password_option expected_status |
| 465 | 7 16 ${False} |
| 466 | 8 16 ${True} |
| 467 | 7 20 ${False} |
| 468 | 8 20 ${True} |
| 469 | |
| 470 | |
Ashwini Chandrappa | 5cefabf | 2021-08-30 23:48:14 -0500 | [diff] [blame] | 471 | Verify Continuous IPMI Command Execution |
| 472 | [Documentation] Verify that continuous IPMI command execution runs fine. |
| 473 | [Tags] Verify_Continuous_IPMI_Command_Execution |
| 474 | |
| 475 | FOR ${i} IN RANGE ${USER_LOOP_COUNT} |
| 476 | Run IPMI Standard Command lan print |
| 477 | Run IPMI Standard Command power status |
| 478 | Run IPMI Standard Command fru list |
| 479 | Run IPMI Standard Command sel list |
| 480 | END |
| 481 | |
| 482 | |
chithrag | c0582f7 | 2021-12-08 10:34:23 -0500 | [diff] [blame] | 483 | Modify IPMI User |
| 484 | [Documentation] Verify modified IPMI user is communicating via IPMI. |
| 485 | [Tags] Modify_IPMI_User |
| 486 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 487 | ... Delete Created User ${random_userid} |
| 488 | |
| 489 | ${random_userid} ${random_username}= Create Random IPMI User |
| 490 | Set Test Variable ${random_userid} |
| 491 | Run IPMI Standard Command |
| 492 | ... user set password ${random_userid} ${valid_password} |
| 493 | |
| 494 | # Set admin privilege and enable IPMI messaging for newly created user. |
| 495 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 496 | |
| 497 | # Delay added for user privilege to get set. |
| 498 | Sleep 5s |
| 499 | |
| 500 | Enable IPMI User And Verify ${random_userid} |
| 501 | |
| 502 | # Verify that user is able to run administrator level IPMI command. |
| 503 | Verify IPMI Command ${random_username} ${valid_password} Administrator ${CHANNEL_NUMBER} |
| 504 | |
| 505 | # Set different username for same IPMI user. |
| 506 | Run IPMI Standard Command |
| 507 | ... user set name ${random_userid} ${new_username} |
Gene Ratzlaff | 3a3d5d5 | 2022-05-05 08:30:52 -0400 | [diff] [blame] | 508 | Wait And Confirm New Username And Password ${new_username} ${valid_password} |
chithrag | c0582f7 | 2021-12-08 10:34:23 -0500 | [diff] [blame] | 509 | |
| 510 | # Verify that user is able to run administrator level IPMI command. |
| 511 | Verify IPMI Command ${new_username} ${valid_password} Administrator ${CHANNEL_NUMBER} |
| 512 | |
| 513 | |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 514 | *** Keywords *** |
| 515 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 516 | Create Random IPMI User |
| 517 | [Documentation] Create IPMI user with random username and userid and return those fields. |
| 518 | |
| 519 | ${random_username}= Generate Random String 8 [LETTERS] |
| 520 | ${random_userid}= Evaluate random.randint(2, 15) modules=random |
| 521 | IPMI Create User ${random_userid} ${random_username} |
| 522 | [Return] ${random_userid} ${random_username} |
| 523 | |
| 524 | |
| 525 | Enable IPMI User And Verify |
| 526 | [Documentation] Enable the userid and verify that it has been enabled. |
| 527 | [Arguments] ${userid} |
| 528 | |
| 529 | # Description of argument(s): |
| 530 | # userid A numeric userid (e.g. "4"). |
| 531 | |
| 532 | Run IPMI Standard Command user enable ${userid} |
| 533 | ${user_info}= Get User Info ${userid} |
| 534 | Valid Value user_info['enable_status'] ['enabled'] |
| 535 | |
| 536 | |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 537 | Set Default Password For IPMI Root User |
| 538 | [Documentation] Set default password for IPMI root user (i.e. 0penBmc). |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 539 | # Set default password for root user. |
| 540 | ${result}= Run External IPMI Standard Command |
| 541 | ... user set password ${root_userid} ${OPENBMC_PASSWORD} |
| 542 | ... P=${valid_password} |
| 543 | Should Contain ${result} Set User Password command successful |
| 544 | |
| 545 | # Verify that root user is able to run IPMI command using default password. |
| 546 | Verify IPMI Username And Password root ${OPENBMC_PASSWORD} |
| 547 | |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 548 | |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 549 | Test IPMI User Privilege |
| 550 | [Documentation] Test IPMI user privilege by executing IPMI command with different privileges. |
| 551 | [Arguments] ${privilege_level} ${user_cmd_status} ${operator_cmd_status} ${admin_cmd_status} |
| 552 | |
| 553 | # Description of argument(s): |
| 554 | # privilege_level Privilege level of IPMI user (e.g. 4, 3). |
| 555 | # user_cmd_status Expected status of IPMI command run with the "User" |
| 556 | # privilege (i.e. "Passed" or "Failed"). |
| 557 | # operator_cmd_status Expected status of IPMI command run with the "Operator" |
| 558 | # privilege (i.e. "Passed" or "Failed"). |
| 559 | # admin_cmd_status Expected status of IPMI command run with the "Administrator" |
| 560 | # privilege (i.e. "Passed" or "Failed"). |
| 561 | |
| 562 | # Create IPMI user and set valid password. |
| 563 | ${random_username}= Generate Random String 8 [LETTERS] |
| 564 | ${random_userid}= Evaluate random.randint(2, 15) modules=random |
| 565 | IPMI Create User ${random_userid} ${random_username} |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 566 | Set Test Variable ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 567 | Run IPMI Standard Command |
| 568 | ... user set password ${random_userid} ${valid_password} |
| 569 | |
| 570 | # Set privilege and enable IPMI messaging for newly created user. |
| 571 | Set Channel Access ${random_userid} ipmi=on privilege=${privilege_level} |
| 572 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 573 | # Delay added for user privilege to get set. |
Rahul Maheshwari | 62c8aea | 2019-09-27 05:23:12 -0500 | [diff] [blame] | 574 | Sleep 5s |
| 575 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 576 | Enable IPMI User And Verify ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 577 | |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 578 | Verify IPMI Command ${random_username} ${valid_password} User |
| 579 | ... expected_status=${user_cmd_status} |
| 580 | Verify IPMI Command ${random_username} ${valid_password} Operator |
| 581 | ... expected_status=${operator_cmd_status} |
| 582 | Verify IPMI Command ${random_username} ${valid_password} Administrator |
| 583 | ... expected_status=${admin_cmd_status} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 584 | |
| 585 | |
| 586 | Verify IPMI Command |
| 587 | [Documentation] Verify IPMI command execution with given username, |
| 588 | ... password, privilege and expected status. |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 589 | [Arguments] ${username} ${password} ${privilege} ${channel}=${1} ${expected_status}=Passed |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 590 | # Description of argument(s): |
| 591 | # username The user name (e.g. "root", "robert", etc.). |
| 592 | # password The user password (e.g. "0penBmc", "0penBmc1", etc.). |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 593 | # privilege The session privilege for IPMI command (e.g. "User", "Operator", etc.). |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 594 | # channel The user channel number (e.g. "1" or "2"). |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 595 | # expected_status Expected status of IPMI command run with the user |
| 596 | # of above password and privilege (i.e. "Passed" or "Failed"). |
| 597 | |
| 598 | ${expected_rc}= Set Variable If '${expected_status}' == 'Passed' ${0} ${1} |
Rahul Maheshwari | ceb282e | 2019-09-16 00:11:41 -0500 | [diff] [blame] | 599 | Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command |
| 600 | ... sel info ${channel} expected_rc=${expected_rc} U=${username} P=${password} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 601 | ... L=${privilege} |
| 602 | |
| 603 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 604 | Set User Password And Verify |
| 605 | [Documentation] Create a user and set its password with given length and option. |
| 606 | [Arguments] ${password_length} ${password_option} ${expected_result} |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 607 | [Teardown] Run Keyword Delete Created User ${random_userid} |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 608 | # Description of argument(s): |
| 609 | # password_length Length of password to be generated and used (e.g. "16"). |
| 610 | # password_option Password length option to be given in IPMI command (e.g. "16", "20"). |
| 611 | # expected_result Expected result for setting the user's password (e.g. "True", "False"). |
| 612 | |
| 613 | Rprint Vars password_length password_option expected_result |
| 614 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 615 | Set Test Variable ${random_userid} |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 616 | ${password}= Get From Dictionary ${password_values} ${password_length} |
| 617 | Rprint Vars random_userid password |
| 618 | |
| 619 | # Set password for newly created user. |
| 620 | ${status}= Run Keyword And Return Status Run IPMI Standard Command |
| 621 | ... user set password ${random_userid} ${password} ${password_option} |
| 622 | Rprint Vars status |
| 623 | Valid Value status [${expected_result}] |
Anusha Dathatri | 7f81071 | 2020-01-07 04:13:16 -0600 | [diff] [blame] | 624 | Return From Keyword If '${expected_result}' == '${False}' |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 625 | |
| 626 | # Set admin privilege and enable IPMI messaging for newly created user. |
| 627 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 628 | |
| 629 | # Delay added for user privilege to get set. |
| 630 | Sleep 5s |
| 631 | |
| 632 | Enable IPMI User And Verify ${random_userid} |
| 633 | |
| 634 | # For password_option 16, passwords with length between 17 and 20 will be truncated. |
| 635 | # For all other cases, passwords will be retained as it is to verify. |
| 636 | ${truncated_password}= Set Variable ${password[:${password_option}]} |
| 637 | Rprint Vars truncated_password |
| 638 | ${status}= Run Keyword And Return Status Verify IPMI Username And Password ${random_username} |
| 639 | ... ${truncated_password} |
| 640 | Rprint Vars status |
| 641 | Valid Value status [${expected_result}] |
| 642 | |
| 643 | |
Rahul Maheshwari | f646baa | 2019-02-20 12:29:35 -0600 | [diff] [blame] | 644 | Test Teardown Execution |
| 645 | [Documentation] Do the test teardown execution. |
| 646 | |
| 647 | FFDC On Test Case Fail |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 648 | |
| 649 | |
| 650 | Delete Created User |
| 651 | [Documentation] Delete created IPMI user. |
| 652 | [Arguments] ${userid} |
| 653 | # Description of argument(s): |
| 654 | # userid The user ID (e.g. "1", "2", etc.). |
| 655 | |
| 656 | Run IPMI Standard Command user set name ${userid} "" |
Ashwini Chandrappa | 5cefabf | 2021-08-30 23:48:14 -0500 | [diff] [blame] | 657 | Sleep 5s |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 658 | |
| 659 | |
| 660 | Check Active Ethernet Channels |
| 661 | [Documentation] Check active ethernet channels and set suite variables. |
| 662 | |
| 663 | ${channel_number_list}= Get Active Ethernet Channel List |
| 664 | ${channel_length}= Get Length ${channel_number_list} |
| 665 | Skip If '${channel_length}' == '1' |
| 666 | ... msg= Skips this test case as only one channel was in active. |
| 667 | |
| 668 | FOR ${channel_num} IN @{channel_number_list} |
| 669 | ${secondary_channel_number}= Set Variable If ${channel_num} != ${CHANNEL_NUMBER} ${channel_num} |
| 670 | END |
| 671 | |
| 672 | Set Suite Variable ${secondary_channel_number} |
Ashwini Chandrappa | 12be4b4 | 2022-03-15 23:02:07 -0500 | [diff] [blame] | 673 | |
| 674 | |
| 675 | Suite Setup Execution |
| 676 | [Documentation] Check for the enabled user. |
| 677 | |
| 678 | # Check for the enabled user count |
| 679 | ${resp}= Run IPMI Standard Command user summary ${CHANNEL_NUMBER} |
| 680 | ${enabled_user_count}= |
| 681 | ... Get Lines Containing String ${resp} Enabled User Count |
| 682 | |
| 683 | Should not contain ${enabled_user_count} 15 |
| 684 | ... msg=IPMI have reached maximum user count |
George Keishing | 5e9fbbf | 2022-04-29 03:48:14 -0500 | [diff] [blame] | 685 | |
| 686 | |
Gene Ratzlaff | 3a3d5d5 | 2022-05-05 08:30:52 -0400 | [diff] [blame] | 687 | Wait And Confirm New Username And Password |
George Keishing | 5e9fbbf | 2022-04-29 03:48:14 -0500 | [diff] [blame] | 688 | [Documentation] Wait in loop trying to to confirm Username And Password. |
| 689 | [Arguments] ${username} ${password} |
| 690 | |
| 691 | # Give time for previous command to complete. |
| 692 | Sleep 5s |
| 693 | |
| 694 | # Looping verify that root user is able to run IPMI command using new password. |
| 695 | Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password |
| 696 | ... ${username} ${password} |