blob: 1a7888cfced4bada2b603f15cbf70ee9f3bd27d9 [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
George Keishing5a73ee02019-01-28 08:21:47 -06004Resource ../../lib/bmc_redfish_resource.robot
George Keishing3298d5c2019-02-12 06:59:25 -06005Resource ../../lib/openbmc_ffdc.robot
6
George Keishing97c93942019-03-04 12:45:07 -06007
George Keishing3298d5c2019-02-12 06:59:25 -06008Test Teardown FFDC On Test Case Fail
Michael Walshc108e422019-03-28 12:27:18 -05009Test Setup Printn
George Keishing5a73ee02019-01-28 08:21:47 -060010
Matt Fischer6fb70d92023-10-24 19:06:33 -060011Test Tags Service_Root
George Keishing54316852023-10-16 14:03:29 +053012
George Keishing5a73ee02019-01-28 08:21:47 -060013*** Test Cases ***
14
George Keishing5ee33d92019-02-02 12:33:25 -060015Redfish Login And Logout
George Keishing5a73ee02019-01-28 08:21:47 -060016 [Documentation] Login to BMCweb and then logout.
George Keishing5ee33d92019-02-02 12:33:25 -060017 [Tags] Redfish_Login_And_Logout
George Keishing5a73ee02019-01-28 08:21:47 -060018
George Keishing97c93942019-03-04 12:45:07 -060019 Redfish.Login
20 Redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060021
22
George Keishing5ee33d92019-02-02 12:33:25 -060023GET Redfish Hypermedia Without Login
George Keishing6510cfb2019-01-31 12:28:36 -060024 [Documentation] GET hypermedia URL without login.
George Keishing5ee33d92019-02-02 12:33:25 -060025 [Tags] GET_Redfish_Hypermedia_Without_Login
Lei YUebe7e952020-01-16 14:18:04 +080026 [Setup] Redfish.Logout
George Keishing6510cfb2019-01-31 12:28:36 -060027 [Template] GET And Verify Redfish Response
George Keishing5a73ee02019-01-28 08:21:47 -060028
George Keishing6510cfb2019-01-31 12:28:36 -060029 # Expect status Resource URL Path
George Keishing6510cfb2019-01-31 12:28:36 -060030 ${HTTP_OK} /redfish
31 ${HTTP_OK} /redfish/v1
George Keishing5a73ee02019-01-28 08:21:47 -060032
33
George Keishing5ee33d92019-02-02 12:33:25 -060034GET Redfish SessionService Without Login
George Keishing5a73ee02019-01-28 08:21:47 -060035 [Documentation] Get /redfish/v1/SessionService without login
George Keishing5ee33d92019-02-02 12:33:25 -060036 [Tags] GET_Redfish_SessionService_Without_Login
Lei YUebe7e952020-01-16 14:18:04 +080037 [Setup] Redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060038
George Keishing97c93942019-03-04 12:45:07 -060039 ${resp}= Redfish.Get /redfish/v1/SessionService
40 ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
George Keishing5a73ee02019-01-28 08:21:47 -060041
42
George Keishingc681a632019-07-12 07:17:16 -050043GET Redfish Resources With Login
44 [Documentation] Login to BMCweb and GET valid resource.
45 [Tags] GET_Redfish_Resources_With_Login
46 [Setup] Redfish.Login
47 [Template] GET And Verify Redfish Response
48
49 # Expect status Resource URL Path
50 ${HTTP_OK} /redfish/v1/SessionService
51 ${HTTP_OK} /redfish/v1/AccountService
Yi Huc32434a2024-01-11 17:33:10 -080052 ${HTTP_OK} /redfish/v1/Systems/${SYSTEM_ID}
Tony Lee2b975822021-04-01 11:15:00 +080053 ${HTTP_OK} /redfish/v1/Chassis/${CHASSIS_ID}
ganesanb4d430282023-04-27 14:33:23 +000054 ${HTTP_OK} /redfish/v1/Managers/${MANAGER_ID}
George Keishingc681a632019-07-12 07:17:16 -050055 ${HTTP_OK} /redfish/v1/UpdateService
56
57
George Keishing5ee33d92019-02-02 12:33:25 -060058Redfish Login Using Invalid Token
George Keishing5a73ee02019-01-28 08:21:47 -060059 [Documentation] Login to BMCweb with invalid token.
George Keishing5ee33d92019-02-02 12:33:25 -060060 [Tags] Redfish_Login_Using_Invalid_Token
George Keishing5a73ee02019-01-28 08:21:47 -060061
George Keishing5a73ee02019-01-28 08:21:47 -060062 Create Session openbmc ${AUTH_URI}
63
64 # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun"
65 ${headers}= Create Dictionary Content-Type=application/json
66 ... X-Auth-Token=deadbeef
67
George Keishingfbd67002022-08-01 11:24:03 -050068 ${resp}= GET On Session
George Keishing5a73ee02019-01-28 08:21:47 -060069 ... openbmc /redfish/v1/SessionService/Sessions headers=${headers}
George Keishingfbd67002022-08-01 11:24:03 -050070 ... expected_status=${HTTP_UNAUTHORIZED}
George Keishing5a73ee02019-01-28 08:21:47 -060071
72 Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
73
74
George Keishing07e41092019-05-23 23:09:51 -050075Verify Redfish Invalid URL Response Code
76 [Documentation] Login to BMCweb and verify error response code.
77 [Tags] Verify_Redfish_Invalid_URL_Response_Code
78
79 Redfish.Login
George Keishing43909f32024-08-20 22:08:02 +053080 Wait Until Keyword Succeeds 1 min 30 sec
81 ... Redfish.Get /redfish/v1/idontexist valid_status_codes=[${HTTP_NOT_FOUND}]
George Keishing07e41092019-05-23 23:09:51 -050082 Redfish.Logout
83
84
George Keishing5236ec52022-01-31 12:07:58 -060085Delete Redfish Session Using Valid Login
George Keishing5a73ee02019-01-28 08:21:47 -060086 [Documentation] Delete a session using valid login.
George Keishing5ee33d92019-02-02 12:33:25 -060087 [Tags] Delete_Redfish_Session_Using_Valid_Login
George Keishing5a73ee02019-01-28 08:21:47 -060088
George Keishing97c93942019-03-04 12:45:07 -060089 Redfish.Login
George Keishing6fed4432019-03-25 14:45:29 -050090 ${session_info}= Get Redfish Session Info
91
George Keishing97c93942019-03-04 12:45:07 -060092 Redfish.Login
George Keishing5a73ee02019-01-28 08:21:47 -060093
94 # Example o/p:
95 # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
96 # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
George Keishing97c93942019-03-04 12:45:07 -060097 ${resp_list}= Redfish_Utils.List Request
98 ... /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -050099
100 Redfish.Delete ${session_info["location"]}
George Keishing5a73ee02019-01-28 08:21:47 -0600101
George Keishing97c93942019-03-04 12:45:07 -0600102 ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -0500103 List Should Not Contain Value ${resp} ${session_info["location"]}
George Keishing4db114c2019-02-02 07:22:17 -0600104
George Keishing6510cfb2019-01-31 12:28:36 -0600105
George Keishingda5a81d2019-07-18 04:40:42 -0500106Redfish Login Via SessionService
107 [Documentation] Login to BMC via redfish session service.
108 [Tags] Redfish_Login_Via_SessionService
109
Matt Fischer69546022023-10-24 15:33:42 -0600110 Create Session openbmc https://${OPENBMC_HOST}:${HTTPS_PORT}
George Keishingda5a81d2019-07-18 04:40:42 -0500111 ${headers}= Create Dictionary Content-Type=application/json
George Keishingfbd67002022-08-01 11:24:03 -0500112 ${data}= Set Variable {"UserName":"${OPENBMC_USERNAME}", "Password":"${OPENBMC_PASSWORD}"}
George Keishingda5a81d2019-07-18 04:40:42 -0500113
George Keishingfbd67002022-08-01 11:24:03 -0500114 ${resp}= POST On Session openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers}
George Keishingda5a81d2019-07-18 04:40:42 -0500115 Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED}
116
George Keishingda5a81d2019-07-18 04:40:42 -0500117 ${headers}= Create Dictionary Content-Type=application/json
118 ... X-Auth-Token=${resp.headers["X-Auth-Token"]}
George Keishingfbd67002022-08-01 11:24:03 -0500119 ${resp}= DELETE On Session openbmc ${REDFISH_SESSION}${/}${resp.json()["Id"]} headers=${headers}
George Keishingda5a81d2019-07-18 04:40:42 -0500120 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
121
122
Anusha Dathatri6d2d42f2019-11-20 06:17:51 -0600123Verify Redfish Unresponsive URL paths
124 [Documentation] Verify that all URLs in /redfish/v1 respond.
125 [Tags] Verify_Redfish_Unresponsive_URL_paths
126
127 Redfish.Login
128 ${resource_list} ${dead_resources}= Enumerate Request /redfish/v1 include_dead_resources=True
129 Redfish.Logout
130 Valid Length dead_resources max_length=0
131
132
George Keishing6510cfb2019-01-31 12:28:36 -0600133*** Keywords ***
134
135GET And Verify Redfish Response
George Keishinge16f1582022-12-15 07:32:21 -0600136 [Documentation] GET given resource and verify response.
George Keishing97c93942019-03-04 12:45:07 -0600137 [Arguments] ${valid_status_codes} ${resource_path}
George Keishing6510cfb2019-01-31 12:28:36 -0600138
George Keishing97c93942019-03-04 12:45:07 -0600139 # Description of argument(s):
140 # valid_status_codes A comma-separated list of acceptable
141 # status codes (e.g. 200).
142 # resource_path Redfish resource URL path.
George Keishing6510cfb2019-01-31 12:28:36 -0600143
George Keishing97c93942019-03-04 12:45:07 -0600144 ${resp}= Redfish.Get ${resource_path}
145 ... valid_status_codes=[${valid_status_codes}]