blob: d3f52cb17a910b2e5ba59b40f669c1d8e52d2faf [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
Vijay53a00552020-01-08 04:24:47 -060046 Valid Value session_service['@odata.id'] ['/redfish/v1/SessionService/']
47 Valid Value session_service['Description'] ['Session Service']
48 Valid Value session_service['Id'] ['SessionService']
49 Valid Value session_service['Name'] ['Session Service']
50 Valid Value session_service['ServiceEnabled'] [True]
51 Valid Value session_service['SessionTimeout'] [3600]
52 Valid Value session_service['Sessions']['@odata.id'] ['/redfish/v1/SessionService/Sessions']
53
54
55Verify Sessions Defaults
56 [Documentation] Verify Sessions default property values.
57 [Tags] Verify_Sessions_Defaults
58
59 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions
60 Rprint Vars sessions
61 ${sessions_count}= Get length ${sessions['Members']}
62
Vijay53a00552020-01-08 04:24:47 -060063 Valid Value sessions['@odata.id'] ['/redfish/v1/SessionService/Sessions/']
64 Valid Value sessions['Description'] ['Session Collection']
65 Valid Value sessions['Name'] ['Session Collection']
66 Valid Value sessions['Members@odata.count'] [${sessions_count}]
67
68
69Verify Current Session Defaults
70 [Documentation] Verify Current session default property values.
71 [Tags] Verify_Current_Session_Defaults
72
73 ${session_location}= Redfish.Get Session Location
74 ${session_id}= Evaluate os.path.basename($session_location) modules=os
75 ${session_properties}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_id}
76 Rprint Vars session_location session_id session_properties
77
Vijay53a00552020-01-08 04:24:47 -060078 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
Vijay5b2f7792020-01-14 04:18:32 -060093 Valid Value managers['Name'] ['Manager Collection']
94 Valid Value managers['@odata.id'] ['/redfish/v1/Managers']
95 Valid Value managers['Members@odata.count'] [${managers_count}]
96
Vijayff2c0bc2020-02-03 00:05:45 -060097 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -060098 Valid List managers['Members'] required_values=[{'@odata.id': '/redfish/v1/Managers/bmc'}]
99
100
101Verify Chassis Defaults
102 [Documentation] Verify chassis defaults.
103 [Tags] Verify_Chassis_Defaults
104
105 ${chassis}= Redfish.Get Properties /redfish/v1/Chassis
106 Rprint Vars chassis
107 ${chassis_count}= Get Length ${chassis['Members']}
108
Vijay5b2f7792020-01-14 04:18:32 -0600109 Valid Value chassis['Name'] ['Chassis Collection']
110 Valid Value chassis['@odata.id'] ['/redfish/v1/Chassis']
111 Valid Value chassis['Members@odata.count'] [${chassis_count}]
112 Valid Value chassis['Members@odata.count'] [${chassis_count}]
113
Vijayff2c0bc2020-02-03 00:05:45 -0600114 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -0600115 Valid List chassis['Members']
116 ... required_values=[{'@odata.id': '/redfish/v1/Chassis/chassis'}]
117
118
119Verify Systems Defaults
120 [Documentation] Verify systems defaults.
121 [Tags] Verify_Systems_Defaults
122
123 ${systems}= Redfish.Get Properties /redfish/v1/Systems
124 Rprint Vars systems
125 ${systems_count}= Get Length ${systems['Members']}
Vijay5b2f7792020-01-14 04:18:32 -0600126 Valid Value systems['Name'] ['Computer System Collection']
127 Valid Value systems['@odata.id'] ['/redfish/v1/Systems']
128 Valid Value systems['Members@odata.count'] [${systems_count}]
129 Valid Value systems['Members@odata.count'] [${systems_count}]
Vijayff2c0bc2020-02-03 00:05:45 -0600130 # Members can be one or more, hence checking in the list.
Vijay5b2f7792020-01-14 04:18:32 -0600131 Valid List systems['Members'] required_values=[{'@odata.id': '/redfish/v1/Systems/system'}]
132
133
134Verify Session Persistency After BMC Reboot
135 [Documentation] Verify session persistency after BMC reboot.
136 [Tags] Verify_Session_Persistency_After_BMC_Reboot
137
Vijayff2c0bc2020-02-03 00:05:45 -0600138 # Note the current session location.
Vijay5b2f7792020-01-14 04:18:32 -0600139 ${session_location}= Redfish.Get Session Location
140
141 Redfish OBMC Reboot (off) stack_mode=normal
142 Redfish.Login
143
Vijayff2c0bc2020-02-03 00:05:45 -0600144 # Check for session persistency after BMC reboot.
145 # sessions here will have list of all sessions location.
Vijay5b2f7792020-01-14 04:18:32 -0600146 ${sessions}= Redfish.Get Attribute /redfish/v1/SessionService/Sessions Members
147 ${payload}= Create Dictionary @odata.id=${session_location}
148
149 List Should Contain Value ${sessions} ${payload}
150
151
152REST Logging Interface Read Should Be A SUCCESS For Authorized Users
153 [Documentation] REST logging interface read should be a success for authorized users.
154 [Tags] REST_Logging_Interface_Read_Should_Be_A_SUCCESS_For_Authorized_Users
155
156 ${resp}= Redfish.Get /xyz/openbmc_project/logging
157
158 ${resp_output}= evaluate json.loads('''${resp.text}''') json
159 ${log_count}= Get Length ${resp_output["data"]}
160
Vijayff2c0bc2020-02-03 00:05:45 -0600161 # Max 200 error logs are allowed in OpenBmc.
Vijay5b2f7792020-01-14 04:18:32 -0600162 Run Keyword Unless ${-1} < ${log_count} < ${201} Fail
163
Vijaye6fa8552020-01-14 04:44:36 -0600164
Vijaye6fa8552020-01-14 04:44:36 -0600165*** Keywords ***
166
167Create Session And Verify Response Code
168 [Documentation] Create session and verify response code.
169 [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD}
170 ... ${valid_status_code}=${HTTP_CREATED}
171
172 # Description of argument(s):
173 # username The username to create a session.
174 # password The password to create a session.
Vijayff2c0bc2020-02-03 00:05:45 -0600175 # valid_status_code Expected response code, default is ${HTTP_CREATED}.
Vijaye6fa8552020-01-14 04:44:36 -0600176
177 ${resp}= Redfish.Post /redfish/v1/SessionService/Sessions
178 ... body={'UserName':'${username}', 'Password': '${password}'}
179 ... valid_status_codes=[${valid_status_code}]
180
181
Vijaye6fa8552020-01-14 04:44:36 -0600182Suite Setup Execution
183 [Documentation] Suite Setup Execution.
184
185 Redfish.Login
Vijayff2c0bc2020-02-03 00:05:45 -0600186 Create Users With Different Roles users=${USERS} force=${True}
Vijay39373152020-02-14 08:08:20 -0600187
188
189Suite Teardown Execution
190 [Documentation] Suite teardown execution.
191
192 Delete BMC Users Via Redfish users=${USERS}
193 Redfish.Logout