blob: b7b20bf495a3c6751f9e927b802191a48d8070f7 [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 Singh251a0bc2021-08-24 01:12:14 -050018${MAXIMUM_SIZE_MESSAGE} File size exceeds maximum allowed size[500KB]
19${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
43 # file_name file_size
44 100bytes-file small_file_size
45
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 Singhcbbce6a2020-09-07 00:57:37 -050056Redfish Fail To Upload Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050057 [Documentation] Fail to upload partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050058 [Tags] Redfish_Fail_To_Upload_Partition_File_To_BMC
59 [Template] Redfish Fail To Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060060
Sushil Singhcbbce6a2020-09-07 00:57:37 -050061 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050062 501KB-file
Vijayfcdadc52020-01-21 01:48:19 -060063
64
Sushil Singhcbbce6a2020-09-07 00:57:37 -050065Redfish Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050066 [Documentation] Upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050067 [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC
68 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060069
Sushil Singhcbbce6a2020-09-07 00:57:37 -050070 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050071 250KB-file,500KB-file
Vijayfcdadc52020-01-21 01:48:19 -060072
73
Sushil Singhcbbce6a2020-09-07 00:57:37 -050074Redfish Fail To Upload Multiple Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -050075 [Documentation] Fail to upload multiple partition file to BMC using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -050076 [Tags] Redfish_Fail_To_Upload_Multiple_Partition_File_To_BMC
77 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -060078
Sushil Singhcbbce6a2020-09-07 00:57:37 -050079 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050080 650KB-file,501KB-file
Vijay09839e22020-02-05 02:54:44 -060081
82
Sushil Singhdf6ba522020-11-24 04:17:00 -060083Redfish Upload Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -050084 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhdf6ba522020-11-24 04:17:00 -060085 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
86 [Template] Redfish Upload Partition File In Loop
87
88 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050089 500KB-file
Sushil Singhdf6ba522020-11-24 04:17:00 -060090
91
Sushil Singhf39629c2020-12-11 07:30:21 -060092Redfish Upload And Delete Same Partition File To BMC In Loop
Sushil Singh251a0bc2021-08-24 01:12:14 -050093 [Documentation] Upload same partition file to BMC using Redfish in loop.
Sushil Singhf39629c2020-12-11 07:30:21 -060094 [Tags] Redfish_Upload_And_Delete_Same_Partition_File_To_BMC_In_Loop
95 [Template] Redfish Upload And Delete Partition File In Loop
96
97 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050098 500KB-file
Sushil Singhf39629c2020-12-11 07:30:21 -060099
100
Sushil Singh5d0782f2020-11-23 06:35:35 -0600101Redfish Partition File Upload Post BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500102 [Documentation] Upload partition file to BMC using Redfish, after the BMC reboot.
Sushil Singh5d0782f2020-11-23 06:35:35 -0600103 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
104 [Template] Verify Partition File Upload Post BMC Reboot
105
106 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500107 500KB-file
Sushil Singh5d0782f2020-11-23 06:35:35 -0600108
109
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500110Redfish Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500111 [Documentation] Upload partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500112 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
113 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600114
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500115 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500116 500KB-file
Vijay09839e22020-02-05 02:54:44 -0600117
118
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500119Redfish Multiple Partition File Persistency On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500120 [Documentation] Upload multiple partition file to BMC using Redfish and is same after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500121 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
122 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600123
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500124 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500125 250KB-file,500KB-file
Vijay09839e22020-02-05 02:54:44 -0600126
127
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500128Redfish Read Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500129 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500130 [Tags] Redfish_Read_Partition_File_On_BMC
131 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600132
Sushil Singh85c381c2021-08-17 23:25:10 -0500133 # file_name reboot_flag
134 testfile01-file False
135 testfile01-file,testfile02-file False
Vijay09839e22020-02-05 02:54:44 -0600136
Vijay09839e22020-02-05 02:54:44 -0600137
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500138Redfish Read Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500139 [Documentation] Upload partition file to BMC using Redfish and verify the content after reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500140 [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot
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 True
145 testfile01-file,testfile02-file True
Vijay09839e22020-02-05 02:54:44 -0600146
Vijay09839e22020-02-05 02:54:44 -0600147
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500148Redfish Update Partition File On BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500149 [Documentation] Upload partition file to BMC using Redfish and verify the content.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500150 [Tags] Redfish_Update_Partition_File_On_BMC
151 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600152
Sushil Singh85c381c2021-08-17 23:25:10 -0500153 # file_name reboot_flag
154 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500155
156
157Redfish Update Partition File On BMC Reboot
Sushil Singh251a0bc2021-08-24 01:12:14 -0500158 [Documentation] Upload partition file to BMC using Redfish and verify the content after the reboot.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500159 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
160 [Template] Redfish Update Partition File With Different Content
161
Sushil Singh85c381c2021-08-17 23:25:10 -0500162 # file_name reboot_flag
163 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500164
165
166Redfish Persistency 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_Persistency_Update_Partition_File_On_BMC
169 [Template] Redfish Update Partition File With Same Content
170
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 Persistency 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_Persistency_Update_Partition_File_On_BMC_Reboot
178 [Template] Redfish Update Partition File With Same 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 Delete Non Existence Of Partition File
185 [Documentation] Delete the partition file if do not exists.
186 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
187 [Template] Redfish Delete Non Existence Partition File
188
189 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500190 testfile01-file
Vijay09839e22020-02-05 02:54:44 -0600191
192
193Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500194 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600195 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500196 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600197
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500198 # range
199 1000
Vijay09839e22020-02-05 02:54:44 -0600200
Vijay09839e22020-02-05 02:54:44 -0600201
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500202Non Admin Users Fail To Upload Partition File
203 [Documentation] Non admin user will fail to upload the partition file.
204 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
205 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600206
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500207 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500208 500KB-file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600209
210
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500211Non Admin User Delete Non Existence Of Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600212 [Documentation] Delete the partition file if does not exists.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500213 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
214 [Template] Non Admin Delete Non Existence Partition File
215
216 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500217 500KB-file operator_user TestPwd123 Operator
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500218
219
220Redfish Update Wrong Partition File To BMC
Sushil Singh251a0bc2021-08-24 01:12:14 -0500221 [Documentation] Upload partition file to BMC by wrong URI using Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500222 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
223 [Template] Verify Update Wrong Partition File To BMC
224
225 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500226 500KB-file
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500227
Vijayfcdadc52020-01-21 01:48:19 -0600228*** Keywords ***
229
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500230Suite Setup Execution
231 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600232
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500233 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600234
235
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500236Test Teardown Execution
237 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600238
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500239 Delete All BMC Partition File ${HTTP_OK}
240 FFDC On Test Case Fail
241
242
243Suite Teardown Execution
244 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600245
246 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600247
248
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500249Delete Local Partition File
250 [Documentation] Delete local partition file.
251 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600252
253 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500254 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600255
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500256 FOR ${conf_file} IN @{file_name}
257 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
258 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
259 END
Vijayfcdadc52020-01-21 01:48:19 -0600260
Vijayfcdadc52020-01-21 01:48:19 -0600261
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500262Create Partition File
263 [Documentation] Create Partition file.
264 [Arguments] ${file_name}
265
266 # Description of argument(s):
267 # file_name Partition file name.
268
269 Delete Local Partition File ${file_name}
270
271 FOR ${conf_file} IN @{file_name}
Sushil Singh85c381c2021-08-17 23:25:10 -0500272 @{words}= Split String ${conf_file} -
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500273 Run dd if=/dev/zero of=${conf_file} bs=1 count=0 seek=${words}[-0]
274 OperatingSystem.File Should Exist ${conf_file}
275 END
276
277
Sushil Singh251a0bc2021-08-24 01:12:14 -0500278Create Small Size Partition File
279 [Documentation] Create small size Partition file.
280 [Arguments] ${file_name}
281
282 # Description of argument(s):
283 # file_name Partition file name.
284
285 Delete Local Partition File ${file_name}
286
287 FOR ${conf_file} IN @{file_name}
288 @{words}= Split String ${conf_file} -
289 ${matches}= Get Regexp Matches ${words}[0] (.*[0-9])
290 Run dd if=/dev/zero of=${conf_file} bs=${matches}[0] count=1
291 OperatingSystem.File Should Exist ${conf_file}
292 END
293
294
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500295Delete BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500296 [Documentation] Delete single partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500297 [Arguments] ${file_name} ${status_code} ${expected_message}
298
299 # Description of argument(s):
300 # file_name Partition file name.
301 # status_code HTTPS status code.
302 # expected_message Expected message of URI.
303
304 FOR ${conf_file} IN @{file_name}
305 ${data}= Create Dictionary
306 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
307 Set To Dictionary ${data} headers ${headers}
308
309 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
310 Should Be Equal As Strings ${resp.status_code} ${status_code}
311
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500312 ${description}= Return Description Of Response ${resp.text}
313 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500314 END
315
316
317Delete All BMC Partition File
Sushil Singh251a0bc2021-08-24 01:12:14 -0500318 [Documentation] Delete multiple partition file on BMC via Redfish.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500319 [Arguments] ${status_code}
320
321 # Description of argument(s):
322 # status_code HTTPS status code.
323
324 Initialize OpenBMC
325 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600326 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600327 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600328
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500329 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
330 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600331
332
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500333Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600334 [Documentation] Return description of REST response.
335 [Arguments] ${resp_text}
336
337 # Description of argument(s):
338 # resp_text REST response body.
339
340 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500341 # {
342 # "Description": "File Created"
343 # }
Vijay09839e22020-02-05 02:54:44 -0600344
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500345 ${status}= Run Keyword And Return Status Evaluate isinstance(${resp_text}, dict)
346 Return From Keyword If '${status}' == 'False' ${resp_text}
Vijay09839e22020-02-05 02:54:44 -0600347 ${message}= Evaluate json.loads('''${resp_text}''') json
348
349 [Return] ${message["Description"]}
350
351
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500352Upload Partition File To BMC
353 [Documentation] Upload partition file to BMC.
354 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True}
Vijay09839e22020-02-05 02:54:44 -0600355
356 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500357 # file_name Partition file name.
358 # status_code HTTPS status code.
359 # expected_message Expected message of URI.
360 # flag If True run part of program, else skip.
Vijay09839e22020-02-05 02:54:44 -0600361
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500362 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
363 FOR ${conf_file} IN @{file_name}
364 # Get the content of the file and upload to BMC.
365 ${image_data}= OperatingSystem.Get Binary File ${conf_file}
Sushil Singh85c381c2021-08-17 23:25:10 -0500366 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
Vijay09839e22020-02-05 02:54:44 -0600367
Sushil Singh85c381c2021-08-17 23:25:10 -0500368 ${kwargs}= Create Dictionary data=${image_data}
369 Set To Dictionary ${kwargs} headers ${headers}
370 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{kwargs} timeout=10
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500371 Should Be Equal As Strings ${resp.status_code} ${status_code}
372
Sushil Singh7aa3cc42021-08-19 07:42:29 -0500373 ${description}= Return Description Of Response ${resp.text}
374 Should Be Equal As Strings ${description} ${expected_message}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500375 END
Vijayfcdadc52020-01-21 01:48:19 -0600376
377
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500378Verify Partition File On BMC
379 [Documentation] Verify partition file on BMC.
380 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600381
382 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500383 # file_name Partition file name.
384 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600385
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500386 FOR ${conf_file} IN @{file_name}
387 ${status} ${stderr} ${rc}= BMC Execute Command
Sushil Singhe5f39ee2021-01-06 00:39:12 -0600388 ... ls -l /var/lib/bmcweb/ibm-management-console/configfiles/${conf_file} | wc -l
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500389 Valid Value ${status} [${Partition_status}]
390 END
Vijayfcdadc52020-01-21 01:48:19 -0600391
392
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500393Redfish Upload Partition File
394 [Documentation] Upload the partition file.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500395 [Arguments] ${file_name} ${file_size}=${EMPTY}
Vijayfcdadc52020-01-21 01:48:19 -0600396
397 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500398 # file_name Partition file name.
Sushil Singh251a0bc2021-08-24 01:12:14 -0500399 # file_size By Default is set to EMPTY,
400 # if user pass small_file_size the create file with small
401 # size keyword gets executed.
Vijayfcdadc52020-01-21 01:48:19 -0600402
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500403 @{Partition_file_list} = Split String ${file_name} ,
404 ${num_records}= Get Length ${Partition_file_list}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500405
406 Run Keyword If '${file_size}' == 'small_file_size'
407 ... Create Small Size Partition File ${Partition_file_list}
408 ... ELSE
409 ... Create Partition File ${Partition_file_list}
410
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500411 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
412 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
413 Run Keyword If ${num_records} == ${1}
414 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
415 ... ELSE
416 ... Delete All BMC Partition File ${HTTP_OK}
417 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600418
419
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500420Redfish Fail To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600421 [Documentation] Fail to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500422 [Arguments] ${file_name}
Vijay09839e22020-02-05 02:54:44 -0600423
424 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500425 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600426
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500427 @{Partition_file_list} = Split String ${file_name} ,
428 Create Partition File ${Partition_file_list}
429 Upload Partition File To BMC ${Partition_file_list} ${HTTP_BAD_REQUEST} ${MAXIMUM_SIZE_MESSAGE}
430 Verify Partition File On BMC ${Partition_file_list} Partition_status=0
Sushil Singh251a0bc2021-08-24 01:12:14 -0500431 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500432 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600433
434
Sushil Singhdf6ba522020-11-24 04:17:00 -0600435Redfish Upload Partition File In Loop
436 [Documentation] Upload the same partition file multiple times in loop to BMC.
437 [Arguments] ${file_name}
438
439 # Description of argument(s):
440 # file_name Partition file name.
441
442 @{Partition_file_list} = Split String ${file_name} ,
443 Create Partition File ${Partition_file_list}
444
445 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
446 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
447
448 FOR ${count} IN RANGE 1 11
Sushil Singh251a0bc2021-08-24 01:12:14 -0500449 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhdf6ba522020-11-24 04:17:00 -0600450 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
451 END
452
453 Initialize OpenBMC
454 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
455 Delete Local Partition File ${Partition_file_list}
456
457
Sushil Singhf39629c2020-12-11 07:30:21 -0600458Redfish Upload And Delete Partition File In Loop
459 [Documentation] Upload the same partition file multiple times in loop to BMC.
460 [Arguments] ${file_name}
461
462 # Description of argument(s):
463 # file_name Partition file name.
464
465 FOR ${count} IN RANGE 1 11
466 Redfish Upload Partition File ${file_name}
467 END
468
469
Sushil Singh5d0782f2020-11-23 06:35:35 -0600470Verify Partition File Upload Post BMC Reboot
471 [Documentation] Upload the partition file, after BMC reboot.
472 [Arguments] ${file_name}
473
474 # Description of argument(s):
475 # file_name Partition file name.
476
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600477 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
478 Redfish BMC Reset Operation
479 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
480
481 Is BMC Standby
Sushil Singh5d0782f2020-11-23 06:35:35 -0600482
483 Redfish Upload Partition File ${file_name}
484
485
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500486Redfish Partition File Persistency
487 [Documentation] Upload the partition file and check for persistency after reboot.
488 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600489
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500490 # Description of argument(s):
491 # file_name Partition file name.
492
493 @{Partition_file_list} = Split String ${file_name} ,
494 ${num_records}= Get Length ${Partition_file_list}
495 Create Partition File ${Partition_file_list}
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
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600498
499 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
500 Redfish BMC Reset Operation
501 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
502
503 Is BMC Standby
504
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500505 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600506 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500507 Run Keyword If ${num_records} == ${1}
508 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
509 ... ELSE
510 ... Delete All BMC Partition File ${HTTP_OK}
511 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600512
513
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500514Verify Redfish Partition File Content
515 [Documentation] Verify partition file content.
516 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600517
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500518 # Description of argument(s):
519 # file_name Partition file name.
520 # content_dict Dict contain the content.
521 # status_code HTTPS status code.
522
523 FOR ${conf_file} IN @{file_name}
524 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
525 Should Be Equal As Strings ${resp.status_code} ${status_code}
526
527 ${Partition_file_data}= Remove String ${resp.text} \\n
528 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
529 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
530 END
Vijayfcdadc52020-01-21 01:48:19 -0600531
Vijay39373152020-02-14 08:08:20 -0600532
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500533Add Content To Files
534 [Documentation] Add defined content in partition file.
535 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600536
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500537 # Description of argument(s):
538 # file_name Partition file name.
539 # index Index
540
541 ${num_records}= Get Length ${file_name}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500542 &{content_dict}= Create Dictionary
Sushil Singh85c381c2021-08-17 23:25:10 -0500543
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500544 FOR ${conf_file} IN @{file_name}
545 ${index}= Get Index From List ${file_name} ${conf_file}
546 ${index}= Evaluate ${index} + 1
547
548 Run echo "${content-${index}}" > ${conf_file}
549 OperatingSystem.File Should Exist ${conf_file}
550
551 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
552 END
553
554 [Return] &{content_dict}
555
556
557Redfish Read Partition File
558 [Documentation] Read partition file content.
559 [Arguments] ${file_name} ${reboot_flag}=False
560
561 # Description of argument(s):
562 # file_name Partition file name.
563 # reboot_flag Reboot flag.
564
565 @{Partition_file_list} = Split String ${file_name} ,
566 ${content_dict}= Add Content To Files ${Partition_file_list}
567
568 ${num_records}= Get Length ${Partition_file_list}
569
570 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
571 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
572 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
573
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600574 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
575
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500576 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600577 ... Run Keywords Redfish BMC Reset Operation AND
578 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
579 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500580 ... Initialize OpenBMC AND
581 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600582
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500583 Run Keyword If ${num_records} == ${1}
584 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
585 ... ELSE
586 ... Delete All BMC Partition File ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600587
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500588 Delete Local Partition File ${Partition_file_list}
589
590
591Redfish Update Partition File With Same Content
592 [Documentation] Update partition file with same content.
593 [Arguments] ${file_name} ${reboot_flag}=False
594
595 # Description of argument(s):
596 # file_name Partition file name.
597 # reboot_flag Reboot flag.
598
599 @{Partition_file_list} = Split String ${file_name} ,
600 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
601
602 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
603 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
604 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
605
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600606 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
607
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500608 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600609 ... Run Keywords Redfish BMC Reset Operation AND
610 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
611 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500612 ... Initialize OpenBMC
613
614 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500615 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500616 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
617 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
618
619 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
620 Delete Local Partition File ${Partition_file_list}
621
622
623Redfish Update Partition File With Different Content
624 [Documentation] Update partition file with different content.
625 [Arguments] ${file_name} ${reboot_flag}=False
626
627 # Description of argument(s):
628 # file_name Partition file name.
629 # reboot_flag Reboot flag.
630
631 @{Partition_file_list} = Split String ${file_name} ,
632 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
633
634 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
635 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
636 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
637
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600638 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
639
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500640 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600641 ... Run Keywords Redfish BMC Reset Operation AND
642 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
643 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500644 ... Initialize OpenBMC
645
646 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
Sushil Singh251a0bc2021-08-24 01:12:14 -0500647 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500648 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
649 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
650
651 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
652 Delete Local Partition File ${Partition_file_list}
653
654
655Create File Names
656 [Documentation] Create partition file names.
657 [Arguments] ${range}
658
659 # Description of argument(s):
660 # range Range in numbers.
661
662 @{file_name_list}= Create List
663 Set Test Variable ${file_name} rangefile
664 FOR ${count} IN RANGE ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500665 Append To List ${file_name_list} 1KB-file${count}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500666 END
667 [Return] ${file_name_list}
668
669
670Redfish Upload Partition File With Range
671 [Documentation] Upload the partition file with the range of files.
672 [Arguments] ${range}
673
674 # Description of argument(s):
675 # range Range in numbers.
676
677 ${Partition_file_list}= Create File Names ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500678 Delete Local Partition File ${Partition_file_list}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500679 Create Partition File ${Partition_file_list}
680 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
681 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
682 Delete All BMC Partition File ${HTTP_OK}
683 Delete Local Partition File ${Partition_file_list}
684
685
686Redfish Delete Non Existence Partition File
687 [Documentation] Delete the partition file if do not exists.
688 [Arguments] ${file_name}
689
690 # Description of argument(s):
691 # file_name Partition file name.
692
693 @{Partition_file_list} = Split String ${file_name} ,
Sushil Singh251a0bc2021-08-24 01:12:14 -0500694 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND_MESSAGE}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500695
696
697Non Admin User To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600698 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500699 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
700
701 # Description of argument(s):
702 # file_name Partition file name.
703 # username Username.
704 # password Password.
705 # role Role of user.
706 # enabled Value can be True or False.
707
708 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600709 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500710 Initialize OpenBMC rest_username=${username} rest_password=${password}
711 @{Partition_file_list} = Split String ${file_name} ,
712 Create Partition File ${Partition_file_list}
713 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
714 Delete Local Partition File ${Partition_file_list}
715 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
716
717
718Non Admin Delete Non Existence Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600719 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500720 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
721
722 # Description of argument(s):
723 # file_name Partition file name.
724 # username Username.
725 # password Password.
726 # role Role of user.
727 # enabled Value can be True or False.
728
729 Redfish Create User ${username} ${password} ${role} ${enabled}
730 Delete All Sessions
731 Initialize OpenBMC rest_username=${username} rest_password=${password}
732 @{Partition_file_list} = Split String ${file_name} ,
733 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
734
735
736Verify Update Wrong Partition File To BMC
737 [Documentation] Upload the wrong partition file to BMC.
738 [Arguments] ${file_name}
739
740 # Description of argument(s):
741 # file_name Partition file name.
742
743 Redfish.Login
744 ${resp}= Run Keyword And Return Status
745 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
746 Should Be Equal As Strings ${resp} False