George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 1 | *** Settings *** |
Joy Onyerikwu | dbfe97d | 2019-03-11 19:44:56 -0500 | [diff] [blame] | 2 | Documentation Test Redfish to verify responses for SessionService and Hypermedia. |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 3 | |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 4 | Resource ../../lib/bmc_redfish_resource.robot |
George Keishing | 3298d5c | 2019-02-12 06:59:25 -0600 | [diff] [blame] | 5 | Resource ../../lib/openbmc_ffdc.robot |
| 6 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 7 | |
George Keishing | 3298d5c | 2019-02-12 06:59:25 -0600 | [diff] [blame] | 8 | Test Teardown FFDC On Test Case Fail |
Michael Walsh | c108e42 | 2019-03-28 12:27:18 -0500 | [diff] [blame] | 9 | Test Setup Printn |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 10 | |
George Keishing | 5431685 | 2023-10-16 14:03:29 +0530 | [diff] [blame] | 11 | Force Tags Service_Root |
| 12 | |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 13 | *** Test Cases *** |
| 14 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 15 | Redfish Login And Logout |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 16 | [Documentation] Login to BMCweb and then logout. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 17 | [Tags] Redfish_Login_And_Logout |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 18 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 19 | Redfish.Login |
| 20 | Redfish.Logout |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 21 | |
| 22 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 23 | GET Redfish Hypermedia Without Login |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 24 | [Documentation] GET hypermedia URL without login. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 25 | [Tags] GET_Redfish_Hypermedia_Without_Login |
Lei YU | ebe7e95 | 2020-01-16 14:18:04 +0800 | [diff] [blame] | 26 | [Setup] Redfish.Logout |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 27 | [Template] GET And Verify Redfish Response |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 28 | |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 29 | # Expect status Resource URL Path |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 30 | ${HTTP_OK} /redfish |
| 31 | ${HTTP_OK} /redfish/v1 |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 32 | |
| 33 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 34 | GET Redfish SessionService Without Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 35 | [Documentation] Get /redfish/v1/SessionService without login |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 36 | [Tags] GET_Redfish_SessionService_Without_Login |
Lei YU | ebe7e95 | 2020-01-16 14:18:04 +0800 | [diff] [blame] | 37 | [Setup] Redfish.Logout |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 38 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 39 | ${resp}= Redfish.Get /redfish/v1/SessionService |
| 40 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}] |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 41 | |
| 42 | |
George Keishing | c681a63 | 2019-07-12 07:17:16 -0500 | [diff] [blame] | 43 | GET 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 Lee | 2b97582 | 2021-04-01 11:15:00 +0800 | [diff] [blame] | 53 | ${HTTP_OK} /redfish/v1/Chassis/${CHASSIS_ID} |
ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 54 | ${HTTP_OK} /redfish/v1/Managers/${MANAGER_ID} |
George Keishing | c681a63 | 2019-07-12 07:17:16 -0500 | [diff] [blame] | 55 | ${HTTP_OK} /redfish/v1/UpdateService |
| 56 | |
| 57 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 58 | Redfish Login Using Invalid Token |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 59 | [Documentation] Login to BMCweb with invalid token. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 60 | [Tags] Redfish_Login_Using_Invalid_Token |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 61 | |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 62 | 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 Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 68 | ${resp}= GET On Session |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 69 | ... openbmc /redfish/v1/SessionService/Sessions headers=${headers} |
George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 70 | ... expected_status=${HTTP_UNAUTHORIZED} |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 71 | |
| 72 | Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED} |
| 73 | |
| 74 | |
George Keishing | 07e4109 | 2019-05-23 23:09:51 -0500 | [diff] [blame] | 75 | Verify 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 Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 84 | Delete Redfish Session Using Valid Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 85 | [Documentation] Delete a session using valid login. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 86 | [Tags] Delete_Redfish_Session_Using_Valid_Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 87 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 88 | Redfish.Login |
George Keishing | 6fed443 | 2019-03-25 14:45:29 -0500 | [diff] [blame] | 89 | ${session_info}= Get Redfish Session Info |
| 90 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 91 | Redfish.Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 92 | |
| 93 | # Example o/p: |
| 94 | # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'}, |
| 95 | # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}] |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 96 | ${resp_list}= Redfish_Utils.List Request |
| 97 | ... /redfish/v1/SessionService/Sessions |
George Keishing | 6fed443 | 2019-03-25 14:45:29 -0500 | [diff] [blame] | 98 | |
| 99 | Redfish.Delete ${session_info["location"]} |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 100 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 101 | ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions |
George Keishing | 6fed443 | 2019-03-25 14:45:29 -0500 | [diff] [blame] | 102 | List Should Not Contain Value ${resp} ${session_info["location"]} |
George Keishing | 4db114c | 2019-02-02 07:22:17 -0600 | [diff] [blame] | 103 | |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 104 | |
George Keishing | da5a81d | 2019-07-18 04:40:42 -0500 | [diff] [blame] | 105 | Redfish Login Via SessionService |
| 106 | [Documentation] Login to BMC via redfish session service. |
| 107 | [Tags] Redfish_Login_Via_SessionService |
| 108 | |
Matt Fischer | 6954602 | 2023-10-24 15:33:42 -0600 | [diff] [blame] | 109 | Create Session openbmc https://${OPENBMC_HOST}:${HTTPS_PORT} |
George Keishing | da5a81d | 2019-07-18 04:40:42 -0500 | [diff] [blame] | 110 | ${headers}= Create Dictionary Content-Type=application/json |
George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 111 | ${data}= Set Variable {"UserName":"${OPENBMC_USERNAME}", "Password":"${OPENBMC_PASSWORD}"} |
George Keishing | da5a81d | 2019-07-18 04:40:42 -0500 | [diff] [blame] | 112 | |
George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 113 | ${resp}= POST On Session openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers} |
George Keishing | da5a81d | 2019-07-18 04:40:42 -0500 | [diff] [blame] | 114 | Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED} |
| 115 | |
George Keishing | da5a81d | 2019-07-18 04:40:42 -0500 | [diff] [blame] | 116 | ${headers}= Create Dictionary Content-Type=application/json |
| 117 | ... X-Auth-Token=${resp.headers["X-Auth-Token"]} |
George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 118 | ${resp}= DELETE On Session openbmc ${REDFISH_SESSION}${/}${resp.json()["Id"]} headers=${headers} |
George Keishing | da5a81d | 2019-07-18 04:40:42 -0500 | [diff] [blame] | 119 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 120 | |
| 121 | |
Anusha Dathatri | 6d2d42f | 2019-11-20 06:17:51 -0600 | [diff] [blame] | 122 | Verify 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 Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 132 | *** Keywords *** |
| 133 | |
| 134 | GET And Verify Redfish Response |
George Keishing | e16f158 | 2022-12-15 07:32:21 -0600 | [diff] [blame] | 135 | [Documentation] GET given resource and verify response. |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 136 | [Arguments] ${valid_status_codes} ${resource_path} |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 137 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 138 | # 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 Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 142 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 143 | ${resp}= Redfish.Get ${resource_path} |
| 144 | ... valid_status_codes=[${valid_status_codes}] |