xref: /openbmc/openbmc-test-automation/redfish/service_root/test_service_root.robot (revision dbfe97db0dff00007ae6bc7042c5d21d2345c71f)
15a73ee0bSGeorge Keishing*** Settings ***
2*dbfe97dbSJoy 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
1097c93945SGeorge KeishingTest Setup       Rprintn
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
665ee33d93SGeorge KeishingDelete Redfish Session Using Valid login
675a73ee0bSGeorge Keishing    [Documentation]  Delete a session using valid login.
685ee33d93SGeorge Keishing    [Tags]  Delete_Redfish_Session_Using_Valid_Login
695a73ee0bSGeorge Keishing
7097c93945SGeorge Keishing    Redfish.Login
7197c93945SGeorge Keishing    Redfish.Login
725a73ee0bSGeorge Keishing
735a73ee0bSGeorge Keishing    # Example o/p:
745a73ee0bSGeorge Keishing    # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
755a73ee0bSGeorge Keishing    #  {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
7697c93945SGeorge Keishing    ${resp_list}=  Redfish_Utils.List Request
7797c93945SGeorge Keishing    ...  /redfish/v1/SessionService/Sessions
7897c93945SGeorge Keishing    Redfish.Delete  ${resp_list[1]}
795a73ee0bSGeorge Keishing
8097c93945SGeorge Keishing    ${resp}=  Redfish_Utils.List Request  /redfish/v1/SessionService/Sessions
813a813a97SGeorge Keishing    List Should Not Contain Value  ${resp}  ${resp_list[1]}
824db114ccSGeorge Keishing
836510cfbeSGeorge Keishing
846510cfbeSGeorge Keishing*** Keywords ***
856510cfbeSGeorge Keishing
866510cfbeSGeorge KeishingGET And Verify Redfish Response
876510cfbeSGeorge Keishing    [Documentation]  GET given resource and verfiy response.
8897c93945SGeorge Keishing    [Arguments]  ${valid_status_codes}  ${resource_path}
896510cfbeSGeorge Keishing
9097c93945SGeorge Keishing    # Description of argument(s):
9197c93945SGeorge Keishing    # valid_status_codes            A comma-separated list of acceptable
9297c93945SGeorge Keishing    #                               status codes (e.g. 200).
936510cfbeSGeorge Keishing    # resource_path                 Redfish resource URL path.
946510cfbeSGeorge Keishing
9597c93945SGeorge Keishing    ${resp}=  Redfish.Get  ${resource_path}
9697c93945SGeorge Keishing    ...  valid_status_codes=[${valid_status_codes}]
97