blob: a1e0ffa7ab4329d4a293c47b8e70315bfaf4ca5b [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2Documentation This suite is for testing OCC: Power capping setting
3
4Resource ../lib/rest_client.robot
5Resource ../lib/utils.robot
George Keishing4d6c1da2016-07-15 05:51:22 -05006Resource ../lib/connection_client.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05007
George Keishing4d6c1da2016-07-15 05:51:22 -05008Suite Setup Open Connection And Log In
9Suite Teardown Close All Connections
Chris Austenb29d2e82016-06-07 12:25:35 -050010
11*** Variables ***
12${SYSTEM_SHUTDOWN_TIME} ${5}
13
14*** Test Cases ***
15
16Test WarmReset via REST
17 [Tags] reboot_tests
18 ${warm_test_file}= Set Variable /tmp/before_warmreset
19 Open Connection And Log In
20 ${stdout} ${stderr} ${rc}= Execute Command touch ${warm_test_file} return_stderr=True return_rc=True
21 Should Be Equal ${rc} ${0} Unable to create file - ${warm_test_file}
22
23 ${bmc_uri}= Get BMC Link
24 ${data} = create dictionary data=@{EMPTY}
25 ${resp} = openbmc post request ${bmc_uri}/action/warmReset data=${data}
26 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
27 Sleep ${SYSTEM_SHUTDOWN_TIME}min
28 Wait For Host To Ping ${OPENBMC_HOST}
29 ${max_wait_time}= Evaluate ${SYSTEM_SHUTDOWN_TIME}+${OPENBMC_REBOOT_TIMEOUT}
30
31 Open Connection And Log In
32 ${uptime}= Execute Command cut -d " " -f 1 /proc/uptime| cut -d "." -f 1
33 ${uptime}= Convert To Integer ${uptime}
34 ${uptime}= Evaluate ${uptime}/60
35 Should Be True ${uptime}<${max_wait_time}
36 Open Connection And Log In
37 ${stdout} ${stderr} ${rc}= Execute Command ls ${warm_test_file} return_stderr=True return_rc=True
38 Should Be Equal ${rc} ${1} File ${warm_test_file} does exist even after reboot of BMC, error:${stderr}, stdput: ${stdout}
39
40*** Keywords ***
41Get BMC Link
42 ${resp}= OpenBMC Get Request /org/openbmc/control/
43 ${jsondata}= To Json ${resp.content}
44 log ${jsondata}
45 : FOR ${ELEMENT} IN @{jsondata["data"]}
46 \ log ${ELEMENT}
47 \ ${found}= Get Lines Matching Pattern ${ELEMENT} *control/bmc*
48 \ Return From Keyword If '${found}' != '' ${found}