blob: ed0a123ebc7c38c9085bc7563f74358139f4a5ca [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 Singhde1347d2022-07-13 02:54:26 -050018${MAXIMUM_FILE_SIZE_MESSAGE} File size exceeds maximum allowed size[25MB]
Sushil Singh1544c5e2021-11-03 07:56:37 -050019${MAXIMUM_DIR_SIZE_MESSAGE}
Sushil Singhde1347d2022-07-13 02:54:26 -050020... File size does not fit in the savearea directory maximum allowed size[25MB]
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 Singhde1347d2022-07-13 02:54:26 -050058 2000KB-file
Sushil Singh1544c5e2021-11-03 07:56:37 -050059 10000KB-file
Sushil Singhde1347d2022-07-13 02:54:26 -050060 25000KB-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
Sushil Singhde1347d2022-07-13 02:54:26 -050080 25001KB-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 Singhf9eeec72021-12-14 08:31:59 -060092Test Upload Partition File When BMC Space Reach Max And Expect Failure
93 [Documentation] Fail to upload multiple partition file to BMC
94 ... as BMC directory reach to upper limit using Redfish.
95 [Tags] Test_Upload_Partition_File_When_BMC_Space_Reach_Max_And_Expect_Failure
Sushil Singhcbbce6a2020-09-07 00:57:37 -050096 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -060097
Sushil Singh1544c5e2021-11-03 07:56:37 -050098 # file_name status_code partition_status response_message
Sushil Singhde1347d2022-07-13 02:54:26 -050099 15000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
100 16000KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
101 25000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
Sushil Singh1544c5e2021-11-03 07:56:37 -0500102 100-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
Vijay09839e22020-02-05 02:54:44 -0600103
104
Sushil Singhdf6ba522020-11-24 04:17:00 -0600105Redfish Upload Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500106 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhdf6ba522020-11-24 04:17:00 -0600107 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
108 [Template] Redfish Upload Partition File In Loop
109
110 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500111 500KB-file
Sushil Singhdf6ba522020-11-24 04:17:00 -0600112
113
Sushil Singhf39629c2020-12-11 07:30:21 -0600114Redfish Upload And Delete Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500115 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhf39629c2020-12-11 07:30:21 -0600116 [Tags] Redfish_Upload_And_Delete_Same_Partition_File_To_BMC_In_Loop
117 [Template] Redfish Upload And Delete Partition File In Loop
118
119 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500120 500KB-file
Sushil Singhf39629c2020-12-11 07:30:21 -0600121
122
Sushil Singh5d0782f2020-11-23 06:35:35 -0600123Redfish Partition File Upload Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500124 [Documentation] Upload partition file to BMC using Redfish, after the BMC reboot.
Sushil Singh5d0782f2020-11-23 06:35:35 -0600125 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
126 [Template] Verify Partition File Upload Post BMC Reboot
127
128 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500129 500KB-file
Sushil Singh5d0782f2020-11-23 06:35:35 -0600130
131
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500132Redfish Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500133 [Documentation] Upload partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500134 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
135 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600136
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500137 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500138 500KB-file
Vijay09839e22020-02-05 02:54:44 -0600139
140
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500141Redfish Multiple Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500142 [Documentation] Upload multiple partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500143 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
144 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600145
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500146 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500147 250KB-file,500KB-file
Vijay09839e22020-02-05 02:54:44 -0600148
149
Sushil Singhb22e4b62021-12-15 00:54:53 -0600150Redfish Read Partition File From BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500151 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhb22e4b62021-12-15 00:54:53 -0600152 [Tags] Redfish_Read_Partition_File_From_BMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500153 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600154
Sushil Singh85c381c2021-08-17 23:25:10 -0500155 # file_name reboot_flag
156 testfile01-file False
157 testfile01-file,testfile02-file False
Vijay09839e22020-02-05 02:54:44 -0600158
Vijay09839e22020-02-05 02:54:44 -0600159
Sushil Singhb22e4b62021-12-15 00:54:53 -0600160Redfish Read Partition File Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500161 [Documentation] Upload partition file to BMC using Redfish and verify the content after reboot.
Sushil Singhb22e4b62021-12-15 00:54:53 -0600162 [Tags] Redfish_Read_Partition_File_Post_BMC_Reboot
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500163 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600164
Sushil Singh85c381c2021-08-17 23:25:10 -0500165 # file_name reboot_flag
166 testfile01-file True
167 testfile01-file,testfile02-file True
Vijay09839e22020-02-05 02:54:44 -0600168
Vijay09839e22020-02-05 02:54:44 -0600169
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500170Redfish Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500171 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500172 [Tags] Redfish_Update_Partition_File_On_BMC
173 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600174
Sushil Singh85c381c2021-08-17 23:25:10 -0500175 # file_name reboot_flag
176 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500177
178
179Redfish Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500180 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500181 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
182 [Template] Redfish Update Partition File With Different Content
183
Sushil Singh85c381c2021-08-17 23:25:10 -0500184 # file_name reboot_flag
185 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500186
187
188Redfish Persistency Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500189 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500190 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
191 [Template] Redfish Update Partition File With Same Content
192
Sushil Singh85c381c2021-08-17 23:25:10 -0500193 # file_name reboot_flag
194 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500195
196
Sushil Singh692a2c92021-12-15 06:47:40 -0600197Redfish Persistency Update Partition File Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500198 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singh692a2c92021-12-15 06:47:40 -0600199 [Tags] Redfish_Persistency_Update_Partition_File_Post_BMC_Reboot
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500200 [Template] Redfish Update Partition File With Same Content
201
Sushil Singh85c381c2021-08-17 23:25:10 -0500202 # file_name reboot_flag
203 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500204
205
206Redfish Delete Non Existence Of Partition File
207 [Documentation] Delete the partition file if do not exists.
208 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
209 [Template] Redfish Delete Non Existence Partition File
210
211 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500212 testfile01-file
Vijay09839e22020-02-05 02:54:44 -0600213
214
215Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500216 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600217 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500218 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600219
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500220 # range
221 1000
Vijay09839e22020-02-05 02:54:44 -0600222
Vijay09839e22020-02-05 02:54:44 -0600223
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500224Non Admin Users Fail To Upload Partition File
225 [Documentation] Non admin user will fail to upload the partition file.
226 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
227 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600228
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500229 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500230 500KB-file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600231
232
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500233Non Admin User Delete Non Existence Of Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600234 [Documentation] Delete the partition file if does not exists.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500235 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
236 [Template] Non Admin Delete Non Existence Partition File
237
238 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500239 500KB-file operator_user TestPwd123 Operator
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500240
241
242Redfish Update Wrong Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500243 [Documentation] Upload partition file to BMC by wrong URI using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500244 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
245 [Template] Verify Update Wrong Partition File To BMC
246
247 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500248 500KB-file
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500249
Sushil Singh9942df52021-09-03 02:28:11 -0500250
251Test Redfish Upload Partition File Name With Character Limit To BMC
252 [Documentation] Upload partition file to BMC with file name character allowed limit
253 ... and above allowed limit using Redfish.
254 [Tags] Test_Redfish_Upload_Partition_File_Name_With_Character_Limit_To_BMC
255 [Template] Check Redfish Upload Partition File Name With Character Limit To BMC
256
257 # file_name status_code message
258 50KB-testfilesavfile ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
259 50KB-testsaveareafile ${HTTP_BAD_REQUEST} ${MAXIMUM_FILE_NAME_MESSAGE}
260
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500261
262Test Redfish Fail To Upload Partition File Name With Special Character To BMC
263 [Documentation] Upload partition file to BMC with special character file name and
264 ... Redfish through an error.
265 [Tags] Test_Redfish_Fail_To_Upload_Partition_File_Name_With_Special_Character_To_BMC
266 [Template] Check Redfish Fail To Upload Partition File Name With Special Character To BMC
267
268 # file_name status_code message
269 1KB-*filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
270 1KB-!filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
271 1KB-@filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
272
Sushil Singh44b8cf32021-11-17 06:57:09 -0600273
274Redfish Upload Validated Partition File From Path To BMC
275 [Documentation] Upload valid partition file to BMC from file path define by user in loop.
276 ... By default loop count values is 10 times.
277 [Tags] Redfish_Upload_Validated_Partition_File_From_Path_To_BMC
278
279 Log To Console ${EMPTY}
280 FOR ${count} IN RANGE 1 ${LOOP_COUNT} + 1
281 Log To Console **************************************
282 Log To Console * The Current Loop Count is ${count} of ${LOOP_COUNT} *
283 Log To Console **************************************
284
285 Redfish Upload Partition File From Path ${PARTITION_FILE_PATH}
286 END
287
Vijayfcdadc52020-01-21 01:48:19 -0600288*** Keywords ***
289
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500290Suite Setup Execution
291 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600292
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500293 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600294
295
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500296Test Teardown Execution
297 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600298
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500299 Delete All BMC Partition File ${HTTP_OK}
300 FFDC On Test Case Fail
301
302
303Suite Teardown Execution
304 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600305
306 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600307
308
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500309Delete Local Partition File
310 [Documentation] Delete local partition file.
311 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600312
313 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500314 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600315
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500316 FOR ${conf_file} IN @{file_name}
317 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
318 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
319 END
Vijayfcdadc52020-01-21 01:48:19 -0600320
Vijayfcdadc52020-01-21 01:48:19 -0600321
Sushil Singh1544c5e2021-11-03 07:56:37 -0500322Delete Local Server Partition File
323 [Documentation] Local partition files which is getting uploaded to BMC,
324 ... will get deleted after the uploads. If partition file name consist
325 ... of “-file then partition file gets deleted.
326
327 @{conf_file_list} = OperatingSystem.List Files In Directory ${EXECDIR}
328 ${match_conf_file_list}= Get Matches ${conf_file_list} regexp=.*-file case_insensitive=${True}
329
330 ${num_records}= Get Length ${match_conf_file_list}
331 Return From Keyword If ${num_records} == ${0} ${EMPTY}
332
333 FOR ${conf_file} IN @{match_conf_file_list}
334 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
335 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
336 END
337
338
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500339Create Partition File
340 [Documentation] Create Partition file.
341 [Arguments] ${file_name}
342
343 # Description of argument(s):
344 # file_name Partition file name.
345
346 Delete Local Partition File ${file_name}
347
348 FOR ${conf_file} IN @{file_name}
Sushil Singh85c381c2021-08-17 23:25:10 -0500349 @{words}= Split String ${conf_file} -
Sushil Singh255ec632021-08-26 08:08:21 -0500350 Run dd if=/dev/zero of=${conf_file} bs=${words}[-0] count=1
Sushil Singh251a0bc2021-08-24 01:12:14 -0500351 OperatingSystem.File Should Exist ${conf_file}
352 END
353
354
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500355Delete BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500356 [Documentation] Delete single partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500357 [Arguments] ${file_name} ${status_code} ${expected_message}
358
359 # Description of argument(s):
360 # file_name Partition file name.
361 # status_code HTTPS status code.
362 # expected_message Expected message of URI.
363
364 FOR ${conf_file} IN @{file_name}
365 ${data}= Create Dictionary
366 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
367 Set To Dictionary ${data} headers ${headers}
368
369 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
370 Should Be Equal As Strings ${resp.status_code} ${status_code}
371
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500372 ${description}= Return Description Of Response ${resp.text}
373 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500374 END
375
376
377Delete All BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500378 [Documentation] Delete multiple partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500379 [Arguments] ${status_code}
380
381 # Description of argument(s):
382 # status_code HTTPS status code.
383
384 Initialize OpenBMC
385 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600386 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600387 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600388
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500389 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
390 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600391
392
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500393Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600394 [Documentation] Return description of REST response.
395 [Arguments] ${resp_text}
396
397 # Description of argument(s):
398 # resp_text REST response body.
399
400 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500401 # {
402 # "Description": "File Created"
403 # }
Vijay09839e22020-02-05 02:54:44 -0600404
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500405 ${status}= Run Keyword And Return Status Evaluate isinstance(${resp_text}, dict)
406 Return From Keyword If '${status}' == 'False' ${resp_text}
Vijay09839e22020-02-05 02:54:44 -0600407 ${message}= Evaluate json.loads('''${resp_text}''') json
408
409 [Return] ${message["Description"]}
410
411
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500412Upload Partition File To BMC
413 [Documentation] Upload partition file to BMC.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600414 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True} ${path}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600415
416 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500417 # file_name Partition file name.
418 # status_code HTTPS status code.
419 # expected_message Expected message of URI.
420 # flag If True run part of program, else skip.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600421 # path Partition file path.
Vijay09839e22020-02-05 02:54:44 -0600422
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500423 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
424 FOR ${conf_file} IN @{file_name}
425 # Get the content of the file and upload to BMC.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600426 ${image_data}= OperatingSystem.Get Binary File ${path}${conf_file}
Sushil Singh85c381c2021-08-17 23:25:10 -0500427 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
Vijay09839e22020-02-05 02:54:44 -0600428
Sushil Singh85c381c2021-08-17 23:25:10 -0500429 ${kwargs}= Create Dictionary data=${image_data}
430 Set To Dictionary ${kwargs} headers ${headers}
431 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{kwargs} timeout=10
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500432 Should Be Equal As Strings ${resp.status_code} ${status_code}
433
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500434 ${description}= Return Description Of Response ${resp.text}
435 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500436 END
Vijayfcdadc52020-01-21 01:48:19 -0600437
438
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500439Verify Partition File On BMC
440 [Documentation] Verify partition file on BMC.
441 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600442
443 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500444 # file_name Partition file name.
445 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600446
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500447 FOR ${conf_file} IN @{file_name}
448 ${status} ${stderr} ${rc}= BMC Execute Command
Sushil Singhe5f39ee2021-01-06 00:39:12 -0600449 ... ls -l /var/lib/bmcweb/ibm-management-console/configfiles/${conf_file} | wc -l
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500450 Valid Value ${status} [${Partition_status}]
451 END
Vijayfcdadc52020-01-21 01:48:19 -0600452
453
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500454Redfish Upload Partition File
455 [Documentation] Upload the partition file.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500456 [Arguments] ${file_name} ${file_size}=${EMPTY}
Vijayfcdadc52020-01-21 01:48:19 -0600457
458 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500459 # file_name Partition file name.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500460 # file_size By Default is set to EMPTY,
461 # if user pass small_file_size the create file with small
462 # size keyword gets executed.
Vijayfcdadc52020-01-21 01:48:19 -0600463
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500464 @{Partition_file_list} = Split String ${file_name} ,
465 ${num_records}= Get Length ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500466
Sushil Singh255ec632021-08-26 08:08:21 -0500467 Create Partition File ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500468
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500469 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
470 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
471 Run Keyword If ${num_records} == ${1}
472 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
473 ... ELSE
474 ... Delete All BMC Partition File ${HTTP_OK}
475 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600476
477
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500478Redfish Fail To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600479 [Documentation] Fail to upload the partition file.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500480 [Arguments] ${file_name} ${status_code} ${partition_status} ${response_message}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600481
482 # Description of argument(s):
Sushil Singh255ec632021-08-26 08:08:21 -0500483 # file_name Partition file name.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500484 # status_code HTTPS status code.
485 # partition_status Partition status.
Sushil Singh255ec632021-08-26 08:08:21 -0500486 # response_message By default is set to EMPTY,
Sushil Singh1544c5e2021-11-03 07:56:37 -0500487 # else user provide the information when user upload the partition with file size
Sushil Singh255ec632021-08-26 08:08:21 -0500488 # below lower linit of allowed partition or more than of large allowed partition.
Vijay09839e22020-02-05 02:54:44 -0600489
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500490 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh255ec632021-08-26 08:08:21 -0500491
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500492 Create Partition File ${Partition_file_list}
Sushil Singh1544c5e2021-11-03 07:56:37 -0500493 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${response_message}
494 Verify Partition File On BMC ${Partition_file_list} Partition_status=${partition_status}
Sushil Singh255ec632021-08-26 08:08:21 -0500495
Sushil Singh1544c5e2021-11-03 07:56:37 -0500496 Run Keyword If ${partition_status} == 0
497 ... Run Keywords
498 ... Delete BMC Partition File
499 ... ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE} AND
500 ... Delete All BMC Partition File ${HTTP_OK} AND
501 ... Delete Local Server Partition File
502
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500503 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600504
505
Sushil Singhdf6ba522020-11-24 04:17:00 -0600506Redfish Upload Partition File In Loop
507 [Documentation] Upload the same partition file multiple times in loop to BMC.
508 [Arguments] ${file_name}
509
510 # Description of argument(s):
511 # file_name Partition file name.
512
513 @{Partition_file_list} = Split String ${file_name} ,
514 Create Partition File ${Partition_file_list}
515
516 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
517 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
518
519 FOR ${count} IN RANGE 1 11
Sushil Singh251a0bc2021-08-24 01:12:14 -0500520 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhdf6ba522020-11-24 04:17:00 -0600521 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
522 END
523
524 Initialize OpenBMC
525 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
526 Delete Local Partition File ${Partition_file_list}
527
528
Sushil Singhf39629c2020-12-11 07:30:21 -0600529Redfish Upload And Delete Partition File In Loop
530 [Documentation] Upload the same partition file multiple times in loop to BMC.
531 [Arguments] ${file_name}
532
533 # Description of argument(s):
534 # file_name Partition file name.
535
536 FOR ${count} IN RANGE 1 11
537 Redfish Upload Partition File ${file_name}
538 END
539
540
Sushil Singh5d0782f2020-11-23 06:35:35 -0600541Verify Partition File Upload Post BMC Reboot
542 [Documentation] Upload the partition file, after BMC reboot.
543 [Arguments] ${file_name}
544
545 # Description of argument(s):
546 # file_name Partition file name.
547
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600548 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
549 Redfish BMC Reset Operation
550 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
551
552 Is BMC Standby
Sushil Singh5d0782f2020-11-23 06:35:35 -0600553
554 Redfish Upload Partition File ${file_name}
555
556
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500557Redfish Partition File Persistency
558 [Documentation] Upload the partition file and check for persistency after reboot.
559 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600560
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500561 # Description of argument(s):
562 # file_name Partition file name.
563
564 @{Partition_file_list} = Split String ${file_name} ,
565 ${num_records}= Get Length ${Partition_file_list}
566 Create Partition File ${Partition_file_list}
567 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
568 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600569
570 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
571 Redfish BMC Reset Operation
572 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
573
574 Is BMC Standby
575
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500576 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600577 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500578 Run Keyword If ${num_records} == ${1}
579 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
580 ... ELSE
581 ... Delete All BMC Partition File ${HTTP_OK}
582 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600583
584
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500585Verify Redfish Partition File Content
586 [Documentation] Verify partition file content.
587 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600588
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500589 # Description of argument(s):
590 # file_name Partition file name.
591 # content_dict Dict contain the content.
592 # status_code HTTPS status code.
593
594 FOR ${conf_file} IN @{file_name}
595 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
596 Should Be Equal As Strings ${resp.status_code} ${status_code}
597
598 ${Partition_file_data}= Remove String ${resp.text} \\n
599 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
600 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
601 END
Vijayfcdadc52020-01-21 01:48:19 -0600602
Vijay39373152020-02-14 08:08:20 -0600603
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500604Add Content To Files
605 [Documentation] Add defined content in partition file.
606 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600607
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500608 # Description of argument(s):
609 # file_name Partition file name.
610 # index Index
611
612 ${num_records}= Get Length ${file_name}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500613 &{content_dict}= Create Dictionary
Sushil Singh85c381c2021-08-17 23:25:10 -0500614
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500615 FOR ${conf_file} IN @{file_name}
616 ${index}= Get Index From List ${file_name} ${conf_file}
617 ${index}= Evaluate ${index} + 1
618
619 Run echo "${content-${index}}" > ${conf_file}
620 OperatingSystem.File Should Exist ${conf_file}
621
622 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
623 END
624
625 [Return] &{content_dict}
626
627
628Redfish Read Partition File
629 [Documentation] Read partition file content.
630 [Arguments] ${file_name} ${reboot_flag}=False
631
632 # Description of argument(s):
633 # file_name Partition file name.
634 # reboot_flag Reboot flag.
635
636 @{Partition_file_list} = Split String ${file_name} ,
637 ${content_dict}= Add Content To Files ${Partition_file_list}
638
639 ${num_records}= Get Length ${Partition_file_list}
640
641 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
642 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
643 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
644
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600645 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
646
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500647 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600648 ... Run Keywords Redfish BMC Reset Operation AND
649 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
650 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500651 ... Initialize OpenBMC AND
652 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600653
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500654 Run Keyword If ${num_records} == ${1}
655 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
656 ... ELSE
657 ... Delete All BMC Partition File ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600658
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500659 Delete Local Partition File ${Partition_file_list}
660
661
662Redfish Update Partition File With Same Content
663 [Documentation] Update partition file with same content.
664 [Arguments] ${file_name} ${reboot_flag}=False
665
666 # Description of argument(s):
667 # file_name Partition file name.
668 # reboot_flag Reboot flag.
669
670 @{Partition_file_list} = Split String ${file_name} ,
671 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
672
673 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
674 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
675 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
676
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600677 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
678
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500679 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600680 ... Run Keywords Redfish BMC Reset Operation AND
681 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
682 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500683 ... Initialize OpenBMC
684
685 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500686 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500687 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
688 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
689
690 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
691 Delete Local Partition File ${Partition_file_list}
692
693
694Redfish Update Partition File With Different Content
695 [Documentation] Update partition file with different content.
696 [Arguments] ${file_name} ${reboot_flag}=False
697
698 # Description of argument(s):
699 # file_name Partition file name.
700 # reboot_flag Reboot flag.
701
702 @{Partition_file_list} = Split String ${file_name} ,
703 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
704
705 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
706 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
707 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
708
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600709 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
710
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500711 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600712 ... Run Keywords Redfish BMC Reset Operation AND
713 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
714 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500715 ... Initialize OpenBMC
716
717 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500718 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500719 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
720 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
721
722 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
723 Delete Local Partition File ${Partition_file_list}
724
725
726Create File Names
727 [Documentation] Create partition file names.
728 [Arguments] ${range}
729
730 # Description of argument(s):
731 # range Range in numbers.
732
733 @{file_name_list}= Create List
734 Set Test Variable ${file_name} rangefile
735 FOR ${count} IN RANGE ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500736 Append To List ${file_name_list} 1KB-file${count}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500737 END
738 [Return] ${file_name_list}
739
740
741Redfish Upload Partition File With Range
742 [Documentation] Upload the partition file with the range of files.
743 [Arguments] ${range}
744
745 # Description of argument(s):
746 # range Range in numbers.
747
748 ${Partition_file_list}= Create File Names ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500749 Delete Local Partition File ${Partition_file_list}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500750 Create Partition File ${Partition_file_list}
751 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
752 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
753 Delete All BMC Partition File ${HTTP_OK}
754 Delete Local Partition File ${Partition_file_list}
755
756
757Redfish Delete Non Existence Partition File
758 [Documentation] Delete the partition file if do not exists.
759 [Arguments] ${file_name}
760
761 # Description of argument(s):
762 # file_name Partition file name.
763
764 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh251a0bc2021-08-24 01:12:14 -0500765 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500766
767
768Non Admin User To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600769 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500770 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
771
772 # Description of argument(s):
773 # file_name Partition file name.
774 # username Username.
775 # password Password.
776 # role Role of user.
777 # enabled Value can be True or False.
778
779 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600780 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500781 Initialize OpenBMC rest_username=${username} rest_password=${password}
782 @{Partition_file_list} = Split String ${file_name} ,
783 Create Partition File ${Partition_file_list}
784 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
785 Delete Local Partition File ${Partition_file_list}
786 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
787
788
789Non Admin Delete Non Existence Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600790 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500791 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
792
793 # Description of argument(s):
794 # file_name Partition file name.
795 # username Username.
796 # password Password.
797 # role Role of user.
798 # enabled Value can be True or False.
799
800 Redfish Create User ${username} ${password} ${role} ${enabled}
801 Delete All Sessions
802 Initialize OpenBMC rest_username=${username} rest_password=${password}
803 @{Partition_file_list} = Split String ${file_name} ,
804 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
805
806
807Verify Update Wrong Partition File To BMC
808 [Documentation] Upload the wrong partition file to BMC.
809 [Arguments] ${file_name}
810
811 # Description of argument(s):
812 # file_name Partition file name.
813
814 Redfish.Login
815 ${resp}= Run Keyword And Return Status
816 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
817 Should Be Equal As Strings ${resp} False
Sushil Singh9942df52021-09-03 02:28:11 -0500818
819
820Check Redfish Upload Partition File Name With Character Limit To BMC
821 [Documentation] Upload the partition file to BMC with file name character limit.
822 [Arguments] ${file_name} ${status_code} ${message}
823
824 # Description of argument(s):
825 # file_name Partition file name.
826 # status_code HTTPS status code.
827 # message Expected message of from upload partition file URI.
828
829 @{Partition_file_list} = Split String ${file_name} ,
830 ${num_records}= Get Length ${Partition_file_list}
831 Create Partition File ${Partition_file_list}
832
833 ${file_name_length}= Get Length ${Partition_file_list}[0]
834
835 Run Keyword If ${file_name_length} == 20
836 ... Run Keywords
837 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message} AND
838 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1 AND
839 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
840 ... ELSE
841 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
842
843 Delete Local Partition File ${Partition_file_list}
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500844
845
846Check Redfish Fail To Upload Partition File Name With Special Character To BMC
847 [Documentation] Upload the partition file to BMC with special character file name.
848 [Arguments] ${file_name} ${status_code} ${message}
849
850 # Description of argument(s):
851 # file_name Partition file name.
852 # status_code HTTPS status code.
853 # message Expected message from upload partition file URI.
854
855 @{Partition_file_list} = Split String ${file_name} ,
856 ${num_records}= Get Length ${Partition_file_list}
857
858 Create Partition File ${Partition_file_list}
859
860 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
861
862 ${status}= Run Keyword And Return Status
863 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1
864 Should Be Equal As Strings ${status} False
865
866 Delete Local Partition File ${Partition_file_list}
Sushil Singh44b8cf32021-11-17 06:57:09 -0600867
868
869Redfish Upload Partition File From Path
870 [Documentation] Upload the partition file to BMC from file path.
871 [Arguments] ${PARTITION_FILE_PATH}
872
873 # Description of argument(s):
874 # PARTITION_FILE_PATH Partition file path.
875
876 ${file_list} = OperatingSystem.List Files In Directory ${PARTITION_FILE_PATH}
877
878 ${num_records}= Get Length ${file_list}
879 Should Not Be Equal As Integers ${num_records} 0
880
881 FOR ${file_name} IN @{file_list}
882 @{Partition_file_list} = Split String ${file_name} ,
883 ${num_records}= Get Length ${Partition_file_list}
George Keishing538f1742022-03-14 05:00:55 -0500884 Upload Partition File To BMC file_name=${Partition_file_list}
885 ... status_code=${HTTP_OK} expected_message=${FILE_UPLOAD_MESSAGE} path=${PARTITION_FILE_PATH}
Sushil Singh44b8cf32021-11-17 06:57:09 -0600886 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
887 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
888 END
889