| 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 |  | 
| Rahul Maheshwari | 953038b | 2017-10-17 05:08:59 -0500 | [diff] [blame^] | 27 | Verify No Dump In Progress | 
 | 28 |     [Documentation]  Verify no dump in progress. | 
 | 29 |  | 
 | 30 |     ${dump_progress}  ${stderr}  ${rc}=  BMC Execute Command | 
 | 31 |     ...  [ -d /tmp/obmcdump* ] && echo 'In Progress' || echo 'No Progress' | 
 | 32 |  | 
 | 33 |     Should Be Equal As Strings  ${dump_progress}  No Progress | 
 | 34 |  | 
 | 35 |  | 
| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 36 | Check Dump Existence | 
 | 37 |     [Documentation]  Verify if given dump exist. | 
 | 38 |     [Arguments]  ${dump_id} | 
 | 39 |  | 
 | 40 |     # Description of Argument(s): | 
 | 41 |     # dump_id  An integer value that identifies a particular dump | 
 | 42 |     #          object(e.g. 1, 3, 5). | 
 | 43 |  | 
 | 44 |     ${resp}=  OpenBMC Get Request  ${DUMP_ENTRY_URI}/${dump_id} | 
 | 45 |     Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK} | 
 | 46 |  | 
 | 47 |  | 
 | 48 | Delete BMC Dump | 
 | 49 |     [Documentation]  Deletes a given bmc dump. | 
 | 50 |     [Arguments]  ${dump_id} | 
 | 51 |  | 
 | 52 |     # Description of Argument(s): | 
 | 53 |     # dump_id  An interger value that identifies a particular dump (e.g. 1, 3). | 
 | 54 |  | 
 | 55 |     ${data}=  Create Dictionary  data=@{EMPTY} | 
 | 56 |     ${resp}=  OpenBMC Post Request | 
 | 57 |     ...  ${DUMP_ENTRY_URI}/${dump_id}/action/Delete  data=${data} | 
 | 58 |  | 
 | 59 |     Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK} | 
 | 60 |  | 
 | 61 | Delete All Dumps | 
 | 62 |     [Documentation]  Delete all dumps. | 
 | 63 |  | 
 | 64 |     # Check if dump entries exist, if not return. | 
| George Keishing | 6a6e76d | 2017-09-14 08:19:17 -0500 | [diff] [blame] | 65 |     ${resp}=  OpenBMC Get Request  ${DUMP_ENTRY_URI}list  quiet=${1} | 
| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 66 |     Return From Keyword If  ${resp.status_code} == ${HTTP_NOT_FOUND} | 
 | 67 |  | 
 | 68 |     # Get the list of dump entries and delete them all. | 
 | 69 |     ${dump_entries}=  Get URL List  ${DUMP_ENTRY_URI} | 
 | 70 |     :FOR  ${entry}  IN  @{dump_entries} | 
 | 71 |     \  ${dump_id}=  Fetch From Right  ${entry}  / | 
 | 72 |     \  Delete BMC Dump  ${dump_id} | 
| George Keishing | c9fcd09 | 2017-09-20 09:24:37 -0500 | [diff] [blame] | 73 |  | 
 | 74 |  | 
 | 75 | Delete All BMC Dump | 
 | 76 |     [Documentation]  Delete all BMC dump entries using "DeleteAll" interface. | 
 | 77 |  | 
 | 78 |     ${data}=  Create Dictionary  data=@{EMPTY} | 
 | 79 |     ${resp}=  Openbmc Post Request  ${DUMP_URI}action/DeleteAll  data=${data} | 
 | 80 |     Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK} |