blob: c72eca96a32d2df87ebe1309a000c7c74b920168 [file] [log] [blame]
Vijay53a00552020-01-08 04:24:47 -06001*** Settings ***
Vijaye6fa8552020-01-14 04:44:36 -06002
Vijay53a00552020-01-08 04:24:47 -06003Documentation Test Redfish SessionService.
4
5Resource ../../lib/resource.robot
6Resource ../../lib/bmc_redfish_resource.robot
Vijayff2c0bc2020-02-03 00:05:45 -06007Resource ../../lib/bmc_redfish_utils.robot
Vijay53a00552020-01-08 04:24:47 -06008Resource ../../lib/openbmc_ffdc.robot
9
Vijaye6fa8552020-01-14 04:44:36 -060010Suite Setup Suite Setup Execution
Vijay53a00552020-01-08 04:24:47 -060011Suite Teardown Redfish.Logout
12Test Setup Printn
13Test Teardown FFDC On Test Case Fail
14
Vijayff2c0bc2020-02-03 00:05:45 -060015*** Variables ***
16@{ADMIN} admin_user TestPwd123
17@{OPERATOR} operator_user TestPwd123
18&{USERS} Administrator=${ADMIN} Operator=${OPERATOR}
Vijay53a00552020-01-08 04:24:47 -060019
20*** Test Cases ***
21
Vijaye6fa8552020-01-14 04:44:36 -060022Create Session And Verify Response Code Using Different Credentials
23 [Documentation] Create session and verify response code using different credentials.
24 [Tags] Create_Session_And_Verify_Response_Code_Using_Different_Credentails
25 [Template] Create Session And Verify Response Code
Vijay53a00552020-01-08 04:24:47 -060026
Vijaye6fa8552020-01-14 04:44:36 -060027 # username password valid_status_code
28 ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} ${HTTP_CREATED}
Vijayff2c0bc2020-02-03 00:05:45 -060029 r00t ${OPENBMC_PASSWORD} ${HTTP_UNAUTHORIZED}
30 ${OPENBMC_USERNAME} password ${HTTP_UNAUTHORIZED}
31 r00t password ${HTTP_UNAUTHORIZED}
Vijaye6fa8552020-01-14 04:44:36 -060032 admin_user TestPwd123 ${HTTP_CREATED}
33 operator_user TestPwd123 ${HTTP_CREATED}
Vijay53a00552020-01-08 04:24:47 -060034
35
36Verify SessionService Defaults
37 [Documentation] Verify SessionService default property values.
38 [Tags] Verify_SessionService_Defaults
39
40 ${session_service}= Redfish.Get Properties /redfish/v1/SessionService
41 Rprint Vars session_service
42
43 Valid Value session_service['@odata.context'] ['/redfish/v1/$metadata#SessionService.SessionService']
44 Valid Value session_service['@odata.id'] ['/redfish/v1/SessionService/']
45 Valid Value session_service['Description'] ['Session Service']
46 Valid Value session_service['Id'] ['SessionService']
47 Valid Value session_service['Name'] ['Session Service']
48 Valid Value session_service['ServiceEnabled'] [True]
49 Valid Value session_service['SessionTimeout'] [3600]
50 Valid Value session_service['Sessions']['@odata.id'] ['/redfish/v1/SessionService/Sessions']
51
52
53Verify Sessions Defaults
54 [Documentation] Verify Sessions default property values.
55 [Tags] Verify_Sessions_Defaults
56
57 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions
58 Rprint Vars sessions
59 ${sessions_count}= Get length ${sessions['Members']}
60
61 Valid Value sessions['@odata.context'] ['/redfish/v1/$metadata#SessionCollection.SessionCollection']
62 Valid Value sessions['@odata.id'] ['/redfish/v1/SessionService/Sessions/']
63 Valid Value sessions['Description'] ['Session Collection']
64 Valid Value sessions['Name'] ['Session Collection']
65 Valid Value sessions['Members@odata.count'] [${sessions_count}]
66
67
68Verify Current Session Defaults
69 [Documentation] Verify Current session default property values.
70 [Tags] Verify_Current_Session_Defaults
71
72 ${session_location}= Redfish.Get Session Location
73 ${session_id}= Evaluate os.path.basename($session_location) modules=os
74 ${session_properties}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_id}
75 Rprint Vars session_location session_id session_properties
76
77 Valid Value session_properties['@odata.context'] ['/redfish/v1/$metadata#Session.Session']
78 Valid Value session_properties['@odata.id'] ['/redfish/v1/SessionService/Sessions/${session_id}']
79 Valid Value session_properties['Description'] ['Manager User Session']
80 Valid Value session_properties['Name'] ['User Session']
81 Valid Value session_properties['Id'] ['${session_id}']
82 Valid Value session_properties['UserName'] ['${OPENBMC_USERNAME}']
Vijay5b2f7792020-01-14 04:18:32 -060083
84
85Verify Managers Defaults
86 [Documentation] Verify managers defaults.
87 [Tags] Verify_Managers_Defaults
88
89 ${managers}= Redfish.Get Properties /redfish/v1/Managers
90 Rprint Vars managers
91 ${managers_count}= Get Length ${managers['Members']}
92
93 Valid Value managers['@odata.context'] ['/redfish/v1/$metadata#ManagerCollection.ManagerCollection']
94 Valid Value managers['Name'] ['Manager Collection']
95 Valid Value managers['@odata.id'] ['/redfish/v1/Managers']
96 Valid Value managers['Members@odata.count'] [${managers_count}]
97
Vijayff2c0bc2020-02-03 00:05:45 -060098 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -060099 Valid List managers['Members'] required_values=[{'@odata.id': '/redfish/v1/Managers/bmc'}]
100
101
102Verify Chassis Defaults
103 [Documentation] Verify chassis defaults.
104 [Tags] Verify_Chassis_Defaults
105
106 ${chassis}= Redfish.Get Properties /redfish/v1/Chassis
107 Rprint Vars chassis
108 ${chassis_count}= Get Length ${chassis['Members']}
109
110 Valid Value chassis['@odata.context'] ['/redfish/v1/$metadata#ChassisCollection.ChassisCollection']
111 Valid Value chassis['Name'] ['Chassis Collection']
112 Valid Value chassis['@odata.id'] ['/redfish/v1/Chassis']
113 Valid Value chassis['Members@odata.count'] [${chassis_count}]
114 Valid Value chassis['Members@odata.count'] [${chassis_count}]
115
Vijayff2c0bc2020-02-03 00:05:45 -0600116 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -0600117 Valid List chassis['Members']
118 ... required_values=[{'@odata.id': '/redfish/v1/Chassis/chassis'}]
119
120
121Verify Systems Defaults
122 [Documentation] Verify systems defaults.
123 [Tags] Verify_Systems_Defaults
124
125 ${systems}= Redfish.Get Properties /redfish/v1/Systems
126 Rprint Vars systems
127 ${systems_count}= Get Length ${systems['Members']}
128
129 Valid Value systems['@odata.context']
130 ... ['/redfish/v1/$metadata#ComputerSystemCollection.ComputerSystemCollection']
131 Valid Value systems['Name'] ['Computer System Collection']
132 Valid Value systems['@odata.id'] ['/redfish/v1/Systems']
133 Valid Value systems['Members@odata.count'] [${systems_count}]
134 Valid Value systems['Members@odata.count'] [${systems_count}]
Vijayff2c0bc2020-02-03 00:05:45 -0600135 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -0600136 Valid List systems['Members'] required_values=[{'@odata.id': '/redfish/v1/Systems/system'}]
137
138
139Verify Session Persistency After BMC Reboot
140 [Documentation] Verify session persistency after BMC reboot.
141 [Tags] Verify_Session_Persistency_After_BMC_Reboot
142
Vijayff2c0bc2020-02-03 00:05:45 -0600143 # Note the current session location.
Vijay5b2f7792020-01-14 04:18:32 -0600144 ${session_location}= Redfish.Get Session Location
145
146 Redfish OBMC Reboot (off) stack_mode=normal
147 Redfish.Login
148
Vijayff2c0bc2020-02-03 00:05:45 -0600149 # Check for session persistency after BMC reboot.
150 # sessions here will have list of all sessions location.
Vijay5b2f7792020-01-14 04:18:32 -0600151 ${sessions}= Redfish.Get Attribute /redfish/v1/SessionService/Sessions Members
152 ${payload}= Create Dictionary @odata.id=${session_location}
153
154 List Should Contain Value ${sessions} ${payload}
155
156
157REST Logging Interface Read Should Be A SUCCESS For Authorized Users
158 [Documentation] REST logging interface read should be a success for authorized users.
159 [Tags] REST_Logging_Interface_Read_Should_Be_A_SUCCESS_For_Authorized_Users
160
161 ${resp}= Redfish.Get /xyz/openbmc_project/logging
162
163 ${resp_output}= evaluate json.loads('''${resp.text}''') json
164 ${log_count}= Get Length ${resp_output["data"]}
165
Vijayff2c0bc2020-02-03 00:05:45 -0600166 # Max 200 error logs are allowed in OpenBmc.
Vijay5b2f7792020-01-14 04:18:32 -0600167 Run Keyword Unless ${-1} < ${log_count} < ${201} Fail
168
Vijaye6fa8552020-01-14 04:44:36 -0600169
Vijaye6fa8552020-01-14 04:44:36 -0600170*** Keywords ***
171
172Create Session And Verify Response Code
173 [Documentation] Create session and verify response code.
174 [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD}
175 ... ${valid_status_code}=${HTTP_CREATED}
176
177 # Description of argument(s):
178 # username The username to create a session.
179 # password The password to create a session.
Vijayff2c0bc2020-02-03 00:05:45 -0600180 # valid_status_code Expected response code, default is ${HTTP_CREATED}.
Vijaye6fa8552020-01-14 04:44:36 -0600181
182 ${resp}= Redfish.Post /redfish/v1/SessionService/Sessions
183 ... body={'UserName':'${username}', 'Password': '${password}'}
184 ... valid_status_codes=[${valid_status_code}]
185
186
Vijaye6fa8552020-01-14 04:44:36 -0600187Suite Setup Execution
188 [Documentation] Suite Setup Execution.
189
190 Redfish.Login
Vijayff2c0bc2020-02-03 00:05:45 -0600191 Create Users With Different Roles users=${USERS} force=${True}