Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This module provides general keywords for dump. |
| 3 | |
| 4 | |
| 5 | *** Variables *** |
| 6 | |
| 7 | *** Keywords *** |
| 8 | |
| 9 | Create User Initiated Dump |
| 10 | [Documentation] Generate user initiated dump and return |
| 11 | ... dump id (e.g 1, 2 etc). |
| 12 | |
| 13 | ${data}= Create Dictionary data=@{EMPTY} |
| 14 | ${resp}= OpenBMC Post Request |
| 15 | ... ${DUMP_URI}/action/CreateDump data=${data} |
| 16 | |
| 17 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 18 | ${json}= To JSON ${resp.content} |
| 19 | ${dump_id}= Set Variable ${json["data"]} |
| 20 | |
Rahul Maheshwari | e2cd17f | 2017-09-26 21:26:50 -0500 | [diff] [blame] | 21 | Wait Until Keyword Succeeds 3 min 15 sec Check Dump Existence |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 22 | ... ${dump_id} |
| 23 | |
| 24 | [Return] ${dump_id} |
| 25 | |
| 26 | |
| 27 | Check Dump Existence |
| 28 | [Documentation] Verify if given dump exist. |
| 29 | [Arguments] ${dump_id} |
| 30 | |
| 31 | # Description of Argument(s): |
| 32 | # dump_id An integer value that identifies a particular dump |
| 33 | # object(e.g. 1, 3, 5). |
| 34 | |
| 35 | ${resp}= OpenBMC Get Request ${DUMP_ENTRY_URI}/${dump_id} |
| 36 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 37 | |
| 38 | |
| 39 | Delete BMC Dump |
| 40 | [Documentation] Deletes a given bmc dump. |
| 41 | [Arguments] ${dump_id} |
| 42 | |
| 43 | # Description of Argument(s): |
| 44 | # dump_id An interger value that identifies a particular dump (e.g. 1, 3). |
| 45 | |
| 46 | ${data}= Create Dictionary data=@{EMPTY} |
| 47 | ${resp}= OpenBMC Post Request |
| 48 | ... ${DUMP_ENTRY_URI}/${dump_id}/action/Delete data=${data} |
| 49 | |
| 50 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 51 | |
| 52 | Delete All Dumps |
| 53 | [Documentation] Delete all dumps. |
| 54 | |
| 55 | # Check if dump entries exist, if not return. |
George Keishing | 6a6e76d | 2017-09-14 08:19:17 -0500 | [diff] [blame] | 56 | ${resp}= OpenBMC Get Request ${DUMP_ENTRY_URI}list quiet=${1} |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 57 | Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND} |
| 58 | |
| 59 | # Get the list of dump entries and delete them all. |
| 60 | ${dump_entries}= Get URL List ${DUMP_ENTRY_URI} |
| 61 | :FOR ${entry} IN @{dump_entries} |
| 62 | \ ${dump_id}= Fetch From Right ${entry} / |
| 63 | \ Delete BMC Dump ${dump_id} |
George Keishing | c9fcd09 | 2017-09-20 09:24:37 -0500 | [diff] [blame] | 64 | |
| 65 | |
| 66 | Delete All BMC Dump |
| 67 | [Documentation] Delete all BMC dump entries using "DeleteAll" interface. |
| 68 | |
| 69 | ${data}= Create Dictionary data=@{EMPTY} |
| 70 | ${resp}= Openbmc Post Request ${DUMP_URI}action/DeleteAll data=${data} |
| 71 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |