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