blob: a9d1857dc1b9f6d02d6c3236ba4e6804aa12df8b [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
Rahul Maheshwarif646baa2019-02-20 12:29:35 -060010Test Teardown Test Teardown Execution
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060011
12*** Variables ***
13
14${invalid_username} user%
15${invalid_password} abc123
chithragc0582f72021-12-08 10:34:23 -050016${new_username} newuser
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060017${root_userid} 1
18${operator_level_priv} 0x3
Rahul Maheshwaric05bf562019-03-01 04:02:53 -060019${user_priv} 2
20${operator_priv} 3
Rahul Maheshwarief0a7352019-02-20 11:07:48 -060021${admin_level_priv} 4
Rahul Maheshwaric05bf562019-03-01 04:02:53 -060022${no_access_priv} 15
Rahul Maheshwaric19f8382019-02-20 08:19:22 -060023${valid_password} 0penBmc1
24${max_password_length} 20
Rahul Maheshwarief0a7352019-02-20 11:07:48 -060025${ipmi_setaccess_cmd} channel setaccess
Anusha Dathatridd8e7d82019-12-03 07:45:30 -060026&{password_values} 16=0penBmc10penBmc2 17=0penBmc10penBmc2B
27 ... 20=0penBmc10penBmc2Bmc3 21=0penBmc10penBmc2Bmc34
Anusha Dathatri466816f2020-01-30 05:12:36 -060028 ... 7=0penBmc 8=0penBmc0
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060029
Ashwini Chandrappa5cefabf2021-08-30 23:48:14 -050030# User defined count.
31${USER_LOOP_COUNT} 20
32
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
ganesanb0ae36202022-02-17 12:14:37 +0000367 [Setup] Check Active Ethernet Channels
Tony Leef9379e82020-01-08 18:20:38 +0800368 [Teardown] Run Keywords FFDC On Test Case Fail AND
369 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500370
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600371 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800372 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500373 Run IPMI Standard Command
374 ... user set password ${random_userid} ${valid_password}
375
376 # Set admin privilege for newly created user with channel 1.
ganesanb0ae36202022-02-17 12:14:37 +0000377 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} ${CHANNEL_NUMBER}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500378
379 # Set no access privilege for newly created user with channel 2.
ganesanb0ae36202022-02-17 12:14:37 +0000380 Set Channel Access ${random_userid} ipmi=on privilege=${no_access_priv} ${secondary_channel_number}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500381
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600382 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500383
384 # Verify that user is able to run administrator level IPMI command with channel 1.
ganesanb0ae36202022-02-17 12:14:37 +0000385 Verify IPMI Command ${random_username} ${valid_password} Administrator ${CHANNEL_NUMBER}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500386
387 # Verify that user is unable to run IPMI command with channel 2.
ganesanb0ae36202022-02-17 12:14:37 +0000388 Run IPMI Standard Command sel info ${secondary_channel_number} expected_rc=${1} U=${random_username} P=${valid_password}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500389
390
391Verify Operator And User Privilege For Different Channels
392 [Documentation] Set operator and user privilege for different channels and verify.
393 [Tags] Verify_Operator_And_User_Privilege_For_Different_Channels
ganesanb0ae36202022-02-17 12:14:37 +0000394 [Setup] Check Active Ethernet Channels
Tony Leef9379e82020-01-08 18:20:38 +0800395 [Teardown] Run Keywords FFDC On Test Case Fail AND
396 ... Delete Created User ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500397
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600398 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800399 Set Test Variable ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500400 Run IPMI Standard Command
401 ... user set password ${random_userid} ${valid_password}
402
403 # Set operator privilege for newly created user with channel 1.
ganesanb0ae36202022-02-17 12:14:37 +0000404 Set Channel Access ${random_userid} ipmi=on privilege=${operator_priv} ${CHANNEL_NUMBER}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500405
406 # Set user privilege for newly created user with channel 2.
ganesanb0ae36202022-02-17 12:14:37 +0000407 Set Channel Access ${random_userid} ipmi=on privilege=${user_priv} ${secondary_channel_number}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500408
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600409 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500410
411 # Verify that user is able to run operator level IPMI command with channel 1.
ganesanb0ae36202022-02-17 12:14:37 +0000412 Verify IPMI Command ${random_username} ${valid_password} Operator ${CHANNEL_NUMBER}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500413
414 # Verify that user is able to run user level IPMI command with channel 2.
ganesanb0ae36202022-02-17 12:14:37 +0000415 Verify IPMI Command ${random_username} ${valid_password} User ${secondary_channel_number}
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500416
417
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600418Verify Setting IPMI User With Max Password Length
419 [Documentation] Verify IPMI user creation with password length of 20 characters.
420 [Tags] Verify_Setting_IPMI_User_With_Max_Password_Length
421 [Template] Set User Password And Verify
422
423 # password_length password_option expected_status
424 20 20 ${True}
425
426
427Verify Setting IPMI User With Invalid Password Length
428 [Documentation] Verify that IPMI user cannot be set with 21 character password using 16 char
429 ... or 20 char password option.
430 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password_Length
431 [Template] Set User Password And Verify
432
433 # password_length password_option expected_status
434 21 16 ${False}
435 21 20 ${False}
436
437
438Verify Setting IPMI User With 16 Character Password
439 [Documentation] Verify that IPMI user can create a 16 character password using 16 char or 20
440 ... char password option.
441 [Tags] Verify_Setting_IPMI_User_With_16_Character_Password
442 [Template] Set User Password And Verify
443
444 # password_length password_option expected_status
445 16 16 ${True}
446 16 20 ${True}
447
448
449Verify Default Selection Of 16 Character Password For IPMI User
450 [Documentation] Verify that ipmitool by default opts for the 16 character option when given a
451 ... password whose length is in between 17 and 20.
452 [Tags] Verify_Default_Selection_Of_16_Character_Password_For_IPMI_User
453 [Template] Set User Password And Verify
454
455 # password_length password_option expected_status
456 17 16 ${True}
457 20 16 ${True}
458
459
Anusha Dathatri466816f2020-01-30 05:12:36 -0600460Verify Minimum Password Length For IPMI User
461 [Documentation] Verify minimum password length of 8 characters.
462 [Tags] Verify_Minimum_Password_Length_For_IPMI_User
463 [Template] Set User Password And Verify
464
465 # password_length password_option expected_status
466 7 16 ${False}
467 8 16 ${True}
468 7 20 ${False}
469 8 20 ${True}
470
471
Ashwini Chandrappa5cefabf2021-08-30 23:48:14 -0500472Verify Continuous IPMI Command Execution
473 [Documentation] Verify that continuous IPMI command execution runs fine.
474 [Tags] Verify_Continuous_IPMI_Command_Execution
475
476 FOR ${i} IN RANGE ${USER_LOOP_COUNT}
477 Run IPMI Standard Command lan print
478 Run IPMI Standard Command power status
479 Run IPMI Standard Command fru list
480 Run IPMI Standard Command sel list
481 END
482
483
chithragc0582f72021-12-08 10:34:23 -0500484Modify IPMI User
485 [Documentation] Verify modified IPMI user is communicating via IPMI.
486 [Tags] Modify_IPMI_User
487 [Teardown] Run Keywords FFDC On Test Case Fail AND
488 ... Delete Created User ${random_userid}
489
490 ${random_userid} ${random_username}= Create Random IPMI User
491 Set Test Variable ${random_userid}
492 Run IPMI Standard Command
493 ... user set password ${random_userid} ${valid_password}
494
495 # Set admin privilege and enable IPMI messaging for newly created user.
496 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
497
498 # Delay added for user privilege to get set.
499 Sleep 5s
500
501 Enable IPMI User And Verify ${random_userid}
502
503 # Verify that user is able to run administrator level IPMI command.
504 Verify IPMI Command ${random_username} ${valid_password} Administrator ${CHANNEL_NUMBER}
505
506 # Set different username for same IPMI user.
507 Run IPMI Standard Command
508 ... user set name ${random_userid} ${new_username}
509
510 # Verify that user is able to run administrator level IPMI command.
511 Verify IPMI Command ${new_username} ${valid_password} Administrator ${CHANNEL_NUMBER}
512
513
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600514*** Keywords ***
515
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600516Create Random IPMI User
517 [Documentation] Create IPMI user with random username and userid and return those fields.
518
519 ${random_username}= Generate Random String 8 [LETTERS]
520 ${random_userid}= Evaluate random.randint(2, 15) modules=random
521 IPMI Create User ${random_userid} ${random_username}
522 [Return] ${random_userid} ${random_username}
523
524
525Enable IPMI User And Verify
526 [Documentation] Enable the userid and verify that it has been enabled.
527 [Arguments] ${userid}
528
529 # Description of argument(s):
530 # userid A numeric userid (e.g. "4").
531
532 Run IPMI Standard Command user enable ${userid}
533 ${user_info}= Get User Info ${userid}
534 Valid Value user_info['enable_status'] ['enabled']
535
536
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600537Set Default Password For IPMI Root User
538 [Documentation] Set default password for IPMI root user (i.e. 0penBmc).
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600539 # Set default password for root user.
540 ${result}= Run External IPMI Standard Command
541 ... user set password ${root_userid} ${OPENBMC_PASSWORD}
542 ... P=${valid_password}
543 Should Contain ${result} Set User Password command successful
544
545 # Verify that root user is able to run IPMI command using default password.
546 Verify IPMI Username And Password root ${OPENBMC_PASSWORD}
547
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600548
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600549Test IPMI User Privilege
550 [Documentation] Test IPMI user privilege by executing IPMI command with different privileges.
551 [Arguments] ${privilege_level} ${user_cmd_status} ${operator_cmd_status} ${admin_cmd_status}
552
553 # Description of argument(s):
554 # privilege_level Privilege level of IPMI user (e.g. 4, 3).
555 # user_cmd_status Expected status of IPMI command run with the "User"
556 # privilege (i.e. "Passed" or "Failed").
557 # operator_cmd_status Expected status of IPMI command run with the "Operator"
558 # privilege (i.e. "Passed" or "Failed").
559 # admin_cmd_status Expected status of IPMI command run with the "Administrator"
560 # privilege (i.e. "Passed" or "Failed").
561
562 # Create IPMI user and set valid password.
563 ${random_username}= Generate Random String 8 [LETTERS]
564 ${random_userid}= Evaluate random.randint(2, 15) modules=random
565 IPMI Create User ${random_userid} ${random_username}
Tony Leef9379e82020-01-08 18:20:38 +0800566 Set Test Variable ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600567 Run IPMI Standard Command
568 ... user set password ${random_userid} ${valid_password}
569
570 # Set privilege and enable IPMI messaging for newly created user.
571 Set Channel Access ${random_userid} ipmi=on privilege=${privilege_level}
572
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600573 # Delay added for user privilege to get set.
Rahul Maheshwari62c8aea2019-09-27 05:23:12 -0500574 Sleep 5s
575
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600576 Enable IPMI User And Verify ${random_userid}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600577
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500578 Verify IPMI Command ${random_username} ${valid_password} User
579 ... expected_status=${user_cmd_status}
580 Verify IPMI Command ${random_username} ${valid_password} Operator
581 ... expected_status=${operator_cmd_status}
582 Verify IPMI Command ${random_username} ${valid_password} Administrator
583 ... expected_status=${admin_cmd_status}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600584
585
586Verify IPMI Command
587 [Documentation] Verify IPMI command execution with given username,
588 ... password, privilege and expected status.
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500589 [Arguments] ${username} ${password} ${privilege} ${channel}=${1} ${expected_status}=Passed
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600590 # Description of argument(s):
591 # username The user name (e.g. "root", "robert", etc.).
592 # password The user password (e.g. "0penBmc", "0penBmc1", etc.).
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600593 # privilege The session privilege for IPMI command (e.g. "User", "Operator", etc.).
Rahul Maheshwari8e175622019-05-20 05:30:32 -0500594 # channel The user channel number (e.g. "1" or "2").
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600595 # expected_status Expected status of IPMI command run with the user
596 # of above password and privilege (i.e. "Passed" or "Failed").
597
598 ${expected_rc}= Set Variable If '${expected_status}' == 'Passed' ${0} ${1}
Rahul Maheshwariceb282e2019-09-16 00:11:41 -0500599 Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command
600 ... sel info ${channel} expected_rc=${expected_rc} U=${username} P=${password}
Rahul Maheshwaric05bf562019-03-01 04:02:53 -0600601 ... L=${privilege}
602
603
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600604Set User Password And Verify
605 [Documentation] Create a user and set its password with given length and option.
606 [Arguments] ${password_length} ${password_option} ${expected_result}
Tony Leef9379e82020-01-08 18:20:38 +0800607 [Teardown] Run Keyword Delete Created User ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600608 # Description of argument(s):
609 # password_length Length of password to be generated and used (e.g. "16").
610 # password_option Password length option to be given in IPMI command (e.g. "16", "20").
611 # expected_result Expected result for setting the user's password (e.g. "True", "False").
612
613 Rprint Vars password_length password_option expected_result
614 ${random_userid} ${random_username}= Create Random IPMI User
Tony Leef9379e82020-01-08 18:20:38 +0800615 Set Test Variable ${random_userid}
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600616 ${password}= Get From Dictionary ${password_values} ${password_length}
617 Rprint Vars random_userid password
618
619 # Set password for newly created user.
620 ${status}= Run Keyword And Return Status Run IPMI Standard Command
621 ... user set password ${random_userid} ${password} ${password_option}
622 Rprint Vars status
623 Valid Value status [${expected_result}]
Anusha Dathatri7f810712020-01-07 04:13:16 -0600624 Return From Keyword If '${expected_result}' == '${False}'
Anusha Dathatridd8e7d82019-12-03 07:45:30 -0600625
626 # Set admin privilege and enable IPMI messaging for newly created user.
627 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
628
629 # Delay added for user privilege to get set.
630 Sleep 5s
631
632 Enable IPMI User And Verify ${random_userid}
633
634 # For password_option 16, passwords with length between 17 and 20 will be truncated.
635 # For all other cases, passwords will be retained as it is to verify.
636 ${truncated_password}= Set Variable ${password[:${password_option}]}
637 Rprint Vars truncated_password
638 ${status}= Run Keyword And Return Status Verify IPMI Username And Password ${random_username}
639 ... ${truncated_password}
640 Rprint Vars status
641 Valid Value status [${expected_result}]
642
643
Rahul Maheshwarif646baa2019-02-20 12:29:35 -0600644Test Teardown Execution
645 [Documentation] Do the test teardown execution.
646
647 FFDC On Test Case Fail
Tony Leef9379e82020-01-08 18:20:38 +0800648
649
650Delete Created User
651 [Documentation] Delete created IPMI user.
652 [Arguments] ${userid}
653 # Description of argument(s):
654 # userid The user ID (e.g. "1", "2", etc.).
655
656 Run IPMI Standard Command user set name ${userid} ""
Ashwini Chandrappa5cefabf2021-08-30 23:48:14 -0500657 Sleep 5s
ganesanb0ae36202022-02-17 12:14:37 +0000658
659
660Check Active Ethernet Channels
661 [Documentation] Check active ethernet channels and set suite variables.
662
663 ${channel_number_list}= Get Active Ethernet Channel List
664 ${channel_length}= Get Length ${channel_number_list}
665 Skip If '${channel_length}' == '1'
666 ... msg= Skips this test case as only one channel was in active.
667
668 FOR ${channel_num} IN @{channel_number_list}
669 ${secondary_channel_number}= Set Variable If ${channel_num} != ${CHANNEL_NUMBER} ${channel_num}
670 END
671
672 Set Suite Variable ${secondary_channel_number}