1*** Settings ***
2
3Documentation     Test Save Area feature of Management Console on BMC.
4
5Resource          ../../lib/rest_client.robot
6Resource          ../../lib/openbmc_ffdc.robot
7Resource          ../../lib/resource.robot
8Resource          ../../lib/bmc_redfish_utils.robot
9Resource          ../../lib/utils.robot
10Resource          ../../lib/bmc_redfish_resource.robot
11
12Suite Setup       Suite Setup Execution
13Test Teardown     Test Teardown Execution
14Suite Teardown    Suite Teardown Execution
15
16*** Variables ***
17
18${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
25
26*** Test Cases ***
27
28Redfish 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
32
33    # file_name
34    500KB_file
35
36
37Redfish 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
41
42    # file_name
43    501KB_file
44
45
46Redfish 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
50
51    # file_name
52    250KB_file,500KB_file
53
54
55Redfish 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
59
60    # file_name
61    650KB_file,501KB_file
62
63
64Redfish 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
73Redfish 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
82Redfish 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
86
87    # file_name
88    500KB_file
89
90
91Redfish 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
95
96    # file_name
97    250KB_file,500KB_file
98
99
100Redfish 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
104
105    # file_name            reboot_flag
106    testfile               False
107    testfile01,testfile02  False
108
109
110Redfish 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
114
115    # file_name            reboot_flag
116    testfile               True
117    testfile01,testfile02  True
118
119
120Redfish 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
124
125    # 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
163
164
165Verify One Thousand Partitions File Upload
166    [Documentation]  Upload 1000 partition file to BMC.
167    [Tags]  Verify_One_Thousand_Partitions_File_Upload
168    [Template]  Redfish Upload Partition File With Range
169
170    # range
171    1000
172
173
174Non 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
178
179    # file_name    username         password       role_id
180    500KB_file     operator_user    TestPwd123     Operator
181
182
183Non 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
200*** Keywords ***
201
202Suite Setup Execution
203    [Documentation]  Suite setup execution.
204
205    Redfish.Login
206
207
208Test Teardown Execution
209    [Documentation]  Test teardown execution.
210
211    Delete All BMC Partition File  ${HTTP_OK}
212    FFDC On Test Case Fail
213
214
215Suite Teardown Execution
216    [Documentation]  Suite teardown execution.
217
218    Delete All Sessions
219
220
221Delete Local Partition File
222    [Documentation]  Delete local partition file.
223    [Arguments]  ${file_name}
224
225    # Description of argument(s):
226    # file_name    Partition file name.
227
228    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
232
233
234Create 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
285    ${headers}=  Create Dictionary  X-Auth-Token=${XAUTH_TOKEN}
286    Set To Dictionary  ${data}  headers  ${headers}
287
288    ${resp}=  Post Request  openbmc  /ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll  &{data}
289    Should Be Equal As Strings  ${resp.status_code}  ${status_code}
290
291
292Return Description Of Response
293    [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:
300    # {
301    #    "Description": "File Created"
302    # }
303
304    ${message}=  Evaluate  json.loads('''${resp_text}''')  json
305
306    [Return]  ${message["Description"]}
307
308
309Upload Partition File To BMC
310    [Documentation]  Upload partition file to BMC.
311    [Arguments]  ${file_name}  ${status_code}  ${expected_message}  ${flag}=${True}
312
313    # Description of argument(s):
314    # 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.
318
319    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}
326
327      ${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
337
338
339Verify Partition File On BMC
340    [Documentation]  Verify partition file on BMC.
341    [Arguments]  ${file_name}  ${Partition_status}
342
343    # Description of argument(s):
344    # file_name           Partition file name.
345    # Partition_status    Partition file status on BMC.
346
347    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
352
353
354Redfish Upload Partition File
355    [Documentation]  Upload the partition file.
356    [Arguments]  ${file_name}
357
358    # Description of argument(s):
359    # file_name    Partition file name.
360
361    @{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}
371
372
373Redfish Fail To Upload Partition File
374    [Documentation]  Fail to uplaod the partition file.
375    [Arguments]  ${file_name}
376
377    # Description of argument(s):
378    # file_name    Partition file name.
379
380    @{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}
386
387
388Redfish 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
411Verify 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
423Redfish Partition File Persistency
424    [Documentation]  Upload the partition file and check for persistency after reboot.
425    [Arguments]  ${file_name}
426
427    # 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
437    Initialize OpenBMC
438    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}
443
444
445Verify Redfish Partition File Content
446    [Documentation]  Verify partition file content.
447    [Arguments]  ${file_name}  ${content_dict}  ${status_code}
448
449    # 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
462
463
464Add Content To Files
465    [Documentation]  Add defined content in partition file.
466    [Arguments]  ${file_name}  ${index}=${0}
467
468    # 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}
626    Delete All Sessions
627    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
664