blob: 93d7a9380d9097ef0c030fae4bdd62547869b53e [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
Vijay39373152020-02-14 08:08:20 -060011Suite Teardown Suite Teardown Execution
Vijay53a00552020-01-08 04:24:47 -060012Test Setup Printn
13Test Teardown FFDC On Test Case Fail
14
Vijay39373152020-02-14 08:08:20 -060015
Vijayff2c0bc2020-02-03 00:05:45 -060016*** Variables ***
Vijay39373152020-02-14 08:08:20 -060017
Vijayff2c0bc2020-02-03 00:05:45 -060018@{ADMIN} admin_user TestPwd123
19@{OPERATOR} operator_user TestPwd123
20&{USERS} Administrator=${ADMIN} Operator=${OPERATOR}
Vijay53a00552020-01-08 04:24:47 -060021
Vijay39373152020-02-14 08:08:20 -060022
Vijay53a00552020-01-08 04:24:47 -060023*** Test Cases ***
24
Vijaye6fa8552020-01-14 04:44:36 -060025Create Session And Verify Response Code Using Different Credentials
26 [Documentation] Create session and verify response code using different credentials.
George Keishing0c8100f2022-01-13 00:24:57 -060027 [Tags] Create_Session_And_Verify_Response_Code_Using_Different_Credentials
Vijaye6fa8552020-01-14 04:44:36 -060028 [Template] Create Session And Verify Response Code
Vijay53a00552020-01-08 04:24:47 -060029
Vijaye6fa8552020-01-14 04:44:36 -060030 # username password valid_status_code
31 ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} ${HTTP_CREATED}
Vijayff2c0bc2020-02-03 00:05:45 -060032 r00t ${OPENBMC_PASSWORD} ${HTTP_UNAUTHORIZED}
33 ${OPENBMC_USERNAME} password ${HTTP_UNAUTHORIZED}
34 r00t password ${HTTP_UNAUTHORIZED}
Vijaye6fa8552020-01-14 04:44:36 -060035 admin_user TestPwd123 ${HTTP_CREATED}
36 operator_user TestPwd123 ${HTTP_CREATED}
Vijay53a00552020-01-08 04:24:47 -060037
38
David Wangd511f5d2021-02-26 16:19:20 +080039Set Session Timeout And Verify Response Code
40 [Documentation] Set Session Timeout And Verify Response Code.
41 [Tags] Set_Session_Timeout_And_Verify_Response_Code
42 [Template] Set Session Timeout And Verify
43 [Teardown] Set Session Timeout And Verify ${3600} ${HTTP_OK}
44
George Keishing96143832021-03-23 07:55:08 -050045 # The minimum & maximum allowed values for session timeout are 30
David Wangd511f5d2021-02-26 16:19:20 +080046 # seconds and 86400 seconds respectively as per the session service
47 # schema mentioned at
48 # https://redfish.dmtf.org/schemas/v1/SessionService.v1_1_7.json
49
50 # value valid_status_code
51 ${25} ${HTTP_BAD_REQUEST}
52 ${30} ${HTTP_OK}
53 ${3600} ${HTTP_OK}
54 ${86400} ${HTTP_OK}
55 ${86500} ${HTTP_BAD_REQUEST}
56
57
Vijay53a00552020-01-08 04:24:47 -060058Verify SessionService Defaults
59 [Documentation] Verify SessionService default property values.
60 [Tags] Verify_SessionService_Defaults
61
62 ${session_service}= Redfish.Get Properties /redfish/v1/SessionService
63 Rprint Vars session_service
64
Vijay53a00552020-01-08 04:24:47 -060065 Valid Value session_service['@odata.id'] ['/redfish/v1/SessionService/']
66 Valid Value session_service['Description'] ['Session Service']
67 Valid Value session_service['Id'] ['SessionService']
68 Valid Value session_service['Name'] ['Session Service']
69 Valid Value session_service['ServiceEnabled'] [True]
70 Valid Value session_service['SessionTimeout'] [3600]
71 Valid Value session_service['Sessions']['@odata.id'] ['/redfish/v1/SessionService/Sessions']
72
73
74Verify Sessions Defaults
75 [Documentation] Verify Sessions default property values.
76 [Tags] Verify_Sessions_Defaults
77
78 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions
79 Rprint Vars sessions
80 ${sessions_count}= Get length ${sessions['Members']}
81
Vijay53a00552020-01-08 04:24:47 -060082 Valid Value sessions['@odata.id'] ['/redfish/v1/SessionService/Sessions/']
83 Valid Value sessions['Description'] ['Session Collection']
84 Valid Value sessions['Name'] ['Session Collection']
85 Valid Value sessions['Members@odata.count'] [${sessions_count}]
86
87
88Verify Current Session Defaults
89 [Documentation] Verify Current session default property values.
90 [Tags] Verify_Current_Session_Defaults
91
92 ${session_location}= Redfish.Get Session Location
93 ${session_id}= Evaluate os.path.basename($session_location) modules=os
94 ${session_properties}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_id}
95 Rprint Vars session_location session_id session_properties
96
Vijay53a00552020-01-08 04:24:47 -060097 Valid Value session_properties['@odata.id'] ['/redfish/v1/SessionService/Sessions/${session_id}']
98 Valid Value session_properties['Description'] ['Manager User Session']
99 Valid Value session_properties['Name'] ['User Session']
100 Valid Value session_properties['Id'] ['${session_id}']
101 Valid Value session_properties['UserName'] ['${OPENBMC_USERNAME}']
Vijay5b2f7792020-01-14 04:18:32 -0600102
103
104Verify Managers Defaults
105 [Documentation] Verify managers defaults.
106 [Tags] Verify_Managers_Defaults
107
108 ${managers}= Redfish.Get Properties /redfish/v1/Managers
109 Rprint Vars managers
110 ${managers_count}= Get Length ${managers['Members']}
111
Vijay5b2f7792020-01-14 04:18:32 -0600112 Valid Value managers['Name'] ['Manager Collection']
113 Valid Value managers['@odata.id'] ['/redfish/v1/Managers']
114 Valid Value managers['Members@odata.count'] [${managers_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 managers['Members'] required_values=[{'@odata.id': '/redfish/v1/Managers/bmc'}]
118
119
120Verify Chassis Defaults
121 [Documentation] Verify chassis defaults.
122 [Tags] Verify_Chassis_Defaults
123
124 ${chassis}= Redfish.Get Properties /redfish/v1/Chassis
125 Rprint Vars chassis
126 ${chassis_count}= Get Length ${chassis['Members']}
127
Vijay5b2f7792020-01-14 04:18:32 -0600128 Valid Value chassis['Name'] ['Chassis Collection']
129 Valid Value chassis['@odata.id'] ['/redfish/v1/Chassis']
130 Valid Value chassis['Members@odata.count'] [${chassis_count}]
131 Valid Value chassis['Members@odata.count'] [${chassis_count}]
132
Vijayff2c0bc2020-02-03 00:05:45 -0600133 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -0600134 Valid List chassis['Members']
Tony Lee2b975822021-04-01 11:15:00 +0800135 ... required_values=[{'@odata.id': '/redfish/v1/Chassis/${CHASSIS_ID}'}]
Vijay5b2f7792020-01-14 04:18:32 -0600136
137
138Verify Systems Defaults
139 [Documentation] Verify systems defaults.
140 [Tags] Verify_Systems_Defaults
141
142 ${systems}= Redfish.Get Properties /redfish/v1/Systems
143 Rprint Vars systems
144 ${systems_count}= Get Length ${systems['Members']}
Vijay5b2f7792020-01-14 04:18:32 -0600145 Valid Value systems['Name'] ['Computer System Collection']
146 Valid Value systems['@odata.id'] ['/redfish/v1/Systems']
147 Valid Value systems['Members@odata.count'] [${systems_count}]
148 Valid Value systems['Members@odata.count'] [${systems_count}]
Vijayff2c0bc2020-02-03 00:05:45 -0600149 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -0600150 Valid List systems['Members'] required_values=[{'@odata.id': '/redfish/v1/Systems/system'}]
151
152
153Verify Session Persistency After BMC Reboot
154 [Documentation] Verify session persistency after BMC reboot.
155 [Tags] Verify_Session_Persistency_After_BMC_Reboot
156
Vijayff2c0bc2020-02-03 00:05:45 -0600157 # Note the current session location.
Vijay5b2f7792020-01-14 04:18:32 -0600158 ${session_location}= Redfish.Get Session Location
159
160 Redfish OBMC Reboot (off) stack_mode=normal
Vijay5b2f7792020-01-14 04:18:32 -0600161
Vijayff2c0bc2020-02-03 00:05:45 -0600162 # Check for session persistency after BMC reboot.
163 # sessions here will have list of all sessions location.
Vijay5b2f7792020-01-14 04:18:32 -0600164 ${sessions}= Redfish.Get Attribute /redfish/v1/SessionService/Sessions Members
165 ${payload}= Create Dictionary @odata.id=${session_location}
166
167 List Should Contain Value ${sessions} ${payload}
168
Vijaye6fa8552020-01-14 04:44:36 -0600169*** Keywords ***
170
171Create Session And Verify Response Code
172 [Documentation] Create session and verify response code.
173 [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD}
174 ... ${valid_status_code}=${HTTP_CREATED}
175
176 # Description of argument(s):
177 # username The username to create a session.
178 # password The password to create a session.
Vijayff2c0bc2020-02-03 00:05:45 -0600179 # valid_status_code Expected response code, default is ${HTTP_CREATED}.
Vijaye6fa8552020-01-14 04:44:36 -0600180
181 ${resp}= Redfish.Post /redfish/v1/SessionService/Sessions
182 ... body={'UserName':'${username}', 'Password': '${password}'}
183 ... valid_status_codes=[${valid_status_code}]
184
185
David Wangd511f5d2021-02-26 16:19:20 +0800186Set Session Timeout And Verify
187 [Documentation] Set Session Timeout And Verify.
188 [Arguments] ${value}=3600 ${valid_status_code}=${HTTP_OK}
189
190 # Description of argument(s):
191 # value The value to patch session timeout.
192 # valid_status_code Expected response code, default is ${HTTP_OK}.
193
194 ${data}= Create Dictionary SessionTimeout=${value}
195 Redfish.Patch ${REDFISH_BASE_URI}SessionService
196 ... body=&{data}
197 ... valid_status_codes=[${valid_status_code}]
198
199 ${session_timeout}= Redfish.Get Attribute
200 ... ${REDFISH_BASE_URI}SessionService SessionTimeout
201
202 Run Keyword If ${valid_status_code}==${HTTP_OK}
203 ... Valid Value session_timeout [${value}]
204
205
Vijaye6fa8552020-01-14 04:44:36 -0600206Suite Setup Execution
207 [Documentation] Suite Setup Execution.
208
209 Redfish.Login
Vijayff2c0bc2020-02-03 00:05:45 -0600210 Create Users With Different Roles users=${USERS} force=${True}
Vijay39373152020-02-14 08:08:20 -0600211
212
213Suite Teardown Execution
214 [Documentation] Suite teardown execution.
215
216 Delete BMC Users Via Redfish users=${USERS}
217 Redfish.Logout