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 | |
| 39 | Verify 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 | |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 46 | 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 | |
| 55 | Verify 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 | |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 63 | 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 | |
| 69 | Verify 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 | |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 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}'] |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 83 | |
| 84 | |
| 85 | Verify 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 | |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 93 | 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 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 97 | # Members can be one or more, hence checking in the list. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 98 | Valid List managers['Members'] required_values=[{'@odata.id': '/redfish/v1/Managers/bmc'}] |
| 99 | |
| 100 | |
| 101 | Verify 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 | |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 109 | 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 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 114 | # Members can be one or more, hence checking in the list. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 115 | Valid List chassis['Members'] |
| 116 | ... required_values=[{'@odata.id': '/redfish/v1/Chassis/chassis'}] |
| 117 | |
| 118 | |
| 119 | Verify 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']} |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 126 | 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}] |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 130 | # Members can be one or more, hence checking in the list. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 131 | Valid List systems['Members'] required_values=[{'@odata.id': '/redfish/v1/Systems/system'}] |
| 132 | |
| 133 | |
| 134 | Verify Session Persistency After BMC Reboot |
| 135 | [Documentation] Verify session persistency after BMC reboot. |
| 136 | [Tags] Verify_Session_Persistency_After_BMC_Reboot |
| 137 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 138 | # Note the current session location. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 139 | ${session_location}= Redfish.Get Session Location |
| 140 | |
| 141 | Redfish OBMC Reboot (off) stack_mode=normal |
| 142 | Redfish.Login |
| 143 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 144 | # Check for session persistency after BMC reboot. |
| 145 | # sessions here will have list of all sessions location. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 146 | ${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 | |
| 152 | REST 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 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 161 | # Max 200 error logs are allowed in OpenBmc. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 162 | Run Keyword Unless ${-1} < ${log_count} < ${201} Fail |
| 163 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 164 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 165 | *** Keywords *** |
| 166 | |
| 167 | Create 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. |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 175 | # valid_status_code Expected response code, default is ${HTTP_CREATED}. |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 176 | |
| 177 | ${resp}= Redfish.Post /redfish/v1/SessionService/Sessions |
| 178 | ... body={'UserName':'${username}', 'Password': '${password}'} |
| 179 | ... valid_status_codes=[${valid_status_code}] |
| 180 | |
| 181 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 182 | Suite Setup Execution |
| 183 | [Documentation] Suite Setup Execution. |
| 184 | |
| 185 | Redfish.Login |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 186 | Create Users With Different Roles users=${USERS} force=${True} |
Vijay | 3937315 | 2020-02-14 08:08:20 -0600 | [diff] [blame] | 187 | |
| 188 | |
| 189 | Suite Teardown Execution |
| 190 | [Documentation] Suite teardown execution. |
| 191 | |
| 192 | Delete BMC Users Via Redfish users=${USERS} |
| 193 | Redfish.Logout |