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 | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 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 |
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 | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 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 |
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 | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 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} |
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 |
| 57 | [Template] Redfish Create And Verify User |
| 58 | |
| 59 | # username password role_id enabled |
| 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. |
| 76 | Redfish OBMC Reboot (off) |
| 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 | |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 90 | *** Keywords *** |
| 91 | |
| 92 | Test Setup Execution |
| 93 | [Documentation] Do test case setup tasks. |
| 94 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 95 | Redfish.Login |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 96 | |
| 97 | |
| 98 | Test Teardown Execution |
| 99 | [Documentation] Do the post test teardown. |
| 100 | |
| 101 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 102 | Redfish.Logout |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 103 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 104 | Redfish Create User |
| 105 | [Documentation] Redfish create user. |
| 106 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 107 | |
| 108 | # Description of argument(s): |
| 109 | # username The username to be created. |
| 110 | # password The password to be assigned. |
| 111 | # role_id The role id of the user to be created |
| 112 | # (e.g. "Administrator", "Operator", etc.). |
| 113 | # enabled Indicates whether the username being created |
| 114 | # should be enabled (${True}, ${False}). |
| 115 | |
| 116 | # Create specified user. |
| 117 | ${payload}= Create Dictionary |
| 118 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
| 119 | Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload} |
| 120 | ... valid_status_codes=[${HTTP_CREATED}] |
| 121 | |
| 122 | |
| 123 | Redfish Verify User |
| 124 | [Documentation] Redfish user verification. |
| 125 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 126 | |
| 127 | # Description of argument(s): |
| 128 | # username The username to be created. |
| 129 | # password The password to be assigned. |
| 130 | # role_id The role id of the user to be created |
| 131 | # (e.g. "Administrator", "Operator", etc.). |
| 132 | |
| 133 | # Trying todo a login with created user |
| 134 | ${is_redfish}= Run Keyword And Return Status Redfish.Login ${username} ${password} |
| 135 | |
| 136 | # Doing a check of the rerurned status |
| 137 | Should Be Equal ${is_redfish} ${enabled} |
| 138 | |
| 139 | # We do not needed to login with created user (user could be in disabled status) |
| 140 | Redfish.Login |
| 141 | |
| 142 | # Validate Role Id of created user. |
| 143 | ${role_config}= Redfish_Utils.Get Attribute |
| 144 | ... /redfish/v1/AccountService/Accounts/${username} RoleId |
| 145 | Should Be Equal ${role_id} ${role_config} |
| 146 | |
| 147 | |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 148 | Redfish Create And Verify User |
| 149 | [Documentation] Redfish create and verify user. |
| 150 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 151 | |
| 152 | # Description of argument(s): |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 153 | # username The username to be created. |
| 154 | # password The password to be assigned. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 155 | # role_id The role id of the user to be created |
| 156 | # (e.g. "Administrator", "Operator", etc.). |
| 157 | # enabled Indicates whether the username being created |
| 158 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 159 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 160 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 161 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 162 | Redfish Verify User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 163 | |
| 164 | # Delete Specified User |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 165 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |
| 166 | |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 167 | |
| 168 | Verify Redfish User with Wrong Password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 169 | [Documentation] Verify Redfish User with Wrong Password. |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 170 | [Arguments] ${username} ${password} ${role_id} ${enabled} ${wrong_password} |
| 171 | |
| 172 | # Description of argument(s): |
| 173 | # username The username to be created. |
| 174 | # password The password to be assigned. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 175 | # role_id The role id of the user to be created |
| 176 | # (e.g. "Administrator", "Operator", etc.). |
| 177 | # enabled Indicates whether the username being created |
| 178 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 179 | # wrong_password Any invalid password. |
| 180 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 181 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 182 | |
| 183 | # Attempt to login with created user with invalid password. |
| 184 | Run Keyword And Expect Error InvalidCredentialsError* |
| 185 | ... Redfish.Login ${username} ${wrong_password} |
| 186 | |
| 187 | Redfish.Login |
| 188 | |
| 189 | # Delete newly created user. |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 190 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 191 | |
| 192 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 193 | Verify Login with Deleted Redfish User |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 194 | [Documentation] Verify Login with Deleted Redfish User. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 195 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 196 | |
| 197 | # Description of argument(s): |
| 198 | # username The username to be created. |
| 199 | # password The password to be assigned. |
| 200 | # role_id The role id of the user to be created |
| 201 | # (e.g. "Administrator", "Operator", etc.). |
| 202 | # enabled Indicates whether the username being created |
| 203 | # should be enabled (${True}, ${False}). |
| 204 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 205 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 206 | |
| 207 | # Delete newly created user. |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 208 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 209 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame^] | 210 | ${is_redfish}= Run Keyword And Return Status Redfish.Login ${username} ${password} |
| 211 | |
| 212 | # Doing a check of the rerurned status |
| 213 | Should Be Equal ${is_redfish} ${False} |
| 214 | |
| 215 | Redfish.Login |