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 | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 11 | Suite Teardown Redfish.Logout |
| 12 | Test Setup Printn |
| 13 | Test Teardown FFDC On Test Case Fail |
| 14 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 15 | *** Variables *** |
| 16 | @{ADMIN} admin_user TestPwd123 |
| 17 | @{OPERATOR} operator_user TestPwd123 |
| 18 | &{USERS} Administrator=${ADMIN} Operator=${OPERATOR} |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 19 | |
| 20 | *** Test Cases *** |
| 21 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 22 | Create Session And Verify Response Code Using Different Credentials |
| 23 | [Documentation] Create session and verify response code using different credentials. |
| 24 | [Tags] Create_Session_And_Verify_Response_Code_Using_Different_Credentails |
| 25 | [Template] Create Session And Verify Response Code |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 26 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 27 | # username password valid_status_code |
| 28 | ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} ${HTTP_CREATED} |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 29 | r00t ${OPENBMC_PASSWORD} ${HTTP_UNAUTHORIZED} |
| 30 | ${OPENBMC_USERNAME} password ${HTTP_UNAUTHORIZED} |
| 31 | r00t password ${HTTP_UNAUTHORIZED} |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 32 | admin_user TestPwd123 ${HTTP_CREATED} |
| 33 | operator_user TestPwd123 ${HTTP_CREATED} |
Vijay | 53a0055 | 2020-01-08 04:24:47 -0600 | [diff] [blame] | 34 | |
| 35 | |
| 36 | Verify SessionService Defaults |
| 37 | [Documentation] Verify SessionService default property values. |
| 38 | [Tags] Verify_SessionService_Defaults |
| 39 | |
| 40 | ${session_service}= Redfish.Get Properties /redfish/v1/SessionService |
| 41 | Rprint Vars session_service |
| 42 | |
| 43 | Valid Value session_service['@odata.context'] ['/redfish/v1/$metadata#SessionService.SessionService'] |
| 44 | Valid Value session_service['@odata.id'] ['/redfish/v1/SessionService/'] |
| 45 | Valid Value session_service['Description'] ['Session Service'] |
| 46 | Valid Value session_service['Id'] ['SessionService'] |
| 47 | Valid Value session_service['Name'] ['Session Service'] |
| 48 | Valid Value session_service['ServiceEnabled'] [True] |
| 49 | Valid Value session_service['SessionTimeout'] [3600] |
| 50 | Valid Value session_service['Sessions']['@odata.id'] ['/redfish/v1/SessionService/Sessions'] |
| 51 | |
| 52 | |
| 53 | Verify Sessions Defaults |
| 54 | [Documentation] Verify Sessions default property values. |
| 55 | [Tags] Verify_Sessions_Defaults |
| 56 | |
| 57 | ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions |
| 58 | Rprint Vars sessions |
| 59 | ${sessions_count}= Get length ${sessions['Members']} |
| 60 | |
| 61 | Valid Value sessions['@odata.context'] ['/redfish/v1/$metadata#SessionCollection.SessionCollection'] |
| 62 | Valid Value sessions['@odata.id'] ['/redfish/v1/SessionService/Sessions/'] |
| 63 | Valid Value sessions['Description'] ['Session Collection'] |
| 64 | Valid Value sessions['Name'] ['Session Collection'] |
| 65 | Valid Value sessions['Members@odata.count'] [${sessions_count}] |
| 66 | |
| 67 | |
| 68 | Verify Current Session Defaults |
| 69 | [Documentation] Verify Current session default property values. |
| 70 | [Tags] Verify_Current_Session_Defaults |
| 71 | |
| 72 | ${session_location}= Redfish.Get Session Location |
| 73 | ${session_id}= Evaluate os.path.basename($session_location) modules=os |
| 74 | ${session_properties}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_id} |
| 75 | Rprint Vars session_location session_id session_properties |
| 76 | |
| 77 | Valid Value session_properties['@odata.context'] ['/redfish/v1/$metadata#Session.Session'] |
| 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 | |
| 93 | Valid Value managers['@odata.context'] ['/redfish/v1/$metadata#ManagerCollection.ManagerCollection'] |
| 94 | Valid Value managers['Name'] ['Manager Collection'] |
| 95 | Valid Value managers['@odata.id'] ['/redfish/v1/Managers'] |
| 96 | Valid Value managers['Members@odata.count'] [${managers_count}] |
| 97 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 98 | # Members can be one or more, hence checking in the list. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 99 | Valid List managers['Members'] required_values=[{'@odata.id': '/redfish/v1/Managers/bmc'}] |
| 100 | |
| 101 | |
| 102 | Verify Chassis Defaults |
| 103 | [Documentation] Verify chassis defaults. |
| 104 | [Tags] Verify_Chassis_Defaults |
| 105 | |
| 106 | ${chassis}= Redfish.Get Properties /redfish/v1/Chassis |
| 107 | Rprint Vars chassis |
| 108 | ${chassis_count}= Get Length ${chassis['Members']} |
| 109 | |
| 110 | Valid Value chassis['@odata.context'] ['/redfish/v1/$metadata#ChassisCollection.ChassisCollection'] |
| 111 | Valid Value chassis['Name'] ['Chassis Collection'] |
| 112 | Valid Value chassis['@odata.id'] ['/redfish/v1/Chassis'] |
| 113 | Valid Value chassis['Members@odata.count'] [${chassis_count}] |
| 114 | Valid Value chassis['Members@odata.count'] [${chassis_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 chassis['Members'] |
| 118 | ... required_values=[{'@odata.id': '/redfish/v1/Chassis/chassis'}] |
| 119 | |
| 120 | |
| 121 | Verify Systems Defaults |
| 122 | [Documentation] Verify systems defaults. |
| 123 | [Tags] Verify_Systems_Defaults |
| 124 | |
| 125 | ${systems}= Redfish.Get Properties /redfish/v1/Systems |
| 126 | Rprint Vars systems |
| 127 | ${systems_count}= Get Length ${systems['Members']} |
| 128 | |
| 129 | Valid Value systems['@odata.context'] |
| 130 | ... ['/redfish/v1/$metadata#ComputerSystemCollection.ComputerSystemCollection'] |
| 131 | Valid Value systems['Name'] ['Computer System Collection'] |
| 132 | Valid Value systems['@odata.id'] ['/redfish/v1/Systems'] |
| 133 | Valid Value systems['Members@odata.count'] [${systems_count}] |
| 134 | Valid Value systems['Members@odata.count'] [${systems_count}] |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 135 | # Members can be one or more, hence checking in the list. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 136 | Valid List systems['Members'] required_values=[{'@odata.id': '/redfish/v1/Systems/system'}] |
| 137 | |
| 138 | |
| 139 | Verify Session Persistency After BMC Reboot |
| 140 | [Documentation] Verify session persistency after BMC reboot. |
| 141 | [Tags] Verify_Session_Persistency_After_BMC_Reboot |
| 142 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 143 | # Note the current session location. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 144 | ${session_location}= Redfish.Get Session Location |
| 145 | |
| 146 | Redfish OBMC Reboot (off) stack_mode=normal |
| 147 | Redfish.Login |
| 148 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 149 | # Check for session persistency after BMC reboot. |
| 150 | # sessions here will have list of all sessions location. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 151 | ${sessions}= Redfish.Get Attribute /redfish/v1/SessionService/Sessions Members |
| 152 | ${payload}= Create Dictionary @odata.id=${session_location} |
| 153 | |
| 154 | List Should Contain Value ${sessions} ${payload} |
| 155 | |
| 156 | |
| 157 | REST Logging Interface Read Should Be A SUCCESS For Authorized Users |
| 158 | [Documentation] REST logging interface read should be a success for authorized users. |
| 159 | [Tags] REST_Logging_Interface_Read_Should_Be_A_SUCCESS_For_Authorized_Users |
| 160 | |
| 161 | ${resp}= Redfish.Get /xyz/openbmc_project/logging |
| 162 | |
| 163 | ${resp_output}= evaluate json.loads('''${resp.text}''') json |
| 164 | ${log_count}= Get Length ${resp_output["data"]} |
| 165 | |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 166 | # Max 200 error logs are allowed in OpenBmc. |
Vijay | 5b2f779 | 2020-01-14 04:18:32 -0600 | [diff] [blame] | 167 | Run Keyword Unless ${-1} < ${log_count} < ${201} Fail |
| 168 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 169 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 170 | *** Keywords *** |
| 171 | |
| 172 | Create Session And Verify Response Code |
| 173 | [Documentation] Create session and verify response code. |
| 174 | [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD} |
| 175 | ... ${valid_status_code}=${HTTP_CREATED} |
| 176 | |
| 177 | # Description of argument(s): |
| 178 | # username The username to create a session. |
| 179 | # password The password to create a session. |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 180 | # valid_status_code Expected response code, default is ${HTTP_CREATED}. |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 181 | |
| 182 | ${resp}= Redfish.Post /redfish/v1/SessionService/Sessions |
| 183 | ... body={'UserName':'${username}', 'Password': '${password}'} |
| 184 | ... valid_status_codes=[${valid_status_code}] |
| 185 | |
| 186 | |
Vijay | e6fa855 | 2020-01-14 04:44:36 -0600 | [diff] [blame] | 187 | Suite Setup Execution |
| 188 | [Documentation] Suite Setup Execution. |
| 189 | |
| 190 | Redfish.Login |
Vijay | ff2c0bc | 2020-02-03 00:05:45 -0600 | [diff] [blame] | 191 | Create Users With Different Roles users=${USERS} force=${True} |