blob: c25109393f620f549c16a8787fa8b67722c6e337 [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
Sushil Singh177b4592022-09-20 08:25:25 -050011Resource ../../lib/external_intf/management_console_utils.robot
Vijayfcdadc52020-01-21 01:48:19 -060012
Vijay39373152020-02-14 08:08:20 -060013Suite Setup Suite Setup Execution
14Test Teardown Test Teardown Execution
15Suite Teardown Suite Teardown Execution
Vijayfcdadc52020-01-21 01:48:19 -060016
George Keishing7c32f302023-10-10 16:11:46 +053017Force Tags Savearea_Management
18
Vijayfcdadc52020-01-21 01:48:19 -060019*** Variables ***
20
Sushil Singhde1347d2022-07-13 02:54:26 -050021${MAXIMUM_FILE_SIZE_MESSAGE} File size exceeds maximum allowed size[25MB]
Sushil Singh1544c5e2021-11-03 07:56:37 -050022${MAXIMUM_DIR_SIZE_MESSAGE}
Sushil Singhde1347d2022-07-13 02:54:26 -050023... File size does not fit in the savearea directory maximum allowed size[25MB]
Sushil Singh251a0bc2021-08-24 01:12:14 -050024${FILE_UPLOAD_MESSAGE} File Created
25${FILE_DELETED_MESSAGE} File Deleted
26${FILE_UPDATED_MESSAGE} File Updated
27${FORBIDDEN_MESSAGE} Forbidden
28${ERROR_MESSAGE} Error while creating the file
29${RESOURCE_NOT_FOUND_MESSAGE} Resource Not Found
30${MINIMUM_FILE_SIZE_MESSAGE} File size is less than minimum allowed size[100B]
31${MAXIMUM_FILE_NAME_MESSAGE} Filename must be maximum 20 characters
32${UNSUPPORTED_FILE_NAME_MESSAGE} Unsupported character in filename
Vijayfcdadc52020-01-21 01:48:19 -060033
Sushil Singh251a0bc2021-08-24 01:12:14 -050034${content-1} Sample Content to test partition file upload
Sushil Singh85c381c2021-08-17 23:25:10 -050035... Sample Content to test partition file upload
36... Sample Content to test partition file upload
Sushil Singh251a0bc2021-08-24 01:12:14 -050037${content-2} Sample Content to test partition file upload after reboot
Sushil Singh85c381c2021-08-17 23:25:10 -050038... Sample Content to test partition file upload after reboot
39... Sample Content to test partition file upload after reboot
40
Sushil Singh44b8cf32021-11-17 06:57:09 -060041${LOOP_COUNT} 10
42
Vijayfcdadc52020-01-21 01:48:19 -060043*** Test Cases ***
44
Sushil Singh251a0bc2021-08-24 01:12:14 -050045Redfish Upload Lower Limit Partition File To BMC
46 [Documentation] Upload lower limit of allowed partition file to BMC using Redfish.
47 [Tags] Redfish_Upload_Lower_Limit_Partition_File_To_BMC
48 [Template] Redfish Upload Partition File
49
Sushil Singh255ec632021-08-26 08:08:21 -050050 # file_name
51 100-file
Sushil Singh251a0bc2021-08-24 01:12:14 -050052
53
Sushil Singhcbbce6a2020-09-07 00:57:37 -050054Redfish Upload Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050055 [Documentation] Upload partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050056 [Tags] Redfish_Upload_Partition_File_To_BMC
57 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060058
Sushil Singhcbbce6a2020-09-07 00:57:37 -050059 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050060 500KB-file
Sushil Singhde1347d2022-07-13 02:54:26 -050061 2000KB-file
Sushil Singh1544c5e2021-11-03 07:56:37 -050062 10000KB-file
Sushil Singhde1347d2022-07-13 02:54:26 -050063 25000KB-file
Vijayfcdadc52020-01-21 01:48:19 -060064
65
Sushil Singh255ec632021-08-26 08:08:21 -050066Test Upload Lower Limit Partition File To BMC And Expect Failure
67 [Documentation] Fail to upload partition file to BMC with file size
68 ... below the lower limit of allowed partition file size using Redfish.
69 [Tags] Test_Upload_Lower_Limit_Partition_File_To_BMC_And_Expect_Failure
70 [Template] Redfish Fail To Upload Partition File
71
Sushil Singh1544c5e2021-11-03 07:56:37 -050072 # file_name status_code partition_status response_message
73 99-file ${HTTP_BAD_REQUEST} 0 ${MINIMUM_FILE_SIZE_MESSAGE}
Sushil Singh255ec632021-08-26 08:08:21 -050074
75
Sushil Singh298d15d2021-12-14 07:21:09 -060076Test Upload Upper Limit Partition File To BMC And Expect Failure
77 [Documentation] Fail to upload partition file to BMC with file size
78 ... more than upper limit of allowed partition file size using Redfish.
79 [Tags] Test_Upload_Upper_Limit_Partition_File_To_BMC_And_Expect_Failure
Sushil Singhcbbce6a2020-09-07 00:57:37 -050080 [Template] Redfish Fail To Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060081
Sushil Singh1544c5e2021-11-03 07:56:37 -050082 # file_name status_code partition_status response_message
Sushil Singhde1347d2022-07-13 02:54:26 -050083 25001KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_FILE_SIZE_MESSAGE}
Vijayfcdadc52020-01-21 01:48:19 -060084
85
Sushil Singhcbbce6a2020-09-07 00:57:37 -050086Redfish Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050087 [Documentation] Upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050088 [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC
89 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060090
Sushil Singhcbbce6a2020-09-07 00:57:37 -050091 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050092 250KB-file,500KB-file
Vijayfcdadc52020-01-21 01:48:19 -060093
94
Sushil Singhf9eeec72021-12-14 08:31:59 -060095Test Upload Partition File When BMC Space Reach Max And Expect Failure
96 [Documentation] Fail to upload multiple partition file to BMC
97 ... as BMC directory reach to upper limit using Redfish.
98 [Tags] Test_Upload_Partition_File_When_BMC_Space_Reach_Max_And_Expect_Failure
Sushil Singhcbbce6a2020-09-07 00:57:37 -050099 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600100
Sushil Singh1544c5e2021-11-03 07:56:37 -0500101 # file_name status_code partition_status response_message
Sushil Singhde1347d2022-07-13 02:54:26 -0500102 15000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
103 16000KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
104 25000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
Sushil Singh1544c5e2021-11-03 07:56:37 -0500105 100-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
Vijay09839e22020-02-05 02:54:44 -0600106
107
Sushil Singhdf6ba522020-11-24 04:17:00 -0600108Redfish Upload Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500109 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhdf6ba522020-11-24 04:17:00 -0600110 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
111 [Template] Redfish Upload Partition File In Loop
112
113 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500114 500KB-file
Sushil Singhdf6ba522020-11-24 04:17:00 -0600115
116
Sushil Singhf39629c2020-12-11 07:30:21 -0600117Redfish Upload And Delete Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500118 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhf39629c2020-12-11 07:30:21 -0600119 [Tags] Redfish_Upload_And_Delete_Same_Partition_File_To_BMC_In_Loop
120 [Template] Redfish Upload And Delete Partition File In Loop
121
122 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500123 500KB-file
Sushil Singhf39629c2020-12-11 07:30:21 -0600124
125
Sushil Singh5d0782f2020-11-23 06:35:35 -0600126Redfish Partition File Upload Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500127 [Documentation] Upload partition file to BMC using Redfish, after the BMC reboot.
Sushil Singh5d0782f2020-11-23 06:35:35 -0600128 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
129 [Template] Verify Partition File Upload Post BMC Reboot
130
131 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500132 500KB-file
Sushil Singh5d0782f2020-11-23 06:35:35 -0600133
134
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500135Redfish Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500136 [Documentation] Upload partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500137 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
138 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600139
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500140 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500141 500KB-file
Vijay09839e22020-02-05 02:54:44 -0600142
143
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500144Redfish Multiple Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500145 [Documentation] Upload multiple partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500146 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
147 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600148
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500149 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500150 250KB-file,500KB-file
Vijay09839e22020-02-05 02:54:44 -0600151
152
Sushil Singhb22e4b62021-12-15 00:54:53 -0600153Redfish Read Partition File From BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500154 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhb22e4b62021-12-15 00:54:53 -0600155 [Tags] Redfish_Read_Partition_File_From_BMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500156 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600157
Sushil Singh85c381c2021-08-17 23:25:10 -0500158 # file_name reboot_flag
159 testfile01-file False
160 testfile01-file,testfile02-file False
Vijay09839e22020-02-05 02:54:44 -0600161
Vijay09839e22020-02-05 02:54:44 -0600162
Sushil Singhb22e4b62021-12-15 00:54:53 -0600163Redfish Read Partition File Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500164 [Documentation] Upload partition file to BMC using Redfish and verify the content after reboot.
Sushil Singhb22e4b62021-12-15 00:54:53 -0600165 [Tags] Redfish_Read_Partition_File_Post_BMC_Reboot
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500166 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600167
Sushil Singh85c381c2021-08-17 23:25:10 -0500168 # file_name reboot_flag
169 testfile01-file True
170 testfile01-file,testfile02-file True
Vijay09839e22020-02-05 02:54:44 -0600171
Vijay09839e22020-02-05 02:54:44 -0600172
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500173Redfish Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500174 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500175 [Tags] Redfish_Update_Partition_File_On_BMC
176 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600177
Sushil Singh85c381c2021-08-17 23:25:10 -0500178 # file_name reboot_flag
179 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500180
181
182Redfish Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500183 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500184 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
185 [Template] Redfish Update Partition File With Different Content
186
Sushil Singh85c381c2021-08-17 23:25:10 -0500187 # file_name reboot_flag
188 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500189
190
191Redfish Persistency Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500192 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500193 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
194 [Template] Redfish Update Partition File With Same Content
195
Sushil Singh85c381c2021-08-17 23:25:10 -0500196 # file_name reboot_flag
197 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500198
199
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500200Redfish Delete Non Existence Of Partition File
201 [Documentation] Delete the partition file if do not exists.
202 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
203 [Template] Redfish Delete Non Existence Partition File
204
205 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500206 testfile01-file
Vijay09839e22020-02-05 02:54:44 -0600207
208
209Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500210 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600211 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500212 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600213
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500214 # range
215 1000
Vijay09839e22020-02-05 02:54:44 -0600216
Vijay09839e22020-02-05 02:54:44 -0600217
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500218Non Admin Users Fail To Upload Partition File
219 [Documentation] Non admin user will fail to upload the partition file.
220 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
221 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600222
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500223 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500224 500KB-file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600225
226
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500227Non Admin User Delete Non Existence Of Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600228 [Documentation] Delete the partition file if does not exists.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500229 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
230 [Template] Non Admin Delete Non Existence Partition File
231
232 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500233 500KB-file operator_user TestPwd123 Operator
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500234
235
236Redfish Update Wrong Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500237 [Documentation] Upload partition file to BMC by wrong URI using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500238 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
239 [Template] Verify Update Wrong Partition File To BMC
240
241 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500242 500KB-file
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500243
Sushil Singh9942df52021-09-03 02:28:11 -0500244
245Test Redfish Upload Partition File Name With Character Limit To BMC
246 [Documentation] Upload partition file to BMC with file name character allowed limit
247 ... and above allowed limit using Redfish.
248 [Tags] Test_Redfish_Upload_Partition_File_Name_With_Character_Limit_To_BMC
249 [Template] Check Redfish Upload Partition File Name With Character Limit To BMC
250
251 # file_name status_code message
252 50KB-testfilesavfile ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
253 50KB-testsaveareafile ${HTTP_BAD_REQUEST} ${MAXIMUM_FILE_NAME_MESSAGE}
254
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500255
256Test Redfish Fail To Upload Partition File Name With Special Character To BMC
257 [Documentation] Upload partition file to BMC with special character file name and
258 ... Redfish through an error.
259 [Tags] Test_Redfish_Fail_To_Upload_Partition_File_Name_With_Special_Character_To_BMC
260 [Template] Check Redfish Fail To Upload Partition File Name With Special Character To BMC
261
262 # file_name status_code message
263 1KB-*filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
264 1KB-!filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
265 1KB-@filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
266
Sushil Singh44b8cf32021-11-17 06:57:09 -0600267
Sushil Singh404416d2022-12-23 08:14:43 -0600268Redfish Persistency Update Partition File Post BMC Reboot
269 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
270 [Tags] Redfish_Persistency_Update_Partition_File_Post_BMC_Reboot
271 [Template] Redfish Update Partition File With Same Content
272
273 # file_name reboot_flag
274 testfile01-file True
275
276
Sushil Singh44b8cf32021-11-17 06:57:09 -0600277Redfish Upload Validated Partition File From Path To BMC
278 [Documentation] Upload valid partition file to BMC from file path define by user in loop.
279 ... By default loop count values is 10 times.
280 [Tags] Redfish_Upload_Validated_Partition_File_From_Path_To_BMC
281
282 Log To Console ${EMPTY}
283 FOR ${count} IN RANGE 1 ${LOOP_COUNT} + 1
284 Log To Console **************************************
285 Log To Console * The Current Loop Count is ${count} of ${LOOP_COUNT} *
286 Log To Console **************************************
287
288 Redfish Upload Partition File From Path ${PARTITION_FILE_PATH}
289 END
290
Vijayfcdadc52020-01-21 01:48:19 -0600291*** Keywords ***
292
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500293Suite Setup Execution
294 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600295
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500296 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600297
298
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500299Test Teardown Execution
300 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600301
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500302 Delete All BMC Partition File ${HTTP_OK}
303 FFDC On Test Case Fail
304
305
306Suite Teardown Execution
307 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600308
309 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600310
311
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500312Delete Local Partition File
313 [Documentation] Delete local partition file.
314 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600315
316 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500317 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600318
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500319 FOR ${conf_file} IN @{file_name}
320 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
321 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
322 END
Vijayfcdadc52020-01-21 01:48:19 -0600323
Vijayfcdadc52020-01-21 01:48:19 -0600324
Sushil Singh1544c5e2021-11-03 07:56:37 -0500325Delete Local Server Partition File
326 [Documentation] Local partition files which is getting uploaded to BMC,
327 ... will get deleted after the uploads. If partition file name consist
328 ... of “-file then partition file gets deleted.
329
330 @{conf_file_list} = OperatingSystem.List Files In Directory ${EXECDIR}
331 ${match_conf_file_list}= Get Matches ${conf_file_list} regexp=.*-file case_insensitive=${True}
332
333 ${num_records}= Get Length ${match_conf_file_list}
334 Return From Keyword If ${num_records} == ${0} ${EMPTY}
335
336 FOR ${conf_file} IN @{match_conf_file_list}
337 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
338 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
339 END
340
341
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500342Create Partition File
343 [Documentation] Create Partition file.
344 [Arguments] ${file_name}
345
346 # Description of argument(s):
347 # file_name Partition file name.
348
349 Delete Local Partition File ${file_name}
350
351 FOR ${conf_file} IN @{file_name}
Sushil Singh85c381c2021-08-17 23:25:10 -0500352 @{words}= Split String ${conf_file} -
Sushil Singh255ec632021-08-26 08:08:21 -0500353 Run dd if=/dev/zero of=${conf_file} bs=${words}[-0] count=1
Sushil Singh251a0bc2021-08-24 01:12:14 -0500354 OperatingSystem.File Should Exist ${conf_file}
355 END
356
357
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500358Delete BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500359 [Documentation] Delete single partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500360 [Arguments] ${file_name} ${status_code} ${expected_message}
361
362 # Description of argument(s):
363 # file_name Partition file name.
364 # status_code HTTPS status code.
365 # expected_message Expected message of URI.
366
367 FOR ${conf_file} IN @{file_name}
368 ${data}= Create Dictionary
369 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
370 Set To Dictionary ${data} headers ${headers}
371
George Keishingfbd67002022-08-01 11:24:03 -0500372 ${resp}= DELETE On Session openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
373 ... expected_status=any
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500374 Should Be Equal As Strings ${resp.status_code} ${status_code}
375
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500376 ${description}= Return Description Of Response ${resp.text}
377 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500378 END
379
380
381Delete All BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500382 [Documentation] Delete multiple partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500383 [Arguments] ${status_code}
384
385 # Description of argument(s):
386 # status_code HTTPS status code.
387
388 Initialize OpenBMC
389 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600390 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600391 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600392
George Keishingfbd67002022-08-01 11:24:03 -0500393 ${resp}= POST On Session openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
394 ... expected_status=any
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500395 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600396
397
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500398Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600399 [Documentation] Return description of REST response.
400 [Arguments] ${resp_text}
401
402 # Description of argument(s):
403 # resp_text REST response body.
404
405 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500406 # {
407 # "Description": "File Created"
408 # }
Vijay09839e22020-02-05 02:54:44 -0600409
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500410 ${status}= Run Keyword And Return Status Evaluate isinstance(${resp_text}, dict)
411 Return From Keyword If '${status}' == 'False' ${resp_text}
Vijay09839e22020-02-05 02:54:44 -0600412 ${message}= Evaluate json.loads('''${resp_text}''') json
413
414 [Return] ${message["Description"]}
415
416
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500417Upload Partition File To BMC
418 [Documentation] Upload partition file to BMC.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600419 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True} ${path}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600420
421 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500422 # file_name Partition file name.
423 # status_code HTTPS status code.
424 # expected_message Expected message of URI.
425 # flag If True run part of program, else skip.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600426 # path Partition file path.
Vijay09839e22020-02-05 02:54:44 -0600427
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500428 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
429 FOR ${conf_file} IN @{file_name}
430 # Get the content of the file and upload to BMC.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600431 ${image_data}= OperatingSystem.Get Binary File ${path}${conf_file}
Sushil Singh85c381c2021-08-17 23:25:10 -0500432 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
Vijay09839e22020-02-05 02:54:44 -0600433
Sushil Singh85c381c2021-08-17 23:25:10 -0500434 ${kwargs}= Create Dictionary data=${image_data}
435 Set To Dictionary ${kwargs} headers ${headers}
George Keishingfbd67002022-08-01 11:24:03 -0500436 ${resp}= PUT On Session openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{kwargs} timeout=10
437 ... expected_status=any
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500438 Should Be Equal As Strings ${resp.status_code} ${status_code}
439
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500440 ${description}= Return Description Of Response ${resp.text}
441 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500442 END
Vijayfcdadc52020-01-21 01:48:19 -0600443
444
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500445Verify Partition File On BMC
446 [Documentation] Verify partition file on BMC.
447 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600448
449 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500450 # file_name Partition file name.
451 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600452
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500453 FOR ${conf_file} IN @{file_name}
454 ${status} ${stderr} ${rc}= BMC Execute Command
Sushil Singhe5f39ee2021-01-06 00:39:12 -0600455 ... ls -l /var/lib/bmcweb/ibm-management-console/configfiles/${conf_file} | wc -l
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500456 Valid Value ${status} [${Partition_status}]
457 END
Vijayfcdadc52020-01-21 01:48:19 -0600458
459
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500460Redfish Upload Partition File
461 [Documentation] Upload the partition file.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500462 [Arguments] ${file_name} ${file_size}=${EMPTY}
Vijayfcdadc52020-01-21 01:48:19 -0600463
464 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500465 # file_name Partition file name.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500466 # file_size By Default is set to EMPTY,
467 # if user pass small_file_size the create file with small
468 # size keyword gets executed.
Vijayfcdadc52020-01-21 01:48:19 -0600469
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500470 @{Partition_file_list} = Split String ${file_name} ,
471 ${num_records}= Get Length ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500472
Sushil Singh255ec632021-08-26 08:08:21 -0500473 Create Partition File ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500474
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500475 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
476 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
477 Run Keyword If ${num_records} == ${1}
478 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
479 ... ELSE
480 ... Delete All BMC Partition File ${HTTP_OK}
481 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600482
483
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500484Redfish Fail To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600485 [Documentation] Fail to upload the partition file.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500486 [Arguments] ${file_name} ${status_code} ${partition_status} ${response_message}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600487
488 # Description of argument(s):
Sushil Singh255ec632021-08-26 08:08:21 -0500489 # file_name Partition file name.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500490 # status_code HTTPS status code.
491 # partition_status Partition status.
Sushil Singh255ec632021-08-26 08:08:21 -0500492 # response_message By default is set to EMPTY,
Sushil Singh1544c5e2021-11-03 07:56:37 -0500493 # else user provide the information when user upload the partition with file size
Sushil Singh255ec632021-08-26 08:08:21 -0500494 # below lower linit of allowed partition or more than of large allowed partition.
Vijay09839e22020-02-05 02:54:44 -0600495
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500496 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh255ec632021-08-26 08:08:21 -0500497
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500498 Create Partition File ${Partition_file_list}
Sushil Singh1544c5e2021-11-03 07:56:37 -0500499 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${response_message}
500 Verify Partition File On BMC ${Partition_file_list} Partition_status=${partition_status}
Sushil Singh255ec632021-08-26 08:08:21 -0500501
Sushil Singh1544c5e2021-11-03 07:56:37 -0500502 Run Keyword If ${partition_status} == 0
503 ... Run Keywords
504 ... Delete BMC Partition File
505 ... ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE} AND
506 ... Delete All BMC Partition File ${HTTP_OK} AND
507 ... Delete Local Server Partition File
508
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500509 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600510
511
Sushil Singhdf6ba522020-11-24 04:17:00 -0600512Redfish Upload Partition File In Loop
513 [Documentation] Upload the same partition file multiple times in loop to BMC.
514 [Arguments] ${file_name}
515
516 # Description of argument(s):
517 # file_name Partition file name.
518
519 @{Partition_file_list} = Split String ${file_name} ,
520 Create Partition File ${Partition_file_list}
521
522 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
523 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
524
525 FOR ${count} IN RANGE 1 11
Sushil Singh251a0bc2021-08-24 01:12:14 -0500526 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhdf6ba522020-11-24 04:17:00 -0600527 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
528 END
529
530 Initialize OpenBMC
531 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
532 Delete Local Partition File ${Partition_file_list}
533
534
Sushil Singhf39629c2020-12-11 07:30:21 -0600535Redfish Upload And Delete Partition File In Loop
536 [Documentation] Upload the same partition file multiple times in loop to BMC.
537 [Arguments] ${file_name}
538
539 # Description of argument(s):
540 # file_name Partition file name.
541
542 FOR ${count} IN RANGE 1 11
543 Redfish Upload Partition File ${file_name}
544 END
545
546
Sushil Singh5d0782f2020-11-23 06:35:35 -0600547Verify Partition File Upload Post BMC Reboot
548 [Documentation] Upload the partition file, after BMC reboot.
549 [Arguments] ${file_name}
550
551 # Description of argument(s):
552 # file_name Partition file name.
553
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600554 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
555 Redfish BMC Reset Operation
556 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
557
Sushil Singh177b4592022-09-20 08:25:25 -0500558 Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600559 Is BMC Standby
Sushil Singh5d0782f2020-11-23 06:35:35 -0600560
561 Redfish Upload Partition File ${file_name}
562
563
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500564Redfish Partition File Persistency
565 [Documentation] Upload the partition file and check for persistency after reboot.
566 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600567
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500568 # Description of argument(s):
569 # file_name Partition file name.
570
571 @{Partition_file_list} = Split String ${file_name} ,
572 ${num_records}= Get Length ${Partition_file_list}
573 Create Partition File ${Partition_file_list}
574 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
575 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600576
577 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
578 Redfish BMC Reset Operation
579 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
580
Sushil Singh177b4592022-09-20 08:25:25 -0500581 Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600582 Is BMC Standby
583
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500584 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600585 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500586 Run Keyword If ${num_records} == ${1}
587 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
588 ... ELSE
589 ... Delete All BMC Partition File ${HTTP_OK}
590 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600591
592
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500593Verify Redfish Partition File Content
594 [Documentation] Verify partition file content.
595 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600596
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500597 # Description of argument(s):
598 # file_name Partition file name.
599 # content_dict Dict contain the content.
600 # status_code HTTPS status code.
601
602 FOR ${conf_file} IN @{file_name}
George Keishingfbd67002022-08-01 11:24:03 -0500603 ${resp}= GET On Session openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
604 ... expected_status=any
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500605 Should Be Equal As Strings ${resp.status_code} ${status_code}
606
607 ${Partition_file_data}= Remove String ${resp.text} \\n
608 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
609 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
610 END
Vijayfcdadc52020-01-21 01:48:19 -0600611
Vijay39373152020-02-14 08:08:20 -0600612
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500613Add Content To Files
614 [Documentation] Add defined content in partition file.
615 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600616
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500617 # Description of argument(s):
618 # file_name Partition file name.
619 # index Index
620
621 ${num_records}= Get Length ${file_name}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500622 &{content_dict}= Create Dictionary
Sushil Singh85c381c2021-08-17 23:25:10 -0500623
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500624 FOR ${conf_file} IN @{file_name}
625 ${index}= Get Index From List ${file_name} ${conf_file}
626 ${index}= Evaluate ${index} + 1
627
628 Run echo "${content-${index}}" > ${conf_file}
629 OperatingSystem.File Should Exist ${conf_file}
630
631 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
632 END
633
634 [Return] &{content_dict}
635
636
637Redfish Read Partition File
638 [Documentation] Read partition file content.
639 [Arguments] ${file_name} ${reboot_flag}=False
640
641 # Description of argument(s):
642 # file_name Partition file name.
643 # reboot_flag Reboot flag.
644
645 @{Partition_file_list} = Split String ${file_name} ,
646 ${content_dict}= Add Content To Files ${Partition_file_list}
647
648 ${num_records}= Get Length ${Partition_file_list}
649
650 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
651 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
652 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
653
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600654 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
655
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500656 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600657 ... Run Keywords Redfish BMC Reset Operation AND
658 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
Sushil Singh177b4592022-09-20 08:25:25 -0500659 ... Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled AND
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600660 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500661 ... Initialize OpenBMC AND
662 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600663
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500664 Run Keyword If ${num_records} == ${1}
665 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
666 ... ELSE
667 ... Delete All BMC Partition File ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600668
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500669 Delete Local Partition File ${Partition_file_list}
670
671
672Redfish Update Partition File With Same Content
673 [Documentation] Update partition file with same content.
674 [Arguments] ${file_name} ${reboot_flag}=False
675
676 # Description of argument(s):
677 # file_name Partition file name.
678 # reboot_flag Reboot flag.
679
680 @{Partition_file_list} = Split String ${file_name} ,
681 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
682
683 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
684 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
685 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
686
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600687 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
688
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500689 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600690 ... Run Keywords Redfish BMC Reset Operation AND
691 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
Sushil Singh177b4592022-09-20 08:25:25 -0500692 ... Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled AND
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600693 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500694 ... Initialize OpenBMC
695
696 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500697 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500698 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
699 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
700
701 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
702 Delete Local Partition File ${Partition_file_list}
703
704
705Redfish Update Partition File With Different Content
706 [Documentation] Update partition file with different content.
707 [Arguments] ${file_name} ${reboot_flag}=False
708
709 # Description of argument(s):
710 # file_name Partition file name.
711 # reboot_flag Reboot flag.
712
713 @{Partition_file_list} = Split String ${file_name} ,
714 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
715
716 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
717 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
718 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
719
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600720 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
721
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500722 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600723 ... Run Keywords Redfish BMC Reset Operation AND
724 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
Sushil Singh177b4592022-09-20 08:25:25 -0500725 ... Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled AND
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600726 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500727 ... Initialize OpenBMC
728
729 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500730 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500731 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
732 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
733
734 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
735 Delete Local Partition File ${Partition_file_list}
736
737
738Create File Names
739 [Documentation] Create partition file names.
740 [Arguments] ${range}
741
742 # Description of argument(s):
743 # range Range in numbers.
744
745 @{file_name_list}= Create List
746 Set Test Variable ${file_name} rangefile
747 FOR ${count} IN RANGE ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500748 Append To List ${file_name_list} 1KB-file${count}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500749 END
750 [Return] ${file_name_list}
751
752
753Redfish Upload Partition File With Range
754 [Documentation] Upload the partition file with the range of files.
755 [Arguments] ${range}
756
757 # Description of argument(s):
758 # range Range in numbers.
759
760 ${Partition_file_list}= Create File Names ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500761 Delete Local Partition File ${Partition_file_list}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500762 Create Partition File ${Partition_file_list}
763 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
764 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
765 Delete All BMC Partition File ${HTTP_OK}
766 Delete Local Partition File ${Partition_file_list}
767
768
769Redfish Delete Non Existence Partition File
770 [Documentation] Delete the partition file if do not exists.
771 [Arguments] ${file_name}
772
773 # Description of argument(s):
774 # file_name Partition file name.
775
776 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh251a0bc2021-08-24 01:12:14 -0500777 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500778
779
780Non Admin User To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600781 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500782 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
783
784 # Description of argument(s):
785 # file_name Partition file name.
786 # username Username.
787 # password Password.
788 # role Role of user.
789 # enabled Value can be True or False.
790
791 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600792 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500793 Initialize OpenBMC rest_username=${username} rest_password=${password}
794 @{Partition_file_list} = Split String ${file_name} ,
795 Create Partition File ${Partition_file_list}
796 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
797 Delete Local Partition File ${Partition_file_list}
798 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
799
800
801Non Admin Delete Non Existence Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600802 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500803 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
804
805 # Description of argument(s):
806 # file_name Partition file name.
807 # username Username.
808 # password Password.
809 # role Role of user.
810 # enabled Value can be True or False.
811
812 Redfish Create User ${username} ${password} ${role} ${enabled}
813 Delete All Sessions
814 Initialize OpenBMC rest_username=${username} rest_password=${password}
815 @{Partition_file_list} = Split String ${file_name} ,
816 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
817
818
819Verify Update Wrong Partition File To BMC
820 [Documentation] Upload the wrong partition file to BMC.
821 [Arguments] ${file_name}
822
823 # Description of argument(s):
824 # file_name Partition file name.
825
826 Redfish.Login
827 ${resp}= Run Keyword And Return Status
828 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
829 Should Be Equal As Strings ${resp} False
Sushil Singh9942df52021-09-03 02:28:11 -0500830
831
832Check Redfish Upload Partition File Name With Character Limit To BMC
833 [Documentation] Upload the partition file to BMC with file name character limit.
834 [Arguments] ${file_name} ${status_code} ${message}
835
836 # Description of argument(s):
837 # file_name Partition file name.
838 # status_code HTTPS status code.
839 # message Expected message of from upload partition file URI.
840
841 @{Partition_file_list} = Split String ${file_name} ,
842 ${num_records}= Get Length ${Partition_file_list}
843 Create Partition File ${Partition_file_list}
844
845 ${file_name_length}= Get Length ${Partition_file_list}[0]
846
847 Run Keyword If ${file_name_length} == 20
848 ... Run Keywords
849 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message} AND
850 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1 AND
851 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
852 ... ELSE
853 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
854
855 Delete Local Partition File ${Partition_file_list}
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500856
857
858Check Redfish Fail To Upload Partition File Name With Special Character To BMC
859 [Documentation] Upload the partition file to BMC with special character file name.
860 [Arguments] ${file_name} ${status_code} ${message}
861
862 # Description of argument(s):
863 # file_name Partition file name.
864 # status_code HTTPS status code.
865 # message Expected message from upload partition file URI.
866
867 @{Partition_file_list} = Split String ${file_name} ,
868 ${num_records}= Get Length ${Partition_file_list}
869
870 Create Partition File ${Partition_file_list}
871
872 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
873
874 ${status}= Run Keyword And Return Status
875 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1
876 Should Be Equal As Strings ${status} False
877
878 Delete Local Partition File ${Partition_file_list}
Sushil Singh44b8cf32021-11-17 06:57:09 -0600879
880
881Redfish Upload Partition File From Path
882 [Documentation] Upload the partition file to BMC from file path.
883 [Arguments] ${PARTITION_FILE_PATH}
884
885 # Description of argument(s):
886 # PARTITION_FILE_PATH Partition file path.
887
888 ${file_list} = OperatingSystem.List Files In Directory ${PARTITION_FILE_PATH}
889
890 ${num_records}= Get Length ${file_list}
891 Should Not Be Equal As Integers ${num_records} 0
892
893 FOR ${file_name} IN @{file_list}
894 @{Partition_file_list} = Split String ${file_name} ,
895 ${num_records}= Get Length ${Partition_file_list}
George Keishing538f1742022-03-14 05:00:55 -0500896 Upload Partition File To BMC file_name=${Partition_file_list}
897 ... status_code=${HTTP_OK} expected_message=${FILE_UPLOAD_MESSAGE} path=${PARTITION_FILE_PATH}
Sushil Singh44b8cf32021-11-17 06:57:09 -0600898 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
899 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
900 END
901