15a73ee0bSGeorge Keishing*** Settings *** 2dbfe97dbSJoy OnyerikwuDocumentation Test Redfish to verify responses for SessionService and Hypermedia. 397c93945SGeorge Keishing 4839a0c27SSandhya SomashekarResource ../../lib/resource.robot 55a73ee0bSGeorge KeishingResource ../../lib/bmc_redfish_resource.robot 63298d5c3SGeorge KeishingResource ../../lib/openbmc_ffdc.robot 73298d5c3SGeorge Keishing 897c93945SGeorge Keishing 93298d5c3SGeorge KeishingTest Teardown FFDC On Test Case Fail 10c108e429SMichael WalshTest Setup Printn 115a73ee0bSGeorge Keishing 125a73ee0bSGeorge Keishing*** Test Cases *** 135a73ee0bSGeorge Keishing 145ee33d93SGeorge KeishingRedfish Login And Logout 155a73ee0bSGeorge Keishing [Documentation] Login to BMCweb and then logout. 165ee33d93SGeorge Keishing [Tags] Redfish_Login_And_Logout 175a73ee0bSGeorge Keishing 1897c93945SGeorge Keishing Redfish.Login 1997c93945SGeorge Keishing Redfish.Logout 205a73ee0bSGeorge Keishing 215a73ee0bSGeorge Keishing 225ee33d93SGeorge KeishingGET Redfish Hypermedia Without Login 236510cfbeSGeorge Keishing [Documentation] GET hypermedia URL without login. 245ee33d93SGeorge Keishing [Tags] GET_Redfish_Hypermedia_Without_Login 256510cfbeSGeorge Keishing [Template] GET And Verify Redfish Response 265a73ee0bSGeorge Keishing 276510cfbeSGeorge Keishing # Expect status Resource URL Path 286510cfbeSGeorge Keishing ${HTTP_OK} / 296510cfbeSGeorge Keishing ${HTTP_OK} /redfish 306510cfbeSGeorge Keishing ${HTTP_OK} /redfish/v1 315a73ee0bSGeorge Keishing 325a73ee0bSGeorge Keishing 335ee33d93SGeorge KeishingGET Redfish SessionService Resource With Login 345a73ee0bSGeorge Keishing [Documentation] Login to BMCweb and get /redfish/v1/SessionService. 355ee33d93SGeorge Keishing [Tags] GET_Redfish_SessionService_Resource_With_Login 365a73ee0bSGeorge Keishing 3797c93945SGeorge Keishing Redfish.Login 3897c93945SGeorge Keishing ${resp}= Redfish.Get /redfish/v1/SessionService 3997c93945SGeorge Keishing Redfish.Logout 405a73ee0bSGeorge Keishing 415a73ee0bSGeorge Keishing 425ee33d93SGeorge KeishingGET Redfish SessionService Without Login 435a73ee0bSGeorge Keishing [Documentation] Get /redfish/v1/SessionService without login 445ee33d93SGeorge Keishing [Tags] GET_Redfish_SessionService_Without_Login 455a73ee0bSGeorge Keishing 4697c93945SGeorge Keishing ${resp}= Redfish.Get /redfish/v1/SessionService 4797c93945SGeorge Keishing ... valid_status_codes=[${HTTP_UNAUTHORIZED}] 485a73ee0bSGeorge Keishing 495a73ee0bSGeorge Keishing 505ee33d93SGeorge KeishingRedfish Login Using Invalid Token 515a73ee0bSGeorge Keishing [Documentation] Login to BMCweb with invalid token. 525ee33d93SGeorge Keishing [Tags] Redfish_Login_Using_Invalid_Token 535a73ee0bSGeorge Keishing 545a73ee0bSGeorge Keishing Create Session openbmc ${AUTH_URI} 555a73ee0bSGeorge Keishing 565a73ee0bSGeorge Keishing # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun" 575a73ee0bSGeorge Keishing ${headers}= Create Dictionary Content-Type=application/json 585a73ee0bSGeorge Keishing ... X-Auth-Token=deadbeef 595a73ee0bSGeorge Keishing 605a73ee0bSGeorge Keishing ${resp}= Get Request 615a73ee0bSGeorge Keishing ... openbmc /redfish/v1/SessionService/Sessions headers=${headers} 625a73ee0bSGeorge Keishing 635a73ee0bSGeorge Keishing Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED} 645a73ee0bSGeorge Keishing 655a73ee0bSGeorge Keishing 66*07e4109bSGeorge KeishingVerify Redfish Invalid URL Response Code 67*07e4109bSGeorge Keishing [Documentation] Login to BMCweb and verify error response code. 68*07e4109bSGeorge Keishing [Tags] Verify_Redfish_Invalid_URL_Response_Code 69*07e4109bSGeorge Keishing 70*07e4109bSGeorge Keishing Redfish.Login 71*07e4109bSGeorge Keishing Redfish.Get /redfish/v1/idontexist valid_status_codes=[${HTTP_NOT_FOUND}] 72*07e4109bSGeorge Keishing Redfish.Logout 73*07e4109bSGeorge Keishing 74*07e4109bSGeorge Keishing 755ee33d93SGeorge KeishingDelete Redfish Session Using Valid login 765a73ee0bSGeorge Keishing [Documentation] Delete a session using valid login. 775ee33d93SGeorge Keishing [Tags] Delete_Redfish_Session_Using_Valid_Login 785a73ee0bSGeorge Keishing 7997c93945SGeorge Keishing Redfish.Login 806fed4436SGeorge Keishing ${session_info}= Get Redfish Session Info 816fed4436SGeorge Keishing 8297c93945SGeorge Keishing Redfish.Login 835a73ee0bSGeorge Keishing 845a73ee0bSGeorge Keishing # Example o/p: 855a73ee0bSGeorge Keishing # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'}, 865a73ee0bSGeorge Keishing # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}] 8797c93945SGeorge Keishing ${resp_list}= Redfish_Utils.List Request 8897c93945SGeorge Keishing ... /redfish/v1/SessionService/Sessions 896fed4436SGeorge Keishing 906fed4436SGeorge Keishing Redfish.Delete ${session_info["location"]} 915a73ee0bSGeorge Keishing 9297c93945SGeorge Keishing ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions 936fed4436SGeorge Keishing List Should Not Contain Value ${resp} ${session_info["location"]} 944db114ccSGeorge Keishing 956510cfbeSGeorge Keishing 966510cfbeSGeorge Keishing*** Keywords *** 976510cfbeSGeorge Keishing 986510cfbeSGeorge KeishingGET And Verify Redfish Response 996510cfbeSGeorge Keishing [Documentation] GET given resource and verfiy response. 10097c93945SGeorge Keishing [Arguments] ${valid_status_codes} ${resource_path} 1016510cfbeSGeorge Keishing 10297c93945SGeorge Keishing # Description of argument(s): 10397c93945SGeorge Keishing # valid_status_codes A comma-separated list of acceptable 10497c93945SGeorge Keishing # status codes (e.g. 200). 1056510cfbeSGeorge Keishing # resource_path Redfish resource URL path. 1066510cfbeSGeorge Keishing 10797c93945SGeorge Keishing ${resp}= Redfish.Get ${resource_path} 10897c93945SGeorge Keishing ... valid_status_codes=[${valid_status_codes}] 109