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 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 43 | Verify Login with Deleted Redfish Users |
| 44 | [Documentation] Verify login with deleted Redfish Users |
| 45 | [Tags] Verify_Login_with_Deleted_Redfish_Users |
| 46 | [Template] Verify Login with Deleted Redfish User |
| 47 | |
| 48 | # username password role_id enabled |
| 49 | admin_user TestPwd123 Administrator ${True} |
| 50 | operator_user TestPwd123 Operator ${True} |
| 51 | user_user TestPwd123 User ${True} |
| 52 | callback_user TestPwd123 Callback ${True} |
| 53 | |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 54 | |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 55 | *** Keywords *** |
| 56 | |
| 57 | Test Setup Execution |
| 58 | [Documentation] Do test case setup tasks. |
| 59 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 60 | Redfish.Login |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 61 | |
| 62 | |
| 63 | Test Teardown Execution |
| 64 | [Documentation] Do the post test teardown. |
| 65 | |
| 66 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 67 | Redfish.Logout |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 68 | |
| 69 | Redfish Create And Verify User |
| 70 | [Documentation] Redfish create and verify user. |
| 71 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 72 | |
| 73 | # Description of argument(s): |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 74 | # username The username to be created. |
| 75 | # password The password to be assigned. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 76 | # role_id The role id of the user to be created |
| 77 | # (e.g. "Administrator", "Operator", etc.). |
| 78 | # enabled Indicates whether the username being created |
| 79 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 80 | |
| 81 | # Example: |
| 82 | #{ |
| 83 | #"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount", |
| 84 | #"@odata.id": "/redfish/v1/AccountService/Accounts/test1", |
| 85 | #"@odata.type": "#ManagerAccount.v1_0_3.ManagerAccount", |
| 86 | #"Description": "User Account", |
| 87 | #"Enabled": true, |
| 88 | #"Id": "test1", |
| 89 | #"Links": { |
| 90 | # "Role": { |
| 91 | # "@odata.id": "/redfish/v1/AccountService/Roles/Administrator" |
| 92 | # } |
| 93 | #}, |
| 94 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 95 | # Make sure the user account in question does not already exist. |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 96 | Run Keyword And Ignore Error |
| 97 | ... Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
| 98 | |
| 99 | # Create specified user. |
| 100 | ${payload}= Create Dictionary |
| 101 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
| 102 | Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload} |
| 103 | ... valid_status_codes=[${HTTP_CREATED}] |
| 104 | |
| 105 | Redfish.Logout |
| 106 | |
| 107 | # Login with created user. |
| 108 | Redfish.Login ${username} ${password} |
| 109 | |
| 110 | # Validate Role Id of created user. |
| 111 | ${role_config}= Redfish_Utils.Get Attribute |
| 112 | ... /redfish/v1/AccountService/Accounts/${userName} RoleId |
| 113 | Should Be Equal ${role_id} ${role_config} |
| 114 | |
| 115 | Redfish.Get /redfish/v1/AccountService/Accounts/${userName} |
| 116 | |
| 117 | # Delete Specified User |
| 118 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 119 | |
| 120 | Verify Redfish User with Wrong Password |
| 121 | [Documentation] Verify Redfish User with Wrong Password |
| 122 | [Arguments] ${username} ${password} ${role_id} ${enabled} ${wrong_password} |
| 123 | |
| 124 | # Description of argument(s): |
| 125 | # username The username to be created. |
| 126 | # password The password to be assigned. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 127 | # role_id The role id of the user to be created |
| 128 | # (e.g. "Administrator", "Operator", etc.). |
| 129 | # enabled Indicates whether the username being created |
| 130 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 131 | # wrong_password Any invalid password. |
| 132 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 133 | # Make sure the user account in question does not already exist. |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 134 | Run Keyword And Ignore Error |
| 135 | ... Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
| 136 | |
| 137 | # Create specified user. |
| 138 | ${payload}= Create Dictionary |
| 139 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
| 140 | Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload} |
| 141 | ... valid_status_codes=[${HTTP_CREATED}] |
| 142 | |
| 143 | Redfish.Logout |
| 144 | |
| 145 | # Login with created user. |
| 146 | Redfish.Login ${username} ${password} |
| 147 | |
| 148 | Redfish.Logout |
| 149 | |
| 150 | # Attempt to login with created user with invalid password. |
| 151 | Run Keyword And Expect Error InvalidCredentialsError* |
| 152 | ... Redfish.Login ${username} ${wrong_password} |
| 153 | |
| 154 | Redfish.Login |
| 155 | |
| 156 | # Delete newly created user. |
| 157 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
| 158 | |
| 159 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 160 | Verify Login with Deleted Redfish User |
| 161 | [Documentation] Verify Login with Deleted Redfish User |
| 162 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 163 | |
| 164 | # Description of argument(s): |
| 165 | # username The username to be created. |
| 166 | # password The password to be assigned. |
| 167 | # role_id The role id of the user to be created |
| 168 | # (e.g. "Administrator", "Operator", etc.). |
| 169 | # enabled Indicates whether the username being created |
| 170 | # should be enabled (${True}, ${False}). |
| 171 | |
| 172 | # Make sure the user account in question does not already exist. |
| 173 | Run Keyword And Ignore Error |
| 174 | ... Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
| 175 | |
| 176 | Redfish.Login |
| 177 | |
| 178 | # Create specified user. |
| 179 | ${payload}= Create Dictionary |
| 180 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
| 181 | Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload} |
| 182 | ... valid_status_codes=[${HTTP_CREATED}] |
| 183 | |
| 184 | Redfish.Logout |
| 185 | |
| 186 | # Login with created user. |
| 187 | Redfish.Login ${username} ${password} |
| 188 | |
| 189 | Redfish.Logout |
| 190 | |
| 191 | Redfish.Login |
| 192 | |
| 193 | # Delete newly created user. |
| 194 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
| 195 | |
| 196 | # Attempt to login with deleted user account. |
| 197 | Run Keyword And Expect Error InvalidCredentialsError* |
| 198 | ... Redfish.Login ${username} ${password} |