Redfish power operation
Added:
- Resource variables paths.
- Keyword to accept valid boot options.
Change-Id: Id49db5c351520116475971cda40c3d5ee32ed20d
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index 642dc13..872c4e9 100755
--- a/data/variables.py
+++ b/data/variables.py
@@ -148,7 +148,8 @@
# Boot options and URI variables.
POWER_ON = 'On'
-POWER_GRACEFULL_OFF = "GracefulShutdown"
+POWER_GRACEFUL_OFF = "GracefulShutdown"
+POWER_GRACEFUL_RESTART = "GracefulRestart"
POWER_FORCE_OFF = 'ForceOff'
REDFISH_POWER_URI = 'Systems/1/Actions/ComputerSystem.Reset'
diff --git a/lib/bmc_redfish_utils.robot b/lib/bmc_redfish_utils.robot
new file mode 100644
index 0000000..b178f55
--- /dev/null
+++ b/lib/bmc_redfish_utils.robot
@@ -0,0 +1,36 @@
+*** Settings ***
+Documentation BMC redfish utils.
+
+Resource resource.txt
+Resource bmc_redfish_resource.robot
+
+
+*** Keywords ***
+
+Redfish Power Operation
+ [Documentation] Do Redfish power operation.
+ [Arguments] ${reset_type}
+ # Description of arguments:
+ # reset_type Type of power operation.
+ # (e.g. On/ForceOff/GracefulRestart/GracefulShutdown)
+
+ # Example:
+ # "Actions": {
+ # "#ComputerSystem.Reset": {
+ # "ResetType@Redfish.AllowableValues": [
+ # "On",
+ # "ForceOff",
+ # "GracefulRestart",
+ # "GracefulShutdown"
+ # ],
+ # "target": "/redfish/v1/Systems/motherboard/Actions/ComputerSystem.Reset"
+ # }}
+
+ redfish.Login
+ ${payload}= Create Dictionary ResetType=${reset_type}
+ ${resp}= redfish.Post Systems/1/Actions/ComputerSystem.Reset body=&{payload}
+ Should Be Equal As Strings ${resp.status} ${HTTP_OK}
+ redfish.Logout
+
+
+