blob: 5242a50844b84eadd64a37cebf76ad4f63d2a6b0 [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
chithragc0582f72021-12-08 10:34:23 -050015${new_username} newuser
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060016${root_userid} 1
17${operator_level_priv} 0x3
Rahul Maheshwaric05bf562019-03-01 04:02:53 -060018${user_priv} 2
19${operator_priv} 3
Rahul Maheshwarief0a7352019-02-20 11:07:48 -060020${admin_level_priv} 4
Rahul Maheshwaric05bf562019-03-01 04:02:53 -060021${no_access_priv} 15
Rahul Maheshwaric19f8382019-02-20 08:19:22 -060022${valid_password} 0penBmc1
23${max_password_length} 20
Rahul Maheshwarief0a7352019-02-20 11:07:48 -060024${ipmi_setaccess_cmd} channel setaccess
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060025&{password_values} 16=0penBmc10penBmc2 17=0penBmc10penBmc2B
26 ... 20=0penBmc10penBmc2Bmc3 21=0penBmc10penBmc2Bmc34
Anusha Dathatri466816f2020-01-30 05:12:36 -060027 ... 7=0penBmc 8=0penBmc0
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060028
Ashwini Chandrappa5cefabf2021-08-30 23:48:14 -050029# User defined count.
30${USER_LOOP_COUNT} 20
31
Rahul Maheshwaridd63c742019-02-27 23:03:54 -060032
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060033*** Test Cases ***
34
Rahul Maheshwariffc77352019-02-25 09:05:27 -060035Verify IPMI User Summary
36 [Documentation] Verify IPMI maximum supported IPMI user ID and
37 ... enabled user form user summary
38 [Tags] Verify_IPMI_User_Summary
Tony Leef9379e82020-01-08 18:20:38 +080039 [Teardown] Run Keywords FFDC On Test Case Fail AND
40 ... Delete Created User ${random_userid}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060041 # Delete all non-root IPMI (i.e. except userid 1)
42 Delete All Non Root IPMI User
43
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060044 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +080045 Set Test Variable ${random_userid}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060046 Run IPMI Standard Command user enable ${random_userid}
47
48 # Verify maximum user count IPMI local user can have. Also verify
49 # currently enabled users.
Tony Lee86fd6732020-06-03 14:12:05 +080050 ${resp}= Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command
51 ... user summary ${CHANNEL_NUMBER}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060052 ${enabled_user_count}=
53 ... Get Lines Containing String ${resp} Enabled User Count
54 ${maximum_ids}= Get Lines Containing String ${resp} Maximum IDs
55 Should Contain ${enabled_user_count} 2
56 Should Contain ${maximum_ids} 15
57
58
Tony Lee3d351ee2020-02-19 10:21:04 +080059Verify IPMI User List
60 [Documentation] Verify user list via IPMI.
61 [Tags] Verify_IPMI_User_List
62 [Teardown] Run Keywords FFDC On Test Case Fail AND
63 ... Delete Created User ${random_userid}
64
65 ${random_userid} ${random_username}= Create Random IPMI User
66 Set Test Variable ${random_userid}
67
68 Run IPMI Standard Command
69 ... user set password ${random_userid} ${valid_password}
70 Run IPMI Standard Command user enable ${random_userid}
71 # Delay added for IPMI user to get enabled.
72 Sleep 5s
73 # Set admin privilege and enable IPMI messaging for newly created user.
74 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
75
76 ${users_access}= Get User Access Ipmi ${CHANNEL_NUMBER}
77 Rprint Vars users_access
78
79 ${index}= Evaluate ${random_userid} - 1
80 # Verify the user access of created user.
81 Valid Value users_access[${index}]['id'] ['${random_userid}']
82 Valid Value users_access[${index}]['name'] ['${random_username}']
83 Valid Value users_access[${index}]['callin'] ['true']
84 Valid Value users_access[${index}]['link'] ['false']
85 Valid Value users_access[${index}]['auth'] ['true']
86 Valid Value users_access[${index}]['ipmi'] ['ADMINISTRATOR']
87
88
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060089Verify IPMI User Creation With Valid Name And ID
90 [Documentation] Create user via IPMI and verify.
George Keishingb98036a2022-01-31 12:39:47 -060091 [Tags] Verify_IPMI_User_Creation_With_Valid_Name_And_ID
Tony Leef9379e82020-01-08 18:20:38 +080092 [Teardown] Run Keywords FFDC On Test Case Fail AND
93 ... Delete Created User ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060094
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060095 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +080096 Set Test Variable ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060097
98
99Verify IPMI User Creation With Invalid Name
100 [Documentation] Verify error while creating IPMI user with invalid
George Keishingc2a6f092019-02-20 12:26:54 -0600101 ... name(e.g. user name with special characters).
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600102 [Tags] Verify_IPMI_User_Creation_With_Invalid_Name
103
Rahul Maheshwari976a1702019-02-21 01:47:58 -0600104 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600105 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
106 ... user set name ${random_userid} ${invalid_username}
107 Should Contain ${msg} Invalid data
108
109
110Verify IPMI User Creation With Invalid ID
111 [Documentation] Verify error while creating IPMI user with invalid
112 ... ID(i.e. any number greater than 15 or 0).
113 [Tags] Verify_IPMI_User_Creation_With_Invalid_ID
114
115 @{id_list}= Create List
116 ${random_invalid_id}= Evaluate random.randint(16, 1000) modules=random
117 Append To List ${id_list} ${random_invalid_id}
118 Append To List ${id_list} 0
119
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500120 FOR ${id} IN @{id_list}
121 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
122 ... user set name ${id} newuser
Tony Leec8ed7532020-01-09 16:15:16 +0800123 Should Contain Any ${msg} User ID is limited to range Parameter out of range
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500124 END
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600125
126Verify Setting IPMI User With Invalid Password
127 [Documentation] Verify error while setting IPMI user with invalid
128 ... password.
129 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password
Tony Leef9379e82020-01-08 18:20:38 +0800130 [Teardown] Run Keywords FFDC On Test Case Fail AND
131 ... Delete Created User ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600132
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600133 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800134 Set Test Variable ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600135
136 # Set invalid password for newly created user.
137 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
138 ... user set password ${random_userid} ${invalid_password}
139
Sushma M M97fccae2020-07-27 14:55:19 -0500140 # Delay added for user password to get set.
141 Sleep 5s
142
Anusha Dathatria54cddc2019-08-07 10:01:16 -0500143 Should Contain ${msg} Set User Password command failed
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600144
145Verify Setting IPMI Root User With New Name
146 [Documentation] Verify error while setting IPMI root user with new
147 ... name.
148 [Tags] Verify_Setting_IPMI_Root_User_With_New_Name
149
150 # Set invalid password for newly created user.
151 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
152 ... user set name ${root_userid} abcd
153
154 Should Contain ${msg} Set User Name command failed
155
156
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600157Verify IPMI User Password Via Test Command
158 [Documentation] Verify IPMI user password using test command.
159 [Tags] Verify_IPMI_User_Password_Via_Test_Command
Tony Leef9379e82020-01-08 18:20:38 +0800160 [Teardown] Run Keywords FFDC On Test Case Fail AND
161 ... Delete Created User ${random_userid}
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600162
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600163 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800164 Set Test Variable ${random_userid}
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600165
166 # Set valid password for newly created user.
167 Run IPMI Standard Command
168 ... user set password ${random_userid} ${valid_password}
169
170 # Verify newly set password using test command.
171 ${msg}= Run IPMI Standard Command
172 ... user test ${random_userid} ${max_password_length} ${valid_password}
173
174 Should Contain ${msg} Success
175
176
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600177Verify Setting Valid Password For IPMI User
178 [Documentation] Set valid password for IPMI user and verify.
179 [Tags] Verify_Setting_Valid_Password_For_IPMI_User
Tony Leef9379e82020-01-08 18:20:38 +0800180 [Teardown] Run Keywords FFDC On Test Case Fail AND
181 ... Delete Created User ${random_userid}
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600182
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600183 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800184 Set Test Variable ${random_userid}
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600185
186 # Set valid password for newly created user.
187 Run IPMI Standard Command
188 ... user set password ${random_userid} ${valid_password}
189
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600190 Run IPMI Standard Command user enable ${random_userid}
191
Rahul Maheshwari7d232ab2019-08-29 06:44:16 -0500192 # Delay added for IPMI user to get enable
193 Sleep 5s
194
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600195 # Set admin privilege and enable IPMI messaging for newly created user
196 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
197
198 Verify IPMI Username And Password ${random_username} ${valid_password}
199
200
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600201Verify IPMI User Creation With Same Name
202 [Documentation] Verify error while creating two IPMI user with same name.
203 [Tags] Verify_IPMI_User_Creation_With_Same_Name
Tony Leef9379e82020-01-08 18:20:38 +0800204 [Teardown] Run Keywords FFDC On Test Case Fail AND
205 ... Delete Created User 2
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600206
207 ${random_username}= Generate Random String 8 [LETTERS]
208 IPMI Create User 2 ${random_username}
209
210 # Set same username for another IPMI user.
211 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
212 ... user set name 3 ${random_username}
213 Should Contain ${msg} Invalid data field in request
214
215
216Verify Setting IPMI User With Null Password
217 [Documentation] Verify error while setting IPMI user with null
218 ... password.
219 [Tags] Verify_Setting_IPMI_User_With_Null_Password
Tony Leef9379e82020-01-08 18:20:38 +0800220 [Teardown] Run Keywords FFDC On Test Case Fail AND
221 ... Delete Created User ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600222
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600223 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800224 Set Test Variable ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600225
226 # Set null password for newly created user.
227 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
228 ... user set password ${random_userid} ""
229
230 Should Contain ${msg} Invalid data field in request
231
232
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600233Verify IPMI User Deletion
234 [Documentation] Delete user via IPMI and verify.
235 [Tags] Verify_IPMI_User_Deletion
Tony Leef9379e82020-01-08 18:20:38 +0800236 [Teardown] Run Keywords FFDC On Test Case Fail AND
237 ... Delete Created User ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600238
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600239 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800240 Set Test Variable ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600241 # Delete IPMI User and verify
242 Run IPMI Standard Command user set name ${random_userid} ""
Rahul Maheshwari4f4688f2019-02-28 00:49:10 -0600243 ${user_info}= Get User Info ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600244 Should Be Equal ${user_info['user_name']} ${EMPTY}
245
246
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600247Test IPMI User Privilege Level
248 [Documentation] Verify IPMI user with user privilege can only run user level commands.
249 [Tags] Test_IPMI_User_Privilege_Level
250 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800251 [Teardown] Run Keywords FFDC On Test Case Fail AND
252 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600253
254 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
255 ${user_priv} Passed Failed Failed
256
257
258Test IPMI Operator Privilege Level
259 [Documentation] Verify IPMI user with operator privilege can only run user and operator levels commands.
260 ... level is set to operator.
261 [Tags] Test_IPMI_Operator_Privilege_Level
262 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800263 [Teardown] Run Keywords FFDC On Test Case Fail AND
264 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600265
266 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
267 ${operator_priv} Passed Passed Failed
268
269
270Test IPMI Administrator Privilege Level
271 [Documentation] Verify IPMI user with admin privilege can run all levels command.
272 [Tags] Test_IPMI_Administrator_Privilege_Level
273 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800274 [Teardown] Run Keywords FFDC On Test Case Fail AND
275 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600276
277 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
278 ${admin_level_priv} Passed Passed Passed
279
280
281Test IPMI No Access Privilege Level
282 [Documentation] Verify IPMI user with no access privilege can not run only any level command.
283 [Tags] Test_IPMI_No_Access_Privilege_Level
284 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800285 [Teardown] Run Keywords FFDC On Test Case Fail AND
286 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600287
288 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
289 ${no_access_priv} Failed Failed Failed
290
291
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600292Enable IPMI User And Verify
293 [Documentation] Enable IPMI user and verify that the user is able
294 ... to run IPMI command.
295 [Tags] Enable_IPMI_User_And_Verify
Tony Leef9379e82020-01-08 18:20:38 +0800296 [Teardown] Run Keywords FFDC On Test Case Fail AND
297 ... Delete Created User ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600298
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600299 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800300 Set Test Variable ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600301 Run IPMI Standard Command
302 ... user set password ${random_userid} ${valid_password}
303
304 # Set admin privilege and enable IPMI messaging for newly created user.
305 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
306
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600307 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500308 Sleep 5s
309
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600310 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600311
312 # Verify that enabled IPMI user is able to run IPMI command.
313 Verify IPMI Username And Password ${random_username} ${valid_password}
314
315
316Disable IPMI User And Verify
317 [Documentation] Disable IPMI user and verify that that the user
318 ... is unable to run IPMI command.
319 [Tags] Disable_IPMI_User_And_Verify
Tony Leef9379e82020-01-08 18:20:38 +0800320 [Teardown] Run Keywords FFDC On Test Case Fail AND
321 ... Delete Created User ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600322
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600323 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800324 Set Test Variable ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600325 Run IPMI Standard Command
326 ... user set password ${random_userid} ${valid_password}
327
328 # Set admin privilege and enable IPMI messaging for newly created user.
329 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
330
331 # Disable IPMI user and verify.
332 Run IPMI Standard Command user disable ${random_userid}
333 ${user_info}= Get User Info ${random_userid}
334 Should Be Equal ${user_info['enable_status']} disabled
335
336 # Verify that disabled IPMI user is unable to run IPMI command.
337 ${msg}= Run Keyword And Expect Error * Verify IPMI Username And Password
338 ... ${random_username} ${valid_password}
Rahul Maheshwaric3d1e962019-03-06 23:53:21 -0600339 Should Contain ${msg} Unable to establish IPMI
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600340
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600341
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600342Verify IPMI Root User Password Change
343 [Documentation] Change IPMI root user password and verify that
344 ... root user is able to run IPMI command.
345 [Tags] Verify_IPMI_Root_User_Password_Change
Tony Leef9379e82020-01-08 18:20:38 +0800346 [Teardown] Run Keywords FFDC On Test Case Fail AND
347 ... Wait Until Keyword Succeeds 15 sec 5 sec
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600348 ... Set Default Password For IPMI Root User
349
Anusha Dathatri9f84bc82020-01-28 07:46:48 -0600350 # User input password should be minimum 8 characters long.
351 Valid Length OPENBMC_PASSWORD min_length=8
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600352 # Set new password for root user.
353 Run IPMI Standard Command
354 ... user set password ${root_userid} ${valid_password}
355
Sushma M M97fccae2020-07-27 14:55:19 -0500356 # Delay added for user password to get set.
357 Sleep 5s
358
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600359 # Verify that root user is able to run IPMI command using new password.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500360 Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password
361 ... root ${valid_password}
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600362
363
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500364Verify Administrator And No Access Privilege For Different Channels
365 [Documentation] Set administrator and no access privilege for different channels and verify.
366 [Tags] Verify_Administrator_And_No_Access_Privilege_For_Different_Channels
Tony Leef9379e82020-01-08 18:20:38 +0800367 [Teardown] Run Keywords FFDC On Test Case Fail AND
368 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500369
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600370 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800371 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500372 Run IPMI Standard Command
373 ... user set password ${random_userid} ${valid_password}
374
375 # Set admin privilege for newly created user with channel 1.
376 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} 1
377
378 # Set no access privilege for newly created user with channel 2.
379 Set Channel Access ${random_userid} ipmi=on privilege=${no_access_priv} 2
380
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600381 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500382
383 # Verify that user is able to run administrator level IPMI command with channel 1.
384 Verify IPMI Command ${random_username} ${valid_password} Administrator 1
385
386 # Verify that user is unable to run IPMI command with channel 2.
387 Run IPMI Standard Command sel info 2 expected_rc=${1} U=${random_username} P=${valid_password}
388
389
390Verify Operator And User Privilege For Different Channels
391 [Documentation] Set operator and user privilege for different channels and verify.
392 [Tags] Verify_Operator_And_User_Privilege_For_Different_Channels
Tony Leef9379e82020-01-08 18:20:38 +0800393 [Teardown] Run Keywords FFDC On Test Case Fail AND
394 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500395
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600396 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800397 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500398 Run IPMI Standard Command
399 ... user set password ${random_userid} ${valid_password}
400
401 # Set operator privilege for newly created user with channel 1.
402 Set Channel Access ${random_userid} ipmi=on privilege=${operator_priv} 1
403
404 # Set user privilege for newly created user with channel 2.
405 Set Channel Access ${random_userid} ipmi=on privilege=${user_priv} 2
406
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600407 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500408
409 # Verify that user is able to run operator level IPMI command with channel 1.
410 Verify IPMI Command ${random_username} ${valid_password} Operator 1
411
412 # Verify that user is able to run user level IPMI command with channel 2.
413 Verify IPMI Command ${random_username} ${valid_password} User 2
414
415
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600416Verify Setting IPMI User With Max Password Length
417 [Documentation] Verify IPMI user creation with password length of 20 characters.
418 [Tags] Verify_Setting_IPMI_User_With_Max_Password_Length
419 [Template] Set User Password And Verify
420
421 # password_length password_option expected_status
422 20 20 ${True}
423
424
425Verify Setting IPMI User With Invalid Password Length
426 [Documentation] Verify that IPMI user cannot be set with 21 character password using 16 char
427 ... or 20 char password option.
428 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password_Length
429 [Template] Set User Password And Verify
430
431 # password_length password_option expected_status
432 21 16 ${False}
433 21 20 ${False}
434
435
436Verify Setting IPMI User With 16 Character Password
437 [Documentation] Verify that IPMI user can create a 16 character password using 16 char or 20
438 ... char password option.
439 [Tags] Verify_Setting_IPMI_User_With_16_Character_Password
440 [Template] Set User Password And Verify
441
442 # password_length password_option expected_status
443 16 16 ${True}
444 16 20 ${True}
445
446
447Verify Default Selection Of 16 Character Password For IPMI User
448 [Documentation] Verify that ipmitool by default opts for the 16 character option when given a
449 ... password whose length is in between 17 and 20.
450 [Tags] Verify_Default_Selection_Of_16_Character_Password_For_IPMI_User
451 [Template] Set User Password And Verify
452
453 # password_length password_option expected_status
454 17 16 ${True}
455 20 16 ${True}
456
457
Anusha Dathatri466816f2020-01-30 05:12:36 -0600458Verify Minimum Password Length For IPMI User
459 [Documentation] Verify minimum password length of 8 characters.
460 [Tags] Verify_Minimum_Password_Length_For_IPMI_User
461 [Template] Set User Password And Verify
462
463 # password_length password_option expected_status
464 7 16 ${False}
465 8 16 ${True}
466 7 20 ${False}
467 8 20 ${True}
468
469
Ashwini Chandrappa5cefabf2021-08-30 23:48:14 -0500470Verify Continuous IPMI Command Execution
471 [Documentation] Verify that continuous IPMI command execution runs fine.
472 [Tags] Verify_Continuous_IPMI_Command_Execution
473
474 FOR ${i} IN RANGE ${USER_LOOP_COUNT}
475 Run IPMI Standard Command lan print
476 Run IPMI Standard Command power status
477 Run IPMI Standard Command fru list
478 Run IPMI Standard Command sel list
479 END
480
481
chithragc0582f72021-12-08 10:34:23 -0500482Modify IPMI User
483 [Documentation] Verify modified IPMI user is communicating via IPMI.
484 [Tags] Modify_IPMI_User
485 [Teardown] Run Keywords FFDC On Test Case Fail AND
486 ... Delete Created User ${random_userid}
487
488 ${random_userid} ${random_username}= Create Random IPMI User
489 Set Test Variable ${random_userid}
490 Run IPMI Standard Command
491 ... user set password ${random_userid} ${valid_password}
492
493 # Set admin privilege and enable IPMI messaging for newly created user.
494 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
495
496 # Delay added for user privilege to get set.
497 Sleep 5s
498
499 Enable IPMI User And Verify ${random_userid}
500
501 # Verify that user is able to run administrator level IPMI command.
502 Verify IPMI Command ${random_username} ${valid_password} Administrator ${CHANNEL_NUMBER}
503
504 # Set different username for same IPMI user.
505 Run IPMI Standard Command
506 ... user set name ${random_userid} ${new_username}
507
508 # Verify that user is able to run administrator level IPMI command.
509 Verify IPMI Command ${new_username} ${valid_password} Administrator ${CHANNEL_NUMBER}
510
511
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600512*** Keywords ***
513
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600514Create Random IPMI User
515 [Documentation] Create IPMI user with random username and userid and return those fields.
516
517 ${random_username}= Generate Random String 8 [LETTERS]
518 ${random_userid}= Evaluate random.randint(2, 15) modules=random
519 IPMI Create User ${random_userid} ${random_username}
520 [Return] ${random_userid} ${random_username}
521
522
523Enable IPMI User And Verify
524 [Documentation] Enable the userid and verify that it has been enabled.
525 [Arguments] ${userid}
526
527 # Description of argument(s):
528 # userid A numeric userid (e.g. "4").
529
530 Run IPMI Standard Command user enable ${userid}
531 ${user_info}= Get User Info ${userid}
532 Valid Value user_info['enable_status'] ['enabled']
533
534
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600535Set Default Password For IPMI Root User
536 [Documentation] Set default password for IPMI root user (i.e. 0penBmc).
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600537 # Set default password for root user.
538 ${result}= Run External IPMI Standard Command
539 ... user set password ${root_userid} ${OPENBMC_PASSWORD}
540 ... P=${valid_password}
541 Should Contain ${result} Set User Password command successful
542
543 # Verify that root user is able to run IPMI command using default password.
544 Verify IPMI Username And Password root ${OPENBMC_PASSWORD}
545
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600546
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600547Test IPMI User Privilege
548 [Documentation] Test IPMI user privilege by executing IPMI command with different privileges.
549 [Arguments] ${privilege_level} ${user_cmd_status} ${operator_cmd_status} ${admin_cmd_status}
550
551 # Description of argument(s):
552 # privilege_level Privilege level of IPMI user (e.g. 4, 3).
553 # user_cmd_status Expected status of IPMI command run with the "User"
554 # privilege (i.e. "Passed" or "Failed").
555 # operator_cmd_status Expected status of IPMI command run with the "Operator"
556 # privilege (i.e. "Passed" or "Failed").
557 # admin_cmd_status Expected status of IPMI command run with the "Administrator"
558 # privilege (i.e. "Passed" or "Failed").
559
560 # Create IPMI user and set valid password.
561 ${random_username}= Generate Random String 8 [LETTERS]
562 ${random_userid}= Evaluate random.randint(2, 15) modules=random
563 IPMI Create User ${random_userid} ${random_username}
Tony Leef9379e82020-01-08 18:20:38 +0800564 Set Test Variable ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600565 Run IPMI Standard Command
566 ... user set password ${random_userid} ${valid_password}
567
568 # Set privilege and enable IPMI messaging for newly created user.
569 Set Channel Access ${random_userid} ipmi=on privilege=${privilege_level}
570
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600571 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500572 Sleep 5s
573
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600574 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600575
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500576 Verify IPMI Command ${random_username} ${valid_password} User
577 ... expected_status=${user_cmd_status}
578 Verify IPMI Command ${random_username} ${valid_password} Operator
579 ... expected_status=${operator_cmd_status}
580 Verify IPMI Command ${random_username} ${valid_password} Administrator
581 ... expected_status=${admin_cmd_status}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600582
583
584Verify IPMI Command
585 [Documentation] Verify IPMI command execution with given username,
586 ... password, privilege and expected status.
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500587 [Arguments] ${username} ${password} ${privilege} ${channel}=${1} ${expected_status}=Passed
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600588 # Description of argument(s):
589 # username The user name (e.g. "root", "robert", etc.).
590 # password The user password (e.g. "0penBmc", "0penBmc1", etc.).
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600591 # privilege The session privilege for IPMI command (e.g. "User", "Operator", etc.).
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500592 # channel The user channel number (e.g. "1" or "2").
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600593 # expected_status Expected status of IPMI command run with the user
594 # of above password and privilege (i.e. "Passed" or "Failed").
595
596 ${expected_rc}= Set Variable If '${expected_status}' == 'Passed' ${0} ${1}
Rahul Maheshwariceb282e2019-09-16 00:11:41 -0500597 Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command
598 ... sel info ${channel} expected_rc=${expected_rc} U=${username} P=${password}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600599 ... L=${privilege}
600
601
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600602Set User Password And Verify
603 [Documentation] Create a user and set its password with given length and option.
604 [Arguments] ${password_length} ${password_option} ${expected_result}
Tony Leef9379e82020-01-08 18:20:38 +0800605 [Teardown] Run Keyword Delete Created User ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600606 # Description of argument(s):
607 # password_length Length of password to be generated and used (e.g. "16").
608 # password_option Password length option to be given in IPMI command (e.g. "16", "20").
609 # expected_result Expected result for setting the user's password (e.g. "True", "False").
610
611 Rprint Vars password_length password_option expected_result
612 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800613 Set Test Variable ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600614 ${password}= Get From Dictionary ${password_values} ${password_length}
615 Rprint Vars random_userid password
616
617 # Set password for newly created user.
618 ${status}= Run Keyword And Return Status Run IPMI Standard Command
619 ... user set password ${random_userid} ${password} ${password_option}
620 Rprint Vars status
621 Valid Value status [${expected_result}]
Anusha Dathatri7f810712020-01-07 04:13:16 -0600622 Return From Keyword If '${expected_result}' == '${False}'
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600623
624 # Set admin privilege and enable IPMI messaging for newly created user.
625 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
626
627 # Delay added for user privilege to get set.
628 Sleep 5s
629
630 Enable IPMI User And Verify ${random_userid}
631
632 # For password_option 16, passwords with length between 17 and 20 will be truncated.
633 # For all other cases, passwords will be retained as it is to verify.
634 ${truncated_password}= Set Variable ${password[:${password_option}]}
635 Rprint Vars truncated_password
636 ${status}= Run Keyword And Return Status Verify IPMI Username And Password ${random_username}
637 ... ${truncated_password}
638 Rprint Vars status
639 Valid Value status [${expected_result}]
640
641
Rahul Maheshwarif646baa2019-02-20 12:29:35 -0600642Test Teardown Execution
643 [Documentation] Do the test teardown execution.
644
645 FFDC On Test Case Fail
Tony Leef9379e82020-01-08 18:20:38 +0800646
647
648Delete Created User
649 [Documentation] Delete created IPMI user.
650 [Arguments] ${userid}
651 # Description of argument(s):
652 # userid The user ID (e.g. "1", "2", etc.).
653
654 Run IPMI Standard Command user set name ${userid} ""
Ashwini Chandrappa5cefabf2021-08-30 23:48:14 -0500655 Sleep 5s