Keywords and test for redfish
Changes:
- Added new test suite for CI test_redfish_basic_poweron.robot.
- Added new resource file lib/redfish_utility.robot.
- Added new variables and fix POST request args.
Change-Id: Ia4c230ec464973b9b8cf3260401a8854ca711229
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index a435df3..ba8e088 100755
--- a/data/variables.py
+++ b/data/variables.py
@@ -144,6 +144,13 @@
REDFISH_SESSION = REDFISH_BASE_URI + 'SessionService/Sessions'
REDFISH_SESSION_URI = 'SessionService/Sessions/'
+# Boot options and URI variables.
+POWER_ON = 'On'
+POWER_GRACEFULL_OFF = "GracefulShutdown"
+POWER_FORCE_OFF = 'ForceOff'
+
+REDFISH_POWER_URI = 'Systems/1/Actions/ComputerSystem.Reset'
+
# rsyslog variables.
REMOTE_LOGGING_URI = OPENBMC_BASE_URI + 'logging/config/remote/'
diff --git a/lib/redfish_client.robot b/lib/redfish_client.robot
index 513d121..e548b22 100644
--- a/lib/redfish_client.robot
+++ b/lib/redfish_client.robot
@@ -94,8 +94,8 @@
Redfish Post Request
[Documentation] Do redfish POST request.
[Arguments] ${uri_suffix}
- ... &{kwargs}
... ${timeout}=30
+ ... &{kwargs}
# Description of argument(s):
# uri_suffix The URI to establish connection with
diff --git a/lib/redfish_utility.robot b/lib/redfish_utility.robot
new file mode 100644
index 0000000..feb0560
--- /dev/null
+++ b/lib/redfish_utility.robot
@@ -0,0 +1,18 @@
+*** Settings ***
+
+Documentation Utilities keywords for BMC redfish.
+
+Resource resource.txt
+Resource redfish_client.robot
+
+*** Keywords ***
+
+Boot Action
+ [Documentation] Host boot to power on, off or reboot.
+ [Arguments] ${boot_option}
+
+ # Description of argument(s):
+ # boot_option On/GracefulShutdown/ForceOff
+
+ ${args}= Create Dictionary ResetType=${boot_option}
+ ${resp}= Redfish Post Request ${REDFISH_POWER_URI} data=${args}
diff --git a/redfish_test/test_redfish_basic_poweron.robot b/redfish_test/test_redfish_basic_poweron.robot
new file mode 100644
index 0000000..6db27ff
--- /dev/null
+++ b/redfish_test/test_redfish_basic_poweron.robot
@@ -0,0 +1,15 @@
+*** Settings ***
+
+Documentation Test power on and off.
+
+Resource ../lib/redfish_utility.robot
+
+** Test Cases **
+
+Redfish Power On Test
+ [Documentation] Power off and on.
+ [Tags] Redfish_Power_On_Test
+
+ Boot Action ${POWER_GRACEFULL_OFF}
+
+*** Keywords ***