blob: ed97552f98c3a477117df6d8de543f2439f3ec3c [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 Singhcbbce6a2020-09-07 00:57:37 -050064Redfish Partition File Persistency On BMC Reboot
65 [Documentation] Upload partition file to BMC using redfish and is same after reboot.
66 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
67 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -060068
Sushil Singhcbbce6a2020-09-07 00:57:37 -050069 # file_name
70 500KB_file
Vijay09839e22020-02-05 02:54:44 -060071
72
Sushil Singhcbbce6a2020-09-07 00:57:37 -050073Redfish Multiple Partition File Persistency On BMC Reboot
74 [Documentation] Upload partition file to BMC using redfish and is same after reboot.
75 [Tags] Redfish_Multiple_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 250KB_file,500KB_file
Vijay09839e22020-02-05 02:54:44 -060080
81
Sushil Singhcbbce6a2020-09-07 00:57:37 -050082Redfish Read Partition File On BMC
83 [Documentation] Upload partition file to BMC using redfish and verify the content.
84 [Tags] Redfish_Read_Partition_File_On_BMC
85 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -060086
Sushil Singhcbbce6a2020-09-07 00:57:37 -050087 # file_name reboot_flag
88 testfile False
89 testfile01,testfile02 False
Vijay09839e22020-02-05 02:54:44 -060090
Vijay09839e22020-02-05 02:54:44 -060091
Sushil Singhcbbce6a2020-09-07 00:57:37 -050092Redfish Read Partition File On BMC Reboot
93 [Documentation] Upload partition file to BMC using redfish and verify the content after reboot.
94 [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot
95 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -060096
Sushil Singhcbbce6a2020-09-07 00:57:37 -050097 # file_name reboot_flag
98 testfile True
99 testfile01,testfile02 True
Vijay09839e22020-02-05 02:54:44 -0600100
Vijay09839e22020-02-05 02:54:44 -0600101
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500102Redfish Update Partition File On BMC
103 [Documentation] Upload partition file to BMC using redfish and verify the content.
104 [Tags] Redfish_Update_Partition_File_On_BMC
105 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600106
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500107 # file_name reboot_flag
108 testfile01 False
109
110
111Redfish Update Partition File On BMC Reboot
112 [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot.
113 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
114 [Template] Redfish Update Partition File With Different Content
115
116 # file_name reboot_flag
117 testfile01 True
118
119
120Redfish Persistency Update Partition File On BMC
121 [Documentation] Upload partition file to BMC using redfish and verify the content.
122 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
123 [Template] Redfish Update Partition File With Same Content
124
125 # file_name reboot_flag
126 testfile01 False
127
128
129Redfish Persistency 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_Persistency_Update_Partition_File_On_BMC_Reboot
132 [Template] Redfish Update Partition File With Same Content
133
134 # file_name reboot_flag
135 testfile01 True
136
137
138Redfish Delete Non Existence Of Partition File
139 [Documentation] Delete the partition file if do not exists.
140 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
141 [Template] Redfish Delete Non Existence Partition File
142
143 # file_name
144 testfile01
Vijay09839e22020-02-05 02:54:44 -0600145
146
147Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500148 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600149 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500150 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600151
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500152 # range
153 1000
Vijay09839e22020-02-05 02:54:44 -0600154
Vijay09839e22020-02-05 02:54:44 -0600155
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500156Non Admin Users Fail To Upload Partition File
157 [Documentation] Non admin user will fail to upload the partition file.
158 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
159 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600160
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500161 # file_name username password role_id
162 500KB_file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600163
164
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500165Non Admin User Delete Non Existence Of Partition File
166 [Documentation] Delete the partion file if does not exists.
167 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
168 [Template] Non Admin Delete Non Existence Partition File
169
170 # file_name username password role_id
171 500KB_file operator_user TestPwd123 Operator
172
173
174Redfish Update Wrong Partition File To BMC
175 [Documentation] Upload partition file to BMC by wrong URI using redfish.
176 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
177 [Template] Verify Update Wrong Partition File To BMC
178
179 # file_name
180 500KB_file
181
Vijayfcdadc52020-01-21 01:48:19 -0600182*** Keywords ***
183
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500184Suite Setup Execution
185 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600186
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500187 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600188
189
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500190Test Teardown Execution
191 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600192
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500193 Delete All BMC Partition File ${HTTP_OK}
194 FFDC On Test Case Fail
195
196
197Suite Teardown Execution
198 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600199
200 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600201
202
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500203Delete Local Partition File
204 [Documentation] Delete local partition file.
205 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600206
207 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500208 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600209
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500210 FOR ${conf_file} IN @{file_name}
211 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
212 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
213 END
Vijayfcdadc52020-01-21 01:48:19 -0600214
Vijayfcdadc52020-01-21 01:48:19 -0600215
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500216Create Partition File
217 [Documentation] Create Partition file.
218 [Arguments] ${file_name}
219
220 # Description of argument(s):
221 # file_name Partition file name.
222
223 Delete Local Partition File ${file_name}
224
225 FOR ${conf_file} IN @{file_name}
226 @{words}= Split String ${conf_file} _
227 Run dd if=/dev/zero of=${conf_file} bs=1 count=0 seek=${words}[-0]
228 OperatingSystem.File Should Exist ${conf_file}
229 END
230
231
232Delete BMC Partition File
233 [Documentation] Delete single partition file on BMC via redfish.
234 [Arguments] ${file_name} ${status_code} ${expected_message}
235
236 # Description of argument(s):
237 # file_name Partition file name.
238 # status_code HTTPS status code.
239 # expected_message Expected message of URI.
240
241 FOR ${conf_file} IN @{file_name}
242 ${data}= Create Dictionary
243 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
244 Set To Dictionary ${data} headers ${headers}
245
246 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
247 Should Be Equal As Strings ${resp.status_code} ${status_code}
248
249 Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN}
250 ... Should Be Equal As Strings ${resp.text} ${expected_message}
251 ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK}
252 ... Return Description Of Response ${resp.text}
253 Run Keyword If '${description}' != 'None'
254 ... Should Be Equal As Strings ${description} ${expected_message}
255 END
256
257
258Delete All BMC Partition File
259 [Documentation] Delete multiple partition file on BMC via redfish.
260 [Arguments] ${status_code}
261
262 # Description of argument(s):
263 # status_code HTTPS status code.
264
265 Initialize OpenBMC
266 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600267 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600268 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600269
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500270 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
271 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600272
273
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500274Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600275 [Documentation] Return description of REST response.
276 [Arguments] ${resp_text}
277
278 # Description of argument(s):
279 # resp_text REST response body.
280
281 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500282 # {
283 # "Description": "File Created"
284 # }
Vijay09839e22020-02-05 02:54:44 -0600285
286 ${message}= Evaluate json.loads('''${resp_text}''') json
287
288 [Return] ${message["Description"]}
289
290
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500291Upload Partition File To BMC
292 [Documentation] Upload partition file to BMC.
293 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True}
Vijay09839e22020-02-05 02:54:44 -0600294
295 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500296 # file_name Partition file name.
297 # status_code HTTPS status code.
298 # expected_message Expected message of URI.
299 # flag If True run part of program, else skip.
Vijay09839e22020-02-05 02:54:44 -0600300
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500301 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
302 FOR ${conf_file} IN @{file_name}
303 # Get the content of the file and upload to BMC.
304 ${image_data}= OperatingSystem.Get Binary File ${conf_file}
305 ${data}= Create Dictionary data ${image_data}
306 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
307 Set To Dictionary ${data} headers ${headers}
Vijay09839e22020-02-05 02:54:44 -0600308
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500309 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
310 Should Be Equal As Strings ${resp.status_code} ${status_code}
311
312 Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN}
313 ... Should Be Equal As Strings ${resp.text} ${expected_message}
314 ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK}
315 ... Return Description Of Response ${resp.text}
316 Run Keyword If '${description}' != 'None'
317 ... Should Be Equal As Strings ${description} ${expected_message}
318 END
Vijayfcdadc52020-01-21 01:48:19 -0600319
320
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500321Verify Partition File On BMC
322 [Documentation] Verify partition file on BMC.
323 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600324
325 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500326 # file_name Partition file name.
327 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600328
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500329 FOR ${conf_file} IN @{file_name}
330 ${status} ${stderr} ${rc}= BMC Execute Command
331 ... ls -l /var/lib/obmc/bmc-console-mgmt/save-area/${conf_file} | wc -l
332 Valid Value ${status} [${Partition_status}]
333 END
Vijayfcdadc52020-01-21 01:48:19 -0600334
335
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500336Redfish Upload Partition File
337 [Documentation] Upload the partition file.
Vijayfcdadc52020-01-21 01:48:19 -0600338 [Arguments] ${file_name}
339
340 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500341 # file_name Partition file name.
Vijayfcdadc52020-01-21 01:48:19 -0600342
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500343 @{Partition_file_list} = Split String ${file_name} ,
344 ${num_records}= Get Length ${Partition_file_list}
345 Create Partition File ${Partition_file_list}
346 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
347 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
348 Run Keyword If ${num_records} == ${1}
349 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
350 ... ELSE
351 ... Delete All BMC Partition File ${HTTP_OK}
352 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600353
354
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500355Redfish Fail To Upload Partition File
356 [Documentation] Fail to uplaod the partition file.
357 [Arguments] ${file_name}
Vijay09839e22020-02-05 02:54:44 -0600358
359 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500360 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600361
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500362 @{Partition_file_list} = Split String ${file_name} ,
363 Create Partition File ${Partition_file_list}
364 Upload Partition File To BMC ${Partition_file_list} ${HTTP_BAD_REQUEST} ${MAXIMUM_SIZE_MESSAGE}
365 Verify Partition File On BMC ${Partition_file_list} Partition_status=0
366 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND}
367 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600368
369
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500370Redfish Partition File Persistency
371 [Documentation] Upload the partition file and check for persistency after reboot.
372 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600373
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500374 # Description of argument(s):
375 # file_name Partition file name.
376
377 @{Partition_file_list} = Split String ${file_name} ,
378 ${num_records}= Get Length ${Partition_file_list}
379 Create Partition File ${Partition_file_list}
380 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
381 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
382 Redfish OBMC Reboot (off)
383 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600384 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500385 Run Keyword If ${num_records} == ${1}
386 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
387 ... ELSE
388 ... Delete All BMC Partition File ${HTTP_OK}
389 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600390
391
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500392Verify Redfish Partition File Content
393 [Documentation] Verify partition file content.
394 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600395
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500396 # Description of argument(s):
397 # file_name Partition file name.
398 # content_dict Dict contain the content.
399 # status_code HTTPS status code.
400
401 FOR ${conf_file} IN @{file_name}
402 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
403 Should Be Equal As Strings ${resp.status_code} ${status_code}
404
405 ${Partition_file_data}= Remove String ${resp.text} \\n
406 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
407 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
408 END
Vijayfcdadc52020-01-21 01:48:19 -0600409
Vijay39373152020-02-14 08:08:20 -0600410
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500411Add Content To Files
412 [Documentation] Add defined content in partition file.
413 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600414
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500415 # Description of argument(s):
416 # file_name Partition file name.
417 # index Index
418
419 ${num_records}= Get Length ${file_name}
420 Set Test Variable ${content-1} Sample Content to test partition file upload
421 Set Test Variable ${content-2} Sample Content to test partition file upload after reboot
422 &{content_dict}= Create Dictionary
423 FOR ${conf_file} IN @{file_name}
424 ${index}= Get Index From List ${file_name} ${conf_file}
425 ${index}= Evaluate ${index} + 1
426
427 Run echo "${content-${index}}" > ${conf_file}
428 OperatingSystem.File Should Exist ${conf_file}
429
430 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
431 END
432
433 [Return] &{content_dict}
434
435
436Redfish Read Partition File
437 [Documentation] Read partition file content.
438 [Arguments] ${file_name} ${reboot_flag}=False
439
440 # Description of argument(s):
441 # file_name Partition file name.
442 # reboot_flag Reboot flag.
443
444 @{Partition_file_list} = Split String ${file_name} ,
445 ${content_dict}= Add Content To Files ${Partition_file_list}
446
447 ${num_records}= Get Length ${Partition_file_list}
448
449 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
450 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
451 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
452
453 Run Keyword If ${True} == ${reboot_flag}
454 ... Run Keywords Redfish OBMC Reboot (off) AND
455 ... Initialize OpenBMC AND
456 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
457 Run Keyword If ${num_records} == ${1}
458 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
459 ... ELSE
460 ... Delete All BMC Partition File ${HTTP_OK}
461 Delete Local Partition File ${Partition_file_list}
462
463
464Redfish Update Partition File With Same Content
465 [Documentation] Update partition file with same content.
466 [Arguments] ${file_name} ${reboot_flag}=False
467
468 # Description of argument(s):
469 # file_name Partition file name.
470 # reboot_flag Reboot flag.
471
472 @{Partition_file_list} = Split String ${file_name} ,
473 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
474
475 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
476 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
477 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
478
479 Run Keyword If ${True} == ${reboot_flag}
480 ... Run Keywords Redfish OBMC Reboot (off) AND
481 ... Initialize OpenBMC
482
483 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
484 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
485 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
486 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
487
488 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
489 Delete Local Partition File ${Partition_file_list}
490
491
492Redfish Update Partition File With Different Content
493 [Documentation] Update partition file with different content.
494 [Arguments] ${file_name} ${reboot_flag}=False
495
496 # Description of argument(s):
497 # file_name Partition file name.
498 # reboot_flag Reboot flag.
499
500 @{Partition_file_list} = Split String ${file_name} ,
501 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
502
503 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
504 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
505 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
506
507 Run Keyword If ${True} == ${reboot_flag}
508 ... Run Keywords Redfish OBMC Reboot (off) AND
509 ... Initialize OpenBMC
510
511 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
512 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
513 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
514 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
515
516 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
517 Delete Local Partition File ${Partition_file_list}
518
519
520Create File Names
521 [Documentation] Create partition file names.
522 [Arguments] ${range}
523
524 # Description of argument(s):
525 # range Range in numbers.
526
527 @{file_name_list}= Create List
528 Set Test Variable ${file_name} rangefile
529 FOR ${count} IN RANGE ${range}
530 Append To List ${file_name_list} 200KB_file${count}
531 END
532 [Return] ${file_name_list}
533
534
535Redfish Upload Partition File With Range
536 [Documentation] Upload the partition file with the range of files.
537 [Arguments] ${range}
538
539 # Description of argument(s):
540 # range Range in numbers.
541
542 ${Partition_file_list}= Create File Names ${range}
543 Create Partition File ${Partition_file_list}
544 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
545 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
546 Delete All BMC Partition File ${HTTP_OK}
547 Delete Local Partition File ${Partition_file_list}
548
549
550Redfish Delete Non Existence Partition File
551 [Documentation] Delete the partition file if do not exists.
552 [Arguments] ${file_name}
553
554 # Description of argument(s):
555 # file_name Partition file name.
556
557 @{Partition_file_list} = Split String ${file_name} ,
558 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND}
559
560
561Non Admin User To Upload Partition File
562 [Documentation] Non admin user to uplaod the partition file.
563 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
564
565 # Description of argument(s):
566 # file_name Partition file name.
567 # username Username.
568 # password Password.
569 # role Role of user.
570 # enabled Value can be True or False.
571
572 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600573 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500574 Initialize OpenBMC rest_username=${username} rest_password=${password}
575 @{Partition_file_list} = Split String ${file_name} ,
576 Create Partition File ${Partition_file_list}
577 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
578 Delete Local Partition File ${Partition_file_list}
579 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
580
581
582Non Admin Delete Non Existence 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}
594 Delete All Sessions
595 Initialize OpenBMC rest_username=${username} rest_password=${password}
596 @{Partition_file_list} = Split String ${file_name} ,
597 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
598
599
600Verify Update Wrong Partition File To BMC
601 [Documentation] Upload the wrong partition file to BMC.
602 [Arguments] ${file_name}
603
604 # Description of argument(s):
605 # file_name Partition file name.
606
607 Redfish.Login
608 ${resp}= Run Keyword And Return Status
609 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
610 Should Be Equal As Strings ${resp} False