blob: 415498156123c9806ea341365286927fc6ebe329 [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 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
George Keishing5a73ee02019-01-28 08:21:47 -060036
George Keishing97c93942019-03-04 12:45:07 -060037 ${resp}= Redfish.Get /redfish/v1/SessionService
38 ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
George Keishing5a73ee02019-01-28 08:21:47 -060039
40
George Keishingc681a632019-07-12 07:17:16 -050041GET Redfish Resources With Login
42 [Documentation] Login to BMCweb and GET valid resource.
43 [Tags] GET_Redfish_Resources_With_Login
44 [Setup] Redfish.Login
45 [Template] GET And Verify Redfish Response
46
47 # Expect status Resource URL Path
48 ${HTTP_OK} /redfish/v1/SessionService
49 ${HTTP_OK} /redfish/v1/AccountService
50 ${HTTP_OK} /redfish/v1/Systems/system
51 ${HTTP_OK} /redfish/v1/Chassis/chassis
George Keishingc681a632019-07-12 07:17:16 -050052 ${HTTP_OK} /redfish/v1/Managers/bmc
53 ${HTTP_OK} /redfish/v1/UpdateService
54
55
George Keishing5ee33d92019-02-02 12:33:25 -060056Redfish Login Using Invalid Token
George Keishing5a73ee02019-01-28 08:21:47 -060057 [Documentation] Login to BMCweb with invalid token.
George Keishing5ee33d92019-02-02 12:33:25 -060058 [Tags] Redfish_Login_Using_Invalid_Token
George Keishing5a73ee02019-01-28 08:21:47 -060059
George Keishing5a73ee02019-01-28 08:21:47 -060060 Create Session openbmc ${AUTH_URI}
61
62 # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun"
63 ${headers}= Create Dictionary Content-Type=application/json
64 ... X-Auth-Token=deadbeef
65
66 ${resp}= Get Request
67 ... openbmc /redfish/v1/SessionService/Sessions headers=${headers}
68
69 Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
70
71
George Keishing07e41092019-05-23 23:09:51 -050072Verify Redfish Invalid URL Response Code
73 [Documentation] Login to BMCweb and verify error response code.
74 [Tags] Verify_Redfish_Invalid_URL_Response_Code
75
76 Redfish.Login
77 Redfish.Get /redfish/v1/idontexist valid_status_codes=[${HTTP_NOT_FOUND}]
78 Redfish.Logout
79
80
George Keishing5ee33d92019-02-02 12:33:25 -060081Delete Redfish Session Using Valid login
George Keishing5a73ee02019-01-28 08:21:47 -060082 [Documentation] Delete a session using valid login.
George Keishing5ee33d92019-02-02 12:33:25 -060083 [Tags] Delete_Redfish_Session_Using_Valid_Login
George Keishing5a73ee02019-01-28 08:21:47 -060084
George Keishing97c93942019-03-04 12:45:07 -060085 Redfish.Login
George Keishing6fed4432019-03-25 14:45:29 -050086 ${session_info}= Get Redfish Session Info
87
George Keishing97c93942019-03-04 12:45:07 -060088 Redfish.Login
George Keishing5a73ee02019-01-28 08:21:47 -060089
90 # Example o/p:
91 # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
92 # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
George Keishing97c93942019-03-04 12:45:07 -060093 ${resp_list}= Redfish_Utils.List Request
94 ... /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -050095
96 Redfish.Delete ${session_info["location"]}
George Keishing5a73ee02019-01-28 08:21:47 -060097
George Keishing97c93942019-03-04 12:45:07 -060098 ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions
George Keishing6fed4432019-03-25 14:45:29 -050099 List Should Not Contain Value ${resp} ${session_info["location"]}
George Keishing4db114c2019-02-02 07:22:17 -0600100
George Keishing6510cfb2019-01-31 12:28:36 -0600101
George Keishingda5a81d2019-07-18 04:40:42 -0500102Redfish Login Via SessionService
103 [Documentation] Login to BMC via redfish session service.
104 [Tags] Redfish_Login_Via_SessionService
105
106 Create Session openbmc https://${OPENBMC_HOST}
107 ${headers}= Create Dictionary Content-Type=application/json
108 ${data}= Create Dictionary UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD}
109
110 ${resp}= Post Request openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers}
111 Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED}
112
113 ${content}= To JSON ${resp.content}
114 ${headers}= Create Dictionary Content-Type=application/json
115 ... X-Auth-Token=${resp.headers["X-Auth-Token"]}
116 ${resp}= Delete Request openbmc /redfish/v1/SessionService/Sessions/${content["Id"]} headers=${headers}
117 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
118
119
George Keishing6510cfb2019-01-31 12:28:36 -0600120*** Keywords ***
121
122GET And Verify Redfish Response
123 [Documentation] GET given resource and verfiy response.
George Keishing97c93942019-03-04 12:45:07 -0600124 [Arguments] ${valid_status_codes} ${resource_path}
George Keishing6510cfb2019-01-31 12:28:36 -0600125
George Keishing97c93942019-03-04 12:45:07 -0600126 # Description of argument(s):
127 # valid_status_codes A comma-separated list of acceptable
128 # status codes (e.g. 200).
129 # resource_path Redfish resource URL path.
George Keishing6510cfb2019-01-31 12:28:36 -0600130
George Keishing97c93942019-03-04 12:45:07 -0600131 ${resp}= Redfish.Get ${resource_path}
132 ... valid_status_codes=[${valid_status_codes}]