1*** Settings ***
2Documentation       BMC server health, collect eSELs.
3
4# Test Parameters:
5# OPENBMC_HOST      The BMC host name or IP address.
6
7Resource            ../../lib/bmc_redfish_resource.robot
8Resource            ../../lib/openbmc_ffdc.robot
9
10Suite Setup         Suite Setup Execution
11Suite Teardown      Suite Teardown Execution
12Test Setup          Printn
13
14*** Variables ***
15${QUIET}                       ${1}
16${error_logs_flagged_rest}     Rest error log collection excluded
17${event_logs_flagged_redfish}  Redfish event log collection excluded
18${rest_error_logs}             Rest error log collection excluded
19${redfish_event_logs}          Redfish error log collection excluded
20
21*** Test Cases ***
22
23Rest Collect eSELs
24    [Documentation]  Collect eSEL using the OpenBMC Rest API.
25    [Tags]  Rest_Collect_eSELs  rest
26    [Teardown]  FFDC On Test Case Fail
27
28    ${error_logs}=  Get Error Logs  ${QUIET}
29    ${rest_error_logs}=  gen_robot_print.Sprint Vars  error_logs
30    Set Suite Variable  ${rest_error_logs}
31    Log To Console  ${rest_error_logs}
32
33    # Filter out informational error logs.
34    ${non_informational_error_logs}=  Filter Struct  ${error_logs}  [('Severity', '\.Informational$')]
35    ...  regex=1  invert=1
36    ${error_logs_flagged_rest}=  gen_robot_print.Sprint Vars  non_informational_error_logs
37    Set Suite Variable  ${error_logs_flagged_rest}
38
39
40Redfish Collect eSELs
41    [Documentation]  Collect eSEL with Redfish.
42    [Tags]  Redfish_Collect_eSELs  redfish
43    [Setup]  Redfish.Login
44    [Teardown]  Redfish Test Teardown Execution
45
46    ${redfish_event_logs}=  Get Event Logs
47    ${redfish_event_logs}=  gen_robot_print.Sprint Vars  redfish_event_logs
48    Set Suite Variable  ${redfish_event_logs}
49    Log To Console  ${redfish_event_logs}
50    ${event_logs_flagged_redfish}=  Get Event Logs Not Ok
51    ${event_logs_flagged_redfish}=  gen_robot_print.Sprint Vars  event_logs_flagged_redfish
52    Set Suite Variable  ${event_logs_flagged_redfish}
53
54
55*** Keywords ***
56
57Suite Setup Execution
58    [Documentation]  Do test suite setup tasks.
59
60    Set Log Level  DEBUG
61    REST Power On  stack_mode=skip
62
63
64Suite Teardown Execution
65    [Documentation]  Do suite teardown tasks. Log error and event logs collected.
66
67    Log Many  ${rest_error_logs}  ${redfish_event_logs}
68    Log  Flagged error logs found via REST:${\n}${error_logs_flagged_rest}  console=true
69    Log  Flagged events logs found via Redfish:${\n}${event_logs_flagged_redfish}  console=true
70
71
72Redfish Test Teardown Execution
73    [Documentation]  Do the post test teardown for redfish.
74
75    Redfish.Logout
76    FFDC On Test Case Fail
77