George Keishing | eaa73b7 | 2018-07-30 09:30:16 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test Redfish interfaces supported. |
| 3 | |
George Keishing | 9cef109 | 2018-08-06 01:06:24 -0500 | [diff] [blame] | 4 | Resource ../lib/redfish_client.robot |
| 5 | |
| 6 | Test Setup Test Setup Execution |
| 7 | Test Teardown Test Teardown Execution |
| 8 | |
George Keishing | eaa73b7 | 2018-07-30 09:30:16 -0500 | [diff] [blame] | 9 | |
| 10 | ** Test Cases ** |
| 11 | |
George Keishing | 9cef109 | 2018-08-06 01:06:24 -0500 | [diff] [blame] | 12 | Test Get Redfish Session Id |
| 13 | [Documentation] Establish session to BMC and get session identifier. |
| 14 | [Tags] Test_Get_Redfish_Session_Id |
| 15 | |
George Keishing | 1552dd3 | 2018-08-06 13:14:09 -0500 | [diff] [blame] | 16 | # Example: |
| 17 | # { |
| 18 | # "@odata.context": "/redfish/v1/$metadata#Session.Session", |
| 19 | # "@odata.id": "/redfish/v1/SessionService/Sessions/gxgwFkuPqo", |
| 20 | # "@odata.type": "#Session.v1_0_2.Session", |
| 21 | # "Description": "Manager User Session", |
| 22 | # "Id": "gxgwFkuPqo", |
| 23 | # "Name": "User Session", |
| 24 | # "UserName": "root" |
| 25 | # } |
| 26 | |
George Keishing | 9cef109 | 2018-08-06 01:06:24 -0500 | [diff] [blame] | 27 | ${session_url} = |
| 28 | ... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id} |
| 29 | ${resp} = Redfish Get Request |
George Keishing | 1552dd3 | 2018-08-06 13:14:09 -0500 | [diff] [blame] | 30 | ... ${session_url} xauth_token=${test_auth_token} |
| 31 | |
| 32 | Should Be Equal As Strings |
| 33 | ... /redfish/v1/${session_url} ${resp["@odata.id"]} |
| 34 | |
| 35 | |
George Keishing | d61775f | 2018-08-09 01:02:30 -0500 | [diff] [blame] | 36 | Test Delete Redfish Session With Invalid Token |
| 37 | [Documentation] Delete valid session with invalid token. |
| 38 | |
| 39 | ${session_uri} = |
| 40 | ... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id} |
| 41 | |
| 42 | ${resp} = Redfish Delete Request |
| 43 | ... ${session_uri} xauth_token=InvalidToken resp_check=${0} |
| 44 | Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED} |
| 45 | |
| 46 | |
George Keishing | 884d7d4 | 2018-08-09 12:43:13 -0500 | [diff] [blame] | 47 | Test Delete Redfish Response Codes |
| 48 | [Documentation] Get Redfish response codes and validate them. |
| 49 | [Tags] Test_Delete_Redfish_Response_Codes |
| 50 | |
| 51 | ${resp} = Redfish Delete Request |
| 52 | ... Systems/motherboard xauth_token=${test_auth_token} resp_check=${0} |
| 53 | Should Be Equal As Strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED} |
| 54 | |
| 55 | |
George Keishing | 1552dd3 | 2018-08-06 13:14:09 -0500 | [diff] [blame] | 56 | Test Invalid Redfish Token Access |
| 57 | [Documentation] Access valid session id using invalid session token. |
| 58 | [Tags] Test_Invalid_Redfish_Token_Access |
| 59 | |
| 60 | ${session_url} = |
| 61 | ... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id} |
| 62 | ${resp} = Redfish Get Request |
George Keishing | 884d7d4 | 2018-08-09 12:43:13 -0500 | [diff] [blame] | 63 | ... ${session_url} xauth_token=InvalidToken resp_check=${0} |
George Keishing | 1552dd3 | 2018-08-06 13:14:09 -0500 | [diff] [blame] | 64 | Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED} |
George Keishing | 9cef109 | 2018-08-06 01:06:24 -0500 | [diff] [blame] | 65 | |
| 66 | |
| 67 | Test Get Redfish Response Codes |
George Keishing | eaa73b7 | 2018-07-30 09:30:16 -0500 | [diff] [blame] | 68 | [Documentation] Get Redfish response codes and validate them. |
George Keishing | 9cef109 | 2018-08-06 01:06:24 -0500 | [diff] [blame] | 69 | [Tags] Test_Get_Redfish_Response_Codes |
George Keishing | eaa73b7 | 2018-07-30 09:30:16 -0500 | [diff] [blame] | 70 | [Template] Execute Get And Check Response |
| 71 | |
| 72 | # Expected status URL Path |
George Keishing | 884d7d4 | 2018-08-09 12:43:13 -0500 | [diff] [blame] | 73 | ${HTTP_OK} ${EMPTY} |
George Keishing | 0378f88 | 2018-08-28 09:29:13 -0500 | [diff] [blame] | 74 | ${HTTP_OK} SessionService |
George Keishing | eaa73b7 | 2018-07-30 09:30:16 -0500 | [diff] [blame] | 75 | ${HTTP_OK} Systems |
George Keishing | 0378f88 | 2018-08-28 09:29:13 -0500 | [diff] [blame] | 76 | ${HTTP_OK} Chassis |
| 77 | ${HTTP_OK} Managers |
| 78 | ${HTTP_OK} AccountService |
George Keishing | eaa73b7 | 2018-07-30 09:30:16 -0500 | [diff] [blame] | 79 | ${HTTP_OK} Managers/openbmc/EthernetInterfaces/eth0 |
| 80 | ${HTTP_NOT_FOUND} /i/dont/exist/ |
| 81 | |
| 82 | *** Keywords *** |
| 83 | |
| 84 | Execute Get And Check Response |
| 85 | [Documentation] Execute "GET" request and check for expected status. |
| 86 | [Arguments] ${expected_response_code} ${url_path} |
| 87 | # Description of argument(s): |
| 88 | # expected_response_code Expected REST status codes. |
| 89 | # url_path URL path. |
| 90 | |
George Keishing | 9cef109 | 2018-08-06 01:06:24 -0500 | [diff] [blame] | 91 | ${resp} = Redfish Get Request |
George Keishing | 884d7d4 | 2018-08-09 12:43:13 -0500 | [diff] [blame] | 92 | ... ${url_path} xauth_token=${test_auth_token} resp_check=${0} |
George Keishing | eaa73b7 | 2018-07-30 09:30:16 -0500 | [diff] [blame] | 93 | Should Be Equal As Strings ${resp.status_code} ${expected_response_code} |
George Keishing | 9cef109 | 2018-08-06 01:06:24 -0500 | [diff] [blame] | 94 | |
| 95 | |
| 96 | Test Setup Execution |
| 97 | [Documentation] Do the test setup. |
| 98 | |
| 99 | ${session_id} ${auth_token} = Redfish Login Request |
| 100 | Set Test Variable ${test_session_id} ${session_id} |
| 101 | Set Test Variable ${test_auth_token} ${auth_token} |
| 102 | |
| 103 | |
| 104 | Test Teardown Execution |
| 105 | [Documentation] Do the test teardown. |
| 106 | |
George Keishing | 138f9d3 | 2018-08-08 10:50:05 -0500 | [diff] [blame] | 107 | ${session_uri} = |
| 108 | ... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id} |
| 109 | |
| 110 | Redfish Delete Request ${session_uri} ${test_auth_token} |