blob: bbc82c224d9ae4cde0447b41ab2cda1619c874d9 [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.
Tony Lee86fd6732020-06-03 14:12:05 +080046 ${resp}= Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command
47 ... user summary ${CHANNEL_NUMBER}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060048 ${enabled_user_count}=
49 ... Get Lines Containing String ${resp} Enabled User Count
50 ${maximum_ids}= Get Lines Containing String ${resp} Maximum IDs
51 Should Contain ${enabled_user_count} 2
52 Should Contain ${maximum_ids} 15
53
54
Tony Lee3d351ee2020-02-19 10:21:04 +080055Verify IPMI User List
56 [Documentation] Verify user list via IPMI.
57 [Tags] Verify_IPMI_User_List
58 [Teardown] Run Keywords FFDC On Test Case Fail AND
59 ... Delete Created User ${random_userid}
60
61 ${random_userid} ${random_username}= Create Random IPMI User
62 Set Test Variable ${random_userid}
63
64 Run IPMI Standard Command
65 ... user set password ${random_userid} ${valid_password}
66 Run IPMI Standard Command user enable ${random_userid}
67 # Delay added for IPMI user to get enabled.
68 Sleep 5s
69 # Set admin privilege and enable IPMI messaging for newly created user.
70 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
71
72 ${users_access}= Get User Access Ipmi ${CHANNEL_NUMBER}
73 Rprint Vars users_access
74
75 ${index}= Evaluate ${random_userid} - 1
76 # Verify the user access of created user.
77 Valid Value users_access[${index}]['id'] ['${random_userid}']
78 Valid Value users_access[${index}]['name'] ['${random_username}']
79 Valid Value users_access[${index}]['callin'] ['true']
80 Valid Value users_access[${index}]['link'] ['false']
81 Valid Value users_access[${index}]['auth'] ['true']
82 Valid Value users_access[${index}]['ipmi'] ['ADMINISTRATOR']
83
84
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060085Verify IPMI User Creation With Valid Name And ID
86 [Documentation] Create user via IPMI and verify.
87 [Tags] Test_IPMI_User_Creation_With_Valid_Name_And_ID
Tony Leef9379e82020-01-08 18:20:38 +080088 [Teardown] Run Keywords FFDC On Test Case Fail AND
89 ... Delete Created User ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060090
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060091 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +080092 Set Test Variable ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060093
94
95Verify IPMI User Creation With Invalid Name
96 [Documentation] Verify error while creating IPMI user with invalid
George Keishingc2a6f092019-02-20 12:26:54 -060097 ... name(e.g. user name with special characters).
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060098 [Tags] Verify_IPMI_User_Creation_With_Invalid_Name
99
Rahul Maheshwari976a1702019-02-21 01:47:58 -0600100 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600101 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
102 ... user set name ${random_userid} ${invalid_username}
103 Should Contain ${msg} Invalid data
104
105
106Verify IPMI User Creation With Invalid ID
107 [Documentation] Verify error while creating IPMI user with invalid
108 ... ID(i.e. any number greater than 15 or 0).
109 [Tags] Verify_IPMI_User_Creation_With_Invalid_ID
110
111 @{id_list}= Create List
112 ${random_invalid_id}= Evaluate random.randint(16, 1000) modules=random
113 Append To List ${id_list} ${random_invalid_id}
114 Append To List ${id_list} 0
115
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500116 FOR ${id} IN @{id_list}
117 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
118 ... user set name ${id} newuser
Tony Leec8ed7532020-01-09 16:15:16 +0800119 Should Contain Any ${msg} User ID is limited to range Parameter out of range
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500120 END
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600121
122Verify Setting IPMI User With Invalid Password
123 [Documentation] Verify error while setting IPMI user with invalid
124 ... password.
125 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password
Tony Leef9379e82020-01-08 18:20:38 +0800126 [Teardown] Run Keywords FFDC On Test Case Fail AND
127 ... Delete Created User ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600128
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600129 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800130 Set Test Variable ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600131
132 # Set invalid password for newly created user.
133 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
134 ... user set password ${random_userid} ${invalid_password}
135
Anusha Dathatria54cddc2019-08-07 10:01:16 -0500136 Should Contain ${msg} Set User Password command failed
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600137
138Verify Setting IPMI Root User With New Name
139 [Documentation] Verify error while setting IPMI root user with new
140 ... name.
141 [Tags] Verify_Setting_IPMI_Root_User_With_New_Name
142
143 # Set invalid password for newly created user.
144 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
145 ... user set name ${root_userid} abcd
146
147 Should Contain ${msg} Set User Name command failed
148
149
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600150Verify IPMI User Password Via Test Command
151 [Documentation] Verify IPMI user password using test command.
152 [Tags] Verify_IPMI_User_Password_Via_Test_Command
Tony Leef9379e82020-01-08 18:20:38 +0800153 [Teardown] Run Keywords FFDC On Test Case Fail AND
154 ... Delete Created User ${random_userid}
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600155
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600156 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800157 Set Test Variable ${random_userid}
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600158
159 # Set valid password for newly created user.
160 Run IPMI Standard Command
161 ... user set password ${random_userid} ${valid_password}
162
163 # Verify newly set password using test command.
164 ${msg}= Run IPMI Standard Command
165 ... user test ${random_userid} ${max_password_length} ${valid_password}
166
167 Should Contain ${msg} Success
168
169
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600170Verify Setting Valid Password For IPMI User
171 [Documentation] Set valid password for IPMI user and verify.
172 [Tags] Verify_Setting_Valid_Password_For_IPMI_User
Tony Leef9379e82020-01-08 18:20:38 +0800173 [Teardown] Run Keywords FFDC On Test Case Fail AND
174 ... Delete Created User ${random_userid}
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600175
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600176 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800177 Set Test Variable ${random_userid}
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600178
179 # Set valid password for newly created user.
180 Run IPMI Standard Command
181 ... user set password ${random_userid} ${valid_password}
182
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600183 Run IPMI Standard Command user enable ${random_userid}
184
Rahul Maheshwari7d232ab2019-08-29 06:44:16 -0500185 # Delay added for IPMI user to get enable
186 Sleep 5s
187
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600188 # Set admin privilege and enable IPMI messaging for newly created user
189 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
190
191 Verify IPMI Username And Password ${random_username} ${valid_password}
192
193
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600194Verify IPMI User Creation With Same Name
195 [Documentation] Verify error while creating two IPMI user with same name.
196 [Tags] Verify_IPMI_User_Creation_With_Same_Name
Tony Leef9379e82020-01-08 18:20:38 +0800197 [Teardown] Run Keywords FFDC On Test Case Fail AND
198 ... Delete Created User 2
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600199
200 ${random_username}= Generate Random String 8 [LETTERS]
201 IPMI Create User 2 ${random_username}
202
203 # Set same username for another IPMI user.
204 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
205 ... user set name 3 ${random_username}
206 Should Contain ${msg} Invalid data field in request
207
208
209Verify Setting IPMI User With Null Password
210 [Documentation] Verify error while setting IPMI user with null
211 ... password.
212 [Tags] Verify_Setting_IPMI_User_With_Null_Password
Tony Leef9379e82020-01-08 18:20:38 +0800213 [Teardown] Run Keywords FFDC On Test Case Fail AND
214 ... Delete Created User ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600215
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600216 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800217 Set Test Variable ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600218
219 # Set null password for newly created user.
220 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
221 ... user set password ${random_userid} ""
222
223 Should Contain ${msg} Invalid data field in request
224
225
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600226Verify IPMI User Deletion
227 [Documentation] Delete user via IPMI and verify.
228 [Tags] Verify_IPMI_User_Deletion
Tony Leef9379e82020-01-08 18:20:38 +0800229 [Teardown] Run Keywords FFDC On Test Case Fail AND
230 ... Delete Created User ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600231
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600232 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800233 Set Test Variable ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600234 # Delete IPMI User and verify
235 Run IPMI Standard Command user set name ${random_userid} ""
Rahul Maheshwari4f4688f2019-02-28 00:49:10 -0600236 ${user_info}= Get User Info ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600237 Should Be Equal ${user_info['user_name']} ${EMPTY}
238
239
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600240Test IPMI User Privilege Level
241 [Documentation] Verify IPMI user with user privilege can only run user level commands.
242 [Tags] Test_IPMI_User_Privilege_Level
243 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800244 [Teardown] Run Keywords FFDC On Test Case Fail AND
245 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600246
247 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
248 ${user_priv} Passed Failed Failed
249
250
251Test IPMI Operator Privilege Level
252 [Documentation] Verify IPMI user with operator privilege can only run user and operator levels commands.
253 ... level is set to operator.
254 [Tags] Test_IPMI_Operator_Privilege_Level
255 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800256 [Teardown] Run Keywords FFDC On Test Case Fail AND
257 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600258
259 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
260 ${operator_priv} Passed Passed Failed
261
262
263Test IPMI Administrator Privilege Level
264 [Documentation] Verify IPMI user with admin privilege can run all levels command.
265 [Tags] Test_IPMI_Administrator_Privilege_Level
266 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800267 [Teardown] Run Keywords FFDC On Test Case Fail AND
268 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600269
270 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
271 ${admin_level_priv} Passed Passed Passed
272
273
274Test IPMI No Access Privilege Level
275 [Documentation] Verify IPMI user with no access privilege can not run only any level command.
276 [Tags] Test_IPMI_No_Access_Privilege_Level
277 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800278 [Teardown] Run Keywords FFDC On Test Case Fail AND
279 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600280
281 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
282 ${no_access_priv} Failed Failed Failed
283
284
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600285Enable IPMI User And Verify
286 [Documentation] Enable IPMI user and verify that the user is able
287 ... to run IPMI command.
288 [Tags] Enable_IPMI_User_And_Verify
Tony Leef9379e82020-01-08 18:20:38 +0800289 [Teardown] Run Keywords FFDC On Test Case Fail AND
290 ... Delete Created User ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600291
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600292 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800293 Set Test Variable ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600294 Run IPMI Standard Command
295 ... user set password ${random_userid} ${valid_password}
296
297 # Set admin privilege and enable IPMI messaging for newly created user.
298 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
299
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600300 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500301 Sleep 5s
302
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600303 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600304
305 # Verify that enabled IPMI user is able to run IPMI command.
306 Verify IPMI Username And Password ${random_username} ${valid_password}
307
308
309Disable IPMI User And Verify
310 [Documentation] Disable IPMI user and verify that that the user
311 ... is unable to run IPMI command.
312 [Tags] Disable_IPMI_User_And_Verify
Tony Leef9379e82020-01-08 18:20:38 +0800313 [Teardown] Run Keywords FFDC On Test Case Fail AND
314 ... Delete Created User ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600315
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600316 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800317 Set Test Variable ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600318 Run IPMI Standard Command
319 ... user set password ${random_userid} ${valid_password}
320
321 # Set admin privilege and enable IPMI messaging for newly created user.
322 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
323
324 # Disable IPMI user and verify.
325 Run IPMI Standard Command user disable ${random_userid}
326 ${user_info}= Get User Info ${random_userid}
327 Should Be Equal ${user_info['enable_status']} disabled
328
329 # Verify that disabled IPMI user is unable to run IPMI command.
330 ${msg}= Run Keyword And Expect Error * Verify IPMI Username And Password
331 ... ${random_username} ${valid_password}
Rahul Maheshwaric3d1e962019-03-06 23:53:21 -0600332 Should Contain ${msg} Unable to establish IPMI
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600333
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600334
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600335Verify IPMI Root User Password Change
336 [Documentation] Change IPMI root user password and verify that
337 ... root user is able to run IPMI command.
338 [Tags] Verify_IPMI_Root_User_Password_Change
Tony Leef9379e82020-01-08 18:20:38 +0800339 [Teardown] Run Keywords FFDC On Test Case Fail AND
340 ... Wait Until Keyword Succeeds 15 sec 5 sec
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600341 ... Set Default Password For IPMI Root User
342
Anusha Dathatri9f84bc82020-01-28 07:46:48 -0600343 # User input password should be minimum 8 characters long.
344 Valid Length OPENBMC_PASSWORD min_length=8
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600345 # Set new password for root user.
346 Run IPMI Standard Command
347 ... user set password ${root_userid} ${valid_password}
348
349 # Verify that root user is able to run IPMI command using new password.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500350 Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password
351 ... root ${valid_password}
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600352
353
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500354Verify Administrator And No Access Privilege For Different Channels
355 [Documentation] Set administrator and no access privilege for different channels and verify.
356 [Tags] Verify_Administrator_And_No_Access_Privilege_For_Different_Channels
Tony Leef9379e82020-01-08 18:20:38 +0800357 [Teardown] Run Keywords FFDC On Test Case Fail AND
358 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500359
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600360 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800361 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500362 Run IPMI Standard Command
363 ... user set password ${random_userid} ${valid_password}
364
365 # Set admin privilege for newly created user with channel 1.
366 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} 1
367
368 # Set no access privilege for newly created user with channel 2.
369 Set Channel Access ${random_userid} ipmi=on privilege=${no_access_priv} 2
370
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600371 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500372
373 # Verify that user is able to run administrator level IPMI command with channel 1.
374 Verify IPMI Command ${random_username} ${valid_password} Administrator 1
375
376 # Verify that user is unable to run IPMI command with channel 2.
377 Run IPMI Standard Command sel info 2 expected_rc=${1} U=${random_username} P=${valid_password}
378
379
380Verify Operator And User Privilege For Different Channels
381 [Documentation] Set operator and user privilege for different channels and verify.
382 [Tags] Verify_Operator_And_User_Privilege_For_Different_Channels
Tony Leef9379e82020-01-08 18:20:38 +0800383 [Teardown] Run Keywords FFDC On Test Case Fail AND
384 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500385
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600386 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800387 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500388 Run IPMI Standard Command
389 ... user set password ${random_userid} ${valid_password}
390
391 # Set operator privilege for newly created user with channel 1.
392 Set Channel Access ${random_userid} ipmi=on privilege=${operator_priv} 1
393
394 # Set user privilege for newly created user with channel 2.
395 Set Channel Access ${random_userid} ipmi=on privilege=${user_priv} 2
396
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600397 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500398
399 # Verify that user is able to run operator level IPMI command with channel 1.
400 Verify IPMI Command ${random_username} ${valid_password} Operator 1
401
402 # Verify that user is able to run user level IPMI command with channel 2.
403 Verify IPMI Command ${random_username} ${valid_password} User 2
404
405
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600406Verify Setting IPMI User With Max Password Length
407 [Documentation] Verify IPMI user creation with password length of 20 characters.
408 [Tags] Verify_Setting_IPMI_User_With_Max_Password_Length
409 [Template] Set User Password And Verify
410
411 # password_length password_option expected_status
412 20 20 ${True}
413
414
415Verify Setting IPMI User With Invalid Password Length
416 [Documentation] Verify that IPMI user cannot be set with 21 character password using 16 char
417 ... or 20 char password option.
418 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password_Length
419 [Template] Set User Password And Verify
420
421 # password_length password_option expected_status
422 21 16 ${False}
423 21 20 ${False}
424
425
426Verify Setting IPMI User With 16 Character Password
427 [Documentation] Verify that IPMI user can create a 16 character password using 16 char or 20
428 ... char password option.
429 [Tags] Verify_Setting_IPMI_User_With_16_Character_Password
430 [Template] Set User Password And Verify
431
432 # password_length password_option expected_status
433 16 16 ${True}
434 16 20 ${True}
435
436
437Verify Default Selection Of 16 Character Password For IPMI User
438 [Documentation] Verify that ipmitool by default opts for the 16 character option when given a
439 ... password whose length is in between 17 and 20.
440 [Tags] Verify_Default_Selection_Of_16_Character_Password_For_IPMI_User
441 [Template] Set User Password And Verify
442
443 # password_length password_option expected_status
444 17 16 ${True}
445 20 16 ${True}
446
447
Anusha Dathatri466816f2020-01-30 05:12:36 -0600448Verify Minimum Password Length For IPMI User
449 [Documentation] Verify minimum password length of 8 characters.
450 [Tags] Verify_Minimum_Password_Length_For_IPMI_User
451 [Template] Set User Password And Verify
452
453 # password_length password_option expected_status
454 7 16 ${False}
455 8 16 ${True}
456 7 20 ${False}
457 8 20 ${True}
458
459
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600460*** Keywords ***
461
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600462Create Random IPMI User
463 [Documentation] Create IPMI user with random username and userid and return those fields.
464
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}
468 [Return] ${random_userid} ${random_username}
469
470
471Enable IPMI User And Verify
472 [Documentation] Enable the userid and verify that it has been enabled.
473 [Arguments] ${userid}
474
475 # Description of argument(s):
476 # userid A numeric userid (e.g. "4").
477
478 Run IPMI Standard Command user enable ${userid}
479 ${user_info}= Get User Info ${userid}
480 Valid Value user_info['enable_status'] ['enabled']
481
482
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600483Set Default Password For IPMI Root User
484 [Documentation] Set default password for IPMI root user (i.e. 0penBmc).
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600485 # Set default password for root user.
486 ${result}= Run External IPMI Standard Command
487 ... user set password ${root_userid} ${OPENBMC_PASSWORD}
488 ... P=${valid_password}
489 Should Contain ${result} Set User Password command successful
490
491 # Verify that root user is able to run IPMI command using default password.
492 Verify IPMI Username And Password root ${OPENBMC_PASSWORD}
493
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600494
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600495Test IPMI User Privilege
496 [Documentation] Test IPMI user privilege by executing IPMI command with different privileges.
497 [Arguments] ${privilege_level} ${user_cmd_status} ${operator_cmd_status} ${admin_cmd_status}
498
499 # Description of argument(s):
500 # privilege_level Privilege level of IPMI user (e.g. 4, 3).
501 # user_cmd_status Expected status of IPMI command run with the "User"
502 # privilege (i.e. "Passed" or "Failed").
503 # operator_cmd_status Expected status of IPMI command run with the "Operator"
504 # privilege (i.e. "Passed" or "Failed").
505 # admin_cmd_status Expected status of IPMI command run with the "Administrator"
506 # privilege (i.e. "Passed" or "Failed").
507
508 # Create IPMI user and set valid password.
509 ${random_username}= Generate Random String 8 [LETTERS]
510 ${random_userid}= Evaluate random.randint(2, 15) modules=random
511 IPMI Create User ${random_userid} ${random_username}
Tony Leef9379e82020-01-08 18:20:38 +0800512 Set Test Variable ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600513 Run IPMI Standard Command
514 ... user set password ${random_userid} ${valid_password}
515
516 # Set privilege and enable IPMI messaging for newly created user.
517 Set Channel Access ${random_userid} ipmi=on privilege=${privilege_level}
518
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600519 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500520 Sleep 5s
521
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600522 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600523
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500524 Verify IPMI Command ${random_username} ${valid_password} User
525 ... expected_status=${user_cmd_status}
526 Verify IPMI Command ${random_username} ${valid_password} Operator
527 ... expected_status=${operator_cmd_status}
528 Verify IPMI Command ${random_username} ${valid_password} Administrator
529 ... expected_status=${admin_cmd_status}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600530
531
532Verify IPMI Command
533 [Documentation] Verify IPMI command execution with given username,
534 ... password, privilege and expected status.
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500535 [Arguments] ${username} ${password} ${privilege} ${channel}=${1} ${expected_status}=Passed
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600536 # Description of argument(s):
537 # username The user name (e.g. "root", "robert", etc.).
538 # password The user password (e.g. "0penBmc", "0penBmc1", etc.).
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600539 # privilege The session privilege for IPMI command (e.g. "User", "Operator", etc.).
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500540 # channel The user channel number (e.g. "1" or "2").
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600541 # expected_status Expected status of IPMI command run with the user
542 # of above password and privilege (i.e. "Passed" or "Failed").
543
544 ${expected_rc}= Set Variable If '${expected_status}' == 'Passed' ${0} ${1}
Rahul Maheshwariceb282e2019-09-16 00:11:41 -0500545 Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command
546 ... sel info ${channel} expected_rc=${expected_rc} U=${username} P=${password}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600547 ... L=${privilege}
548
549
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600550Set User Password And Verify
551 [Documentation] Create a user and set its password with given length and option.
552 [Arguments] ${password_length} ${password_option} ${expected_result}
Tony Leef9379e82020-01-08 18:20:38 +0800553 [Teardown] Run Keyword Delete Created User ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600554 # Description of argument(s):
555 # password_length Length of password to be generated and used (e.g. "16").
556 # password_option Password length option to be given in IPMI command (e.g. "16", "20").
557 # expected_result Expected result for setting the user's password (e.g. "True", "False").
558
559 Rprint Vars password_length password_option expected_result
560 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800561 Set Test Variable ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600562 ${password}= Get From Dictionary ${password_values} ${password_length}
563 Rprint Vars random_userid password
564
565 # Set password for newly created user.
566 ${status}= Run Keyword And Return Status Run IPMI Standard Command
567 ... user set password ${random_userid} ${password} ${password_option}
568 Rprint Vars status
569 Valid Value status [${expected_result}]
Anusha Dathatri7f810712020-01-07 04:13:16 -0600570 Return From Keyword If '${expected_result}' == '${False}'
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600571
572 # Set admin privilege and enable IPMI messaging for newly created user.
573 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
574
575 # Delay added for user privilege to get set.
576 Sleep 5s
577
578 Enable IPMI User And Verify ${random_userid}
579
580 # For password_option 16, passwords with length between 17 and 20 will be truncated.
581 # For all other cases, passwords will be retained as it is to verify.
582 ${truncated_password}= Set Variable ${password[:${password_option}]}
583 Rprint Vars truncated_password
584 ${status}= Run Keyword And Return Status Verify IPMI Username And Password ${random_username}
585 ... ${truncated_password}
586 Rprint Vars status
587 Valid Value status [${expected_result}]
588
589
Rahul Maheshwarif646baa2019-02-20 12:29:35 -0600590Test Teardown Execution
591 [Documentation] Do the test teardown execution.
592
593 FFDC On Test Case Fail
Tony Leef9379e82020-01-08 18:20:38 +0800594
595
596Delete Created User
597 [Documentation] Delete created IPMI user.
598 [Arguments] ${userid}
599 # Description of argument(s):
600 # userid The user ID (e.g. "1", "2", etc.).
601
602 Run IPMI Standard Command user set name ${userid} ""
603 Sleep 5s