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 |
| 22 | [Documentation] Create Redfish users with various roles |
| 23 | [Tags] Redfish_Create_and_Verify_Users |
| 24 | [Template] Redfish Create And Verify User |
| 25 | |
| 26 | # username password role_id enabled |
| 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 |
| 33 | [Documentation] Verify Redfish User with Wrong Password |
| 34 | [Tags] Verify_Redfish_User_with_Wrong_Password |
| 35 | [Template] Verify Redfish User with Wrong Password |
| 36 | |
| 37 | # username password role_id enabled wrong_password |
| 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 |
| 42 | |
| 43 | |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 44 | *** Keywords *** |
| 45 | |
| 46 | Test Setup Execution |
| 47 | [Documentation] Do test case setup tasks. |
| 48 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 49 | Redfish.Login |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 50 | |
| 51 | |
| 52 | Test Teardown Execution |
| 53 | [Documentation] Do the post test teardown. |
| 54 | |
| 55 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 56 | Redfish.Logout |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 57 | |
| 58 | Redfish Create And Verify User |
| 59 | [Documentation] Redfish create and verify user. |
| 60 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 61 | |
| 62 | # Description of argument(s): |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 63 | # username The username to be created. |
| 64 | # password The password to be assigned. |
| 65 | # role_id The role id of the user to be created. |
| 66 | # enabled The decision if it should be enabled. |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 67 | |
| 68 | # Example: |
| 69 | #{ |
| 70 | #"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount", |
| 71 | #"@odata.id": "/redfish/v1/AccountService/Accounts/test1", |
| 72 | #"@odata.type": "#ManagerAccount.v1_0_3.ManagerAccount", |
| 73 | #"Description": "User Account", |
| 74 | #"Enabled": true, |
| 75 | #"Id": "test1", |
| 76 | #"Links": { |
| 77 | # "Role": { |
| 78 | # "@odata.id": "/redfish/v1/AccountService/Roles/Administrator" |
| 79 | # } |
| 80 | #}, |
| 81 | |
| 82 | # Delete if the user exist. |
| 83 | Run Keyword And Ignore Error |
| 84 | ... Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
| 85 | |
| 86 | # Create specified user. |
| 87 | ${payload}= Create Dictionary |
| 88 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
| 89 | Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload} |
| 90 | ... valid_status_codes=[${HTTP_CREATED}] |
| 91 | |
| 92 | Redfish.Logout |
| 93 | |
| 94 | # Login with created user. |
| 95 | Redfish.Login ${username} ${password} |
| 96 | |
| 97 | # Validate Role Id of created user. |
| 98 | ${role_config}= Redfish_Utils.Get Attribute |
| 99 | ... /redfish/v1/AccountService/Accounts/${userName} RoleId |
| 100 | Should Be Equal ${role_id} ${role_config} |
| 101 | |
| 102 | Redfish.Get /redfish/v1/AccountService/Accounts/${userName} |
| 103 | |
| 104 | # Delete Specified User |
| 105 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 106 | |
| 107 | Verify Redfish User with Wrong Password |
| 108 | [Documentation] Verify Redfish User with Wrong Password |
| 109 | [Arguments] ${username} ${password} ${role_id} ${enabled} ${wrong_password} |
| 110 | |
| 111 | # Description of argument(s): |
| 112 | # username The username to be created. |
| 113 | # password The password to be assigned. |
| 114 | # role_id The role id of the user to be created. |
| 115 | # enabled The decision if it should be enabled. |
| 116 | # wrong_password Any invalid password. |
| 117 | |
| 118 | # Delete if the user exist. |
| 119 | Run Keyword And Ignore Error |
| 120 | ... Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
| 121 | |
| 122 | # Create specified user. |
| 123 | ${payload}= Create Dictionary |
| 124 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
| 125 | Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload} |
| 126 | ... valid_status_codes=[${HTTP_CREATED}] |
| 127 | |
| 128 | Redfish.Logout |
| 129 | |
| 130 | # Login with created user. |
| 131 | Redfish.Login ${username} ${password} |
| 132 | |
| 133 | Redfish.Logout |
| 134 | |
| 135 | # Attempt to login with created user with invalid password. |
| 136 | Run Keyword And Expect Error InvalidCredentialsError* |
| 137 | ... Redfish.Login ${username} ${wrong_password} |
| 138 | |
| 139 | Redfish.Login |
| 140 | |
| 141 | # Delete newly created user. |
| 142 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
| 143 | |
| 144 | |