blob: 9e4c2bac9d6a0bf59fe0925afcb59f926028bb55 [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
George Keishing54316852023-10-16 14:03:29 +053011Force Tags Service_Root
12
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
52 ${HTTP_OK} /redfish/v1/Systems/system
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
80 Redfish.Get /redfish/v1/idontexist valid_status_codes=[${HTTP_NOT_FOUND}]
81 Redfish.Logout
82
83
George Keishing5236ec52022-01-31 12:07:58 -060084Delete Redfish Session Using Valid Login
George Keishing5a73ee02019-01-28 08:21:47 -060085 [Documentation] Delete a session using valid login.
George Keishing5ee33d92019-02-02 12:33:25 -060086 [Tags] Delete_Redfish_Session_Using_Valid_Login
George Keishing5a73ee02019-01-28 08:21:47 -060087
George Keishing97c93942019-03-04 12:45:07 -060088 Redfish.Login
George Keishing6fed4432019-03-25 14:45:29 -050089 ${session_info}= Get Redfish Session Info
90
George Keishing97c93942019-03-04 12:45:07 -060091 Redfish.Login
George Keishing5a73ee02019-01-28 08:21:47 -060092
93 # Example o/p:
94 # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
95 # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
George Keishing97c93942019-03-04 12:45:07 -060096 ${resp_list}= Redfish_Utils.List Request
97 ... /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -050098
99 Redfish.Delete ${session_info["location"]}
George Keishing5a73ee02019-01-28 08:21:47 -0600100
George Keishing97c93942019-03-04 12:45:07 -0600101 ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -0500102 List Should Not Contain Value ${resp} ${session_info["location"]}
George Keishing4db114c2019-02-02 07:22:17 -0600103
George Keishing6510cfb2019-01-31 12:28:36 -0600104
George Keishingda5a81d2019-07-18 04:40:42 -0500105Redfish Login Via SessionService
106 [Documentation] Login to BMC via redfish session service.
107 [Tags] Redfish_Login_Via_SessionService
108
Matt Fischer69546022023-10-24 15:33:42 -0600109 Create Session openbmc https://${OPENBMC_HOST}:${HTTPS_PORT}
George Keishingda5a81d2019-07-18 04:40:42 -0500110 ${headers}= Create Dictionary Content-Type=application/json
George Keishingfbd67002022-08-01 11:24:03 -0500111 ${data}= Set Variable {"UserName":"${OPENBMC_USERNAME}", "Password":"${OPENBMC_PASSWORD}"}
George Keishingda5a81d2019-07-18 04:40:42 -0500112
George Keishingfbd67002022-08-01 11:24:03 -0500113 ${resp}= POST On Session openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers}
George Keishingda5a81d2019-07-18 04:40:42 -0500114 Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED}
115
George Keishingda5a81d2019-07-18 04:40:42 -0500116 ${headers}= Create Dictionary Content-Type=application/json
117 ... X-Auth-Token=${resp.headers["X-Auth-Token"]}
George Keishingfbd67002022-08-01 11:24:03 -0500118 ${resp}= DELETE On Session openbmc ${REDFISH_SESSION}${/}${resp.json()["Id"]} headers=${headers}
George Keishingda5a81d2019-07-18 04:40:42 -0500119 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
120
121
Anusha Dathatri6d2d42f2019-11-20 06:17:51 -0600122Verify Redfish Unresponsive URL paths
123 [Documentation] Verify that all URLs in /redfish/v1 respond.
124 [Tags] Verify_Redfish_Unresponsive_URL_paths
125
126 Redfish.Login
127 ${resource_list} ${dead_resources}= Enumerate Request /redfish/v1 include_dead_resources=True
128 Redfish.Logout
129 Valid Length dead_resources max_length=0
130
131
George Keishing6510cfb2019-01-31 12:28:36 -0600132*** Keywords ***
133
134GET And Verify Redfish Response
George Keishinge16f1582022-12-15 07:32:21 -0600135 [Documentation] GET given resource and verify response.
George Keishing97c93942019-03-04 12:45:07 -0600136 [Arguments] ${valid_status_codes} ${resource_path}
George Keishing6510cfb2019-01-31 12:28:36 -0600137
George Keishing97c93942019-03-04 12:45:07 -0600138 # Description of argument(s):
139 # valid_status_codes A comma-separated list of acceptable
140 # status codes (e.g. 200).
141 # resource_path Redfish resource URL path.
George Keishing6510cfb2019-01-31 12:28:36 -0600142
George Keishing97c93942019-03-04 12:45:07 -0600143 ${resp}= Redfish.Get ${resource_path}
144 ... valid_status_codes=[${valid_status_codes}]