1*** Settings ***
2Documentation   BMC redfish utils.
3
4Resource        resource.robot
5Resource        bmc_redfish_resource.robot
6
7
8*** Keywords ***
9
10Redfish Power Operation
11    [Documentation]  Do Redfish power operation.
12    [Arguments]      ${reset_type}
13    # Description of arguments:
14    # reset_type     Type of power operation.
15    #                (e.g. On/ForceOff/GracefulRestart/GracefulShutdown)
16
17    # Example:
18    # "Actions": {
19    # "#ComputerSystem.Reset": {
20    #  "ResetType@Redfish.AllowableValues": [
21    #    "On",
22    #    "ForceOff",
23    #    "GracefulRestart",
24    #    "GracefulShutdown"
25    #  ],
26    #  "target": "/redfish/v1/Systems/motherboard/Actions/ComputerSystem.Reset"
27    #  }}
28
29    redfish.Login
30    ${payload}=  Create Dictionary  ResetType=${reset_type}
31    ${resp}=  redfish.Post  Systems/1/Actions/ComputerSystem.Reset  body=&{payload}
32    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
33    redfish.Logout
34
35
36
37