blob: c0dba646a4c7fba955947401c24a3b77e9dab569 [file] [log] [blame]
Sridevi Ramesh0047de82019-02-01 06:33:08 -06001*** Settings ***
George Keishingb10eaca2019-02-24 05:07:30 -06002Documentation BMC and host redfish utility keywords.
Sridevi Ramesh0047de82019-02-01 06:33:08 -06003
George Keishing2db7bca2019-02-14 13:03:08 -06004Resource resource.robot
Sridevi Ramesh0047de82019-02-01 06:33:08 -06005Resource bmc_redfish_resource.robot
6
7
8*** Keywords ***
9
10Redfish Power Operation
George Keishingb10eaca2019-02-24 05:07:30 -060011 [Documentation] Do Redfish host power operation.
Sridevi Ramesh0047de82019-02-01 06:33:08 -060012 [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 # ],
George Keishing2deec3c2019-02-26 09:20:10 -060026 # "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset"
27 # }
28 # }
Sridevi Ramesh0047de82019-02-01 06:33:08 -060029
Michael Walsh213feb32019-03-08 14:44:31 -060030 Redfish.Login
George Keishingc2b176e2019-03-02 23:31:30 -060031 ${target}= redfish_utils.Get Target Actions /redfish/v1/Systems/system/ ComputerSystem.Reset
Sridevi Ramesh0047de82019-02-01 06:33:08 -060032 ${payload}= Create Dictionary ResetType=${reset_type}
Michael Walsh213feb32019-03-08 14:44:31 -060033 ${resp}= Redfish.Post ${target} body=&{payload}
34 Redfish.Logout
Sridevi Ramesh0047de82019-02-01 06:33:08 -060035
36
George Keishingb10eaca2019-02-24 05:07:30 -060037Redfish BMC Reset Operation
38 [Documentation] Do Redfish BMC reset operation.
Sridevi Ramesh0047de82019-02-01 06:33:08 -060039
George Keishingb10eaca2019-02-24 05:07:30 -060040 # Example:
41 # "Actions": {
42 # "#Manager.Reset": {
43 # "ResetType@Redfish.AllowableValues": [
44 # "GracefulRestart"
45 # ],
46 # "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset"
47 # }
48
Michael Walsh213feb32019-03-08 14:44:31 -060049 Redfish.Login
George Keishingc2b176e2019-03-02 23:31:30 -060050 ${target}= redfish_utils.Get Target Actions /redfish/v1/Managers/bmc/ Manager.Reset
George Keishingb10eaca2019-02-24 05:07:30 -060051 ${payload}= Create Dictionary ResetType=GracefulRestart
Michael Walsh213feb32019-03-08 14:44:31 -060052 ${resp}= Redfish.Post ${target} body=&{payload}
53 # The logout may very well fail because the system was just asked to
54 # reset itself.
55 Run Keyword And Ignore Error Redfish.Logout
George Keishingcaa718b2019-03-10 00:08:33 -060056
57
58Delete All Redfish Sessions
59 [Documentation] Delete all active redfish sessions.
60
61 Redfish.Login
62 ${saved_session_info}= Get Redfish Session Info
63
64 ${resp_list}= Redfish_Utils.Get Member List
65 ... /redfish/v1/SessionService/Sessions
66
67 # Remove the current login session from the list.
68 Remove Values From List ${resp_list} ${saved_session_info["location"]}
69
70 :FOR ${session} IN @{resp_list}
71 \ Redfish.Delete ${session}
72
73 Redfish.Logout