Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test BMC dump functionality of OpenBMC. |
| 4 | |
| 5 | Resource ../../lib/openbmc_ffdc.robot |
| 6 | Resource ../../lib/dump_utils.robot |
| 7 | |
| 8 | Test Setup Redfish Delete All BMC Dumps |
| 9 | Test Teardown Test Teardown Execution |
| 10 | |
| 11 | |
| 12 | *** Test Cases *** |
| 13 | |
| 14 | Verify User Initiated BMC Dump When Host Powered Off |
| 15 | [Documentation] Create user initiated BMC dump at host off state and |
| 16 | ... verify dump entry for it. |
| 17 | [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off |
| 18 | |
| 19 | Redfish Power Off stack_mode=skip |
| 20 | ${dump_id}= Create User Initiated BMC Dump |
Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 21 | ${dump_entries}= Get BMC Dump Entries |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 22 | Length Should Be ${dump_entries} 1 |
| 23 | List Should Contain Value ${dump_entries} ${dump_id} |
| 24 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 25 | Verify User Initiated BMC Dump When Host Booted |
| 26 | [Documentation] Create user initiated BMC dump at host booted state and |
| 27 | ... verify dump entry for it. |
| 28 | [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted |
| 29 | |
| 30 | Redfish Power On stack_mode=skip |
| 31 | ${dump_id}= Create User Initiated BMC Dump |
Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 32 | ${dump_entries}= Get BMC Dump Entries |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 33 | Length Should Be ${dump_entries} 1 |
| 34 | List Should Contain Value ${dump_entries} ${dump_id} |
| 35 | |
| 36 | |
| 37 | Verify Dump Persistency On Dump Service Restart |
| 38 | [Documentation] Create user dump, restart dump manager service and verify dump |
| 39 | ... persistency. |
| 40 | [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart |
| 41 | |
| 42 | Create User Initiated BMC Dump |
| 43 | ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 44 | |
| 45 | # Restart dump service. |
| 46 | BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service |
| 47 | Sleep 10s reason=Wait for BMC dump service to restart properly |
| 48 | |
| 49 | ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 50 | Lists Should Be Equal ${dump_entries_before} ${dump_entries_after} |
| 51 | |
| 52 | |
| 53 | Verify Dump Persistency On BMC Reset |
| 54 | [Documentation] Create user dump, reset BMC and verify dump persistency. |
| 55 | [Tags] Verify_Dump_Persistency_On_BMC_Reset |
| 56 | |
| 57 | Create User Initiated BMC Dump |
| 58 | ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 59 | |
| 60 | # Reset BMC. |
| 61 | OBMC Reboot (off) |
| 62 | |
| 63 | ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 64 | Lists Should Be Equal ${dump_entries_before} ${dump_entries_after} |
| 65 | |
| 66 | |
Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 67 | Delete User Initiated BMC Dump And Verify |
| 68 | [Documentation] Delete user initiated BMC dump and verify. |
| 69 | [Tags] Delete_User_Initiated_BMC_Dump_And_Verify |
| 70 | |
| 71 | ${dump_id}= Create User Initiated BMC Dump |
| 72 | Redfish Delete BMC Dump ${dump_id} |
| 73 | |
| 74 | ${dump_entries}= Get BMC Dump Entries |
| 75 | Should Be Empty ${dump_entries} |
| 76 | |
| 77 | |
| 78 | Delete All User Initiated BMC Dumps And Verify |
| 79 | [Documentation] Delete all user initiated BMC dumps and verify. |
| 80 | [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify |
| 81 | |
| 82 | # Create some BMC dump. |
| 83 | Create User Initiated BMC Dump |
| 84 | Create User Initiated BMC Dump |
| 85 | |
| 86 | Redfish Delete All BMC Dumps |
| 87 | ${dump_entries}= Get BMC Dump Entries |
| 88 | Should Be Empty ${dump_entries} |
| 89 | |
| 90 | |
Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 91 | Create Two User Initiated BMC Dumps |
| 92 | [Documentation] Create two user initiated BMC dumps. |
| 93 | [Tags] Create_Two_User_Initiated_BMC_Dumps |
| 94 | |
| 95 | ${dump_id1}= Create User Initiated BMC Dump |
| 96 | ${dump_id2}= Create User Initiated BMC Dump |
| 97 | |
| 98 | ${dump_entries}= Get BMC Dump Entries |
| 99 | Length Should Be ${dump_entries} 2 |
| 100 | Should Contain ${dump_entries} ${dump_id1} |
| 101 | Should Contain ${dump_entries} ${dump_id2} |
| 102 | |
| 103 | |
| 104 | Create Two User Initiated BMC Dumps And Delete One |
| 105 | [Documentation] Create two dumps and delete the first. |
| 106 | [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One |
| 107 | |
| 108 | ${dump_id1}= Create User Initiated BMC Dump |
| 109 | ${dump_id2}= Create User Initiated BMC Dump |
| 110 | |
| 111 | Redfish Delete BMC Dump ${dump_id1} |
| 112 | |
| 113 | ${dump_entries}= Get BMC Dump Entries |
| 114 | Length Should Be ${dump_entries} 1 |
| 115 | List Should Contain Value ${dump_entries} ${dump_id2} |
| 116 | |
| 117 | |
| 118 | Create And Delete User Initiated BMC Dump Multiple Times |
| 119 | [Documentation] Create and delete user initiated BMC dump multiple times. |
| 120 | [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times |
| 121 | |
| 122 | FOR ${INDEX} IN 1 10 |
| 123 | ${dump_id}= Create User Initiated BMC Dump |
| 124 | Redfish Delete BMC Dump ${dump_id} |
| 125 | END |
| 126 | |
| 127 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 128 | *** Keywords *** |
| 129 | |
| 130 | Create User Initiated BMC Dump |
| 131 | [Documentation] Generate user initiated BMC dump and return the dump id number (e.g., "5"). |
| 132 | |
| 133 | ${payload}= Create Dictionary DiagnosticDataType=Manager |
| 134 | ${resp}= Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData |
| 135 | ... body=${payload} valid_status_codes=[${HTTP_ACCEPTED}] |
| 136 | |
| 137 | # Example of response from above Redfish POST request. |
| 138 | # "@odata.id": "/redfish/v1/TaskService/Tasks/0", |
| 139 | # "@odata.type": "#Task.v1_4_3.Task", |
| 140 | # "Id": "0", |
| 141 | # "TaskState": "Running", |
| 142 | # "TaskStatus": "OK" |
| 143 | |
| 144 | Wait Until Keyword Succeeds 5 min 15 sec Is Task Completed ${resp.dict['Id']} |
| 145 | ${task_id}= Set Variable ${resp.dict['Id']} |
| 146 | |
| 147 | ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id} |
| 148 | |
| 149 | # Example of HttpHeaders field of task details. |
| 150 | # "Payload": { |
| 151 | # "HttpHeaders": [ |
| 152 | # "Host: <BMC_IP>", |
| 153 | # "Accept-Encoding: identity", |
| 154 | # "Connection: Keep-Alive", |
| 155 | # "Accept: */*", |
| 156 | # "Content-Length: 33", |
| 157 | # "Location: /redfish/v1/Managers/bmc/LogServices/Dump/Entries/2"] |
| 158 | # ], |
| 159 | # "HttpOperation": "POST", |
| 160 | # "JsonBody": "{\"DiagnosticDataType\":\"Manager\"}", |
| 161 | # "TargetUri": "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData" |
| 162 | # } |
| 163 | |
| 164 | [Return] ${task_dict["Payload"]["HttpHeaders"][-1].split("/")[-1]} |
| 165 | |
| 166 | |
Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 167 | Get BMC Dump Entries |
| 168 | [Documentation] Return BMC dump ids list. |
| 169 | |
| 170 | ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 171 | ${dump_ids}= Create List |
| 172 | |
| 173 | FOR ${dump_uri} IN @{dump_uris} |
| 174 | ${dump_id}= Fetch From Right ${dump_uri} / |
| 175 | Append To List ${dump_ids} ${dump_id} |
| 176 | END |
| 177 | |
| 178 | [Return] ${dump_ids} |
| 179 | |
| 180 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 181 | Is Task Completed |
| 182 | [Documentation] Verify if the given task is completed. |
| 183 | [Arguments] ${task_id} |
| 184 | |
| 185 | # Description of argument(s): |
| 186 | # task_id Id of task which needs to be checked. |
| 187 | |
| 188 | ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id} |
| 189 | Should Be Equal As Strings ${task_dict['TaskState']} Completed |
| 190 | |
| 191 | |
| 192 | Test Teardown Execution |
| 193 | [Documentation] Do test teardown operation. |
| 194 | |
| 195 | FFDC On Test Case Fail |
| 196 | Close All Connections |