blob: e64dfc9fc59d2400caea8295c885aeed54c8ea19 [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
Sushil Singh85c381c2021-08-17 23:25:10 -050026${content-1} Set Test Variable Sample Content to test partition file upload
27... Sample Content to test partition file upload
28... Sample Content to test partition file upload
29${content-2} Set Test Variable Sample Content to test partition file upload after reboot
30... Sample Content to test partition file upload after reboot
31... Sample Content to test partition file upload after reboot
32
Vijayfcdadc52020-01-21 01:48:19 -060033*** Test Cases ***
34
Sushil Singhcbbce6a2020-09-07 00:57:37 -050035Redfish Upload Partition File To BMC
36 [Documentation] Upload partition file to BMC using redfish.
37 [Tags] Redfish_Upload_Partition_File_To_BMC
38 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060039
Sushil Singhcbbce6a2020-09-07 00:57:37 -050040 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050041 500KB-file
Vijayfcdadc52020-01-21 01:48:19 -060042
43
Sushil Singhcbbce6a2020-09-07 00:57:37 -050044Redfish Fail To Upload Partition File To BMC
45 [Documentation] Fail to upload partition file to BMC using redfish.
46 [Tags] Redfish_Fail_To_Upload_Partition_File_To_BMC
47 [Template] Redfish Fail To Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060048
Sushil Singhcbbce6a2020-09-07 00:57:37 -050049 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050050 501KB-file
Vijayfcdadc52020-01-21 01:48:19 -060051
52
Sushil Singhcbbce6a2020-09-07 00:57:37 -050053Redfish Upload Multiple Partition File To BMC
54 [Documentation] Upload multiple partition file to BMC using redfish.
55 [Tags] Redfish_Upload_Multiple_Partition_File_To_BMC
56 [Template] Redfish Upload Partition File
Vijayfcdadc52020-01-21 01:48:19 -060057
Sushil Singhcbbce6a2020-09-07 00:57:37 -050058 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050059 250KB-file,500KB-file
Vijayfcdadc52020-01-21 01:48:19 -060060
61
Sushil Singhcbbce6a2020-09-07 00:57:37 -050062Redfish Fail To Upload Multiple Partition File To BMC
63 [Documentation] Fail to upload multiple partition file to BMC using redfish.
64 [Tags] Redfish_Fail_To_Upload_Multiple_Partition_File_To_BMC
65 [Template] Redfish Fail To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -060066
Sushil Singhcbbce6a2020-09-07 00:57:37 -050067 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050068 650KB-file,501KB-file
Vijay09839e22020-02-05 02:54:44 -060069
70
Sushil Singhdf6ba522020-11-24 04:17:00 -060071Redfish Upload Same Partition File To BMC In Loop
72 [Documentation] Upload same partition file to BMC using redfish in loop.
73 [Tags] Redfish_Upload_Same_Partition_File_To_BMC_In_Loop
74 [Template] Redfish Upload Partition File In Loop
75
76 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050077 500KB-file
Sushil Singhdf6ba522020-11-24 04:17:00 -060078
79
Sushil Singhf39629c2020-12-11 07:30:21 -060080Redfish Upload And Delete Same Partition File To BMC In Loop
81 [Documentation] Upload same partition file to BMC using redfish in loop.
82 [Tags] Redfish_Upload_And_Delete_Same_Partition_File_To_BMC_In_Loop
83 [Template] Redfish Upload And Delete Partition File In Loop
84
85 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050086 500KB-file
Sushil Singhf39629c2020-12-11 07:30:21 -060087
88
Sushil Singh5d0782f2020-11-23 06:35:35 -060089Redfish Partition File Upload Post BMC Reboot
90 [Documentation] Upload partition file to BMC using redfish, after the BMC reboot.
91 [Tags] Redfish_Partition_File_Upload_Post_BMC_Reboot
92 [Template] Verify Partition File Upload Post BMC Reboot
93
94 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -050095 500KB-file
Sushil Singh5d0782f2020-11-23 06:35:35 -060096
97
Sushil Singhcbbce6a2020-09-07 00:57:37 -050098Redfish Partition File Persistency On BMC Reboot
99 [Documentation] Upload partition file to BMC using redfish and is same after reboot.
100 [Tags] Redfish_Partition_File_Persistency_On_BMC_Reboot
101 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600102
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500103 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500104 500KB-file
Vijay09839e22020-02-05 02:54:44 -0600105
106
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500107Redfish Multiple Partition File Persistency On BMC Reboot
108 [Documentation] Upload partition file to BMC using redfish and is same after reboot.
109 [Tags] Redfish_Multiple_Partition_File_Persistency_On_BMC_Reboot
110 [Template] Redfish Partition File Persistency
Vijay09839e22020-02-05 02:54:44 -0600111
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500112 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500113 250KB-file,500KB-file
Vijay09839e22020-02-05 02:54:44 -0600114
115
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500116Redfish Read Partition File On BMC
117 [Documentation] Upload partition file to BMC using redfish and verify the content.
118 [Tags] Redfish_Read_Partition_File_On_BMC
119 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600120
Sushil Singh85c381c2021-08-17 23:25:10 -0500121 # file_name reboot_flag
122 testfile01-file False
123 testfile01-file,testfile02-file False
Vijay09839e22020-02-05 02:54:44 -0600124
Vijay09839e22020-02-05 02:54:44 -0600125
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500126Redfish Read Partition File On BMC Reboot
127 [Documentation] Upload partition file to BMC using redfish and verify the content after reboot.
128 [Tags] Check_Redfish_Read_Partition_File_On_BMC_Reboot
129 [Template] Redfish Read Partition File
Vijay09839e22020-02-05 02:54:44 -0600130
Sushil Singh85c381c2021-08-17 23:25:10 -0500131 # file_name reboot_flag
132 testfile01-file True
133 testfile01-file,testfile02-file True
Vijay09839e22020-02-05 02:54:44 -0600134
Vijay09839e22020-02-05 02:54:44 -0600135
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500136Redfish Update Partition File On BMC
137 [Documentation] Upload partition file to BMC using redfish and verify the content.
138 [Tags] Redfish_Update_Partition_File_On_BMC
139 [Template] Redfish Update Partition File With Different Content
Vijay09839e22020-02-05 02:54:44 -0600140
Sushil Singh85c381c2021-08-17 23:25:10 -0500141 # file_name reboot_flag
142 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500143
144
145Redfish Update Partition File On BMC Reboot
146 [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot.
147 [Tags] Redfish_Update_Partition_File_On_BMC_Reboot
148 [Template] Redfish Update Partition File With Different Content
149
Sushil Singh85c381c2021-08-17 23:25:10 -0500150 # file_name reboot_flag
151 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500152
153
154Redfish Persistency Update Partition File On BMC
155 [Documentation] Upload partition file to BMC using redfish and verify the content.
156 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC
157 [Template] Redfish Update Partition File With Same Content
158
Sushil Singh85c381c2021-08-17 23:25:10 -0500159 # file_name reboot_flag
160 testfile01-file False
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500161
162
163Redfish Persistency Update Partition File On BMC Reboot
164 [Documentation] Upload partition file to BMC using redfish and verify the content after the reboot.
165 [Tags] Redfish_Persistency_Update_Partition_File_On_BMC_Reboot
166 [Template] Redfish Update Partition File With Same Content
167
Sushil Singh85c381c2021-08-17 23:25:10 -0500168 # file_name reboot_flag
169 testfile01-file True
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500170
171
172Redfish Delete Non Existence Of Partition File
173 [Documentation] Delete the partition file if do not exists.
174 [Tags] Redfish_Delete_Non_Existence_Of_Partition_File
175 [Template] Redfish Delete Non Existence Partition File
176
177 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500178 testfile01-file
Vijay09839e22020-02-05 02:54:44 -0600179
180
181Verify One Thousand Partitions File Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500182 [Documentation] Upload 1000 partition file to BMC.
Vijay09839e22020-02-05 02:54:44 -0600183 [Tags] Verify_One_Thousand_Partitions_File_Upload
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500184 [Template] Redfish Upload Partition File With Range
Vijay09839e22020-02-05 02:54:44 -0600185
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500186 # range
187 1000
Vijay09839e22020-02-05 02:54:44 -0600188
Vijay09839e22020-02-05 02:54:44 -0600189
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500190Non Admin Users Fail To Upload Partition File
191 [Documentation] Non admin user will fail to upload the partition file.
192 [Tags] Non_Admin_Users_Fail_To_Upload_Partition_File
193 [Template] Non Admin User To Upload Partition File
Vijay09839e22020-02-05 02:54:44 -0600194
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500195 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500196 500KB-file operator_user TestPwd123 Operator
Vijay09839e22020-02-05 02:54:44 -0600197
198
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500199Non Admin User Delete Non Existence Of Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600200 [Documentation] Delete the partition file if does not exists.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500201 [Tags] Non_Admin_User_Delete_Non_Existence_Of_Partition_File
202 [Template] Non Admin Delete Non Existence Partition File
203
204 # file_name username password role_id
Sushil Singh85c381c2021-08-17 23:25:10 -0500205 500KB-file operator_user TestPwd123 Operator
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500206
207
208Redfish Update Wrong Partition File To BMC
209 [Documentation] Upload partition file to BMC by wrong URI using redfish.
210 [Tags] Redfish_Update_Wrong_Partition_File_To_BMC
211 [Template] Verify Update Wrong Partition File To BMC
212
213 # file_name
Sushil Singh85c381c2021-08-17 23:25:10 -0500214 500KB-file
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500215
Vijayfcdadc52020-01-21 01:48:19 -0600216*** Keywords ***
217
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500218Suite Setup Execution
219 [Documentation] Suite setup execution.
Vijayfcdadc52020-01-21 01:48:19 -0600220
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500221 Redfish.Login
Vijayfcdadc52020-01-21 01:48:19 -0600222
223
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500224Test Teardown Execution
225 [Documentation] Test teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600226
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500227 Delete All BMC Partition File ${HTTP_OK}
228 FFDC On Test Case Fail
229
230
231Suite Teardown Execution
232 [Documentation] Suite teardown execution.
Vijay09839e22020-02-05 02:54:44 -0600233
234 Delete All Sessions
Vijay09839e22020-02-05 02:54:44 -0600235
236
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500237Delete Local Partition File
238 [Documentation] Delete local partition file.
239 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600240
241 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500242 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600243
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500244 FOR ${conf_file} IN @{file_name}
245 ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist ${conf_file}
246 Run Keyword If 'True' == '${file_exist}' Remove File ${conf_file}
247 END
Vijayfcdadc52020-01-21 01:48:19 -0600248
Vijayfcdadc52020-01-21 01:48:19 -0600249
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500250Create Partition File
251 [Documentation] Create Partition file.
252 [Arguments] ${file_name}
253
254 # Description of argument(s):
255 # file_name Partition file name.
256
257 Delete Local Partition File ${file_name}
258
259 FOR ${conf_file} IN @{file_name}
Sushil Singh85c381c2021-08-17 23:25:10 -0500260 @{words}= Split String ${conf_file} -
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500261 Run dd if=/dev/zero of=${conf_file} bs=1 count=0 seek=${words}[-0]
262 OperatingSystem.File Should Exist ${conf_file}
263 END
264
265
266Delete BMC Partition File
267 [Documentation] Delete single partition file on BMC via redfish.
268 [Arguments] ${file_name} ${status_code} ${expected_message}
269
270 # Description of argument(s):
271 # file_name Partition file name.
272 # status_code HTTPS status code.
273 # expected_message Expected message of URI.
274
275 FOR ${conf_file} IN @{file_name}
276 ${data}= Create Dictionary
277 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
278 Set To Dictionary ${data} headers ${headers}
279
280 ${resp}= Delete Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{data}
281 Should Be Equal As Strings ${resp.status_code} ${status_code}
282
283 Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN}
284 ... Should Be Equal As Strings ${resp.text} ${expected_message}
285 ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK}
286 ... Return Description Of Response ${resp.text}
287 Run Keyword If '${description}' != 'None'
288 ... Should Be Equal As Strings ${description} ${expected_message}
289 END
290
291
292Delete All BMC Partition File
293 [Documentation] Delete multiple partition file on BMC via redfish.
294 [Arguments] ${status_code}
295
296 # Description of argument(s):
297 # status_code HTTPS status code.
298
299 Initialize OpenBMC
300 ${data}= Create Dictionary
Vijayfcdadc52020-01-21 01:48:19 -0600301 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
Vijayfcdadc52020-01-21 01:48:19 -0600302 Set To Dictionary ${data} headers ${headers}
Vijayfcdadc52020-01-21 01:48:19 -0600303
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500304 ${resp}= Post Request openbmc /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll &{data}
305 Should Be Equal As Strings ${resp.status_code} ${status_code}
Vijay09839e22020-02-05 02:54:44 -0600306
307
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500308Return Description Of Response
Vijay09839e22020-02-05 02:54:44 -0600309 [Documentation] Return description of REST response.
310 [Arguments] ${resp_text}
311
312 # Description of argument(s):
313 # resp_text REST response body.
314
315 # resp_text after successful partition file upload looks like:
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500316 # {
317 # "Description": "File Created"
318 # }
Vijay09839e22020-02-05 02:54:44 -0600319
320 ${message}= Evaluate json.loads('''${resp_text}''') json
321
322 [Return] ${message["Description"]}
323
324
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500325Upload Partition File To BMC
326 [Documentation] Upload partition file to BMC.
327 [Arguments] ${file_name} ${status_code} ${expected_message} ${flag}=${True}
Vijay09839e22020-02-05 02:54:44 -0600328
329 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500330 # file_name Partition file name.
331 # status_code HTTPS status code.
332 # expected_message Expected message of URI.
333 # flag If True run part of program, else skip.
Vijay09839e22020-02-05 02:54:44 -0600334
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500335 Run Keyword If '${flag}' == '${True}' Initialize OpenBMC
336 FOR ${conf_file} IN @{file_name}
337 # Get the content of the file and upload to BMC.
338 ${image_data}= OperatingSystem.Get Binary File ${conf_file}
Sushil Singh85c381c2021-08-17 23:25:10 -0500339 ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream
Vijay09839e22020-02-05 02:54:44 -0600340
Sushil Singh85c381c2021-08-17 23:25:10 -0500341 ${kwargs}= Create Dictionary data=${image_data}
342 Set To Dictionary ${kwargs} headers ${headers}
343 ${resp}= Put Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file} &{kwargs} timeout=10
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500344 Should Be Equal As Strings ${resp.status_code} ${status_code}
345
346 Run Keyword If ${resp.status_code} == ${HTTP_FORBIDDEN}
347 ... Should Be Equal As Strings ${resp.text} ${expected_message}
348 ${description}= Run Keyword If ${resp.status_code} == ${HTTP_OK}
349 ... Return Description Of Response ${resp.text}
350 Run Keyword If '${description}' != 'None'
351 ... Should Be Equal As Strings ${description} ${expected_message}
352 END
Vijayfcdadc52020-01-21 01:48:19 -0600353
354
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500355Verify Partition File On BMC
356 [Documentation] Verify partition file on BMC.
357 [Arguments] ${file_name} ${Partition_status}
Vijayfcdadc52020-01-21 01:48:19 -0600358
359 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500360 # file_name Partition file name.
361 # Partition_status Partition file status on BMC.
Vijayfcdadc52020-01-21 01:48:19 -0600362
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500363 FOR ${conf_file} IN @{file_name}
364 ${status} ${stderr} ${rc}= BMC Execute Command
Sushil Singhe5f39ee2021-01-06 00:39:12 -0600365 ... ls -l /var/lib/bmcweb/ibm-management-console/configfiles/${conf_file} | wc -l
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500366 Valid Value ${status} [${Partition_status}]
367 END
Vijayfcdadc52020-01-21 01:48:19 -0600368
369
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500370Redfish Upload Partition File
371 [Documentation] Upload the partition file.
Vijayfcdadc52020-01-21 01:48:19 -0600372 [Arguments] ${file_name}
373
374 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500375 # file_name Partition file name.
Vijayfcdadc52020-01-21 01:48:19 -0600376
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500377 @{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 Run Keyword If ${num_records} == ${1}
383 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
384 ... ELSE
385 ... Delete All BMC Partition File ${HTTP_OK}
386 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600387
388
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500389Redfish Fail To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600390 [Documentation] Fail to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500391 [Arguments] ${file_name}
Vijay09839e22020-02-05 02:54:44 -0600392
393 # Description of argument(s):
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500394 # file_name Partition file name.
Vijay09839e22020-02-05 02:54:44 -0600395
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500396 @{Partition_file_list} = Split String ${file_name} ,
397 Create Partition File ${Partition_file_list}
398 Upload Partition File To BMC ${Partition_file_list} ${HTTP_BAD_REQUEST} ${MAXIMUM_SIZE_MESSAGE}
399 Verify Partition File On BMC ${Partition_file_list} Partition_status=0
400 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND}
401 Delete Local Partition File ${Partition_file_list}
Vijay09839e22020-02-05 02:54:44 -0600402
403
Sushil Singhdf6ba522020-11-24 04:17:00 -0600404Redfish Upload Partition File In Loop
405 [Documentation] Upload the same partition file multiple times in loop to BMC.
406 [Arguments] ${file_name}
407
408 # Description of argument(s):
409 # file_name Partition file name.
410
411 @{Partition_file_list} = Split String ${file_name} ,
412 Create Partition File ${Partition_file_list}
413
414 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
415 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
416
417 FOR ${count} IN RANGE 1 11
418 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
419 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
420 END
421
422 Initialize OpenBMC
423 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
424 Delete Local Partition File ${Partition_file_list}
425
426
Sushil Singhf39629c2020-12-11 07:30:21 -0600427Redfish Upload And Delete Partition File In Loop
428 [Documentation] Upload the same partition file multiple times in loop to BMC.
429 [Arguments] ${file_name}
430
431 # Description of argument(s):
432 # file_name Partition file name.
433
434 FOR ${count} IN RANGE 1 11
435 Redfish Upload Partition File ${file_name}
436 END
437
438
Sushil Singh5d0782f2020-11-23 06:35:35 -0600439Verify Partition File Upload Post BMC Reboot
440 [Documentation] Upload the partition file, after BMC reboot.
441 [Arguments] ${file_name}
442
443 # Description of argument(s):
444 # file_name Partition file name.
445
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600446 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
447 Redfish BMC Reset Operation
448 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
449
450 Is BMC Standby
Sushil Singh5d0782f2020-11-23 06:35:35 -0600451
452 Redfish Upload Partition File ${file_name}
453
454
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500455Redfish Partition File Persistency
456 [Documentation] Upload the partition file and check for persistency after reboot.
457 [Arguments] ${file_name}
Vijayfcdadc52020-01-21 01:48:19 -0600458
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500459 # Description of argument(s):
460 # file_name Partition file name.
461
462 @{Partition_file_list} = Split String ${file_name} ,
463 ${num_records}= Get Length ${Partition_file_list}
464 Create Partition File ${Partition_file_list}
465 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
466 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600467
468 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
469 Redfish BMC Reset Operation
470 Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token}
471
472 Is BMC Standby
473
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500474 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
Vijayfcdadc52020-01-21 01:48:19 -0600475 Initialize OpenBMC
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500476 Run Keyword If ${num_records} == ${1}
477 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
478 ... ELSE
479 ... Delete All BMC Partition File ${HTTP_OK}
480 Delete Local Partition File ${Partition_file_list}
Vijayfcdadc52020-01-21 01:48:19 -0600481
482
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500483Verify Redfish Partition File Content
484 [Documentation] Verify partition file content.
485 [Arguments] ${file_name} ${content_dict} ${status_code}
Vijayfcdadc52020-01-21 01:48:19 -0600486
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500487 # Description of argument(s):
488 # file_name Partition file name.
489 # content_dict Dict contain the content.
490 # status_code HTTPS status code.
491
492 FOR ${conf_file} IN @{file_name}
493 ${resp}= Get Request openbmc /ibm/v1/Host/ConfigFiles/${conf_file}
494 Should Be Equal As Strings ${resp.status_code} ${status_code}
495
496 ${Partition_file_data}= Remove String ${resp.text} \\n
497 ${Partition_file_data}= Evaluate json.loads('''${Partition_file_data}''') json
498 Should Be Equal As Strings ${Partition_file_data["Data"]} ${content_dict['${conf_file}']}
499 END
Vijayfcdadc52020-01-21 01:48:19 -0600500
Vijay39373152020-02-14 08:08:20 -0600501
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500502Add Content To Files
503 [Documentation] Add defined content in partition file.
504 [Arguments] ${file_name} ${index}=${0}
Vijay39373152020-02-14 08:08:20 -0600505
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500506 # Description of argument(s):
507 # file_name Partition file name.
508 # index Index
509
510 ${num_records}= Get Length ${file_name}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500511 &{content_dict}= Create Dictionary
Sushil Singh85c381c2021-08-17 23:25:10 -0500512
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500513 FOR ${conf_file} IN @{file_name}
514 ${index}= Get Index From List ${file_name} ${conf_file}
515 ${index}= Evaluate ${index} + 1
516
517 Run echo "${content-${index}}" > ${conf_file}
518 OperatingSystem.File Should Exist ${conf_file}
519
520 Set To Dictionary ${content_dict} ${conf_file} ${content-${index}}
521 END
522
523 [Return] &{content_dict}
524
525
526Redfish Read Partition File
527 [Documentation] Read partition file content.
528 [Arguments] ${file_name} ${reboot_flag}=False
529
530 # Description of argument(s):
531 # file_name Partition file name.
532 # reboot_flag Reboot flag.
533
534 @{Partition_file_list} = Split String ${file_name} ,
535 ${content_dict}= Add Content To Files ${Partition_file_list}
536
537 ${num_records}= Get Length ${Partition_file_list}
538
539 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
540 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
541 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
542
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600543 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
544
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500545 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600546 ... Run Keywords Redfish BMC Reset Operation AND
547 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
548 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500549 ... Initialize OpenBMC AND
550 ... Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600551
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500552 Run Keyword If ${num_records} == ${1}
553 ... Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
554 ... ELSE
555 ... Delete All BMC Partition File ${HTTP_OK}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600556
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500557 Delete Local Partition File ${Partition_file_list}
558
559
560Redfish Update Partition File With Same Content
561 [Documentation] Update partition file with same content.
562 [Arguments] ${file_name} ${reboot_flag}=False
563
564 # Description of argument(s):
565 # file_name Partition file name.
566 # reboot_flag Reboot flag.
567
568 @{Partition_file_list} = Split String ${file_name} ,
569 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
570
571 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
572 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
573 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
574
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600575 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
576
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500577 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600578 ... Run Keywords Redfish BMC Reset Operation AND
579 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
580 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500581 ... Initialize OpenBMC
582
583 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
584 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
585 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
586 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
587
588 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
589 Delete Local Partition File ${Partition_file_list}
590
591
592Redfish Update Partition File With Different Content
593 [Documentation] Update partition file with different content.
594 [Arguments] ${file_name} ${reboot_flag}=False
595
596 # Description of argument(s):
597 # file_name Partition file name.
598 # reboot_flag Reboot flag.
599
600 @{Partition_file_list} = Split String ${file_name} ,
601 ${content_dict}= Add Content To Files ${Partition_file_list} ${0}
602
603 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
604 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
605 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
606
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600607 ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN}
608
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500609 Run Keyword If ${True} == ${reboot_flag}
Sushil Singh98ebdfa2021-02-10 04:24:06 -0600610 ... Run Keywords Redfish BMC Reset Operation AND
611 ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND
612 ... Is BMC Standby AND
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500613 ... Initialize OpenBMC
614
615 ${content_dict}= Add Content To Files ${Partition_file_list} ${1}
616 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPDATED}
617 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
618 Verify Redfish Partition File Content ${Partition_file_list} ${content_dict} ${HTTP_OK}
619
620 Delete BMC Partition File ${Partition_file_list} ${HTTP_OK} ${FILE_DELETED_MESSAGE}
621 Delete Local Partition File ${Partition_file_list}
622
623
624Create File Names
625 [Documentation] Create partition file names.
626 [Arguments] ${range}
627
628 # Description of argument(s):
629 # range Range in numbers.
630
631 @{file_name_list}= Create List
632 Set Test Variable ${file_name} rangefile
633 FOR ${count} IN RANGE ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500634 Append To List ${file_name_list} 1KB-file${count}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500635 END
636 [Return] ${file_name_list}
637
638
639Redfish Upload Partition File With Range
640 [Documentation] Upload the partition file with the range of files.
641 [Arguments] ${range}
642
643 # Description of argument(s):
644 # range Range in numbers.
645
646 ${Partition_file_list}= Create File Names ${range}
Sushil Singh85c381c2021-08-17 23:25:10 -0500647 Delete Local Partition File ${Partition_file_list}
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500648 Create Partition File ${Partition_file_list}
649 Upload Partition File To BMC ${Partition_file_list} ${HTTP_OK} ${FILE_UPLOAD_MESSAGE}
650 Verify Partition File On BMC ${Partition_file_list} Partition_status=1
651 Delete All BMC Partition File ${HTTP_OK}
652 Delete Local Partition File ${Partition_file_list}
653
654
655Redfish Delete Non Existence Partition File
656 [Documentation] Delete the partition file if do not exists.
657 [Arguments] ${file_name}
658
659 # Description of argument(s):
660 # file_name Partition file name.
661
662 @{Partition_file_list} = Split String ${file_name} ,
663 Delete BMC Partition File ${Partition_file_list} ${HTTP_NOT_FOUND} ${RESOURCE_NOT_FOUND}
664
665
666Non Admin User To Upload Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600667 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500668 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
669
670 # Description of argument(s):
671 # file_name Partition file name.
672 # username Username.
673 # password Password.
674 # role Role of user.
675 # enabled Value can be True or False.
676
677 Redfish Create User ${username} ${password} ${role} ${enabled}
Vijay39373152020-02-14 08:08:20 -0600678 Delete All Sessions
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500679 Initialize OpenBMC rest_username=${username} rest_password=${password}
680 @{Partition_file_list} = Split String ${file_name} ,
681 Create Partition File ${Partition_file_list}
682 Upload Partition File To BMC ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE} ${False}
683 Delete Local Partition File ${Partition_file_list}
684 Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
685
686
687Non Admin Delete Non Existence Partition File
George Keishing16b3c7b2021-01-28 09:23:37 -0600688 [Documentation] Non admin user to upload the partition file.
Sushil Singhcbbce6a2020-09-07 00:57:37 -0500689 [Arguments] ${file_name} ${username} ${password} ${role} ${enabled}=${True}
690
691 # Description of argument(s):
692 # file_name Partition file name.
693 # username Username.
694 # password Password.
695 # role Role of user.
696 # enabled Value can be True or False.
697
698 Redfish Create User ${username} ${password} ${role} ${enabled}
699 Delete All Sessions
700 Initialize OpenBMC rest_username=${username} rest_password=${password}
701 @{Partition_file_list} = Split String ${file_name} ,
702 Delete BMC Partition File ${Partition_file_list} ${HTTP_FORBIDDEN} ${FORBIDDEN_MESSAGE}
703
704
705Verify Update Wrong Partition File To BMC
706 [Documentation] Upload the wrong partition file to BMC.
707 [Arguments] ${file_name}
708
709 # Description of argument(s):
710 # file_name Partition file name.
711
712 Redfish.Login
713 ${resp}= Run Keyword And Return Status
714 ... Redfish.Put /ibm/v1/Host/ConfigFiles/../../../../../etc/resolv.conf body={"data": "test string"}
715 Should Be Equal As Strings ${resp} False