blob: a3d1fe692c75becc75157ddc2aadf89b340c2750 [file] [log] [blame]
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -06001*** Settings ***
2Documentation Test suite for OpenBMC IPMI user management.
3
4Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
6Library ../lib/ipmi_utils.py
Anusha Dathatridd8e7d82019-12-03 07:45:30 -06007Test Setup Printn
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -06008
Rahul Maheshwarif646baa2019-02-20 12:29:35 -06009Test Teardown Test Teardown Execution
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060010
11*** Variables ***
12
13${invalid_username} user%
14${invalid_password} abc123
15${root_userid} 1
16${operator_level_priv} 0x3
Rahul Maheshwaric05bf562019-03-01 04:02:53 -060017${user_priv} 2
18${operator_priv} 3
Rahul Maheshwarief0a7352019-02-20 11:07:48 -060019${admin_level_priv} 4
Rahul Maheshwaric05bf562019-03-01 04:02:53 -060020${no_access_priv} 15
Rahul Maheshwaric19f8382019-02-20 08:19:22 -060021${valid_password} 0penBmc1
22${max_password_length} 20
Rahul Maheshwarief0a7352019-02-20 11:07:48 -060023${ipmi_setaccess_cmd} channel setaccess
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060024&{password_values} 16=0penBmc10penBmc2 17=0penBmc10penBmc2B
25 ... 20=0penBmc10penBmc2Bmc3 21=0penBmc10penBmc2Bmc34
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060026
Rahul Maheshwaridd63c742019-02-27 23:03:54 -060027
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060028*** Test Cases ***
29
Rahul Maheshwariffc77352019-02-25 09:05:27 -060030Verify IPMI User Summary
31 [Documentation] Verify IPMI maximum supported IPMI user ID and
32 ... enabled user form user summary
33 [Tags] Verify_IPMI_User_Summary
Tony Leef9379e82020-01-08 18:20:38 +080034 [Teardown] Run Keywords FFDC On Test Case Fail AND
35 ... Delete Created User ${random_userid}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060036 # Delete all non-root IPMI (i.e. except userid 1)
37 Delete All Non Root IPMI User
38
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060039 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +080040 Set Test Variable ${random_userid}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060041 Run IPMI Standard Command user enable ${random_userid}
42
43 # Verify maximum user count IPMI local user can have. Also verify
44 # currently enabled users.
Rahul Maheshwaric0e91ec2019-08-27 05:43:11 -050045 ${resp}= Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command user summary
Rahul Maheshwariffc77352019-02-25 09:05:27 -060046 ${enabled_user_count}=
47 ... Get Lines Containing String ${resp} Enabled User Count
48 ${maximum_ids}= Get Lines Containing String ${resp} Maximum IDs
49 Should Contain ${enabled_user_count} 2
50 Should Contain ${maximum_ids} 15
51
52
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060053Verify IPMI User Creation With Valid Name And ID
54 [Documentation] Create user via IPMI and verify.
55 [Tags] Test_IPMI_User_Creation_With_Valid_Name_And_ID
Tony Leef9379e82020-01-08 18:20:38 +080056 [Teardown] Run Keywords FFDC On Test Case Fail AND
57 ... Delete Created User ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060058
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060059 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +080060 Set Test Variable ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060061
62
63Verify IPMI User Creation With Invalid Name
64 [Documentation] Verify error while creating IPMI user with invalid
George Keishingc2a6f092019-02-20 12:26:54 -060065 ... name(e.g. user name with special characters).
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060066 [Tags] Verify_IPMI_User_Creation_With_Invalid_Name
67
Rahul Maheshwari976a1702019-02-21 01:47:58 -060068 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060069 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
70 ... user set name ${random_userid} ${invalid_username}
71 Should Contain ${msg} Invalid data
72
73
74Verify IPMI User Creation With Invalid ID
75 [Documentation] Verify error while creating IPMI user with invalid
76 ... ID(i.e. any number greater than 15 or 0).
77 [Tags] Verify_IPMI_User_Creation_With_Invalid_ID
78
79 @{id_list}= Create List
80 ${random_invalid_id}= Evaluate random.randint(16, 1000) modules=random
81 Append To List ${id_list} ${random_invalid_id}
82 Append To List ${id_list} 0
83
Sushil Singhbe97ffc2019-06-04 06:34:24 -050084 FOR ${id} IN @{id_list}
85 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
86 ... user set name ${id} newuser
Tony Leec8ed7532020-01-09 16:15:16 +080087 Should Contain Any ${msg} User ID is limited to range Parameter out of range
Sushil Singhbe97ffc2019-06-04 06:34:24 -050088 END
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060089
90Verify Setting IPMI User With Invalid Password
91 [Documentation] Verify error while setting IPMI user with invalid
92 ... password.
93 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password
Tony Leef9379e82020-01-08 18:20:38 +080094 [Teardown] Run Keywords FFDC On Test Case Fail AND
95 ... Delete Created User ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060096
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060097 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +080098 Set Test Variable ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060099
100 # Set invalid password for newly created user.
101 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
102 ... user set password ${random_userid} ${invalid_password}
103
Anusha Dathatria54cddc2019-08-07 10:01:16 -0500104 Should Contain ${msg} Set User Password command failed
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600105
106Verify Setting IPMI Root User With New Name
107 [Documentation] Verify error while setting IPMI root user with new
108 ... name.
109 [Tags] Verify_Setting_IPMI_Root_User_With_New_Name
110
111 # Set invalid password for newly created user.
112 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
113 ... user set name ${root_userid} abcd
114
115 Should Contain ${msg} Set User Name command failed
116
117
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600118Verify IPMI User Password Via Test Command
119 [Documentation] Verify IPMI user password using test command.
120 [Tags] Verify_IPMI_User_Password_Via_Test_Command
Tony Leef9379e82020-01-08 18:20:38 +0800121 [Teardown] Run Keywords FFDC On Test Case Fail AND
122 ... Delete Created User ${random_userid}
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600123
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600124 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800125 Set Test Variable ${random_userid}
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600126
127 # Set valid password for newly created user.
128 Run IPMI Standard Command
129 ... user set password ${random_userid} ${valid_password}
130
131 # Verify newly set password using test command.
132 ${msg}= Run IPMI Standard Command
133 ... user test ${random_userid} ${max_password_length} ${valid_password}
134
135 Should Contain ${msg} Success
136
137
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600138Verify Setting Valid Password For IPMI User
139 [Documentation] Set valid password for IPMI user and verify.
140 [Tags] Verify_Setting_Valid_Password_For_IPMI_User
Tony Leef9379e82020-01-08 18:20:38 +0800141 [Teardown] Run Keywords FFDC On Test Case Fail AND
142 ... Delete Created User ${random_userid}
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600143
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600144 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800145 Set Test Variable ${random_userid}
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600146
147 # Set valid password for newly created user.
148 Run IPMI Standard Command
149 ... user set password ${random_userid} ${valid_password}
150
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600151 Run IPMI Standard Command user enable ${random_userid}
152
Rahul Maheshwari7d232ab2019-08-29 06:44:16 -0500153 # Delay added for IPMI user to get enable
154 Sleep 5s
155
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600156 # Set admin privilege and enable IPMI messaging for newly created user
157 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
158
159 Verify IPMI Username And Password ${random_username} ${valid_password}
160
161
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600162Verify IPMI User Creation With Same Name
163 [Documentation] Verify error while creating two IPMI user with same name.
164 [Tags] Verify_IPMI_User_Creation_With_Same_Name
Tony Leef9379e82020-01-08 18:20:38 +0800165 [Teardown] Run Keywords FFDC On Test Case Fail AND
166 ... Delete Created User 2
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600167
168 ${random_username}= Generate Random String 8 [LETTERS]
169 IPMI Create User 2 ${random_username}
170
171 # Set same username for another IPMI user.
172 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
173 ... user set name 3 ${random_username}
174 Should Contain ${msg} Invalid data field in request
175
176
177Verify Setting IPMI User With Null Password
178 [Documentation] Verify error while setting IPMI user with null
179 ... password.
180 [Tags] Verify_Setting_IPMI_User_With_Null_Password
Tony Leef9379e82020-01-08 18:20:38 +0800181 [Teardown] Run Keywords FFDC On Test Case Fail AND
182 ... Delete Created User ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600183
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600184 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800185 Set Test Variable ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600186
187 # Set null password for newly created user.
188 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
189 ... user set password ${random_userid} ""
190
191 Should Contain ${msg} Invalid data field in request
192
193
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600194Verify IPMI User Deletion
195 [Documentation] Delete user via IPMI and verify.
196 [Tags] Verify_IPMI_User_Deletion
Tony Leef9379e82020-01-08 18:20:38 +0800197 [Teardown] Run Keywords FFDC On Test Case Fail AND
198 ... Delete Created User ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600199
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600200 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800201 Set Test Variable ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600202 # Delete IPMI User and verify
203 Run IPMI Standard Command user set name ${random_userid} ""
Rahul Maheshwari4f4688f2019-02-28 00:49:10 -0600204 ${user_info}= Get User Info ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600205 Should Be Equal ${user_info['user_name']} ${EMPTY}
206
207
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600208Test IPMI User Privilege Level
209 [Documentation] Verify IPMI user with user privilege can only run user level commands.
210 [Tags] Test_IPMI_User_Privilege_Level
211 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800212 [Teardown] Run Keywords FFDC On Test Case Fail AND
213 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600214
215 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
216 ${user_priv} Passed Failed Failed
217
218
219Test IPMI Operator Privilege Level
220 [Documentation] Verify IPMI user with operator privilege can only run user and operator levels commands.
221 ... level is set to operator.
222 [Tags] Test_IPMI_Operator_Privilege_Level
223 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800224 [Teardown] Run Keywords FFDC On Test Case Fail AND
225 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600226
227 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
228 ${operator_priv} Passed Passed Failed
229
230
231Test IPMI Administrator Privilege Level
232 [Documentation] Verify IPMI user with admin privilege can run all levels command.
233 [Tags] Test_IPMI_Administrator_Privilege_Level
234 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800235 [Teardown] Run Keywords FFDC On Test Case Fail AND
236 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600237
238 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
239 ${admin_level_priv} Passed Passed Passed
240
241
242Test IPMI No Access Privilege Level
243 [Documentation] Verify IPMI user with no access privilege can not run only any level command.
244 [Tags] Test_IPMI_No_Access_Privilege_Level
245 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800246 [Teardown] Run Keywords FFDC On Test Case Fail AND
247 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600248
249 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
250 ${no_access_priv} Failed Failed Failed
251
252
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600253Enable IPMI User And Verify
254 [Documentation] Enable IPMI user and verify that the user is able
255 ... to run IPMI command.
256 [Tags] Enable_IPMI_User_And_Verify
Tony Leef9379e82020-01-08 18:20:38 +0800257 [Teardown] Run Keywords FFDC On Test Case Fail AND
258 ... Delete Created User ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600259
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600260 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800261 Set Test Variable ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600262 Run IPMI Standard Command
263 ... user set password ${random_userid} ${valid_password}
264
265 # Set admin privilege and enable IPMI messaging for newly created user.
266 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
267
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600268 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500269 Sleep 5s
270
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600271 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600272
273 # Verify that enabled IPMI user is able to run IPMI command.
274 Verify IPMI Username And Password ${random_username} ${valid_password}
275
276
277Disable IPMI User And Verify
278 [Documentation] Disable IPMI user and verify that that the user
279 ... is unable to run IPMI command.
280 [Tags] Disable_IPMI_User_And_Verify
Tony Leef9379e82020-01-08 18:20:38 +0800281 [Teardown] Run Keywords FFDC On Test Case Fail AND
282 ... Delete Created User ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600283
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600284 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800285 Set Test Variable ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600286 Run IPMI Standard Command
287 ... user set password ${random_userid} ${valid_password}
288
289 # Set admin privilege and enable IPMI messaging for newly created user.
290 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
291
292 # Disable IPMI user and verify.
293 Run IPMI Standard Command user disable ${random_userid}
294 ${user_info}= Get User Info ${random_userid}
295 Should Be Equal ${user_info['enable_status']} disabled
296
297 # Verify that disabled IPMI user is unable to run IPMI command.
298 ${msg}= Run Keyword And Expect Error * Verify IPMI Username And Password
299 ... ${random_username} ${valid_password}
Rahul Maheshwaric3d1e962019-03-06 23:53:21 -0600300 Should Contain ${msg} Unable to establish IPMI
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600301
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600302
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600303Verify IPMI Root User Password Change
304 [Documentation] Change IPMI root user password and verify that
305 ... root user is able to run IPMI command.
306 [Tags] Verify_IPMI_Root_User_Password_Change
Tony Leef9379e82020-01-08 18:20:38 +0800307 [Teardown] Run Keywords FFDC On Test Case Fail AND
308 ... Wait Until Keyword Succeeds 15 sec 5 sec
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600309 ... Set Default Password For IPMI Root User
310
311 # Set new password for root user.
312 Run IPMI Standard Command
313 ... user set password ${root_userid} ${valid_password}
314
315 # Verify that root user is able to run IPMI command using new password.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500316 Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password
317 ... root ${valid_password}
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600318
319
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500320Verify Administrator And No Access Privilege For Different Channels
321 [Documentation] Set administrator and no access privilege for different channels and verify.
322 [Tags] Verify_Administrator_And_No_Access_Privilege_For_Different_Channels
Tony Leef9379e82020-01-08 18:20:38 +0800323 [Teardown] Run Keywords FFDC On Test Case Fail AND
324 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500325
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600326 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800327 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500328 Run IPMI Standard Command
329 ... user set password ${random_userid} ${valid_password}
330
331 # Set admin privilege for newly created user with channel 1.
332 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} 1
333
334 # Set no access privilege for newly created user with channel 2.
335 Set Channel Access ${random_userid} ipmi=on privilege=${no_access_priv} 2
336
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600337 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500338
339 # Verify that user is able to run administrator level IPMI command with channel 1.
340 Verify IPMI Command ${random_username} ${valid_password} Administrator 1
341
342 # Verify that user is unable to run IPMI command with channel 2.
343 Run IPMI Standard Command sel info 2 expected_rc=${1} U=${random_username} P=${valid_password}
344
345
346Verify Operator And User Privilege For Different Channels
347 [Documentation] Set operator and user privilege for different channels and verify.
348 [Tags] Verify_Operator_And_User_Privilege_For_Different_Channels
Tony Leef9379e82020-01-08 18:20:38 +0800349 [Teardown] Run Keywords FFDC On Test Case Fail AND
350 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500351
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600352 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800353 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500354 Run IPMI Standard Command
355 ... user set password ${random_userid} ${valid_password}
356
357 # Set operator privilege for newly created user with channel 1.
358 Set Channel Access ${random_userid} ipmi=on privilege=${operator_priv} 1
359
360 # Set user privilege for newly created user with channel 2.
361 Set Channel Access ${random_userid} ipmi=on privilege=${user_priv} 2
362
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600363 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500364
365 # Verify that user is able to run operator level IPMI command with channel 1.
366 Verify IPMI Command ${random_username} ${valid_password} Operator 1
367
368 # Verify that user is able to run user level IPMI command with channel 2.
369 Verify IPMI Command ${random_username} ${valid_password} User 2
370
371
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600372Verify Setting IPMI User With Max Password Length
373 [Documentation] Verify IPMI user creation with password length of 20 characters.
374 [Tags] Verify_Setting_IPMI_User_With_Max_Password_Length
375 [Template] Set User Password And Verify
376
377 # password_length password_option expected_status
378 20 20 ${True}
379
380
381Verify Setting IPMI User With Invalid Password Length
382 [Documentation] Verify that IPMI user cannot be set with 21 character password using 16 char
383 ... or 20 char password option.
384 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password_Length
385 [Template] Set User Password And Verify
386
387 # password_length password_option expected_status
388 21 16 ${False}
389 21 20 ${False}
390
391
392Verify Setting IPMI User With 16 Character Password
393 [Documentation] Verify that IPMI user can create a 16 character password using 16 char or 20
394 ... char password option.
395 [Tags] Verify_Setting_IPMI_User_With_16_Character_Password
396 [Template] Set User Password And Verify
397
398 # password_length password_option expected_status
399 16 16 ${True}
400 16 20 ${True}
401
402
403Verify Default Selection Of 16 Character Password For IPMI User
404 [Documentation] Verify that ipmitool by default opts for the 16 character option when given a
405 ... password whose length is in between 17 and 20.
406 [Tags] Verify_Default_Selection_Of_16_Character_Password_For_IPMI_User
407 [Template] Set User Password And Verify
408
409 # password_length password_option expected_status
410 17 16 ${True}
411 20 16 ${True}
412
413
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600414*** Keywords ***
415
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600416Create Random IPMI User
417 [Documentation] Create IPMI user with random username and userid and return those fields.
418
419 ${random_username}= Generate Random String 8 [LETTERS]
420 ${random_userid}= Evaluate random.randint(2, 15) modules=random
421 IPMI Create User ${random_userid} ${random_username}
422 [Return] ${random_userid} ${random_username}
423
424
425Enable IPMI User And Verify
426 [Documentation] Enable the userid and verify that it has been enabled.
427 [Arguments] ${userid}
428
429 # Description of argument(s):
430 # userid A numeric userid (e.g. "4").
431
432 Run IPMI Standard Command user enable ${userid}
433 ${user_info}= Get User Info ${userid}
434 Valid Value user_info['enable_status'] ['enabled']
435
436
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600437Set Default Password For IPMI Root User
438 [Documentation] Set default password for IPMI root user (i.e. 0penBmc).
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600439 # Set default password for root user.
440 ${result}= Run External IPMI Standard Command
441 ... user set password ${root_userid} ${OPENBMC_PASSWORD}
442 ... P=${valid_password}
443 Should Contain ${result} Set User Password command successful
444
445 # Verify that root user is able to run IPMI command using default password.
446 Verify IPMI Username And Password root ${OPENBMC_PASSWORD}
447
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600448
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600449Test IPMI User Privilege
450 [Documentation] Test IPMI user privilege by executing IPMI command with different privileges.
451 [Arguments] ${privilege_level} ${user_cmd_status} ${operator_cmd_status} ${admin_cmd_status}
452
453 # Description of argument(s):
454 # privilege_level Privilege level of IPMI user (e.g. 4, 3).
455 # user_cmd_status Expected status of IPMI command run with the "User"
456 # privilege (i.e. "Passed" or "Failed").
457 # operator_cmd_status Expected status of IPMI command run with the "Operator"
458 # privilege (i.e. "Passed" or "Failed").
459 # admin_cmd_status Expected status of IPMI command run with the "Administrator"
460 # privilege (i.e. "Passed" or "Failed").
461
462 # Create IPMI user and set valid password.
463 ${random_username}= Generate Random String 8 [LETTERS]
464 ${random_userid}= Evaluate random.randint(2, 15) modules=random
465 IPMI Create User ${random_userid} ${random_username}
Tony Leef9379e82020-01-08 18:20:38 +0800466 Set Test Variable ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600467 Run IPMI Standard Command
468 ... user set password ${random_userid} ${valid_password}
469
470 # Set privilege and enable IPMI messaging for newly created user.
471 Set Channel Access ${random_userid} ipmi=on privilege=${privilege_level}
472
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600473 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500474 Sleep 5s
475
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600476 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600477
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500478 Verify IPMI Command ${random_username} ${valid_password} User
479 ... expected_status=${user_cmd_status}
480 Verify IPMI Command ${random_username} ${valid_password} Operator
481 ... expected_status=${operator_cmd_status}
482 Verify IPMI Command ${random_username} ${valid_password} Administrator
483 ... expected_status=${admin_cmd_status}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600484
485
486Verify IPMI Command
487 [Documentation] Verify IPMI command execution with given username,
488 ... password, privilege and expected status.
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500489 [Arguments] ${username} ${password} ${privilege} ${channel}=${1} ${expected_status}=Passed
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600490 # Description of argument(s):
491 # username The user name (e.g. "root", "robert", etc.).
492 # password The user password (e.g. "0penBmc", "0penBmc1", etc.).
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600493 # privilege The session privilege for IPMI command (e.g. "User", "Operator", etc.).
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500494 # channel The user channel number (e.g. "1" or "2").
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600495 # expected_status Expected status of IPMI command run with the user
496 # of above password and privilege (i.e. "Passed" or "Failed").
497
498 ${expected_rc}= Set Variable If '${expected_status}' == 'Passed' ${0} ${1}
Rahul Maheshwariceb282e2019-09-16 00:11:41 -0500499 Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command
500 ... sel info ${channel} expected_rc=${expected_rc} U=${username} P=${password}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600501 ... L=${privilege}
502
503
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600504Set User Password And Verify
505 [Documentation] Create a user and set its password with given length and option.
506 [Arguments] ${password_length} ${password_option} ${expected_result}
Tony Leef9379e82020-01-08 18:20:38 +0800507 [Teardown] Run Keyword Delete Created User ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600508 # Description of argument(s):
509 # password_length Length of password to be generated and used (e.g. "16").
510 # password_option Password length option to be given in IPMI command (e.g. "16", "20").
511 # expected_result Expected result for setting the user's password (e.g. "True", "False").
512
513 Rprint Vars password_length password_option expected_result
514 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800515 Set Test Variable ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600516 ${password}= Get From Dictionary ${password_values} ${password_length}
517 Rprint Vars random_userid password
518
519 # Set password for newly created user.
520 ${status}= Run Keyword And Return Status Run IPMI Standard Command
521 ... user set password ${random_userid} ${password} ${password_option}
522 Rprint Vars status
523 Valid Value status [${expected_result}]
Anusha Dathatri7f810712020-01-07 04:13:16 -0600524 Return From Keyword If '${expected_result}' == '${False}'
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600525
526 # Set admin privilege and enable IPMI messaging for newly created user.
527 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
528
529 # Delay added for user privilege to get set.
530 Sleep 5s
531
532 Enable IPMI User And Verify ${random_userid}
533
534 # For password_option 16, passwords with length between 17 and 20 will be truncated.
535 # For all other cases, passwords will be retained as it is to verify.
536 ${truncated_password}= Set Variable ${password[:${password_option}]}
537 Rprint Vars truncated_password
538 ${status}= Run Keyword And Return Status Verify IPMI Username And Password ${random_username}
539 ... ${truncated_password}
540 Rprint Vars status
541 Valid Value status [${expected_result}]
542
543
Rahul Maheshwarif646baa2019-02-20 12:29:35 -0600544Test Teardown Execution
545 [Documentation] Do the test teardown execution.
546
547 FFDC On Test Case Fail
Tony Leef9379e82020-01-08 18:20:38 +0800548
549
550Delete Created User
551 [Documentation] Delete created IPMI user.
552 [Arguments] ${userid}
553 # Description of argument(s):
554 # userid The user ID (e.g. "1", "2", etc.).
555
556 Run IPMI Standard Command user set name ${userid} ""
557 Sleep 5s