blob: 6420166fb3c6263c087448bfe805ea1dfc6b65fb [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
Anusha Dathatri466816f2020-01-30 05:12:36 -060026 ... 7=0penBmc 8=0penBmc0
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060027
Rahul Maheshwaridd63c742019-02-27 23:03:54 -060028
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060029*** Test Cases ***
30
Rahul Maheshwariffc77352019-02-25 09:05:27 -060031Verify IPMI User Summary
32 [Documentation] Verify IPMI maximum supported IPMI user ID and
33 ... enabled user form user summary
34 [Tags] Verify_IPMI_User_Summary
Tony Leef9379e82020-01-08 18:20:38 +080035 [Teardown] Run Keywords FFDC On Test Case Fail AND
36 ... Delete Created User ${random_userid}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060037 # Delete all non-root IPMI (i.e. except userid 1)
38 Delete All Non Root IPMI User
39
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060040 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +080041 Set Test Variable ${random_userid}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060042 Run IPMI Standard Command user enable ${random_userid}
43
44 # Verify maximum user count IPMI local user can have. Also verify
45 # currently enabled users.
Rahul Maheshwaric0e91ec2019-08-27 05:43:11 -050046 ${resp}= Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command user summary
Rahul Maheshwariffc77352019-02-25 09:05:27 -060047 ${enabled_user_count}=
48 ... Get Lines Containing String ${resp} Enabled User Count
49 ${maximum_ids}= Get Lines Containing String ${resp} Maximum IDs
50 Should Contain ${enabled_user_count} 2
51 Should Contain ${maximum_ids} 15
52
53
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060054Verify IPMI User Creation With Valid Name And ID
55 [Documentation] Create user via IPMI and verify.
56 [Tags] Test_IPMI_User_Creation_With_Valid_Name_And_ID
Tony Leef9379e82020-01-08 18:20:38 +080057 [Teardown] Run Keywords FFDC On Test Case Fail AND
58 ... Delete Created User ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060059
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060060 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +080061 Set Test Variable ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060062
63
64Verify IPMI User Creation With Invalid Name
65 [Documentation] Verify error while creating IPMI user with invalid
George Keishingc2a6f092019-02-20 12:26:54 -060066 ... name(e.g. user name with special characters).
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060067 [Tags] Verify_IPMI_User_Creation_With_Invalid_Name
68
Rahul Maheshwari976a1702019-02-21 01:47:58 -060069 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060070 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
71 ... user set name ${random_userid} ${invalid_username}
72 Should Contain ${msg} Invalid data
73
74
75Verify IPMI User Creation With Invalid ID
76 [Documentation] Verify error while creating IPMI user with invalid
77 ... ID(i.e. any number greater than 15 or 0).
78 [Tags] Verify_IPMI_User_Creation_With_Invalid_ID
79
80 @{id_list}= Create List
81 ${random_invalid_id}= Evaluate random.randint(16, 1000) modules=random
82 Append To List ${id_list} ${random_invalid_id}
83 Append To List ${id_list} 0
84
Sushil Singhbe97ffc2019-06-04 06:34:24 -050085 FOR ${id} IN @{id_list}
86 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
87 ... user set name ${id} newuser
Tony Leec8ed7532020-01-09 16:15:16 +080088 Should Contain Any ${msg} User ID is limited to range Parameter out of range
Sushil Singhbe97ffc2019-06-04 06:34:24 -050089 END
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060090
91Verify Setting IPMI User With Invalid Password
92 [Documentation] Verify error while setting IPMI user with invalid
93 ... password.
94 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password
Tony Leef9379e82020-01-08 18:20:38 +080095 [Teardown] Run Keywords FFDC On Test Case Fail AND
96 ... Delete Created User ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060097
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060098 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +080099 Set Test Variable ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600100
101 # Set invalid password for newly created user.
102 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
103 ... user set password ${random_userid} ${invalid_password}
104
Anusha Dathatria54cddc2019-08-07 10:01:16 -0500105 Should Contain ${msg} Set User Password command failed
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600106
107Verify Setting IPMI Root User With New Name
108 [Documentation] Verify error while setting IPMI root user with new
109 ... name.
110 [Tags] Verify_Setting_IPMI_Root_User_With_New_Name
111
112 # Set invalid password for newly created user.
113 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
114 ... user set name ${root_userid} abcd
115
116 Should Contain ${msg} Set User Name command failed
117
118
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600119Verify IPMI User Password Via Test Command
120 [Documentation] Verify IPMI user password using test command.
121 [Tags] Verify_IPMI_User_Password_Via_Test_Command
Tony Leef9379e82020-01-08 18:20:38 +0800122 [Teardown] Run Keywords FFDC On Test Case Fail AND
123 ... Delete Created User ${random_userid}
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600124
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600125 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800126 Set Test Variable ${random_userid}
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600127
128 # Set valid password for newly created user.
129 Run IPMI Standard Command
130 ... user set password ${random_userid} ${valid_password}
131
132 # Verify newly set password using test command.
133 ${msg}= Run IPMI Standard Command
134 ... user test ${random_userid} ${max_password_length} ${valid_password}
135
136 Should Contain ${msg} Success
137
138
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600139Verify Setting Valid Password For IPMI User
140 [Documentation] Set valid password for IPMI user and verify.
141 [Tags] Verify_Setting_Valid_Password_For_IPMI_User
Tony Leef9379e82020-01-08 18:20:38 +0800142 [Teardown] Run Keywords FFDC On Test Case Fail AND
143 ... Delete Created User ${random_userid}
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600144
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600145 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800146 Set Test Variable ${random_userid}
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600147
148 # Set valid password for newly created user.
149 Run IPMI Standard Command
150 ... user set password ${random_userid} ${valid_password}
151
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600152 Run IPMI Standard Command user enable ${random_userid}
153
Rahul Maheshwari7d232ab2019-08-29 06:44:16 -0500154 # Delay added for IPMI user to get enable
155 Sleep 5s
156
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600157 # Set admin privilege and enable IPMI messaging for newly created user
158 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
159
160 Verify IPMI Username And Password ${random_username} ${valid_password}
161
162
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600163Verify IPMI User Creation With Same Name
164 [Documentation] Verify error while creating two IPMI user with same name.
165 [Tags] Verify_IPMI_User_Creation_With_Same_Name
Tony Leef9379e82020-01-08 18:20:38 +0800166 [Teardown] Run Keywords FFDC On Test Case Fail AND
167 ... Delete Created User 2
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600168
169 ${random_username}= Generate Random String 8 [LETTERS]
170 IPMI Create User 2 ${random_username}
171
172 # Set same username for another IPMI user.
173 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
174 ... user set name 3 ${random_username}
175 Should Contain ${msg} Invalid data field in request
176
177
178Verify Setting IPMI User With Null Password
179 [Documentation] Verify error while setting IPMI user with null
180 ... password.
181 [Tags] Verify_Setting_IPMI_User_With_Null_Password
Tony Leef9379e82020-01-08 18:20:38 +0800182 [Teardown] Run Keywords FFDC On Test Case Fail AND
183 ... Delete Created User ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600184
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600185 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800186 Set Test Variable ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600187
188 # Set null password for newly created user.
189 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
190 ... user set password ${random_userid} ""
191
192 Should Contain ${msg} Invalid data field in request
193
194
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600195Verify IPMI User Deletion
196 [Documentation] Delete user via IPMI and verify.
197 [Tags] Verify_IPMI_User_Deletion
Tony Leef9379e82020-01-08 18:20:38 +0800198 [Teardown] Run Keywords FFDC On Test Case Fail AND
199 ... Delete Created User ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600200
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600201 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800202 Set Test Variable ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600203 # Delete IPMI User and verify
204 Run IPMI Standard Command user set name ${random_userid} ""
Rahul Maheshwari4f4688f2019-02-28 00:49:10 -0600205 ${user_info}= Get User Info ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600206 Should Be Equal ${user_info['user_name']} ${EMPTY}
207
208
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600209Test IPMI User Privilege Level
210 [Documentation] Verify IPMI user with user privilege can only run user level commands.
211 [Tags] Test_IPMI_User_Privilege_Level
212 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800213 [Teardown] Run Keywords FFDC On Test Case Fail AND
214 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600215
216 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
217 ${user_priv} Passed Failed Failed
218
219
220Test IPMI Operator Privilege Level
221 [Documentation] Verify IPMI user with operator privilege can only run user and operator levels commands.
222 ... level is set to operator.
223 [Tags] Test_IPMI_Operator_Privilege_Level
224 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800225 [Teardown] Run Keywords FFDC On Test Case Fail AND
226 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600227
228 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
229 ${operator_priv} Passed Passed Failed
230
231
232Test IPMI Administrator Privilege Level
233 [Documentation] Verify IPMI user with admin privilege can run all levels command.
234 [Tags] Test_IPMI_Administrator_Privilege_Level
235 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800236 [Teardown] Run Keywords FFDC On Test Case Fail AND
237 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600238
239 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
240 ${admin_level_priv} Passed Passed Passed
241
242
243Test IPMI No Access Privilege Level
244 [Documentation] Verify IPMI user with no access privilege can not run only any level command.
245 [Tags] Test_IPMI_No_Access_Privilege_Level
246 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800247 [Teardown] Run Keywords FFDC On Test Case Fail AND
248 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600249
250 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
251 ${no_access_priv} Failed Failed Failed
252
253
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600254Enable IPMI User And Verify
255 [Documentation] Enable IPMI user and verify that the user is able
256 ... to run IPMI command.
257 [Tags] Enable_IPMI_User_And_Verify
Tony Leef9379e82020-01-08 18:20:38 +0800258 [Teardown] Run Keywords FFDC On Test Case Fail AND
259 ... Delete Created User ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600260
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600261 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800262 Set Test Variable ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600263 Run IPMI Standard Command
264 ... user set password ${random_userid} ${valid_password}
265
266 # Set admin privilege and enable IPMI messaging for newly created user.
267 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
268
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600269 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500270 Sleep 5s
271
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600272 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600273
274 # Verify that enabled IPMI user is able to run IPMI command.
275 Verify IPMI Username And Password ${random_username} ${valid_password}
276
277
278Disable IPMI User And Verify
279 [Documentation] Disable IPMI user and verify that that the user
280 ... is unable to run IPMI command.
281 [Tags] Disable_IPMI_User_And_Verify
Tony Leef9379e82020-01-08 18:20:38 +0800282 [Teardown] Run Keywords FFDC On Test Case Fail AND
283 ... Delete Created User ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600284
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600285 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800286 Set Test Variable ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600287 Run IPMI Standard Command
288 ... user set password ${random_userid} ${valid_password}
289
290 # Set admin privilege and enable IPMI messaging for newly created user.
291 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
292
293 # Disable IPMI user and verify.
294 Run IPMI Standard Command user disable ${random_userid}
295 ${user_info}= Get User Info ${random_userid}
296 Should Be Equal ${user_info['enable_status']} disabled
297
298 # Verify that disabled IPMI user is unable to run IPMI command.
299 ${msg}= Run Keyword And Expect Error * Verify IPMI Username And Password
300 ... ${random_username} ${valid_password}
Rahul Maheshwaric3d1e962019-03-06 23:53:21 -0600301 Should Contain ${msg} Unable to establish IPMI
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600302
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600303
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600304Verify IPMI Root User Password Change
305 [Documentation] Change IPMI root user password and verify that
306 ... root user is able to run IPMI command.
307 [Tags] Verify_IPMI_Root_User_Password_Change
Tony Leef9379e82020-01-08 18:20:38 +0800308 [Teardown] Run Keywords FFDC On Test Case Fail AND
309 ... Wait Until Keyword Succeeds 15 sec 5 sec
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600310 ... Set Default Password For IPMI Root User
311
Anusha Dathatri9f84bc82020-01-28 07:46:48 -0600312 # User input password should be minimum 8 characters long.
313 Valid Length OPENBMC_PASSWORD min_length=8
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600314 # Set new password for root user.
315 Run IPMI Standard Command
316 ... user set password ${root_userid} ${valid_password}
317
318 # Verify that root user is able to run IPMI command using new password.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500319 Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password
320 ... root ${valid_password}
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600321
322
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500323Verify Administrator And No Access Privilege For Different Channels
324 [Documentation] Set administrator and no access privilege for different channels and verify.
325 [Tags] Verify_Administrator_And_No_Access_Privilege_For_Different_Channels
Tony Leef9379e82020-01-08 18:20:38 +0800326 [Teardown] Run Keywords FFDC On Test Case Fail AND
327 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500328
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600329 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800330 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500331 Run IPMI Standard Command
332 ... user set password ${random_userid} ${valid_password}
333
334 # Set admin privilege for newly created user with channel 1.
335 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} 1
336
337 # Set no access privilege for newly created user with channel 2.
338 Set Channel Access ${random_userid} ipmi=on privilege=${no_access_priv} 2
339
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600340 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500341
342 # Verify that user is able to run administrator level IPMI command with channel 1.
343 Verify IPMI Command ${random_username} ${valid_password} Administrator 1
344
345 # Verify that user is unable to run IPMI command with channel 2.
346 Run IPMI Standard Command sel info 2 expected_rc=${1} U=${random_username} P=${valid_password}
347
348
349Verify Operator And User Privilege For Different Channels
350 [Documentation] Set operator and user privilege for different channels and verify.
351 [Tags] Verify_Operator_And_User_Privilege_For_Different_Channels
Tony Leef9379e82020-01-08 18:20:38 +0800352 [Teardown] Run Keywords FFDC On Test Case Fail AND
353 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500354
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600355 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800356 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500357 Run IPMI Standard Command
358 ... user set password ${random_userid} ${valid_password}
359
360 # Set operator privilege for newly created user with channel 1.
361 Set Channel Access ${random_userid} ipmi=on privilege=${operator_priv} 1
362
363 # Set user privilege for newly created user with channel 2.
364 Set Channel Access ${random_userid} ipmi=on privilege=${user_priv} 2
365
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600366 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500367
368 # Verify that user is able to run operator level IPMI command with channel 1.
369 Verify IPMI Command ${random_username} ${valid_password} Operator 1
370
371 # Verify that user is able to run user level IPMI command with channel 2.
372 Verify IPMI Command ${random_username} ${valid_password} User 2
373
374
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600375Verify Setting IPMI User With Max Password Length
376 [Documentation] Verify IPMI user creation with password length of 20 characters.
377 [Tags] Verify_Setting_IPMI_User_With_Max_Password_Length
378 [Template] Set User Password And Verify
379
380 # password_length password_option expected_status
381 20 20 ${True}
382
383
384Verify Setting IPMI User With Invalid Password Length
385 [Documentation] Verify that IPMI user cannot be set with 21 character password using 16 char
386 ... or 20 char password option.
387 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password_Length
388 [Template] Set User Password And Verify
389
390 # password_length password_option expected_status
391 21 16 ${False}
392 21 20 ${False}
393
394
395Verify Setting IPMI User With 16 Character Password
396 [Documentation] Verify that IPMI user can create a 16 character password using 16 char or 20
397 ... char password option.
398 [Tags] Verify_Setting_IPMI_User_With_16_Character_Password
399 [Template] Set User Password And Verify
400
401 # password_length password_option expected_status
402 16 16 ${True}
403 16 20 ${True}
404
405
406Verify Default Selection Of 16 Character Password For IPMI User
407 [Documentation] Verify that ipmitool by default opts for the 16 character option when given a
408 ... password whose length is in between 17 and 20.
409 [Tags] Verify_Default_Selection_Of_16_Character_Password_For_IPMI_User
410 [Template] Set User Password And Verify
411
412 # password_length password_option expected_status
413 17 16 ${True}
414 20 16 ${True}
415
416
Anusha Dathatri466816f2020-01-30 05:12:36 -0600417Verify Minimum Password Length For IPMI User
418 [Documentation] Verify minimum password length of 8 characters.
419 [Tags] Verify_Minimum_Password_Length_For_IPMI_User
420 [Template] Set User Password And Verify
421
422 # password_length password_option expected_status
423 7 16 ${False}
424 8 16 ${True}
425 7 20 ${False}
426 8 20 ${True}
427
428
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600429*** Keywords ***
430
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600431Create Random IPMI User
432 [Documentation] Create IPMI user with random username and userid and return those fields.
433
434 ${random_username}= Generate Random String 8 [LETTERS]
435 ${random_userid}= Evaluate random.randint(2, 15) modules=random
436 IPMI Create User ${random_userid} ${random_username}
437 [Return] ${random_userid} ${random_username}
438
439
440Enable IPMI User And Verify
441 [Documentation] Enable the userid and verify that it has been enabled.
442 [Arguments] ${userid}
443
444 # Description of argument(s):
445 # userid A numeric userid (e.g. "4").
446
447 Run IPMI Standard Command user enable ${userid}
448 ${user_info}= Get User Info ${userid}
449 Valid Value user_info['enable_status'] ['enabled']
450
451
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600452Set Default Password For IPMI Root User
453 [Documentation] Set default password for IPMI root user (i.e. 0penBmc).
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600454 # Set default password for root user.
455 ${result}= Run External IPMI Standard Command
456 ... user set password ${root_userid} ${OPENBMC_PASSWORD}
457 ... P=${valid_password}
458 Should Contain ${result} Set User Password command successful
459
460 # Verify that root user is able to run IPMI command using default password.
461 Verify IPMI Username And Password root ${OPENBMC_PASSWORD}
462
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600463
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600464Test IPMI User Privilege
465 [Documentation] Test IPMI user privilege by executing IPMI command with different privileges.
466 [Arguments] ${privilege_level} ${user_cmd_status} ${operator_cmd_status} ${admin_cmd_status}
467
468 # Description of argument(s):
469 # privilege_level Privilege level of IPMI user (e.g. 4, 3).
470 # user_cmd_status Expected status of IPMI command run with the "User"
471 # privilege (i.e. "Passed" or "Failed").
472 # operator_cmd_status Expected status of IPMI command run with the "Operator"
473 # privilege (i.e. "Passed" or "Failed").
474 # admin_cmd_status Expected status of IPMI command run with the "Administrator"
475 # privilege (i.e. "Passed" or "Failed").
476
477 # Create IPMI user and set valid password.
478 ${random_username}= Generate Random String 8 [LETTERS]
479 ${random_userid}= Evaluate random.randint(2, 15) modules=random
480 IPMI Create User ${random_userid} ${random_username}
Tony Leef9379e82020-01-08 18:20:38 +0800481 Set Test Variable ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600482 Run IPMI Standard Command
483 ... user set password ${random_userid} ${valid_password}
484
485 # Set privilege and enable IPMI messaging for newly created user.
486 Set Channel Access ${random_userid} ipmi=on privilege=${privilege_level}
487
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600488 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500489 Sleep 5s
490
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600491 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600492
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500493 Verify IPMI Command ${random_username} ${valid_password} User
494 ... expected_status=${user_cmd_status}
495 Verify IPMI Command ${random_username} ${valid_password} Operator
496 ... expected_status=${operator_cmd_status}
497 Verify IPMI Command ${random_username} ${valid_password} Administrator
498 ... expected_status=${admin_cmd_status}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600499
500
501Verify IPMI Command
502 [Documentation] Verify IPMI command execution with given username,
503 ... password, privilege and expected status.
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500504 [Arguments] ${username} ${password} ${privilege} ${channel}=${1} ${expected_status}=Passed
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600505 # Description of argument(s):
506 # username The user name (e.g. "root", "robert", etc.).
507 # password The user password (e.g. "0penBmc", "0penBmc1", etc.).
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600508 # privilege The session privilege for IPMI command (e.g. "User", "Operator", etc.).
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500509 # channel The user channel number (e.g. "1" or "2").
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600510 # expected_status Expected status of IPMI command run with the user
511 # of above password and privilege (i.e. "Passed" or "Failed").
512
513 ${expected_rc}= Set Variable If '${expected_status}' == 'Passed' ${0} ${1}
Rahul Maheshwariceb282e2019-09-16 00:11:41 -0500514 Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command
515 ... sel info ${channel} expected_rc=${expected_rc} U=${username} P=${password}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600516 ... L=${privilege}
517
518
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600519Set User Password And Verify
520 [Documentation] Create a user and set its password with given length and option.
521 [Arguments] ${password_length} ${password_option} ${expected_result}
Tony Leef9379e82020-01-08 18:20:38 +0800522 [Teardown] Run Keyword Delete Created User ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600523 # Description of argument(s):
524 # password_length Length of password to be generated and used (e.g. "16").
525 # password_option Password length option to be given in IPMI command (e.g. "16", "20").
526 # expected_result Expected result for setting the user's password (e.g. "True", "False").
527
528 Rprint Vars password_length password_option expected_result
529 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800530 Set Test Variable ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600531 ${password}= Get From Dictionary ${password_values} ${password_length}
532 Rprint Vars random_userid password
533
534 # Set password for newly created user.
535 ${status}= Run Keyword And Return Status Run IPMI Standard Command
536 ... user set password ${random_userid} ${password} ${password_option}
537 Rprint Vars status
538 Valid Value status [${expected_result}]
Anusha Dathatri7f810712020-01-07 04:13:16 -0600539 Return From Keyword If '${expected_result}' == '${False}'
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600540
541 # Set admin privilege and enable IPMI messaging for newly created user.
542 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
543
544 # Delay added for user privilege to get set.
545 Sleep 5s
546
547 Enable IPMI User And Verify ${random_userid}
548
549 # For password_option 16, passwords with length between 17 and 20 will be truncated.
550 # For all other cases, passwords will be retained as it is to verify.
551 ${truncated_password}= Set Variable ${password[:${password_option}]}
552 Rprint Vars truncated_password
553 ${status}= Run Keyword And Return Status Verify IPMI Username And Password ${random_username}
554 ... ${truncated_password}
555 Rprint Vars status
556 Valid Value status [${expected_result}]
557
558
Rahul Maheshwarif646baa2019-02-20 12:29:35 -0600559Test Teardown Execution
560 [Documentation] Do the test teardown execution.
561
562 FFDC On Test Case Fail
Tony Leef9379e82020-01-08 18:20:38 +0800563
564
565Delete Created User
566 [Documentation] Delete created IPMI user.
567 [Arguments] ${userid}
568 # Description of argument(s):
569 # userid The user ID (e.g. "1", "2", etc.).
570
571 Run IPMI Standard Command user set name ${userid} ""
572 Sleep 5s