blob: be63b6ef3e010b84f0d90e8682e58f790fd6b3e3 [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
ganesanb0ae36202022-02-17 12:14:37 +00006Resource ../lib/bmc_network_utils.robot
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -06007Library ../lib/ipmi_utils.py
Anusha Dathatridd8e7d82019-12-03 07:45:30 -06008Test Setup Printn
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -06009
Ashwini Chandrappa12be4b42022-03-15 23:02:07 -050010Suite Setup Suite Setup Execution
Rahul Maheshwarif646baa2019-02-20 12:29:35 -060011Test Teardown Test Teardown Execution
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060012
George Keishing87dc4422023-10-20 12:56:30 +053013Force Tags IPMI_User
14
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060015*** Variables ***
16
17${invalid_username} user%
18${invalid_password} abc123
chithragc0582f72021-12-08 10:34:23 -050019${new_username} newuser
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060020${root_userid} 1
21${operator_level_priv} 0x3
Rahul Maheshwaric05bf562019-03-01 04:02:53 -060022${user_priv} 2
23${operator_priv} 3
Rahul Maheshwarief0a7352019-02-20 11:07:48 -060024${admin_level_priv} 4
Rahul Maheshwaric05bf562019-03-01 04:02:53 -060025${no_access_priv} 15
Rahul Maheshwaric19f8382019-02-20 08:19:22 -060026${valid_password} 0penBmc1
27${max_password_length} 20
Rahul Maheshwarief0a7352019-02-20 11:07:48 -060028${ipmi_setaccess_cmd} channel setaccess
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060029&{password_values} 16=0penBmc10penBmc2 17=0penBmc10penBmc2B
30 ... 20=0penBmc10penBmc2Bmc3 21=0penBmc10penBmc2Bmc34
Anusha Dathatri466816f2020-01-30 05:12:36 -060031 ... 7=0penBmc 8=0penBmc0
Gene Ratzlaffa631d692022-05-05 14:40:03 -040032${expected_max_ids} 15
33${root_pattern} ^.*\\sroot\\s.*ADMINISTRATOR.*$
34${empty_name_pattern} ^User Name\\s.*\\s:\\s$
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060035
Ashwini Chandrappa5cefabf2021-08-30 23:48:14 -050036# User defined count.
37${USER_LOOP_COUNT} 20
38
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060039*** Test Cases ***
40
Rahul Maheshwariffc77352019-02-25 09:05:27 -060041Verify IPMI User Summary
42 [Documentation] Verify IPMI maximum supported IPMI user ID and
Gene Ratzlaffa631d692022-05-05 14:40:03 -040043 ... enabled user from user summary.
Rahul Maheshwariffc77352019-02-25 09:05:27 -060044 [Tags] Verify_IPMI_User_Summary
Gene Ratzlaffa631d692022-05-05 14:40:03 -040045 [Teardown] Run Keywords FFDC On Test Case Fail AND
46 ... Delete Created User ${random_userid}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060047
Gene Ratzlaffa631d692022-05-05 14:40:03 -040048 ${initial_user_count} ${maximum_ids}= Get Enabled User Count
49
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060050 ${random_userid} ${random_username}= Create Random IPMI User
Gene Ratzlaffa631d692022-05-05 14:40:03 -040051 Wait And Confirm New User Entry ${random_username}
Tony Leef9379e82020-01-08 18:20:38 +080052 Set Test Variable ${random_userid}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060053 Run IPMI Standard Command user enable ${random_userid}
54
Gene Ratzlaffa631d692022-05-05 14:40:03 -040055 # Verify number of currently enabled users.
56 ${current_user_count} ${maximum_ids}= Get Enabled User Count
57 ${calculated_count}= Evaluate ${initial_user_count} + 1
58 Should Be Equal As Integers ${current_user_count} ${calculated_count}
Ashwini Chandrappa12be4b42022-03-15 23:02:07 -050059
Gene Ratzlaffa631d692022-05-05 14:40:03 -040060 # Verify maximum user count IPMI local user can have.
61 Should Be Equal As Integers ${maximum_ids} ${expected_max_ids}
Rahul Maheshwariffc77352019-02-25 09:05:27 -060062
63
Tony Lee3d351ee2020-02-19 10:21:04 +080064Verify IPMI User List
65 [Documentation] Verify user list via IPMI.
66 [Tags] Verify_IPMI_User_List
67 [Teardown] Run Keywords FFDC On Test Case Fail AND
68 ... Delete Created User ${random_userid}
69
70 ${random_userid} ${random_username}= Create Random IPMI User
71 Set Test Variable ${random_userid}
72
73 Run IPMI Standard Command
74 ... user set password ${random_userid} ${valid_password}
75 Run IPMI Standard Command user enable ${random_userid}
76 # Delay added for IPMI user to get enabled.
77 Sleep 5s
78 # Set admin privilege and enable IPMI messaging for newly created user.
79 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
80
81 ${users_access}= Get User Access Ipmi ${CHANNEL_NUMBER}
82 Rprint Vars users_access
83
84 ${index}= Evaluate ${random_userid} - 1
85 # Verify the user access of created user.
86 Valid Value users_access[${index}]['id'] ['${random_userid}']
87 Valid Value users_access[${index}]['name'] ['${random_username}']
88 Valid Value users_access[${index}]['callin'] ['true']
89 Valid Value users_access[${index}]['link'] ['false']
90 Valid Value users_access[${index}]['auth'] ['true']
91 Valid Value users_access[${index}]['ipmi'] ['ADMINISTRATOR']
92
93
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060094Verify IPMI User Creation With Valid Name And ID
95 [Documentation] Create user via IPMI and verify.
George Keishingb98036a2022-01-31 12:39:47 -060096 [Tags] Verify_IPMI_User_Creation_With_Valid_Name_And_ID
Tony Leef9379e82020-01-08 18:20:38 +080097 [Teardown] Run Keywords FFDC On Test Case Fail AND
98 ... Delete Created User ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060099
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600100 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800101 Set Test Variable ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600102
103
104Verify IPMI User Creation With Invalid Name
105 [Documentation] Verify error while creating IPMI user with invalid
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400106 ... name (e.g. user name with special characters).
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600107 [Tags] Verify_IPMI_User_Creation_With_Invalid_Name
108
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400109 ${random_userid}= Find Free User Id
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600110 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
111 ... user set name ${random_userid} ${invalid_username}
112 Should Contain ${msg} Invalid data
113
114
115Verify IPMI User Creation With Invalid ID
116 [Documentation] Verify error while creating IPMI user with invalid
117 ... ID(i.e. any number greater than 15 or 0).
118 [Tags] Verify_IPMI_User_Creation_With_Invalid_ID
119
120 @{id_list}= Create List
121 ${random_invalid_id}= Evaluate random.randint(16, 1000) modules=random
122 Append To List ${id_list} ${random_invalid_id}
123 Append To List ${id_list} 0
124
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500125 FOR ${id} IN @{id_list}
126 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
127 ... user set name ${id} newuser
Tony Leec8ed7532020-01-09 16:15:16 +0800128 Should Contain Any ${msg} User ID is limited to range Parameter out of range
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500129 END
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600130
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400131
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600132Verify Setting IPMI User With Invalid Password
133 [Documentation] Verify error while setting IPMI user with invalid
134 ... password.
135 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password
Tony Leef9379e82020-01-08 18:20:38 +0800136 [Teardown] Run Keywords FFDC On Test Case Fail AND
137 ... Delete Created User ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600138
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600139 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800140 Set Test Variable ${random_userid}
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600141
142 # Set invalid password for newly created user.
143 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
144 ... user set password ${random_userid} ${invalid_password}
145
Sushma M M97fccae2020-07-27 14:55:19 -0500146 # Delay added for user password to get set.
147 Sleep 5s
148
Anusha Dathatria54cddc2019-08-07 10:01:16 -0500149 Should Contain ${msg} Set User Password command failed
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600150
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400151
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600152Verify Setting IPMI Root User With New Name
153 [Documentation] Verify error while setting IPMI root user with new
154 ... name.
155 [Tags] Verify_Setting_IPMI_Root_User_With_New_Name
156
157 # Set invalid password for newly created user.
158 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
159 ... user set name ${root_userid} abcd
160
161 Should Contain ${msg} Set User Name command failed
162
163
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600164Verify IPMI User Password Via Test Command
165 [Documentation] Verify IPMI user password using test command.
166 [Tags] Verify_IPMI_User_Password_Via_Test_Command
Tony Leef9379e82020-01-08 18:20:38 +0800167 [Teardown] Run Keywords FFDC On Test Case Fail AND
168 ... Delete Created User ${random_userid}
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600169
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600170 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800171 Set Test Variable ${random_userid}
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600172
173 # Set valid password for newly created user.
174 Run IPMI Standard Command
175 ... user set password ${random_userid} ${valid_password}
176
177 # Verify newly set password using test command.
178 ${msg}= Run IPMI Standard Command
179 ... user test ${random_userid} ${max_password_length} ${valid_password}
180
181 Should Contain ${msg} Success
182
183
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600184Verify Setting Valid Password For IPMI User
185 [Documentation] Set valid password for IPMI user and verify.
186 [Tags] Verify_Setting_Valid_Password_For_IPMI_User
Tony Leef9379e82020-01-08 18:20:38 +0800187 [Teardown] Run Keywords FFDC On Test Case Fail AND
188 ... Delete Created User ${random_userid}
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600189
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600190 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800191 Set Test Variable ${random_userid}
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600192
193 # Set valid password for newly created user.
194 Run IPMI Standard Command
195 ... user set password ${random_userid} ${valid_password}
196
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600197 Run IPMI Standard Command user enable ${random_userid}
198
Rahul Maheshwari7d232ab2019-08-29 06:44:16 -0500199 # Delay added for IPMI user to get enable
200 Sleep 5s
201
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600202 # Set admin privilege and enable IPMI messaging for newly created user
203 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
204
205 Verify IPMI Username And Password ${random_username} ${valid_password}
206
207
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600208Verify IPMI User Creation With Same Name
209 [Documentation] Verify error while creating two IPMI user with same name.
210 [Tags] Verify_IPMI_User_Creation_With_Same_Name
Tony Leef9379e82020-01-08 18:20:38 +0800211 [Teardown] Run Keywords FFDC On Test Case Fail AND
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400212 ... Delete Created User ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600213
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400214 ${random_userid} ${random_username}= Create Random IPMI User
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600215
216 # Set same username for another IPMI user.
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400217 ${rand_userid_two}= Find Free User Id
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600218 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400219 ... user set name ${rand_userid_two} ${random_username}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600220 Should Contain ${msg} Invalid data field in request
221
222
223Verify Setting IPMI User With Null Password
224 [Documentation] Verify error while setting IPMI user with null
225 ... password.
226 [Tags] Verify_Setting_IPMI_User_With_Null_Password
Tony Leef9379e82020-01-08 18:20:38 +0800227 [Teardown] Run Keywords FFDC On Test Case Fail AND
228 ... Delete Created User ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600229
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600230 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800231 Set Test Variable ${random_userid}
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600232
233 # Set null password for newly created user.
234 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
235 ... user set password ${random_userid} ""
236
237 Should Contain ${msg} Invalid data field in request
238
239
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600240Verify IPMI User Deletion
241 [Documentation] Delete user via IPMI and verify.
242 [Tags] Verify_IPMI_User_Deletion
Tony Leef9379e82020-01-08 18:20:38 +0800243 [Teardown] Run Keywords FFDC On Test Case Fail AND
244 ... Delete Created User ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600245
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600246 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800247 Set Test Variable ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600248 # Delete IPMI User and verify
249 Run IPMI Standard Command user set name ${random_userid} ""
Nagarjun B26499142023-02-16 15:20:14 +0530250 ${user_info}= Get User Info ${random_userid} ${CHANNEL_NUMBER}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600251 Should Be Equal ${user_info['user_name']} ${EMPTY}
252
253
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600254Test IPMI User Privilege Level
255 [Documentation] Verify IPMI user with user privilege can only run user level commands.
256 [Tags] Test_IPMI_User_Privilege_Level
257 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800258 [Teardown] Run Keywords FFDC On Test Case Fail AND
259 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600260
261 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
262 ${user_priv} Passed Failed Failed
263
264
265Test IPMI Operator Privilege Level
266 [Documentation] Verify IPMI user with operator privilege can only run user and operator levels commands.
267 ... level is set to operator.
268 [Tags] Test_IPMI_Operator_Privilege_Level
269 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800270 [Teardown] Run Keywords FFDC On Test Case Fail AND
271 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600272
273 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
274 ${operator_priv} Passed Passed Failed
275
276
277Test IPMI Administrator Privilege Level
278 [Documentation] Verify IPMI user with admin privilege can run all levels command.
279 [Tags] Test_IPMI_Administrator_Privilege_Level
280 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800281 [Teardown] Run Keywords FFDC On Test Case Fail AND
282 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600283
284 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
285 ${admin_level_priv} Passed Passed Passed
286
287
288Test IPMI No Access Privilege Level
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400289 [Documentation] Verify IPMI user with no access privilege can not run command at any level.
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600290 [Tags] Test_IPMI_No_Access_Privilege_Level
291 [Template] Test IPMI User Privilege
Tony Leef9379e82020-01-08 18:20:38 +0800292 [Teardown] Run Keywords FFDC On Test Case Fail AND
293 ... Delete Created User ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600294
295 #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status
296 ${no_access_priv} Failed Failed Failed
297
298
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600299Enable IPMI User And Verify
300 [Documentation] Enable IPMI user and verify that the user is able
301 ... to run IPMI command.
302 [Tags] Enable_IPMI_User_And_Verify
Tony Leef9379e82020-01-08 18:20:38 +0800303 [Teardown] Run Keywords FFDC On Test Case Fail AND
304 ... Delete Created User ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600305
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600306 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800307 Set Test Variable ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600308 Run IPMI Standard Command
309 ... user set password ${random_userid} ${valid_password}
310
311 # Set admin privilege and enable IPMI messaging for newly created user.
312 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
313
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600314 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500315 Sleep 5s
316
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600317 Enable IPMI User And Verify ${random_userid}
Gene Ratzlaff3a3d5d52022-05-05 08:30:52 -0400318 Wait And Confirm New Username And Password ${random_username} ${valid_password}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600319
320 # Verify that enabled IPMI user is able to run IPMI command.
321 Verify IPMI Username And Password ${random_username} ${valid_password}
322
323
324Disable IPMI User And Verify
325 [Documentation] Disable IPMI user and verify that that the user
326 ... is unable to run IPMI command.
327 [Tags] Disable_IPMI_User_And_Verify
Tony Leef9379e82020-01-08 18:20:38 +0800328 [Teardown] Run Keywords FFDC On Test Case Fail AND
329 ... Delete Created User ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600330
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600331 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800332 Set Test Variable ${random_userid}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600333 Run IPMI Standard Command
334 ... user set password ${random_userid} ${valid_password}
335
336 # Set admin privilege and enable IPMI messaging for newly created user.
337 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
338
339 # Disable IPMI user and verify.
340 Run IPMI Standard Command user disable ${random_userid}
Nagarjun B26499142023-02-16 15:20:14 +0530341 ${user_info}= Get User Info ${random_userid} ${CHANNEL_NUMBER}
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600342 Should Be Equal ${user_info['enable_status']} disabled
343
344 # Verify that disabled IPMI user is unable to run IPMI command.
345 ${msg}= Run Keyword And Expect Error * Verify IPMI Username And Password
346 ... ${random_username} ${valid_password}
Rahul Maheshwaric3d1e962019-03-06 23:53:21 -0600347 Should Contain ${msg} Unable to establish IPMI
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600348
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600349
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600350Verify IPMI Root User Password Change
351 [Documentation] Change IPMI root user password and verify that
352 ... root user is able to run IPMI command.
353 [Tags] Verify_IPMI_Root_User_Password_Change
Tony Leef9379e82020-01-08 18:20:38 +0800354 [Teardown] Run Keywords FFDC On Test Case Fail AND
355 ... Wait Until Keyword Succeeds 15 sec 5 sec
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600356 ... Set Default Password For IPMI Root User
357
Anusha Dathatri9f84bc82020-01-28 07:46:48 -0600358 # User input password should be minimum 8 characters long.
359 Valid Length OPENBMC_PASSWORD min_length=8
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600360 # Set new password for root user.
361 Run IPMI Standard Command
362 ... user set password ${root_userid} ${valid_password}
363
Sushma M M97fccae2020-07-27 14:55:19 -0500364 # Delay added for user password to get set.
365 Sleep 5s
366
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600367 # Verify that root user is able to run IPMI command using new password.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500368 Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password
369 ... root ${valid_password}
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600370
371
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500372Verify Administrator And No Access Privilege For Different Channels
373 [Documentation] Set administrator and no access privilege for different channels and verify.
374 [Tags] Verify_Administrator_And_No_Access_Privilege_For_Different_Channels
ganesanb0ae36202022-02-17 12:14:37 +0000375 [Setup] Check Active Ethernet Channels
Tony Leef9379e82020-01-08 18:20:38 +0800376 [Teardown] Run Keywords FFDC On Test Case Fail AND
377 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500378
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600379 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800380 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500381 Run IPMI Standard Command
382 ... user set password ${random_userid} ${valid_password}
383
384 # Set admin privilege for newly created user with channel 1.
ganesanb0ae36202022-02-17 12:14:37 +0000385 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} ${CHANNEL_NUMBER}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500386
387 # Set no access privilege for newly created user with channel 2.
ganesanb0ae36202022-02-17 12:14:37 +0000388 Set Channel Access ${random_userid} ipmi=on privilege=${no_access_priv} ${secondary_channel_number}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500389
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600390 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500391
392 # Verify that user is able to run administrator level IPMI command with channel 1.
ganesanb0ae36202022-02-17 12:14:37 +0000393 Verify IPMI Command ${random_username} ${valid_password} Administrator ${CHANNEL_NUMBER}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500394
395 # Verify that user is unable to run IPMI command with channel 2.
George Keishing6e641262022-05-05 10:46:22 -0500396 Run IPMI Standard Command
397 ... sel info ${secondary_channel_number} expected_rc=${1} U=${random_username} P=${valid_password}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500398
399
400Verify Operator And User Privilege For Different Channels
401 [Documentation] Set operator and user privilege for different channels and verify.
402 [Tags] Verify_Operator_And_User_Privilege_For_Different_Channels
ganesanb0ae36202022-02-17 12:14:37 +0000403 [Setup] Check Active Ethernet Channels
Tony Leef9379e82020-01-08 18:20:38 +0800404 [Teardown] Run Keywords FFDC On Test Case Fail AND
405 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500406
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600407 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800408 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500409 Run IPMI Standard Command
410 ... user set password ${random_userid} ${valid_password}
411
412 # Set operator privilege for newly created user with channel 1.
ganesanb0ae36202022-02-17 12:14:37 +0000413 Set Channel Access ${random_userid} ipmi=on privilege=${operator_priv} ${CHANNEL_NUMBER}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500414
415 # Set user privilege for newly created user with channel 2.
ganesanb0ae36202022-02-17 12:14:37 +0000416 Set Channel Access ${random_userid} ipmi=on privilege=${user_priv} ${secondary_channel_number}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500417
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600418 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500419
420 # Verify that user is able to run operator level IPMI command with channel 1.
ganesanb0ae36202022-02-17 12:14:37 +0000421 Verify IPMI Command ${random_username} ${valid_password} Operator ${CHANNEL_NUMBER}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500422
423 # Verify that user is able to run user level IPMI command with channel 2.
ganesanb0ae36202022-02-17 12:14:37 +0000424 Verify IPMI Command ${random_username} ${valid_password} User ${secondary_channel_number}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500425
426
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600427Verify Setting IPMI User With Max Password Length
428 [Documentation] Verify IPMI user creation with password length of 20 characters.
429 [Tags] Verify_Setting_IPMI_User_With_Max_Password_Length
430 [Template] Set User Password And Verify
431
432 # password_length password_option expected_status
433 20 20 ${True}
434
435
436Verify Setting IPMI User With Invalid Password Length
437 [Documentation] Verify that IPMI user cannot be set with 21 character password using 16 char
438 ... or 20 char password option.
439 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password_Length
440 [Template] Set User Password And Verify
441
442 # password_length password_option expected_status
443 21 16 ${False}
444 21 20 ${False}
445
446
447Verify Setting IPMI User With 16 Character Password
448 [Documentation] Verify that IPMI user can create a 16 character password using 16 char or 20
449 ... char password option.
450 [Tags] Verify_Setting_IPMI_User_With_16_Character_Password
451 [Template] Set User Password And Verify
452
453 # password_length password_option expected_status
454 16 16 ${True}
455 16 20 ${True}
456
457
458Verify Default Selection Of 16 Character Password For IPMI User
459 [Documentation] Verify that ipmitool by default opts for the 16 character option when given a
460 ... password whose length is in between 17 and 20.
461 [Tags] Verify_Default_Selection_Of_16_Character_Password_For_IPMI_User
462 [Template] Set User Password And Verify
463
464 # password_length password_option expected_status
465 17 16 ${True}
466 20 16 ${True}
467
468
Anusha Dathatri466816f2020-01-30 05:12:36 -0600469Verify Minimum Password Length For IPMI User
470 [Documentation] Verify minimum password length of 8 characters.
471 [Tags] Verify_Minimum_Password_Length_For_IPMI_User
472 [Template] Set User Password And Verify
473
474 # password_length password_option expected_status
475 7 16 ${False}
476 8 16 ${True}
477 7 20 ${False}
478 8 20 ${True}
479
480
Ashwini Chandrappa5cefabf2021-08-30 23:48:14 -0500481Verify Continuous IPMI Command Execution
482 [Documentation] Verify that continuous IPMI command execution runs fine.
483 [Tags] Verify_Continuous_IPMI_Command_Execution
484
485 FOR ${i} IN RANGE ${USER_LOOP_COUNT}
486 Run IPMI Standard Command lan print
487 Run IPMI Standard Command power status
488 Run IPMI Standard Command fru list
489 Run IPMI Standard Command sel list
490 END
491
492
chithragc0582f72021-12-08 10:34:23 -0500493Modify IPMI User
494 [Documentation] Verify modified IPMI user is communicating via IPMI.
495 [Tags] Modify_IPMI_User
496 [Teardown] Run Keywords FFDC On Test Case Fail AND
497 ... Delete Created User ${random_userid}
498
499 ${random_userid} ${random_username}= Create Random IPMI User
500 Set Test Variable ${random_userid}
501 Run IPMI Standard Command
502 ... user set password ${random_userid} ${valid_password}
503
504 # Set admin privilege and enable IPMI messaging for newly created user.
505 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
506
507 # Delay added for user privilege to get set.
508 Sleep 5s
509
510 Enable IPMI User And Verify ${random_userid}
511
512 # Verify that user is able to run administrator level IPMI command.
513 Verify IPMI Command ${random_username} ${valid_password} Administrator ${CHANNEL_NUMBER}
514
515 # Set different username for same IPMI user.
516 Run IPMI Standard Command
517 ... user set name ${random_userid} ${new_username}
Gene Ratzlaff3a3d5d52022-05-05 08:30:52 -0400518 Wait And Confirm New Username And Password ${new_username} ${valid_password}
chithragc0582f72021-12-08 10:34:23 -0500519
520 # Verify that user is able to run administrator level IPMI command.
521 Verify IPMI Command ${new_username} ${valid_password} Administrator ${CHANNEL_NUMBER}
522
523
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600524*** Keywords ***
525
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600526Set Default Password For IPMI Root User
527 [Documentation] Set default password for IPMI root user (i.e. 0penBmc).
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600528 # Set default password for root user.
529 ${result}= Run External IPMI Standard Command
530 ... user set password ${root_userid} ${OPENBMC_PASSWORD}
531 ... P=${valid_password}
532 Should Contain ${result} Set User Password command successful
533
534 # Verify that root user is able to run IPMI command using default password.
535 Verify IPMI Username And Password root ${OPENBMC_PASSWORD}
536
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600537
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600538Test IPMI User Privilege
539 [Documentation] Test IPMI user privilege by executing IPMI command with different privileges.
540 [Arguments] ${privilege_level} ${user_cmd_status} ${operator_cmd_status} ${admin_cmd_status}
541
542 # Description of argument(s):
543 # privilege_level Privilege level of IPMI user (e.g. 4, 3).
544 # user_cmd_status Expected status of IPMI command run with the "User"
545 # privilege (i.e. "Passed" or "Failed").
546 # operator_cmd_status Expected status of IPMI command run with the "Operator"
547 # privilege (i.e. "Passed" or "Failed").
548 # admin_cmd_status Expected status of IPMI command run with the "Administrator"
549 # privilege (i.e. "Passed" or "Failed").
550
551 # Create IPMI user and set valid password.
552 ${random_username}= Generate Random String 8 [LETTERS]
553 ${random_userid}= Evaluate random.randint(2, 15) modules=random
554 IPMI Create User ${random_userid} ${random_username}
Tony Leef9379e82020-01-08 18:20:38 +0800555 Set Test Variable ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600556 Run IPMI Standard Command
557 ... user set password ${random_userid} ${valid_password}
558
559 # Set privilege and enable IPMI messaging for newly created user.
560 Set Channel Access ${random_userid} ipmi=on privilege=${privilege_level}
561
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600562 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500563 Sleep 5s
564
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600565 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600566
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500567 Verify IPMI Command ${random_username} ${valid_password} User
568 ... expected_status=${user_cmd_status}
569 Verify IPMI Command ${random_username} ${valid_password} Operator
570 ... expected_status=${operator_cmd_status}
571 Verify IPMI Command ${random_username} ${valid_password} Administrator
572 ... expected_status=${admin_cmd_status}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600573
574
575Verify IPMI Command
576 [Documentation] Verify IPMI command execution with given username,
577 ... password, privilege and expected status.
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500578 [Arguments] ${username} ${password} ${privilege} ${channel}=${1} ${expected_status}=Passed
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600579 # Description of argument(s):
580 # username The user name (e.g. "root", "robert", etc.).
581 # password The user password (e.g. "0penBmc", "0penBmc1", etc.).
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600582 # privilege The session privilege for IPMI command (e.g. "User", "Operator", etc.).
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500583 # channel The user channel number (e.g. "1" or "2").
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600584 # expected_status Expected status of IPMI command run with the user
585 # of above password and privilege (i.e. "Passed" or "Failed").
586
587 ${expected_rc}= Set Variable If '${expected_status}' == 'Passed' ${0} ${1}
Rahul Maheshwariceb282e2019-09-16 00:11:41 -0500588 Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command
589 ... sel info ${channel} expected_rc=${expected_rc} U=${username} P=${password}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600590 ... L=${privilege}
591
592
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600593Set User Password And Verify
594 [Documentation] Create a user and set its password with given length and option.
595 [Arguments] ${password_length} ${password_option} ${expected_result}
Tony Leef9379e82020-01-08 18:20:38 +0800596 [Teardown] Run Keyword Delete Created User ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600597 # Description of argument(s):
598 # password_length Length of password to be generated and used (e.g. "16").
599 # password_option Password length option to be given in IPMI command (e.g. "16", "20").
600 # expected_result Expected result for setting the user's password (e.g. "True", "False").
601
602 Rprint Vars password_length password_option expected_result
603 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800604 Set Test Variable ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600605 ${password}= Get From Dictionary ${password_values} ${password_length}
606 Rprint Vars random_userid password
607
608 # Set password for newly created user.
609 ${status}= Run Keyword And Return Status Run IPMI Standard Command
610 ... user set password ${random_userid} ${password} ${password_option}
611 Rprint Vars status
612 Valid Value status [${expected_result}]
Anusha Dathatri7f810712020-01-07 04:13:16 -0600613 Return From Keyword If '${expected_result}' == '${False}'
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600614
615 # Set admin privilege and enable IPMI messaging for newly created user.
616 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
617
618 # Delay added for user privilege to get set.
619 Sleep 5s
620
621 Enable IPMI User And Verify ${random_userid}
622
623 # For password_option 16, passwords with length between 17 and 20 will be truncated.
624 # For all other cases, passwords will be retained as it is to verify.
625 ${truncated_password}= Set Variable ${password[:${password_option}]}
626 Rprint Vars truncated_password
627 ${status}= Run Keyword And Return Status Verify IPMI Username And Password ${random_username}
628 ... ${truncated_password}
629 Rprint Vars status
630 Valid Value status [${expected_result}]
631
632
Rahul Maheshwarif646baa2019-02-20 12:29:35 -0600633Test Teardown Execution
634 [Documentation] Do the test teardown execution.
635
636 FFDC On Test Case Fail
Tony Leef9379e82020-01-08 18:20:38 +0800637
638
ganesanb0ae36202022-02-17 12:14:37 +0000639Check Active Ethernet Channels
640 [Documentation] Check active ethernet channels and set suite variables.
641
642 ${channel_number_list}= Get Active Ethernet Channel List
643 ${channel_length}= Get Length ${channel_number_list}
644 Skip If '${channel_length}' == '1'
645 ... msg= Skips this test case as only one channel was in active.
646
647 FOR ${channel_num} IN @{channel_number_list}
648 ${secondary_channel_number}= Set Variable If ${channel_num} != ${CHANNEL_NUMBER} ${channel_num}
649 END
650
651 Set Suite Variable ${secondary_channel_number}
Ashwini Chandrappa12be4b42022-03-15 23:02:07 -0500652
653
654Suite Setup Execution
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400655 [Documentation] Make sure the enabled user count is below maximum,
656 ... and prepares administrative user list suite variables.
657
658 Check Enabled User Count
George Keishingca9a7842022-07-07 03:44:44 -0500659 # Skip root user checking if user decides not to use root user as default.
660 Run Keyword If '${IPMI_USERNAME}' == 'root' Determine Root User Id
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400661
662
663Check Enabled User Count
664 [Documentation] Ensure that there are available user IDs.
Ashwini Chandrappa12be4b42022-03-15 23:02:07 -0500665
666 # Check for the enabled user count
667 ${resp}= Run IPMI Standard Command user summary ${CHANNEL_NUMBER}
668 ${enabled_user_count}=
669 ... Get Lines Containing String ${resp} Enabled User Count
670
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400671 Should not contain ${enabled_user_count} ${expected_max_ids}
Ashwini Chandrappa12be4b42022-03-15 23:02:07 -0500672 ... msg=IPMI have reached maximum user count
George Keishing5e9fbbf2022-04-29 03:48:14 -0500673
674
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400675Determine Root User Id
676 [Documentation] Determines the user ID of the root user.
677
678 ${resp}= Wait Until Keyword Succeeds 15 sec 1 sec Run IPMI Standard Command
679 ... user list
680 @{lines}= Split To Lines ${resp}
681
682 ${root_userid}= Set Variable ${-1}
683 ${line_count}= Get Length ${lines}
684 FOR ${id_index} IN RANGE 1 ${line_count}
685 ${line}= Get From List ${lines} ${id_index}
686 ${root_found}= Get Lines Matching Regexp ${line} ${root_pattern}
687 IF '${root_found}' != '${EMPTY}'
688 ${root_userid}= Set Variable ${id_index}
George Keishinge9e44c42022-05-26 08:41:39 -0500689 Exit For Loop
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400690 END
691 END
692 Set Suite Variable ${root_userid}
693
694 Log To Console The root user ID is ${root_userid}.
695 Run Keyword If ${root_userid} < ${1} Fail msg= Did not identify root user ID.
696
697
Gene Ratzlaff3a3d5d52022-05-05 08:30:52 -0400698Wait And Confirm New Username And Password
George Keishing5e9fbbf2022-04-29 03:48:14 -0500699 [Documentation] Wait in loop trying to to confirm Username And Password.
700 [Arguments] ${username} ${password}
701
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400702 # Description of argument(s):
703 # username The user name (e.g. "root", "robert", etc.).
704 # password The user password (e.g. "0penBmc", "0penBmc1", etc.).
705
George Keishing5e9fbbf2022-04-29 03:48:14 -0500706 # Give time for previous command to complete.
707 Sleep 5s
708
709 # Looping verify that root user is able to run IPMI command using new password.
710 Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password
711 ... ${username} ${password}
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400712
713
714Get Enabled User Count
715 [Documentation] Return as integers: current number of enabled users and
716 ... Maximum number of Ids.
717
718 # Isolate 'Enabled User Count' value and convert to integer
719 ${resp}= Wait Until Keyword Succeeds 15 sec 1 sec Run IPMI Standard Command
720 ... user summary ${CHANNEL_NUMBER}
721 ${user_count_line}= Get Lines Containing String ${resp} Enabled User Count
722 ${count}= Fetch From Right ${user_count_line} \:
723 ${user_count}= Convert To Integer ${count}
724
725 # Isolate 'Maximum IDs' value and convert to integer
726 ${maximum_ids}= Get Lines Containing String ${resp} Maximum IDs
727 ${max_ids}= Fetch From Right ${maximum_ids} \:
728 ${int_maximum_ids_count}= Convert To Integer ${max_ids}
729
730 [Return] ${user_count} ${int_maximum_ids_count}
731
732
733Wait And Confirm New User Entry
734 [Documentation] Wait in loop until new user appears with given username.
735 [Arguments] ${username}
736
737 # Description of argument(s):
738 # username The user name (e.g. "root", "robert", etc.).
739
740 Wait Until Keyword Succeeds 45 sec 1 sec Verify IPMI Username Visible
741 ... ${username}
742
743
744Verify IPMI Username Visible
745 [Documentation] Confirm that username is present in user list.
746 [Arguments] ${username}
747
748 # Description of argument(s):
749 # username The user name (e.g. "root", "robert", etc.).
750
751 ${resp}= Run IPMI Standard Command user list
752 Should Contain ${resp} ${username}
753
754
755Find Free User Id
756 [Documentation] Find a user ID that is not being used.
757
758 Check Enabled User Count
759 FOR ${num} IN RANGE 300
760 ${random_userid}= Evaluate random.randint(1, ${expected_max_ids}) modules=random
Nagarjun B26499142023-02-16 15:20:14 +0530761 ${access}= Run IPMI Standard Command channel getaccess ${CHANNEL_NUMBER} ${random_userid}
Gene Ratzlaffa631d692022-05-05 14:40:03 -0400762
763 ${name_line}= Get Lines Containing String ${access} User Name
764 Log To Console For ID ${random_userid}: ${name_line}
765 ${is_empty}= Run Keyword And Return Status
766 ... Should Match Regexp ${name_line} ${empty_name_pattern}
767
768 Exit For Loop If ${is_empty} == ${True}
769 END
George Keishingca9a7842022-07-07 03:44:44 -0500770 [Return] ${random_userid}