blob: 4c03528c61d5c383b21ef0a2ad596ce786cdab26 [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 Singhcbbce6a2020-09-07 00:57:37 -050073Redfish Fail To Upload Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050074 [Documentation] Fail to upload partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050075 [Tags] Redfish_Fail_To_Upload_Partition_File_To_BMC
76 [Template] Redfish Fail To Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060077
Sushil Singh1544c5e2021-11-03 07:56:37 -050078 # file_name status_code partition_status response_message
79 10001KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_FILE_SIZE_MESSAGE}
Vijayfcdadc52020-01-21 01:48:19 -060080
81
Sushil Singhcbbce6a2020-09-07 00:57:37 -050082Redfish Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050083 [Documentation] Upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050084 [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC
85 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060086
Sushil Singhcbbce6a2020-09-07 00:57:37 -050087 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050088 250KB-file,500KB-file
Vijayfcdadc52020-01-21 01:48:19 -060089
90
Sushil Singhcbbce6a2020-09-07 00:57:37 -050091Redfish Fail To Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050092 [Documentation] Fail to upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050093 [Tags] Redfish_Fail_To_Upload_Multiple_Partition_File_To_BMC
94 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -060095
Sushil Singh1544c5e2021-11-03 07:56:37 -050096 # file_name status_code partition_status response_message
97 5000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
98 6000KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
99 10000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
100 100-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
Vijay09839e22020-02-05 02:54:44 -0600101
102
Sushil Singhdf6ba522020-11-24 04:17:00 -0600103Redfish Upload Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500104 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhdf6ba522020-11-24 04:17:00 -0600105 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
106 [Template] Redfish Upload Partition File In Loop
107
108 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500109 500KB-file
Sushil Singhdf6ba522020-11-24 04:17:00 -0600110
111
Sushil Singhf39629c2020-12-11 07:30:21 -0600112Redfish Upload And Delete Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500113 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhf39629c2020-12-11 07:30:21 -0600114 [Tags] Redfish_Upload_And_Delete_Same_Partition_File_To_BMC_In_Loop
115 [Template] Redfish Upload And Delete Partition File In Loop
116
117 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500118 500KB-file
Sushil Singhf39629c2020-12-11 07:30:21 -0600119
120
Sushil Singh5d0782f2020-11-23 06:35:35 -0600121Redfish Partition File Upload Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500122 [Documentation] Upload partition file to BMC using Redfish, after the BMC reboot.
Sushil Singh5d0782f2020-11-23 06:35:35 -0600123 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
124 [Template] Verify Partition File Upload Post BMC Reboot
125
126 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500127 500KB-file
Sushil Singh5d0782f2020-11-23 06:35:35 -0600128
129
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500130Redfish Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500131 [Documentation] Upload partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500132 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
133 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600134
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500135 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500136 500KB-file
Vijay09839e22020-02-05 02:54:44 -0600137
138
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500139Redfish Multiple Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500140 [Documentation] Upload multiple partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500141 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
142 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600143
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500144 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500145 250KB-file,500KB-file
Vijay09839e22020-02-05 02:54:44 -0600146
147
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500148Redfish Read Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500149 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500150 [Tags] Redfish_Read_Partition_File_On_BMC
151 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600152
Sushil Singh85c381c2021-08-17 23:25:10 -0500153 # file_name reboot_flag
154 testfile01-file False
155 testfile01-file,testfile02-file False
Vijay09839e22020-02-05 02:54:44 -0600156
Vijay09839e22020-02-05 02:54:44 -0600157
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500158Redfish Read Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500159 [Documentation] Upload partition file to BMC using Redfish and verify the content after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500160 [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot
161 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600162
Sushil Singh85c381c2021-08-17 23:25:10 -0500163 # file_name reboot_flag
164 testfile01-file True
165 testfile01-file,testfile02-file True
Vijay09839e22020-02-05 02:54:44 -0600166
Vijay09839e22020-02-05 02:54:44 -0600167
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500168Redfish Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500169 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500170 [Tags] Redfish_Update_Partition_File_On_BMC
171 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600172
Sushil Singh85c381c2021-08-17 23:25:10 -0500173 # file_name reboot_flag
174 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500175
176
177Redfish Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500178 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500179 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
180 [Template] Redfish Update Partition File With Different Content
181
Sushil Singh85c381c2021-08-17 23:25:10 -0500182 # file_name reboot_flag
183 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500184
185
186Redfish Persistency Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500187 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500188 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
189 [Template] Redfish Update Partition File With Same Content
190
Sushil Singh85c381c2021-08-17 23:25:10 -0500191 # file_name reboot_flag
192 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500193
194
195Redfish Persistency Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500196 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500197 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC_Reboot
198 [Template] Redfish Update Partition File With Same Content
199
Sushil Singh85c381c2021-08-17 23:25:10 -0500200 # file_name reboot_flag
201 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500202
203
204Redfish Delete Non Existence Of Partition File
205 [Documentation] Delete the partition file if do not exists.
206 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
207 [Template] Redfish Delete Non Existence Partition File
208
209 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500210 testfile01-file
Vijay09839e22020-02-05 02:54:44 -0600211
212
213Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500214 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600215 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500216 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600217
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500218 # range
219 1000
Vijay09839e22020-02-05 02:54:44 -0600220
Vijay09839e22020-02-05 02:54:44 -0600221
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500222Non Admin Users Fail To Upload Partition File
223 [Documentation] Non admin user will fail to upload the partition file.
224 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
225 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600226
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500227 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500228 500KB-file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600229
230
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500231Non Admin User Delete Non Existence Of Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600232 [Documentation] Delete the partition file if does not exists.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500233 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
234 [Template] Non Admin Delete Non Existence Partition File
235
236 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500237 500KB-file operator_user TestPwd123 Operator
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500238
239
240Redfish Update Wrong Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500241 [Documentation] Upload partition file to BMC by wrong URI using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500242 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
243 [Template] Verify Update Wrong Partition File To BMC
244
245 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500246 500KB-file
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500247
Sushil Singh9942df52021-09-03 02:28:11 -0500248
249Test Redfish Upload Partition File Name With Character Limit To BMC
250 [Documentation] Upload partition file to BMC with file name character allowed limit
251 ... and above allowed limit using Redfish.
252 [Tags] Test_Redfish_Upload_Partition_File_Name_With_Character_Limit_To_BMC
253 [Template] Check Redfish Upload Partition File Name With Character Limit To BMC
254
255 # file_name status_code message
256 50KB-testfilesavfile ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
257 50KB-testsaveareafile ${HTTP_BAD_REQUEST} ${MAXIMUM_FILE_NAME_MESSAGE}
258
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500259
260Test Redfish Fail To Upload Partition File Name With Special Character To BMC
261 [Documentation] Upload partition file to BMC with special character file name and
262 ... Redfish through an error.
263 [Tags] Test_Redfish_Fail_To_Upload_Partition_File_Name_With_Special_Character_To_BMC
264 [Template] Check Redfish Fail To Upload Partition File Name With Special Character To BMC
265
266 # file_name status_code message
267 1KB-*filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
268 1KB-!filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
269 1KB-@filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
270
Sushil Singh44b8cf32021-11-17 06:57:09 -0600271
272Redfish Upload Validated Partition File From Path To BMC
273 [Documentation] Upload valid partition file to BMC from file path define by user in loop.
274 ... By default loop count values is 10 times.
275 [Tags] Redfish_Upload_Validated_Partition_File_From_Path_To_BMC
276
277 Log To Console ${EMPTY}
278 FOR ${count} IN RANGE 1 ${LOOP_COUNT} + 1
279 Log To Console **************************************
280 Log To Console * The Current Loop Count is ${count} of ${LOOP_COUNT} *
281 Log To Console **************************************
282
283 Redfish Upload Partition File From Path ${PARTITION_FILE_PATH}
284 END
285
Vijayfcdadc52020-01-21 01:48:19 -0600286*** Keywords ***
287
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500288Suite Setup Execution
289 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600290
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500291 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600292
293
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500294Test Teardown Execution
295 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600296
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500297 Delete All BMC Partition File ${HTTP_OK}
298 FFDC On Test Case Fail
299
300
301Suite Teardown Execution
302 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600303
304 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600305
306
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500307Delete Local Partition File
308 [Documentation] Delete local partition file.
309 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600310
311 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500312 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600313
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500314 FOR ${conf_file} IN @{file_name}
315 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
316 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
317 END
Vijayfcdadc52020-01-21 01:48:19 -0600318
Vijayfcdadc52020-01-21 01:48:19 -0600319
Sushil Singh1544c5e2021-11-03 07:56:37 -0500320Delete Local Server Partition File
321 [Documentation] Local partition files which is getting uploaded to BMC,
322 ... will get deleted after the uploads. If partition file name consist
323 ... of “-file then partition file gets deleted.
324
325 @{conf_file_list} = OperatingSystem.List Files In Directory ${EXECDIR}
326 ${match_conf_file_list}= Get Matches ${conf_file_list} regexp=.*-file case_insensitive=${True}
327
328 ${num_records}= Get Length ${match_conf_file_list}
329 Return From Keyword If ${num_records} == ${0} ${EMPTY}
330
331 FOR ${conf_file} IN @{match_conf_file_list}
332 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
333 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
334 END
335
336
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500337Create Partition File
338 [Documentation] Create Partition file.
339 [Arguments] ${file_name}
340
341 # Description of argument(s):
342 # file_name Partition file name.
343
344 Delete Local Partition File ${file_name}
345
346 FOR ${conf_file} IN @{file_name}
Sushil Singh85c381c2021-08-17 23:25:10 -0500347 @{words}= Split String ${conf_file} -
Sushil Singh255ec632021-08-26 08:08:21 -0500348 Run dd if=/dev/zero of=${conf_file} bs=${words}[-0] count=1
Sushil Singh251a0bc2021-08-24 01:12:14 -0500349 OperatingSystem.File Should Exist ${conf_file}
350 END
351
352
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500353Delete BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500354 [Documentation] Delete single partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500355 [Arguments] ${file_name} ${status_code} ${expected_message}
356
357 # Description of argument(s):
358 # file_name Partition file name.
359 # status_code HTTPS status code.
360 # expected_message Expected message of URI.
361
362 FOR ${conf_file} IN @{file_name}
363 ${data}= Create Dictionary
364 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
365 Set To Dictionary ${data} headers ${headers}
366
367 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
368 Should Be Equal As Strings ${resp.status_code} ${status_code}
369
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500370 ${description}= Return Description Of Response ${resp.text}
371 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500372 END
373
374
375Delete All BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500376 [Documentation] Delete multiple partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500377 [Arguments] ${status_code}
378
379 # Description of argument(s):
380 # status_code HTTPS status code.
381
382 Initialize OpenBMC
383 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600384 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600385 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600386
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500387 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
388 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600389
390
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500391Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600392 [Documentation] Return description of REST response.
393 [Arguments] ${resp_text}
394
395 # Description of argument(s):
396 # resp_text REST response body.
397
398 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500399 # {
400 # "Description": "File Created"
401 # }
Vijay09839e22020-02-05 02:54:44 -0600402
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500403 ${status}= Run Keyword And Return Status Evaluate isinstance(${resp_text}, dict)
404 Return From Keyword If '${status}' == 'False' ${resp_text}
Vijay09839e22020-02-05 02:54:44 -0600405 ${message}= Evaluate json.loads('''${resp_text}''') json
406
407 [Return] ${message["Description"]}
408
409
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500410Upload Partition File To BMC
411 [Documentation] Upload partition file to BMC.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600412 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True} ${path}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600413
414 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500415 # file_name Partition file name.
416 # status_code HTTPS status code.
417 # expected_message Expected message of URI.
418 # flag If True run part of program, else skip.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600419 # path Partition file path.
Vijay09839e22020-02-05 02:54:44 -0600420
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500421 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
422 FOR ${conf_file} IN @{file_name}
423 # Get the content of the file and upload to BMC.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600424 ${image_data}= OperatingSystem.Get Binary File ${path}${conf_file}
Sushil Singh85c381c2021-08-17 23:25:10 -0500425 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
Vijay09839e22020-02-05 02:54:44 -0600426
Sushil Singh85c381c2021-08-17 23:25:10 -0500427 ${kwargs}= Create Dictionary data=${image_data}
428 Set To Dictionary ${kwargs} headers ${headers}
429 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{kwargs} timeout=10
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500430 Should Be Equal As Strings ${resp.status_code} ${status_code}
431
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500432 ${description}= Return Description Of Response ${resp.text}
433 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500434 END
Vijayfcdadc52020-01-21 01:48:19 -0600435
436
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500437Verify Partition File On BMC
438 [Documentation] Verify partition file on BMC.
439 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600440
441 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500442 # file_name Partition file name.
443 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600444
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500445 FOR ${conf_file} IN @{file_name}
446 ${status} ${stderr} ${rc}= BMC Execute Command
Sushil Singhe5f39ee2021-01-06 00:39:12 -0600447 ... ls -l /var/lib/bmcweb/ibm-management-console/configfiles/${conf_file} | wc -l
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500448 Valid Value ${status} [${Partition_status}]
449 END
Vijayfcdadc52020-01-21 01:48:19 -0600450
451
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500452Redfish Upload Partition File
453 [Documentation] Upload the partition file.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500454 [Arguments] ${file_name} ${file_size}=${EMPTY}
Vijayfcdadc52020-01-21 01:48:19 -0600455
456 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500457 # file_name Partition file name.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500458 # file_size By Default is set to EMPTY,
459 # if user pass small_file_size the create file with small
460 # size keyword gets executed.
Vijayfcdadc52020-01-21 01:48:19 -0600461
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500462 @{Partition_file_list} = Split String ${file_name} ,
463 ${num_records}= Get Length ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500464
Sushil Singh255ec632021-08-26 08:08:21 -0500465 Create Partition File ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500466
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500467 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
468 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
469 Run Keyword If ${num_records} == ${1}
470 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
471 ... ELSE
472 ... Delete All BMC Partition File ${HTTP_OK}
473 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600474
475
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500476Redfish Fail To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600477 [Documentation] Fail to upload the partition file.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500478 [Arguments] ${file_name} ${status_code} ${partition_status} ${response_message}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600479
480 # Description of argument(s):
Sushil Singh255ec632021-08-26 08:08:21 -0500481 # file_name Partition file name.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500482 # status_code HTTPS status code.
483 # partition_status Partition status.
Sushil Singh255ec632021-08-26 08:08:21 -0500484 # response_message By default is set to EMPTY,
Sushil Singh1544c5e2021-11-03 07:56:37 -0500485 # else user provide the information when user upload the partition with file size
Sushil Singh255ec632021-08-26 08:08:21 -0500486 # below lower linit of allowed partition or more than of large allowed partition.
Vijay09839e22020-02-05 02:54:44 -0600487
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500488 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh255ec632021-08-26 08:08:21 -0500489
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500490 Create Partition File ${Partition_file_list}
Sushil Singh1544c5e2021-11-03 07:56:37 -0500491 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${response_message}
492 Verify Partition File On BMC ${Partition_file_list} Partition_status=${partition_status}
Sushil Singh255ec632021-08-26 08:08:21 -0500493
Sushil Singh1544c5e2021-11-03 07:56:37 -0500494 Run Keyword If ${partition_status} == 0
495 ... Run Keywords
496 ... Delete BMC Partition File
497 ... ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE} AND
498 ... Delete All BMC Partition File ${HTTP_OK} AND
499 ... Delete Local Server Partition File
500
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500501 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600502
503
Sushil Singhdf6ba522020-11-24 04:17:00 -0600504Redfish Upload Partition File In Loop
505 [Documentation] Upload the same partition file multiple times in loop to BMC.
506 [Arguments] ${file_name}
507
508 # Description of argument(s):
509 # file_name Partition file name.
510
511 @{Partition_file_list} = Split String ${file_name} ,
512 Create Partition File ${Partition_file_list}
513
514 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
515 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
516
517 FOR ${count} IN RANGE 1 11
Sushil Singh251a0bc2021-08-24 01:12:14 -0500518 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhdf6ba522020-11-24 04:17:00 -0600519 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
520 END
521
522 Initialize OpenBMC
523 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
524 Delete Local Partition File ${Partition_file_list}
525
526
Sushil Singhf39629c2020-12-11 07:30:21 -0600527Redfish Upload And Delete Partition File In Loop
528 [Documentation] Upload the same partition file multiple times in loop to BMC.
529 [Arguments] ${file_name}
530
531 # Description of argument(s):
532 # file_name Partition file name.
533
534 FOR ${count} IN RANGE 1 11
535 Redfish Upload Partition File ${file_name}
536 END
537
538
Sushil Singh5d0782f2020-11-23 06:35:35 -0600539Verify Partition File Upload Post BMC Reboot
540 [Documentation] Upload the partition file, after BMC reboot.
541 [Arguments] ${file_name}
542
543 # Description of argument(s):
544 # file_name Partition file name.
545
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600546 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
547 Redfish BMC Reset Operation
548 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
549
550 Is BMC Standby
Sushil Singh5d0782f2020-11-23 06:35:35 -0600551
552 Redfish Upload Partition File ${file_name}
553
554
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500555Redfish Partition File Persistency
556 [Documentation] Upload the partition file and check for persistency after reboot.
557 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600558
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500559 # Description of argument(s):
560 # file_name Partition file name.
561
562 @{Partition_file_list} = Split String ${file_name} ,
563 ${num_records}= Get Length ${Partition_file_list}
564 Create Partition File ${Partition_file_list}
565 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
566 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600567
568 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
569 Redfish BMC Reset Operation
570 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
571
572 Is BMC Standby
573
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500574 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600575 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500576 Run Keyword If ${num_records} == ${1}
577 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
578 ... ELSE
579 ... Delete All BMC Partition File ${HTTP_OK}
580 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600581
582
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500583Verify Redfish Partition File Content
584 [Documentation] Verify partition file content.
585 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600586
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500587 # Description of argument(s):
588 # file_name Partition file name.
589 # content_dict Dict contain the content.
590 # status_code HTTPS status code.
591
592 FOR ${conf_file} IN @{file_name}
593 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
594 Should Be Equal As Strings ${resp.status_code} ${status_code}
595
596 ${Partition_file_data}= Remove String ${resp.text} \\n
597 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
598 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
599 END
Vijayfcdadc52020-01-21 01:48:19 -0600600
Vijay39373152020-02-14 08:08:20 -0600601
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500602Add Content To Files
603 [Documentation] Add defined content in partition file.
604 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600605
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500606 # Description of argument(s):
607 # file_name Partition file name.
608 # index Index
609
610 ${num_records}= Get Length ${file_name}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500611 &{content_dict}= Create Dictionary
Sushil Singh85c381c2021-08-17 23:25:10 -0500612
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500613 FOR ${conf_file} IN @{file_name}
614 ${index}= Get Index From List ${file_name} ${conf_file}
615 ${index}= Evaluate ${index} + 1
616
617 Run echo "${content-${index}}" > ${conf_file}
618 OperatingSystem.File Should Exist ${conf_file}
619
620 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
621 END
622
623 [Return] &{content_dict}
624
625
626Redfish Read Partition File
627 [Documentation] Read partition file content.
628 [Arguments] ${file_name} ${reboot_flag}=False
629
630 # Description of argument(s):
631 # file_name Partition file name.
632 # reboot_flag Reboot flag.
633
634 @{Partition_file_list} = Split String ${file_name} ,
635 ${content_dict}= Add Content To Files ${Partition_file_list}
636
637 ${num_records}= Get Length ${Partition_file_list}
638
639 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
640 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
641 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
642
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600643 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
644
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500645 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600646 ... Run Keywords Redfish BMC Reset Operation AND
647 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
648 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500649 ... Initialize OpenBMC AND
650 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600651
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500652 Run Keyword If ${num_records} == ${1}
653 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
654 ... ELSE
655 ... Delete All BMC Partition File ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600656
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500657 Delete Local Partition File ${Partition_file_list}
658
659
660Redfish Update Partition File With Same Content
661 [Documentation] Update partition file with same content.
662 [Arguments] ${file_name} ${reboot_flag}=False
663
664 # Description of argument(s):
665 # file_name Partition file name.
666 # reboot_flag Reboot flag.
667
668 @{Partition_file_list} = Split String ${file_name} ,
669 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
670
671 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
672 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
673 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
674
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600675 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
676
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500677 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600678 ... Run Keywords Redfish BMC Reset Operation AND
679 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
680 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500681 ... Initialize OpenBMC
682
683 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500684 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500685 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
686 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
687
688 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
689 Delete Local Partition File ${Partition_file_list}
690
691
692Redfish Update Partition File With Different Content
693 [Documentation] Update partition file with different content.
694 [Arguments] ${file_name} ${reboot_flag}=False
695
696 # Description of argument(s):
697 # file_name Partition file name.
698 # reboot_flag Reboot flag.
699
700 @{Partition_file_list} = Split String ${file_name} ,
701 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
702
703 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
704 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
705 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
706
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600707 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
708
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500709 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600710 ... Run Keywords Redfish BMC Reset Operation AND
711 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
712 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500713 ... Initialize OpenBMC
714
715 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500716 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500717 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
720 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
721 Delete Local Partition File ${Partition_file_list}
722
723
724Create File Names
725 [Documentation] Create partition file names.
726 [Arguments] ${range}
727
728 # Description of argument(s):
729 # range Range in numbers.
730
731 @{file_name_list}= Create List
732 Set Test Variable ${file_name} rangefile
733 FOR ${count} IN RANGE ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500734 Append To List ${file_name_list} 1KB-file${count}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500735 END
736 [Return] ${file_name_list}
737
738
739Redfish Upload Partition File With Range
740 [Documentation] Upload the partition file with the range of files.
741 [Arguments] ${range}
742
743 # Description of argument(s):
744 # range Range in numbers.
745
746 ${Partition_file_list}= Create File Names ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500747 Delete Local Partition File ${Partition_file_list}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500748 Create Partition File ${Partition_file_list}
749 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
750 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
751 Delete All BMC Partition File ${HTTP_OK}
752 Delete Local Partition File ${Partition_file_list}
753
754
755Redfish Delete Non Existence Partition File
756 [Documentation] Delete the partition file if do not exists.
757 [Arguments] ${file_name}
758
759 # Description of argument(s):
760 # file_name Partition file name.
761
762 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh251a0bc2021-08-24 01:12:14 -0500763 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500764
765
766Non Admin User To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600767 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500768 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
769
770 # Description of argument(s):
771 # file_name Partition file name.
772 # username Username.
773 # password Password.
774 # role Role of user.
775 # enabled Value can be True or False.
776
777 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600778 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500779 Initialize OpenBMC rest_username=${username} rest_password=${password}
780 @{Partition_file_list} = Split String ${file_name} ,
781 Create Partition File ${Partition_file_list}
782 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
783 Delete Local Partition File ${Partition_file_list}
784 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
785
786
787Non Admin Delete Non Existence Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600788 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500789 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
790
791 # Description of argument(s):
792 # file_name Partition file name.
793 # username Username.
794 # password Password.
795 # role Role of user.
796 # enabled Value can be True or False.
797
798 Redfish Create User ${username} ${password} ${role} ${enabled}
799 Delete All Sessions
800 Initialize OpenBMC rest_username=${username} rest_password=${password}
801 @{Partition_file_list} = Split String ${file_name} ,
802 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
803
804
805Verify Update Wrong Partition File To BMC
806 [Documentation] Upload the wrong partition file to BMC.
807 [Arguments] ${file_name}
808
809 # Description of argument(s):
810 # file_name Partition file name.
811
812 Redfish.Login
813 ${resp}= Run Keyword And Return Status
814 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
815 Should Be Equal As Strings ${resp} False
Sushil Singh9942df52021-09-03 02:28:11 -0500816
817
818Check Redfish Upload Partition File Name With Character Limit To BMC
819 [Documentation] Upload the partition file to BMC with file name character limit.
820 [Arguments] ${file_name} ${status_code} ${message}
821
822 # Description of argument(s):
823 # file_name Partition file name.
824 # status_code HTTPS status code.
825 # message Expected message of from upload partition file URI.
826
827 @{Partition_file_list} = Split String ${file_name} ,
828 ${num_records}= Get Length ${Partition_file_list}
829 Create Partition File ${Partition_file_list}
830
831 ${file_name_length}= Get Length ${Partition_file_list}[0]
832
833 Run Keyword If ${file_name_length} == 20
834 ... Run Keywords
835 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message} AND
836 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1 AND
837 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
838 ... ELSE
839 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
840
841 Delete Local Partition File ${Partition_file_list}
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500842
843
844Check Redfish Fail To Upload Partition File Name With Special Character To BMC
845 [Documentation] Upload the partition file to BMC with special character file name.
846 [Arguments] ${file_name} ${status_code} ${message}
847
848 # Description of argument(s):
849 # file_name Partition file name.
850 # status_code HTTPS status code.
851 # message Expected message from upload partition file URI.
852
853 @{Partition_file_list} = Split String ${file_name} ,
854 ${num_records}= Get Length ${Partition_file_list}
855
856 Create Partition File ${Partition_file_list}
857
858 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
859
860 ${status}= Run Keyword And Return Status
861 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1
862 Should Be Equal As Strings ${status} False
863
864 Delete Local Partition File ${Partition_file_list}
Sushil Singh44b8cf32021-11-17 06:57:09 -0600865
866
867Redfish Upload Partition File From Path
868 [Documentation] Upload the partition file to BMC from file path.
869 [Arguments] ${PARTITION_FILE_PATH}
870
871 # Description of argument(s):
872 # PARTITION_FILE_PATH Partition file path.
873
874 ${file_list} = OperatingSystem.List Files In Directory ${PARTITION_FILE_PATH}
875
876 ${num_records}= Get Length ${file_list}
877 Should Not Be Equal As Integers ${num_records} 0
878
879 FOR ${file_name} IN @{file_list}
880 @{Partition_file_list} = Split String ${file_name} ,
881 ${num_records}= Get Length ${Partition_file_list}
882 Upload Partition File To BMC file_name=${Partition_file_list} status_code=${HTTP_OK} expected_message=${FILE_UPLOAD_MESSAGE} path=${PARTITION_FILE_PATH}
883 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
884 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
885 END
886