blob: a669b26c4c0cd647357f880beda3e2f3933e48ff [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
7
Rahul Maheshwarif646baa2019-02-20 12:29:35 -06008Test Teardown Test Teardown Execution
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -06009
10
11*** Variables ***
12
13${invalid_username} user%
14${invalid_password} abc123
15${root_userid} 1
16${operator_level_priv} 0x3
Rahul Maheshwarief0a7352019-02-20 11:07:48 -060017${admin_level_priv} 4
Rahul Maheshwaric19f8382019-02-20 08:19:22 -060018${valid_password} 0penBmc1
19${max_password_length} 20
Rahul Maheshwarief0a7352019-02-20 11:07:48 -060020${ipmi_setaccess_cmd} channel setaccess
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060021
Rahul Maheshwaridd63c742019-02-27 23:03:54 -060022
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060023*** Test Cases ***
24
Rahul Maheshwariffc77352019-02-25 09:05:27 -060025Verify IPMI User Summary
26 [Documentation] Verify IPMI maximum supported IPMI user ID and
27 ... enabled user form user summary
28 [Tags] Verify_IPMI_User_Summary
29
30 # Delete all non-root IPMI (i.e. except userid 1)
31 Delete All Non Root IPMI User
32
33 # Create a valid user and enable it.
34 ${random_username}= Generate Random String 8 [LETTERS]
35 ${random_userid}= Evaluate random.randint(2, 15) modules=random
36 IPMI Create User ${random_userid} ${random_username}
37 Run IPMI Standard Command user enable ${random_userid}
38
39 # Verify maximum user count IPMI local user can have. Also verify
40 # currently enabled users.
41 ${resp}= Run IPMI Standard Command user summary
42 ${enabled_user_count}=
43 ... Get Lines Containing String ${resp} Enabled User Count
44 ${maximum_ids}= Get Lines Containing String ${resp} Maximum IDs
45 Should Contain ${enabled_user_count} 2
46 Should Contain ${maximum_ids} 15
47
48
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060049Verify IPMI User Creation With Valid Name And ID
50 [Documentation] Create user via IPMI and verify.
51 [Tags] Test_IPMI_User_Creation_With_Valid_Name_And_ID
52
53 ${random_username}= Generate Random String 8 [LETTERS]
Rahul Maheshwari976a1702019-02-21 01:47:58 -060054 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060055 IPMI Create User ${random_userid} ${random_username}
56
57
58Verify IPMI User Creation With Invalid Name
59 [Documentation] Verify error while creating IPMI user with invalid
George Keishingc2a6f092019-02-20 12:26:54 -060060 ... name(e.g. user name with special characters).
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060061 [Tags] Verify_IPMI_User_Creation_With_Invalid_Name
62
Rahul Maheshwari976a1702019-02-21 01:47:58 -060063 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060064 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
65 ... user set name ${random_userid} ${invalid_username}
66 Should Contain ${msg} Invalid data
67
68
69Verify IPMI User Creation With Invalid ID
70 [Documentation] Verify error while creating IPMI user with invalid
71 ... ID(i.e. any number greater than 15 or 0).
72 [Tags] Verify_IPMI_User_Creation_With_Invalid_ID
73
74 @{id_list}= Create List
75 ${random_invalid_id}= Evaluate random.randint(16, 1000) modules=random
76 Append To List ${id_list} ${random_invalid_id}
77 Append To List ${id_list} 0
78
79 :FOR ${id} IN @{id_list}
80 \ ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
81 \ ... user set name ${id} newuser
82 \ Should Contain ${msg} User ID is limited to range
83
84
85Verify Setting IPMI User With Invalid Password
86 [Documentation] Verify error while setting IPMI user with invalid
87 ... password.
88 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password
89
90 # Create IPMI user.
91 ${random_username}= Generate Random String 8 [LETTERS]
Rahul Maheshwari976a1702019-02-21 01:47:58 -060092 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060093 IPMI Create User ${random_userid} ${random_username}
94
95 # Set invalid password for newly created user.
96 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
97 ... user set password ${random_userid} ${invalid_password}
98
99 Should Contain ${msg} Invalid data field in request
100
101
102Verify Setting IPMI Root User With New Name
103 [Documentation] Verify error while setting IPMI root user with new
104 ... name.
105 [Tags] Verify_Setting_IPMI_Root_User_With_New_Name
106
107 # Set invalid password for newly created user.
108 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
109 ... user set name ${root_userid} abcd
110
111 Should Contain ${msg} Set User Name command failed
112
113
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600114Verify IPMI User Password Via Test Command
115 [Documentation] Verify IPMI user password using test command.
116 [Tags] Verify_IPMI_User_Password_Via_Test_Command
117
118 # Create IPMI user.
119 ${random_username}= Generate Random String 8 [LETTERS]
120 ${random_userid}= Evaluate random.randint(2, 15) modules=random
121 IPMI Create User ${random_userid} ${random_username}
122
123 # Set valid password for newly created user.
124 Run IPMI Standard Command
125 ... user set password ${random_userid} ${valid_password}
126
127 # Verify newly set password using test command.
128 ${msg}= Run IPMI Standard Command
129 ... user test ${random_userid} ${max_password_length} ${valid_password}
130
131 Should Contain ${msg} Success
132
133
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600134Verify Setting Valid Password For IPMI User
135 [Documentation] Set valid password for IPMI user and verify.
136 [Tags] Verify_Setting_Valid_Password_For_IPMI_User
137
138 # Create IPMI user.
139 ${random_username}= Generate Random String 8 [LETTERS]
140 ${random_userid}= Evaluate random.randint(2, 15) modules=random
141 IPMI Create User ${random_userid} ${random_username}
142
143 # Set valid password for newly created user.
144 Run IPMI Standard Command
145 ... user set password ${random_userid} ${valid_password}
146
147 # Enable IPMI user
148 Run IPMI Standard Command user enable ${random_userid}
149
150 # Set admin privilege and enable IPMI messaging for newly created user
151 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
152
153 Verify IPMI Username And Password ${random_username} ${valid_password}
154
155
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600156Verify IPMI User Creation With Same Name
157 [Documentation] Verify error while creating two IPMI user with same name.
158 [Tags] Verify_IPMI_User_Creation_With_Same_Name
159
160 ${random_username}= Generate Random String 8 [LETTERS]
161 IPMI Create User 2 ${random_username}
162
163 # Set same username for another IPMI user.
164 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
165 ... user set name 3 ${random_username}
166 Should Contain ${msg} Invalid data field in request
167
168
169Verify Setting IPMI User With Null Password
170 [Documentation] Verify error while setting IPMI user with null
171 ... password.
172 [Tags] Verify_Setting_IPMI_User_With_Null_Password
173
174 # Create IPMI user.
175 ${random_username}= Generate Random String 8 [LETTERS]
Rahul Maheshwari976a1702019-02-21 01:47:58 -0600176 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600177 IPMI Create User ${random_userid} ${random_username}
178
179 # Set null password for newly created user.
180 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
181 ... user set password ${random_userid} ""
182
183 Should Contain ${msg} Invalid data field in request
184
185
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600186Verify IPMI User Deletion
187 [Documentation] Delete user via IPMI and verify.
188 [Tags] Verify_IPMI_User_Deletion
189
190 ${random_username}= Generate Random String 8 [LETTERS]
191 ${random_userid}= Evaluate random.randint(2, 15) modules=random
192 IPMI Create User ${random_userid} ${random_username}
193
194 # Delete IPMI User and verify
195 Run IPMI Standard Command user set name ${random_userid} ""
Rahul Maheshwari4f4688f2019-02-28 00:49:10 -0600196 ${user_info}= Get User Info ${random_userid}
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600197 Should Be Equal ${user_info['user_name']} ${EMPTY}
198
199
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600200Enable IPMI User And Verify
201 [Documentation] Enable IPMI user and verify that the user is able
202 ... to run IPMI command.
203 [Tags] Enable_IPMI_User_And_Verify
204
205 # Create IPMI user and set valid password.
206 ${random_username}= Generate Random String 8 [LETTERS]
207 ${random_userid}= Evaluate random.randint(2, 15) modules=random
208 IPMI Create User ${random_userid} ${random_username}
209 Run IPMI Standard Command
210 ... user set password ${random_userid} ${valid_password}
211
212 # Set admin privilege and enable IPMI messaging for newly created user.
213 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
214
215 # Enable IPMI user and verify.
216 Run IPMI Standard Command user enable ${random_userid}
217 ${user_info}= Get User Info ${random_userid}
218 Should Be Equal ${user_info['enable_status']} enabled
219
220 # Verify that enabled IPMI user is able to run IPMI command.
221 Verify IPMI Username And Password ${random_username} ${valid_password}
222
223
224Disable IPMI User And Verify
225 [Documentation] Disable IPMI user and verify that that the user
226 ... is unable to run IPMI command.
227 [Tags] Disable_IPMI_User_And_Verify
228
229 # Create IPMI user and set valid password.
230 ${random_username}= Generate Random String 8 [LETTERS]
231 ${random_userid}= Evaluate random.randint(2, 15) modules=random
232 IPMI Create User ${random_userid} ${random_username}
233 Run IPMI Standard Command
234 ... user set password ${random_userid} ${valid_password}
235
236 # Set admin privilege and enable IPMI messaging for newly created user.
237 Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv}
238
239 # Disable IPMI user and verify.
240 Run IPMI Standard Command user disable ${random_userid}
241 ${user_info}= Get User Info ${random_userid}
242 Should Be Equal ${user_info['enable_status']} disabled
243
244 # Verify that disabled IPMI user is unable to run IPMI command.
245 ${msg}= Run Keyword And Expect Error * Verify IPMI Username And Password
246 ... ${random_username} ${valid_password}
Rahul Maheshwaric3d1e962019-03-06 23:53:21 -0600247 Should Contain ${msg} Unable to establish IPMI
Rahul Maheshwari0c71f5e2019-02-20 03:52:55 -0600248
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600249
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600250Verify IPMI Root User Password Change
251 [Documentation] Change IPMI root user password and verify that
252 ... root user is able to run IPMI command.
253 [Tags] Verify_IPMI_Root_User_Password_Change
254 [Teardown] Wait Until Keyword Succeeds 15 sec 5 sec
255 ... Set Default Password For IPMI Root User
256
257 # Set new password for root user.
258 Run IPMI Standard Command
259 ... user set password ${root_userid} ${valid_password}
260
261 # Verify that root user is able to run IPMI command using new password.
262 Verify IPMI Username And Password root ${valid_password}
263
264
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600265*** Keywords ***
266
267IPMI Create User
268 [Documentation] Create IPMI user with given userid and username.
269 [Arguments] ${userid} ${username}
270
271 # Description of argument(s):
272 # userid The user ID (e.g. "1", "2", etc.).
273 # username The user name (e.g. "root", "robert", etc.).
274
275 ${ipmi_cmd}= Catenate user set name ${userid} ${username}
276 ${resp}= Run IPMI Standard Command ${ipmi_cmd}
277 ${user_info}= Get User Info ${userid}
278 Should Be Equal ${user_info['user_name']} ${username}
279
Rahul Maheshwarif646baa2019-02-20 12:29:35 -0600280
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600281Set Channel Access
282 [Documentation] Verify that user is able to run IPMI command
283 ... with given username and password.
284 [Arguments] ${userid} ${options} ${channel}=1
285
286 # Description of argument(s):
287 # userid The user ID (e.g. "1", "2", etc.).
288 # options Set channel command options (e.g.
289 # "link=on", "ipmi=on", etc.).
290 # channel_number The user's channel number (e.g. "1").
291
292 ${ipmi_cmd}= Catenate SEPARATOR=
293 ... ${ipmi_setaccess_cmd}${SPACE}${channel}${SPACE}${userid}
294 ... ${SPACE}${options}
295 Run IPMI Standard Command ${ipmi_cmd}
296
Rahul Maheshwaridd63c742019-02-27 23:03:54 -0600297Set Default Password For IPMI Root User
298 [Documentation] Set default password for IPMI root user (i.e. 0penBmc).
299
300 # Set default password for root user.
301 ${result}= Run External IPMI Standard Command
302 ... user set password ${root_userid} ${OPENBMC_PASSWORD}
303 ... P=${valid_password}
304 Should Contain ${result} Set User Password command successful
305
306 # Verify that root user is able to run IPMI command using default password.
307 Verify IPMI Username And Password root ${OPENBMC_PASSWORD}
308
Rahul Maheshwarief0a7352019-02-20 11:07:48 -0600309
Rahul Maheshwarif646baa2019-02-20 12:29:35 -0600310Delete All Non Root IPMI User
311 [Documentation] Delete all non-root IPMI user.
312
313 :FOR ${userid} IN RANGE 2 16
314 \ ${user_info}= Get User Info ${userid}
315 \ Run Keyword If "${user_info['user_name']}" != ""
316 ... Run IPMI Standard Command user set name ${userid} ""
317
318
319Test Teardown Execution
320 [Documentation] Do the test teardown execution.
321
322 FFDC On Test Case Fail
323 Delete All Non Root IPMI User
324