blob: 8c041cefc4d6a78b531ca7bc6123b9bf4fdd1224 [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 Singh5d0782f2020-11-23 06:35:35 -060064Redfish Partition File Upload Post BMC Reboot
65 [Documentation] Upload partition file to BMC using redfish, after the BMC reboot.
66 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
67 [Template] Verify Partition File Upload Post BMC Reboot
68
69 # file_name
70 500KB_file
71
72
Sushil Singhcbbce6a2020-09-07 00:57:37 -050073Redfish Partition File Persistency On BMC Reboot
74 [Documentation] Upload partition file to BMC using redfish and is same after reboot.
75 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
76 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -060077
Sushil Singhcbbce6a2020-09-07 00:57:37 -050078 # file_name
79 500KB_file
Vijay09839e22020-02-05 02:54:44 -060080
81
Sushil Singhcbbce6a2020-09-07 00:57:37 -050082Redfish Multiple Partition File Persistency On BMC Reboot
83 [Documentation] Upload partition file to BMC using redfish and is same after reboot.
84 [Tags] Redfish_Multiple_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 250KB_file,500KB_file
Vijay09839e22020-02-05 02:54:44 -060089
90
Sushil Singhcbbce6a2020-09-07 00:57:37 -050091Redfish Read Partition File On BMC
92 [Documentation] Upload partition file to BMC using redfish and verify the content.
93 [Tags] Redfish_Read_Partition_File_On_BMC
94 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -060095
Sushil Singhcbbce6a2020-09-07 00:57:37 -050096 # file_name reboot_flag
97 testfile False
98 testfile01,testfile02 False
Vijay09839e22020-02-05 02:54:44 -060099
Vijay09839e22020-02-05 02:54:44 -0600100
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500101Redfish Read Partition File On BMC Reboot
102 [Documentation] Upload partition file to BMC using redfish and verify the content after reboot.
103 [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot
104 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600105
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500106 # file_name reboot_flag
107 testfile True
108 testfile01,testfile02 True
Vijay09839e22020-02-05 02:54:44 -0600109
Vijay09839e22020-02-05 02:54:44 -0600110
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500111Redfish Update Partition File On BMC
112 [Documentation] Upload partition file to BMC using redfish and verify the content.
113 [Tags] Redfish_Update_Partition_File_On_BMC
114 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600115
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500116 # file_name reboot_flag
117 testfile01 False
118
119
120Redfish Update Partition File On BMC Reboot
121 [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot.
122 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
123 [Template] Redfish Update Partition File With Different Content
124
125 # file_name reboot_flag
126 testfile01 True
127
128
129Redfish Persistency Update Partition File On BMC
130 [Documentation] Upload partition file to BMC using redfish and verify the content.
131 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
132 [Template] Redfish Update Partition File With Same Content
133
134 # file_name reboot_flag
135 testfile01 False
136
137
138Redfish Persistency Update Partition File On BMC Reboot
139 [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot.
140 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC_Reboot
141 [Template] Redfish Update Partition File With Same Content
142
143 # file_name reboot_flag
144 testfile01 True
145
146
147Redfish Delete Non Existence Of Partition File
148 [Documentation] Delete the partition file if do not exists.
149 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
150 [Template] Redfish Delete Non Existence Partition File
151
152 # file_name
153 testfile01
Vijay09839e22020-02-05 02:54:44 -0600154
155
156Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500157 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600158 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500159 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600160
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500161 # range
162 1000
Vijay09839e22020-02-05 02:54:44 -0600163
Vijay09839e22020-02-05 02:54:44 -0600164
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500165Non Admin Users Fail To Upload Partition File
166 [Documentation] Non admin user will fail to upload the partition file.
167 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
168 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600169
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500170 # file_name username password role_id
171 500KB_file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600172
173
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500174Non Admin User Delete Non Existence Of Partition File
175 [Documentation] Delete the partion file if does not exists.
176 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
177 [Template] Non Admin Delete Non Existence Partition File
178
179 # file_name username password role_id
180 500KB_file operator_user TestPwd123 Operator
181
182
183Redfish Update Wrong Partition File To BMC
184 [Documentation] Upload partition file to BMC by wrong URI using redfish.
185 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
186 [Template] Verify Update Wrong Partition File To BMC
187
188 # file_name
189 500KB_file
190
Vijayfcdadc52020-01-21 01:48:19 -0600191*** Keywords ***
192
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500193Suite Setup Execution
194 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600195
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500196 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600197
198
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500199Test Teardown Execution
200 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600201
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500202 Delete All BMC Partition File ${HTTP_OK}
203 FFDC On Test Case Fail
204
205
206Suite Teardown Execution
207 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600208
209 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600210
211
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500212Delete Local Partition File
213 [Documentation] Delete local partition file.
214 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600215
216 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500217 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600218
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500219 FOR ${conf_file} IN @{file_name}
220 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
221 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
222 END
Vijayfcdadc52020-01-21 01:48:19 -0600223
Vijayfcdadc52020-01-21 01:48:19 -0600224
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500225Create Partition File
226 [Documentation] Create Partition file.
227 [Arguments] ${file_name}
228
229 # Description of argument(s):
230 # file_name Partition file name.
231
232 Delete Local Partition File ${file_name}
233
234 FOR ${conf_file} IN @{file_name}
235 @{words}= Split String ${conf_file} _
236 Run dd if=/dev/zero of=${conf_file} bs=1 count=0 seek=${words}[-0]
237 OperatingSystem.File Should Exist ${conf_file}
238 END
239
240
241Delete BMC Partition File
242 [Documentation] Delete single partition file on BMC via redfish.
243 [Arguments] ${file_name} ${status_code} ${expected_message}
244
245 # Description of argument(s):
246 # file_name Partition file name.
247 # status_code HTTPS status code.
248 # expected_message Expected message of URI.
249
250 FOR ${conf_file} IN @{file_name}
251 ${data}= Create Dictionary
252 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
253 Set To Dictionary ${data} headers ${headers}
254
255 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
256 Should Be Equal As Strings ${resp.status_code} ${status_code}
257
258 Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN}
259 ... Should Be Equal As Strings ${resp.text} ${expected_message}
260 ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK}
261 ... Return Description Of Response ${resp.text}
262 Run Keyword If '${description}' != 'None'
263 ... Should Be Equal As Strings ${description} ${expected_message}
264 END
265
266
267Delete All BMC Partition File
268 [Documentation] Delete multiple partition file on BMC via redfish.
269 [Arguments] ${status_code}
270
271 # Description of argument(s):
272 # status_code HTTPS status code.
273
274 Initialize OpenBMC
275 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600276 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600277 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600278
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500279 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
280 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600281
282
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500283Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600284 [Documentation] Return description of REST response.
285 [Arguments] ${resp_text}
286
287 # Description of argument(s):
288 # resp_text REST response body.
289
290 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500291 # {
292 # "Description": "File Created"
293 # }
Vijay09839e22020-02-05 02:54:44 -0600294
295 ${message}= Evaluate json.loads('''${resp_text}''') json
296
297 [Return] ${message["Description"]}
298
299
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500300Upload Partition File To BMC
301 [Documentation] Upload partition file to BMC.
302 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True}
Vijay09839e22020-02-05 02:54:44 -0600303
304 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500305 # file_name Partition file name.
306 # status_code HTTPS status code.
307 # expected_message Expected message of URI.
308 # flag If True run part of program, else skip.
Vijay09839e22020-02-05 02:54:44 -0600309
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500310 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
311 FOR ${conf_file} IN @{file_name}
312 # Get the content of the file and upload to BMC.
313 ${image_data}= OperatingSystem.Get Binary File ${conf_file}
314 ${data}= Create Dictionary data ${image_data}
315 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
316 Set To Dictionary ${data} headers ${headers}
Vijay09839e22020-02-05 02:54:44 -0600317
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500318 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
319 Should Be Equal As Strings ${resp.status_code} ${status_code}
320
321 Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN}
322 ... Should Be Equal As Strings ${resp.text} ${expected_message}
323 ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK}
324 ... Return Description Of Response ${resp.text}
325 Run Keyword If '${description}' != 'None'
326 ... Should Be Equal As Strings ${description} ${expected_message}
327 END
Vijayfcdadc52020-01-21 01:48:19 -0600328
329
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500330Verify Partition File On BMC
331 [Documentation] Verify partition file on BMC.
332 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600333
334 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500335 # file_name Partition file name.
336 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600337
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500338 FOR ${conf_file} IN @{file_name}
339 ${status} ${stderr} ${rc}= BMC Execute Command
340 ... ls -l /var/lib/obmc/bmc-console-mgmt/save-area/${conf_file} | wc -l
341 Valid Value ${status} [${Partition_status}]
342 END
Vijayfcdadc52020-01-21 01:48:19 -0600343
344
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500345Redfish Upload Partition File
346 [Documentation] Upload the partition file.
Vijayfcdadc52020-01-21 01:48:19 -0600347 [Arguments] ${file_name}
348
349 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500350 # file_name Partition file name.
Vijayfcdadc52020-01-21 01:48:19 -0600351
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500352 @{Partition_file_list} = Split String ${file_name} ,
353 ${num_records}= Get Length ${Partition_file_list}
354 Create Partition File ${Partition_file_list}
355 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
356 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
357 Run Keyword If ${num_records} == ${1}
358 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
359 ... ELSE
360 ... Delete All BMC Partition File ${HTTP_OK}
361 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600362
363
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500364Redfish Fail To Upload Partition File
365 [Documentation] Fail to uplaod the partition file.
366 [Arguments] ${file_name}
Vijay09839e22020-02-05 02:54:44 -0600367
368 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500369 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600370
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500371 @{Partition_file_list} = Split String ${file_name} ,
372 Create Partition File ${Partition_file_list}
373 Upload Partition File To BMC ${Partition_file_list} ${HTTP_BAD_REQUEST} ${MAXIMUM_SIZE_MESSAGE}
374 Verify Partition File On BMC ${Partition_file_list} Partition_status=0
375 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND}
376 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600377
378
Sushil Singh5d0782f2020-11-23 06:35:35 -0600379Verify Partition File Upload Post BMC Reboot
380 [Documentation] Upload the partition file, after BMC reboot.
381 [Arguments] ${file_name}
382
383 # Description of argument(s):
384 # file_name Partition file name.
385
386 Redfish OBMC Reboot (off)
387
388 Redfish Upload Partition File ${file_name}
389
390
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500391Redfish Partition File Persistency
392 [Documentation] Upload the partition file and check for persistency after reboot.
393 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600394
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500395 # Description of argument(s):
396 # file_name Partition file name.
397
398 @{Partition_file_list} = Split String ${file_name} ,
399 ${num_records}= Get Length ${Partition_file_list}
400 Create Partition File ${Partition_file_list}
401 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
402 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
403 Redfish OBMC Reboot (off)
404 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600405 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500406 Run Keyword If ${num_records} == ${1}
407 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
408 ... ELSE
409 ... Delete All BMC Partition File ${HTTP_OK}
410 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600411
412
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500413Verify Redfish Partition File Content
414 [Documentation] Verify partition file content.
415 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600416
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500417 # Description of argument(s):
418 # file_name Partition file name.
419 # content_dict Dict contain the content.
420 # status_code HTTPS status code.
421
422 FOR ${conf_file} IN @{file_name}
423 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
424 Should Be Equal As Strings ${resp.status_code} ${status_code}
425
426 ${Partition_file_data}= Remove String ${resp.text} \\n
427 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
428 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
429 END
Vijayfcdadc52020-01-21 01:48:19 -0600430
Vijay39373152020-02-14 08:08:20 -0600431
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500432Add Content To Files
433 [Documentation] Add defined content in partition file.
434 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600435
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500436 # Description of argument(s):
437 # file_name Partition file name.
438 # index Index
439
440 ${num_records}= Get Length ${file_name}
441 Set Test Variable ${content-1} Sample Content to test partition file upload
442 Set Test Variable ${content-2} Sample Content to test partition file upload after reboot
443 &{content_dict}= Create Dictionary
444 FOR ${conf_file} IN @{file_name}
445 ${index}= Get Index From List ${file_name} ${conf_file}
446 ${index}= Evaluate ${index} + 1
447
448 Run echo "${content-${index}}" > ${conf_file}
449 OperatingSystem.File Should Exist ${conf_file}
450
451 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
452 END
453
454 [Return] &{content_dict}
455
456
457Redfish Read Partition File
458 [Documentation] Read partition file content.
459 [Arguments] ${file_name} ${reboot_flag}=False
460
461 # Description of argument(s):
462 # file_name Partition file name.
463 # reboot_flag Reboot flag.
464
465 @{Partition_file_list} = Split String ${file_name} ,
466 ${content_dict}= Add Content To Files ${Partition_file_list}
467
468 ${num_records}= Get Length ${Partition_file_list}
469
470 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
471 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
472 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
473
474 Run Keyword If ${True} == ${reboot_flag}
475 ... Run Keywords Redfish OBMC Reboot (off) AND
476 ... Initialize OpenBMC AND
477 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
478 Run Keyword If ${num_records} == ${1}
479 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
480 ... ELSE
481 ... Delete All BMC Partition File ${HTTP_OK}
482 Delete Local Partition File ${Partition_file_list}
483
484
485Redfish Update Partition File With Same Content
486 [Documentation] Update partition file with same content.
487 [Arguments] ${file_name} ${reboot_flag}=False
488
489 # Description of argument(s):
490 # file_name Partition file name.
491 # reboot_flag Reboot flag.
492
493 @{Partition_file_list} = Split String ${file_name} ,
494 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
495
496 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
497 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
498 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
499
500 Run Keyword If ${True} == ${reboot_flag}
501 ... Run Keywords Redfish OBMC Reboot (off) AND
502 ... Initialize OpenBMC
503
504 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
505 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
506 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
507 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
508
509 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
510 Delete Local Partition File ${Partition_file_list}
511
512
513Redfish Update Partition File With Different Content
514 [Documentation] Update partition file with different content.
515 [Arguments] ${file_name} ${reboot_flag}=False
516
517 # Description of argument(s):
518 # file_name Partition file name.
519 # reboot_flag Reboot flag.
520
521 @{Partition_file_list} = Split String ${file_name} ,
522 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
523
524 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
525 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
526 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
527
528 Run Keyword If ${True} == ${reboot_flag}
529 ... Run Keywords Redfish OBMC Reboot (off) AND
530 ... Initialize OpenBMC
531
532 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
533 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
534 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
535 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
536
537 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
538 Delete Local Partition File ${Partition_file_list}
539
540
541Create File Names
542 [Documentation] Create partition file names.
543 [Arguments] ${range}
544
545 # Description of argument(s):
546 # range Range in numbers.
547
548 @{file_name_list}= Create List
549 Set Test Variable ${file_name} rangefile
550 FOR ${count} IN RANGE ${range}
551 Append To List ${file_name_list} 200KB_file${count}
552 END
553 [Return] ${file_name_list}
554
555
556Redfish Upload Partition File With Range
557 [Documentation] Upload the partition file with the range of files.
558 [Arguments] ${range}
559
560 # Description of argument(s):
561 # range Range in numbers.
562
563 ${Partition_file_list}= Create File Names ${range}
564 Create Partition File ${Partition_file_list}
565 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
566 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
567 Delete All BMC Partition File ${HTTP_OK}
568 Delete Local Partition File ${Partition_file_list}
569
570
571Redfish Delete Non Existence Partition File
572 [Documentation] Delete the partition file if do not exists.
573 [Arguments] ${file_name}
574
575 # Description of argument(s):
576 # file_name Partition file name.
577
578 @{Partition_file_list} = Split String ${file_name} ,
579 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND}
580
581
582Non Admin User To Upload Partition File
583 [Documentation] Non admin user to uplaod the partition file.
584 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
585
586 # Description of argument(s):
587 # file_name Partition file name.
588 # username Username.
589 # password Password.
590 # role Role of user.
591 # enabled Value can be True or False.
592
593 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600594 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500595 Initialize OpenBMC rest_username=${username} rest_password=${password}
596 @{Partition_file_list} = Split String ${file_name} ,
597 Create Partition File ${Partition_file_list}
598 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
599 Delete Local Partition File ${Partition_file_list}
600 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
601
602
603Non Admin Delete Non Existence Partition File
604 [Documentation] Non admin user to uplaod the partition file.
605 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
606
607 # Description of argument(s):
608 # file_name Partition file name.
609 # username Username.
610 # password Password.
611 # role Role of user.
612 # enabled Value can be True or False.
613
614 Redfish Create User ${username} ${password} ${role} ${enabled}
615 Delete All Sessions
616 Initialize OpenBMC rest_username=${username} rest_password=${password}
617 @{Partition_file_list} = Split String ${file_name} ,
618 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
619
620
621Verify Update Wrong Partition File To BMC
622 [Documentation] Upload the wrong partition file to BMC.
623 [Arguments] ${file_name}
624
625 # Description of argument(s):
626 # file_name Partition file name.
627
628 Redfish.Login
629 ${resp}= Run Keyword And Return Status
630 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
631 Should Be Equal As Strings ${resp} False