15a73ee0bSGeorge Keishing*** Settings *** 2dbfe97dbSJoy OnyerikwuDocumentation Test Redfish to verify responses for SessionService and Hypermedia. 397c93945SGeorge Keishing 45a73ee0bSGeorge KeishingResource ../../lib/bmc_redfish_resource.robot 53298d5c3SGeorge KeishingResource ../../lib/openbmc_ffdc.robot 63298d5c3SGeorge Keishing 797c93945SGeorge Keishing 83298d5c3SGeorge KeishingTest Teardown FFDC On Test Case Fail 9c108e429SMichael WalshTest Setup Printn 105a73ee0bSGeorge Keishing 11*5431685fSGeorge KeishingForce Tags Service_Root 12*5431685fSGeorge Keishing 135a73ee0bSGeorge Keishing*** Test Cases *** 145a73ee0bSGeorge Keishing 155ee33d93SGeorge KeishingRedfish Login And Logout 165a73ee0bSGeorge Keishing [Documentation] Login to BMCweb and then logout. 175ee33d93SGeorge Keishing [Tags] Redfish_Login_And_Logout 185a73ee0bSGeorge Keishing 1997c93945SGeorge Keishing Redfish.Login 2097c93945SGeorge Keishing Redfish.Logout 215a73ee0bSGeorge Keishing 225a73ee0bSGeorge Keishing 235ee33d93SGeorge KeishingGET Redfish Hypermedia Without Login 246510cfbeSGeorge Keishing [Documentation] GET hypermedia URL without login. 255ee33d93SGeorge Keishing [Tags] GET_Redfish_Hypermedia_Without_Login 26ebe7e958SLei YU [Setup] Redfish.Logout 276510cfbeSGeorge Keishing [Template] GET And Verify Redfish Response 285a73ee0bSGeorge Keishing 296510cfbeSGeorge Keishing # Expect status Resource URL Path 306510cfbeSGeorge Keishing ${HTTP_OK} /redfish 316510cfbeSGeorge Keishing ${HTTP_OK} /redfish/v1 325a73ee0bSGeorge Keishing 335a73ee0bSGeorge Keishing 345ee33d93SGeorge KeishingGET Redfish SessionService Without Login 355a73ee0bSGeorge Keishing [Documentation] Get /redfish/v1/SessionService without login 365ee33d93SGeorge Keishing [Tags] GET_Redfish_SessionService_Without_Login 37ebe7e958SLei YU [Setup] Redfish.Logout 385a73ee0bSGeorge Keishing 3997c93945SGeorge Keishing ${resp}= Redfish.Get /redfish/v1/SessionService 4097c93945SGeorge Keishing ... valid_status_codes=[${HTTP_UNAUTHORIZED}] 415a73ee0bSGeorge Keishing 425a73ee0bSGeorge Keishing 43c681a63fSGeorge KeishingGET Redfish Resources With Login 44c681a63fSGeorge Keishing [Documentation] Login to BMCweb and GET valid resource. 45c681a63fSGeorge Keishing [Tags] GET_Redfish_Resources_With_Login 46c681a63fSGeorge Keishing [Setup] Redfish.Login 47c681a63fSGeorge Keishing [Template] GET And Verify Redfish Response 48c681a63fSGeorge Keishing 49c681a63fSGeorge Keishing # Expect status Resource URL Path 50c681a63fSGeorge Keishing ${HTTP_OK} /redfish/v1/SessionService 51c681a63fSGeorge Keishing ${HTTP_OK} /redfish/v1/AccountService 52c681a63fSGeorge Keishing ${HTTP_OK} /redfish/v1/Systems/system 532b975827STony Lee ${HTTP_OK} /redfish/v1/Chassis/${CHASSIS_ID} 544d430283Sganesanb ${HTTP_OK} /redfish/v1/Managers/${MANAGER_ID} 55c681a63fSGeorge Keishing ${HTTP_OK} /redfish/v1/UpdateService 56c681a63fSGeorge Keishing 57c681a63fSGeorge Keishing 585ee33d93SGeorge KeishingRedfish Login Using Invalid Token 595a73ee0bSGeorge Keishing [Documentation] Login to BMCweb with invalid token. 605ee33d93SGeorge Keishing [Tags] Redfish_Login_Using_Invalid_Token 615a73ee0bSGeorge Keishing 625a73ee0bSGeorge Keishing Create Session openbmc ${AUTH_URI} 635a73ee0bSGeorge Keishing 645a73ee0bSGeorge Keishing # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun" 655a73ee0bSGeorge Keishing ${headers}= Create Dictionary Content-Type=application/json 665a73ee0bSGeorge Keishing ... X-Auth-Token=deadbeef 675a73ee0bSGeorge Keishing 68fbd67007SGeorge Keishing ${resp}= GET On Session 695a73ee0bSGeorge Keishing ... openbmc /redfish/v1/SessionService/Sessions headers=${headers} 70fbd67007SGeorge Keishing ... expected_status=${HTTP_UNAUTHORIZED} 715a73ee0bSGeorge Keishing 725a73ee0bSGeorge Keishing Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED} 735a73ee0bSGeorge Keishing 745a73ee0bSGeorge Keishing 7507e4109bSGeorge KeishingVerify Redfish Invalid URL Response Code 7607e4109bSGeorge Keishing [Documentation] Login to BMCweb and verify error response code. 7707e4109bSGeorge Keishing [Tags] Verify_Redfish_Invalid_URL_Response_Code 7807e4109bSGeorge Keishing 7907e4109bSGeorge Keishing Redfish.Login 8007e4109bSGeorge Keishing Redfish.Get /redfish/v1/idontexist valid_status_codes=[${HTTP_NOT_FOUND}] 8107e4109bSGeorge Keishing Redfish.Logout 8207e4109bSGeorge Keishing 8307e4109bSGeorge Keishing 845236ec54SGeorge KeishingDelete Redfish Session Using Valid Login 855a73ee0bSGeorge Keishing [Documentation] Delete a session using valid login. 865ee33d93SGeorge Keishing [Tags] Delete_Redfish_Session_Using_Valid_Login 875a73ee0bSGeorge Keishing 8897c93945SGeorge Keishing Redfish.Login 896fed4436SGeorge Keishing ${session_info}= Get Redfish Session Info 906fed4436SGeorge Keishing 9197c93945SGeorge Keishing Redfish.Login 925a73ee0bSGeorge Keishing 935a73ee0bSGeorge Keishing # Example o/p: 945a73ee0bSGeorge Keishing # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'}, 955a73ee0bSGeorge Keishing # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}] 9697c93945SGeorge Keishing ${resp_list}= Redfish_Utils.List Request 9797c93945SGeorge Keishing ... /redfish/v1/SessionService/Sessions 986fed4436SGeorge Keishing 996fed4436SGeorge Keishing Redfish.Delete ${session_info["location"]} 1005a73ee0bSGeorge Keishing 10197c93945SGeorge Keishing ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions 1026fed4436SGeorge Keishing List Should Not Contain Value ${resp} ${session_info["location"]} 1034db114ccSGeorge Keishing 1046510cfbeSGeorge Keishing 105da5a81d0SGeorge KeishingRedfish Login Via SessionService 106da5a81d0SGeorge Keishing [Documentation] Login to BMC via redfish session service. 107da5a81d0SGeorge Keishing [Tags] Redfish_Login_Via_SessionService 108da5a81d0SGeorge Keishing 109da5a81d0SGeorge Keishing Create Session openbmc https://${OPENBMC_HOST} 110da5a81d0SGeorge Keishing ${headers}= Create Dictionary Content-Type=application/json 111fbd67007SGeorge Keishing ${data}= Set Variable {"UserName":"${OPENBMC_USERNAME}", "Password":"${OPENBMC_PASSWORD}"} 112da5a81d0SGeorge Keishing 113fbd67007SGeorge Keishing ${resp}= POST On Session openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers} 114da5a81d0SGeorge Keishing Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED} 115da5a81d0SGeorge Keishing 116da5a81d0SGeorge Keishing ${headers}= Create Dictionary Content-Type=application/json 117da5a81d0SGeorge Keishing ... X-Auth-Token=${resp.headers["X-Auth-Token"]} 118fbd67007SGeorge Keishing ${resp}= DELETE On Session openbmc ${REDFISH_SESSION}${/}${resp.json()["Id"]} headers=${headers} 119da5a81d0SGeorge Keishing Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} 120da5a81d0SGeorge Keishing 121da5a81d0SGeorge Keishing 1226d2d42fcSAnusha DathatriVerify Redfish Unresponsive URL paths 1236d2d42fcSAnusha Dathatri [Documentation] Verify that all URLs in /redfish/v1 respond. 1246d2d42fcSAnusha Dathatri [Tags] Verify_Redfish_Unresponsive_URL_paths 1256d2d42fcSAnusha Dathatri 1266d2d42fcSAnusha Dathatri Redfish.Login 1276d2d42fcSAnusha Dathatri ${resource_list} ${dead_resources}= Enumerate Request /redfish/v1 include_dead_resources=True 1286d2d42fcSAnusha Dathatri Redfish.Logout 1296d2d42fcSAnusha Dathatri Valid Length dead_resources max_length=0 1306d2d42fcSAnusha Dathatri 1316d2d42fcSAnusha Dathatri 1326510cfbeSGeorge Keishing*** Keywords *** 1336510cfbeSGeorge Keishing 1346510cfbeSGeorge KeishingGET And Verify Redfish Response 135e16f158fSGeorge Keishing [Documentation] GET given resource and verify response. 13697c93945SGeorge Keishing [Arguments] ${valid_status_codes} ${resource_path} 1376510cfbeSGeorge Keishing 13897c93945SGeorge Keishing # Description of argument(s): 13997c93945SGeorge Keishing # valid_status_codes A comma-separated list of acceptable 14097c93945SGeorge Keishing # status codes (e.g. 200). 1416510cfbeSGeorge Keishing # resource_path Redfish resource URL path. 1426510cfbeSGeorge Keishing 14397c93945SGeorge Keishing ${resp}= Redfish.Get ${resource_path} 14497c93945SGeorge Keishing ... valid_status_codes=[${valid_status_codes}] 145