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 25ebe7e958SLei YU [Setup] Redfish.Logout 266510cfbeSGeorge Keishing [Template] GET And Verify Redfish Response 275a73ee0bSGeorge Keishing 286510cfbeSGeorge Keishing # Expect status Resource URL Path 296510cfbeSGeorge Keishing ${HTTP_OK} /redfish 306510cfbeSGeorge Keishing ${HTTP_OK} /redfish/v1 315a73ee0bSGeorge Keishing 325a73ee0bSGeorge Keishing 335ee33d93SGeorge KeishingGET Redfish SessionService Without Login 345a73ee0bSGeorge Keishing [Documentation] Get /redfish/v1/SessionService without login 355ee33d93SGeorge Keishing [Tags] GET_Redfish_SessionService_Without_Login 36ebe7e958SLei YU [Setup] Redfish.Logout 375a73ee0bSGeorge Keishing 3897c93945SGeorge Keishing ${resp}= Redfish.Get /redfish/v1/SessionService 3997c93945SGeorge Keishing ... valid_status_codes=[${HTTP_UNAUTHORIZED}] 405a73ee0bSGeorge Keishing 415a73ee0bSGeorge Keishing 42c681a63fSGeorge KeishingGET Redfish Resources With Login 43c681a63fSGeorge Keishing [Documentation] Login to BMCweb and GET valid resource. 44c681a63fSGeorge Keishing [Tags] GET_Redfish_Resources_With_Login 45c681a63fSGeorge Keishing [Setup] Redfish.Login 46c681a63fSGeorge Keishing [Template] GET And Verify Redfish Response 47c681a63fSGeorge Keishing 48c681a63fSGeorge Keishing # Expect status Resource URL Path 49c681a63fSGeorge Keishing ${HTTP_OK} /redfish/v1/SessionService 50c681a63fSGeorge Keishing ${HTTP_OK} /redfish/v1/AccountService 51c681a63fSGeorge Keishing ${HTTP_OK} /redfish/v1/Systems/system 522b975827STony Lee ${HTTP_OK} /redfish/v1/Chassis/${CHASSIS_ID} 53c681a63fSGeorge Keishing ${HTTP_OK} /redfish/v1/Managers/bmc 54c681a63fSGeorge Keishing ${HTTP_OK} /redfish/v1/UpdateService 55c681a63fSGeorge Keishing 56c681a63fSGeorge Keishing 575ee33d93SGeorge KeishingRedfish Login Using Invalid Token 585a73ee0bSGeorge Keishing [Documentation] Login to BMCweb with invalid token. 595ee33d93SGeorge Keishing [Tags] Redfish_Login_Using_Invalid_Token 605a73ee0bSGeorge Keishing 615a73ee0bSGeorge Keishing Create Session openbmc ${AUTH_URI} 625a73ee0bSGeorge Keishing 635a73ee0bSGeorge Keishing # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun" 645a73ee0bSGeorge Keishing ${headers}= Create Dictionary Content-Type=application/json 655a73ee0bSGeorge Keishing ... X-Auth-Token=deadbeef 665a73ee0bSGeorge Keishing 67*fbd67007SGeorge Keishing ${resp}= GET On Session 685a73ee0bSGeorge Keishing ... openbmc /redfish/v1/SessionService/Sessions headers=${headers} 69*fbd67007SGeorge Keishing ... expected_status=${HTTP_UNAUTHORIZED} 705a73ee0bSGeorge Keishing 715a73ee0bSGeorge Keishing Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED} 725a73ee0bSGeorge Keishing 735a73ee0bSGeorge Keishing 7407e4109bSGeorge KeishingVerify Redfish Invalid URL Response Code 7507e4109bSGeorge Keishing [Documentation] Login to BMCweb and verify error response code. 7607e4109bSGeorge Keishing [Tags] Verify_Redfish_Invalid_URL_Response_Code 7707e4109bSGeorge Keishing 7807e4109bSGeorge Keishing Redfish.Login 7907e4109bSGeorge Keishing Redfish.Get /redfish/v1/idontexist valid_status_codes=[${HTTP_NOT_FOUND}] 8007e4109bSGeorge Keishing Redfish.Logout 8107e4109bSGeorge Keishing 8207e4109bSGeorge Keishing 835236ec54SGeorge KeishingDelete Redfish Session Using Valid Login 845a73ee0bSGeorge Keishing [Documentation] Delete a session using valid login. 855ee33d93SGeorge Keishing [Tags] Delete_Redfish_Session_Using_Valid_Login 865a73ee0bSGeorge Keishing 8797c93945SGeorge Keishing Redfish.Login 886fed4436SGeorge Keishing ${session_info}= Get Redfish Session Info 896fed4436SGeorge Keishing 9097c93945SGeorge Keishing Redfish.Login 915a73ee0bSGeorge Keishing 925a73ee0bSGeorge Keishing # Example o/p: 935a73ee0bSGeorge Keishing # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'}, 945a73ee0bSGeorge Keishing # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}] 9597c93945SGeorge Keishing ${resp_list}= Redfish_Utils.List Request 9697c93945SGeorge Keishing ... /redfish/v1/SessionService/Sessions 976fed4436SGeorge Keishing 986fed4436SGeorge Keishing Redfish.Delete ${session_info["location"]} 995a73ee0bSGeorge Keishing 10097c93945SGeorge Keishing ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions 1016fed4436SGeorge Keishing List Should Not Contain Value ${resp} ${session_info["location"]} 1024db114ccSGeorge Keishing 1036510cfbeSGeorge Keishing 104da5a81d0SGeorge KeishingRedfish Login Via SessionService 105da5a81d0SGeorge Keishing [Documentation] Login to BMC via redfish session service. 106da5a81d0SGeorge Keishing [Tags] Redfish_Login_Via_SessionService 107da5a81d0SGeorge Keishing 108da5a81d0SGeorge Keishing Create Session openbmc https://${OPENBMC_HOST} 109da5a81d0SGeorge Keishing ${headers}= Create Dictionary Content-Type=application/json 110*fbd67007SGeorge Keishing ${data}= Set Variable {"UserName":"${OPENBMC_USERNAME}", "Password":"${OPENBMC_PASSWORD}"} 111da5a81d0SGeorge Keishing 112*fbd67007SGeorge Keishing ${resp}= POST On Session openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers} 113da5a81d0SGeorge Keishing Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED} 114da5a81d0SGeorge Keishing 115da5a81d0SGeorge Keishing ${headers}= Create Dictionary Content-Type=application/json 116da5a81d0SGeorge Keishing ... X-Auth-Token=${resp.headers["X-Auth-Token"]} 117*fbd67007SGeorge Keishing ${resp}= DELETE On Session openbmc ${REDFISH_SESSION}${/}${resp.json()["Id"]} headers=${headers} 118da5a81d0SGeorge Keishing Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} 119da5a81d0SGeorge Keishing 120da5a81d0SGeorge Keishing 1216d2d42fcSAnusha DathatriVerify Redfish Unresponsive URL paths 1226d2d42fcSAnusha Dathatri [Documentation] Verify that all URLs in /redfish/v1 respond. 1236d2d42fcSAnusha Dathatri [Tags] Verify_Redfish_Unresponsive_URL_paths 1246d2d42fcSAnusha Dathatri 1256d2d42fcSAnusha Dathatri Redfish.Login 1266d2d42fcSAnusha Dathatri ${resource_list} ${dead_resources}= Enumerate Request /redfish/v1 include_dead_resources=True 1276d2d42fcSAnusha Dathatri Redfish.Logout 1286d2d42fcSAnusha Dathatri Valid Length dead_resources max_length=0 1296d2d42fcSAnusha Dathatri 1306d2d42fcSAnusha Dathatri 1316510cfbeSGeorge Keishing*** Keywords *** 1326510cfbeSGeorge Keishing 1336510cfbeSGeorge KeishingGET And Verify Redfish Response 1346510cfbeSGeorge Keishing [Documentation] GET given resource and verfiy response. 13597c93945SGeorge Keishing [Arguments] ${valid_status_codes} ${resource_path} 1366510cfbeSGeorge Keishing 13797c93945SGeorge Keishing # Description of argument(s): 13897c93945SGeorge Keishing # valid_status_codes A comma-separated list of acceptable 13997c93945SGeorge Keishing # status codes (e.g. 200). 1406510cfbeSGeorge Keishing # resource_path Redfish resource URL path. 1416510cfbeSGeorge Keishing 14297c93945SGeorge Keishing ${resp}= Redfish.Get ${resource_path} 14397c93945SGeorge Keishing ... valid_status_codes=[${valid_status_codes}] 144