blob: a5df8c7d8168c9dc0980b8bfcc39b9aab1ccff31 [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
George Keishing5ee33d92019-02-02 12:33:25 -06007Redfish Login And Logout
George Keishing5a73ee02019-01-28 08:21:47 -06008 [Documentation] Login to BMCweb and then logout.
George Keishing5ee33d92019-02-02 12:33:25 -06009 [Tags] Redfish_Login_And_Logout
George Keishing5a73ee02019-01-28 08:21:47 -060010
11 redfish.Login
12 redfish.Logout
13
14
George Keishing5ee33d92019-02-02 12:33:25 -060015GET Redfish Hypermedia Without Login
George Keishing6510cfb2019-01-31 12:28:36 -060016 [Documentation] GET hypermedia URL without login.
George Keishing5ee33d92019-02-02 12:33:25 -060017 [Tags] GET_Redfish_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
George Keishing5ee33d92019-02-02 12:33:25 -060026GET Redfish SessionService Resource With Login
George Keishing5a73ee02019-01-28 08:21:47 -060027 [Documentation] Login to BMCweb and get /redfish/v1/SessionService.
George Keishing5ee33d92019-02-02 12:33:25 -060028 [Tags] GET_Redfish_SessionService_Resource_With_Login
George Keishing5a73ee02019-01-28 08:21:47 -060029
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}
George Keishing3a813a92019-02-01 20:34:47 -060033 redfish.Logout
George Keishing5a73ee02019-01-28 08:21:47 -060034
35
George Keishing5ee33d92019-02-02 12:33:25 -060036GET Redfish SessionService Without Login
George Keishing5a73ee02019-01-28 08:21:47 -060037 [Documentation] Get /redfish/v1/SessionService without login
George Keishing5ee33d92019-02-02 12:33:25 -060038 [Tags] GET_Redfish_SessionService_Without_Login
George Keishing5a73ee02019-01-28 08:21:47 -060039
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
George Keishing5ee33d92019-02-02 12:33:25 -060044Redfish Login Using Invalid Token
George Keishing5a73ee02019-01-28 08:21:47 -060045 [Documentation] Login to BMCweb with invalid token.
George Keishing5ee33d92019-02-02 12:33:25 -060046 [Tags] Redfish_Login_Using_Invalid_Token
George Keishing5a73ee02019-01-28 08:21:47 -060047
George Keishing5a73ee02019-01-28 08:21:47 -060048 Create Session openbmc ${AUTH_URI}
49
50 # Example: "X-Auth-Token: 3la1JUf1vY4yN2dNOwun"
51 ${headers}= Create Dictionary Content-Type=application/json
52 ... X-Auth-Token=deadbeef
53
54 ${resp}= Get Request
55 ... openbmc /redfish/v1/SessionService/Sessions headers=${headers}
56
57 Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
58
59
George Keishing5ee33d92019-02-02 12:33:25 -060060Delete Redfish Session Using Valid login
George Keishing5a73ee02019-01-28 08:21:47 -060061 [Documentation] Delete a session using valid login.
George Keishing5ee33d92019-02-02 12:33:25 -060062 [Tags] Delete_Redfish_Session_Using_Valid_Login
George Keishing5a73ee02019-01-28 08:21:47 -060063
64 redfish.Login
65
66 # Example o/p:
67 # [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
68 # {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
George Keishing3a813a92019-02-01 20:34:47 -060069 ${resp_list}= redfish.List Request SessionService/Sessions
George Keishing3a813a92019-02-01 20:34:47 -060070 redfish.Delete ${resp_list[1]}
George Keishing5a73ee02019-01-28 08:21:47 -060071
George Keishing3a813a92019-02-01 20:34:47 -060072 ${resp}= redfish.List Request SessionService/Sessions
73 List Should Not Contain Value ${resp} ${resp_list[1]}
George Keishing4db114c2019-02-02 07:22:17 -060074
George Keishing6510cfb2019-01-31 12:28:36 -060075
76*** Keywords ***
77
78GET And Verify Redfish Response
79 [Documentation] GET given resource and verfiy response.
80 [Arguments] ${expected_response_code} ${resource_path}
81
82 # Description of arguments:
83 # expected_response_code Expected REST status codes.
84 # resource_path Redfish resource URL path.
85
86 ${resp}= redfish.Get ${resource_path}
87 Should Be Equal As Strings ${resp.status} ${expected_response_code}