blob: 37b1ef6438a9d7692f97b1139391a054b1924acb [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 Singhcbbce6a2020-09-07 00:57:37 -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} File Updated
22${FORBIDDEN_MESSAGE} Forbidden
23${ERROR_MESSAGE} Error while creating the file
24${RESOURCE_NOT_FOUND} Resource Not Found
Vijayfcdadc52020-01-21 01:48:19 -060025
26*** Test Cases ***
27
Sushil Singhcbbce6a2020-09-07 00:57:37 -050028Redfish Upload Partition File To BMC
29 [Documentation] Upload partition file to BMC using redfish.
30 [Tags] Redfish_Upload_Partition_File_To_BMC
31 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060032
Sushil Singhcbbce6a2020-09-07 00:57:37 -050033 # file_name
34 500KB_file
Vijayfcdadc52020-01-21 01:48:19 -060035
36
Sushil Singhcbbce6a2020-09-07 00:57:37 -050037Redfish Fail To Upload Partition File To BMC
38 [Documentation] Fail to upload partition file to BMC using redfish.
39 [Tags] Redfish_Fail_To_Upload_Partition_File_To_BMC
40 [Template] Redfish Fail To Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060041
Sushil Singhcbbce6a2020-09-07 00:57:37 -050042 # file_name
43 501KB_file
Vijayfcdadc52020-01-21 01:48:19 -060044
45
Sushil Singhcbbce6a2020-09-07 00:57:37 -050046Redfish Upload Multiple Partition File To BMC
47 [Documentation] Upload multiple partition file to BMC using redfish.
48 [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC
49 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060050
Sushil Singhcbbce6a2020-09-07 00:57:37 -050051 # file_name
52 250KB_file,500KB_file
Vijayfcdadc52020-01-21 01:48:19 -060053
54
Sushil Singhcbbce6a2020-09-07 00:57:37 -050055Redfish Fail To Upload Multiple Partition File To BMC
56 [Documentation] Fail to upload multiple partition file to BMC using redfish.
57 [Tags] Redfish_Fail_To_Upload_Multiple_Partition_File_To_BMC
58 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -060059
Sushil Singhcbbce6a2020-09-07 00:57:37 -050060 # file_name
61 650KB_file,501KB_file
Vijay09839e22020-02-05 02:54:44 -060062
63
Sushil Singhdf6ba522020-11-24 04:17:00 -060064Redfish Upload Same Partition File To BMC In Loop
65 [Documentation] Upload same partition file to BMC using redfish in loop.
66 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
67 [Template] Redfish Upload Partition File In Loop
68
69 # file_name
70 500KB_file
71
72
Sushil Singh5d0782f2020-11-23 06:35:35 -060073Redfish Partition File Upload Post BMC Reboot
74 [Documentation] Upload partition file to BMC using redfish, after the BMC reboot.
75 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
76 [Template] Verify Partition File Upload Post BMC Reboot
77
78 # file_name
79 500KB_file
80
81
Sushil Singhcbbce6a2020-09-07 00:57:37 -050082Redfish Partition File Persistency On BMC Reboot
83 [Documentation] Upload partition file to BMC using redfish and is same after reboot.
84 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
85 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -060086
Sushil Singhcbbce6a2020-09-07 00:57:37 -050087 # file_name
88 500KB_file
Vijay09839e22020-02-05 02:54:44 -060089
90
Sushil Singhcbbce6a2020-09-07 00:57:37 -050091Redfish Multiple Partition File Persistency On BMC Reboot
92 [Documentation] Upload partition file to BMC using redfish and is same after reboot.
93 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
94 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -060095
Sushil Singhcbbce6a2020-09-07 00:57:37 -050096 # file_name
97 250KB_file,500KB_file
Vijay09839e22020-02-05 02:54:44 -060098
99
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500100Redfish Read Partition File On BMC
101 [Documentation] Upload partition file to BMC using redfish and verify the content.
102 [Tags] Redfish_Read_Partition_File_On_BMC
103 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600104
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500105 # file_name reboot_flag
106 testfile False
107 testfile01,testfile02 False
Vijay09839e22020-02-05 02:54:44 -0600108
Vijay09839e22020-02-05 02:54:44 -0600109
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500110Redfish Read Partition File On BMC Reboot
111 [Documentation] Upload partition file to BMC using redfish and verify the content after reboot.
112 [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot
113 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600114
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500115 # file_name reboot_flag
116 testfile True
117 testfile01,testfile02 True
Vijay09839e22020-02-05 02:54:44 -0600118
Vijay09839e22020-02-05 02:54:44 -0600119
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500120Redfish Update Partition File On BMC
121 [Documentation] Upload partition file to BMC using redfish and verify the content.
122 [Tags] Redfish_Update_Partition_File_On_BMC
123 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600124
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500125 # file_name reboot_flag
126 testfile01 False
127
128
129Redfish Update Partition File On BMC Reboot
130 [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot.
131 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
132 [Template] Redfish Update Partition File With Different Content
133
134 # file_name reboot_flag
135 testfile01 True
136
137
138Redfish Persistency Update Partition File On BMC
139 [Documentation] Upload partition file to BMC using redfish and verify the content.
140 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
141 [Template] Redfish Update Partition File With Same Content
142
143 # file_name reboot_flag
144 testfile01 False
145
146
147Redfish Persistency Update Partition File On BMC Reboot
148 [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot.
149 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC_Reboot
150 [Template] Redfish Update Partition File With Same Content
151
152 # file_name reboot_flag
153 testfile01 True
154
155
156Redfish Delete Non Existence Of Partition File
157 [Documentation] Delete the partition file if do not exists.
158 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
159 [Template] Redfish Delete Non Existence Partition File
160
161 # file_name
162 testfile01
Vijay09839e22020-02-05 02:54:44 -0600163
164
165Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500166 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600167 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500168 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600169
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500170 # range
171 1000
Vijay09839e22020-02-05 02:54:44 -0600172
Vijay09839e22020-02-05 02:54:44 -0600173
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500174Non Admin Users Fail To Upload Partition File
175 [Documentation] Non admin user will fail to upload the partition file.
176 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
177 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600178
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500179 # file_name username password role_id
180 500KB_file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600181
182
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500183Non Admin User Delete Non Existence Of Partition File
184 [Documentation] Delete the partion file if does not exists.
185 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
186 [Template] Non Admin Delete Non Existence Partition File
187
188 # file_name username password role_id
189 500KB_file operator_user TestPwd123 Operator
190
191
192Redfish Update Wrong Partition File To BMC
193 [Documentation] Upload partition file to BMC by wrong URI using redfish.
194 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
195 [Template] Verify Update Wrong Partition File To BMC
196
197 # file_name
198 500KB_file
199
Vijayfcdadc52020-01-21 01:48:19 -0600200*** Keywords ***
201
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500202Suite Setup Execution
203 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600204
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500205 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600206
207
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500208Test Teardown Execution
209 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600210
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500211 Delete All BMC Partition File ${HTTP_OK}
212 FFDC On Test Case Fail
213
214
215Suite Teardown Execution
216 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600217
218 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600219
220
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500221Delete Local Partition File
222 [Documentation] Delete local partition file.
223 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600224
225 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500226 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600227
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500228 FOR ${conf_file} IN @{file_name}
229 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
230 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
231 END
Vijayfcdadc52020-01-21 01:48:19 -0600232
Vijayfcdadc52020-01-21 01:48:19 -0600233
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500234Create Partition File
235 [Documentation] Create Partition file.
236 [Arguments] ${file_name}
237
238 # Description of argument(s):
239 # file_name Partition file name.
240
241 Delete Local Partition File ${file_name}
242
243 FOR ${conf_file} IN @{file_name}
244 @{words}= Split String ${conf_file} _
245 Run dd if=/dev/zero of=${conf_file} bs=1 count=0 seek=${words}[-0]
246 OperatingSystem.File Should Exist ${conf_file}
247 END
248
249
250Delete BMC Partition File
251 [Documentation] Delete single partition file on BMC via redfish.
252 [Arguments] ${file_name} ${status_code} ${expected_message}
253
254 # Description of argument(s):
255 # file_name Partition file name.
256 # status_code HTTPS status code.
257 # expected_message Expected message of URI.
258
259 FOR ${conf_file} IN @{file_name}
260 ${data}= Create Dictionary
261 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
262 Set To Dictionary ${data} headers ${headers}
263
264 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
265 Should Be Equal As Strings ${resp.status_code} ${status_code}
266
267 Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN}
268 ... Should Be Equal As Strings ${resp.text} ${expected_message}
269 ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK}
270 ... Return Description Of Response ${resp.text}
271 Run Keyword If '${description}' != 'None'
272 ... Should Be Equal As Strings ${description} ${expected_message}
273 END
274
275
276Delete All BMC Partition File
277 [Documentation] Delete multiple partition file on BMC via redfish.
278 [Arguments] ${status_code}
279
280 # Description of argument(s):
281 # status_code HTTPS status code.
282
283 Initialize OpenBMC
284 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600285 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600286 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600287
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500288 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
289 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600290
291
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500292Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600293 [Documentation] Return description of REST response.
294 [Arguments] ${resp_text}
295
296 # Description of argument(s):
297 # resp_text REST response body.
298
299 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500300 # {
301 # "Description": "File Created"
302 # }
Vijay09839e22020-02-05 02:54:44 -0600303
304 ${message}= Evaluate json.loads('''${resp_text}''') json
305
306 [Return] ${message["Description"]}
307
308
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500309Upload Partition File To BMC
310 [Documentation] Upload partition file to BMC.
311 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True}
Vijay09839e22020-02-05 02:54:44 -0600312
313 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500314 # file_name Partition file name.
315 # status_code HTTPS status code.
316 # expected_message Expected message of URI.
317 # flag If True run part of program, else skip.
Vijay09839e22020-02-05 02:54:44 -0600318
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500319 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
320 FOR ${conf_file} IN @{file_name}
321 # Get the content of the file and upload to BMC.
322 ${image_data}= OperatingSystem.Get Binary File ${conf_file}
323 ${data}= Create Dictionary data ${image_data}
324 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
325 Set To Dictionary ${data} headers ${headers}
Vijay09839e22020-02-05 02:54:44 -0600326
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500327 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
328 Should Be Equal As Strings ${resp.status_code} ${status_code}
329
330 Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN}
331 ... Should Be Equal As Strings ${resp.text} ${expected_message}
332 ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK}
333 ... Return Description Of Response ${resp.text}
334 Run Keyword If '${description}' != 'None'
335 ... Should Be Equal As Strings ${description} ${expected_message}
336 END
Vijayfcdadc52020-01-21 01:48:19 -0600337
338
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500339Verify Partition File On BMC
340 [Documentation] Verify partition file on BMC.
341 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600342
343 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500344 # file_name Partition file name.
345 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600346
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500347 FOR ${conf_file} IN @{file_name}
348 ${status} ${stderr} ${rc}= BMC Execute Command
349 ... ls -l /var/lib/obmc/bmc-console-mgmt/save-area/${conf_file} | wc -l
350 Valid Value ${status} [${Partition_status}]
351 END
Vijayfcdadc52020-01-21 01:48:19 -0600352
353
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500354Redfish Upload Partition File
355 [Documentation] Upload the partition file.
Vijayfcdadc52020-01-21 01:48:19 -0600356 [Arguments] ${file_name}
357
358 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500359 # file_name Partition file name.
Vijayfcdadc52020-01-21 01:48:19 -0600360
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500361 @{Partition_file_list} = Split String ${file_name} ,
362 ${num_records}= Get Length ${Partition_file_list}
363 Create Partition File ${Partition_file_list}
364 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
365 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
366 Run Keyword If ${num_records} == ${1}
367 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
368 ... ELSE
369 ... Delete All BMC Partition File ${HTTP_OK}
370 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600371
372
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500373Redfish Fail To Upload Partition File
374 [Documentation] Fail to uplaod the partition file.
375 [Arguments] ${file_name}
Vijay09839e22020-02-05 02:54:44 -0600376
377 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500378 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600379
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500380 @{Partition_file_list} = Split String ${file_name} ,
381 Create Partition File ${Partition_file_list}
382 Upload Partition File To BMC ${Partition_file_list} ${HTTP_BAD_REQUEST} ${MAXIMUM_SIZE_MESSAGE}
383 Verify Partition File On BMC ${Partition_file_list} Partition_status=0
384 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND}
385 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600386
387
Sushil Singhdf6ba522020-11-24 04:17:00 -0600388Redfish Upload Partition File In Loop
389 [Documentation] Upload the same partition file multiple times in loop to BMC.
390 [Arguments] ${file_name}
391
392 # Description of argument(s):
393 # file_name Partition file name.
394
395 @{Partition_file_list} = Split String ${file_name} ,
396 Create Partition File ${Partition_file_list}
397
398 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
399 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
400
401 FOR ${count} IN RANGE 1 11
402 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
403 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
404 END
405
406 Initialize OpenBMC
407 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
408 Delete Local Partition File ${Partition_file_list}
409
410
Sushil Singh5d0782f2020-11-23 06:35:35 -0600411Verify Partition File Upload Post BMC Reboot
412 [Documentation] Upload the partition file, after BMC reboot.
413 [Arguments] ${file_name}
414
415 # Description of argument(s):
416 # file_name Partition file name.
417
418 Redfish OBMC Reboot (off)
419
420 Redfish Upload Partition File ${file_name}
421
422
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500423Redfish Partition File Persistency
424 [Documentation] Upload the partition file and check for persistency after reboot.
425 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600426
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500427 # Description of argument(s):
428 # file_name Partition file name.
429
430 @{Partition_file_list} = Split String ${file_name} ,
431 ${num_records}= Get Length ${Partition_file_list}
432 Create Partition File ${Partition_file_list}
433 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
434 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
435 Redfish OBMC Reboot (off)
436 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600437 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500438 Run Keyword If ${num_records} == ${1}
439 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
440 ... ELSE
441 ... Delete All BMC Partition File ${HTTP_OK}
442 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600443
444
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500445Verify Redfish Partition File Content
446 [Documentation] Verify partition file content.
447 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600448
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500449 # Description of argument(s):
450 # file_name Partition file name.
451 # content_dict Dict contain the content.
452 # status_code HTTPS status code.
453
454 FOR ${conf_file} IN @{file_name}
455 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
456 Should Be Equal As Strings ${resp.status_code} ${status_code}
457
458 ${Partition_file_data}= Remove String ${resp.text} \\n
459 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
460 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
461 END
Vijayfcdadc52020-01-21 01:48:19 -0600462
Vijay39373152020-02-14 08:08:20 -0600463
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500464Add Content To Files
465 [Documentation] Add defined content in partition file.
466 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600467
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500468 # Description of argument(s):
469 # file_name Partition file name.
470 # index Index
471
472 ${num_records}= Get Length ${file_name}
473 Set Test Variable ${content-1} Sample Content to test partition file upload
474 Set Test Variable ${content-2} Sample Content to test partition file upload after reboot
475 &{content_dict}= Create Dictionary
476 FOR ${conf_file} IN @{file_name}
477 ${index}= Get Index From List ${file_name} ${conf_file}
478 ${index}= Evaluate ${index} + 1
479
480 Run echo "${content-${index}}" > ${conf_file}
481 OperatingSystem.File Should Exist ${conf_file}
482
483 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
484 END
485
486 [Return] &{content_dict}
487
488
489Redfish Read Partition File
490 [Documentation] Read partition file content.
491 [Arguments] ${file_name} ${reboot_flag}=False
492
493 # Description of argument(s):
494 # file_name Partition file name.
495 # reboot_flag Reboot flag.
496
497 @{Partition_file_list} = Split String ${file_name} ,
498 ${content_dict}= Add Content To Files ${Partition_file_list}
499
500 ${num_records}= Get Length ${Partition_file_list}
501
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
504 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
505
506 Run Keyword If ${True} == ${reboot_flag}
507 ... Run Keywords Redfish OBMC Reboot (off) AND
508 ... Initialize OpenBMC AND
509 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
510 Run Keyword If ${num_records} == ${1}
511 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
512 ... ELSE
513 ... Delete All BMC Partition File ${HTTP_OK}
514 Delete Local Partition File ${Partition_file_list}
515
516
517Redfish Update Partition File With Same Content
518 [Documentation] Update partition file with same content.
519 [Arguments] ${file_name} ${reboot_flag}=False
520
521 # Description of argument(s):
522 # file_name Partition file name.
523 # reboot_flag Reboot flag.
524
525 @{Partition_file_list} = Split String ${file_name} ,
526 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
527
528 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
529 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
530 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
531
532 Run Keyword If ${True} == ${reboot_flag}
533 ... Run Keywords Redfish OBMC Reboot (off) AND
534 ... Initialize OpenBMC
535
536 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
537 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
538 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
539 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
540
541 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
542 Delete Local Partition File ${Partition_file_list}
543
544
545Redfish Update Partition File With Different Content
546 [Documentation] Update partition file with different content.
547 [Arguments] ${file_name} ${reboot_flag}=False
548
549 # Description of argument(s):
550 # file_name Partition file name.
551 # reboot_flag Reboot flag.
552
553 @{Partition_file_list} = Split String ${file_name} ,
554 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
555
556 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
557 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
558 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
559
560 Run Keyword If ${True} == ${reboot_flag}
561 ... Run Keywords Redfish OBMC Reboot (off) AND
562 ... Initialize OpenBMC
563
564 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
565 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
566 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
567 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
568
569 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
570 Delete Local Partition File ${Partition_file_list}
571
572
573Create File Names
574 [Documentation] Create partition file names.
575 [Arguments] ${range}
576
577 # Description of argument(s):
578 # range Range in numbers.
579
580 @{file_name_list}= Create List
581 Set Test Variable ${file_name} rangefile
582 FOR ${count} IN RANGE ${range}
583 Append To List ${file_name_list} 200KB_file${count}
584 END
585 [Return] ${file_name_list}
586
587
588Redfish Upload Partition File With Range
589 [Documentation] Upload the partition file with the range of files.
590 [Arguments] ${range}
591
592 # Description of argument(s):
593 # range Range in numbers.
594
595 ${Partition_file_list}= Create File Names ${range}
596 Create Partition File ${Partition_file_list}
597 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
598 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
599 Delete All BMC Partition File ${HTTP_OK}
600 Delete Local Partition File ${Partition_file_list}
601
602
603Redfish Delete Non Existence Partition File
604 [Documentation] Delete the partition file if do not exists.
605 [Arguments] ${file_name}
606
607 # Description of argument(s):
608 # file_name Partition file name.
609
610 @{Partition_file_list} = Split String ${file_name} ,
611 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND}
612
613
614Non Admin User To Upload Partition File
615 [Documentation] Non admin user to uplaod the partition file.
616 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
617
618 # Description of argument(s):
619 # file_name Partition file name.
620 # username Username.
621 # password Password.
622 # role Role of user.
623 # enabled Value can be True or False.
624
625 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600626 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500627 Initialize OpenBMC rest_username=${username} rest_password=${password}
628 @{Partition_file_list} = Split String ${file_name} ,
629 Create Partition File ${Partition_file_list}
630 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
631 Delete Local Partition File ${Partition_file_list}
632 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
633
634
635Non Admin Delete Non Existence Partition File
636 [Documentation] Non admin user to uplaod the partition file.
637 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
638
639 # Description of argument(s):
640 # file_name Partition file name.
641 # username Username.
642 # password Password.
643 # role Role of user.
644 # enabled Value can be True or False.
645
646 Redfish Create User ${username} ${password} ${role} ${enabled}
647 Delete All Sessions
648 Initialize OpenBMC rest_username=${username} rest_password=${password}
649 @{Partition_file_list} = Split String ${file_name} ,
650 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
651
652
653Verify Update Wrong Partition File To BMC
654 [Documentation] Upload the wrong partition file to BMC.
655 [Arguments] ${file_name}
656
657 # Description of argument(s):
658 # file_name Partition file name.
659
660 Redfish.Login
661 ${resp}= Run Keyword And Return Status
662 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
663 Should Be Equal As Strings ${resp} False