blob: 2240d4b9bc38640b17ecae619e10788d7c307e0e [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.
27 [Tags] Create_Session_And_Verify_Response_Code_Using_Different_Credentails
28 [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
39Verify SessionService Defaults
40 [Documentation] Verify SessionService default property values.
41 [Tags] Verify_SessionService_Defaults
42
43 ${session_service}= Redfish.Get Properties /redfish/v1/SessionService
44 Rprint Vars session_service
45
46 Valid Value session_service['@odata.context'] ['/redfish/v1/$metadata#SessionService.SessionService']
47 Valid Value session_service['@odata.id'] ['/redfish/v1/SessionService/']
48 Valid Value session_service['Description'] ['Session Service']
49 Valid Value session_service['Id'] ['SessionService']
50 Valid Value session_service['Name'] ['Session Service']
51 Valid Value session_service['ServiceEnabled'] [True]
52 Valid Value session_service['SessionTimeout'] [3600]
53 Valid Value session_service['Sessions']['@odata.id'] ['/redfish/v1/SessionService/Sessions']
54
55
56Verify Sessions Defaults
57 [Documentation] Verify Sessions default property values.
58 [Tags] Verify_Sessions_Defaults
59
60 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions
61 Rprint Vars sessions
62 ${sessions_count}= Get length ${sessions['Members']}
63
64 Valid Value sessions['@odata.context'] ['/redfish/v1/$metadata#SessionCollection.SessionCollection']
65 Valid Value sessions['@odata.id'] ['/redfish/v1/SessionService/Sessions/']
66 Valid Value sessions['Description'] ['Session Collection']
67 Valid Value sessions['Name'] ['Session Collection']
68 Valid Value sessions['Members@odata.count'] [${sessions_count}]
69
70
71Verify Current Session Defaults
72 [Documentation] Verify Current session default property values.
73 [Tags] Verify_Current_Session_Defaults
74
75 ${session_location}= Redfish.Get Session Location
76 ${session_id}= Evaluate os.path.basename($session_location) modules=os
77 ${session_properties}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_id}
78 Rprint Vars session_location session_id session_properties
79
80 Valid Value session_properties['@odata.context'] ['/redfish/v1/$metadata#Session.Session']
81 Valid Value session_properties['@odata.id'] ['/redfish/v1/SessionService/Sessions/${session_id}']
82 Valid Value session_properties['Description'] ['Manager User Session']
83 Valid Value session_properties['Name'] ['User Session']
84 Valid Value session_properties['Id'] ['${session_id}']
85 Valid Value session_properties['UserName'] ['${OPENBMC_USERNAME}']
Vijay5b2f7792020-01-14 04:18:32 -060086
87
88Verify Managers Defaults
89 [Documentation] Verify managers defaults.
90 [Tags] Verify_Managers_Defaults
91
92 ${managers}= Redfish.Get Properties /redfish/v1/Managers
93 Rprint Vars managers
94 ${managers_count}= Get Length ${managers['Members']}
95
96 Valid Value managers['@odata.context'] ['/redfish/v1/$metadata#ManagerCollection.ManagerCollection']
97 Valid Value managers['Name'] ['Manager Collection']
98 Valid Value managers['@odata.id'] ['/redfish/v1/Managers']
99 Valid Value managers['Members@odata.count'] [${managers_count}]
100
Vijayff2c0bc2020-02-03 00:05:45 -0600101 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -0600102 Valid List managers['Members'] required_values=[{'@odata.id': '/redfish/v1/Managers/bmc'}]
103
104
105Verify Chassis Defaults
106 [Documentation] Verify chassis defaults.
107 [Tags] Verify_Chassis_Defaults
108
109 ${chassis}= Redfish.Get Properties /redfish/v1/Chassis
110 Rprint Vars chassis
111 ${chassis_count}= Get Length ${chassis['Members']}
112
113 Valid Value chassis['@odata.context'] ['/redfish/v1/$metadata#ChassisCollection.ChassisCollection']
114 Valid Value chassis['Name'] ['Chassis Collection']
115 Valid Value chassis['@odata.id'] ['/redfish/v1/Chassis']
116 Valid Value chassis['Members@odata.count'] [${chassis_count}]
117 Valid Value chassis['Members@odata.count'] [${chassis_count}]
118
Vijayff2c0bc2020-02-03 00:05:45 -0600119 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -0600120 Valid List chassis['Members']
121 ... required_values=[{'@odata.id': '/redfish/v1/Chassis/chassis'}]
122
123
124Verify Systems Defaults
125 [Documentation] Verify systems defaults.
126 [Tags] Verify_Systems_Defaults
127
128 ${systems}= Redfish.Get Properties /redfish/v1/Systems
129 Rprint Vars systems
130 ${systems_count}= Get Length ${systems['Members']}
131
132 Valid Value systems['@odata.context']
133 ... ['/redfish/v1/$metadata#ComputerSystemCollection.ComputerSystemCollection']
134 Valid Value systems['Name'] ['Computer System Collection']
135 Valid Value systems['@odata.id'] ['/redfish/v1/Systems']
136 Valid Value systems['Members@odata.count'] [${systems_count}]
137 Valid Value systems['Members@odata.count'] [${systems_count}]
Vijayff2c0bc2020-02-03 00:05:45 -0600138 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -0600139 Valid List systems['Members'] required_values=[{'@odata.id': '/redfish/v1/Systems/system'}]
140
141
142Verify Session Persistency After BMC Reboot
143 [Documentation] Verify session persistency after BMC reboot.
144 [Tags] Verify_Session_Persistency_After_BMC_Reboot
145
Vijayff2c0bc2020-02-03 00:05:45 -0600146 # Note the current session location.
Vijay5b2f7792020-01-14 04:18:32 -0600147 ${session_location}= Redfish.Get Session Location
148
149 Redfish OBMC Reboot (off) stack_mode=normal
150 Redfish.Login
151
Vijayff2c0bc2020-02-03 00:05:45 -0600152 # Check for session persistency after BMC reboot.
153 # sessions here will have list of all sessions location.
Vijay5b2f7792020-01-14 04:18:32 -0600154 ${sessions}= Redfish.Get Attribute /redfish/v1/SessionService/Sessions Members
155 ${payload}= Create Dictionary @odata.id=${session_location}
156
157 List Should Contain Value ${sessions} ${payload}
158
159
160REST Logging Interface Read Should Be A SUCCESS For Authorized Users
161 [Documentation] REST logging interface read should be a success for authorized users.
162 [Tags] REST_Logging_Interface_Read_Should_Be_A_SUCCESS_For_Authorized_Users
163
164 ${resp}= Redfish.Get /xyz/openbmc_project/logging
165
166 ${resp_output}= evaluate json.loads('''${resp.text}''') json
167 ${log_count}= Get Length ${resp_output["data"]}
168
Vijayff2c0bc2020-02-03 00:05:45 -0600169 # Max 200 error logs are allowed in OpenBmc.
Vijay5b2f7792020-01-14 04:18:32 -0600170 Run Keyword Unless ${-1} < ${log_count} < ${201} Fail
171
Vijaye6fa8552020-01-14 04:44:36 -0600172
Vijaye6fa8552020-01-14 04:44:36 -0600173*** Keywords ***
174
175Create Session And Verify Response Code
176 [Documentation] Create session and verify response code.
177 [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD}
178 ... ${valid_status_code}=${HTTP_CREATED}
179
180 # Description of argument(s):
181 # username The username to create a session.
182 # password The password to create a session.
Vijayff2c0bc2020-02-03 00:05:45 -0600183 # valid_status_code Expected response code, default is ${HTTP_CREATED}.
Vijaye6fa8552020-01-14 04:44:36 -0600184
185 ${resp}= Redfish.Post /redfish/v1/SessionService/Sessions
186 ... body={'UserName':'${username}', 'Password': '${password}'}
187 ... valid_status_codes=[${valid_status_code}]
188
189
Vijaye6fa8552020-01-14 04:44:36 -0600190Suite Setup Execution
191 [Documentation] Suite Setup Execution.
192
193 Redfish.Login
Vijayff2c0bc2020-02-03 00:05:45 -0600194 Create Users With Different Roles users=${USERS} force=${True}
Vijay39373152020-02-14 08:08:20 -0600195
196
197Suite Teardown Execution
198 [Documentation] Suite teardown execution.
199
200 Delete BMC Users Via Redfish users=${USERS}
201 Redfish.Logout