blob: ca894401e7f1d5c52a66e212b671c739e33805e1 [file] [log] [blame]
Sivas SRR6aa101f2019-02-19 22:31:55 -06001*** Settings ***
2Documentation Test Redfish user account.
3
4Resource ../../lib/resource.robot
5Resource ../../lib/bmc_redfish_resource.robot
6Resource ../../lib/openbmc_ffdc.robot
7
8Test Setup Test Setup Execution
9Test Teardown Test Teardown Execution
10
11
12** Test Cases **
13
14Verify AccountService Available
Sivas SRRfa6831c2019-02-22 00:12:00 -060015 [Documentation] Verify Redfish account service is available.
Sivas SRR6aa101f2019-02-19 22:31:55 -060016 [Tags] Verify_AccountService_Available
17
George Keishing97c93942019-03-04 12:45:07 -060018 ${resp} = Redfish_utils.Get Attribute /redfish/v1/AccountService ServiceEnabled
Sivas SRR6aa101f2019-02-19 22:31:55 -060019 Should Be Equal As Strings ${resp} ${True}
20
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -060021Redfish 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 SRR6aa101f2019-02-19 22:31:55 -060031
32*** Keywords ***
33
34Test Setup Execution
35 [Documentation] Do test case setup tasks.
36
George Keishing97c93942019-03-04 12:45:07 -060037 Redfish.Login
Sivas SRR6aa101f2019-02-19 22:31:55 -060038
39
40Test Teardown Execution
41 [Documentation] Do the post test teardown.
42
43 FFDC On Test Case Fail
George Keishing97c93942019-03-04 12:45:07 -060044 Redfish.Logout
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -060045
46Redfish 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}