xref: /openbmc/openbmc-test-automation/extended/test_bmc_upload_stability.robot (revision b2a2d948d555cb6e5169b9f21d489a3b089b4387)
1*** Settings ***
2
3Documentation    Module to stress-test REST upload stability.
4...              Upload a test file to the BMC.  The
5...              test file is approximately the size of
6...              a BMC flash image file.
7
8# Test Parameters:
9# OPENBMC_HOST        The BMC host name or IP address.
10# LOOPS               The number of times to loop the test.
11#                     Default value for LOOPS is 1.
12
13
14Library            OperatingSystem
15Resource           ../lib/utils.robot
16Resource           ../lib/openbmc_ffdc.robot
17
18
19Test Teardown   FFDC On Test Case Fail
20
21Test Tags       BMC_Upload_Stability
22
23*** Variables ****
24
25${LOOPS}         ${1}
26${iteration}     ${0}
27
28
29*** Test Cases ***
30
31
32REST Upload Stability Test
33    [Documentation]  Execute upload stress testing.
34    [Tags]  REST_Upload_Stability_Test
35
36    Repeat Keyword  ${LOOPS} times  Upload Test Image File To BMC
37
38
39*** Keywords ***
40
41
42Upload Test Image File To BMC
43    [Documentation]  Upload a file to BMC via REST.  The uploaded file
44    ...              is 32MB, approximately the same size as a downloadable
45    ...              BMC image.
46    [Timeout]  2m
47
48    Set Test Variable  ${iteration}  ${iteration + 1}
49    ${loop_count}=  Catenate  Starting iteration: ${iteration}
50    Printn
51    Rpvars  loop_count
52
53    # Generate data file.
54    Run  dd if=/dev/zero of=dummyfile bs=1 count=0 seek=32MB
55
56    ${image_data}=  OperatingSystem.Get Binary File  dummyfile
57
58    # Set up 'redfish' object used in POST request below.
59    Initialize OpenBMC
60
61    # Create the REST payload headers and data.
62    ${data}=  Create Dictionary  data=${image_data}
63    ${headers}=  Create Dictionary  Content-Type=application/octet-stream
64    ...  X-Auth-Token=${XAUTH_TOKEN}  Accept=application/octet-stream
65    Set To Dictionary  ${data}  headers  ${headers}
66
67    # Upload to BMC and check for HTTP_BAD_REQUEST.
68    ${resp}=  POST On Session  redfish  /upload/image  &{data}
69    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_BAD_REQUEST}
70
71    ${loop_count}=  Catenate  Ending iteration: ${iteration}
72    Rpvars  loop_count
73