1*** Settings ***
2Documentation   This suite is to run some test at the end of execution.
3
4Resource        ../lib/resource.robot
5Resource        ../lib/bmc_redfish_resource.robot
6Resource        ../lib/openbmc_ffdc.robot
7
8Test Teardown   Test Teardown Execution
9
10*** Variables ***
11
12# Error strings to check from journald.
13${ERROR_REGEX}     SEGV|core-dump|FAILURE|Failed to start|Found ordering cycle
14${SKIP_ERROR}      ${EMPTY}
15
16
17*** Test Cases ***
18
19Verify No BMC Dump And Application Failures In BMC
20    [Documentation]  Verify no BMC dump and application failure exists in BMC.
21    [Tags]  Verify_No_BMC_Dump_And_Application_Failures_In_BMC
22
23    # Check dump entry based on Redfish API availability.
24    Redfish.Login
25    ${resp}=  Redfish.Get  /redfish/v1/Managers/bmc/LogServices/Dump/Entries
26    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
27
28    Log To Console  ${resp}
29
30    Run Keyword If  '${resp.status}' == '${HTTP_OK}'
31    ...  Should Be Equal As Strings  ${resp.dict["Members@odata.count"]}  0
32    ...  msg=${resp.dict["Members@odata.count"]} dumps exist.
33
34    ${rest_resp}=  Run Keyword If  '${resp.status}' == '${HTTP_NOT_FOUND}'
35    ...  Check For REST Dumps
36
37    Check For Regex In Journald  ${ERROR_REGEX}  error_check=${0}  boot=-b  filter_string=${SKIP_ERROR}
38
39
40*** Keywords ***
41
42Check For REST Dumps
43    [Documentation]  Verify no BMC dump via REST path.
44
45    ${rest_resp}=  Redfish.Get  /xyz/openbmc_project/dump/bmc/entry/list
46    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
47
48    Log To Console  ${rest_resp}
49
50    Should Be Equal As Strings  ${rest_resp.status}  ${HTTP_NOT_FOUND}
51    ...  msg=1 or more dumps exist.
52
53
54Test Teardown Execution
55    [Documentation]  Do test teardown operation.
56
57    FFDC On Test Case Fail
58    # Remove rm command  once the BMC dump APIs are working.
59    Run Keyword And Ignore Error  BMC Execute Command  rm -rf /var/lib/phosphor-debug-collector/dumps/
60    Run Keyword And Ignore Error  Delete All BMC Dump
61    Run Keyword And Ignore Error  Redfish Delete All BMC Dumps
62    Run Keyword And Ignore Error  Redfish Delete All System Dumps
63