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 Resource With Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 34 | [Documentation] Login to BMCweb and get /redfish/v1/SessionService. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 35 | [Tags] GET_Redfish_SessionService_Resource_With_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 | Redfish.Login |
| 38 | ${resp}= Redfish.Get /redfish/v1/SessionService |
| 39 | Redfish.Logout |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 40 | |
| 41 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 42 | GET Redfish SessionService Without Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 43 | [Documentation] Get /redfish/v1/SessionService without login |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 44 | [Tags] GET_Redfish_SessionService_Without_Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 45 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 46 | ${resp}= Redfish.Get /redfish/v1/SessionService |
| 47 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}] |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 48 | |
| 49 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 50 | Redfish Login Using Invalid Token |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 51 | [Documentation] Login to BMCweb with invalid token. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 52 | [Tags] Redfish_Login_Using_Invalid_Token |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 53 | |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 54 | Create Session openbmc ${AUTH_URI} |
| 55 | |
| 56 | # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun" |
| 57 | ${headers}= Create Dictionary Content-Type=application/json |
| 58 | ... X-Auth-Token=deadbeef |
| 59 | |
| 60 | ${resp}= Get Request |
| 61 | ... openbmc /redfish/v1/SessionService/Sessions headers=${headers} |
| 62 | |
| 63 | Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED} |
| 64 | |
| 65 | |
George Keishing | 07e4109 | 2019-05-23 23:09:51 -0500 | [diff] [blame] | 66 | Verify Redfish Invalid URL Response Code |
| 67 | [Documentation] Login to BMCweb and verify error response code. |
| 68 | [Tags] Verify_Redfish_Invalid_URL_Response_Code |
| 69 | |
| 70 | Redfish.Login |
| 71 | Redfish.Get /redfish/v1/idontexist valid_status_codes=[${HTTP_NOT_FOUND}] |
| 72 | Redfish.Logout |
| 73 | |
| 74 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 75 | Delete Redfish Session Using Valid login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 76 | [Documentation] Delete a session using valid login. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 77 | [Tags] Delete_Redfish_Session_Using_Valid_Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 78 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 79 | Redfish.Login |
George Keishing | 6fed443 | 2019-03-25 14:45:29 -0500 | [diff] [blame] | 80 | ${session_info}= Get Redfish Session Info |
| 81 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 82 | Redfish.Login |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 83 | |
| 84 | # Example o/p: |
| 85 | # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'}, |
| 86 | # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}] |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 87 | ${resp_list}= Redfish_Utils.List Request |
| 88 | ... /redfish/v1/SessionService/Sessions |
George Keishing | 6fed443 | 2019-03-25 14:45:29 -0500 | [diff] [blame] | 89 | |
| 90 | Redfish.Delete ${session_info["location"]} |
George Keishing | 5a73ee0 | 2019-01-28 08:21:47 -0600 | [diff] [blame] | 91 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 92 | ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions |
George Keishing | 6fed443 | 2019-03-25 14:45:29 -0500 | [diff] [blame] | 93 | List Should Not Contain Value ${resp} ${session_info["location"]} |
George Keishing | 4db114c | 2019-02-02 07:22:17 -0600 | [diff] [blame] | 94 | |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 95 | |
George Keishing | da5a81d | 2019-07-18 04:40:42 -0500 | [diff] [blame] | 96 | Redfish Login Via SessionService |
| 97 | [Documentation] Login to BMC via redfish session service. |
| 98 | [Tags] Redfish_Login_Via_SessionService |
| 99 | |
| 100 | Create Session openbmc https://${OPENBMC_HOST} |
| 101 | ${headers}= Create Dictionary Content-Type=application/json |
| 102 | ${data}= Create Dictionary UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD} |
| 103 | |
| 104 | ${resp}= Post Request openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers} |
| 105 | Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED} |
| 106 | |
| 107 | ${content}= To JSON ${resp.content} |
| 108 | ${headers}= Create Dictionary Content-Type=application/json |
| 109 | ... X-Auth-Token=${resp.headers["X-Auth-Token"]} |
| 110 | ${resp}= Delete Request openbmc /redfish/v1/SessionService/Sessions/${content["Id"]} headers=${headers} |
| 111 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 112 | |
| 113 | |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 114 | *** Keywords *** |
| 115 | |
| 116 | GET And Verify Redfish Response |
| 117 | [Documentation] GET given resource and verfiy response. |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 118 | [Arguments] ${valid_status_codes} ${resource_path} |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 119 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 120 | # Description of argument(s): |
| 121 | # valid_status_codes A comma-separated list of acceptable |
| 122 | # status codes (e.g. 200). |
| 123 | # resource_path Redfish resource URL path. |
George Keishing | 6510cfb | 2019-01-31 12:28:36 -0600 | [diff] [blame] | 124 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 125 | ${resp}= Redfish.Get ${resource_path} |
| 126 | ... valid_status_codes=[${valid_status_codes}] |