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