10047de86SSridevi Ramesh*** Settings *** 2b10eacafSGeorge KeishingDocumentation BMC and host redfish utility keywords. 30047de86SSridevi Ramesh 42db7bcaeSGeorge KeishingResource resource.robot 50047de86SSridevi RameshResource bmc_redfish_resource.robot 60047de86SSridevi Ramesh 70047de86SSridevi Ramesh 80047de86SSridevi Ramesh*** Keywords *** 90047de86SSridevi Ramesh 100047de86SSridevi RameshRedfish Power Operation 11b10eacafSGeorge Keishing [Documentation] Do Redfish host power operation. 120047de86SSridevi Ramesh [Arguments] ${reset_type} 130047de86SSridevi Ramesh # Description of arguments: 140047de86SSridevi Ramesh # reset_type Type of power operation. 150047de86SSridevi Ramesh # (e.g. On/ForceOff/GracefulRestart/GracefulShutdown) 160047de86SSridevi Ramesh 170047de86SSridevi Ramesh # Example: 180047de86SSridevi Ramesh # "Actions": { 190047de86SSridevi Ramesh # "#ComputerSystem.Reset": { 200047de86SSridevi Ramesh # "ResetType@Redfish.AllowableValues": [ 210047de86SSridevi Ramesh # "On", 220047de86SSridevi Ramesh # "ForceOff", 230047de86SSridevi Ramesh # "GracefulRestart", 240047de86SSridevi Ramesh # "GracefulShutdown" 250047de86SSridevi Ramesh # ], 262deec3cfSGeorge Keishing # "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset" 272deec3cfSGeorge Keishing # } 282deec3cfSGeorge Keishing # } 290047de86SSridevi Ramesh 30213feb34SMichael Walsh Redfish.Login 31c2b176e2SGeorge Keishing ${target}= redfish_utils.Get Target Actions /redfish/v1/Systems/system/ ComputerSystem.Reset 320047de86SSridevi Ramesh ${payload}= Create Dictionary ResetType=${reset_type} 33213feb34SMichael Walsh ${resp}= Redfish.Post ${target} body=&{payload} 34213feb34SMichael Walsh Redfish.Logout 350047de86SSridevi Ramesh 360047de86SSridevi Ramesh 37b10eacafSGeorge KeishingRedfish BMC Reset Operation 38b10eacafSGeorge Keishing [Documentation] Do Redfish BMC reset operation. 390047de86SSridevi Ramesh 40b10eacafSGeorge Keishing # Example: 41b10eacafSGeorge Keishing # "Actions": { 42b10eacafSGeorge Keishing # "#Manager.Reset": { 43b10eacafSGeorge Keishing # "ResetType@Redfish.AllowableValues": [ 44b10eacafSGeorge Keishing # "GracefulRestart" 45b10eacafSGeorge Keishing # ], 46b10eacafSGeorge Keishing # "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset" 47b10eacafSGeorge Keishing # } 48b10eacafSGeorge Keishing 49213feb34SMichael Walsh Redfish.Login 50c2b176e2SGeorge Keishing ${target}= redfish_utils.Get Target Actions /redfish/v1/Managers/bmc/ Manager.Reset 51b10eacafSGeorge Keishing ${payload}= Create Dictionary ResetType=GracefulRestart 52213feb34SMichael Walsh ${resp}= Redfish.Post ${target} body=&{payload} 53213feb34SMichael Walsh # The logout may very well fail because the system was just asked to 54213feb34SMichael Walsh # reset itself. 55213feb34SMichael Walsh Run Keyword And Ignore Error Redfish.Logout 56*caa718bfSGeorge Keishing 57*caa718bfSGeorge Keishing 58*caa718bfSGeorge KeishingDelete All Redfish Sessions 59*caa718bfSGeorge Keishing [Documentation] Delete all active redfish sessions. 60*caa718bfSGeorge Keishing 61*caa718bfSGeorge Keishing Redfish.Login 62*caa718bfSGeorge Keishing ${saved_session_info}= Get Redfish Session Info 63*caa718bfSGeorge Keishing 64*caa718bfSGeorge Keishing ${resp_list}= Redfish_Utils.Get Member List 65*caa718bfSGeorge Keishing ... /redfish/v1/SessionService/Sessions 66*caa718bfSGeorge Keishing 67*caa718bfSGeorge Keishing # Remove the current login session from the list. 68*caa718bfSGeorge Keishing Remove Values From List ${resp_list} ${saved_session_info["location"]} 69*caa718bfSGeorge Keishing 70*caa718bfSGeorge Keishing :FOR ${session} IN @{resp_list} 71*caa718bfSGeorge Keishing \ Redfish.Delete ${session} 72*caa718bfSGeorge Keishing 73*caa718bfSGeorge Keishing Redfish.Logout 74