blob: 8a90aff44fcc5928c82bbdd885a37334d856c0b3 [file] [log] [blame]
Vijayfcdadc52020-01-21 01:48:19 -06001*** Settings ***
2
Sushil Singhcbbce6a2020-09-07 00:57:37 -05003Documentation Test Save Area feature of Management Console on BMC.
Vijayfcdadc52020-01-21 01:48:19 -06004
5Resource ../../lib/rest_client.robot
6Resource ../../lib/openbmc_ffdc.robot
7Resource ../../lib/resource.robot
Vijay09839e22020-02-05 02:54:44 -06008Resource ../../lib/bmc_redfish_utils.robot
Vijayfcdadc52020-01-21 01:48:19 -06009Resource ../../lib/utils.robot
Sushil Singhcbbce6a2020-09-07 00:57:37 -050010Resource ../../lib/bmc_redfish_resource.robot
Vijayfcdadc52020-01-21 01:48:19 -060011
Vijay39373152020-02-14 08:08:20 -060012Suite Setup Suite Setup Execution
13Test Teardown Test Teardown Execution
14Suite Teardown Suite Teardown Execution
Vijayfcdadc52020-01-21 01:48:19 -060015
Vijayfcdadc52020-01-21 01:48:19 -060016*** Variables ***
17
Sushil Singh1544c5e2021-11-03 07:56:37 -050018${MAXIMUM_FILE_SIZE_MESSAGE} File size exceeds maximum allowed size[10MB]
19${MAXIMUM_DIR_SIZE_MESSAGE}
20... File size does not fit in the savearea directory maximum allowed size[10MB]
Sushil Singh251a0bc2021-08-24 01:12:14 -050021${FILE_UPLOAD_MESSAGE} File Created
22${FILE_DELETED_MESSAGE} File Deleted
23${FILE_UPDATED_MESSAGE} File Updated
24${FORBIDDEN_MESSAGE} Forbidden
25${ERROR_MESSAGE} Error while creating the file
26${RESOURCE_NOT_FOUND_MESSAGE} Resource Not Found
27${MINIMUM_FILE_SIZE_MESSAGE} File size is less than minimum allowed size[100B]
28${MAXIMUM_FILE_NAME_MESSAGE} Filename must be maximum 20 characters
29${UNSUPPORTED_FILE_NAME_MESSAGE} Unsupported character in filename
Vijayfcdadc52020-01-21 01:48:19 -060030
Sushil Singh251a0bc2021-08-24 01:12:14 -050031${content-1} Sample Content to test partition file upload
Sushil Singh85c381c2021-08-17 23:25:10 -050032... Sample Content to test partition file upload
33... Sample Content to test partition file upload
Sushil Singh251a0bc2021-08-24 01:12:14 -050034${content-2} Sample Content to test partition file upload after reboot
Sushil Singh85c381c2021-08-17 23:25:10 -050035... Sample Content to test partition file upload after reboot
36... Sample Content to test partition file upload after reboot
37
Vijayfcdadc52020-01-21 01:48:19 -060038*** Test Cases ***
39
Sushil Singh251a0bc2021-08-24 01:12:14 -050040Redfish Upload Lower Limit Partition File To BMC
41 [Documentation] Upload lower limit of allowed partition file to BMC using Redfish.
42 [Tags] Redfish_Upload_Lower_Limit_Partition_File_To_BMC
43 [Template] Redfish Upload Partition File
44
Sushil Singh255ec632021-08-26 08:08:21 -050045 # file_name
46 100-file
Sushil Singh251a0bc2021-08-24 01:12:14 -050047
48
Sushil Singhcbbce6a2020-09-07 00:57:37 -050049Redfish Upload Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050050 [Documentation] Upload partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050051 [Tags] Redfish_Upload_Partition_File_To_BMC
52 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060053
Sushil Singhcbbce6a2020-09-07 00:57:37 -050054 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050055 500KB-file
Sushil Singh1544c5e2021-11-03 07:56:37 -050056 501KB-file
57 550KB-file
58 10000KB-file
Vijayfcdadc52020-01-21 01:48:19 -060059
60
Sushil Singh255ec632021-08-26 08:08:21 -050061Test Upload Lower Limit Partition File To BMC And Expect Failure
62 [Documentation] Fail to upload partition file to BMC with file size
63 ... below the lower limit of allowed partition file size using Redfish.
64 [Tags] Test_Upload_Lower_Limit_Partition_File_To_BMC_And_Expect_Failure
65 [Template] Redfish Fail To Upload Partition File
66
Sushil Singh1544c5e2021-11-03 07:56:37 -050067 # file_name status_code partition_status response_message
68 99-file ${HTTP_BAD_REQUEST} 0 ${MINIMUM_FILE_SIZE_MESSAGE}
Sushil Singh255ec632021-08-26 08:08:21 -050069
70
Sushil Singhcbbce6a2020-09-07 00:57:37 -050071Redfish Fail To Upload Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050072 [Documentation] Fail to upload partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050073 [Tags] Redfish_Fail_To_Upload_Partition_File_To_BMC
74 [Template] Redfish Fail To Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060075
Sushil Singh1544c5e2021-11-03 07:56:37 -050076 # file_name status_code partition_status response_message
77 10001KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_FILE_SIZE_MESSAGE}
Vijayfcdadc52020-01-21 01:48:19 -060078
79
Sushil Singhcbbce6a2020-09-07 00:57:37 -050080Redfish Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050081 [Documentation] Upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050082 [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC
83 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060084
Sushil Singhcbbce6a2020-09-07 00:57:37 -050085 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050086 250KB-file,500KB-file
Vijayfcdadc52020-01-21 01:48:19 -060087
88
Sushil Singhcbbce6a2020-09-07 00:57:37 -050089Redfish Fail To Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050090 [Documentation] Fail to upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050091 [Tags] Redfish_Fail_To_Upload_Multiple_Partition_File_To_BMC
92 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -060093
Sushil Singh1544c5e2021-11-03 07:56:37 -050094 # file_name status_code partition_status response_message
95 5000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
96 6000KB-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
97 10000KB-file ${HTTP_OK} 1 ${FILE_UPLOAD_MESSAGE}
98 100-file ${HTTP_BAD_REQUEST} 0 ${MAXIMUM_DIR_SIZE_MESSAGE}
Vijay09839e22020-02-05 02:54:44 -060099
100
Sushil Singhdf6ba522020-11-24 04:17:00 -0600101Redfish Upload Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500102 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhdf6ba522020-11-24 04:17:00 -0600103 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
104 [Template] Redfish Upload Partition File In Loop
105
106 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500107 500KB-file
Sushil Singhdf6ba522020-11-24 04:17:00 -0600108
109
Sushil Singhf39629c2020-12-11 07:30:21 -0600110Redfish Upload And Delete Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500111 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhf39629c2020-12-11 07:30:21 -0600112 [Tags] Redfish_Upload_And_Delete_Same_Partition_File_To_BMC_In_Loop
113 [Template] Redfish Upload And Delete Partition File In Loop
114
115 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500116 500KB-file
Sushil Singhf39629c2020-12-11 07:30:21 -0600117
118
Sushil Singh5d0782f2020-11-23 06:35:35 -0600119Redfish Partition File Upload Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500120 [Documentation] Upload partition file to BMC using Redfish, after the BMC reboot.
Sushil Singh5d0782f2020-11-23 06:35:35 -0600121 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
122 [Template] Verify Partition File Upload Post BMC Reboot
123
124 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500125 500KB-file
Sushil Singh5d0782f2020-11-23 06:35:35 -0600126
127
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500128Redfish Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500129 [Documentation] Upload partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500130 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
131 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600132
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500133 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500134 500KB-file
Vijay09839e22020-02-05 02:54:44 -0600135
136
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500137Redfish Multiple Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500138 [Documentation] Upload multiple partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500139 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
140 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600141
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500142 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500143 250KB-file,500KB-file
Vijay09839e22020-02-05 02:54:44 -0600144
145
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500146Redfish Read Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500147 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500148 [Tags] Redfish_Read_Partition_File_On_BMC
149 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600150
Sushil Singh85c381c2021-08-17 23:25:10 -0500151 # file_name reboot_flag
152 testfile01-file False
153 testfile01-file,testfile02-file False
Vijay09839e22020-02-05 02:54:44 -0600154
Vijay09839e22020-02-05 02:54:44 -0600155
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500156Redfish Read Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500157 [Documentation] Upload partition file to BMC using Redfish and verify the content after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500158 [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot
159 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600160
Sushil Singh85c381c2021-08-17 23:25:10 -0500161 # file_name reboot_flag
162 testfile01-file True
163 testfile01-file,testfile02-file True
Vijay09839e22020-02-05 02:54:44 -0600164
Vijay09839e22020-02-05 02:54:44 -0600165
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500166Redfish Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500167 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500168 [Tags] Redfish_Update_Partition_File_On_BMC
169 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600170
Sushil Singh85c381c2021-08-17 23:25:10 -0500171 # file_name reboot_flag
172 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500173
174
175Redfish Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500176 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500177 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
178 [Template] Redfish Update Partition File With Different Content
179
Sushil Singh85c381c2021-08-17 23:25:10 -0500180 # file_name reboot_flag
181 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500182
183
184Redfish Persistency Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500185 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500186 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
187 [Template] Redfish Update Partition File With Same Content
188
Sushil Singh85c381c2021-08-17 23:25:10 -0500189 # file_name reboot_flag
190 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500191
192
193Redfish Persistency Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500194 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500195 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC_Reboot
196 [Template] Redfish Update Partition File With Same Content
197
Sushil Singh85c381c2021-08-17 23:25:10 -0500198 # file_name reboot_flag
199 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500200
201
202Redfish Delete Non Existence Of Partition File
203 [Documentation] Delete the partition file if do not exists.
204 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
205 [Template] Redfish Delete Non Existence Partition File
206
207 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500208 testfile01-file
Vijay09839e22020-02-05 02:54:44 -0600209
210
211Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500212 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600213 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500214 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600215
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500216 # range
217 1000
Vijay09839e22020-02-05 02:54:44 -0600218
Vijay09839e22020-02-05 02:54:44 -0600219
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500220Non Admin Users Fail To Upload Partition File
221 [Documentation] Non admin user will fail to upload the partition file.
222 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
223 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600224
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500225 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500226 500KB-file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600227
228
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500229Non Admin User Delete Non Existence Of Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600230 [Documentation] Delete the partition file if does not exists.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500231 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
232 [Template] Non Admin Delete Non Existence Partition File
233
234 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500235 500KB-file operator_user TestPwd123 Operator
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500236
237
238Redfish Update Wrong Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500239 [Documentation] Upload partition file to BMC by wrong URI using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500240 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
241 [Template] Verify Update Wrong Partition File To BMC
242
243 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500244 500KB-file
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500245
Sushil Singh9942df52021-09-03 02:28:11 -0500246
247Test Redfish Upload Partition File Name With Character Limit To BMC
248 [Documentation] Upload partition file to BMC with file name character allowed limit
249 ... and above allowed limit using Redfish.
250 [Tags] Test_Redfish_Upload_Partition_File_Name_With_Character_Limit_To_BMC
251 [Template] Check Redfish Upload Partition File Name With Character Limit To BMC
252
253 # file_name status_code message
254 50KB-testfilesavfile ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
255 50KB-testsaveareafile ${HTTP_BAD_REQUEST} ${MAXIMUM_FILE_NAME_MESSAGE}
256
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500257
258Test Redfish Fail To Upload Partition File Name With Special Character To BMC
259 [Documentation] Upload partition file to BMC with special character file name and
260 ... Redfish through an error.
261 [Tags] Test_Redfish_Fail_To_Upload_Partition_File_Name_With_Special_Character_To_BMC
262 [Template] Check Redfish Fail To Upload Partition File Name With Special Character To BMC
263
264 # file_name status_code message
265 1KB-*filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
266 1KB-!filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
267 1KB-@filename ${HTTP_BAD_REQUEST} ${UNSUPPORTED_FILE_NAME_MESSAGE}
268
Vijayfcdadc52020-01-21 01:48:19 -0600269*** Keywords ***
270
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500271Suite Setup Execution
272 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600273
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500274 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600275
276
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500277Test Teardown Execution
278 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600279
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500280 Delete All BMC Partition File ${HTTP_OK}
281 FFDC On Test Case Fail
282
283
284Suite Teardown Execution
285 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600286
287 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600288
289
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500290Delete Local Partition File
291 [Documentation] Delete local partition file.
292 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600293
294 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500295 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600296
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500297 FOR ${conf_file} IN @{file_name}
298 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
299 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
300 END
Vijayfcdadc52020-01-21 01:48:19 -0600301
Vijayfcdadc52020-01-21 01:48:19 -0600302
Sushil Singh1544c5e2021-11-03 07:56:37 -0500303Delete Local Server Partition File
304 [Documentation] Local partition files which is getting uploaded to BMC,
305 ... will get deleted after the uploads. If partition file name consist
306 ... of “-file then partition file gets deleted.
307
308 @{conf_file_list} = OperatingSystem.List Files In Directory ${EXECDIR}
309 ${match_conf_file_list}= Get Matches ${conf_file_list} regexp=.*-file case_insensitive=${True}
310
311 ${num_records}= Get Length ${match_conf_file_list}
312 Return From Keyword If ${num_records} == ${0} ${EMPTY}
313
314 FOR ${conf_file} IN @{match_conf_file_list}
315 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
316 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
317 END
318
319
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500320Create Partition File
321 [Documentation] Create Partition file.
322 [Arguments] ${file_name}
323
324 # Description of argument(s):
325 # file_name Partition file name.
326
327 Delete Local Partition File ${file_name}
328
329 FOR ${conf_file} IN @{file_name}
Sushil Singh85c381c2021-08-17 23:25:10 -0500330 @{words}= Split String ${conf_file} -
Sushil Singh255ec632021-08-26 08:08:21 -0500331 Run dd if=/dev/zero of=${conf_file} bs=${words}[-0] count=1
Sushil Singh251a0bc2021-08-24 01:12:14 -0500332 OperatingSystem.File Should Exist ${conf_file}
333 END
334
335
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500336Delete BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500337 [Documentation] Delete single partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500338 [Arguments] ${file_name} ${status_code} ${expected_message}
339
340 # Description of argument(s):
341 # file_name Partition file name.
342 # status_code HTTPS status code.
343 # expected_message Expected message of URI.
344
345 FOR ${conf_file} IN @{file_name}
346 ${data}= Create Dictionary
347 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
348 Set To Dictionary ${data} headers ${headers}
349
350 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
351 Should Be Equal As Strings ${resp.status_code} ${status_code}
352
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500353 ${description}= Return Description Of Response ${resp.text}
354 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500355 END
356
357
358Delete All BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500359 [Documentation] Delete multiple partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500360 [Arguments] ${status_code}
361
362 # Description of argument(s):
363 # status_code HTTPS status code.
364
365 Initialize OpenBMC
366 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600367 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600368 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600369
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500370 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
371 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600372
373
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500374Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600375 [Documentation] Return description of REST response.
376 [Arguments] ${resp_text}
377
378 # Description of argument(s):
379 # resp_text REST response body.
380
381 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500382 # {
383 # "Description": "File Created"
384 # }
Vijay09839e22020-02-05 02:54:44 -0600385
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500386 ${status}= Run Keyword And Return Status Evaluate isinstance(${resp_text}, dict)
387 Return From Keyword If '${status}' == 'False' ${resp_text}
Vijay09839e22020-02-05 02:54:44 -0600388 ${message}= Evaluate json.loads('''${resp_text}''') json
389
390 [Return] ${message["Description"]}
391
392
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500393Upload Partition File To BMC
394 [Documentation] Upload partition file to BMC.
395 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True}
Vijay09839e22020-02-05 02:54:44 -0600396
397 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500398 # file_name Partition file name.
399 # status_code HTTPS status code.
400 # expected_message Expected message of URI.
401 # flag If True run part of program, else skip.
Vijay09839e22020-02-05 02:54:44 -0600402
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500403 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
404 FOR ${conf_file} IN @{file_name}
405 # Get the content of the file and upload to BMC.
406 ${image_data}= OperatingSystem.Get Binary File ${conf_file}
Sushil Singh85c381c2021-08-17 23:25:10 -0500407 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
Vijay09839e22020-02-05 02:54:44 -0600408
Sushil Singh85c381c2021-08-17 23:25:10 -0500409 ${kwargs}= Create Dictionary data=${image_data}
410 Set To Dictionary ${kwargs} headers ${headers}
411 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{kwargs} timeout=10
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500412 Should Be Equal As Strings ${resp.status_code} ${status_code}
413
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500414 ${description}= Return Description Of Response ${resp.text}
415 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500416 END
Vijayfcdadc52020-01-21 01:48:19 -0600417
418
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500419Verify Partition File On BMC
420 [Documentation] Verify partition file on BMC.
421 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600422
423 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500424 # file_name Partition file name.
425 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600426
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500427 FOR ${conf_file} IN @{file_name}
428 ${status} ${stderr} ${rc}= BMC Execute Command
Sushil Singhe5f39ee2021-01-06 00:39:12 -0600429 ... ls -l /var/lib/bmcweb/ibm-management-console/configfiles/${conf_file} | wc -l
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500430 Valid Value ${status} [${Partition_status}]
431 END
Vijayfcdadc52020-01-21 01:48:19 -0600432
433
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500434Redfish Upload Partition File
435 [Documentation] Upload the partition file.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500436 [Arguments] ${file_name} ${file_size}=${EMPTY}
Vijayfcdadc52020-01-21 01:48:19 -0600437
438 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500439 # file_name Partition file name.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500440 # file_size By Default is set to EMPTY,
441 # if user pass small_file_size the create file with small
442 # size keyword gets executed.
Vijayfcdadc52020-01-21 01:48:19 -0600443
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500444 @{Partition_file_list} = Split String ${file_name} ,
445 ${num_records}= Get Length ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500446
Sushil Singh255ec632021-08-26 08:08:21 -0500447 Create Partition File ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500448
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500449 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
450 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
451 Run Keyword If ${num_records} == ${1}
452 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
453 ... ELSE
454 ... Delete All BMC Partition File ${HTTP_OK}
455 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600456
457
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500458Redfish Fail To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600459 [Documentation] Fail to upload the partition file.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500460 [Arguments] ${file_name} ${status_code} ${partition_status} ${response_message}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600461
462 # Description of argument(s):
Sushil Singh255ec632021-08-26 08:08:21 -0500463 # file_name Partition file name.
Sushil Singh1544c5e2021-11-03 07:56:37 -0500464 # status_code HTTPS status code.
465 # partition_status Partition status.
Sushil Singh255ec632021-08-26 08:08:21 -0500466 # response_message By default is set to EMPTY,
Sushil Singh1544c5e2021-11-03 07:56:37 -0500467 # else user provide the information when user upload the partition with file size
Sushil Singh255ec632021-08-26 08:08:21 -0500468 # below lower linit of allowed partition or more than of large allowed partition.
Vijay09839e22020-02-05 02:54:44 -0600469
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500470 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh255ec632021-08-26 08:08:21 -0500471
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500472 Create Partition File ${Partition_file_list}
Sushil Singh1544c5e2021-11-03 07:56:37 -0500473 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${response_message}
474 Verify Partition File On BMC ${Partition_file_list} Partition_status=${partition_status}
Sushil Singh255ec632021-08-26 08:08:21 -0500475
Sushil Singh1544c5e2021-11-03 07:56:37 -0500476 Run Keyword If ${partition_status} == 0
477 ... Run Keywords
478 ... Delete BMC Partition File
479 ... ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE} AND
480 ... Delete All BMC Partition File ${HTTP_OK} AND
481 ... Delete Local Server Partition File
482
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500483 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600484
485
Sushil Singhdf6ba522020-11-24 04:17:00 -0600486Redfish Upload Partition File In Loop
487 [Documentation] Upload the same partition file multiple times in loop to BMC.
488 [Arguments] ${file_name}
489
490 # Description of argument(s):
491 # file_name Partition file name.
492
493 @{Partition_file_list} = Split String ${file_name} ,
494 Create Partition File ${Partition_file_list}
495
496 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
497 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
498
499 FOR ${count} IN RANGE 1 11
Sushil Singh251a0bc2021-08-24 01:12:14 -0500500 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhdf6ba522020-11-24 04:17:00 -0600501 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
502 END
503
504 Initialize OpenBMC
505 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
506 Delete Local Partition File ${Partition_file_list}
507
508
Sushil Singhf39629c2020-12-11 07:30:21 -0600509Redfish Upload And Delete Partition File In Loop
510 [Documentation] Upload the same partition file multiple times in loop to BMC.
511 [Arguments] ${file_name}
512
513 # Description of argument(s):
514 # file_name Partition file name.
515
516 FOR ${count} IN RANGE 1 11
517 Redfish Upload Partition File ${file_name}
518 END
519
520
Sushil Singh5d0782f2020-11-23 06:35:35 -0600521Verify Partition File Upload Post BMC Reboot
522 [Documentation] Upload the partition file, after BMC reboot.
523 [Arguments] ${file_name}
524
525 # Description of argument(s):
526 # file_name Partition file name.
527
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600528 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
529 Redfish BMC Reset Operation
530 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
531
532 Is BMC Standby
Sushil Singh5d0782f2020-11-23 06:35:35 -0600533
534 Redfish Upload Partition File ${file_name}
535
536
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500537Redfish Partition File Persistency
538 [Documentation] Upload the partition file and check for persistency after reboot.
539 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600540
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500541 # Description of argument(s):
542 # file_name Partition file name.
543
544 @{Partition_file_list} = Split String ${file_name} ,
545 ${num_records}= Get Length ${Partition_file_list}
546 Create Partition File ${Partition_file_list}
547 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
548 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600549
550 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
551 Redfish BMC Reset Operation
552 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
553
554 Is BMC Standby
555
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500556 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600557 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500558 Run Keyword If ${num_records} == ${1}
559 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
560 ... ELSE
561 ... Delete All BMC Partition File ${HTTP_OK}
562 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600563
564
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500565Verify Redfish Partition File Content
566 [Documentation] Verify partition file content.
567 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600568
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500569 # Description of argument(s):
570 # file_name Partition file name.
571 # content_dict Dict contain the content.
572 # status_code HTTPS status code.
573
574 FOR ${conf_file} IN @{file_name}
575 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
576 Should Be Equal As Strings ${resp.status_code} ${status_code}
577
578 ${Partition_file_data}= Remove String ${resp.text} \\n
579 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
580 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
581 END
Vijayfcdadc52020-01-21 01:48:19 -0600582
Vijay39373152020-02-14 08:08:20 -0600583
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500584Add Content To Files
585 [Documentation] Add defined content in partition file.
586 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600587
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500588 # Description of argument(s):
589 # file_name Partition file name.
590 # index Index
591
592 ${num_records}= Get Length ${file_name}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500593 &{content_dict}= Create Dictionary
Sushil Singh85c381c2021-08-17 23:25:10 -0500594
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500595 FOR ${conf_file} IN @{file_name}
596 ${index}= Get Index From List ${file_name} ${conf_file}
597 ${index}= Evaluate ${index} + 1
598
599 Run echo "${content-${index}}" > ${conf_file}
600 OperatingSystem.File Should Exist ${conf_file}
601
602 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
603 END
604
605 [Return] &{content_dict}
606
607
608Redfish Read Partition File
609 [Documentation] Read partition file content.
610 [Arguments] ${file_name} ${reboot_flag}=False
611
612 # Description of argument(s):
613 # file_name Partition file name.
614 # reboot_flag Reboot flag.
615
616 @{Partition_file_list} = Split String ${file_name} ,
617 ${content_dict}= Add Content To Files ${Partition_file_list}
618
619 ${num_records}= Get Length ${Partition_file_list}
620
621 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
622 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
623 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
624
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600625 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
626
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500627 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600628 ... Run Keywords Redfish BMC Reset Operation AND
629 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
630 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500631 ... Initialize OpenBMC AND
632 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600633
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500634 Run Keyword If ${num_records} == ${1}
635 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
636 ... ELSE
637 ... Delete All BMC Partition File ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600638
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500639 Delete Local Partition File ${Partition_file_list}
640
641
642Redfish Update Partition File With Same Content
643 [Documentation] Update partition file with same content.
644 [Arguments] ${file_name} ${reboot_flag}=False
645
646 # Description of argument(s):
647 # file_name Partition file name.
648 # reboot_flag Reboot flag.
649
650 @{Partition_file_list} = Split String ${file_name} ,
651 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
652
653 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
654 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
655 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
656
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600657 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
658
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500659 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600660 ... Run Keywords Redfish BMC Reset Operation AND
661 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
662 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500663 ... Initialize OpenBMC
664
665 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500666 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500667 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
668 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
669
670 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
671 Delete Local Partition File ${Partition_file_list}
672
673
674Redfish Update Partition File With Different Content
675 [Documentation] Update partition file with different content.
676 [Arguments] ${file_name} ${reboot_flag}=False
677
678 # Description of argument(s):
679 # file_name Partition file name.
680 # reboot_flag Reboot flag.
681
682 @{Partition_file_list} = Split String ${file_name} ,
683 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
684
685 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
686 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
687 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
688
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600689 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
690
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500691 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600692 ... Run Keywords Redfish BMC Reset Operation AND
693 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
694 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500695 ... Initialize OpenBMC
696
697 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500698 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500699 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
700 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
701
702 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
703 Delete Local Partition File ${Partition_file_list}
704
705
706Create File Names
707 [Documentation] Create partition file names.
708 [Arguments] ${range}
709
710 # Description of argument(s):
711 # range Range in numbers.
712
713 @{file_name_list}= Create List
714 Set Test Variable ${file_name} rangefile
715 FOR ${count} IN RANGE ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500716 Append To List ${file_name_list} 1KB-file${count}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500717 END
718 [Return] ${file_name_list}
719
720
721Redfish Upload Partition File With Range
722 [Documentation] Upload the partition file with the range of files.
723 [Arguments] ${range}
724
725 # Description of argument(s):
726 # range Range in numbers.
727
728 ${Partition_file_list}= Create File Names ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500729 Delete Local Partition File ${Partition_file_list}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500730 Create Partition File ${Partition_file_list}
731 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
732 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
733 Delete All BMC Partition File ${HTTP_OK}
734 Delete Local Partition File ${Partition_file_list}
735
736
737Redfish Delete Non Existence Partition File
738 [Documentation] Delete the partition file if do not exists.
739 [Arguments] ${file_name}
740
741 # Description of argument(s):
742 # file_name Partition file name.
743
744 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh251a0bc2021-08-24 01:12:14 -0500745 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500746
747
748Non Admin User To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600749 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500750 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
751
752 # Description of argument(s):
753 # file_name Partition file name.
754 # username Username.
755 # password Password.
756 # role Role of user.
757 # enabled Value can be True or False.
758
759 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600760 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500761 Initialize OpenBMC rest_username=${username} rest_password=${password}
762 @{Partition_file_list} = Split String ${file_name} ,
763 Create Partition File ${Partition_file_list}
764 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
765 Delete Local Partition File ${Partition_file_list}
766 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
767
768
769Non Admin Delete Non Existence Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600770 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500771 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
772
773 # Description of argument(s):
774 # file_name Partition file name.
775 # username Username.
776 # password Password.
777 # role Role of user.
778 # enabled Value can be True or False.
779
780 Redfish Create User ${username} ${password} ${role} ${enabled}
781 Delete All Sessions
782 Initialize OpenBMC rest_username=${username} rest_password=${password}
783 @{Partition_file_list} = Split String ${file_name} ,
784 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
785
786
787Verify Update Wrong Partition File To BMC
788 [Documentation] Upload the wrong partition file to BMC.
789 [Arguments] ${file_name}
790
791 # Description of argument(s):
792 # file_name Partition file name.
793
794 Redfish.Login
795 ${resp}= Run Keyword And Return Status
796 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
797 Should Be Equal As Strings ${resp} False
Sushil Singh9942df52021-09-03 02:28:11 -0500798
799
800Check Redfish Upload Partition File Name With Character Limit To BMC
801 [Documentation] Upload the partition file to BMC with file name character limit.
802 [Arguments] ${file_name} ${status_code} ${message}
803
804 # Description of argument(s):
805 # file_name Partition file name.
806 # status_code HTTPS status code.
807 # message Expected message of from upload partition file URI.
808
809 @{Partition_file_list} = Split String ${file_name} ,
810 ${num_records}= Get Length ${Partition_file_list}
811 Create Partition File ${Partition_file_list}
812
813 ${file_name_length}= Get Length ${Partition_file_list}[0]
814
815 Run Keyword If ${file_name_length} == 20
816 ... Run Keywords
817 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message} AND
818 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1 AND
819 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
820 ... ELSE
821 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
822
823 Delete Local Partition File ${Partition_file_list}
Sushil Singh2dbcbde2021-09-09 08:50:48 -0500824
825
826Check Redfish Fail To Upload Partition File Name With Special Character To BMC
827 [Documentation] Upload the partition file to BMC with special character file name.
828 [Arguments] ${file_name} ${status_code} ${message}
829
830 # Description of argument(s):
831 # file_name Partition file name.
832 # status_code HTTPS status code.
833 # message Expected message from upload partition file URI.
834
835 @{Partition_file_list} = Split String ${file_name} ,
836 ${num_records}= Get Length ${Partition_file_list}
837
838 Create Partition File ${Partition_file_list}
839
840 Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
841
842 ${status}= Run Keyword And Return Status
843 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1
844 Should Be Equal As Strings ${status} False
845
846 Delete Local Partition File ${Partition_file_list}