1*** Settings ***
2Documentation   BMC and host redfish utility keywords.
3
4Resource        resource.robot
5Resource        bmc_redfish_resource.robot
6
7
8*** Keywords ***
9
10Redfish Power Operation
11    [Documentation]  Do Redfish host 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/system/Actions/ComputerSystem.Reset"
27    #  }
28    # }
29
30    redfish.Login
31    ${target}=  redfish_utils.Get Target Actions  /redfish/v1/Systems/system/  ComputerSystem.Reset
32    ${payload}=  Create Dictionary  ResetType=${reset_type}
33    ${resp}=  redfish.Post  ${target}  body=&{payload}
34    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
35    redfish.Logout
36
37
38Redfish BMC Reset Operation
39    [Documentation]  Do Redfish BMC reset operation.
40
41    # Example:
42    # "Actions": {
43    # "#Manager.Reset": {
44    #  "ResetType@Redfish.AllowableValues": [
45    #    "GracefulRestart"
46    #  ],
47    #  "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset"
48    # }
49
50    redfish.Login
51    ${target}=  redfish_utils.Get Target Actions  /redfish/v1/Managers/bmc/  Manager.Reset
52    ${payload}=  Create Dictionary  ResetType=GracefulRestart
53    ${resp}=  redfish.Post  ${target}  body=&{payload}
54    Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
55    redfish.Logout
56