blob: ab3abd601b397b4a27bb1c271e86de68d4646da5 [file] [log] [blame]
Steven Sombarf3a19952017-10-11 14:18:26 -05001*** 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.
George Keishing4d4ef992021-01-28 09:56:53 -060011# Default value for LOOPS is 1.
Steven Sombarf3a19952017-10-11 14:18:26 -050012
13
14Library OperatingSystem
15Resource ../lib/utils.robot
16Resource ../lib/openbmc_ffdc.robot
17
18
19Test Teardown FFDC On Test Case Fail
20
Igor Kanyukafeb79d62025-10-20 21:24:03 +010021Test Tags BMC_Upload_Stability
Steven Sombarf3a19952017-10-11 14:18:26 -050022
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}
Michael Walshc108e422019-03-28 12:27:18 -050050 Printn
Steven Sombarf3a19952017-10-11 14:18:26 -050051 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
George Keishing6d9d4f62025-03-21 11:36:47 +053058 # Set up 'redfish' object used in POST request below.
Steven Sombarf3a19952017-10-11 14:18:26 -050059 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
Sridevi Ramesheadeef02019-01-17 08:56:18 -060064 ... X-Auth-Token=${XAUTH_TOKEN} Accept=application/octet-stream
Steven Sombarf3a19952017-10-11 14:18:26 -050065 Set To Dictionary ${data} headers ${headers}
66
George Keishinga789aeb2018-04-14 12:17:42 -050067 # Upload to BMC and check for HTTP_BAD_REQUEST.
George Keishing6d9d4f62025-03-21 11:36:47 +053068 ${resp}= POST On Session redfish /upload/image &{data}
George Keishinga789aeb2018-04-14 12:17:42 -050069 Should Be Equal As Strings ${resp.status_code} ${HTTP_BAD_REQUEST}
Steven Sombarf3a19952017-10-11 14:18:26 -050070
Steven Sombarf3a19952017-10-11 14:18:26 -050071 ${loop_count}= Catenate Ending iteration: ${iteration}
72 Rpvars loop_count