Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test Redfish user account. |
| 3 | |
| 4 | Resource ../../lib/resource.robot |
| 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | |
| 8 | Test Setup Test Setup Execution |
| 9 | Test Teardown Test Teardown Execution |
| 10 | |
| 11 | |
| 12 | ** Test Cases ** |
| 13 | |
| 14 | Verify AccountService Available |
Sivas SRR | fa6831c | 2019-02-22 00:12:00 -0600 | [diff] [blame] | 15 | [Documentation] Verify Redfish account service is available. |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 16 | [Tags] Verify_AccountService_Available |
| 17 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 18 | ${resp} = Redfish_utils.Get Attribute /redfish/v1/AccountService ServiceEnabled |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 19 | Should Be Equal As Strings ${resp} ${True} |
| 20 | |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 21 | Redfish Create and Verify Users |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 22 | [Documentation] Create Redfish users with various roles. |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 23 | [Tags] Redfish_Create_and_Verify_Users |
| 24 | [Template] Redfish Create And Verify User |
| 25 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 26 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 27 | admin_user TestPwd123 Administrator ${True} |
| 28 | operator_user TestPwd123 Operator ${True} |
| 29 | user_user TestPwd123 User ${True} |
| 30 | callback_user TestPwd123 Callback ${True} |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 31 | |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 32 | Verify Redfish User with Wrong Password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 33 | [Documentation] Verify Redfish User with Wrong Password. |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 34 | [Tags] Verify_Redfish_User_with_Wrong_Password |
| 35 | [Template] Verify Redfish User with Wrong Password |
| 36 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 37 | #username password role_id enabled wrong_password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 38 | admin_user TestPwd123 Administrator ${True} alskjhfwurh |
| 39 | operator_user TestPwd123 Operator ${True} 12j8a8uakjhdaosiruf024 |
| 40 | user_user TestPwd123 User ${True} 12 |
| 41 | callback_user TestPwd123 Callback ${True} !#@D#RF#@!D |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 42 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 43 | Verify Login with Deleted Redfish Users |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 44 | [Documentation] Verify login with deleted Redfish Users. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 45 | [Tags] Verify_Login_with_Deleted_Redfish_Users |
| 46 | [Template] Verify Login with Deleted Redfish User |
| 47 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 48 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 49 | admin_user TestPwd123 Administrator ${True} |
| 50 | operator_user TestPwd123 Operator ${True} |
| 51 | user_user TestPwd123 User ${True} |
| 52 | callback_user TestPwd123 Callback ${True} |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 53 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 54 | Verify User Creation Without Enabling it |
| 55 | [Documentation] Verify User Creation Without Enabling it. |
| 56 | [Tags] Verify_User_Creation_Without_Enabling_it |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 57 | [Template] Verify Create User Without Enabling |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 58 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 59 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 60 | admin_user TestPwd123 Administrator ${False} |
| 61 | operator_user TestPwd123 Operator ${False} |
| 62 | user_user TestPwd123 User ${False} |
| 63 | callback_user TestPwd123 Callback ${False} |
| 64 | |
| 65 | Verify Redfish User Persistence After Reboot |
| 66 | [Documentation] Verify Redfish user persistence after reboot. |
| 67 | [Tags] Verify_Redfish_User_Persistence_After_Reboot |
| 68 | |
| 69 | # Create Redfish users. |
| 70 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 71 | Redfish Create User operator_user TestPwd123 Operator ${True} |
| 72 | Redfish Create User user_user TestPwd123 User ${True} |
| 73 | Redfish Create User callback_user TestPwd123 Callback ${True} |
| 74 | |
| 75 | # Reboot BMC. |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 76 | Redfish OBMC Reboot (off) stack_mode=normal |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 77 | |
| 78 | # Verify users after reboot. |
| 79 | Redfish Verify User admin_user TestPwd123 Administrator ${True} |
| 80 | Redfish Verify User operator_user TestPwd123 Operator ${True} |
| 81 | Redfish Verify User user_user TestPwd123 User ${True} |
| 82 | Redfish Verify User callback_user TestPwd123 Callback ${True} |
| 83 | |
| 84 | # Delete created users. |
| 85 | Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
| 86 | Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user |
| 87 | Redfish.Delete /redfish/v1/AccountService/Accounts/user_user |
| 88 | Redfish.Delete /redfish/v1/AccountService/Accounts/callback_user |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 89 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 90 | Verify User Creation With Invalid Role Id |
| 91 | [Documentation] Verify user creation with invalid role id. |
| 92 | [Tags] Verify_User_Creation_With_Invalid_Role_Id |
| 93 | |
| 94 | # Make sure the user account in question does not already exist. |
| 95 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}test_user |
| 96 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 97 | |
| 98 | # Create specified user. |
| 99 | ${payload}= Create Dictionary |
| 100 | ... UserName=test_user Password=TestPwd123 RoleId=wrongroleid Enabled=${True} |
| 101 | Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload} |
| 102 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 103 | |
| 104 | |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 105 | *** Keywords *** |
| 106 | |
| 107 | Test Setup Execution |
| 108 | [Documentation] Do test case setup tasks. |
| 109 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 110 | Redfish.Login |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 111 | |
| 112 | |
| 113 | Test Teardown Execution |
| 114 | [Documentation] Do the post test teardown. |
| 115 | |
| 116 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 117 | Redfish.Logout |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 118 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 119 | Redfish Create User |
| 120 | [Documentation] Redfish create user. |
| 121 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 122 | |
| 123 | # Description of argument(s): |
| 124 | # username The username to be created. |
| 125 | # password The password to be assigned. |
| 126 | # role_id The role id of the user to be created |
| 127 | # (e.g. "Administrator", "Operator", etc.). |
| 128 | # enabled Indicates whether the username being created |
| 129 | # should be enabled (${True}, ${False}). |
| 130 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 131 | # Make sure the user account in question does not already exist. |
| 132 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}${userName} |
| 133 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 134 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 135 | # Create specified user. |
| 136 | ${payload}= Create Dictionary |
| 137 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 138 | Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 139 | ... valid_status_codes=[${HTTP_CREATED}] |
| 140 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 141 | Redfish.Logout |
| 142 | |
| 143 | # Login with created user. |
| 144 | Run Keyword If ${enabled} == False |
| 145 | ... Run Keyword And Expect Error InvalidCredentialsError* |
| 146 | ... Redfish.Login ${username} ${password} |
| 147 | ... ELSE |
| 148 | ... Redfish.Login ${username} ${password} |
| 149 | |
| 150 | Run Keyword If ${enabled} == False |
| 151 | ... Redfish.Login |
| 152 | |
| 153 | # Validate Role Id of created user. |
| 154 | ${role_config}= Redfish_Utils.Get Attribute |
| 155 | ... /redfish/v1/AccountService/Accounts/${username} RoleId |
| 156 | Should Be Equal ${role_id} ${role_config} |
| 157 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 158 | |
| 159 | Redfish Verify User |
| 160 | [Documentation] Redfish user verification. |
| 161 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 162 | |
| 163 | # Description of argument(s): |
| 164 | # username The username to be created. |
| 165 | # password The password to be assigned. |
| 166 | # role_id The role id of the user to be created |
| 167 | # (e.g. "Administrator", "Operator", etc.). |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 168 | # enabled Indicates whether the username being created |
| 169 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 170 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 171 | # Trying to do a login with created user. |
| 172 | ${status}= Run Keyword And Return Status Redfish.Login ${username} ${password} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 173 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 174 | # Doing a check of the returned status. |
| 175 | Should Be Equal ${status} ${enabled} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 176 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 177 | # We do not need to login with created user (user could be in disabled status). |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 178 | Redfish.Login |
| 179 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 180 | # Validate Role Id of user. |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 181 | ${role_config}= Redfish_Utils.Get Attribute |
| 182 | ... /redfish/v1/AccountService/Accounts/${username} RoleId |
| 183 | Should Be Equal ${role_id} ${role_config} |
| 184 | |
| 185 | |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 186 | Redfish Create And Verify User |
| 187 | [Documentation] Redfish create and verify user. |
| 188 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 189 | |
| 190 | # Description of argument(s): |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 191 | # username The username to be created. |
| 192 | # password The password to be assigned. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 193 | # role_id The role id of the user to be created |
| 194 | # (e.g. "Administrator", "Operator", etc.). |
| 195 | # enabled Indicates whether the username being created |
| 196 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 197 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 198 | # Example: |
| 199 | #{ |
| 200 | #"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount", |
| 201 | #"@odata.id": "/redfish/v1/AccountService/Accounts/test1", |
| 202 | #"@odata.type": "#ManagerAccount.v1_0_3.ManagerAccount", |
| 203 | #"Description": "User Account", |
| 204 | #"Enabled": true, |
| 205 | #"Id": "test1", |
| 206 | #"Links": { |
| 207 | # "Role": { |
| 208 | # "@odata.id": "/redfish/v1/AccountService/Roles/Administrator" |
| 209 | # } |
| 210 | #}, |
| 211 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 212 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 213 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 214 | Redfish Verify User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 215 | |
| 216 | # Delete Specified User |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 217 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |
| 218 | |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 219 | Verify Redfish User with Wrong Password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 220 | [Documentation] Verify Redfish User with Wrong Password. |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 221 | [Arguments] ${username} ${password} ${role_id} ${enabled} ${wrong_password} |
| 222 | |
| 223 | # Description of argument(s): |
| 224 | # username The username to be created. |
| 225 | # password The password to be assigned. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 226 | # role_id The role id of the user to be created |
| 227 | # (e.g. "Administrator", "Operator", etc.). |
| 228 | # enabled Indicates whether the username being created |
| 229 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 230 | # wrong_password Any invalid password. |
| 231 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 232 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 233 | |
| 234 | # Attempt to login with created user with invalid password. |
| 235 | Run Keyword And Expect Error InvalidCredentialsError* |
| 236 | ... Redfish.Login ${username} ${wrong_password} |
| 237 | |
| 238 | Redfish.Login |
| 239 | |
| 240 | # Delete newly created user. |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 241 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}${username} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 242 | |
| 243 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 244 | Verify Login with Deleted Redfish User |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 245 | [Documentation] Verify Login with Deleted Redfish User. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 246 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 247 | |
| 248 | # Description of argument(s): |
| 249 | # username The username to be created. |
| 250 | # password The password to be assigned. |
| 251 | # role_id The role id of the user to be created |
| 252 | # (e.g. "Administrator", "Operator", etc.). |
| 253 | # enabled Indicates whether the username being created |
| 254 | # should be enabled (${True}, ${False}). |
| 255 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 256 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 257 | ${status}= Run Keyword And Return Status Redfish.Login ${username} ${password} |
| 258 | |
| 259 | # Doing a check of the rerurned status |
| 260 | Should Be Equal ${status} ${True} |
| 261 | |
| 262 | Redfish.Login |
| 263 | |
| 264 | # Delete newly created user. |
| 265 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}${userName} |
| 266 | |
| 267 | # Attempt to login with deleted user account. |
| 268 | Run Keyword And Expect Error InvalidCredentialsError* |
| 269 | ... Redfish.Login ${username} ${password} |
| 270 | |
| 271 | Redfish.Login |
| 272 | |
| 273 | Verify Create User Without Enabling |
| 274 | [Documentation] Verify Create User Without Enabling. |
| 275 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 276 | |
| 277 | # Description of argument(s): |
| 278 | # username The username to be created. |
| 279 | # password The password to be assigned. |
| 280 | # role_id The role id of the user to be created |
| 281 | # (e.g. "Administrator", "Operator", etc.). |
| 282 | # enabled Indicates whether the username being created |
| 283 | # should be enabled (${True}, ${False}). |
| 284 | |
| 285 | Redfish.Login |
| 286 | |
| 287 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
| 288 | |
| 289 | Redfish.Logout |
| 290 | |
| 291 | # Login with created user. |
| 292 | Run Keyword And Expect Error InvalidCredentialsError* |
| 293 | ... Redfish.Login ${username} ${password} |
| 294 | |
| 295 | Redfish.Login |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 296 | |
| 297 | # Delete newly created user. |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 298 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |