blob: 05c7e1da36401fd8049ac428d625db344d24d8e4 [file] [log] [blame]
Vijayfcdadc52020-01-21 01:48:19 -06001*** Settings ***
2
Sushil Singhcbbce6a2020-09-07 00:57:37 -05003Documentation Test Save Area feature of Management Console on BMC.
Vijayfcdadc52020-01-21 01:48:19 -06004
5Resource ../../lib/rest_client.robot
6Resource ../../lib/openbmc_ffdc.robot
7Resource ../../lib/resource.robot
Vijay09839e22020-02-05 02:54:44 -06008Resource ../../lib/bmc_redfish_utils.robot
Vijayfcdadc52020-01-21 01:48:19 -06009Resource ../../lib/utils.robot
Sushil Singhcbbce6a2020-09-07 00:57:37 -050010Resource ../../lib/bmc_redfish_resource.robot
Vijayfcdadc52020-01-21 01:48:19 -060011
Vijay39373152020-02-14 08:08:20 -060012Suite Setup Suite Setup Execution
13Test Teardown Test Teardown Execution
14Suite Teardown Suite Teardown Execution
Vijayfcdadc52020-01-21 01:48:19 -060015
Vijayfcdadc52020-01-21 01:48:19 -060016*** Variables ***
17
Sushil Singhcbbce6a2020-09-07 00:57:37 -050018${MAXIMUM_SIZE_MESSAGE} File size exceeds maximum allowed size[500KB]
19${FILE_UPLOAD_MESSAGE} File Created
20${FILE_DELETED_MESSAGE} File Deleted
21${FILE_UPDATED} File Updated
22${FORBIDDEN_MESSAGE} Forbidden
23${ERROR_MESSAGE} Error while creating the file
24${RESOURCE_NOT_FOUND} Resource Not Found
Vijayfcdadc52020-01-21 01:48:19 -060025
26*** Test Cases ***
27
Sushil Singhcbbce6a2020-09-07 00:57:37 -050028Redfish Upload Partition File To BMC
29 [Documentation] Upload partition file to BMC using redfish.
30 [Tags] Redfish_Upload_Partition_File_To_BMC
31 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060032
Sushil Singhcbbce6a2020-09-07 00:57:37 -050033 # file_name
34 500KB_file
Vijayfcdadc52020-01-21 01:48:19 -060035
36
Sushil Singhcbbce6a2020-09-07 00:57:37 -050037Redfish Fail To Upload Partition File To BMC
38 [Documentation] Fail to upload partition file to BMC using redfish.
39 [Tags] Redfish_Fail_To_Upload_Partition_File_To_BMC
40 [Template] Redfish Fail To Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060041
Sushil Singhcbbce6a2020-09-07 00:57:37 -050042 # file_name
43 501KB_file
Vijayfcdadc52020-01-21 01:48:19 -060044
45
Sushil Singhcbbce6a2020-09-07 00:57:37 -050046Redfish Upload Multiple Partition File To BMC
47 [Documentation] Upload multiple partition file to BMC using redfish.
48 [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC
49 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060050
Sushil Singhcbbce6a2020-09-07 00:57:37 -050051 # file_name
52 250KB_file,500KB_file
Vijayfcdadc52020-01-21 01:48:19 -060053
54
Sushil Singhcbbce6a2020-09-07 00:57:37 -050055Redfish Fail To Upload Multiple Partition File To BMC
56 [Documentation] Fail to upload multiple partition file to BMC using redfish.
57 [Tags] Redfish_Fail_To_Upload_Multiple_Partition_File_To_BMC
58 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -060059
Sushil Singhcbbce6a2020-09-07 00:57:37 -050060 # file_name
61 650KB_file,501KB_file
Vijay09839e22020-02-05 02:54:44 -060062
63
Sushil Singhdf6ba522020-11-24 04:17:00 -060064Redfish Upload Same Partition File To BMC In Loop
65 [Documentation] Upload same partition file to BMC using redfish in loop.
66 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
67 [Template] Redfish Upload Partition File In Loop
68
69 # file_name
70 500KB_file
71
72
Sushil Singhf39629c2020-12-11 07:30:21 -060073Redfish Upload And Delete Same Partition File To BMC In Loop
74 [Documentation] Upload same partition file to BMC using redfish in loop.
75 [Tags] Redfish_Upload_And_Delete_Same_Partition_File_To_BMC_In_Loop
76 [Template] Redfish Upload And Delete Partition File In Loop
77
78 # file_name
79 500KB_file
80
81
Sushil Singh5d0782f2020-11-23 06:35:35 -060082Redfish Partition File Upload Post BMC Reboot
83 [Documentation] Upload partition file to BMC using redfish, after the BMC reboot.
84 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
85 [Template] Verify Partition File Upload Post BMC Reboot
86
87 # file_name
88 500KB_file
89
90
Sushil Singhcbbce6a2020-09-07 00:57:37 -050091Redfish Partition File Persistency On BMC Reboot
92 [Documentation] Upload partition file to BMC using redfish and is same after reboot.
93 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
94 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -060095
Sushil Singhcbbce6a2020-09-07 00:57:37 -050096 # file_name
97 500KB_file
Vijay09839e22020-02-05 02:54:44 -060098
99
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500100Redfish Multiple Partition File Persistency On BMC Reboot
101 [Documentation] Upload partition file to BMC using redfish and is same after reboot.
102 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
103 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600104
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500105 # file_name
106 250KB_file,500KB_file
Vijay09839e22020-02-05 02:54:44 -0600107
108
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500109Redfish Read Partition File On BMC
110 [Documentation] Upload partition file to BMC using redfish and verify the content.
111 [Tags] Redfish_Read_Partition_File_On_BMC
112 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600113
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500114 # file_name reboot_flag
115 testfile False
116 testfile01,testfile02 False
Vijay09839e22020-02-05 02:54:44 -0600117
Vijay09839e22020-02-05 02:54:44 -0600118
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500119Redfish Read Partition File On BMC Reboot
120 [Documentation] Upload partition file to BMC using redfish and verify the content after reboot.
121 [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot
122 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600123
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500124 # file_name reboot_flag
125 testfile True
126 testfile01,testfile02 True
Vijay09839e22020-02-05 02:54:44 -0600127
Vijay09839e22020-02-05 02:54:44 -0600128
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500129Redfish Update Partition File On BMC
130 [Documentation] Upload partition file to BMC using redfish and verify the content.
131 [Tags] Redfish_Update_Partition_File_On_BMC
132 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600133
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500134 # file_name reboot_flag
135 testfile01 False
136
137
138Redfish Update Partition File On BMC Reboot
139 [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot.
140 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
141 [Template] Redfish Update Partition File With Different Content
142
143 # file_name reboot_flag
144 testfile01 True
145
146
147Redfish Persistency Update Partition File On BMC
148 [Documentation] Upload partition file to BMC using redfish and verify the content.
149 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
150 [Template] Redfish Update Partition File With Same Content
151
152 # file_name reboot_flag
153 testfile01 False
154
155
156Redfish Persistency Update Partition File On BMC Reboot
157 [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot.
158 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC_Reboot
159 [Template] Redfish Update Partition File With Same Content
160
161 # file_name reboot_flag
162 testfile01 True
163
164
165Redfish Delete Non Existence Of Partition File
166 [Documentation] Delete the partition file if do not exists.
167 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
168 [Template] Redfish Delete Non Existence Partition File
169
170 # file_name
171 testfile01
Vijay09839e22020-02-05 02:54:44 -0600172
173
174Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500175 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600176 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500177 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600178
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500179 # range
180 1000
Vijay09839e22020-02-05 02:54:44 -0600181
Vijay09839e22020-02-05 02:54:44 -0600182
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500183Non Admin Users Fail To Upload Partition File
184 [Documentation] Non admin user will fail to upload the partition file.
185 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
186 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600187
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500188 # file_name username password role_id
189 500KB_file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600190
191
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500192Non Admin User Delete Non Existence Of Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600193 [Documentation] Delete the partition file if does not exists.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500194 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
195 [Template] Non Admin Delete Non Existence Partition File
196
197 # file_name username password role_id
198 500KB_file operator_user TestPwd123 Operator
199
200
201Redfish Update Wrong Partition File To BMC
202 [Documentation] Upload partition file to BMC by wrong URI using redfish.
203 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
204 [Template] Verify Update Wrong Partition File To BMC
205
206 # file_name
207 500KB_file
208
Vijayfcdadc52020-01-21 01:48:19 -0600209*** Keywords ***
210
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500211Suite Setup Execution
212 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600213
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500214 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600215
216
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500217Test Teardown Execution
218 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600219
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500220 Delete All BMC Partition File ${HTTP_OK}
221 FFDC On Test Case Fail
222
223
224Suite Teardown Execution
225 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600226
227 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600228
229
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500230Delete Local Partition File
231 [Documentation] Delete local partition file.
232 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600233
234 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500235 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600236
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500237 FOR ${conf_file} IN @{file_name}
238 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
239 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
240 END
Vijayfcdadc52020-01-21 01:48:19 -0600241
Vijayfcdadc52020-01-21 01:48:19 -0600242
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500243Create Partition File
244 [Documentation] Create Partition file.
245 [Arguments] ${file_name}
246
247 # Description of argument(s):
248 # file_name Partition file name.
249
250 Delete Local Partition File ${file_name}
251
252 FOR ${conf_file} IN @{file_name}
253 @{words}= Split String ${conf_file} _
254 Run dd if=/dev/zero of=${conf_file} bs=1 count=0 seek=${words}[-0]
255 OperatingSystem.File Should Exist ${conf_file}
256 END
257
258
259Delete BMC Partition File
260 [Documentation] Delete single partition file on BMC via redfish.
261 [Arguments] ${file_name} ${status_code} ${expected_message}
262
263 # Description of argument(s):
264 # file_name Partition file name.
265 # status_code HTTPS status code.
266 # expected_message Expected message of URI.
267
268 FOR ${conf_file} IN @{file_name}
269 ${data}= Create Dictionary
270 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
271 Set To Dictionary ${data} headers ${headers}
272
273 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
274 Should Be Equal As Strings ${resp.status_code} ${status_code}
275
276 Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN}
277 ... Should Be Equal As Strings ${resp.text} ${expected_message}
278 ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK}
279 ... Return Description Of Response ${resp.text}
280 Run Keyword If '${description}' != 'None'
281 ... Should Be Equal As Strings ${description} ${expected_message}
282 END
283
284
285Delete All BMC Partition File
286 [Documentation] Delete multiple partition file on BMC via redfish.
287 [Arguments] ${status_code}
288
289 # Description of argument(s):
290 # status_code HTTPS status code.
291
292 Initialize OpenBMC
293 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600294 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600295 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600296
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500297 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
298 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600299
300
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500301Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600302 [Documentation] Return description of REST response.
303 [Arguments] ${resp_text}
304
305 # Description of argument(s):
306 # resp_text REST response body.
307
308 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500309 # {
310 # "Description": "File Created"
311 # }
Vijay09839e22020-02-05 02:54:44 -0600312
313 ${message}= Evaluate json.loads('''${resp_text}''') json
314
315 [Return] ${message["Description"]}
316
317
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500318Upload Partition File To BMC
319 [Documentation] Upload partition file to BMC.
320 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True}
Vijay09839e22020-02-05 02:54:44 -0600321
322 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500323 # file_name Partition file name.
324 # status_code HTTPS status code.
325 # expected_message Expected message of URI.
326 # flag If True run part of program, else skip.
Vijay09839e22020-02-05 02:54:44 -0600327
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500328 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
329 FOR ${conf_file} IN @{file_name}
330 # Get the content of the file and upload to BMC.
331 ${image_data}= OperatingSystem.Get Binary File ${conf_file}
332 ${data}= Create Dictionary data ${image_data}
333 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
334 Set To Dictionary ${data} headers ${headers}
Vijay09839e22020-02-05 02:54:44 -0600335
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500336 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
337 Should Be Equal As Strings ${resp.status_code} ${status_code}
338
339 Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN}
340 ... Should Be Equal As Strings ${resp.text} ${expected_message}
341 ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK}
342 ... Return Description Of Response ${resp.text}
343 Run Keyword If '${description}' != 'None'
344 ... Should Be Equal As Strings ${description} ${expected_message}
345 END
Vijayfcdadc52020-01-21 01:48:19 -0600346
347
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500348Verify Partition File On BMC
349 [Documentation] Verify partition file on BMC.
350 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600351
352 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500353 # file_name Partition file name.
354 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600355
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500356 FOR ${conf_file} IN @{file_name}
357 ${status} ${stderr} ${rc}= BMC Execute Command
Sushil Singhe5f39ee2021-01-06 00:39:12 -0600358 ... ls -l /var/lib/bmcweb/ibm-management-console/configfiles/${conf_file} | wc -l
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500359 Valid Value ${status} [${Partition_status}]
360 END
Vijayfcdadc52020-01-21 01:48:19 -0600361
362
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500363Redfish Upload Partition File
364 [Documentation] Upload the partition file.
Vijayfcdadc52020-01-21 01:48:19 -0600365 [Arguments] ${file_name}
366
367 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500368 # file_name Partition file name.
Vijayfcdadc52020-01-21 01:48:19 -0600369
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500370 @{Partition_file_list} = Split String ${file_name} ,
371 ${num_records}= Get Length ${Partition_file_list}
372 Create Partition File ${Partition_file_list}
373 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
374 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
375 Run Keyword If ${num_records} == ${1}
376 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
377 ... ELSE
378 ... Delete All BMC Partition File ${HTTP_OK}
379 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600380
381
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500382Redfish Fail To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600383 [Documentation] Fail to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500384 [Arguments] ${file_name}
Vijay09839e22020-02-05 02:54:44 -0600385
386 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500387 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600388
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500389 @{Partition_file_list} = Split String ${file_name} ,
390 Create Partition File ${Partition_file_list}
391 Upload Partition File To BMC ${Partition_file_list} ${HTTP_BAD_REQUEST} ${MAXIMUM_SIZE_MESSAGE}
392 Verify Partition File On BMC ${Partition_file_list} Partition_status=0
393 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND}
394 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600395
396
Sushil Singhdf6ba522020-11-24 04:17:00 -0600397Redfish Upload Partition File In Loop
398 [Documentation] Upload the same partition file multiple times in loop to BMC.
399 [Arguments] ${file_name}
400
401 # Description of argument(s):
402 # file_name Partition file name.
403
404 @{Partition_file_list} = Split String ${file_name} ,
405 Create Partition File ${Partition_file_list}
406
407 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
408 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
409
410 FOR ${count} IN RANGE 1 11
411 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
412 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
413 END
414
415 Initialize OpenBMC
416 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
417 Delete Local Partition File ${Partition_file_list}
418
419
Sushil Singhf39629c2020-12-11 07:30:21 -0600420Redfish Upload And Delete Partition File In Loop
421 [Documentation] Upload the same partition file multiple times in loop to BMC.
422 [Arguments] ${file_name}
423
424 # Description of argument(s):
425 # file_name Partition file name.
426
427 FOR ${count} IN RANGE 1 11
428 Redfish Upload Partition File ${file_name}
429 END
430
431
Sushil Singh5d0782f2020-11-23 06:35:35 -0600432Verify Partition File Upload Post BMC Reboot
433 [Documentation] Upload the partition file, after BMC reboot.
434 [Arguments] ${file_name}
435
436 # Description of argument(s):
437 # file_name Partition file name.
438
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600439 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
440 Redfish BMC Reset Operation
441 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
442
443 Is BMC Standby
Sushil Singh5d0782f2020-11-23 06:35:35 -0600444
445 Redfish Upload Partition File ${file_name}
446
447
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500448Redfish Partition File Persistency
449 [Documentation] Upload the partition file and check for persistency after reboot.
450 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600451
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500452 # Description of argument(s):
453 # file_name Partition file name.
454
455 @{Partition_file_list} = Split String ${file_name} ,
456 ${num_records}= Get Length ${Partition_file_list}
457 Create Partition File ${Partition_file_list}
458 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
459 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600460
461 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
462 Redfish BMC Reset Operation
463 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
464
465 Is BMC Standby
466
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500467 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600468 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500469 Run Keyword If ${num_records} == ${1}
470 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
471 ... ELSE
472 ... Delete All BMC Partition File ${HTTP_OK}
473 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600474
475
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500476Verify Redfish Partition File Content
477 [Documentation] Verify partition file content.
478 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600479
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500480 # Description of argument(s):
481 # file_name Partition file name.
482 # content_dict Dict contain the content.
483 # status_code HTTPS status code.
484
485 FOR ${conf_file} IN @{file_name}
486 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
487 Should Be Equal As Strings ${resp.status_code} ${status_code}
488
489 ${Partition_file_data}= Remove String ${resp.text} \\n
490 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
491 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
492 END
Vijayfcdadc52020-01-21 01:48:19 -0600493
Vijay39373152020-02-14 08:08:20 -0600494
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500495Add Content To Files
496 [Documentation] Add defined content in partition file.
497 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600498
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500499 # Description of argument(s):
500 # file_name Partition file name.
501 # index Index
502
503 ${num_records}= Get Length ${file_name}
504 Set Test Variable ${content-1} Sample Content to test partition file upload
505 Set Test Variable ${content-2} Sample Content to test partition file upload after reboot
506 &{content_dict}= Create Dictionary
507 FOR ${conf_file} IN @{file_name}
508 ${index}= Get Index From List ${file_name} ${conf_file}
509 ${index}= Evaluate ${index} + 1
510
511 Run echo "${content-${index}}" > ${conf_file}
512 OperatingSystem.File Should Exist ${conf_file}
513
514 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
515 END
516
517 [Return] &{content_dict}
518
519
520Redfish Read Partition File
521 [Documentation] Read partition file content.
522 [Arguments] ${file_name} ${reboot_flag}=False
523
524 # Description of argument(s):
525 # file_name Partition file name.
526 # reboot_flag Reboot flag.
527
528 @{Partition_file_list} = Split String ${file_name} ,
529 ${content_dict}= Add Content To Files ${Partition_file_list}
530
531 ${num_records}= Get Length ${Partition_file_list}
532
533 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
534 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
535 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
536
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600537 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
538
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500539 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600540 ... Run Keywords Redfish BMC Reset Operation AND
541 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
542 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500543 ... Initialize OpenBMC AND
544 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600545
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500546 Run Keyword If ${num_records} == ${1}
547 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
548 ... ELSE
549 ... Delete All BMC Partition File ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600550
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500551 Delete Local Partition File ${Partition_file_list}
552
553
554Redfish Update Partition File With Same Content
555 [Documentation] Update partition file with same content.
556 [Arguments] ${file_name} ${reboot_flag}=False
557
558 # Description of argument(s):
559 # file_name Partition file name.
560 # reboot_flag Reboot flag.
561
562 @{Partition_file_list} = Split String ${file_name} ,
563 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
564
565 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
566 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
567 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
568
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600569 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
570
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500571 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600572 ... Run Keywords Redfish BMC Reset Operation AND
573 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
574 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500575 ... Initialize OpenBMC
576
577 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
578 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
579 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
580 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
581
582 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
583 Delete Local Partition File ${Partition_file_list}
584
585
586Redfish Update Partition File With Different Content
587 [Documentation] Update partition file with different content.
588 [Arguments] ${file_name} ${reboot_flag}=False
589
590 # Description of argument(s):
591 # file_name Partition file name.
592 # reboot_flag Reboot flag.
593
594 @{Partition_file_list} = Split String ${file_name} ,
595 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
596
597 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
598 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
599 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
600
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600601 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
602
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500603 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600604 ... Run Keywords Redfish BMC Reset Operation AND
605 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
606 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500607 ... Initialize OpenBMC
608
609 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
610 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
611 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
612 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
613
614 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
615 Delete Local Partition File ${Partition_file_list}
616
617
618Create File Names
619 [Documentation] Create partition file names.
620 [Arguments] ${range}
621
622 # Description of argument(s):
623 # range Range in numbers.
624
625 @{file_name_list}= Create List
626 Set Test Variable ${file_name} rangefile
627 FOR ${count} IN RANGE ${range}
628 Append To List ${file_name_list} 200KB_file${count}
629 END
630 [Return] ${file_name_list}
631
632
633Redfish Upload Partition File With Range
634 [Documentation] Upload the partition file with the range of files.
635 [Arguments] ${range}
636
637 # Description of argument(s):
638 # range Range in numbers.
639
640 ${Partition_file_list}= Create File Names ${range}
641 Create Partition File ${Partition_file_list}
642 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
643 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
644 Delete All BMC Partition File ${HTTP_OK}
645 Delete Local Partition File ${Partition_file_list}
646
647
648Redfish Delete Non Existence Partition File
649 [Documentation] Delete the partition file if do not exists.
650 [Arguments] ${file_name}
651
652 # Description of argument(s):
653 # file_name Partition file name.
654
655 @{Partition_file_list} = Split String ${file_name} ,
656 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND}
657
658
659Non Admin User To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600660 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500661 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
662
663 # Description of argument(s):
664 # file_name Partition file name.
665 # username Username.
666 # password Password.
667 # role Role of user.
668 # enabled Value can be True or False.
669
670 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600671 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500672 Initialize OpenBMC rest_username=${username} rest_password=${password}
673 @{Partition_file_list} = Split String ${file_name} ,
674 Create Partition File ${Partition_file_list}
675 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
676 Delete Local Partition File ${Partition_file_list}
677 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
678
679
680Non Admin Delete Non Existence Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600681 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500682 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
683
684 # Description of argument(s):
685 # file_name Partition file name.
686 # username Username.
687 # password Password.
688 # role Role of user.
689 # enabled Value can be True or False.
690
691 Redfish Create User ${username} ${password} ${role} ${enabled}
692 Delete All Sessions
693 Initialize OpenBMC rest_username=${username} rest_password=${password}
694 @{Partition_file_list} = Split String ${file_name} ,
695 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
696
697
698Verify Update Wrong Partition File To BMC
699 [Documentation] Upload the wrong partition file to BMC.
700 [Arguments] ${file_name}
701
702 # Description of argument(s):
703 # file_name Partition file name.
704
705 Redfish.Login
706 ${resp}= Run Keyword And Return Status
707 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
708 Should Be Equal As Strings ${resp} False