blob: a360c3fe55ff5f6e7376cf7a278e4d2078e356bc [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 Keishing5a73ee02019-01-28 08:21:47 -060011*** Test Cases ***
12
George Keishing5ee33d92019-02-02 12:33:25 -060013Redfish Login And Logout
George Keishing5a73ee02019-01-28 08:21:47 -060014 [Documentation] Login to BMCweb and then logout.
George Keishing5ee33d92019-02-02 12:33:25 -060015 [Tags] Redfish_Login_And_Logout
George Keishing5a73ee02019-01-28 08:21:47 -060016
George Keishing97c93942019-03-04 12:45:07 -060017 Redfish.Login
18 Redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060019
20
George Keishing5ee33d92019-02-02 12:33:25 -060021GET Redfish Hypermedia Without Login
George Keishing6510cfb2019-01-31 12:28:36 -060022 [Documentation] GET hypermedia URL without login.
George Keishing5ee33d92019-02-02 12:33:25 -060023 [Tags] GET_Redfish_Hypermedia_Without_Login
Lei YUebe7e952020-01-16 14:18:04 +080024 [Setup] Redfish.Logout
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
George Keishing6510cfb2019-01-31 12:28:36 -060028 ${HTTP_OK} /redfish
29 ${HTTP_OK} /redfish/v1
George Keishing5a73ee02019-01-28 08:21:47 -060030
31
George Keishing5ee33d92019-02-02 12:33:25 -060032GET Redfish SessionService Without Login
George Keishing5a73ee02019-01-28 08:21:47 -060033 [Documentation] Get /redfish/v1/SessionService without login
George Keishing5ee33d92019-02-02 12:33:25 -060034 [Tags] GET_Redfish_SessionService_Without_Login
Lei YUebe7e952020-01-16 14:18:04 +080035 [Setup] Redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060036
George Keishing97c93942019-03-04 12:45:07 -060037 ${resp}= Redfish.Get /redfish/v1/SessionService
38 ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
George Keishing5a73ee02019-01-28 08:21:47 -060039
40
George Keishingc681a632019-07-12 07:17:16 -050041GET Redfish Resources With Login
42 [Documentation] Login to BMCweb and GET valid resource.
43 [Tags] GET_Redfish_Resources_With_Login
44 [Setup] Redfish.Login
45 [Template] GET And Verify Redfish Response
46
47 # Expect status Resource URL Path
48 ${HTTP_OK} /redfish/v1/SessionService
49 ${HTTP_OK} /redfish/v1/AccountService
50 ${HTTP_OK} /redfish/v1/Systems/system
Tony Lee2b975822021-04-01 11:15:00 +080051 ${HTTP_OK} /redfish/v1/Chassis/${CHASSIS_ID}
George Keishingc681a632019-07-12 07:17:16 -050052 ${HTTP_OK} /redfish/v1/Managers/bmc
53 ${HTTP_OK} /redfish/v1/UpdateService
54
55
George Keishing5ee33d92019-02-02 12:33:25 -060056Redfish Login Using Invalid Token
George Keishing5a73ee02019-01-28 08:21:47 -060057 [Documentation] Login to BMCweb with invalid token.
George Keishing5ee33d92019-02-02 12:33:25 -060058 [Tags] Redfish_Login_Using_Invalid_Token
George Keishing5a73ee02019-01-28 08:21:47 -060059
George Keishing5a73ee02019-01-28 08:21:47 -060060 Create Session openbmc ${AUTH_URI}
61
62 # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun"
63 ${headers}= Create Dictionary Content-Type=application/json
64 ... X-Auth-Token=deadbeef
65
George Keishingfbd67002022-08-01 11:24:03 -050066 ${resp}= GET On Session
George Keishing5a73ee02019-01-28 08:21:47 -060067 ... openbmc /redfish/v1/SessionService/Sessions headers=${headers}
George Keishingfbd67002022-08-01 11:24:03 -050068 ... expected_status=${HTTP_UNAUTHORIZED}
George Keishing5a73ee02019-01-28 08:21:47 -060069
70 Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
71
72
George Keishing07e41092019-05-23 23:09:51 -050073Verify Redfish Invalid URL Response Code
74 [Documentation] Login to BMCweb and verify error response code.
75 [Tags] Verify_Redfish_Invalid_URL_Response_Code
76
77 Redfish.Login
78 Redfish.Get /redfish/v1/idontexist valid_status_codes=[${HTTP_NOT_FOUND}]
79 Redfish.Logout
80
81
George Keishing5236ec52022-01-31 12:07:58 -060082Delete Redfish Session Using Valid Login
George Keishing5a73ee02019-01-28 08:21:47 -060083 [Documentation] Delete a session using valid login.
George Keishing5ee33d92019-02-02 12:33:25 -060084 [Tags] Delete_Redfish_Session_Using_Valid_Login
George Keishing5a73ee02019-01-28 08:21:47 -060085
George Keishing97c93942019-03-04 12:45:07 -060086 Redfish.Login
George Keishing6fed4432019-03-25 14:45:29 -050087 ${session_info}= Get Redfish Session Info
88
George Keishing97c93942019-03-04 12:45:07 -060089 Redfish.Login
George Keishing5a73ee02019-01-28 08:21:47 -060090
91 # Example o/p:
92 # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
93 # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
George Keishing97c93942019-03-04 12:45:07 -060094 ${resp_list}= Redfish_Utils.List Request
95 ... /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -050096
97 Redfish.Delete ${session_info["location"]}
George Keishing5a73ee02019-01-28 08:21:47 -060098
George Keishing97c93942019-03-04 12:45:07 -060099 ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -0500100 List Should Not Contain Value ${resp} ${session_info["location"]}
George Keishing4db114c2019-02-02 07:22:17 -0600101
George Keishing6510cfb2019-01-31 12:28:36 -0600102
George Keishingda5a81d2019-07-18 04:40:42 -0500103Redfish Login Via SessionService
104 [Documentation] Login to BMC via redfish session service.
105 [Tags] Redfish_Login_Via_SessionService
106
107 Create Session openbmc https://${OPENBMC_HOST}
108 ${headers}= Create Dictionary Content-Type=application/json
George Keishingfbd67002022-08-01 11:24:03 -0500109 ${data}= Set Variable {"UserName":"${OPENBMC_USERNAME}", "Password":"${OPENBMC_PASSWORD}"}
George Keishingda5a81d2019-07-18 04:40:42 -0500110
George Keishingfbd67002022-08-01 11:24:03 -0500111 ${resp}= POST On Session openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers}
George Keishingda5a81d2019-07-18 04:40:42 -0500112 Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED}
113
George Keishingda5a81d2019-07-18 04:40:42 -0500114 ${headers}= Create Dictionary Content-Type=application/json
115 ... X-Auth-Token=${resp.headers["X-Auth-Token"]}
George Keishingfbd67002022-08-01 11:24:03 -0500116 ${resp}= DELETE On Session openbmc ${REDFISH_SESSION}${/}${resp.json()["Id"]} headers=${headers}
George Keishingda5a81d2019-07-18 04:40:42 -0500117 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
118
119
Anusha Dathatri6d2d42f2019-11-20 06:17:51 -0600120Verify Redfish Unresponsive URL paths
121 [Documentation] Verify that all URLs in /redfish/v1 respond.
122 [Tags] Verify_Redfish_Unresponsive_URL_paths
123
124 Redfish.Login
125 ${resource_list} ${dead_resources}= Enumerate Request /redfish/v1 include_dead_resources=True
126 Redfish.Logout
127 Valid Length dead_resources max_length=0
128
129
George Keishing6510cfb2019-01-31 12:28:36 -0600130*** Keywords ***
131
132GET And Verify Redfish Response
George Keishinge16f1582022-12-15 07:32:21 -0600133 [Documentation] GET given resource and verify response.
George Keishing97c93942019-03-04 12:45:07 -0600134 [Arguments] ${valid_status_codes} ${resource_path}
George Keishing6510cfb2019-01-31 12:28:36 -0600135
George Keishing97c93942019-03-04 12:45:07 -0600136 # Description of argument(s):
137 # valid_status_codes A comma-separated list of acceptable
138 # status codes (e.g. 200).
139 # resource_path Redfish resource URL path.
George Keishing6510cfb2019-01-31 12:28:36 -0600140
George Keishing97c93942019-03-04 12:45:07 -0600141 ${resp}= Redfish.Get ${resource_path}
142 ... valid_status_codes=[${valid_status_codes}]