blob: 43d5b5674e9e045bea41fe2c6eea0ea29700fcf8 [file] [log] [blame]
Vijayfcdadc52020-01-21 01:48:19 -06001*** Settings ***
2
Sushil Singhcbbce6a2020-09-07 00:57:37 -05003Documentation Test Save Area feature of Management Console on BMC.
Vijayfcdadc52020-01-21 01:48:19 -06004
5Resource ../../lib/rest_client.robot
6Resource ../../lib/openbmc_ffdc.robot
7Resource ../../lib/resource.robot
Vijay09839e22020-02-05 02:54:44 -06008Resource ../../lib/bmc_redfish_utils.robot
Vijayfcdadc52020-01-21 01:48:19 -06009Resource ../../lib/utils.robot
Sushil Singhcbbce6a2020-09-07 00:57:37 -050010Resource ../../lib/bmc_redfish_resource.robot
Sushil Singh177b4592022-09-20 08:25:25 -050011Resource ../../lib/external_intf/management_console_utils.robot
Vijayfcdadc52020-01-21 01:48:19 -060012
Vijay39373152020-02-14 08:08:20 -060013Suite Setup Suite Setup Execution
14Test Teardown Test Teardown Execution
15Suite Teardown Suite Teardown Execution
Vijayfcdadc52020-01-21 01:48:19 -060016
Vijayfcdadc52020-01-21 01:48:19 -060017*** Variables ***
18
Sushil Singhde1347d2022-07-13 02:54:26 -050019${MAXIMUM_FILE_SIZE_MESSAGE} File size exceeds maximum allowed size[25MB]
Sushil Singh1544c5e2021-11-03 07:56:37 -050020${MAXIMUM_DIR_SIZE_MESSAGE}
Sushil Singhde1347d2022-07-13 02:54:26 -050021... File size does not fit in the savearea directory maximum allowed size[25MB]
Sushil Singh251a0bc2021-08-24 01:12:14 -050022${FILE_UPLOAD_MESSAGE} File Created
23${FILE_DELETED_MESSAGE} File Deleted
24${FILE_UPDATED_MESSAGE} File Updated
25${FORBIDDEN_MESSAGE} Forbidden
26${ERROR_MESSAGE} Error while creating the file
27${RESOURCE_NOT_FOUND_MESSAGE} Resource Not Found
28${MINIMUM_FILE_SIZE_MESSAGE} File size is less than minimum allowed size[100B]
29${MAXIMUM_FILE_NAME_MESSAGE} Filename must be maximum 20 characters
30${UNSUPPORTED_FILE_NAME_MESSAGE} Unsupported character in filename
Vijayfcdadc52020-01-21 01:48:19 -060031
Sushil Singh251a0bc2021-08-24 01:12:14 -050032${content-1} Sample Content to test partition file upload
Sushil Singh85c381c2021-08-17 23:25:10 -050033... Sample Content to test partition file upload
34... Sample Content to test partition file upload
Sushil Singh251a0bc2021-08-24 01:12:14 -050035${content-2} Sample Content to test partition file upload after reboot
Sushil Singh85c381c2021-08-17 23:25:10 -050036... Sample Content to test partition file upload after reboot
37... Sample Content to test partition file upload after reboot
38
Sushil Singh44b8cf32021-11-17 06:57:09 -060039${LOOP_COUNT} 10
40
Vijayfcdadc52020-01-21 01:48:19 -060041*** Test Cases ***
42
Sushil Singh251a0bc2021-08-24 01:12:14 -050043Redfish Upload Lower Limit Partition File To BMC
44 [Documentation] Upload lower limit of allowed partition file to BMC using Redfish.
45 [Tags] Redfish_Upload_Lower_Limit_Partition_File_To_BMC
46 [Template] Redfish Upload Partition File
47
Sushil Singh255ec632021-08-26 08:08:21 -050048 # file_name
49 100-file
Sushil Singh251a0bc2021-08-24 01:12:14 -050050
51
Sushil Singhcbbce6a2020-09-07 00:57:37 -050052Redfish Upload Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050053 [Documentation] Upload partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050054 [Tags] Redfish_Upload_Partition_File_To_BMC
55 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060056
Sushil Singhcbbce6a2020-09-07 00:57:37 -050057 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050058 500KB-file
Sushil Singhde1347d2022-07-13 02:54:26 -050059 2000KB-file
Sushil Singh1544c5e2021-11-03 07:56:37 -050060 10000KB-file
Sushil Singhde1347d2022-07-13 02:54:26 -050061 25000KB-file
Vijayfcdadc52020-01-21 01:48:19 -060062
63
Sushil Singh255ec632021-08-26 08:08:21 -050064Test Upload Lower Limit Partition File To BMC And Expect Failure
65 [Documentation] Fail to upload partition file to BMC with file size
66 ... below the lower limit of allowed partition file size using Redfish.
67 [Tags] Test_Upload_Lower_Limit_Partition_File_To_BMC_And_Expect_Failure
68 [Template] Redfish Fail To Upload Partition File
69
Sushil Singh1544c5e2021-11-03 07:56:37 -050070 # file_name status_code partition_status response_message
71 99-file ${HTTP_BAD_REQUEST} 0 ${MINIMUM_FILE_SIZE_MESSAGE}
Sushil Singh255ec632021-08-26 08:08:21 -050072
73
Sushil Singh298d15d2021-12-14 07:21:09 -060074Test Upload Upper Limit Partition File To BMC And Expect Failure
75 [Documentation] Fail to upload partition file to BMC with file size
76 ... more than upper limit of allowed partition file size using Redfish.
77 [Tags] Test_Upload_Upper_Limit_Partition_File_To_BMC_And_Expect_Failure
Sushil Singhcbbce6a2020-09-07 00:57:37 -050078 [Template] Redfish Fail To Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060079
Sushil Singh1544c5e2021-11-03 07:56:37 -050080 # file_name status_code partition_status response_message
Sushil Singhde1347d2022-07-13 02:54:26 -050081 25001KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_FILE_SIZE_MESSAGE}
Vijayfcdadc52020-01-21 01:48:19 -060082
83
Sushil Singhcbbce6a2020-09-07 00:57:37 -050084Redfish Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050085 [Documentation] Upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050086 [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC
87 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060088
Sushil Singhcbbce6a2020-09-07 00:57:37 -050089 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050090 250KB-file,500KB-file
Vijayfcdadc52020-01-21 01:48:19 -060091
92
Sushil Singhf9eeec72021-12-14 08:31:59 -060093Test Upload Partition File When BMC Space Reach Max And Expect Failure
94 [Documentation] Fail to upload multiple partition file to BMC
95 ... as BMC directory reach to upper limit using Redfish.
96 [Tags] Test_Upload_Partition_File_When_BMC_Space_Reach_Max_And_Expect_Failure
Sushil Singhcbbce6a2020-09-07 00:57:37 -050097 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -060098
Sushil Singh1544c5e2021-11-03 07:56:37 -050099 # file_name status_code partition_status response_message
Sushil Singhde1347d2022-07-13 02:54:26 -0500100 15000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
101 16000KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
102 25000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
Sushil Singh1544c5e2021-11-03 07:56:37 -0500103 100-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
Vijay09839e22020-02-05 02:54:44 -0600104
105
Sushil Singhdf6ba522020-11-24 04:17:00 -0600106Redfish Upload Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500107 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhdf6ba522020-11-24 04:17:00 -0600108 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
109 [Template] Redfish Upload Partition File In Loop
110
111 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500112 500KB-file
Sushil Singhdf6ba522020-11-24 04:17:00 -0600113
114
Sushil Singhf39629c2020-12-11 07:30:21 -0600115Redfish Upload And Delete Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500116 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhf39629c2020-12-11 07:30:21 -0600117 [Tags] Redfish_Upload_And_Delete_Same_Partition_File_To_BMC_In_Loop
118 [Template] Redfish Upload And Delete Partition File In Loop
119
120 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500121 500KB-file
Sushil Singhf39629c2020-12-11 07:30:21 -0600122
123
Sushil Singh5d0782f2020-11-23 06:35:35 -0600124Redfish Partition File Upload Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500125 [Documentation] Upload partition file to BMC using Redfish, after the BMC reboot.
Sushil Singh5d0782f2020-11-23 06:35:35 -0600126 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
127 [Template] Verify Partition File Upload Post BMC Reboot
128
129 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500130 500KB-file
Sushil Singh5d0782f2020-11-23 06:35:35 -0600131
132
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500133Redfish Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500134 [Documentation] Upload partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500135 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
136 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600137
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500138 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500139 500KB-file
Vijay09839e22020-02-05 02:54:44 -0600140
141
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500142Redfish Multiple Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500143 [Documentation] Upload multiple partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500144 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
145 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600146
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500147 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500148 250KB-file,500KB-file
Vijay09839e22020-02-05 02:54:44 -0600149
150
Sushil Singhb22e4b62021-12-15 00:54:53 -0600151Redfish Read Partition File From BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500152 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhb22e4b62021-12-15 00:54:53 -0600153 [Tags] Redfish_Read_Partition_File_From_BMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500154 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600155
Sushil Singh85c381c2021-08-17 23:25:10 -0500156 # file_name reboot_flag
157 testfile01-file False
158 testfile01-file,testfile02-file False
Vijay09839e22020-02-05 02:54:44 -0600159
Vijay09839e22020-02-05 02:54:44 -0600160
Sushil Singhb22e4b62021-12-15 00:54:53 -0600161Redfish Read Partition File Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500162 [Documentation] Upload partition file to BMC using Redfish and verify the content after reboot.
Sushil Singhb22e4b62021-12-15 00:54:53 -0600163 [Tags] Redfish_Read_Partition_File_Post_BMC_Reboot
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500164 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600165
Sushil Singh85c381c2021-08-17 23:25:10 -0500166 # file_name reboot_flag
167 testfile01-file True
168 testfile01-file,testfile02-file True
Vijay09839e22020-02-05 02:54:44 -0600169
Vijay09839e22020-02-05 02:54:44 -0600170
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500171Redfish Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500172 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500173 [Tags] Redfish_Update_Partition_File_On_BMC
174 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600175
Sushil Singh85c381c2021-08-17 23:25:10 -0500176 # file_name reboot_flag
177 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500178
179
180Redfish Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500181 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500182 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
183 [Template] Redfish Update Partition File With Different Content
184
Sushil Singh85c381c2021-08-17 23:25:10 -0500185 # file_name reboot_flag
186 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500187
188
189Redfish Persistency Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500190 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500191 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
192 [Template] Redfish Update Partition File With Same Content
193
Sushil Singh85c381c2021-08-17 23:25:10 -0500194 # file_name reboot_flag
195 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500196
197
Sushil Singh692a2c92021-12-15 06:47:40 -0600198Redfish Persistency Update Partition File Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500199 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singh692a2c92021-12-15 06:47:40 -0600200 [Tags] Redfish_Persistency_Update_Partition_File_Post_BMC_Reboot
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500201 [Template] Redfish Update Partition File With Same Content
202
Sushil Singh85c381c2021-08-17 23:25:10 -0500203 # file_name reboot_flag
204 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500205
206
207Redfish Delete Non Existence Of Partition File
208 [Documentation] Delete the partition file if do not exists.
209 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
210 [Template] Redfish Delete Non Existence Partition File
211
212 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500213 testfile01-file
Vijay09839e22020-02-05 02:54:44 -0600214
215
216Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500217 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600218 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500219 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600220
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500221 # range
222 1000
Vijay09839e22020-02-05 02:54:44 -0600223
Vijay09839e22020-02-05 02:54:44 -0600224
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500225Non Admin Users Fail To Upload Partition File
226 [Documentation] Non admin user will fail to upload the partition file.
227 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
228 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600229
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500230 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500231 500KB-file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600232
233
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500234Non Admin User Delete Non Existence Of Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600235 [Documentation] Delete the partition file if does not exists.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500236 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
237 [Template] Non Admin Delete Non Existence Partition File
238
239 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500240 500KB-file operator_user TestPwd123 Operator
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500241
242
243Redfish Update Wrong Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500244 [Documentation] Upload partition file to BMC by wrong URI using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500245 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
246 [Template] Verify Update Wrong Partition File To BMC
247
248 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500249 500KB-file
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500250
Sushil Singh9942df52021-09-03 02:28:11 -0500251
252Test Redfish Upload Partition File Name With Character Limit To BMC
253 [Documentation] Upload partition file to BMC with file name character allowed limit
254 ... and above allowed limit using Redfish.
255 [Tags] Test_Redfish_Upload_Partition_File_Name_With_Character_Limit_To_BMC
256 [Template] Check Redfish Upload Partition File Name With Character Limit To BMC
257
258 # file_name status_code message
259 50KB-testfilesavfile ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
260 50KB-testsaveareafile ${HTTP_BAD_REQUEST} ${MAXIMUM_FILE_NAME_MESSAGE}
261
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500262
263Test Redfish Fail To Upload Partition File Name With Special Character To BMC
264 [Documentation] Upload partition file to BMC with special character file name and
265 ... Redfish through an error.
266 [Tags] Test_Redfish_Fail_To_Upload_Partition_File_Name_With_Special_Character_To_BMC
267 [Template] Check Redfish Fail To Upload Partition File Name With Special Character To BMC
268
269 # file_name status_code message
270 1KB-*filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
271 1KB-!filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
272 1KB-@filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
273
Sushil Singh44b8cf32021-11-17 06:57:09 -0600274
275Redfish Upload Validated Partition File From Path To BMC
276 [Documentation] Upload valid partition file to BMC from file path define by user in loop.
277 ... By default loop count values is 10 times.
278 [Tags] Redfish_Upload_Validated_Partition_File_From_Path_To_BMC
279
280 Log To Console ${EMPTY}
281 FOR ${count} IN RANGE 1 ${LOOP_COUNT} + 1
282 Log To Console **************************************
283 Log To Console * The Current Loop Count is ${count} of ${LOOP_COUNT} *
284 Log To Console **************************************
285
286 Redfish Upload Partition File From Path ${PARTITION_FILE_PATH}
287 END
288
Vijayfcdadc52020-01-21 01:48:19 -0600289*** Keywords ***
290
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500291Suite Setup Execution
292 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600293
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500294 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600295
296
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500297Test Teardown Execution
298 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600299
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500300 Delete All BMC Partition File ${HTTP_OK}
301 FFDC On Test Case Fail
302
303
304Suite Teardown Execution
305 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600306
307 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600308
309
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500310Delete Local Partition File
311 [Documentation] Delete local partition file.
312 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600313
314 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500315 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600316
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500317 FOR ${conf_file} IN @{file_name}
318 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
319 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
320 END
Vijayfcdadc52020-01-21 01:48:19 -0600321
Vijayfcdadc52020-01-21 01:48:19 -0600322
Sushil Singh1544c5e2021-11-03 07:56:37 -0500323Delete Local Server Partition File
324 [Documentation] Local partition files which is getting uploaded to BMC,
325 ... will get deleted after the uploads. If partition file name consist
326 ... of “-file then partition file gets deleted.
327
328 @{conf_file_list} = OperatingSystem.List Files In Directory ${EXECDIR}
329 ${match_conf_file_list}= Get Matches ${conf_file_list} regexp=.*-file case_insensitive=${True}
330
331 ${num_records}= Get Length ${match_conf_file_list}
332 Return From Keyword If ${num_records} == ${0} ${EMPTY}
333
334 FOR ${conf_file} IN @{match_conf_file_list}
335 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
336 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
337 END
338
339
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500340Create Partition File
341 [Documentation] Create Partition file.
342 [Arguments] ${file_name}
343
344 # Description of argument(s):
345 # file_name Partition file name.
346
347 Delete Local Partition File ${file_name}
348
349 FOR ${conf_file} IN @{file_name}
Sushil Singh85c381c2021-08-17 23:25:10 -0500350 @{words}= Split String ${conf_file} -
Sushil Singh255ec632021-08-26 08:08:21 -0500351 Run dd if=/dev/zero of=${conf_file} bs=${words}[-0] count=1
Sushil Singh251a0bc2021-08-24 01:12:14 -0500352 OperatingSystem.File Should Exist ${conf_file}
353 END
354
355
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500356Delete BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500357 [Documentation] Delete single partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500358 [Arguments] ${file_name} ${status_code} ${expected_message}
359
360 # Description of argument(s):
361 # file_name Partition file name.
362 # status_code HTTPS status code.
363 # expected_message Expected message of URI.
364
365 FOR ${conf_file} IN @{file_name}
366 ${data}= Create Dictionary
367 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
368 Set To Dictionary ${data} headers ${headers}
369
George Keishingfbd67002022-08-01 11:24:03 -0500370 ${resp}= DELETE On Session openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
371 ... expected_status=any
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500372 Should Be Equal As Strings ${resp.status_code} ${status_code}
373
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500374 ${description}= Return Description Of Response ${resp.text}
375 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500376 END
377
378
379Delete All BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500380 [Documentation] Delete multiple partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500381 [Arguments] ${status_code}
382
383 # Description of argument(s):
384 # status_code HTTPS status code.
385
386 Initialize OpenBMC
387 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600388 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600389 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600390
George Keishingfbd67002022-08-01 11:24:03 -0500391 ${resp}= POST On Session openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
392 ... expected_status=any
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500393 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600394
395
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500396Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600397 [Documentation] Return description of REST response.
398 [Arguments] ${resp_text}
399
400 # Description of argument(s):
401 # resp_text REST response body.
402
403 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500404 # {
405 # "Description": "File Created"
406 # }
Vijay09839e22020-02-05 02:54:44 -0600407
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500408 ${status}= Run Keyword And Return Status Evaluate isinstance(${resp_text}, dict)
409 Return From Keyword If '${status}' == 'False' ${resp_text}
Vijay09839e22020-02-05 02:54:44 -0600410 ${message}= Evaluate json.loads('''${resp_text}''') json
411
412 [Return] ${message["Description"]}
413
414
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500415Upload Partition File To BMC
416 [Documentation] Upload partition file to BMC.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600417 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True} ${path}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600418
419 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500420 # file_name Partition file name.
421 # status_code HTTPS status code.
422 # expected_message Expected message of URI.
423 # flag If True run part of program, else skip.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600424 # path Partition file path.
Vijay09839e22020-02-05 02:54:44 -0600425
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500426 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
427 FOR ${conf_file} IN @{file_name}
428 # Get the content of the file and upload to BMC.
Sushil Singh44b8cf32021-11-17 06:57:09 -0600429 ${image_data}= OperatingSystem.Get Binary File ${path}${conf_file}
Sushil Singh85c381c2021-08-17 23:25:10 -0500430 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
Vijay09839e22020-02-05 02:54:44 -0600431
Sushil Singh85c381c2021-08-17 23:25:10 -0500432 ${kwargs}= Create Dictionary data=${image_data}
433 Set To Dictionary ${kwargs} headers ${headers}
George Keishingfbd67002022-08-01 11:24:03 -0500434 ${resp}= PUT On Session openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{kwargs} timeout=10
435 ... expected_status=any
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500436 Should Be Equal As Strings ${resp.status_code} ${status_code}
437
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500438 ${description}= Return Description Of Response ${resp.text}
439 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500440 END
Vijayfcdadc52020-01-21 01:48:19 -0600441
442
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500443Verify Partition File On BMC
444 [Documentation] Verify partition file on BMC.
445 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600446
447 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500448 # file_name Partition file name.
449 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600450
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500451 FOR ${conf_file} IN @{file_name}
452 ${status} ${stderr} ${rc}= BMC Execute Command
Sushil Singhe5f39ee2021-01-06 00:39:12 -0600453 ... ls -l /var/lib/bmcweb/ibm-management-console/configfiles/${conf_file} | wc -l
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500454 Valid Value ${status} [${Partition_status}]
455 END
Vijayfcdadc52020-01-21 01:48:19 -0600456
457
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500458Redfish Upload Partition File
459 [Documentation] Upload the partition file.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500460 [Arguments] ${file_name} ${file_size}=${EMPTY}
Vijayfcdadc52020-01-21 01:48:19 -0600461
462 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500463 # file_name Partition file name.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500464 # file_size By Default is set to EMPTY,
465 # if user pass small_file_size the create file with small
466 # size keyword gets executed.
Vijayfcdadc52020-01-21 01:48:19 -0600467
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500468 @{Partition_file_list} = Split String ${file_name} ,
469 ${num_records}= Get Length ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500470
Sushil Singh255ec632021-08-26 08:08:21 -0500471 Create Partition File ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500472
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500473 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
474 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
475 Run Keyword If ${num_records} == ${1}
476 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
477 ... ELSE
478 ... Delete All BMC Partition File ${HTTP_OK}
479 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600480
481
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500482Redfish Fail To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600483 [Documentation] Fail to upload the partition file.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500484 [Arguments] ${file_name} ${status_code} ${partition_status} ${response_message}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600485
486 # Description of argument(s):
Sushil Singh255ec632021-08-26 08:08:21 -0500487 # file_name Partition file name.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500488 # status_code HTTPS status code.
489 # partition_status Partition status.
Sushil Singh255ec632021-08-26 08:08:21 -0500490 # response_message By default is set to EMPTY,
Sushil Singh1544c5e2021-11-03 07:56:37 -0500491 # else user provide the information when user upload the partition with file size
Sushil Singh255ec632021-08-26 08:08:21 -0500492 # below lower linit of allowed partition or more than of large allowed partition.
Vijay09839e22020-02-05 02:54:44 -0600493
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500494 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh255ec632021-08-26 08:08:21 -0500495
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500496 Create Partition File ${Partition_file_list}
Sushil Singh1544c5e2021-11-03 07:56:37 -0500497 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${response_message}
498 Verify Partition File On BMC ${Partition_file_list} Partition_status=${partition_status}
Sushil Singh255ec632021-08-26 08:08:21 -0500499
Sushil Singh1544c5e2021-11-03 07:56:37 -0500500 Run Keyword If ${partition_status} == 0
501 ... Run Keywords
502 ... Delete BMC Partition File
503 ... ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE} AND
504 ... Delete All BMC Partition File ${HTTP_OK} AND
505 ... Delete Local Server Partition File
506
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500507 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600508
509
Sushil Singhdf6ba522020-11-24 04:17:00 -0600510Redfish Upload Partition File In Loop
511 [Documentation] Upload the same partition file multiple times in loop to BMC.
512 [Arguments] ${file_name}
513
514 # Description of argument(s):
515 # file_name Partition file name.
516
517 @{Partition_file_list} = Split String ${file_name} ,
518 Create Partition File ${Partition_file_list}
519
520 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
521 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
522
523 FOR ${count} IN RANGE 1 11
Sushil Singh251a0bc2021-08-24 01:12:14 -0500524 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhdf6ba522020-11-24 04:17:00 -0600525 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
526 END
527
528 Initialize OpenBMC
529 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
530 Delete Local Partition File ${Partition_file_list}
531
532
Sushil Singhf39629c2020-12-11 07:30:21 -0600533Redfish Upload And Delete Partition File In Loop
534 [Documentation] Upload the same partition file multiple times in loop to BMC.
535 [Arguments] ${file_name}
536
537 # Description of argument(s):
538 # file_name Partition file name.
539
540 FOR ${count} IN RANGE 1 11
541 Redfish Upload Partition File ${file_name}
542 END
543
544
Sushil Singh5d0782f2020-11-23 06:35:35 -0600545Verify Partition File Upload Post BMC Reboot
546 [Documentation] Upload the partition file, after BMC reboot.
547 [Arguments] ${file_name}
548
549 # Description of argument(s):
550 # file_name Partition file name.
551
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600552 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
553 Redfish BMC Reset Operation
554 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
555
Sushil Singh177b4592022-09-20 08:25:25 -0500556 Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600557 Is BMC Standby
Sushil Singh5d0782f2020-11-23 06:35:35 -0600558
559 Redfish Upload Partition File ${file_name}
560
561
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500562Redfish Partition File Persistency
563 [Documentation] Upload the partition file and check for persistency after reboot.
564 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600565
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500566 # Description of argument(s):
567 # file_name Partition file name.
568
569 @{Partition_file_list} = Split String ${file_name} ,
570 ${num_records}= Get Length ${Partition_file_list}
571 Create Partition File ${Partition_file_list}
572 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
573 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600574
575 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
576 Redfish BMC Reset Operation
577 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
578
Sushil Singh177b4592022-09-20 08:25:25 -0500579 Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600580 Is BMC Standby
581
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500582 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600583 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500584 Run Keyword If ${num_records} == ${1}
585 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
586 ... ELSE
587 ... Delete All BMC Partition File ${HTTP_OK}
588 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600589
590
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500591Verify Redfish Partition File Content
592 [Documentation] Verify partition file content.
593 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600594
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500595 # Description of argument(s):
596 # file_name Partition file name.
597 # content_dict Dict contain the content.
598 # status_code HTTPS status code.
599
600 FOR ${conf_file} IN @{file_name}
George Keishingfbd67002022-08-01 11:24:03 -0500601 ${resp}= GET On Session openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
602 ... expected_status=any
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500603 Should Be Equal As Strings ${resp.status_code} ${status_code}
604
605 ${Partition_file_data}= Remove String ${resp.text} \\n
606 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
607 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
608 END
Vijayfcdadc52020-01-21 01:48:19 -0600609
Vijay39373152020-02-14 08:08:20 -0600610
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500611Add Content To Files
612 [Documentation] Add defined content in partition file.
613 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600614
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500615 # Description of argument(s):
616 # file_name Partition file name.
617 # index Index
618
619 ${num_records}= Get Length ${file_name}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500620 &{content_dict}= Create Dictionary
Sushil Singh85c381c2021-08-17 23:25:10 -0500621
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500622 FOR ${conf_file} IN @{file_name}
623 ${index}= Get Index From List ${file_name} ${conf_file}
624 ${index}= Evaluate ${index} + 1
625
626 Run echo "${content-${index}}" > ${conf_file}
627 OperatingSystem.File Should Exist ${conf_file}
628
629 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
630 END
631
632 [Return] &{content_dict}
633
634
635Redfish Read Partition File
636 [Documentation] Read partition file content.
637 [Arguments] ${file_name} ${reboot_flag}=False
638
639 # Description of argument(s):
640 # file_name Partition file name.
641 # reboot_flag Reboot flag.
642
643 @{Partition_file_list} = Split String ${file_name} ,
644 ${content_dict}= Add Content To Files ${Partition_file_list}
645
646 ${num_records}= Get Length ${Partition_file_list}
647
648 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
649 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
650 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
651
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600652 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
653
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500654 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600655 ... Run Keywords Redfish BMC Reset Operation AND
656 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
Sushil Singh177b4592022-09-20 08:25:25 -0500657 ... Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled AND
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600658 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500659 ... Initialize OpenBMC AND
660 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600661
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500662 Run Keyword If ${num_records} == ${1}
663 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
664 ... ELSE
665 ... Delete All BMC Partition File ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600666
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500667 Delete Local Partition File ${Partition_file_list}
668
669
670Redfish Update Partition File With Same Content
671 [Documentation] Update partition file with same content.
672 [Arguments] ${file_name} ${reboot_flag}=False
673
674 # Description of argument(s):
675 # file_name Partition file name.
676 # reboot_flag Reboot flag.
677
678 @{Partition_file_list} = Split String ${file_name} ,
679 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
680
681 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
682 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
683 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
684
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600685 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
686
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500687 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600688 ... Run Keywords Redfish BMC Reset Operation AND
689 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
Sushil Singh177b4592022-09-20 08:25:25 -0500690 ... Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled AND
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600691 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500692 ... Initialize OpenBMC
693
694 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500695 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500696 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
697 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
698
699 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
700 Delete Local Partition File ${Partition_file_list}
701
702
703Redfish Update Partition File With Different Content
704 [Documentation] Update partition file with different content.
705 [Arguments] ${file_name} ${reboot_flag}=False
706
707 # Description of argument(s):
708 # file_name Partition file name.
709 # reboot_flag Reboot flag.
710
711 @{Partition_file_list} = Split String ${file_name} ,
712 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
713
714 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
715 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
716 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
717
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600718 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
719
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500720 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600721 ... Run Keywords Redfish BMC Reset Operation AND
722 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
Sushil Singh177b4592022-09-20 08:25:25 -0500723 ... Wait Until Keyword Succeeds 3 min 10 sec Redfish BMC Match States match_state=Enabled AND
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600724 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500725 ... Initialize OpenBMC
726
727 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500728 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500729 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
730 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
731
732 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
733 Delete Local Partition File ${Partition_file_list}
734
735
736Create File Names
737 [Documentation] Create partition file names.
738 [Arguments] ${range}
739
740 # Description of argument(s):
741 # range Range in numbers.
742
743 @{file_name_list}= Create List
744 Set Test Variable ${file_name} rangefile
745 FOR ${count} IN RANGE ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500746 Append To List ${file_name_list} 1KB-file${count}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500747 END
748 [Return] ${file_name_list}
749
750
751Redfish Upload Partition File With Range
752 [Documentation] Upload the partition file with the range of files.
753 [Arguments] ${range}
754
755 # Description of argument(s):
756 # range Range in numbers.
757
758 ${Partition_file_list}= Create File Names ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500759 Delete Local Partition File ${Partition_file_list}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500760 Create Partition File ${Partition_file_list}
761 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
762 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
763 Delete All BMC Partition File ${HTTP_OK}
764 Delete Local Partition File ${Partition_file_list}
765
766
767Redfish Delete Non Existence Partition File
768 [Documentation] Delete the partition file if do not exists.
769 [Arguments] ${file_name}
770
771 # Description of argument(s):
772 # file_name Partition file name.
773
774 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh251a0bc2021-08-24 01:12:14 -0500775 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500776
777
778Non Admin User To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600779 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500780 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
781
782 # Description of argument(s):
783 # file_name Partition file name.
784 # username Username.
785 # password Password.
786 # role Role of user.
787 # enabled Value can be True or False.
788
789 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600790 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500791 Initialize OpenBMC rest_username=${username} rest_password=${password}
792 @{Partition_file_list} = Split String ${file_name} ,
793 Create Partition File ${Partition_file_list}
794 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
795 Delete Local Partition File ${Partition_file_list}
796 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
797
798
799Non Admin Delete Non Existence Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600800 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500801 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
802
803 # Description of argument(s):
804 # file_name Partition file name.
805 # username Username.
806 # password Password.
807 # role Role of user.
808 # enabled Value can be True or False.
809
810 Redfish Create User ${username} ${password} ${role} ${enabled}
811 Delete All Sessions
812 Initialize OpenBMC rest_username=${username} rest_password=${password}
813 @{Partition_file_list} = Split String ${file_name} ,
814 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
815
816
817Verify Update Wrong Partition File To BMC
818 [Documentation] Upload the wrong partition file to BMC.
819 [Arguments] ${file_name}
820
821 # Description of argument(s):
822 # file_name Partition file name.
823
824 Redfish.Login
825 ${resp}= Run Keyword And Return Status
826 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
827 Should Be Equal As Strings ${resp} False
Sushil Singh9942df52021-09-03 02:28:11 -0500828
829
830Check Redfish Upload Partition File Name With Character Limit To BMC
831 [Documentation] Upload the partition file to BMC with file name character limit.
832 [Arguments] ${file_name} ${status_code} ${message}
833
834 # Description of argument(s):
835 # file_name Partition file name.
836 # status_code HTTPS status code.
837 # message Expected message of from upload partition file URI.
838
839 @{Partition_file_list} = Split String ${file_name} ,
840 ${num_records}= Get Length ${Partition_file_list}
841 Create Partition File ${Partition_file_list}
842
843 ${file_name_length}= Get Length ${Partition_file_list}[0]
844
845 Run Keyword If ${file_name_length} == 20
846 ... Run Keywords
847 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message} AND
848 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1 AND
849 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
850 ... ELSE
851 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
852
853 Delete Local Partition File ${Partition_file_list}
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500854
855
856Check Redfish Fail To Upload Partition File Name With Special Character To BMC
857 [Documentation] Upload the partition file to BMC with special character file name.
858 [Arguments] ${file_name} ${status_code} ${message}
859
860 # Description of argument(s):
861 # file_name Partition file name.
862 # status_code HTTPS status code.
863 # message Expected message from upload partition file URI.
864
865 @{Partition_file_list} = Split String ${file_name} ,
866 ${num_records}= Get Length ${Partition_file_list}
867
868 Create Partition File ${Partition_file_list}
869
870 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
871
872 ${status}= Run Keyword And Return Status
873 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1
874 Should Be Equal As Strings ${status} False
875
876 Delete Local Partition File ${Partition_file_list}
Sushil Singh44b8cf32021-11-17 06:57:09 -0600877
878
879Redfish Upload Partition File From Path
880 [Documentation] Upload the partition file to BMC from file path.
881 [Arguments] ${PARTITION_FILE_PATH}
882
883 # Description of argument(s):
884 # PARTITION_FILE_PATH Partition file path.
885
886 ${file_list} = OperatingSystem.List Files In Directory ${PARTITION_FILE_PATH}
887
888 ${num_records}= Get Length ${file_list}
889 Should Not Be Equal As Integers ${num_records} 0
890
891 FOR ${file_name} IN @{file_list}
892 @{Partition_file_list} = Split String ${file_name} ,
893 ${num_records}= Get Length ${Partition_file_list}
George Keishing538f1742022-03-14 05:00:55 -0500894 Upload Partition File To BMC file_name=${Partition_file_list}
895 ... status_code=${HTTP_OK} expected_message=${FILE_UPLOAD_MESSAGE} path=${PARTITION_FILE_PATH}
Sushil Singh44b8cf32021-11-17 06:57:09 -0600896 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
897 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
898 END
899