blob: 860719534d1a7ba5d69a2500a3cad8156f57537c [file] [log] [blame]
Rahul Maheshwariad676bf2017-06-22 15:06:05 -05001*** Settings ***
2Documentation This module provides general keywords for dump.
3
4
5*** Variables ***
6
7*** Keywords ***
8
9Create 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}
George Keishing73c4ebf2017-11-13 07:10:28 -060019
20 # REST "CreateDump" JSON response.
21 # {
22 # "data": null,
23 # "message": "200 OK",
24 # "status": "ok"
25 # }
26 Run Keyword If ${json["data"]} == ${None}
27 ... Fail Dump id returned null.
28
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050029 ${dump_id}= Set Variable ${json["data"]}
30
Rahul Maheshwarie2cd17f2017-09-26 21:26:50 -050031 Wait Until Keyword Succeeds 3 min 15 sec Check Dump Existence
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050032 ... ${dump_id}
33
34 [Return] ${dump_id}
35
36
Rahul Maheshwari953038b2017-10-17 05:08:59 -050037Verify No Dump In Progress
38 [Documentation] Verify no dump in progress.
39
Rahul Maheshwari4cfdc392017-10-25 09:44:47 -050040 ${dump_progress} ${stderr} ${rc}= BMC Execute Command ls /tmp
41 Should Not Contain ${dump_progress} obmcdump
Rahul Maheshwari953038b2017-10-17 05:08:59 -050042
43
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050044Check Dump Existence
45 [Documentation] Verify if given dump exist.
46 [Arguments] ${dump_id}
47
48 # Description of Argument(s):
49 # dump_id An integer value that identifies a particular dump
50 # object(e.g. 1, 3, 5).
51
52 ${resp}= OpenBMC Get Request ${DUMP_ENTRY_URI}/${dump_id}
53 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
54
55
56Delete BMC Dump
57 [Documentation] Deletes a given bmc dump.
58 [Arguments] ${dump_id}
59
60 # Description of Argument(s):
Gunnar Mills28e403b2017-10-25 16:16:38 -050061 # dump_id An integer value that identifies a particular dump (e.g. 1, 3).
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050062
63 ${data}= Create Dictionary data=@{EMPTY}
64 ${resp}= OpenBMC Post Request
65 ... ${DUMP_ENTRY_URI}/${dump_id}/action/Delete data=${data}
66
67 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
68
69Delete All Dumps
70 [Documentation] Delete all dumps.
71
72 # Check if dump entries exist, if not return.
George Keishing6a6e76d2017-09-14 08:19:17 -050073 ${resp}= OpenBMC Get Request ${DUMP_ENTRY_URI}list quiet=${1}
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050074 Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
75
76 # Get the list of dump entries and delete them all.
77 ${dump_entries}= Get URL List ${DUMP_ENTRY_URI}
78 :FOR ${entry} IN @{dump_entries}
79 \ ${dump_id}= Fetch From Right ${entry} /
80 \ Delete BMC Dump ${dump_id}
George Keishingc9fcd092017-09-20 09:24:37 -050081
82
83Delete All BMC Dump
84 [Documentation] Delete all BMC dump entries using "DeleteAll" interface.
85
86 ${data}= Create Dictionary data=@{EMPTY}
87 ${resp}= Openbmc Post Request ${DUMP_URI}action/DeleteAll data=${data}
88 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
George Keishingdc428762017-11-11 12:37:12 -060089
George Keishingdc428762017-11-11 12:37:12 -060090Dump Should Not Exist
91 [Documentation] Verify that BMC dumps do not exist.
92
93 ${resp}= OpenBMC Get Request ${DUMP_ENTRY_URI}/list quiet=${1}
94 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
95
Sivas SRR7aabd792017-10-18 21:28:23 -050096Check Existence of BMC Dump file
97 [Documentation] Verify existence of BMC dump file.
98 [Arguments] ${dump_id}
99
100 # Description of argument(s):
101 # dump_id BMC dump identifier
102
103 ${dump_check_cmd}= Set Variable
104 ... ls /var/lib/phosphor-debug-collector/dumps
105
106 # Output of sample BMC Execute command with '2' as dump id is as follows
107 # ls /var/lib/phosphor-debug-collector/dumps/2
108 # obmcdump_2_XXXXXXXXXX.tar.xz
109 ${file_there} ${stderr} ${rc}= BMC Execute Command
110 ... ${dump_check_cmd}/${dump_id}
111 Should End With ${file_there} tar.xz msg=BMC dump file not found.