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