Port suite from mkumatag personal repo w/o history
All these files came from https://github.com/mkumatag/openbmc-automation
The decision to remove the commit history was because most of the 122
commits did not follow commit comment AND content best practices.
The ability to remove the commit history was possible because all
contributors where from the same company (IBM) making the coordination /
notification/acceptence easy. See all the gory details about the
first try to commit with history here...
https://github.com/openbmc/openbmc-test-automation/pull/1
This suite of tests will run against an OpenBMC based server. It will
run good/bad path testing against the REST interface. There are tests
that will also run ipmitool on the victim BMC too.
If you want to support a new system in to the suite you should only
have to edit two files...
data/<system>.py
tox.ini
The README.md contains details on how to setup for the first time along
with how to execute the test suite
NOTE: some test cases require tools that do not exist on the system.
Currently the ipmitool is needed and if you do not manually copy / link
it in to the tools directory some suites will fail.
diff --git a/lib/utils.robot b/lib/utils.robot
new file mode 100644
index 0000000..2d45f49
--- /dev/null
+++ b/lib/utils.robot
@@ -0,0 +1,54 @@
+*** Settings ***
+Resource ../lib/resource.txt
+Resource ../lib/rest_client.robot
+
+Library OperatingSystem
+
+*** Variables ***
+${SYSTEM_SHUTDOWN_TIME} ${5}
+
+*** Keywords ***
+
+Wait For Host To Ping
+ [Arguments] ${host}
+ Wait Until Keyword Succeeds ${OPENBMC_REBOOT_TIMEOUT}min 5 sec Ping Host ${host}
+
+Ping Host
+ [Arguments] ${host}
+ ${RC} ${output} = Run and return RC and Output ping -c 4 ${host}
+ Log RC: ${RC}\nOutput:\n${output}
+ Should be equal ${RC} ${0}
+
+Get Boot Progress
+ ${state} = Read Attribute /org/openbmc/sensors/host/BootProgress value
+ [return] ${state}
+
+Is Power On
+ ${state} = Get Boot Progress
+ Should be equal ${state} FW Progress, Starting OS
+
+Is Power Off
+ ${state} = Get Boot Progress
+ Should be equal ${state} Off
+
+Power On Host
+ @{arglist}= Create List
+ ${args}= Create Dictionary data=@{arglist}
+ ${resp}= Call Method /org/openbmc/control/chassis0/ powerOn data=${args}
+ should be equal as strings ${resp.status_code} ${HTTP_OK}
+ Wait Until Keyword Succeeds 3 min 10 sec Is Power On
+
+Power Off Host
+ @{arglist}= Create List
+ ${args}= Create Dictionary data=@{arglist}
+ ${resp}= Call Method /org/openbmc/control/chassis0/ powerOff data=${args}
+ should be equal as strings ${resp.status_code} ${HTTP_OK}
+ Wait Until Keyword Succeeds 1 min 10 sec Is Power Off
+
+Trigger Warm Reset
+ log to console "Triggering warm reset"
+ ${data} = create dictionary data=@{EMPTY}
+ ${resp} = openbmc post request /org/openbmc/control/bmc0/action/warmReset data=${data}
+ Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+ Sleep ${SYSTEM_SHUTDOWN_TIME}min
+ Wait For Host To Ping ${OPENBMC_HOST}