George Keishing | eefc07a | 2016-07-26 03:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This module will test basic power on use cases for CI |
| 3 | |
| 4 | Resource ../lib/rest_client.robot |
| 5 | |
| 6 | Test template power on tests |
| 7 | |
| 8 | *** variables *** |
| 9 | |
| 10 | ${POWER_CONTROL} /org/openbmc/control/chassis0/ |
| 11 | ${POWER_SETTING} /org/openbmc/settings/host0 |
| 12 | ${Retry} 1 min |
| 13 | ${Interval} 30s |
| 14 | |
| 15 | *** test cases *** |
| 16 | |
| 17 | Verify power on system states |
| 18 | |
| 19 | # Template Action Expected End State |
| 20 | poweroff HOST_POWERED_OFF |
| 21 | poweron HOST_POWERED_ON |
| 22 | poweroff HOST_POWERED_OFF |
| 23 | |
| 24 | *** keywords *** |
| 25 | |
| 26 | power on tests |
| 27 | [Arguments] ${action} ${endState} |
| 28 | Log To Console ${\n}${action} the host |
| 29 | |
| 30 | @{arglist}= Create List |
| 31 | ${args}= Create Dictionary data=@{arglist} |
| 32 | ${resp}= Call Method ${POWER_CONTROL} ${action} data=${args} |
| 33 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 34 | ${json} = to json ${resp.content} |
| 35 | should be equal as strings ${json['status']} ok |
| 36 | |
| 37 | Wait Until Keyword Succeeds ${Retry} ${Interval} |
| 38 | ... system power state ${endState} |
| 39 | |
| 40 | |
| 41 | system power state |
| 42 | [Arguments] ${endState} |
| 43 | ${currState}= Read Attribute ${POWER_SETTING} system_state |
| 44 | Should be equal ${currState} ${endState} |