blob: 6a444d4f26dab3a13a9ab37b0eb4e2e97a2b2d22 [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
Lei YUebe7e952020-01-16 14:18:04 +080025 [Setup] Redfish.Logout
George Keishing6510cfb2019-01-31 12:28:36 -060026 [Template] GET And Verify Redfish Response
George Keishing5a73ee02019-01-28 08:21:47 -060027
George Keishing6510cfb2019-01-31 12:28:36 -060028 # Expect status Resource URL Path
George Keishing6510cfb2019-01-31 12:28:36 -060029 ${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 Without Login
George Keishing5a73ee02019-01-28 08:21:47 -060034 [Documentation] Get /redfish/v1/SessionService without login
George Keishing5ee33d92019-02-02 12:33:25 -060035 [Tags] GET_Redfish_SessionService_Without_Login
Lei YUebe7e952020-01-16 14:18:04 +080036 [Setup] Redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060037
George Keishing97c93942019-03-04 12:45:07 -060038 ${resp}= Redfish.Get /redfish/v1/SessionService
39 ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
George Keishing5a73ee02019-01-28 08:21:47 -060040
41
George Keishingc681a632019-07-12 07:17:16 -050042GET Redfish Resources With Login
43 [Documentation] Login to BMCweb and GET valid resource.
44 [Tags] GET_Redfish_Resources_With_Login
45 [Setup] Redfish.Login
46 [Template] GET And Verify Redfish Response
47
48 # Expect status Resource URL Path
49 ${HTTP_OK} /redfish/v1/SessionService
50 ${HTTP_OK} /redfish/v1/AccountService
51 ${HTTP_OK} /redfish/v1/Systems/system
Tony Lee2b975822021-04-01 11:15:00 +080052 ${HTTP_OK} /redfish/v1/Chassis/${CHASSIS_ID}
George Keishingc681a632019-07-12 07:17:16 -050053 ${HTTP_OK} /redfish/v1/Managers/bmc
54 ${HTTP_OK} /redfish/v1/UpdateService
55
56
George Keishing5ee33d92019-02-02 12:33:25 -060057Redfish Login Using Invalid Token
George Keishing5a73ee02019-01-28 08:21:47 -060058 [Documentation] Login to BMCweb with invalid token.
George Keishing5ee33d92019-02-02 12:33:25 -060059 [Tags] Redfish_Login_Using_Invalid_Token
George Keishing5a73ee02019-01-28 08:21:47 -060060
George Keishing5a73ee02019-01-28 08:21:47 -060061 Create Session openbmc ${AUTH_URI}
62
63 # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun"
64 ${headers}= Create Dictionary Content-Type=application/json
65 ... X-Auth-Token=deadbeef
66
67 ${resp}= Get Request
68 ... openbmc /redfish/v1/SessionService/Sessions headers=${headers}
69
70 Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
71
72
George Keishing07e41092019-05-23 23:09:51 -050073Verify Redfish Invalid URL Response Code
74 [Documentation] Login to BMCweb and verify error response code.
75 [Tags] Verify_Redfish_Invalid_URL_Response_Code
76
77 Redfish.Login
78 Redfish.Get /redfish/v1/idontexist valid_status_codes=[${HTTP_NOT_FOUND}]
79 Redfish.Logout
80
81
George Keishing5ee33d92019-02-02 12:33:25 -060082Delete Redfish Session Using Valid login
George Keishing5a73ee02019-01-28 08:21:47 -060083 [Documentation] Delete a session using valid login.
George Keishing5ee33d92019-02-02 12:33:25 -060084 [Tags] Delete_Redfish_Session_Using_Valid_Login
George Keishing5a73ee02019-01-28 08:21:47 -060085
George Keishing97c93942019-03-04 12:45:07 -060086 Redfish.Login
George Keishing6fed4432019-03-25 14:45:29 -050087 ${session_info}= Get Redfish Session Info
88
George Keishing97c93942019-03-04 12:45:07 -060089 Redfish.Login
George Keishing5a73ee02019-01-28 08:21:47 -060090
91 # Example o/p:
92 # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
93 # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
George Keishing97c93942019-03-04 12:45:07 -060094 ${resp_list}= Redfish_Utils.List Request
95 ... /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -050096
97 Redfish.Delete ${session_info["location"]}
George Keishing5a73ee02019-01-28 08:21:47 -060098
George Keishing97c93942019-03-04 12:45:07 -060099 ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -0500100 List Should Not Contain Value ${resp} ${session_info["location"]}
George Keishing4db114c2019-02-02 07:22:17 -0600101
George Keishing6510cfb2019-01-31 12:28:36 -0600102
George Keishingda5a81d2019-07-18 04:40:42 -0500103Redfish Login Via SessionService
104 [Documentation] Login to BMC via redfish session service.
105 [Tags] Redfish_Login_Via_SessionService
106
107 Create Session openbmc https://${OPENBMC_HOST}
108 ${headers}= Create Dictionary Content-Type=application/json
109 ${data}= Create Dictionary UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD}
110
111 ${resp}= Post Request openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers}
112 Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED}
113
114 ${content}= To JSON ${resp.content}
115 ${headers}= Create Dictionary Content-Type=application/json
116 ... X-Auth-Token=${resp.headers["X-Auth-Token"]}
George Keishinge4d41422019-12-12 11:17:03 -0600117 ${resp}= Delete Request openbmc ${REDFISH_SESSION}${/}${content["Id"]} headers=${headers}
George Keishingda5a81d2019-07-18 04:40:42 -0500118 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
119
120
Anusha Dathatri6d2d42f2019-11-20 06:17:51 -0600121Verify Redfish Unresponsive URL paths
122 [Documentation] Verify that all URLs in /redfish/v1 respond.
123 [Tags] Verify_Redfish_Unresponsive_URL_paths
124
125 Redfish.Login
126 ${resource_list} ${dead_resources}= Enumerate Request /redfish/v1 include_dead_resources=True
127 Redfish.Logout
128 Valid Length dead_resources max_length=0
129
130
George Keishing6510cfb2019-01-31 12:28:36 -0600131*** Keywords ***
132
133GET And Verify Redfish Response
134 [Documentation] GET given resource and verfiy response.
George Keishing97c93942019-03-04 12:45:07 -0600135 [Arguments] ${valid_status_codes} ${resource_path}
George Keishing6510cfb2019-01-31 12:28:36 -0600136
George Keishing97c93942019-03-04 12:45:07 -0600137 # Description of argument(s):
138 # valid_status_codes A comma-separated list of acceptable
139 # status codes (e.g. 200).
140 # resource_path Redfish resource URL path.
George Keishing6510cfb2019-01-31 12:28:36 -0600141
George Keishing97c93942019-03-04 12:45:07 -0600142 ${resp}= Redfish.Get ${resource_path}
143 ... valid_status_codes=[${valid_status_codes}]