blob: 51bc5610b21e1a914c973d8b206e43c57063906b [file] [log] [blame]
George Keishing5a73ee02019-01-28 08:21:47 -06001*** Settings ***
Joy Onyerikwudbfe97d2019-03-11 19:44:56 -05002Documentation Test Redfish to verify responses for SessionService and Hypermedia.
George Keishing97c93942019-03-04 12:45:07 -06003
Sandhya Somashekar839a0c22019-01-31 05:05:43 -06004Resource ../../lib/resource.robot
George Keishing5a73ee02019-01-28 08:21:47 -06005Resource ../../lib/bmc_redfish_resource.robot
George Keishing3298d5c2019-02-12 06:59:25 -06006Resource ../../lib/openbmc_ffdc.robot
7
George Keishing97c93942019-03-04 12:45:07 -06008
George Keishing3298d5c2019-02-12 06:59:25 -06009Test Teardown FFDC On Test Case Fail
Michael Walshc108e422019-03-28 12:27:18 -050010Test Setup Printn
George Keishing5a73ee02019-01-28 08:21:47 -060011
George Keishing5a73ee02019-01-28 08:21:47 -060012*** Test Cases ***
13
George Keishing5ee33d92019-02-02 12:33:25 -060014Redfish Login And Logout
George Keishing5a73ee02019-01-28 08:21:47 -060015 [Documentation] Login to BMCweb and then logout.
George Keishing5ee33d92019-02-02 12:33:25 -060016 [Tags] Redfish_Login_And_Logout
George Keishing5a73ee02019-01-28 08:21:47 -060017
George Keishing97c93942019-03-04 12:45:07 -060018 Redfish.Login
19 Redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060020
21
George Keishing5ee33d92019-02-02 12:33:25 -060022GET Redfish Hypermedia Without Login
George Keishing6510cfb2019-01-31 12:28:36 -060023 [Documentation] GET hypermedia URL without login.
George Keishing5ee33d92019-02-02 12:33:25 -060024 [Tags] GET_Redfish_Hypermedia_Without_Login
George Keishing6510cfb2019-01-31 12:28:36 -060025 [Template] GET And Verify Redfish Response
George Keishing5a73ee02019-01-28 08:21:47 -060026
George Keishing6510cfb2019-01-31 12:28:36 -060027 # Expect status Resource URL Path
28 ${HTTP_OK} /
29 ${HTTP_OK} /redfish
30 ${HTTP_OK} /redfish/v1
George Keishing5a73ee02019-01-28 08:21:47 -060031
32
George Keishing5ee33d92019-02-02 12:33:25 -060033GET Redfish SessionService Resource With Login
George Keishing5a73ee02019-01-28 08:21:47 -060034 [Documentation] Login to BMCweb and get /redfish/v1/SessionService.
George Keishing5ee33d92019-02-02 12:33:25 -060035 [Tags] GET_Redfish_SessionService_Resource_With_Login
George Keishing5a73ee02019-01-28 08:21:47 -060036
George Keishing97c93942019-03-04 12:45:07 -060037 Redfish.Login
38 ${resp}= Redfish.Get /redfish/v1/SessionService
39 Redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060040
41
George Keishing5ee33d92019-02-02 12:33:25 -060042GET Redfish SessionService Without Login
George Keishing5a73ee02019-01-28 08:21:47 -060043 [Documentation] Get /redfish/v1/SessionService without login
George Keishing5ee33d92019-02-02 12:33:25 -060044 [Tags] GET_Redfish_SessionService_Without_Login
George Keishing5a73ee02019-01-28 08:21:47 -060045
George Keishing97c93942019-03-04 12:45:07 -060046 ${resp}= Redfish.Get /redfish/v1/SessionService
47 ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
George Keishing5a73ee02019-01-28 08:21:47 -060048
49
George Keishing5ee33d92019-02-02 12:33:25 -060050Redfish Login Using Invalid Token
George Keishing5a73ee02019-01-28 08:21:47 -060051 [Documentation] Login to BMCweb with invalid token.
George Keishing5ee33d92019-02-02 12:33:25 -060052 [Tags] Redfish_Login_Using_Invalid_Token
George Keishing5a73ee02019-01-28 08:21:47 -060053
George Keishing5a73ee02019-01-28 08:21:47 -060054 Create Session openbmc ${AUTH_URI}
55
56 # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun"
57 ${headers}= Create Dictionary Content-Type=application/json
58 ... X-Auth-Token=deadbeef
59
60 ${resp}= Get Request
61 ... openbmc /redfish/v1/SessionService/Sessions headers=${headers}
62
63 Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
64
65
George Keishing5ee33d92019-02-02 12:33:25 -060066Delete Redfish Session Using Valid login
George Keishing5a73ee02019-01-28 08:21:47 -060067 [Documentation] Delete a session using valid login.
George Keishing5ee33d92019-02-02 12:33:25 -060068 [Tags] Delete_Redfish_Session_Using_Valid_Login
George Keishing5a73ee02019-01-28 08:21:47 -060069
George Keishing97c93942019-03-04 12:45:07 -060070 Redfish.Login
George Keishing6fed4432019-03-25 14:45:29 -050071 ${session_info}= Get Redfish Session Info
72
George Keishing97c93942019-03-04 12:45:07 -060073 Redfish.Login
George Keishing5a73ee02019-01-28 08:21:47 -060074
75 # Example o/p:
76 # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
77 # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
George Keishing97c93942019-03-04 12:45:07 -060078 ${resp_list}= Redfish_Utils.List Request
79 ... /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -050080
81 Redfish.Delete ${session_info["location"]}
George Keishing5a73ee02019-01-28 08:21:47 -060082
George Keishing97c93942019-03-04 12:45:07 -060083 ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -050084 List Should Not Contain Value ${resp} ${session_info["location"]}
George Keishing4db114c2019-02-02 07:22:17 -060085
George Keishing6510cfb2019-01-31 12:28:36 -060086
87*** Keywords ***
88
89GET And Verify Redfish Response
90 [Documentation] GET given resource and verfiy response.
George Keishing97c93942019-03-04 12:45:07 -060091 [Arguments] ${valid_status_codes} ${resource_path}
George Keishing6510cfb2019-01-31 12:28:36 -060092
George Keishing97c93942019-03-04 12:45:07 -060093 # Description of argument(s):
94 # valid_status_codes A comma-separated list of acceptable
95 # status codes (e.g. 200).
96 # resource_path Redfish resource URL path.
George Keishing6510cfb2019-01-31 12:28:36 -060097
George Keishing97c93942019-03-04 12:45:07 -060098 ${resp}= Redfish.Get ${resource_path}
99 ... valid_status_codes=[${valid_status_codes}]