blob: a6e7245b0cec6a95f44df1085ca6244dc5368052 [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 Singh1544c5e2021-11-03 07:56:37 -050018${MAXIMUM_FILE_SIZE_MESSAGE} File size exceeds maximum allowed size[10MB]
19${MAXIMUM_DIR_SIZE_MESSAGE}
20... File size does not fit in the savearea directory maximum allowed size[10MB]
Sushil Singh251a0bc2021-08-24 01:12:14 -050021${FILE_UPLOAD_MESSAGE} File Created
22${FILE_DELETED_MESSAGE} File Deleted
23${FILE_UPDATED_MESSAGE} File Updated
24${FORBIDDEN_MESSAGE} Forbidden
25${ERROR_MESSAGE} Error while creating the file
26${RESOURCE_NOT_FOUND_MESSAGE} Resource Not Found
27${MINIMUM_FILE_SIZE_MESSAGE} File size is less than minimum allowed size[100B]
28${MAXIMUM_FILE_NAME_MESSAGE} Filename must be maximum 20 characters
29${UNSUPPORTED_FILE_NAME_MESSAGE} Unsupported character in filename
Vijayfcdadc52020-01-21 01:48:19 -060030
Sushil Singh251a0bc2021-08-24 01:12:14 -050031${content-1} Sample Content to test partition file upload
Sushil Singh85c381c2021-08-17 23:25:10 -050032... Sample Content to test partition file upload
33... Sample Content to test partition file upload
Sushil Singh251a0bc2021-08-24 01:12:14 -050034${content-2} Sample Content to test partition file upload after reboot
Sushil Singh85c381c2021-08-17 23:25:10 -050035... Sample Content to test partition file upload after reboot
36... Sample Content to test partition file upload after reboot
37
Sushil Singh44b8cf32021-11-17 06:57:09 -060038${LOOP_COUNT} 10
39
Vijayfcdadc52020-01-21 01:48:19 -060040*** Test Cases ***
41
Sushil Singh251a0bc2021-08-24 01:12:14 -050042Redfish Upload Lower Limit Partition File To BMC
43 [Documentation] Upload lower limit of allowed partition file to BMC using Redfish.
44 [Tags] Redfish_Upload_Lower_Limit_Partition_File_To_BMC
45 [Template] Redfish Upload Partition File
46
Sushil Singh255ec632021-08-26 08:08:21 -050047 # file_name
48 100-file
Sushil Singh251a0bc2021-08-24 01:12:14 -050049
50
Sushil Singhcbbce6a2020-09-07 00:57:37 -050051Redfish Upload Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050052 [Documentation] Upload partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050053 [Tags] Redfish_Upload_Partition_File_To_BMC
54 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060055
Sushil Singhcbbce6a2020-09-07 00:57:37 -050056 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050057 500KB-file
Sushil Singh1544c5e2021-11-03 07:56:37 -050058 501KB-file
59 550KB-file
60 10000KB-file
Vijayfcdadc52020-01-21 01:48:19 -060061
62
Sushil Singh255ec632021-08-26 08:08:21 -050063Test Upload Lower Limit Partition File To BMC And Expect Failure
64 [Documentation] Fail to upload partition file to BMC with file size
65 ... below the lower limit of allowed partition file size using Redfish.
66 [Tags] Test_Upload_Lower_Limit_Partition_File_To_BMC_And_Expect_Failure
67 [Template] Redfish Fail To Upload Partition File
68
Sushil Singh1544c5e2021-11-03 07:56:37 -050069 # file_name status_code partition_status response_message
70 99-file ${HTTP_BAD_REQUEST} 0 ${MINIMUM_FILE_SIZE_MESSAGE}
Sushil Singh255ec632021-08-26 08:08:21 -050071
72
Sushil Singh298d15d2021-12-14 07:21:09 -060073Test Upload Upper Limit Partition File To BMC And Expect Failure
74 [Documentation] Fail to upload partition file to BMC with file size
75 ... more than upper limit of allowed partition file size using Redfish.
76 [Tags] Test_Upload_Upper_Limit_Partition_File_To_BMC_And_Expect_Failure
Sushil Singhcbbce6a2020-09-07 00:57:37 -050077 [Template] Redfish Fail To Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060078
Sushil Singh1544c5e2021-11-03 07:56:37 -050079 # file_name status_code partition_status response_message
80 10001KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_FILE_SIZE_MESSAGE}
Vijayfcdadc52020-01-21 01:48:19 -060081
82
Sushil Singhcbbce6a2020-09-07 00:57:37 -050083Redfish Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050084 [Documentation] Upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050085 [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC
86 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060087
Sushil Singhcbbce6a2020-09-07 00:57:37 -050088 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050089 250KB-file,500KB-file
Vijayfcdadc52020-01-21 01:48:19 -060090
91
Sushil Singhcbbce6a2020-09-07 00:57:37 -050092Redfish Fail To Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050093 [Documentation] Fail to upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050094 [Tags] Redfish_Fail_To_Upload_Multiple_Partition_File_To_BMC
95 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -060096
Sushil Singh1544c5e2021-11-03 07:56:37 -050097 # file_name status_code partition_status response_message
98 5000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
99 6000KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
100 10000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
101 100-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
Vijay09839e22020-02-05 02:54:44 -0600102
103
Sushil Singhdf6ba522020-11-24 04:17:00 -0600104Redfish Upload Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500105 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhdf6ba522020-11-24 04:17:00 -0600106 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
107 [Template] Redfish Upload Partition File In Loop
108
109 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500110 500KB-file
Sushil Singhdf6ba522020-11-24 04:17:00 -0600111
112
Sushil Singhf39629c2020-12-11 07:30:21 -0600113Redfish Upload And Delete Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500114 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhf39629c2020-12-11 07:30:21 -0600115 [Tags] Redfish_Upload_And_Delete_Same_Partition_File_To_BMC_In_Loop
116 [Template] Redfish Upload And Delete Partition File In Loop
117
118 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500119 500KB-file
Sushil Singhf39629c2020-12-11 07:30:21 -0600120
121
Sushil Singh5d0782f2020-11-23 06:35:35 -0600122Redfish Partition File Upload Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500123 [Documentation] Upload partition file to BMC using Redfish, after the BMC reboot.
Sushil Singh5d0782f2020-11-23 06:35:35 -0600124 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
125 [Template] Verify Partition File Upload Post BMC Reboot
126
127 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500128 500KB-file
Sushil Singh5d0782f2020-11-23 06:35:35 -0600129
130
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500131Redfish Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500132 [Documentation] Upload partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500133 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
134 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600135
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500136 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500137 500KB-file
Vijay09839e22020-02-05 02:54:44 -0600138
139
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500140Redfish Multiple Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500141 [Documentation] Upload multiple partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500142 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
143 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600144
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500145 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500146 250KB-file,500KB-file
Vijay09839e22020-02-05 02:54:44 -0600147
148
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500149Redfish Read Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500150 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500151 [Tags] Redfish_Read_Partition_File_On_BMC
152 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600153
Sushil Singh85c381c2021-08-17 23:25:10 -0500154 # file_name reboot_flag
155 testfile01-file False
156 testfile01-file,testfile02-file False
Vijay09839e22020-02-05 02:54:44 -0600157
Vijay09839e22020-02-05 02:54:44 -0600158
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500159Redfish Read Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500160 [Documentation] Upload partition file to BMC using Redfish and verify the content after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500161 [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot
162 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600163
Sushil Singh85c381c2021-08-17 23:25:10 -0500164 # file_name reboot_flag
165 testfile01-file True
166 testfile01-file,testfile02-file True
Vijay09839e22020-02-05 02:54:44 -0600167
Vijay09839e22020-02-05 02:54:44 -0600168
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500169Redfish Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500170 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500171 [Tags] Redfish_Update_Partition_File_On_BMC
172 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600173
Sushil Singh85c381c2021-08-17 23:25:10 -0500174 # file_name reboot_flag
175 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500176
177
178Redfish Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500179 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500180 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
181 [Template] Redfish Update Partition File With Different Content
182
Sushil Singh85c381c2021-08-17 23:25:10 -0500183 # file_name reboot_flag
184 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500185
186
187Redfish Persistency Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500188 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500189 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
190 [Template] Redfish Update Partition File With Same Content
191
Sushil Singh85c381c2021-08-17 23:25:10 -0500192 # file_name reboot_flag
193 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500194
195
196Redfish Persistency Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500197 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500198 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC_Reboot
199 [Template] Redfish Update Partition File With Same Content
200
Sushil Singh85c381c2021-08-17 23:25:10 -0500201 # file_name reboot_flag
202 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500203
204
205Redfish Delete Non Existence Of Partition File
206 [Documentation] Delete the partition file if do not exists.
207 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
208 [Template] Redfish Delete Non Existence Partition File
209
210 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500211 testfile01-file
Vijay09839e22020-02-05 02:54:44 -0600212
213
214Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500215 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600216 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500217 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600218
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500219 # range
220 1000
Vijay09839e22020-02-05 02:54:44 -0600221
Vijay09839e22020-02-05 02:54:44 -0600222
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500223Non Admin Users Fail To Upload Partition File
224 [Documentation] Non admin user will fail to upload the partition file.
225 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
226 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600227
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500228 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500229 500KB-file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600230
231
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500232Non Admin User Delete Non Existence Of Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600233 [Documentation] Delete the partition file if does not exists.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500234 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
235 [Template] Non Admin Delete Non Existence Partition File
236
237 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500238 500KB-file operator_user TestPwd123 Operator
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500239
240
241Redfish Update Wrong Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500242 [Documentation] Upload partition file to BMC by wrong URI using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500243 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
244 [Template] Verify Update Wrong Partition File To BMC
245
246 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500247 500KB-file
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500248
Sushil Singh9942df52021-09-03 02:28:11 -0500249
250Test Redfish Upload Partition File Name With Character Limit To BMC
251 [Documentation] Upload partition file to BMC with file name character allowed limit
252 ... and above allowed limit using Redfish.
253 [Tags] Test_Redfish_Upload_Partition_File_Name_With_Character_Limit_To_BMC
254 [Template] Check Redfish Upload Partition File Name With Character Limit To BMC
255
256 # file_name status_code message
257 50KB-testfilesavfile ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
258 50KB-testsaveareafile ${HTTP_BAD_REQUEST} ${MAXIMUM_FILE_NAME_MESSAGE}
259
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500260
261Test Redfish Fail To Upload Partition File Name With Special Character To BMC
262 [Documentation] Upload partition file to BMC with special character file name and
263 ... Redfish through an error.
264 [Tags] Test_Redfish_Fail_To_Upload_Partition_File_Name_With_Special_Character_To_BMC
265 [Template] Check Redfish Fail To Upload Partition File Name With Special Character To BMC
266
267 # file_name status_code message
268 1KB-*filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
269 1KB-!filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
270 1KB-@filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
271
Sushil Singh44b8cf32021-11-17 06:57:09 -0600272
273Redfish Upload Validated Partition File From Path To BMC
274 [Documentation] Upload valid partition file to BMC from file path define by user in loop.
275 ... By default loop count values is 10 times.
276 [Tags] Redfish_Upload_Validated_Partition_File_From_Path_To_BMC
277
278 Log To Console ${EMPTY}
279 FOR ${count} IN RANGE 1 ${LOOP_COUNT} + 1
280 Log To Console **************************************
281 Log To Console * The Current Loop Count is ${count} of ${LOOP_COUNT} *
282 Log To Console **************************************
283
284 Redfish Upload Partition File From Path ${PARTITION_FILE_PATH}
285 END
286
Vijayfcdadc52020-01-21 01:48:19 -0600287*** Keywords ***
288
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500289Suite Setup Execution
290 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600291
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500292 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600293
294
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500295Test Teardown Execution
296 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600297
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500298 Delete All BMC Partition File ${HTTP_OK}
299 FFDC On Test Case Fail
300
301
302Suite Teardown Execution
303 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600304
305 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600306
307
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500308Delete Local Partition File
309 [Documentation] Delete local partition file.
310 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600311
312 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500313 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600314
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500315 FOR ${conf_file} IN @{file_name}
316 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
317 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
318 END
Vijayfcdadc52020-01-21 01:48:19 -0600319
Vijayfcdadc52020-01-21 01:48:19 -0600320
Sushil Singh1544c5e2021-11-03 07:56:37 -0500321Delete Local Server Partition File
322 [Documentation] Local partition files which is getting uploaded to BMC,
323 ... will get deleted after the uploads. If partition file name consist
324 ... of “-file then partition file gets deleted.
325
326 @{conf_file_list} = OperatingSystem.List Files In Directory ${EXECDIR}
327 ${match_conf_file_list}= Get Matches ${conf_file_list} regexp=.*-file case_insensitive=${True}
328
329 ${num_records}= Get Length ${match_conf_file_list}
330 Return From Keyword If ${num_records} == ${0} ${EMPTY}
331
332 FOR ${conf_file} IN @{match_conf_file_list}
333 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
334 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
335 END
336
337
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500338Create Partition File
339 [Documentation] Create Partition file.
340 [Arguments] ${file_name}
341
342 # Description of argument(s):
343 # file_name Partition file name.
344
345 Delete Local Partition File ${file_name}
346
347 FOR ${conf_file} IN @{file_name}
Sushil Singh85c381c2021-08-17 23:25:10 -0500348 @{words}= Split String ${conf_file} -
Sushil Singh255ec632021-08-26 08:08:21 -0500349 Run dd if=/dev/zero of=${conf_file} bs=${words}[-0] count=1
Sushil Singh251a0bc2021-08-24 01:12:14 -0500350 OperatingSystem.File Should Exist ${conf_file}
351 END
352
353
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500354Delete BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500355 [Documentation] Delete single partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500356 [Arguments] ${file_name} ${status_code} ${expected_message}
357
358 # Description of argument(s):
359 # file_name Partition file name.
360 # status_code HTTPS status code.
361 # expected_message Expected message of URI.
362
363 FOR ${conf_file} IN @{file_name}
364 ${data}= Create Dictionary
365 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
366 Set To Dictionary ${data} headers ${headers}
367
368 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
369 Should Be Equal As Strings ${resp.status_code} ${status_code}
370
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500371 ${description}= Return Description Of Response ${resp.text}
372 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500373 END
374
375
376Delete All BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500377 [Documentation] Delete multiple partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500378 [Arguments] ${status_code}
379
380 # Description of argument(s):
381 # status_code HTTPS status code.
382
383 Initialize OpenBMC
384 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600385 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600386 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600387
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500388 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
389 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600390
391
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500392Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600393 [Documentation] Return description of REST response.
394 [Arguments] ${resp_text}
395
396 # Description of argument(s):
397 # resp_text REST response body.
398
399 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500400 # {
401 # "Description": "File Created"
402 # }
Vijay09839e22020-02-05 02:54:44 -0600403
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500404 ${status}= Run Keyword And Return Status Evaluate isinstance(${resp_text}, dict)
405 Return From Keyword If '${status}' == 'False' ${resp_text}
Vijay09839e22020-02-05 02:54:44 -0600406 ${message}= Evaluate json.loads('''${resp_text}''') json
407
408 [Return] ${message["Description"]}
409
410
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500411Upload Partition File To BMC
412 [Documentation] Upload partition file to BMC.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600413 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True} ${path}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600414
415 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500416 # file_name Partition file name.
417 # status_code HTTPS status code.
418 # expected_message Expected message of URI.
419 # flag If True run part of program, else skip.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600420 # path Partition file path.
Vijay09839e22020-02-05 02:54:44 -0600421
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500422 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
423 FOR ${conf_file} IN @{file_name}
424 # Get the content of the file and upload to BMC.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600425 ${image_data}= OperatingSystem.Get Binary File ${path}${conf_file}
Sushil Singh85c381c2021-08-17 23:25:10 -0500426 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
Vijay09839e22020-02-05 02:54:44 -0600427
Sushil Singh85c381c2021-08-17 23:25:10 -0500428 ${kwargs}= Create Dictionary data=${image_data}
429 Set To Dictionary ${kwargs} headers ${headers}
430 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{kwargs} timeout=10
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500431 Should Be Equal As Strings ${resp.status_code} ${status_code}
432
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500433 ${description}= Return Description Of Response ${resp.text}
434 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500435 END
Vijayfcdadc52020-01-21 01:48:19 -0600436
437
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500438Verify Partition File On BMC
439 [Documentation] Verify partition file on BMC.
440 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600441
442 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500443 # file_name Partition file name.
444 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600445
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500446 FOR ${conf_file} IN @{file_name}
447 ${status} ${stderr} ${rc}= BMC Execute Command
Sushil Singhe5f39ee2021-01-06 00:39:12 -0600448 ... ls -l /var/lib/bmcweb/ibm-management-console/configfiles/${conf_file} | wc -l
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500449 Valid Value ${status} [${Partition_status}]
450 END
Vijayfcdadc52020-01-21 01:48:19 -0600451
452
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500453Redfish Upload Partition File
454 [Documentation] Upload the partition file.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500455 [Arguments] ${file_name} ${file_size}=${EMPTY}
Vijayfcdadc52020-01-21 01:48:19 -0600456
457 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500458 # file_name Partition file name.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500459 # file_size By Default is set to EMPTY,
460 # if user pass small_file_size the create file with small
461 # size keyword gets executed.
Vijayfcdadc52020-01-21 01:48:19 -0600462
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500463 @{Partition_file_list} = Split String ${file_name} ,
464 ${num_records}= Get Length ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500465
Sushil Singh255ec632021-08-26 08:08:21 -0500466 Create Partition File ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500467
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500468 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
469 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
470 Run Keyword If ${num_records} == ${1}
471 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
472 ... ELSE
473 ... Delete All BMC Partition File ${HTTP_OK}
474 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600475
476
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500477Redfish Fail To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600478 [Documentation] Fail to upload the partition file.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500479 [Arguments] ${file_name} ${status_code} ${partition_status} ${response_message}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600480
481 # Description of argument(s):
Sushil Singh255ec632021-08-26 08:08:21 -0500482 # file_name Partition file name.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500483 # status_code HTTPS status code.
484 # partition_status Partition status.
Sushil Singh255ec632021-08-26 08:08:21 -0500485 # response_message By default is set to EMPTY,
Sushil Singh1544c5e2021-11-03 07:56:37 -0500486 # else user provide the information when user upload the partition with file size
Sushil Singh255ec632021-08-26 08:08:21 -0500487 # below lower linit of allowed partition or more than of large allowed partition.
Vijay09839e22020-02-05 02:54:44 -0600488
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500489 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh255ec632021-08-26 08:08:21 -0500490
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500491 Create Partition File ${Partition_file_list}
Sushil Singh1544c5e2021-11-03 07:56:37 -0500492 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${response_message}
493 Verify Partition File On BMC ${Partition_file_list} Partition_status=${partition_status}
Sushil Singh255ec632021-08-26 08:08:21 -0500494
Sushil Singh1544c5e2021-11-03 07:56:37 -0500495 Run Keyword If ${partition_status} == 0
496 ... Run Keywords
497 ... Delete BMC Partition File
498 ... ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE} AND
499 ... Delete All BMC Partition File ${HTTP_OK} AND
500 ... Delete Local Server Partition File
501
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500502 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600503
504
Sushil Singhdf6ba522020-11-24 04:17:00 -0600505Redfish Upload Partition File In Loop
506 [Documentation] Upload the same partition file multiple times in loop to BMC.
507 [Arguments] ${file_name}
508
509 # Description of argument(s):
510 # file_name Partition file name.
511
512 @{Partition_file_list} = Split String ${file_name} ,
513 Create Partition File ${Partition_file_list}
514
515 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
516 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
517
518 FOR ${count} IN RANGE 1 11
Sushil Singh251a0bc2021-08-24 01:12:14 -0500519 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhdf6ba522020-11-24 04:17:00 -0600520 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
521 END
522
523 Initialize OpenBMC
524 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
525 Delete Local Partition File ${Partition_file_list}
526
527
Sushil Singhf39629c2020-12-11 07:30:21 -0600528Redfish Upload And Delete Partition File In Loop
529 [Documentation] Upload the same partition file multiple times in loop to BMC.
530 [Arguments] ${file_name}
531
532 # Description of argument(s):
533 # file_name Partition file name.
534
535 FOR ${count} IN RANGE 1 11
536 Redfish Upload Partition File ${file_name}
537 END
538
539
Sushil Singh5d0782f2020-11-23 06:35:35 -0600540Verify Partition File Upload Post BMC Reboot
541 [Documentation] Upload the partition file, after BMC reboot.
542 [Arguments] ${file_name}
543
544 # Description of argument(s):
545 # file_name Partition file name.
546
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600547 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
548 Redfish BMC Reset Operation
549 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
550
551 Is BMC Standby
Sushil Singh5d0782f2020-11-23 06:35:35 -0600552
553 Redfish Upload Partition File ${file_name}
554
555
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500556Redfish Partition File Persistency
557 [Documentation] Upload the partition file and check for persistency after reboot.
558 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600559
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500560 # Description of argument(s):
561 # file_name Partition file name.
562
563 @{Partition_file_list} = Split String ${file_name} ,
564 ${num_records}= Get Length ${Partition_file_list}
565 Create Partition File ${Partition_file_list}
566 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
567 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600568
569 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
570 Redfish BMC Reset Operation
571 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
572
573 Is BMC Standby
574
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500575 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600576 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500577 Run Keyword If ${num_records} == ${1}
578 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
579 ... ELSE
580 ... Delete All BMC Partition File ${HTTP_OK}
581 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600582
583
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500584Verify Redfish Partition File Content
585 [Documentation] Verify partition file content.
586 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600587
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500588 # Description of argument(s):
589 # file_name Partition file name.
590 # content_dict Dict contain the content.
591 # status_code HTTPS status code.
592
593 FOR ${conf_file} IN @{file_name}
594 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
595 Should Be Equal As Strings ${resp.status_code} ${status_code}
596
597 ${Partition_file_data}= Remove String ${resp.text} \\n
598 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
599 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
600 END
Vijayfcdadc52020-01-21 01:48:19 -0600601
Vijay39373152020-02-14 08:08:20 -0600602
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500603Add Content To Files
604 [Documentation] Add defined content in partition file.
605 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600606
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500607 # Description of argument(s):
608 # file_name Partition file name.
609 # index Index
610
611 ${num_records}= Get Length ${file_name}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500612 &{content_dict}= Create Dictionary
Sushil Singh85c381c2021-08-17 23:25:10 -0500613
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500614 FOR ${conf_file} IN @{file_name}
615 ${index}= Get Index From List ${file_name} ${conf_file}
616 ${index}= Evaluate ${index} + 1
617
618 Run echo "${content-${index}}" > ${conf_file}
619 OperatingSystem.File Should Exist ${conf_file}
620
621 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
622 END
623
624 [Return] &{content_dict}
625
626
627Redfish Read Partition File
628 [Documentation] Read partition file content.
629 [Arguments] ${file_name} ${reboot_flag}=False
630
631 # Description of argument(s):
632 # file_name Partition file name.
633 # reboot_flag Reboot flag.
634
635 @{Partition_file_list} = Split String ${file_name} ,
636 ${content_dict}= Add Content To Files ${Partition_file_list}
637
638 ${num_records}= Get Length ${Partition_file_list}
639
640 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
641 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
642 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
643
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600644 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
645
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500646 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600647 ... Run Keywords Redfish BMC Reset Operation AND
648 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
649 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500650 ... Initialize OpenBMC AND
651 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600652
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500653 Run Keyword If ${num_records} == ${1}
654 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
655 ... ELSE
656 ... Delete All BMC Partition File ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600657
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500658 Delete Local Partition File ${Partition_file_list}
659
660
661Redfish Update Partition File With Same Content
662 [Documentation] Update partition file with same content.
663 [Arguments] ${file_name} ${reboot_flag}=False
664
665 # Description of argument(s):
666 # file_name Partition file name.
667 # reboot_flag Reboot flag.
668
669 @{Partition_file_list} = Split String ${file_name} ,
670 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
671
672 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
673 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
674 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
675
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600676 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
677
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500678 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600679 ... Run Keywords Redfish BMC Reset Operation AND
680 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
681 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500682 ... Initialize OpenBMC
683
684 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500685 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500686 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
687 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
688
689 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
690 Delete Local Partition File ${Partition_file_list}
691
692
693Redfish Update Partition File With Different Content
694 [Documentation] Update partition file with different content.
695 [Arguments] ${file_name} ${reboot_flag}=False
696
697 # Description of argument(s):
698 # file_name Partition file name.
699 # reboot_flag Reboot flag.
700
701 @{Partition_file_list} = Split String ${file_name} ,
702 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
703
704 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
705 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
706 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
707
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600708 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
709
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500710 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600711 ... Run Keywords Redfish BMC Reset Operation AND
712 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
713 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500714 ... Initialize OpenBMC
715
716 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500717 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500718 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
719 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
720
721 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
722 Delete Local Partition File ${Partition_file_list}
723
724
725Create File Names
726 [Documentation] Create partition file names.
727 [Arguments] ${range}
728
729 # Description of argument(s):
730 # range Range in numbers.
731
732 @{file_name_list}= Create List
733 Set Test Variable ${file_name} rangefile
734 FOR ${count} IN RANGE ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500735 Append To List ${file_name_list} 1KB-file${count}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500736 END
737 [Return] ${file_name_list}
738
739
740Redfish Upload Partition File With Range
741 [Documentation] Upload the partition file with the range of files.
742 [Arguments] ${range}
743
744 # Description of argument(s):
745 # range Range in numbers.
746
747 ${Partition_file_list}= Create File Names ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500748 Delete Local Partition File ${Partition_file_list}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500749 Create Partition File ${Partition_file_list}
750 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
751 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
752 Delete All BMC Partition File ${HTTP_OK}
753 Delete Local Partition File ${Partition_file_list}
754
755
756Redfish Delete Non Existence Partition File
757 [Documentation] Delete the partition file if do not exists.
758 [Arguments] ${file_name}
759
760 # Description of argument(s):
761 # file_name Partition file name.
762
763 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh251a0bc2021-08-24 01:12:14 -0500764 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500765
766
767Non Admin User To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600768 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500769 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
770
771 # Description of argument(s):
772 # file_name Partition file name.
773 # username Username.
774 # password Password.
775 # role Role of user.
776 # enabled Value can be True or False.
777
778 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600779 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500780 Initialize OpenBMC rest_username=${username} rest_password=${password}
781 @{Partition_file_list} = Split String ${file_name} ,
782 Create Partition File ${Partition_file_list}
783 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
784 Delete Local Partition File ${Partition_file_list}
785 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
786
787
788Non Admin Delete Non Existence Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600789 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500790 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
791
792 # Description of argument(s):
793 # file_name Partition file name.
794 # username Username.
795 # password Password.
796 # role Role of user.
797 # enabled Value can be True or False.
798
799 Redfish Create User ${username} ${password} ${role} ${enabled}
800 Delete All Sessions
801 Initialize OpenBMC rest_username=${username} rest_password=${password}
802 @{Partition_file_list} = Split String ${file_name} ,
803 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
804
805
806Verify Update Wrong Partition File To BMC
807 [Documentation] Upload the wrong partition file to BMC.
808 [Arguments] ${file_name}
809
810 # Description of argument(s):
811 # file_name Partition file name.
812
813 Redfish.Login
814 ${resp}= Run Keyword And Return Status
815 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
816 Should Be Equal As Strings ${resp} False
Sushil Singh9942df52021-09-03 02:28:11 -0500817
818
819Check Redfish Upload Partition File Name With Character Limit To BMC
820 [Documentation] Upload the partition file to BMC with file name character limit.
821 [Arguments] ${file_name} ${status_code} ${message}
822
823 # Description of argument(s):
824 # file_name Partition file name.
825 # status_code HTTPS status code.
826 # message Expected message of from upload partition file URI.
827
828 @{Partition_file_list} = Split String ${file_name} ,
829 ${num_records}= Get Length ${Partition_file_list}
830 Create Partition File ${Partition_file_list}
831
832 ${file_name_length}= Get Length ${Partition_file_list}[0]
833
834 Run Keyword If ${file_name_length} == 20
835 ... Run Keywords
836 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message} AND
837 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1 AND
838 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
839 ... ELSE
840 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
841
842 Delete Local Partition File ${Partition_file_list}
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500843
844
845Check Redfish Fail To Upload Partition File Name With Special Character To BMC
846 [Documentation] Upload the partition file to BMC with special character file name.
847 [Arguments] ${file_name} ${status_code} ${message}
848
849 # Description of argument(s):
850 # file_name Partition file name.
851 # status_code HTTPS status code.
852 # message Expected message from upload partition file URI.
853
854 @{Partition_file_list} = Split String ${file_name} ,
855 ${num_records}= Get Length ${Partition_file_list}
856
857 Create Partition File ${Partition_file_list}
858
859 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
860
861 ${status}= Run Keyword And Return Status
862 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1
863 Should Be Equal As Strings ${status} False
864
865 Delete Local Partition File ${Partition_file_list}
Sushil Singh44b8cf32021-11-17 06:57:09 -0600866
867
868Redfish Upload Partition File From Path
869 [Documentation] Upload the partition file to BMC from file path.
870 [Arguments] ${PARTITION_FILE_PATH}
871
872 # Description of argument(s):
873 # PARTITION_FILE_PATH Partition file path.
874
875 ${file_list} = OperatingSystem.List Files In Directory ${PARTITION_FILE_PATH}
876
877 ${num_records}= Get Length ${file_list}
878 Should Not Be Equal As Integers ${num_records} 0
879
880 FOR ${file_name} IN @{file_list}
881 @{Partition_file_list} = Split String ${file_name} ,
882 ${num_records}= Get Length ${Partition_file_list}
883 Upload Partition File To BMC file_name=${Partition_file_list} status_code=${HTTP_OK} expected_message=${FILE_UPLOAD_MESSAGE} path=${PARTITION_FILE_PATH}
884 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
885 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
886 END
887