Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 1 | *** Settings *** |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 2 | |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 3 | Documentation Test Redfish SessionService. |
| 4 | |
| 5 | Resource ../../lib/resource.robot |
| 6 | Resource ../../lib/bmc_redfish_resource.robot |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 7 | Resource ../../lib/bmc_redfish_utils.robot |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 8 | Resource ../../lib/openbmc_ffdc.robot |
| 9 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 10 | Suite Setup Suite Setup Execution |
Vijay | 3937315 | 2020-02-14 08:08:20 -0600 | [diff] [blame] | 11 | Suite Teardown Suite Teardown Execution |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 12 | Test Setup Printn |
| 13 | Test Teardown FFDC On Test Case Fail |
| 14 | |
Vijay | 3937315 | 2020-02-14 08:08:20 -0600 | [diff] [blame] | 15 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 16 | *** Variables *** |
Vijay | 3937315 | 2020-02-14 08:08:20 -0600 | [diff] [blame] | 17 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 18 | @{ADMIN} admin_user TestPwd123 |
| 19 | @{OPERATOR} operator_user TestPwd123 |
| 20 | &{USERS} Administrator=${ADMIN} Operator=${OPERATOR} |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 21 | |
Vijay | 3937315 | 2020-02-14 08:08:20 -0600 | [diff] [blame] | 22 | |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 23 | *** Test Cases *** |
| 24 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 25 | Create 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 |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 29 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 30 | # username password valid_status_code |
| 31 | ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} ${HTTP_CREATED} |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 32 | r00t ${OPENBMC_PASSWORD} ${HTTP_UNAUTHORIZED} |
| 33 | ${OPENBMC_USERNAME} password ${HTTP_UNAUTHORIZED} |
| 34 | r00t password ${HTTP_UNAUTHORIZED} |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 35 | admin_user TestPwd123 ${HTTP_CREATED} |
| 36 | operator_user TestPwd123 ${HTTP_CREATED} |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 37 | |
| 38 | |
David Wang | d511f5d | 2021-02-26 16:19:20 +0800 | [diff] [blame] | 39 | Set 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 Keishing | 9614383 | 2021-03-23 07:55:08 -0500 | [diff] [blame] | 45 | # The minimum & maximum allowed values for session timeout are 30 |
David Wang | d511f5d | 2021-02-26 16:19:20 +0800 | [diff] [blame] | 46 | # 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 | |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 58 | Verify 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 | |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 65 | 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 | |
| 74 | Verify 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 | |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 82 | 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 | |
| 88 | Verify 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 | |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 97 | 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}'] |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 102 | |
| 103 | |
| 104 | Verify 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 | |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 112 | 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 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 116 | # Members can be one or more, hence checking in the list. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 117 | Valid List managers['Members'] required_values=[{'@odata.id': '/redfish/v1/Managers/bmc'}] |
| 118 | |
| 119 | |
| 120 | Verify 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 | |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 128 | 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 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 133 | # Members can be one or more, hence checking in the list. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 134 | Valid List chassis['Members'] |
Tony Lee | 2b97582 | 2021-04-01 11:15:00 +0800 | [diff] [blame] | 135 | ... required_values=[{'@odata.id': '/redfish/v1/Chassis/${CHASSIS_ID}'}] |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 136 | |
| 137 | |
| 138 | Verify 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']} |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 145 | 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}] |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 149 | # Members can be one or more, hence checking in the list. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 150 | Valid List systems['Members'] required_values=[{'@odata.id': '/redfish/v1/Systems/system'}] |
| 151 | |
| 152 | |
| 153 | Verify Session Persistency After BMC Reboot |
| 154 | [Documentation] Verify session persistency after BMC reboot. |
| 155 | [Tags] Verify_Session_Persistency_After_BMC_Reboot |
| 156 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 157 | # Note the current session location. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 158 | ${session_location}= Redfish.Get Session Location |
| 159 | |
| 160 | Redfish OBMC Reboot (off) stack_mode=normal |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 161 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 162 | # Check for session persistency after BMC reboot. |
| 163 | # sessions here will have list of all sessions location. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 164 | ${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 | |
| 169 | |
| 170 | REST Logging Interface Read Should Be A SUCCESS For Authorized Users |
| 171 | [Documentation] REST logging interface read should be a success for authorized users. |
| 172 | [Tags] REST_Logging_Interface_Read_Should_Be_A_SUCCESS_For_Authorized_Users |
| 173 | |
| 174 | ${resp}= Redfish.Get /xyz/openbmc_project/logging |
| 175 | |
| 176 | ${resp_output}= evaluate json.loads('''${resp.text}''') json |
| 177 | ${log_count}= Get Length ${resp_output["data"]} |
| 178 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 179 | # Max 200 error logs are allowed in OpenBmc. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 180 | Run Keyword Unless ${-1} < ${log_count} < ${201} Fail |
| 181 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 182 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 183 | *** Keywords *** |
| 184 | |
| 185 | Create Session And Verify Response Code |
| 186 | [Documentation] Create session and verify response code. |
| 187 | [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD} |
| 188 | ... ${valid_status_code}=${HTTP_CREATED} |
| 189 | |
| 190 | # Description of argument(s): |
| 191 | # username The username to create a session. |
| 192 | # password The password to create a session. |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 193 | # valid_status_code Expected response code, default is ${HTTP_CREATED}. |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 194 | |
| 195 | ${resp}= Redfish.Post /redfish/v1/SessionService/Sessions |
| 196 | ... body={'UserName':'${username}', 'Password': '${password}'} |
| 197 | ... valid_status_codes=[${valid_status_code}] |
| 198 | |
| 199 | |
David Wang | d511f5d | 2021-02-26 16:19:20 +0800 | [diff] [blame] | 200 | Set Session Timeout And Verify |
| 201 | [Documentation] Set Session Timeout And Verify. |
| 202 | [Arguments] ${value}=3600 ${valid_status_code}=${HTTP_OK} |
| 203 | |
| 204 | # Description of argument(s): |
| 205 | # value The value to patch session timeout. |
| 206 | # valid_status_code Expected response code, default is ${HTTP_OK}. |
| 207 | |
| 208 | ${data}= Create Dictionary SessionTimeout=${value} |
| 209 | Redfish.Patch ${REDFISH_BASE_URI}SessionService |
| 210 | ... body=&{data} |
| 211 | ... valid_status_codes=[${valid_status_code}] |
| 212 | |
| 213 | ${session_timeout}= Redfish.Get Attribute |
| 214 | ... ${REDFISH_BASE_URI}SessionService SessionTimeout |
| 215 | |
| 216 | Run Keyword If ${valid_status_code}==${HTTP_OK} |
| 217 | ... Valid Value session_timeout [${value}] |
| 218 | |
| 219 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 220 | Suite Setup Execution |
| 221 | [Documentation] Suite Setup Execution. |
| 222 | |
| 223 | Redfish.Login |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 224 | Create Users With Different Roles users=${USERS} force=${True} |
Vijay | 3937315 | 2020-02-14 08:08:20 -0600 | [diff] [blame] | 225 | |
| 226 | |
| 227 | Suite Teardown Execution |
| 228 | [Documentation] Suite teardown execution. |
| 229 | |
| 230 | Delete BMC Users Via Redfish users=${USERS} |
| 231 | Redfish.Logout |