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 | |
Sandhya Somashekar | 839a0c2 | 2019-01-31 05:05:43 -0600 | [diff] [blame] | 4 | Resource ../../lib/resource.robot |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 5 | Resource ../../lib/bmc_redfish_resource.robot |
George Keishing | 3298d5c | 2019-02-12 06:59:25 -0600 | [diff] [blame] | 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 8 | |
George Keishing | 3298d5c | 2019-02-12 06:59:25 -0600 | [diff] [blame] | 9 | Test Teardown FFDC On Test Case Fail |
Michael Walsh | c108e42 | 2019-03-28 12:27:18 -0500 | [diff] [blame] | 10 | Test Setup Printn |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 11 | |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 12 | *** Test Cases *** |
| 13 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 14 | Redfish Login And Logout |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 15 | [Documentation] Login to BMCweb and then logout. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 16 | [Tags] Redfish_Login_And_Logout |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 17 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 18 | Redfish.Login |
| 19 | Redfish.Logout |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 20 | |
| 21 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 22 | GET Redfish Hypermedia Without Login |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 23 | [Documentation] GET hypermedia URL without login. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 24 | [Tags] GET_Redfish_Hypermedia_Without_Login |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 25 | [Template] GET And Verify Redfish Response |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 26 | |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 27 | # Expect status Resource URL Path |
| 28 | ${HTTP_OK} / |
| 29 | ${HTTP_OK} /redfish |
| 30 | ${HTTP_OK} /redfish/v1 |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 31 | |
| 32 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 33 | GET Redfish SessionService Without Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 34 | [Documentation] Get /redfish/v1/SessionService without login |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 35 | [Tags] GET_Redfish_SessionService_Without_Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 36 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 37 | ${resp}= Redfish.Get /redfish/v1/SessionService |
| 38 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}] |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 39 | |
| 40 | |
George Keishing | c681a63 | 2019-07-12 07:17:16 -0500 | [diff] [blame] | 41 | GET 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 |
| 51 | ${HTTP_OK} /redfish/v1/Chassis/chassis |
George Keishing | c681a63 | 2019-07-12 07:17:16 -0500 | [diff] [blame] | 52 | ${HTTP_OK} /redfish/v1/Managers/bmc |
| 53 | ${HTTP_OK} /redfish/v1/UpdateService |
| 54 | |
| 55 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 56 | Redfish Login Using Invalid Token |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 57 | [Documentation] Login to BMCweb with invalid token. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 58 | [Tags] Redfish_Login_Using_Invalid_Token |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 59 | |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 60 | 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 | |
| 66 | ${resp}= Get Request |
| 67 | ... openbmc /redfish/v1/SessionService/Sessions headers=${headers} |
| 68 | |
| 69 | Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED} |
| 70 | |
| 71 | |
George Keishing | 07e4109 | 2019-05-23 23:09:51 -0500 | [diff] [blame] | 72 | Verify Redfish Invalid URL Response Code |
| 73 | [Documentation] Login to BMCweb and verify error response code. |
| 74 | [Tags] Verify_Redfish_Invalid_URL_Response_Code |
| 75 | |
| 76 | Redfish.Login |
| 77 | Redfish.Get /redfish/v1/idontexist valid_status_codes=[${HTTP_NOT_FOUND}] |
| 78 | Redfish.Logout |
| 79 | |
| 80 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 81 | Delete Redfish Session Using Valid login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 82 | [Documentation] Delete a session using valid login. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 83 | [Tags] Delete_Redfish_Session_Using_Valid_Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 84 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 85 | Redfish.Login |
George Keishing | 6fed443 | 2019-03-25 14:45:29 -0500 | [diff] [blame] | 86 | ${session_info}= Get Redfish Session Info |
| 87 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 88 | Redfish.Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 89 | |
| 90 | # Example o/p: |
| 91 | # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'}, |
| 92 | # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}] |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 93 | ${resp_list}= Redfish_Utils.List Request |
| 94 | ... /redfish/v1/SessionService/Sessions |
George Keishing | 6fed443 | 2019-03-25 14:45:29 -0500 | [diff] [blame] | 95 | |
| 96 | Redfish.Delete ${session_info["location"]} |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 97 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 98 | ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions |
George Keishing | 6fed443 | 2019-03-25 14:45:29 -0500 | [diff] [blame] | 99 | List Should Not Contain Value ${resp} ${session_info["location"]} |
George Keishing | 4db114c | 2019-02-02 07:22:17 -0600 | [diff] [blame] | 100 | |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 101 | |
George Keishing | da5a81d | 2019-07-18 04:40:42 -0500 | [diff] [blame] | 102 | Redfish Login Via SessionService |
| 103 | [Documentation] Login to BMC via redfish session service. |
| 104 | [Tags] Redfish_Login_Via_SessionService |
| 105 | |
| 106 | Create Session openbmc https://${OPENBMC_HOST} |
| 107 | ${headers}= Create Dictionary Content-Type=application/json |
| 108 | ${data}= Create Dictionary UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD} |
| 109 | |
| 110 | ${resp}= Post Request openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers} |
| 111 | Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED} |
| 112 | |
| 113 | ${content}= To JSON ${resp.content} |
| 114 | ${headers}= Create Dictionary Content-Type=application/json |
| 115 | ... X-Auth-Token=${resp.headers["X-Auth-Token"]} |
| 116 | ${resp}= Delete Request openbmc /redfish/v1/SessionService/Sessions/${content["Id"]} headers=${headers} |
| 117 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 118 | |
| 119 | |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 120 | *** Keywords *** |
| 121 | |
| 122 | GET And Verify Redfish Response |
| 123 | [Documentation] GET given resource and verfiy response. |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 124 | [Arguments] ${valid_status_codes} ${resource_path} |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 125 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 126 | # Description of argument(s): |
| 127 | # valid_status_codes A comma-separated list of acceptable |
| 128 | # status codes (e.g. 200). |
| 129 | # resource_path Redfish resource URL path. |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 130 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 131 | ${resp}= Redfish.Get ${resource_path} |
| 132 | ... valid_status_codes=[${valid_status_codes}] |