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