blob: 92390afd6a638156ed80ae4b756af00eb667dfeb [file] [log] [blame]
George Keishing5a73ee02019-01-28 08:21:47 -06001*** Settings ***
Joy Onyerikwudbfe97d2019-03-11 19:44:56 -05002Documentation Test Redfish to verify responses for SessionService and Hypermedia.
George Keishing97c93942019-03-04 12:45:07 -06003
Sandhya Somashekar839a0c22019-01-31 05:05:43 -06004Resource ../../lib/resource.robot
George Keishing5a73ee02019-01-28 08:21:47 -06005Resource ../../lib/bmc_redfish_resource.robot
George Keishing3298d5c2019-02-12 06:59:25 -06006Resource ../../lib/openbmc_ffdc.robot
7
George Keishing97c93942019-03-04 12:45:07 -06008
George Keishing3298d5c2019-02-12 06:59:25 -06009Test Teardown FFDC On Test Case Fail
Michael Walshc108e422019-03-28 12:27:18 -050010Test Setup Printn
George Keishing5a73ee02019-01-28 08:21:47 -060011
George Keishing5a73ee02019-01-28 08:21:47 -060012*** Test Cases ***
13
George Keishing5ee33d92019-02-02 12:33:25 -060014Redfish Login And Logout
George Keishing5a73ee02019-01-28 08:21:47 -060015 [Documentation] Login to BMCweb and then logout.
George Keishing5ee33d92019-02-02 12:33:25 -060016 [Tags] Redfish_Login_And_Logout
George Keishing5a73ee02019-01-28 08:21:47 -060017
George Keishing97c93942019-03-04 12:45:07 -060018 Redfish.Login
19 Redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060020
21
George Keishing5ee33d92019-02-02 12:33:25 -060022GET Redfish Hypermedia Without Login
George Keishing6510cfb2019-01-31 12:28:36 -060023 [Documentation] GET hypermedia URL without login.
George Keishing5ee33d92019-02-02 12:33:25 -060024 [Tags] GET_Redfish_Hypermedia_Without_Login
George Keishing6510cfb2019-01-31 12:28:36 -060025 [Template] GET And Verify Redfish Response
George Keishing5a73ee02019-01-28 08:21:47 -060026
George Keishing6510cfb2019-01-31 12:28:36 -060027 # Expect status Resource URL Path
28 ${HTTP_OK} /
29 ${HTTP_OK} /redfish
30 ${HTTP_OK} /redfish/v1
George Keishing5a73ee02019-01-28 08:21:47 -060031
32
George Keishing5ee33d92019-02-02 12:33:25 -060033GET Redfish SessionService Resource With Login
George Keishing5a73ee02019-01-28 08:21:47 -060034 [Documentation] Login to BMCweb and get /redfish/v1/SessionService.
George Keishing5ee33d92019-02-02 12:33:25 -060035 [Tags] GET_Redfish_SessionService_Resource_With_Login
George Keishing5a73ee02019-01-28 08:21:47 -060036
George Keishing97c93942019-03-04 12:45:07 -060037 Redfish.Login
38 ${resp}= Redfish.Get /redfish/v1/SessionService
39 Redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060040
41
George Keishing5ee33d92019-02-02 12:33:25 -060042GET Redfish SessionService Without Login
George Keishing5a73ee02019-01-28 08:21:47 -060043 [Documentation] Get /redfish/v1/SessionService without login
George Keishing5ee33d92019-02-02 12:33:25 -060044 [Tags] GET_Redfish_SessionService_Without_Login
George Keishing5a73ee02019-01-28 08:21:47 -060045
George Keishing97c93942019-03-04 12:45:07 -060046 ${resp}= Redfish.Get /redfish/v1/SessionService
47 ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
George Keishing5a73ee02019-01-28 08:21:47 -060048
49
George Keishing5ee33d92019-02-02 12:33:25 -060050Redfish Login Using Invalid Token
George Keishing5a73ee02019-01-28 08:21:47 -060051 [Documentation] Login to BMCweb with invalid token.
George Keishing5ee33d92019-02-02 12:33:25 -060052 [Tags] Redfish_Login_Using_Invalid_Token
George Keishing5a73ee02019-01-28 08:21:47 -060053
George Keishing5a73ee02019-01-28 08:21:47 -060054 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 Keishing07e41092019-05-23 23:09:51 -050066Verify 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 Keishing5ee33d92019-02-02 12:33:25 -060075Delete Redfish Session Using Valid login
George Keishing5a73ee02019-01-28 08:21:47 -060076 [Documentation] Delete a session using valid login.
George Keishing5ee33d92019-02-02 12:33:25 -060077 [Tags] Delete_Redfish_Session_Using_Valid_Login
George Keishing5a73ee02019-01-28 08:21:47 -060078
George Keishing97c93942019-03-04 12:45:07 -060079 Redfish.Login
George Keishing6fed4432019-03-25 14:45:29 -050080 ${session_info}= Get Redfish Session Info
81
George Keishing97c93942019-03-04 12:45:07 -060082 Redfish.Login
George Keishing5a73ee02019-01-28 08:21:47 -060083
84 # Example o/p:
85 # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
86 # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
George Keishing97c93942019-03-04 12:45:07 -060087 ${resp_list}= Redfish_Utils.List Request
88 ... /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -050089
90 Redfish.Delete ${session_info["location"]}
George Keishing5a73ee02019-01-28 08:21:47 -060091
George Keishing97c93942019-03-04 12:45:07 -060092 ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -050093 List Should Not Contain Value ${resp} ${session_info["location"]}
George Keishing4db114c2019-02-02 07:22:17 -060094
George Keishing6510cfb2019-01-31 12:28:36 -060095
George Keishingda5a81d2019-07-18 04:40:42 -050096Redfish 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 Keishing6510cfb2019-01-31 12:28:36 -0600114*** Keywords ***
115
116GET And Verify Redfish Response
117 [Documentation] GET given resource and verfiy response.
George Keishing97c93942019-03-04 12:45:07 -0600118 [Arguments] ${valid_status_codes} ${resource_path}
George Keishing6510cfb2019-01-31 12:28:36 -0600119
George Keishing97c93942019-03-04 12:45:07 -0600120 # 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 Keishing6510cfb2019-01-31 12:28:36 -0600124
George Keishing97c93942019-03-04 12:45:07 -0600125 ${resp}= Redfish.Get ${resource_path}
126 ... valid_status_codes=[${valid_status_codes}]