1*** Settings *** 2Resource ../../lib/resource.txt 3Resource ../../lib/bmc_redfish_resource.robot 4 5*** Test Cases *** 6 7Login And Logout BMCweb 8 [Documentation] Login to BMCweb and then logout. 9 [Tags] Login_And_Logout_BMCweb 10 11 redfish.Login 12 redfish.Logout 13 14 15GET BMCweb Hypermedia Without Login 16 [Documentation] GET hypermedia URL without login. 17 [Tags] GET_BMCweb_Hypermedia_Without_Login 18 [Template] GET And Verify Redfish Response 19 20 # Expect status Resource URL Path 21 ${HTTP_OK} / 22 ${HTTP_OK} /redfish 23 ${HTTP_OK} /redfish/v1 24 25 26GET SessionService Resource With Login 27 [Documentation] Login to BMCweb and get /redfish/v1/SessionService. 28 [Tags] GET_SessionService_Resource_With_Login 29 30 redfish.Login 31 ${resp}= redfish.Get /redfish/v1/SessionService 32 Should Be Equal As Strings ${resp.status} ${HTTP_OK} 33 34 35GET SessionService Without Login 36 [Documentation] Get /redfish/v1/SessionService without login 37 [Tags] GET_SessionService_Without_Login 38 39 redfish.Logout 40 ${resp}= redfish.Get /redfish/v1/SessionService 41 Should Be Equal As Strings ${resp.status} ${HTTP_UNAUTHORIZED} 42 43 44Login Using Invalid Token 45 [Documentation] Login to BMCweb with invalid token. 46 [Tags] Login_Using_Invalid_Token 47 48 redfish.Logout 49 50 Create Session openbmc ${AUTH_URI} 51 52 # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun" 53 ${headers}= Create Dictionary Content-Type=application/json 54 ... X-Auth-Token=deadbeef 55 56 ${resp}= Get Request 57 ... openbmc /redfish/v1/SessionService/Sessions headers=${headers} 58 59 Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED} 60 61 62Delete Session Using Valid login 63 [Documentation] Delete a session using valid login. 64 [Tags] Delete_Session_Using_Valid_Login 65 66 redfish.Login 67 68 # Example o/p: 69 # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'}, 70 # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}] 71 ${resp_list}= redfish.Get /redfish/v1/SessionService/Sessions 72 73 redfish.Delete ${resp_list.dict["Members"][0]["@odata.id"]} 74 75 ${resp}= redfish.Get /redfish/v1/SessionService/Sessions 76 Should Not Contain ${resp.dict["Members"]} ${resp_list.dict["Members"][0]["@odata.id"]} 77 redfish.Logout 78 79 80*** Keywords *** 81 82GET And Verify Redfish Response 83 [Documentation] GET given resource and verfiy response. 84 [Arguments] ${expected_response_code} ${resource_path} 85 86 # Description of arguments: 87 # expected_response_code Expected REST status codes. 88 # resource_path Redfish resource URL path. 89 90 ${resp}= redfish.Get ${resource_path} 91 Should Be Equal As Strings ${resp.status} ${expected_response_code} 92