blob: 98cd76b52c7866ac103c36a78605c6d2165dc328 [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
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050022 [Documentation] Create Redfish users with various roles.
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -060023 [Tags] Redfish_Create_and_Verify_Users
24 [Template] Redfish Create And Verify User
25
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050026 # 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
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -050032Verify Redfish User with Wrong Password
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050033 [Documentation] Verify Redfish User with Wrong Password.
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -050034 [Tags] Verify_Redfish_User_with_Wrong_Password
35 [Template] Verify Redfish User with Wrong Password
36
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050037 # 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 Somashekar33aa48c2019-03-13 05:54:49 -050042
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -050043Verify Login with Deleted Redfish Users
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050044 [Documentation] Verify login with deleted Redfish Users.
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -050045 [Tags] Verify_Login_with_Deleted_Redfish_Users
46 [Template] Verify Login with Deleted Redfish User
47
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050048 # 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 Somashekaraf402ca2019-03-18 05:59:19 -050053
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050054Verify 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
65Verify 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 Somashekar33aa48c2019-03-13 05:54:49 -050089
Sivas SRR6aa101f2019-02-19 22:31:55 -060090*** Keywords ***
91
92Test Setup Execution
93 [Documentation] Do test case setup tasks.
94
George Keishing97c93942019-03-04 12:45:07 -060095 Redfish.Login
Sivas SRR6aa101f2019-02-19 22:31:55 -060096
97
98Test Teardown Execution
99 [Documentation] Do the post test teardown.
100
101 FFDC On Test Case Fail
George Keishing97c93942019-03-04 12:45:07 -0600102 Redfish.Logout
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -0600103
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500104Redfish 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
123Redfish 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 Somashekar00f59cc2019-03-05 03:39:47 -0600148Redfish 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 Somashekar33aa48c2019-03-13 05:54:49 -0500153 # username The username to be created.
154 # password The password to be assigned.
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500155 # 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 Somashekar00f59cc2019-03-05 03:39:47 -0600159
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500160 Redfish Create User ${username} ${password} ${role_id} ${enabled}
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -0600161
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500162 Redfish Verify User ${username} ${password} ${role_id} ${enabled}
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -0600163
164 # Delete Specified User
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500165 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
166
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -0500167
168Verify Redfish User with Wrong Password
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500169 [Documentation] Verify Redfish User with Wrong Password.
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -0500170 [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 Somashekaraf402ca2019-03-18 05:59:19 -0500175 # 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 Somashekar33aa48c2019-03-13 05:54:49 -0500179 # wrong_password Any invalid password.
180
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500181 Redfish Create User ${username} ${password} ${role_id} ${enabled}
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -0500182
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 Somashekaraa280aa2019-04-01 04:15:06 -0500190 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -0500191
192
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500193Verify Login with Deleted Redfish User
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500194 [Documentation] Verify Login with Deleted Redfish User.
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500195 [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 Somashekaraa280aa2019-04-01 04:15:06 -0500205 Redfish Create User ${username} ${password} ${role_id} ${enabled}
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500206
207 # Delete newly created user.
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500208 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500209
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500210 ${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