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 | |
| 32 | *** Keywords *** |
| 33 | |
| 34 | Test Setup Execution |
| 35 | [Documentation] Do test case setup tasks. |
| 36 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 37 | Redfish.Login |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 38 | |
| 39 | |
| 40 | Test Teardown Execution |
| 41 | [Documentation] Do the post test teardown. |
| 42 | |
| 43 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 44 | Redfish.Logout |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 45 | |
| 46 | Redfish Create And Verify User |
| 47 | [Documentation] Redfish create and verify user. |
| 48 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 49 | |
| 50 | # Description of argument(s): |
| 51 | # Username The username to be created |
| 52 | # Password The password to be assigned |
| 53 | # Roleid The role id of the user to be created |
| 54 | # Enabled The decision if it should be enabled |
| 55 | |
| 56 | # Example: |
| 57 | #{ |
| 58 | #"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount", |
| 59 | #"@odata.id": "/redfish/v1/AccountService/Accounts/test1", |
| 60 | #"@odata.type": "#ManagerAccount.v1_0_3.ManagerAccount", |
| 61 | #"Description": "User Account", |
| 62 | #"Enabled": true, |
| 63 | #"Id": "test1", |
| 64 | #"Links": { |
| 65 | # "Role": { |
| 66 | # "@odata.id": "/redfish/v1/AccountService/Roles/Administrator" |
| 67 | # } |
| 68 | #}, |
| 69 | |
| 70 | # Delete if the user exist. |
| 71 | Run Keyword And Ignore Error |
| 72 | ... Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
| 73 | |
| 74 | # Create specified user. |
| 75 | ${payload}= Create Dictionary |
| 76 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
| 77 | Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload} |
| 78 | ... valid_status_codes=[${HTTP_CREATED}] |
| 79 | |
| 80 | Redfish.Logout |
| 81 | |
| 82 | # Login with created user. |
| 83 | Redfish.Login ${username} ${password} |
| 84 | |
| 85 | # Validate Role Id of created user. |
| 86 | ${role_config}= Redfish_Utils.Get Attribute |
| 87 | ... /redfish/v1/AccountService/Accounts/${userName} RoleId |
| 88 | Should Be Equal ${role_id} ${role_config} |
| 89 | |
| 90 | Redfish.Get /redfish/v1/AccountService/Accounts/${userName} |
| 91 | |
| 92 | # Delete Specified User |
| 93 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |