blob: e2dd6fdb1c107068d70d0dc63d3ac76a203bdeec [file] [log] [blame]
George Keishingeaa73b72018-07-30 09:30:16 -05001*** Settings ***
2Documentation Test Redfish interfaces supported.
3
George Keishing9cef1092018-08-06 01:06:24 -05004Resource ../lib/redfish_client.robot
5
6Test Setup Test Setup Execution
7Test Teardown Test Teardown Execution
8
George Keishingeaa73b72018-07-30 09:30:16 -05009
10** Test Cases **
11
George Keishing9cef1092018-08-06 01:06:24 -050012Test Get Redfish Session Id
13 [Documentation] Establish session to BMC and get session identifier.
14 [Tags] Test_Get_Redfish_Session_Id
15
George Keishing1552dd32018-08-06 13:14:09 -050016 # 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 Keishing9cef1092018-08-06 01:06:24 -050027 ${session_url} =
28 ... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id}
29 ${resp} = Redfish Get Request
George Keishing1552dd32018-08-06 13:14:09 -050030 ... ${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 Keishingd61775f2018-08-09 01:02:30 -050036Test 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 Keishing1552dd32018-08-06 13:14:09 -050047Test Invalid Redfish Token Access
48 [Documentation] Access valid session id using invalid session token.
49 [Tags] Test_Invalid_Redfish_Token_Access
50
51 ${session_url} =
52 ... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id}
53 ${resp} = Redfish Get Request
54 ... ${session_url} xauth_token=InvalidToken response_format=${0}
55 Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
George Keishing9cef1092018-08-06 01:06:24 -050056
57
58Test Get Redfish Response Codes
George Keishingeaa73b72018-07-30 09:30:16 -050059 [Documentation] Get Redfish response codes and validate them.
George Keishing9cef1092018-08-06 01:06:24 -050060 [Tags] Test_Get_Redfish_Response_Codes
George Keishingeaa73b72018-07-30 09:30:16 -050061 [Template] Execute Get And Check Response
62
63 # Expected status URL Path
64 ${HTTP_OK} Systems
65 ${HTTP_OK} Systems/motherboard
66 ${HTTP_OK} Chassis/system
67 ${HTTP_OK} Managers/openbmc/EthernetInterfaces/eth0
68 ${HTTP_NOT_FOUND} /i/dont/exist/
69
70*** Keywords ***
71
72Execute Get And Check Response
73 [Documentation] Execute "GET" request and check for expected status.
74 [Arguments] ${expected_response_code} ${url_path}
75 # Description of argument(s):
76 # expected_response_code Expected REST status codes.
77 # url_path URL path.
78
George Keishing9cef1092018-08-06 01:06:24 -050079 ${resp} = Redfish Get Request
80 ... ${url_path} xauth_token=${test_auth_token} response_format=${0}
George Keishingeaa73b72018-07-30 09:30:16 -050081 Should Be Equal As Strings ${resp.status_code} ${expected_response_code}
George Keishing9cef1092018-08-06 01:06:24 -050082
83
84Test Setup Execution
85 [Documentation] Do the test setup.
86
87 ${session_id} ${auth_token} = Redfish Login Request
88 Set Test Variable ${test_session_id} ${session_id}
89 Set Test Variable ${test_auth_token} ${auth_token}
90
91
92Test Teardown Execution
93 [Documentation] Do the test teardown.
94
George Keishing138f9d32018-08-08 10:50:05 -050095 ${session_uri} =
96 ... Catenate SEPARATOR= ${REDFISH_SESSION_URI} ${test_session_id}
97
98 Redfish Delete Request ${session_uri} ${test_auth_token}