blob: 6f1bfa325f9ea70257701c671d493904a2ba9978 [file] [log] [blame]
George Keishing5a73ee02019-01-28 08:21:47 -06001*** Settings ***
2Resource ../../lib/resource.txt
3Resource ../../lib/bmc_redfish_resource.robot
4
George Keishing5a73ee02019-01-28 08:21:47 -06005*** Test Cases ***
6
7Login And Logout BMCweb
8 [Documentation] Login to BMCweb and then logout.
9 [Tags] Login_And_Logout_BMCweb
10
11 redfish.Login
12 redfish.Logout
13
14
15GET BMCweb Hypermedia Without Login
George Keishing6510cfb2019-01-31 12:28:36 -060016 [Documentation] GET hypermedia URL without login.
George Keishing5a73ee02019-01-28 08:21:47 -060017 [Tags] GET_BMCweb_Hypermedia_Without_Login
George Keishing6510cfb2019-01-31 12:28:36 -060018 [Template] GET And Verify Redfish Response
George Keishing5a73ee02019-01-28 08:21:47 -060019
George Keishing6510cfb2019-01-31 12:28:36 -060020 # Expect status Resource URL Path
21 ${HTTP_OK} /
22 ${HTTP_OK} /redfish
23 ${HTTP_OK} /redfish/v1
George Keishing5a73ee02019-01-28 08:21:47 -060024
25
26GET SessionService Resource With Login
27 [Documentation] Login to BMCweb and get /redfish/v1/SessionService.
28 [Tags] GET_SessionService_Resource_With_Login
29
30 redfish.Login
George Keishing6510cfb2019-01-31 12:28:36 -060031 ${resp}= redfish.Get /redfish/v1/SessionService
George Keishing5a73ee02019-01-28 08:21:47 -060032 Should Be Equal As Strings ${resp.status} ${HTTP_OK}
33
34
35GET SessionService Without Login
36 [Documentation] Get /redfish/v1/SessionService without login
37 [Tags] GET_SessionService_Without_Login
38
39 redfish.Logout
George Keishing6510cfb2019-01-31 12:28:36 -060040 ${resp}= redfish.Get /redfish/v1/SessionService
George Keishing5a73ee02019-01-28 08:21:47 -060041 Should Be Equal As Strings ${resp.status} ${HTTP_UNAUTHORIZED}
42
43
44Login Using Invalid Token
45 [Documentation] Login to BMCweb with invalid token.
46 [Tags] Login_Using_Invalid_Token
47
48 redfish.Logout
49
50 Create Session openbmc ${AUTH_URI}
51
52 # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun"
53 ${headers}= Create Dictionary Content-Type=application/json
54 ... X-Auth-Token=deadbeef
55
56 ${resp}= Get Request
57 ... openbmc /redfish/v1/SessionService/Sessions headers=${headers}
58
59 Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
60
61
62Delete Session Using Valid login
63 [Documentation] Delete a session using valid login.
64 [Tags] Delete_Session_Using_Valid_Login
65
66 redfish.Login
67
68 # Example o/p:
69 # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
70 # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
George Keishing6510cfb2019-01-31 12:28:36 -060071 ${resp_list}= redfish.Get /redfish/v1/SessionService/Sessions
George Keishing5a73ee02019-01-28 08:21:47 -060072
73 redfish.Delete ${resp_list.dict["Members"][0]["@odata.id"]}
74
George Keishing6510cfb2019-01-31 12:28:36 -060075 ${resp}= redfish.Get /redfish/v1/SessionService/Sessions
George Keishing5a73ee02019-01-28 08:21:47 -060076 Should Not Contain ${resp.dict["Members"]} ${resp_list.dict["Members"][0]["@odata.id"]}
George Keishing6510cfb2019-01-31 12:28:36 -060077 redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060078
George Keishing6510cfb2019-01-31 12:28:36 -060079
80*** Keywords ***
81
82GET And Verify Redfish Response
83 [Documentation] GET given resource and verfiy response.
84 [Arguments] ${expected_response_code} ${resource_path}
85
86 # Description of arguments:
87 # expected_response_code Expected REST status codes.
88 # resource_path Redfish resource URL path.
89
90 ${resp}= redfish.Get ${resource_path}
91 Should Be Equal As Strings ${resp.status} ${expected_response_code}