Steven Sombar | f3a1995 | 2017-10-11 14:18:26 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation 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 | # Defaule value for LOOPS is 1. |
| 12 | |
| 13 | |
| 14 | Library OperatingSystem |
| 15 | Resource ../lib/utils.robot |
| 16 | Resource ../lib/openbmc_ffdc.robot |
| 17 | |
| 18 | |
| 19 | Test Teardown FFDC On Test Case Fail |
| 20 | |
| 21 | |
| 22 | *** Variables **** |
| 23 | |
| 24 | ${LOOPS} ${1} |
| 25 | ${iteration} ${0} |
| 26 | |
| 27 | |
| 28 | *** Test Cases *** |
| 29 | |
| 30 | |
| 31 | REST Upload Stability Test |
| 32 | [Documentation] Execute upload stress testing. |
| 33 | [Tags] REST_Upload_Stability_Test |
| 34 | |
| 35 | Repeat Keyword ${LOOPS} times Upload Test Image File To BMC |
| 36 | |
| 37 | |
| 38 | *** Keywords *** |
| 39 | |
| 40 | |
| 41 | Upload Test Image File To BMC |
| 42 | [Documentation] Upload a file to BMC via REST. The uploaded file |
| 43 | ... is 32MB, approximately the same size as a downloadable |
| 44 | ... BMC image. |
| 45 | [Timeout] 2m |
| 46 | |
| 47 | Set Test Variable ${iteration} ${iteration + 1} |
| 48 | ${loop_count}= Catenate Starting iteration: ${iteration} |
| 49 | Rprintn |
| 50 | Rpvars loop_count |
| 51 | |
| 52 | # Generate data file. |
| 53 | Run dd if=/dev/zero of=dummyfile bs=1 count=0 seek=32MB |
| 54 | |
| 55 | ${image_data}= OperatingSystem.Get Binary File dummyfile |
| 56 | |
| 57 | # Set up 'openbmc' used in POST request below. |
| 58 | Initialize OpenBMC |
| 59 | |
| 60 | # Create the REST payload headers and data. |
| 61 | ${data}= Create Dictionary data=${image_data} |
| 62 | ${headers}= Create Dictionary Content-Type=application/octet-stream |
| 63 | ... Accept=application/octet-stream |
| 64 | Set To Dictionary ${data} headers ${headers} |
| 65 | |
| 66 | # Upload to BMC and check for HTTP_OK. |
| 67 | ${resp}= Post Request openbmc /upload/image &{data} |
| 68 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 69 | |
Steven Sombar | f3a1995 | 2017-10-11 14:18:26 -0500 | [diff] [blame] | 70 | ${loop_count}= Catenate Ending iteration: ${iteration} |
| 71 | Rpvars loop_count |