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 | |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 11 | *** Variables *** |
| 12 | |
| 13 | ${account_lockout_duration} ${30} |
| 14 | ${account_lockout_threshold} ${3} |
| 15 | |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 16 | |
| 17 | ** Test Cases ** |
| 18 | |
| 19 | Verify AccountService Available |
Sivas SRR | fa6831c | 2019-02-22 00:12:00 -0600 | [diff] [blame] | 20 | [Documentation] Verify Redfish account service is available. |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 21 | [Tags] Verify_AccountService_Available |
| 22 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 23 | ${resp} = Redfish_utils.Get Attribute /redfish/v1/AccountService ServiceEnabled |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 24 | Should Be Equal As Strings ${resp} ${True} |
| 25 | |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 26 | Redfish Create and Verify Users |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 27 | [Documentation] Create Redfish users with various roles. |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 28 | [Tags] Redfish_Create_and_Verify_Users |
| 29 | [Template] Redfish Create And Verify User |
| 30 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 31 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 32 | admin_user TestPwd123 Administrator ${True} |
| 33 | operator_user TestPwd123 Operator ${True} |
| 34 | user_user TestPwd123 User ${True} |
| 35 | callback_user TestPwd123 Callback ${True} |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 36 | |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 37 | Verify Redfish User with Wrong Password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 38 | [Documentation] Verify Redfish User with Wrong Password. |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 39 | [Tags] Verify_Redfish_User_with_Wrong_Password |
| 40 | [Template] Verify Redfish User with Wrong Password |
| 41 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 42 | #username password role_id enabled wrong_password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 43 | admin_user TestPwd123 Administrator ${True} alskjhfwurh |
| 44 | operator_user TestPwd123 Operator ${True} 12j8a8uakjhdaosiruf024 |
| 45 | user_user TestPwd123 User ${True} 12 |
| 46 | callback_user TestPwd123 Callback ${True} !#@D#RF#@!D |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 47 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 48 | Verify Login with Deleted Redfish Users |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 49 | [Documentation] Verify login with deleted Redfish Users. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 50 | [Tags] Verify_Login_with_Deleted_Redfish_Users |
| 51 | [Template] Verify Login with Deleted Redfish User |
| 52 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 53 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 54 | admin_user TestPwd123 Administrator ${True} |
| 55 | operator_user TestPwd123 Operator ${True} |
| 56 | user_user TestPwd123 User ${True} |
| 57 | callback_user TestPwd123 Callback ${True} |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 58 | |
George Keishing | e0c5ec3 | 2019-06-13 09:45:29 -0500 | [diff] [blame] | 59 | Verify User Creation Without Enabling It |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 60 | [Documentation] Verify User Creation Without Enabling it. |
George Keishing | e0c5ec3 | 2019-06-13 09:45:29 -0500 | [diff] [blame] | 61 | [Tags] Verify_User_Creation_Without_Enabling_It |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 62 | [Template] Verify Create User Without Enabling |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 63 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 64 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 65 | admin_user TestPwd123 Administrator ${False} |
| 66 | operator_user TestPwd123 Operator ${False} |
| 67 | user_user TestPwd123 User ${False} |
| 68 | callback_user TestPwd123 Callback ${False} |
| 69 | |
| 70 | Verify Redfish User Persistence After Reboot |
| 71 | [Documentation] Verify Redfish user persistence after reboot. |
| 72 | [Tags] Verify_Redfish_User_Persistence_After_Reboot |
| 73 | |
| 74 | # Create Redfish users. |
| 75 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 76 | Redfish Create User operator_user TestPwd123 Operator ${True} |
| 77 | Redfish Create User user_user TestPwd123 User ${True} |
| 78 | Redfish Create User callback_user TestPwd123 Callback ${True} |
| 79 | |
| 80 | # Reboot BMC. |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 81 | Redfish OBMC Reboot (off) stack_mode=normal |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 82 | |
| 83 | # Verify users after reboot. |
| 84 | Redfish Verify User admin_user TestPwd123 Administrator ${True} |
| 85 | Redfish Verify User operator_user TestPwd123 Operator ${True} |
| 86 | Redfish Verify User user_user TestPwd123 User ${True} |
| 87 | Redfish Verify User callback_user TestPwd123 Callback ${True} |
| 88 | |
| 89 | # Delete created users. |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 90 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}admin_user |
| 91 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}operator_user |
| 92 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}user_user |
| 93 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}callback_user |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 94 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 95 | Verify User Creation With Invalid Role Id |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 96 | [Documentation] Verify user creation with invalid role ID. |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 97 | [Tags] Verify_User_Creation_With_Invalid_Role_Id |
| 98 | |
| 99 | # Make sure the user account in question does not already exist. |
| 100 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}test_user |
| 101 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 102 | |
| 103 | # Create specified user. |
| 104 | ${payload}= Create Dictionary |
| 105 | ... UserName=test_user Password=TestPwd123 RoleId=wrongroleid Enabled=${True} |
| 106 | Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload} |
| 107 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 108 | |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 109 | Verify Error Upon Creating Same Users With Different Privileges |
| 110 | [Documentation] Verify error upon creating same users with different privileges. |
| 111 | [Tags] Verify_Error_Upon_Creating_Same_Users_With_Different_Privileges |
| 112 | |
| 113 | Redfish Create User test_user TestPwd123 Administrator ${True} |
| 114 | |
| 115 | # Create specified user. |
| 116 | ${payload}= Create Dictionary |
| 117 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
| 118 | Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload} |
| 119 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 120 | |
| 121 | |
| 122 | Verify Modifying User Attributes |
| 123 | [Documentation] Verify modifying user attributes. |
| 124 | [Tags] Verify_Modifying_User_Attributes |
| 125 | |
| 126 | # Create Redfish users. |
| 127 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 128 | Redfish Create User operator_user TestPwd123 Operator ${True} |
| 129 | Redfish Create User user_user TestPwd123 User ${True} |
| 130 | Redfish Create User callback_user TestPwd123 Callback ${True} |
| 131 | |
| 132 | Redfish.Login |
| 133 | |
| 134 | # Make sure the new user account does not already exist. |
| 135 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}newadmin_user |
| 136 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 137 | |
| 138 | # Update admin_user username using Redfish. |
| 139 | ${payload}= Create Dictionary UserName=newadmin_user |
| 140 | Redfish.Patch ${REDFISH_ACCOUNTS_URI}admin_user body=&{payload} |
| 141 | |
| 142 | # Update operator_user password using Redfish. |
| 143 | ${payload}= Create Dictionary Password=NewTestPwd123 |
| 144 | Redfish.Patch ${REDFISH_ACCOUNTS_URI}operator_user body=&{payload} |
| 145 | |
| 146 | # Update user_user role using Redfish. |
| 147 | ${payload}= Create Dictionary RoleId=Operator |
| 148 | Redfish.Patch ${REDFISH_ACCOUNTS_URI}user_user body=&{payload} |
| 149 | |
| 150 | # Update callback_user to disable using Redfish. |
| 151 | ${payload}= Create Dictionary Enabled=${False} |
| 152 | Redfish.Patch ${REDFISH_ACCOUNTS_URI}callback_user body=&{payload} |
| 153 | |
| 154 | # Verify users after updating |
| 155 | Redfish Verify User newadmin_user TestPwd123 Administrator ${True} |
| 156 | Redfish Verify User operator_user NewTestPwd123 Operator ${True} |
| 157 | Redfish Verify User user_user TestPwd123 Operator ${True} |
| 158 | Redfish Verify User callback_user TestPwd123 Callback ${False} |
| 159 | |
| 160 | # Delete created users. |
| 161 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}newadmin_user |
| 162 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}operator_user |
| 163 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}user_user |
| 164 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}callback_user |
| 165 | |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 166 | Verify User Account Locked |
| 167 | [Documentation] Verify user account locked upon trying with invalid password. |
| 168 | [Tags] Verify_User_Account_Locked |
| 169 | |
| 170 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 171 | |
Sandhya Somashekar | 4737c8f | 2019-07-11 00:00:58 -0500 | [diff] [blame] | 172 | Redfish.Logout |
| 173 | |
| 174 | Redfish.Login |
| 175 | |
Joy Onyerikwu | 1483ce0 | 2019-06-26 14:56:36 -0500 | [diff] [blame] | 176 | ${payload}= Create Dictionary AccountLockoutThreshold=${account_lockout_threshold} |
| 177 | ... AccountLockoutDuration=${account_lockout_duration} |
| 178 | Redfish.Patch ${REDFISH_ACCOUNTS_SERVICE_URI} body=${payload} |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 179 | |
| 180 | # Make ${account_lockout_threshold} failed login attempts. |
| 181 | Repeat Keyword ${account_lockout_threshold} times |
| 182 | ... Run Keyword And Expect Error InvalidCredentialsError* Redfish.Login admin_user abc123 |
| 183 | |
| 184 | # Verify that legitimate login fails due to lockout. |
| 185 | Run Keyword And Expect Error InvalidCredentialsError* |
| 186 | ... Redfish.Login admin_user TestPwd123 |
| 187 | |
| 188 | # Wait for lockout duration to expire and then verify that login works. |
| 189 | Sleep ${account_lockout_duration}s |
| 190 | Redfish.Login admin_user TestPwd123 |
| 191 | |
| 192 | Redfish.Logout |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 193 | |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 194 | Verify Admin User Privilege |
| 195 | [Documentation] Verify admin user privilege. |
| 196 | [Tags] Verify_Admin_User_Privilege |
| 197 | |
| 198 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 199 | Redfish Create User operator_user TestPwd123 Operator ${True} |
| 200 | Redfish Create User user_user TestPwd123 User ${True} |
| 201 | |
| 202 | # Change role ID of operator user with admin user. |
| 203 | # Login with admin user. |
| 204 | Redfish.Login admin_user TestPwd123 |
| 205 | |
| 206 | # Modify Role ID of Operator user. |
| 207 | Redfish.Patch ${REDFISH_ACCOUNTS_URI}operator_user body={'RoleId': 'Administrator'} |
| 208 | |
| 209 | # Verify modified user. |
| 210 | Redfish Verify User operator_user TestPwd123 Administrator ${True} |
| 211 | |
| 212 | # Change password of 'user' user with admin user. |
| 213 | Redfish.Patch ${REDFISH_ACCOUNTS_URI}user_user body={'Password': 'NewTestPwd123'} |
| 214 | |
| 215 | # Verify modified user. |
| 216 | Redfish Verify User user_user NewTestPwd123 User ${True} |
| 217 | |
| 218 | Verify Operator User Privilege |
| 219 | [Documentation] Verify operator user privilege. |
| 220 | [Tags] Verify_operator_User_Privilege |
| 221 | |
| 222 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 223 | Redfish Create User operator_user TestPwd123 Operator ${True} |
| 224 | |
| 225 | # Login with operator user. |
| 226 | Redfish.Login operator_user TestPwd123 |
| 227 | |
| 228 | # Verify power on system. |
| 229 | Redfish OBMC Reboot (off) stack_mode=normal |
| 230 | |
| 231 | # Attempt to change password of admin user with operator user. |
| 232 | Redfish.Patch ${REDFISH_ACCOUNTS_URI}admin_user body={'Password': 'NewTestPwd123'} |
| 233 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}] |
| 234 | |
| 235 | Verify 'User' User Privilege |
| 236 | [Documentation] Verify 'user' user privilege. |
| 237 | [Tags] Verify_User_User_Privilege |
| 238 | |
| 239 | Redfish Create User user_user TestPwd123 User ${True} |
| 240 | |
| 241 | # Read system level data. |
| 242 | ${system_model}= Redfish_Utils.Get Attribute |
| 243 | ... ${SYSTEM_BASE_URI} Model |
| 244 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 245 | |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 246 | *** Keywords *** |
| 247 | |
| 248 | Test Setup Execution |
| 249 | [Documentation] Do test case setup tasks. |
| 250 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 251 | Redfish.Login |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 252 | |
| 253 | |
| 254 | Test Teardown Execution |
| 255 | [Documentation] Do the post test teardown. |
| 256 | |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 257 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 258 | Redfish.Logout |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 259 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 260 | Redfish Create User |
| 261 | [Documentation] Redfish create user. |
| 262 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 263 | |
| 264 | # Description of argument(s): |
| 265 | # username The username to be created. |
| 266 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 267 | # role_id The role ID of the user to be created |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 268 | # (e.g. "Administrator", "Operator", etc.). |
| 269 | # enabled Indicates whether the username being created |
| 270 | # should be enabled (${True}, ${False}). |
| 271 | |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 272 | Redfish.Login |
| 273 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 274 | # Make sure the user account in question does not already exist. |
| 275 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}${userName} |
| 276 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 277 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 278 | # Create specified user. |
| 279 | ${payload}= Create Dictionary |
| 280 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 281 | Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 282 | ... valid_status_codes=[${HTTP_CREATED}] |
| 283 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 284 | Redfish.Logout |
| 285 | |
| 286 | # Login with created user. |
| 287 | Run Keyword If ${enabled} == False |
| 288 | ... Run Keyword And Expect Error InvalidCredentialsError* |
| 289 | ... Redfish.Login ${username} ${password} |
| 290 | ... ELSE |
| 291 | ... Redfish.Login ${username} ${password} |
| 292 | |
| 293 | Run Keyword If ${enabled} == False |
| 294 | ... Redfish.Login |
| 295 | |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 296 | # Validate Role ID of created user. |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 297 | ${role_config}= Redfish_Utils.Get Attribute |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 298 | ... ${REDFISH_ACCOUNTS_URI}${username} RoleId |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 299 | Should Be Equal ${role_id} ${role_config} |
| 300 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 301 | |
| 302 | Redfish Verify User |
| 303 | [Documentation] Redfish user verification. |
| 304 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 305 | |
| 306 | # Description of argument(s): |
| 307 | # username The username to be created. |
| 308 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 309 | # role_id The role ID of the user to be created |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 310 | # (e.g. "Administrator", "Operator", etc.). |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 311 | # enabled Indicates whether the username being created |
| 312 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 313 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 314 | # Trying to do a login with created user. |
| 315 | ${status}= Run Keyword And Return Status Redfish.Login ${username} ${password} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 316 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 317 | # Doing a check of the returned status. |
| 318 | Should Be Equal ${status} ${enabled} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 319 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 320 | # 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] | 321 | Redfish.Login |
| 322 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 323 | # Validate Role Id of user. |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 324 | ${role_config}= Redfish_Utils.Get Attribute |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 325 | ... ${REDFISH_ACCOUNTS_URI}${username} RoleId |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 326 | Should Be Equal ${role_id} ${role_config} |
| 327 | |
| 328 | |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 329 | Redfish Create And Verify User |
| 330 | [Documentation] Redfish create and verify user. |
| 331 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 332 | |
| 333 | # Description of argument(s): |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 334 | # username The username to be created. |
| 335 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 336 | # role_id The role ID of the user to be created |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 337 | # (e.g. "Administrator", "Operator", etc.). |
| 338 | # enabled Indicates whether the username being created |
| 339 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 340 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 341 | # Example: |
| 342 | #{ |
| 343 | #"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount", |
| 344 | #"@odata.id": "/redfish/v1/AccountService/Accounts/test1", |
| 345 | #"@odata.type": "#ManagerAccount.v1_0_3.ManagerAccount", |
| 346 | #"Description": "User Account", |
| 347 | #"Enabled": true, |
| 348 | #"Id": "test1", |
| 349 | #"Links": { |
| 350 | # "Role": { |
| 351 | # "@odata.id": "/redfish/v1/AccountService/Roles/Administrator" |
| 352 | # } |
| 353 | #}, |
| 354 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 355 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 356 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 357 | Redfish Verify User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 358 | |
| 359 | # Delete Specified User |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 360 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}${username} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 361 | |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 362 | Verify Redfish User with Wrong Password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 363 | [Documentation] Verify Redfish User with Wrong Password. |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 364 | [Arguments] ${username} ${password} ${role_id} ${enabled} ${wrong_password} |
| 365 | |
| 366 | # Description of argument(s): |
| 367 | # username The username to be created. |
| 368 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 369 | # role_id The role ID of the user to be created |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 370 | # (e.g. "Administrator", "Operator", etc.). |
| 371 | # enabled Indicates whether the username being created |
| 372 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 373 | # wrong_password Any invalid password. |
| 374 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 375 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 376 | |
| 377 | # Attempt to login with created user with invalid password. |
| 378 | Run Keyword And Expect Error InvalidCredentialsError* |
| 379 | ... Redfish.Login ${username} ${wrong_password} |
| 380 | |
| 381 | Redfish.Login |
| 382 | |
| 383 | # Delete newly created user. |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 384 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}${username} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 385 | |
| 386 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 387 | Verify Login with Deleted Redfish User |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 388 | [Documentation] Verify Login with Deleted Redfish User. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 389 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 390 | |
| 391 | # Description of argument(s): |
| 392 | # username The username to be created. |
| 393 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 394 | # role_id The role ID of the user to be created |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 395 | # (e.g. "Administrator", "Operator", etc.). |
| 396 | # enabled Indicates whether the username being created |
| 397 | # should be enabled (${True}, ${False}). |
| 398 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 399 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 400 | ${status}= Run Keyword And Return Status Redfish.Login ${username} ${password} |
| 401 | |
| 402 | # Doing a check of the rerurned status |
| 403 | Should Be Equal ${status} ${True} |
| 404 | |
| 405 | Redfish.Login |
| 406 | |
| 407 | # Delete newly created user. |
| 408 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}${userName} |
| 409 | |
| 410 | # Attempt to login with deleted user account. |
| 411 | Run Keyword And Expect Error InvalidCredentialsError* |
| 412 | ... Redfish.Login ${username} ${password} |
| 413 | |
| 414 | Redfish.Login |
| 415 | |
| 416 | Verify Create User Without Enabling |
| 417 | [Documentation] Verify Create User Without Enabling. |
| 418 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 419 | |
| 420 | # Description of argument(s): |
| 421 | # username The username to be created. |
| 422 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 423 | # role_id The role ID of the user to be created |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 424 | # (e.g. "Administrator", "Operator", etc.). |
| 425 | # enabled Indicates whether the username being created |
| 426 | # should be enabled (${True}, ${False}). |
| 427 | |
| 428 | Redfish.Login |
| 429 | |
| 430 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
| 431 | |
| 432 | Redfish.Logout |
| 433 | |
| 434 | # Login with created user. |
| 435 | Run Keyword And Expect Error InvalidCredentialsError* |
| 436 | ... Redfish.Login ${username} ${password} |
| 437 | |
| 438 | Redfish.Login |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 439 | |
| 440 | # Delete newly created user. |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 441 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}${username} |