blob: f5a884f715fb8317f113313ca739cb1e4d31300a [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 Singh255ec632021-08-26 08:08:21 -050018${MAXIMUM_FILE_SIZE_MESSAGE} File size exceeds maximum allowed size[500KB]
Sushil Singh251a0bc2021-08-24 01:12:14 -050019${FILE_UPLOAD_MESSAGE} File Created
20${FILE_DELETED_MESSAGE} File Deleted
21${FILE_UPDATED_MESSAGE} File Updated
22${FORBIDDEN_MESSAGE} Forbidden
23${ERROR_MESSAGE} Error while creating the file
24${RESOURCE_NOT_FOUND_MESSAGE} Resource Not Found
25${MINIMUM_FILE_SIZE_MESSAGE} File size is less than minimum allowed size[100B]
26${MAXIMUM_FILE_NAME_MESSAGE} Filename must be maximum 20 characters
27${UNSUPPORTED_FILE_NAME_MESSAGE} Unsupported character in filename
Vijayfcdadc52020-01-21 01:48:19 -060028
Sushil Singh251a0bc2021-08-24 01:12:14 -050029${content-1} Sample Content to test partition file upload
Sushil Singh85c381c2021-08-17 23:25:10 -050030... Sample Content to test partition file upload
31... Sample Content to test partition file upload
Sushil Singh251a0bc2021-08-24 01:12:14 -050032${content-2} Sample Content to test partition file upload after reboot
Sushil Singh85c381c2021-08-17 23:25:10 -050033... Sample Content to test partition file upload after reboot
34... Sample Content to test partition file upload after reboot
35
Vijayfcdadc52020-01-21 01:48:19 -060036*** Test Cases ***
37
Sushil Singh251a0bc2021-08-24 01:12:14 -050038Redfish Upload Lower Limit Partition File To BMC
39 [Documentation] Upload lower limit of allowed partition file to BMC using Redfish.
40 [Tags] Redfish_Upload_Lower_Limit_Partition_File_To_BMC
41 [Template] Redfish Upload Partition File
42
Sushil Singh255ec632021-08-26 08:08:21 -050043 # file_name
44 100-file
Sushil Singh251a0bc2021-08-24 01:12:14 -050045
46
Sushil Singhcbbce6a2020-09-07 00:57:37 -050047Redfish Upload Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050048 [Documentation] Upload partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050049 [Tags] Redfish_Upload_Partition_File_To_BMC
50 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060051
Sushil Singhcbbce6a2020-09-07 00:57:37 -050052 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050053 500KB-file
Vijayfcdadc52020-01-21 01:48:19 -060054
55
Sushil Singh255ec632021-08-26 08:08:21 -050056Test Upload Lower Limit Partition File To BMC And Expect Failure
57 [Documentation] Fail to upload partition file to BMC with file size
58 ... below the lower limit of allowed partition file size using Redfish.
59 [Tags] Test_Upload_Lower_Limit_Partition_File_To_BMC_And_Expect_Failure
60 [Template] Redfish Fail To Upload Partition File
61
62 # file_name response_message
63 99-file ${MINIMUM_FILE_SIZE_MESSAGE}
64
65
Sushil Singhcbbce6a2020-09-07 00:57:37 -050066Redfish Fail To Upload Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050067 [Documentation] Fail to upload partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050068 [Tags] Redfish_Fail_To_Upload_Partition_File_To_BMC
69 [Template] Redfish Fail To Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060070
Sushil Singh255ec632021-08-26 08:08:21 -050071 # file_name response_message
72 501KB-file ${MAXIMUM_FILE_SIZE_MESSAGE}
Vijayfcdadc52020-01-21 01:48:19 -060073
74
Sushil Singhcbbce6a2020-09-07 00:57:37 -050075Redfish Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050076 [Documentation] Upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050077 [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC
78 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060079
Sushil Singhcbbce6a2020-09-07 00:57:37 -050080 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050081 250KB-file,500KB-file
Vijayfcdadc52020-01-21 01:48:19 -060082
83
Sushil Singhcbbce6a2020-09-07 00:57:37 -050084Redfish Fail To Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050085 [Documentation] Fail to upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050086 [Tags] Redfish_Fail_To_Upload_Multiple_Partition_File_To_BMC
87 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -060088
Sushil Singh255ec632021-08-26 08:08:21 -050089 # file_name response_message
90 650KB-file,501KB-file ${MAXIMUM_FILE_SIZE_MESSAGE}
Vijay09839e22020-02-05 02:54:44 -060091
92
Sushil Singhdf6ba522020-11-24 04:17:00 -060093Redfish Upload Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -050094 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhdf6ba522020-11-24 04:17:00 -060095 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
96 [Template] Redfish Upload Partition File In Loop
97
98 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050099 500KB-file
Sushil Singhdf6ba522020-11-24 04:17:00 -0600100
101
Sushil Singhf39629c2020-12-11 07:30:21 -0600102Redfish Upload And Delete Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -0500103 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhf39629c2020-12-11 07:30:21 -0600104 [Tags] Redfish_Upload_And_Delete_Same_Partition_File_To_BMC_In_Loop
105 [Template] Redfish Upload And Delete Partition File In Loop
106
107 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500108 500KB-file
Sushil Singhf39629c2020-12-11 07:30:21 -0600109
110
Sushil Singh5d0782f2020-11-23 06:35:35 -0600111Redfish Partition File Upload Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500112 [Documentation] Upload partition file to BMC using Redfish, after the BMC reboot.
Sushil Singh5d0782f2020-11-23 06:35:35 -0600113 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
114 [Template] Verify Partition File Upload Post BMC Reboot
115
116 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500117 500KB-file
Sushil Singh5d0782f2020-11-23 06:35:35 -0600118
119
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500120Redfish Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500121 [Documentation] Upload partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500122 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
123 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600124
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500125 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500126 500KB-file
Vijay09839e22020-02-05 02:54:44 -0600127
128
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500129Redfish Multiple Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500130 [Documentation] Upload multiple partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500131 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
132 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600133
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500134 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500135 250KB-file,500KB-file
Vijay09839e22020-02-05 02:54:44 -0600136
137
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500138Redfish Read Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500139 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500140 [Tags] Redfish_Read_Partition_File_On_BMC
141 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600142
Sushil Singh85c381c2021-08-17 23:25:10 -0500143 # file_name reboot_flag
144 testfile01-file False
145 testfile01-file,testfile02-file False
Vijay09839e22020-02-05 02:54:44 -0600146
Vijay09839e22020-02-05 02:54:44 -0600147
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500148Redfish Read Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500149 [Documentation] Upload partition file to BMC using Redfish and verify the content after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500150 [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot
151 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600152
Sushil Singh85c381c2021-08-17 23:25:10 -0500153 # file_name reboot_flag
154 testfile01-file True
155 testfile01-file,testfile02-file True
Vijay09839e22020-02-05 02:54:44 -0600156
Vijay09839e22020-02-05 02:54:44 -0600157
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500158Redfish Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500159 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500160 [Tags] Redfish_Update_Partition_File_On_BMC
161 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600162
Sushil Singh85c381c2021-08-17 23:25:10 -0500163 # file_name reboot_flag
164 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500165
166
167Redfish Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500168 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500169 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
170 [Template] Redfish Update Partition File With Different Content
171
Sushil Singh85c381c2021-08-17 23:25:10 -0500172 # file_name reboot_flag
173 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500174
175
176Redfish Persistency Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500177 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500178 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
179 [Template] Redfish Update Partition File With Same Content
180
Sushil Singh85c381c2021-08-17 23:25:10 -0500181 # file_name reboot_flag
182 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500183
184
185Redfish Persistency Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500186 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500187 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC_Reboot
188 [Template] Redfish Update Partition File With Same Content
189
Sushil Singh85c381c2021-08-17 23:25:10 -0500190 # file_name reboot_flag
191 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500192
193
194Redfish Delete Non Existence Of Partition File
195 [Documentation] Delete the partition file if do not exists.
196 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
197 [Template] Redfish Delete Non Existence Partition File
198
199 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500200 testfile01-file
Vijay09839e22020-02-05 02:54:44 -0600201
202
203Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500204 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600205 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500206 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600207
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500208 # range
209 1000
Vijay09839e22020-02-05 02:54:44 -0600210
Vijay09839e22020-02-05 02:54:44 -0600211
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500212Non Admin Users Fail To Upload Partition File
213 [Documentation] Non admin user will fail to upload the partition file.
214 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
215 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600216
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500217 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500218 500KB-file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600219
220
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500221Non Admin User Delete Non Existence Of Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600222 [Documentation] Delete the partition file if does not exists.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500223 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
224 [Template] Non Admin Delete Non Existence Partition File
225
226 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500227 500KB-file operator_user TestPwd123 Operator
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500228
229
230Redfish Update Wrong Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500231 [Documentation] Upload partition file to BMC by wrong URI using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500232 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
233 [Template] Verify Update Wrong Partition File To BMC
234
235 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500236 500KB-file
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500237
Sushil Singh9942df52021-09-03 02:28:11 -0500238
239Test Redfish Upload Partition File Name With Character Limit To BMC
240 [Documentation] Upload partition file to BMC with file name character allowed limit
241 ... and above allowed limit using Redfish.
242 [Tags] Test_Redfish_Upload_Partition_File_Name_With_Character_Limit_To_BMC
243 [Template] Check Redfish Upload Partition File Name With Character Limit To BMC
244
245 # file_name status_code message
246 50KB-testfilesavfile ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
247 50KB-testsaveareafile ${HTTP_BAD_REQUEST} ${MAXIMUM_FILE_NAME_MESSAGE}
248
Vijayfcdadc52020-01-21 01:48:19 -0600249*** Keywords ***
250
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500251Suite Setup Execution
252 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600253
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500254 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600255
256
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500257Test Teardown Execution
258 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600259
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500260 Delete All BMC Partition File ${HTTP_OK}
261 FFDC On Test Case Fail
262
263
264Suite Teardown Execution
265 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600266
267 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600268
269
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500270Delete Local Partition File
271 [Documentation] Delete local partition file.
272 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600273
274 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500275 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600276
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500277 FOR ${conf_file} IN @{file_name}
278 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
279 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
280 END
Vijayfcdadc52020-01-21 01:48:19 -0600281
Vijayfcdadc52020-01-21 01:48:19 -0600282
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500283Create Partition File
284 [Documentation] Create Partition file.
285 [Arguments] ${file_name}
286
287 # Description of argument(s):
288 # file_name Partition file name.
289
290 Delete Local Partition File ${file_name}
291
292 FOR ${conf_file} IN @{file_name}
Sushil Singh85c381c2021-08-17 23:25:10 -0500293 @{words}= Split String ${conf_file} -
Sushil Singh255ec632021-08-26 08:08:21 -0500294 Run dd if=/dev/zero of=${conf_file} bs=${words}[-0] count=1
Sushil Singh251a0bc2021-08-24 01:12:14 -0500295 OperatingSystem.File Should Exist ${conf_file}
296 END
297
298
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500299Delete BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500300 [Documentation] Delete single partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500301 [Arguments] ${file_name} ${status_code} ${expected_message}
302
303 # Description of argument(s):
304 # file_name Partition file name.
305 # status_code HTTPS status code.
306 # expected_message Expected message of URI.
307
308 FOR ${conf_file} IN @{file_name}
309 ${data}= Create Dictionary
310 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
311 Set To Dictionary ${data} headers ${headers}
312
313 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
314 Should Be Equal As Strings ${resp.status_code} ${status_code}
315
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500316 ${description}= Return Description Of Response ${resp.text}
317 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500318 END
319
320
321Delete All BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500322 [Documentation] Delete multiple partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500323 [Arguments] ${status_code}
324
325 # Description of argument(s):
326 # status_code HTTPS status code.
327
328 Initialize OpenBMC
329 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600330 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600331 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600332
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500333 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
334 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600335
336
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500337Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600338 [Documentation] Return description of REST response.
339 [Arguments] ${resp_text}
340
341 # Description of argument(s):
342 # resp_text REST response body.
343
344 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500345 # {
346 # "Description": "File Created"
347 # }
Vijay09839e22020-02-05 02:54:44 -0600348
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500349 ${status}= Run Keyword And Return Status Evaluate isinstance(${resp_text}, dict)
350 Return From Keyword If '${status}' == 'False' ${resp_text}
Vijay09839e22020-02-05 02:54:44 -0600351 ${message}= Evaluate json.loads('''${resp_text}''') json
352
353 [Return] ${message["Description"]}
354
355
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500356Upload Partition File To BMC
357 [Documentation] Upload partition file to BMC.
358 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True}
Vijay09839e22020-02-05 02:54:44 -0600359
360 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500361 # file_name Partition file name.
362 # status_code HTTPS status code.
363 # expected_message Expected message of URI.
364 # flag If True run part of program, else skip.
Vijay09839e22020-02-05 02:54:44 -0600365
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500366 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
367 FOR ${conf_file} IN @{file_name}
368 # Get the content of the file and upload to BMC.
369 ${image_data}= OperatingSystem.Get Binary File ${conf_file}
Sushil Singh85c381c2021-08-17 23:25:10 -0500370 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
Vijay09839e22020-02-05 02:54:44 -0600371
Sushil Singh85c381c2021-08-17 23:25:10 -0500372 ${kwargs}= Create Dictionary data=${image_data}
373 Set To Dictionary ${kwargs} headers ${headers}
374 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{kwargs} timeout=10
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500375 Should Be Equal As Strings ${resp.status_code} ${status_code}
376
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500377 ${description}= Return Description Of Response ${resp.text}
378 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500379 END
Vijayfcdadc52020-01-21 01:48:19 -0600380
381
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500382Verify Partition File On BMC
383 [Documentation] Verify partition file on BMC.
384 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600385
386 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500387 # file_name Partition file name.
388 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600389
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500390 FOR ${conf_file} IN @{file_name}
391 ${status} ${stderr} ${rc}= BMC Execute Command
Sushil Singhe5f39ee2021-01-06 00:39:12 -0600392 ... ls -l /var/lib/bmcweb/ibm-management-console/configfiles/${conf_file} | wc -l
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500393 Valid Value ${status} [${Partition_status}]
394 END
Vijayfcdadc52020-01-21 01:48:19 -0600395
396
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500397Redfish Upload Partition File
398 [Documentation] Upload the partition file.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500399 [Arguments] ${file_name} ${file_size}=${EMPTY}
Vijayfcdadc52020-01-21 01:48:19 -0600400
401 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500402 # file_name Partition file name.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500403 # file_size By Default is set to EMPTY,
404 # if user pass small_file_size the create file with small
405 # size keyword gets executed.
Vijayfcdadc52020-01-21 01:48:19 -0600406
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500407 @{Partition_file_list} = Split String ${file_name} ,
408 ${num_records}= Get Length ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500409
Sushil Singh255ec632021-08-26 08:08:21 -0500410 Create Partition File ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500411
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500412 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
413 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
414 Run Keyword If ${num_records} == ${1}
415 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
416 ... ELSE
417 ... Delete All BMC Partition File ${HTTP_OK}
418 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600419
420
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500421Redfish Fail To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600422 [Documentation] Fail to upload the partition file.
Sushil Singh255ec632021-08-26 08:08:21 -0500423 [Arguments] ${file_name} ${response_message}=${EMPTY}
Vijay09839e22020-02-05 02:54:44 -0600424
425 # Description of argument(s):
Sushil Singh255ec632021-08-26 08:08:21 -0500426 # file_name Partition file name.
427 # response_message By default is set to EMPTY,
428 # else user provide the information when user upload the partition with file size
429 # below lower linit of allowed partition or more than of large allowed partition.
Vijay09839e22020-02-05 02:54:44 -0600430
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500431 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh255ec632021-08-26 08:08:21 -0500432
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500433 Create Partition File ${Partition_file_list}
Sushil Singh255ec632021-08-26 08:08:21 -0500434 Upload Partition File To BMC ${Partition_file_list} ${HTTP_BAD_REQUEST} ${response_message}
435
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500436 Verify Partition File On BMC ${Partition_file_list} Partition_status=0
Sushil Singh251a0bc2021-08-24 01:12:14 -0500437 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500438 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600439
440
Sushil Singhdf6ba522020-11-24 04:17:00 -0600441Redfish Upload Partition File In Loop
442 [Documentation] Upload the same partition file multiple times in loop to BMC.
443 [Arguments] ${file_name}
444
445 # Description of argument(s):
446 # file_name Partition file name.
447
448 @{Partition_file_list} = Split String ${file_name} ,
449 Create Partition File ${Partition_file_list}
450
451 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
452 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
453
454 FOR ${count} IN RANGE 1 11
Sushil Singh251a0bc2021-08-24 01:12:14 -0500455 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhdf6ba522020-11-24 04:17:00 -0600456 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
457 END
458
459 Initialize OpenBMC
460 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
461 Delete Local Partition File ${Partition_file_list}
462
463
Sushil Singhf39629c2020-12-11 07:30:21 -0600464Redfish Upload And Delete Partition File In Loop
465 [Documentation] Upload the same partition file multiple times in loop to BMC.
466 [Arguments] ${file_name}
467
468 # Description of argument(s):
469 # file_name Partition file name.
470
471 FOR ${count} IN RANGE 1 11
472 Redfish Upload Partition File ${file_name}
473 END
474
475
Sushil Singh5d0782f2020-11-23 06:35:35 -0600476Verify Partition File Upload Post BMC Reboot
477 [Documentation] Upload the partition file, after BMC reboot.
478 [Arguments] ${file_name}
479
480 # Description of argument(s):
481 # file_name Partition file name.
482
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600483 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
484 Redfish BMC Reset Operation
485 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
486
487 Is BMC Standby
Sushil Singh5d0782f2020-11-23 06:35:35 -0600488
489 Redfish Upload Partition File ${file_name}
490
491
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500492Redfish Partition File Persistency
493 [Documentation] Upload the partition file and check for persistency after reboot.
494 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600495
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500496 # Description of argument(s):
497 # file_name Partition file name.
498
499 @{Partition_file_list} = Split String ${file_name} ,
500 ${num_records}= Get Length ${Partition_file_list}
501 Create Partition File ${Partition_file_list}
502 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
503 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600504
505 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
506 Redfish BMC Reset Operation
507 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
508
509 Is BMC Standby
510
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500511 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600512 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500513 Run Keyword If ${num_records} == ${1}
514 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
515 ... ELSE
516 ... Delete All BMC Partition File ${HTTP_OK}
517 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600518
519
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500520Verify Redfish Partition File Content
521 [Documentation] Verify partition file content.
522 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600523
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500524 # Description of argument(s):
525 # file_name Partition file name.
526 # content_dict Dict contain the content.
527 # status_code HTTPS status code.
528
529 FOR ${conf_file} IN @{file_name}
530 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
531 Should Be Equal As Strings ${resp.status_code} ${status_code}
532
533 ${Partition_file_data}= Remove String ${resp.text} \\n
534 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
535 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
536 END
Vijayfcdadc52020-01-21 01:48:19 -0600537
Vijay39373152020-02-14 08:08:20 -0600538
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500539Add Content To Files
540 [Documentation] Add defined content in partition file.
541 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600542
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500543 # Description of argument(s):
544 # file_name Partition file name.
545 # index Index
546
547 ${num_records}= Get Length ${file_name}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500548 &{content_dict}= Create Dictionary
Sushil Singh85c381c2021-08-17 23:25:10 -0500549
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500550 FOR ${conf_file} IN @{file_name}
551 ${index}= Get Index From List ${file_name} ${conf_file}
552 ${index}= Evaluate ${index} + 1
553
554 Run echo "${content-${index}}" > ${conf_file}
555 OperatingSystem.File Should Exist ${conf_file}
556
557 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
558 END
559
560 [Return] &{content_dict}
561
562
563Redfish Read Partition File
564 [Documentation] Read partition file content.
565 [Arguments] ${file_name} ${reboot_flag}=False
566
567 # Description of argument(s):
568 # file_name Partition file name.
569 # reboot_flag Reboot flag.
570
571 @{Partition_file_list} = Split String ${file_name} ,
572 ${content_dict}= Add Content To Files ${Partition_file_list}
573
574 ${num_records}= Get Length ${Partition_file_list}
575
576 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
577 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
578 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
579
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600580 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
581
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500582 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600583 ... Run Keywords Redfish BMC Reset Operation AND
584 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
585 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500586 ... Initialize OpenBMC AND
587 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600588
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500589 Run Keyword If ${num_records} == ${1}
590 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
591 ... ELSE
592 ... Delete All BMC Partition File ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600593
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500594 Delete Local Partition File ${Partition_file_list}
595
596
597Redfish Update Partition File With Same Content
598 [Documentation] Update partition file with same content.
599 [Arguments] ${file_name} ${reboot_flag}=False
600
601 # Description of argument(s):
602 # file_name Partition file name.
603 # reboot_flag Reboot flag.
604
605 @{Partition_file_list} = Split String ${file_name} ,
606 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
607
608 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
609 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
610 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
611
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600612 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
613
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500614 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600615 ... Run Keywords Redfish BMC Reset Operation AND
616 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
617 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500618 ... Initialize OpenBMC
619
620 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500621 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500622 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
625 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
626 Delete Local Partition File ${Partition_file_list}
627
628
629Redfish Update Partition File With Different Content
630 [Documentation] Update partition file with different content.
631 [Arguments] ${file_name} ${reboot_flag}=False
632
633 # Description of argument(s):
634 # file_name Partition file name.
635 # reboot_flag Reboot flag.
636
637 @{Partition_file_list} = Split String ${file_name} ,
638 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
639
640 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
641 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
642 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
643
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600644 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
645
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500646 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600647 ... Run Keywords Redfish BMC Reset Operation AND
648 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
649 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500650 ... Initialize OpenBMC
651
652 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500653 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500654 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
657 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
658 Delete Local Partition File ${Partition_file_list}
659
660
661Create File Names
662 [Documentation] Create partition file names.
663 [Arguments] ${range}
664
665 # Description of argument(s):
666 # range Range in numbers.
667
668 @{file_name_list}= Create List
669 Set Test Variable ${file_name} rangefile
670 FOR ${count} IN RANGE ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500671 Append To List ${file_name_list} 1KB-file${count}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500672 END
673 [Return] ${file_name_list}
674
675
676Redfish Upload Partition File With Range
677 [Documentation] Upload the partition file with the range of files.
678 [Arguments] ${range}
679
680 # Description of argument(s):
681 # range Range in numbers.
682
683 ${Partition_file_list}= Create File Names ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500684 Delete Local Partition File ${Partition_file_list}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500685 Create Partition File ${Partition_file_list}
686 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
687 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
688 Delete All BMC Partition File ${HTTP_OK}
689 Delete Local Partition File ${Partition_file_list}
690
691
692Redfish Delete Non Existence Partition File
693 [Documentation] Delete the partition file if do not exists.
694 [Arguments] ${file_name}
695
696 # Description of argument(s):
697 # file_name Partition file name.
698
699 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh251a0bc2021-08-24 01:12:14 -0500700 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500701
702
703Non Admin User To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600704 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500705 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
706
707 # Description of argument(s):
708 # file_name Partition file name.
709 # username Username.
710 # password Password.
711 # role Role of user.
712 # enabled Value can be True or False.
713
714 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600715 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500716 Initialize OpenBMC rest_username=${username} rest_password=${password}
717 @{Partition_file_list} = Split String ${file_name} ,
718 Create Partition File ${Partition_file_list}
719 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
720 Delete Local Partition File ${Partition_file_list}
721 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
722
723
724Non Admin Delete Non Existence Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600725 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500726 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
727
728 # Description of argument(s):
729 # file_name Partition file name.
730 # username Username.
731 # password Password.
732 # role Role of user.
733 # enabled Value can be True or False.
734
735 Redfish Create User ${username} ${password} ${role} ${enabled}
736 Delete All Sessions
737 Initialize OpenBMC rest_username=${username} rest_password=${password}
738 @{Partition_file_list} = Split String ${file_name} ,
739 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
740
741
742Verify Update Wrong Partition File To BMC
743 [Documentation] Upload the wrong partition file to BMC.
744 [Arguments] ${file_name}
745
746 # Description of argument(s):
747 # file_name Partition file name.
748
749 Redfish.Login
750 ${resp}= Run Keyword And Return Status
751 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
752 Should Be Equal As Strings ${resp} False
Sushil Singh9942df52021-09-03 02:28:11 -0500753
754
755Check Redfish Upload Partition File Name With Character Limit To BMC
756 [Documentation] Upload the partition file to BMC with file name character limit.
757 [Arguments] ${file_name} ${status_code} ${message}
758
759 # Description of argument(s):
760 # file_name Partition file name.
761 # status_code HTTPS status code.
762 # message Expected message of from upload partition file URI.
763
764 @{Partition_file_list} = Split String ${file_name} ,
765 ${num_records}= Get Length ${Partition_file_list}
766 Create Partition File ${Partition_file_list}
767
768 ${file_name_length}= Get Length ${Partition_file_list}[0]
769
770 Run Keyword If ${file_name_length} == 20
771 ... Run Keywords
772 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message} AND
773 ... Verify Partition File On BMC ${Partition_file_list} Partition_status=1 AND
774 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
775 ... ELSE
776 ... Upload Partition File To BMC ${Partition_file_list} ${status_code} ${message}
777
778 Delete Local Partition File ${Partition_file_list}