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