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