blob: 37c518faa1da0128398a703f7119aca9b58ba940 [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
Sandhya Somashekar37122b62019-06-18 06:02:02 -050011*** Variables ***
12
13${account_lockout_duration} ${30}
14${account_lockout_threshold} ${3}
15
Sivas SRR6aa101f2019-02-19 22:31:55 -060016** Test Cases **
17
18Verify AccountService Available
Sivas SRRfa6831c2019-02-22 00:12:00 -060019 [Documentation] Verify Redfish account service is available.
Sivas SRR6aa101f2019-02-19 22:31:55 -060020 [Tags] Verify_AccountService_Available
21
George Keishing97c93942019-03-04 12:45:07 -060022 ${resp} = Redfish_utils.Get Attribute /redfish/v1/AccountService ServiceEnabled
Sivas SRR6aa101f2019-02-19 22:31:55 -060023 Should Be Equal As Strings ${resp} ${True}
24
Sandhya Somashekara83fb472019-08-29 02:26:21 -050025Verify Redfish User Persistence After Reboot
26 [Documentation] Verify Redfish user persistence after reboot.
27 [Tags] Verify_Redfish_User_Persistence_After_Reboot
28
29 # Create Redfish users.
30 Redfish Create User admin_user TestPwd123 Administrator ${True}
31 Redfish Create User operator_user TestPwd123 Operator ${True}
Anusha Dathatri4062b442020-02-03 04:39:15 -060032 Redfish Create User readonly_user TestPwd123 ReadOnly ${True}
Sandhya Somashekara83fb472019-08-29 02:26:21 -050033 Redfish Create User callback_user TestPwd123 Callback ${True}
34
35 # Reboot BMC.
36 Redfish OBMC Reboot (off) stack_mode=normal
37 Redfish.Login
38
39 # Verify users after reboot.
40 Redfish Verify User admin_user TestPwd123 Administrator ${True}
41 Redfish Verify User operator_user TestPwd123 Operator ${True}
Anusha Dathatri4062b442020-02-03 04:39:15 -060042 Redfish Verify User readonly_user TestPwd123 ReadOnly ${True}
Sandhya Somashekara83fb472019-08-29 02:26:21 -050043 Redfish Verify User callback_user TestPwd123 Callback ${True}
44
45 # Delete created users.
46 Redfish.Delete ${REDFISH_ACCOUNTS_URI}admin_user
47 Redfish.Delete ${REDFISH_ACCOUNTS_URI}operator_user
Anusha Dathatri4062b442020-02-03 04:39:15 -060048 Redfish.Delete ${REDFISH_ACCOUNTS_URI}readonly_user
Sandhya Somashekara83fb472019-08-29 02:26:21 -050049 Redfish.Delete ${REDFISH_ACCOUNTS_URI}callback_user
50
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -060051Redfish Create and Verify Users
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050052 [Documentation] Create Redfish users with various roles.
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -060053 [Tags] Redfish_Create_and_Verify_Users
54 [Template] Redfish Create And Verify User
55
Sandhya Somashekare92b1e62019-04-25 05:27:45 -050056 #username password role_id enabled
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050057 admin_user TestPwd123 Administrator ${True}
58 operator_user TestPwd123 Operator ${True}
Anusha Dathatri4062b442020-02-03 04:39:15 -060059 readonly_user TestPwd123 ReadOnly ${True}
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050060 callback_user TestPwd123 Callback ${True}
Sivas SRR6aa101f2019-02-19 22:31:55 -060061
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -050062Verify Redfish User with Wrong Password
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050063 [Documentation] Verify Redfish User with Wrong Password.
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -050064 [Tags] Verify_Redfish_User_with_Wrong_Password
65 [Template] Verify Redfish User with Wrong Password
66
Sandhya Somashekare92b1e62019-04-25 05:27:45 -050067 #username password role_id enabled wrong_password
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050068 admin_user TestPwd123 Administrator ${True} alskjhfwurh
69 operator_user TestPwd123 Operator ${True} 12j8a8uakjhdaosiruf024
Anusha Dathatri4062b442020-02-03 04:39:15 -060070 readonly_user TestPwd123 ReadOnly ${True} 12
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050071 callback_user TestPwd123 Callback ${True} !#@D#RF#@!D
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -050072
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -050073Verify Login with Deleted Redfish Users
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050074 [Documentation] Verify login with deleted Redfish Users.
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -050075 [Tags] Verify_Login_with_Deleted_Redfish_Users
76 [Template] Verify Login with Deleted Redfish User
77
Sandhya Somashekare92b1e62019-04-25 05:27:45 -050078 #username password role_id enabled
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050079 admin_user TestPwd123 Administrator ${True}
80 operator_user TestPwd123 Operator ${True}
Anusha Dathatri4062b442020-02-03 04:39:15 -060081 readonly_user TestPwd123 ReadOnly ${True}
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050082 callback_user TestPwd123 Callback ${True}
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -050083
George Keishinge0c5ec32019-06-13 09:45:29 -050084Verify User Creation Without Enabling It
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050085 [Documentation] Verify User Creation Without Enabling it.
George Keishinge0c5ec32019-06-13 09:45:29 -050086 [Tags] Verify_User_Creation_Without_Enabling_It
Sandhya Somashekare92b1e62019-04-25 05:27:45 -050087 [Template] Verify Create User Without Enabling
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050088
Sandhya Somashekare92b1e62019-04-25 05:27:45 -050089 #username password role_id enabled
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050090 admin_user TestPwd123 Administrator ${False}
91 operator_user TestPwd123 Operator ${False}
Anusha Dathatri4062b442020-02-03 04:39:15 -060092 readonly_user TestPwd123 ReadOnly ${False}
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -050093 callback_user TestPwd123 Callback ${False}
94
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -050095
Sandhya Somashekare92b1e62019-04-25 05:27:45 -050096Verify User Creation With Invalid Role Id
Sandhya Somashekard7d46c02019-06-26 05:10:25 -050097 [Documentation] Verify user creation with invalid role ID.
Sandhya Somashekare92b1e62019-04-25 05:27:45 -050098 [Tags] Verify_User_Creation_With_Invalid_Role_Id
99
100 # Make sure the user account in question does not already exist.
101 Redfish.Delete ${REDFISH_ACCOUNTS_URI}test_user
102 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
103
104 # Create specified user.
105 ${payload}= Create Dictionary
106 ... UserName=test_user Password=TestPwd123 RoleId=wrongroleid Enabled=${True}
107 Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload}
108 ... valid_status_codes=[${HTTP_BAD_REQUEST}]
109
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500110Verify Error Upon Creating Same Users With Different Privileges
111 [Documentation] Verify error upon creating same users with different privileges.
112 [Tags] Verify_Error_Upon_Creating_Same_Users_With_Different_Privileges
113
114 Redfish Create User test_user TestPwd123 Administrator ${True}
115
116 # Create specified user.
117 ${payload}= Create Dictionary
118 ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True}
119 Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload}
120 ... valid_status_codes=[${HTTP_BAD_REQUEST}]
121
Sandhya Somashekar7a237472019-07-15 02:06:39 -0500122 Redfish.Delete ${REDFISH_ACCOUNTS_URI}test_user
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500123
124Verify Modifying User Attributes
125 [Documentation] Verify modifying user attributes.
126 [Tags] Verify_Modifying_User_Attributes
127
128 # Create Redfish users.
129 Redfish Create User admin_user TestPwd123 Administrator ${True}
130 Redfish Create User operator_user TestPwd123 Operator ${True}
Anusha Dathatri4062b442020-02-03 04:39:15 -0600131 Redfish Create User readonly_user TestPwd123 ReadOnly ${True}
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500132 Redfish Create User callback_user TestPwd123 Callback ${True}
133
134 Redfish.Login
135
136 # Make sure the new user account does not already exist.
137 Redfish.Delete ${REDFISH_ACCOUNTS_URI}newadmin_user
138 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
139
140 # Update admin_user username using Redfish.
141 ${payload}= Create Dictionary UserName=newadmin_user
142 Redfish.Patch ${REDFISH_ACCOUNTS_URI}admin_user body=&{payload}
143
144 # Update operator_user password using Redfish.
145 ${payload}= Create Dictionary Password=NewTestPwd123
146 Redfish.Patch ${REDFISH_ACCOUNTS_URI}operator_user body=&{payload}
147
Anusha Dathatri4062b442020-02-03 04:39:15 -0600148 # Update readonly_user role using Redfish.
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500149 ${payload}= Create Dictionary RoleId=Operator
Anusha Dathatri4062b442020-02-03 04:39:15 -0600150 Redfish.Patch ${REDFISH_ACCOUNTS_URI}readonly_user body=&{payload}
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500151
152 # Update callback_user to disable using Redfish.
153 ${payload}= Create Dictionary Enabled=${False}
154 Redfish.Patch ${REDFISH_ACCOUNTS_URI}callback_user body=&{payload}
155
156 # Verify users after updating
157 Redfish Verify User newadmin_user TestPwd123 Administrator ${True}
158 Redfish Verify User operator_user NewTestPwd123 Operator ${True}
Anusha Dathatri4062b442020-02-03 04:39:15 -0600159 Redfish Verify User readonly_user TestPwd123 Operator ${True}
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500160 Redfish Verify User callback_user TestPwd123 Callback ${False}
161
162 # Delete created users.
163 Redfish.Delete ${REDFISH_ACCOUNTS_URI}newadmin_user
164 Redfish.Delete ${REDFISH_ACCOUNTS_URI}operator_user
Anusha Dathatri4062b442020-02-03 04:39:15 -0600165 Redfish.Delete ${REDFISH_ACCOUNTS_URI}readonly_user
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500166 Redfish.Delete ${REDFISH_ACCOUNTS_URI}callback_user
167
Sandhya Somashekar37122b62019-06-18 06:02:02 -0500168Verify User Account Locked
169 [Documentation] Verify user account locked upon trying with invalid password.
170 [Tags] Verify_User_Account_Locked
171
172 Redfish Create User admin_user TestPwd123 Administrator ${True}
173
Sandhya Somashekar4737c8f2019-07-11 00:00:58 -0500174 Redfish.Logout
175
176 Redfish.Login
177
Joy Onyerikwu1483ce02019-06-26 14:56:36 -0500178 ${payload}= Create Dictionary AccountLockoutThreshold=${account_lockout_threshold}
179 ... AccountLockoutDuration=${account_lockout_duration}
180 Redfish.Patch ${REDFISH_ACCOUNTS_SERVICE_URI} body=${payload}
Sandhya Somashekar37122b62019-06-18 06:02:02 -0500181
182 # Make ${account_lockout_threshold} failed login attempts.
183 Repeat Keyword ${account_lockout_threshold} times
184 ... Run Keyword And Expect Error InvalidCredentialsError* Redfish.Login admin_user abc123
185
186 # Verify that legitimate login fails due to lockout.
187 Run Keyword And Expect Error InvalidCredentialsError*
188 ... Redfish.Login admin_user TestPwd123
189
190 # Wait for lockout duration to expire and then verify that login works.
191 Sleep ${account_lockout_duration}s
192 Redfish.Login admin_user TestPwd123
193
194 Redfish.Logout
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500195
Sandhya Somashekar7a237472019-07-15 02:06:39 -0500196 Redfish.Login
197
198 Redfish.Delete ${REDFISH_ACCOUNTS_URI}admin_user
199
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500200Verify Admin User Privilege
201 [Documentation] Verify admin user privilege.
202 [Tags] Verify_Admin_User_Privilege
203
204 Redfish Create User admin_user TestPwd123 Administrator ${True}
205 Redfish Create User operator_user TestPwd123 Operator ${True}
Anusha Dathatri4062b442020-02-03 04:39:15 -0600206 Redfish Create User readonly_user TestPwd123 ReadOnly ${True}
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500207
208 # Change role ID of operator user with admin user.
209 # Login with admin user.
210 Redfish.Login admin_user TestPwd123
211
212 # Modify Role ID of Operator user.
213 Redfish.Patch ${REDFISH_ACCOUNTS_URI}operator_user body={'RoleId': 'Administrator'}
214
215 # Verify modified user.
216 Redfish Verify User operator_user TestPwd123 Administrator ${True}
217
218 # Change password of 'user' user with admin user.
Anusha Dathatri4062b442020-02-03 04:39:15 -0600219 Redfish.Patch ${REDFISH_ACCOUNTS_URI}readonly_user body={'Password': 'NewTestPwd123'}
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500220
221 # Verify modified user.
Anusha Dathatri4062b442020-02-03 04:39:15 -0600222 Redfish Verify User readonly_user NewTestPwd123 ReadOnly ${True}
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500223
Sandhya Somashekar7a237472019-07-15 02:06:39 -0500224 Redfish.Login
225
226 Redfish.Delete ${REDFISH_ACCOUNTS_URI}admin_user
227 Redfish.Delete ${REDFISH_ACCOUNTS_URI}operator_user
Anusha Dathatri4062b442020-02-03 04:39:15 -0600228 Redfish.Delete ${REDFISH_ACCOUNTS_URI}readonly_user
Sandhya Somashekar7a237472019-07-15 02:06:39 -0500229
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500230Verify Operator User Privilege
231 [Documentation] Verify operator user privilege.
232 [Tags] Verify_operator_User_Privilege
233
234 Redfish Create User admin_user TestPwd123 Administrator ${True}
235 Redfish Create User operator_user TestPwd123 Operator ${True}
236
237 # Login with operator user.
238 Redfish.Login operator_user TestPwd123
239
240 # Verify power on system.
241 Redfish OBMC Reboot (off) stack_mode=normal
242
243 # Attempt to change password of admin user with operator user.
244 Redfish.Patch ${REDFISH_ACCOUNTS_URI}admin_user body={'Password': 'NewTestPwd123'}
245 ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
246
Sandhya Somashekar7a237472019-07-15 02:06:39 -0500247 Redfish.Login
248
249 Redfish.Delete ${REDFISH_ACCOUNTS_URI}admin_user
250 Redfish.Delete ${REDFISH_ACCOUNTS_URI}operator_user
251
252
Anusha Dathatri4062b442020-02-03 04:39:15 -0600253Verify ReadOnly User Privilege
254 [Documentation] Verify ReadOnly user privilege.
255 [Tags] Verify_ReadOnly_User_Privilege
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500256
Anusha Dathatri4062b442020-02-03 04:39:15 -0600257 Redfish Create User readonly_user TestPwd123 ReadOnly ${True}
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500258
259 # Read system level data.
260 ${system_model}= Redfish_Utils.Get Attribute
261 ... ${SYSTEM_BASE_URI} Model
262
Sandhya Somashekar7a237472019-07-15 02:06:39 -0500263 Redfish.Login
264
Anusha Dathatri4062b442020-02-03 04:39:15 -0600265 Redfish.Delete ${REDFISH_ACCOUNTS_URI}readonly_user
Sandhya Somashekar7a237472019-07-15 02:06:39 -0500266
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500267
Sivas SRR6aa101f2019-02-19 22:31:55 -0600268*** Keywords ***
269
270Test Setup Execution
271 [Documentation] Do test case setup tasks.
272
George Keishing97c93942019-03-04 12:45:07 -0600273 Redfish.Login
Sivas SRR6aa101f2019-02-19 22:31:55 -0600274
275
276Test Teardown Execution
277 [Documentation] Do the post test teardown.
278
Sandhya Somashekar37122b62019-06-18 06:02:02 -0500279 FFDC On Test Case Fail
George Keishing97c93942019-03-04 12:45:07 -0600280 Redfish.Logout
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -0600281
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500282Redfish Create User
283 [Documentation] Redfish create user.
284 [Arguments] ${username} ${password} ${role_id} ${enabled}
285
286 # Description of argument(s):
287 # username The username to be created.
288 # password The password to be assigned.
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500289 # role_id The role ID of the user to be created
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500290 # (e.g. "Administrator", "Operator", etc.).
291 # enabled Indicates whether the username being created
292 # should be enabled (${True}, ${False}).
293
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500294 Redfish.Login
295
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500296 # Make sure the user account in question does not already exist.
297 Redfish.Delete ${REDFISH_ACCOUNTS_URI}${userName}
298 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
299
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500300 # Create specified user.
301 ${payload}= Create Dictionary
302 ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled}
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500303 Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload}
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500304 ... valid_status_codes=[${HTTP_CREATED}]
305
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500306 Redfish.Logout
307
308 # Login with created user.
George Keishing4916b462019-08-08 23:24:48 -0500309 Run Keyword If ${enabled} == ${False}
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500310 ... Run Keyword And Expect Error InvalidCredentialsError*
311 ... Redfish.Login ${username} ${password}
312 ... ELSE
313 ... Redfish.Login ${username} ${password}
314
Sandhya Somashekara83fb472019-08-29 02:26:21 -0500315 Run Keyword If ${enabled} == ${False}
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500316 ... Redfish.Login
317
Sandhya Somashekar0e73c112019-09-24 01:11:13 -0500318 Run Keyword If '${role_id}' == 'Callback'
319 ... Run Keywords Redfish.Logout AND Redfish.Login
320
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500321 # Validate Role ID of created user.
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500322 ${role_config}= Redfish_Utils.Get Attribute
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500323 ... ${REDFISH_ACCOUNTS_URI}${username} RoleId
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500324 Should Be Equal ${role_id} ${role_config}
325
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500326
327Redfish Verify User
328 [Documentation] Redfish user verification.
329 [Arguments] ${username} ${password} ${role_id} ${enabled}
330
331 # Description of argument(s):
332 # username The username to be created.
333 # password The password to be assigned.
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500334 # role_id The role ID of the user to be created
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500335 # (e.g. "Administrator", "Operator", etc.).
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500336 # enabled Indicates whether the username being created
337 # should be enabled (${True}, ${False}).
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500338
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500339 # Trying to do a login with created user.
340 ${status}= Run Keyword And Return Status Redfish.Login ${username} ${password}
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500341
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500342 # Doing a check of the returned status.
343 Should Be Equal ${status} ${enabled}
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500344
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500345 # We do not need to login with created user (user could be in disabled status).
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500346 Redfish.Login
347
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500348 # Validate Role Id of user.
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500349 ${role_config}= Redfish_Utils.Get Attribute
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500350 ... ${REDFISH_ACCOUNTS_URI}${username} RoleId
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500351 Should Be Equal ${role_id} ${role_config}
352
353
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -0600354Redfish Create And Verify User
355 [Documentation] Redfish create and verify user.
356 [Arguments] ${username} ${password} ${role_id} ${enabled}
357
358 # Description of argument(s):
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -0500359 # username The username to be created.
360 # password The password to be assigned.
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500361 # role_id The role ID of the user to be created
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500362 # (e.g. "Administrator", "Operator", etc.).
363 # enabled Indicates whether the username being created
364 # should be enabled (${True}, ${False}).
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -0600365
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500366 # Example:
367 #{
368 #"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount",
369 #"@odata.id": "/redfish/v1/AccountService/Accounts/test1",
370 #"@odata.type": "#ManagerAccount.v1_0_3.ManagerAccount",
371 #"Description": "User Account",
372 #"Enabled": true,
373 #"Id": "test1",
374 #"Links": {
375 # "Role": {
376 # "@odata.id": "/redfish/v1/AccountService/Roles/Administrator"
377 # }
378 #},
379
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500380 Redfish Create User ${username} ${password} ${role_id} ${enabled}
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -0600381
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500382 Redfish Verify User ${username} ${password} ${role_id} ${enabled}
Sandhya Somashekar00f59cc2019-03-05 03:39:47 -0600383
384 # Delete Specified User
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500385 Redfish.Delete ${REDFISH_ACCOUNTS_URI}${username}
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500386
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -0500387Verify Redfish User with Wrong Password
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500388 [Documentation] Verify Redfish User with Wrong Password.
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -0500389 [Arguments] ${username} ${password} ${role_id} ${enabled} ${wrong_password}
390
391 # Description of argument(s):
392 # username The username to be created.
393 # password The password to be assigned.
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500394 # role_id The role ID of the user to be created
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500395 # (e.g. "Administrator", "Operator", etc.).
396 # enabled Indicates whether the username being created
397 # should be enabled (${True}, ${False}).
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -0500398 # wrong_password Any invalid password.
399
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500400 Redfish Create User ${username} ${password} ${role_id} ${enabled}
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -0500401
402 # Attempt to login with created user with invalid password.
403 Run Keyword And Expect Error InvalidCredentialsError*
404 ... Redfish.Login ${username} ${wrong_password}
405
406 Redfish.Login
407
408 # Delete newly created user.
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500409 Redfish.Delete ${REDFISH_ACCOUNTS_URI}${username}
Sandhya Somashekar33aa48c2019-03-13 05:54:49 -0500410
411
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500412Verify Login with Deleted Redfish User
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500413 [Documentation] Verify Login with Deleted Redfish User.
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500414 [Arguments] ${username} ${password} ${role_id} ${enabled}
415
416 # Description of argument(s):
417 # username The username to be created.
418 # password The password to be assigned.
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500419 # role_id The role ID of the user to be created
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500420 # (e.g. "Administrator", "Operator", etc.).
421 # enabled Indicates whether the username being created
422 # should be enabled (${True}, ${False}).
423
Sandhya Somashekaraa280aa2019-04-01 04:15:06 -0500424 Redfish Create User ${username} ${password} ${role_id} ${enabled}
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500425 ${status}= Run Keyword And Return Status Redfish.Login ${username} ${password}
426
427 # Doing a check of the rerurned status
428 Should Be Equal ${status} ${True}
429
430 Redfish.Login
431
432 # Delete newly created user.
433 Redfish.Delete ${REDFISH_ACCOUNTS_URI}${userName}
434
435 # Attempt to login with deleted user account.
436 Run Keyword And Expect Error InvalidCredentialsError*
437 ... Redfish.Login ${username} ${password}
438
439 Redfish.Login
440
441Verify Create User Without Enabling
442 [Documentation] Verify Create User Without Enabling.
443 [Arguments] ${username} ${password} ${role_id} ${enabled}
444
445 # Description of argument(s):
446 # username The username to be created.
447 # password The password to be assigned.
Sandhya Somashekard7d46c02019-06-26 05:10:25 -0500448 # role_id The role ID of the user to be created
Sandhya Somashekare92b1e62019-04-25 05:27:45 -0500449 # (e.g. "Administrator", "Operator", etc.).
450 # enabled Indicates whether the username being created
451 # should be enabled (${True}, ${False}).
452
453 Redfish.Login
454
455 Redfish Create User ${username} ${password} ${role_id} ${enabled}
456
457 Redfish.Logout
458
459 # Login with created user.
460 Run Keyword And Expect Error InvalidCredentialsError*
461 ... Redfish.Login ${username} ${password}
462
463 Redfish.Login
Sandhya Somashekaraf402ca2019-03-18 05:59:19 -0500464
465 # Delete newly created user.
Sandhya Somashekar8c5b2492019-05-16 05:19:03 -0500466 Redfish.Delete ${REDFISH_ACCOUNTS_URI}${username}