blob: a684286a1db61f8f5276724b727334d17ecb4c24 [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
Anusha Dathatri9f84bc82020-01-28 07:46:48 -0600311 # User input password should be minimum 8 characters long.
312 Valid Length OPENBMC_PASSWORD min_length=8
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600313 # Set new password for root user.
314 Run IPMI Standard Command
315 ... user set password ${root_userid} ${valid_password}
316
317 # Verify that root user is able to run IPMI command using new password.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500318 Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password
319 ... root ${valid_password}
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600320
321
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500322Verify Administrator And No Access Privilege For Different Channels
323 [Documentation] Set administrator and no access privilege for different channels and verify.
324 [Tags] Verify_Administrator_And_No_Access_Privilege_For_Different_Channels
Tony Leef9379e82020-01-08 18:20:38 +0800325 [Teardown] Run Keywords FFDC On Test Case Fail AND
326 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500327
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600328 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800329 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500330 Run IPMI Standard Command
331 ... user set password ${random_userid} ${valid_password}
332
333 # Set admin privilege for newly created user with channel 1.
334 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} 1
335
336 # Set no access privilege for newly created user with channel 2.
337 Set Channel Access ${random_userid} ipmi=on privilege=${no_access_priv} 2
338
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600339 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500340
341 # Verify that user is able to run administrator level IPMI command with channel 1.
342 Verify IPMI Command ${random_username} ${valid_password} Administrator 1
343
344 # Verify that user is unable to run IPMI command with channel 2.
345 Run IPMI Standard Command sel info 2 expected_rc=${1} U=${random_username} P=${valid_password}
346
347
348Verify Operator And User Privilege For Different Channels
349 [Documentation] Set operator and user privilege for different channels and verify.
350 [Tags] Verify_Operator_And_User_Privilege_For_Different_Channels
Tony Leef9379e82020-01-08 18:20:38 +0800351 [Teardown] Run Keywords FFDC On Test Case Fail AND
352 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500353
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600354 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800355 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500356 Run IPMI Standard Command
357 ... user set password ${random_userid} ${valid_password}
358
359 # Set operator privilege for newly created user with channel 1.
360 Set Channel Access ${random_userid} ipmi=on privilege=${operator_priv} 1
361
362 # Set user privilege for newly created user with channel 2.
363 Set Channel Access ${random_userid} ipmi=on privilege=${user_priv} 2
364
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600365 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500366
367 # Verify that user is able to run operator level IPMI command with channel 1.
368 Verify IPMI Command ${random_username} ${valid_password} Operator 1
369
370 # Verify that user is able to run user level IPMI command with channel 2.
371 Verify IPMI Command ${random_username} ${valid_password} User 2
372
373
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600374Verify Setting IPMI User With Max Password Length
375 [Documentation] Verify IPMI user creation with password length of 20 characters.
376 [Tags] Verify_Setting_IPMI_User_With_Max_Password_Length
377 [Template] Set User Password And Verify
378
379 # password_length password_option expected_status
380 20 20 ${True}
381
382
383Verify Setting IPMI User With Invalid Password Length
384 [Documentation] Verify that IPMI user cannot be set with 21 character password using 16 char
385 ... or 20 char password option.
386 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password_Length
387 [Template] Set User Password And Verify
388
389 # password_length password_option expected_status
390 21 16 ${False}
391 21 20 ${False}
392
393
394Verify Setting IPMI User With 16 Character Password
395 [Documentation] Verify that IPMI user can create a 16 character password using 16 char or 20
396 ... char password option.
397 [Tags] Verify_Setting_IPMI_User_With_16_Character_Password
398 [Template] Set User Password And Verify
399
400 # password_length password_option expected_status
401 16 16 ${True}
402 16 20 ${True}
403
404
405Verify Default Selection Of 16 Character Password For IPMI User
406 [Documentation] Verify that ipmitool by default opts for the 16 character option when given a
407 ... password whose length is in between 17 and 20.
408 [Tags] Verify_Default_Selection_Of_16_Character_Password_For_IPMI_User
409 [Template] Set User Password And Verify
410
411 # password_length password_option expected_status
412 17 16 ${True}
413 20 16 ${True}
414
415
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600416*** Keywords ***
417
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600418Create Random IPMI User
419 [Documentation] Create IPMI user with random username and userid and return those fields.
420
421 ${random_username}= Generate Random String 8 [LETTERS]
422 ${random_userid}= Evaluate random.randint(2, 15) modules=random
423 IPMI Create User ${random_userid} ${random_username}
424 [Return] ${random_userid} ${random_username}
425
426
427Enable IPMI User And Verify
428 [Documentation] Enable the userid and verify that it has been enabled.
429 [Arguments] ${userid}
430
431 # Description of argument(s):
432 # userid A numeric userid (e.g. "4").
433
434 Run IPMI Standard Command user enable ${userid}
435 ${user_info}= Get User Info ${userid}
436 Valid Value user_info['enable_status'] ['enabled']
437
438
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600439Set Default Password For IPMI Root User
440 [Documentation] Set default password for IPMI root user (i.e. 0penBmc).
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600441 # Set default password for root user.
442 ${result}= Run External IPMI Standard Command
443 ... user set password ${root_userid} ${OPENBMC_PASSWORD}
444 ... P=${valid_password}
445 Should Contain ${result} Set User Password command successful
446
447 # Verify that root user is able to run IPMI command using default password.
448 Verify IPMI Username And Password root ${OPENBMC_PASSWORD}
449
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600450
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600451Test IPMI User Privilege
452 [Documentation] Test IPMI user privilege by executing IPMI command with different privileges.
453 [Arguments] ${privilege_level} ${user_cmd_status} ${operator_cmd_status} ${admin_cmd_status}
454
455 # Description of argument(s):
456 # privilege_level Privilege level of IPMI user (e.g. 4, 3).
457 # user_cmd_status Expected status of IPMI command run with the "User"
458 # privilege (i.e. "Passed" or "Failed").
459 # operator_cmd_status Expected status of IPMI command run with the "Operator"
460 # privilege (i.e. "Passed" or "Failed").
461 # admin_cmd_status Expected status of IPMI command run with the "Administrator"
462 # privilege (i.e. "Passed" or "Failed").
463
464 # Create IPMI user and set valid password.
465 ${random_username}= Generate Random String 8 [LETTERS]
466 ${random_userid}= Evaluate random.randint(2, 15) modules=random
467 IPMI Create User ${random_userid} ${random_username}
Tony Leef9379e82020-01-08 18:20:38 +0800468 Set Test Variable ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600469 Run IPMI Standard Command
470 ... user set password ${random_userid} ${valid_password}
471
472 # Set privilege and enable IPMI messaging for newly created user.
473 Set Channel Access ${random_userid} ipmi=on privilege=${privilege_level}
474
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600475 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500476 Sleep 5s
477
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600478 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600479
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500480 Verify IPMI Command ${random_username} ${valid_password} User
481 ... expected_status=${user_cmd_status}
482 Verify IPMI Command ${random_username} ${valid_password} Operator
483 ... expected_status=${operator_cmd_status}
484 Verify IPMI Command ${random_username} ${valid_password} Administrator
485 ... expected_status=${admin_cmd_status}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600486
487
488Verify IPMI Command
489 [Documentation] Verify IPMI command execution with given username,
490 ... password, privilege and expected status.
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500491 [Arguments] ${username} ${password} ${privilege} ${channel}=${1} ${expected_status}=Passed
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600492 # Description of argument(s):
493 # username The user name (e.g. "root", "robert", etc.).
494 # password The user password (e.g. "0penBmc", "0penBmc1", etc.).
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600495 # privilege The session privilege for IPMI command (e.g. "User", "Operator", etc.).
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500496 # channel The user channel number (e.g. "1" or "2").
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600497 # expected_status Expected status of IPMI command run with the user
498 # of above password and privilege (i.e. "Passed" or "Failed").
499
500 ${expected_rc}= Set Variable If '${expected_status}' == 'Passed' ${0} ${1}
Rahul Maheshwariceb282e2019-09-16 00:11:41 -0500501 Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command
502 ... sel info ${channel} expected_rc=${expected_rc} U=${username} P=${password}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600503 ... L=${privilege}
504
505
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600506Set User Password And Verify
507 [Documentation] Create a user and set its password with given length and option.
508 [Arguments] ${password_length} ${password_option} ${expected_result}
Tony Leef9379e82020-01-08 18:20:38 +0800509 [Teardown] Run Keyword Delete Created User ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600510 # Description of argument(s):
511 # password_length Length of password to be generated and used (e.g. "16").
512 # password_option Password length option to be given in IPMI command (e.g. "16", "20").
513 # expected_result Expected result for setting the user's password (e.g. "True", "False").
514
515 Rprint Vars password_length password_option expected_result
516 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800517 Set Test Variable ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600518 ${password}= Get From Dictionary ${password_values} ${password_length}
519 Rprint Vars random_userid password
520
521 # Set password for newly created user.
522 ${status}= Run Keyword And Return Status Run IPMI Standard Command
523 ... user set password ${random_userid} ${password} ${password_option}
524 Rprint Vars status
525 Valid Value status [${expected_result}]
Anusha Dathatri7f810712020-01-07 04:13:16 -0600526 Return From Keyword If '${expected_result}' == '${False}'
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600527
528 # Set admin privilege and enable IPMI messaging for newly created user.
529 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
530
531 # Delay added for user privilege to get set.
532 Sleep 5s
533
534 Enable IPMI User And Verify ${random_userid}
535
536 # For password_option 16, passwords with length between 17 and 20 will be truncated.
537 # For all other cases, passwords will be retained as it is to verify.
538 ${truncated_password}= Set Variable ${password[:${password_option}]}
539 Rprint Vars truncated_password
540 ${status}= Run Keyword And Return Status Verify IPMI Username And Password ${random_username}
541 ... ${truncated_password}
542 Rprint Vars status
543 Valid Value status [${expected_result}]
544
545
Rahul Maheshwarif646baa2019-02-20 12:29:35 -0600546Test Teardown Execution
547 [Documentation] Do the test teardown execution.
548
549 FFDC On Test Case Fail
Tony Leef9379e82020-01-08 18:20:38 +0800550
551
552Delete Created User
553 [Documentation] Delete created IPMI user.
554 [Arguments] ${userid}
555 # Description of argument(s):
556 # userid The user ID (e.g. "1", "2", etc.).
557
558 Run IPMI Standard Command user set name ${userid} ""
559 Sleep 5s