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