xref: /openbmc/openbmc-test-automation/redfish/systems/eventlog/test_esel.robot (revision 56fef304e90d540aa7111c2474be120f0ed69bdf)
14840c839SGeorge Keishing*** Settings ***
24840c839SGeorge Keishing
34840c839SGeorge KeishingDocumentation       eSEL's Test cases.
44840c839SGeorge Keishing
54840c839SGeorge KeishingResource            ../../../lib/ipmi_client.robot
64840c839SGeorge KeishingResource            ../../../lib/openbmc_ffdc.robot
74840c839SGeorge KeishingResource            ../../../lib/utils.robot
84840c839SGeorge KeishingResource            ../../../lib/esel_utils.robot
96716d6a8SGeorge KeishingResource            ../../../lib/boot_utils.robot
106716d6a8SGeorge KeishingVariables           ../../../data/variables.py
114840c839SGeorge Keishing
124840c839SGeorge KeishingSuite Setup         Suite Setup Execution
134840c839SGeorge KeishingSuite Teardown      Suite Teardown Execution
146716d6a8SGeorge KeishingTest Setup          Test Setup Execution
154840c839SGeorge KeishingTest Teardown       FFDC On Test Case Fail
164840c839SGeorge Keishing
176fb70d98SMatt FischerTest Tags          eSEL
184840c839SGeorge Keishing
194840c839SGeorge Keishing*** Variables ***
204840c839SGeorge Keishing
214840c839SGeorge Keishing${stack_mode}            skip
224840c839SGeorge Keishing
234840c839SGeorge Keishing${LOGGING_SERVICE}       xyz.openbmc_project.Logging.service
244840c839SGeorge Keishing
254840c839SGeorge Keishing${ESEL_DATA}             ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00
264840c839SGeorge Keishing
27*2a2dbbd1SSridevi Ramesh${IPMI_RAW_PREFIX}       0x3a 0xf0 0x
28*2a2dbbd1SSridevi Ramesh
294840c839SGeorge Keishing*** Test Cases ***
304840c839SGeorge Keishing
316716d6a8SGeorge KeishingVerify eSEL Using Redfish
326716d6a8SGeorge Keishing    [Documentation]  Generate eSEL log and verify using redfish.
336716d6a8SGeorge Keishing    [Tags]  Verify_eSEL_Using_Redfish
344840c839SGeorge Keishing
35*2a2dbbd1SSridevi Ramesh    Create eSEL  ${IPMI_RAW_PREFIX}
366716d6a8SGeorge Keishing    Event Log Should Exist
374840c839SGeorge Keishing
384840c839SGeorge Keishing
396716d6a8SGeorge KeishingVerify eSEL Entries Using Redfish
404840c839SGeorge Keishing    [Documentation]  Verify that eSEL entries have data.
416716d6a8SGeorge Keishing    [Tags]  Verify_eSEL_Entries_Using_Redfish
424840c839SGeorge Keishing
43*2a2dbbd1SSridevi Ramesh    Create eSEL  ${IPMI_RAW_PREFIX}
446716d6a8SGeorge Keishing    Redfish.Login
454840c839SGeorge Keishing    Verify eSEL Entries
464840c839SGeorge Keishing
474840c839SGeorge Keishing
484840c839SGeorge KeishingVerify eSEL Description And EntryID Using REST
494840c839SGeorge Keishing    [Documentation]  Create eSEL log and verify "Description" and "EntryID"
504840c839SGeorge Keishing    ...  are not empty via REST.
514840c839SGeorge Keishing    [Tags]  Verify_eSEL_Description_And_EntryID_Using_REST
524840c839SGeorge Keishing
534840c839SGeorge Keishing    # {
544840c839SGeorge Keishing    # "AdditionalData": [
554840c839SGeorge Keishing    #     "CALLOUT_INVENTORY_PATH=",
564840c839SGeorge Keishing    #     "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00",
574840c839SGeorge Keishing    #     "_PID=1175"
584840c839SGeorge Keishing    # ],
594840c839SGeorge Keishing    # "Description": "An error was detected with the base platform,
604840c839SGeorge Keishing    #  but was not able to be deciphered. Contact your next level of support.",
614840c839SGeorge Keishing    # "EventID": "FQPSPAA0011M",
624840c839SGeorge Keishing    # "Id": 1,
634840c839SGeorge Keishing    # "Message": "org.open_power.Host.Error.Event",
644840c839SGeorge Keishing    # "Resolved": 0,
654840c839SGeorge Keishing    # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
664840c839SGeorge Keishing    # "Timestamp": 1524233022072,
6758520d01SGeorge Keishing    # "Associations": [
684840c839SGeorge Keishing    #    [
694840c839SGeorge Keishing    #        "callout",
704840c839SGeorge Keishing    #        "fault",
714840c839SGeorge Keishing    #        ""
724840c839SGeorge Keishing    #    ]
734840c839SGeorge Keishing    # ]
744840c839SGeorge Keishing
75*2a2dbbd1SSridevi Ramesh    Create eSEL  ${IPMI_RAW_PREFIX}
764840c839SGeorge Keishing
774840c839SGeorge Keishing    ${elog_entry}=  Get URL List  ${BMC_LOGGING_ENTRY}
784840c839SGeorge Keishing    ${desc}=  Read Attribute  ${elog_entry[0]}  Description
794840c839SGeorge Keishing    Should Not Be Empty  ${desc}  msg=${desc} is not populated.
804840c839SGeorge Keishing
814840c839SGeorge Keishing    ${event_id}=  Read Attribute  ${elog_entry[0]}  EventID
824840c839SGeorge Keishing    Should Not Be Equal  ${event_id}  ${None}
834840c839SGeorge Keishing    ...  msg=${event_id} is populated default "None".
844840c839SGeorge Keishing
854840c839SGeorge Keishing
866716d6a8SGeorge KeishingVerify Multiple eSEL Using Redfish
876716d6a8SGeorge Keishing    [Documentation]  Generate multiple eSEL log and verify using redfish
886716d6a8SGeorge Keishing    [Tags]  Verify_Multiple_eSEL_Using_Redfish
894840c839SGeorge Keishing
90*2a2dbbd1SSridevi Ramesh    Create eSEL  ${IPMI_RAW_PREFIX}
914840c839SGeorge Keishing    ${entries}=  Count eSEL Entries
924840c839SGeorge Keishing    Should Be Equal As Integers  ${entries}  ${2}
934840c839SGeorge Keishing    ...  msg=Expecting 2 eSELs but found ${entries}.
944840c839SGeorge Keishing
954840c839SGeorge Keishing
964840c839SGeorge KeishingCheck eSEL AdditionalData
974840c839SGeorge Keishing    [Documentation]  Generate eSEL log and verify AdditionalData is
984840c839SGeorge Keishing    ...              not empty.
994840c839SGeorge Keishing    [Tags]  Check_eSEL_AdditionalData
1004840c839SGeorge Keishing
101*2a2dbbd1SSridevi Ramesh    Create eSEL  ${IPMI_RAW_PREFIX}
1024840c839SGeorge Keishing    ${elog_entry}=  Get URL List  ${BMC_LOGGING_ENTRY}
1034840c839SGeorge Keishing    ${resp}=  OpenBMC Get Request  ${elog_entry[0]}
1044840c839SGeorge Keishing    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK}
1054840c839SGeorge Keishing    # "/xyz/openbmc_project/logging/entry/1": {
1064840c839SGeorge Keishing    #    "Timestamp": 1487743771812,
1074840c839SGeorge Keishing    #    "AdditionalData": [],
1084840c839SGeorge Keishing    #    "Message": "org.open_power.Error.Host.Event.Event",
1094840c839SGeorge Keishing    #    "Id": 1,
1104840c839SGeorge Keishing    #    "Severity": "xyz.openbmc_project.Logging.Entry.Level.Emergency"
1114840c839SGeorge Keishing    # }
112fbd67007SGeorge Keishing    Should Not Be Empty  ${resp.json()["data"]["AdditionalData"]}
1134840c839SGeorge Keishing
1144840c839SGeorge Keishing
1154840c839SGeorge KeishingTest Wrong Reservation_ID
1164840c839SGeorge Keishing    [Documentation]  This testcase is to test BMC can handle multi-requestor's
1174840c839SGeorge Keishing    ...              oem partial add command with incorrect reservation id.
1184840c839SGeorge Keishing    ...              It simulates sending partial add command with fake content
1194840c839SGeorge Keishing    ...              and wrong Reservation ID. This command will be rejected.
1204840c839SGeorge Keishing    [Tags]  Test_Wrong_Reservation_ID
1214840c839SGeorge Keishing
1224840c839SGeorge Keishing    ${rev_id_1}=   Run Inband IPMI Raw Command  0x0a 0x42
1234840c839SGeorge Keishing    ${rev_id_ls}=   Get Substring   ${rev_id_1}   1   3
1244840c839SGeorge Keishing    ${rev_id_ms}=   Get Substring   ${rev_id_1}   -2
1254840c839SGeorge Keishing    Run Inband IPMI Raw Command   0x0a 0x42
1264840c839SGeorge Keishing    ${output}=  Check IPMI OEMpartialadd Reject
127*2a2dbbd1SSridevi Ramesh    ...  ${IPMI_RAW_PREFIX}${rev_id_ls} 0x${rev_id_ms} 0 0 0 0 0 1 2 3 4 5 6 7 8 9 0xa 0xb 0xc 0xd 0xe 0xf
1284840c839SGeorge Keishing    Should Contain   ${output}   Reservation cancelled
1294840c839SGeorge Keishing
1304840c839SGeorge KeishingTest Correct Reservation_ID
1314840c839SGeorge Keishing    [Documentation]  This testcase is to test BMC can handle multi-requestor's
1324840c839SGeorge Keishing    ...              oem partial add command with correct reservation id. It
1334840c839SGeorge Keishing    ...              simulates sending partial add command with fake content
1344840c839SGeorge Keishing    ...              and correct Reservation ID. This command will be accepted.
1354840c839SGeorge Keishing    [Tags]  Test_Correct_Reservation_ID
1364840c839SGeorge Keishing
1374840c839SGeorge Keishing    Run Inband IPMI Raw Command  0x0a 0x42
1384840c839SGeorge Keishing    ${rev_id_2}=    Run Inband IPMI Raw Command  0x0a 0x42
1394840c839SGeorge Keishing    ${rev_id_ls}=   Get Substring   ${rev_id_2}   1   3
1404840c839SGeorge Keishing    ${rev_id_ms}=   Get Substring   ${rev_id_2}   -2
1414840c839SGeorge Keishing    ${output}=  Check IPMI OEMpartialadd Accept
142*2a2dbbd1SSridevi Ramesh    ...  ${IPMI_RAW_PREFIX}${rev_id_ls} 0x${rev_id_ms} 0 0 0 0 0 1 2 3 4 5 6 7 8 9 0xa 0xb 0xc 0xd 0xe 0xf
1434840c839SGeorge Keishing    Should Be Empty    ${output}
1444840c839SGeorge Keishing
1454840c839SGeorge Keishing
1464840c839SGeorge Keishing*** Keywords ***
1474840c839SGeorge Keishing
1484840c839SGeorge Keishing
1494840c839SGeorge KeishingSuite Teardown Execution
1504840c839SGeorge Keishing    [Documentation]  Cleanup test logs and connection.
1514840c839SGeorge Keishing    Close All Connections
1526716d6a8SGeorge Keishing    Redfish.Logout
1534840c839SGeorge Keishing
1544840c839SGeorge Keishing
1554840c839SGeorge KeishingRestart Logging Service
1564840c839SGeorge Keishing    [Documentation]  Restart Logging to clear eSEL log.
1574840c839SGeorge Keishing    ${MainPID}  ${stderr}=  Execute Command
1584840c839SGeorge Keishing    ...  systemctl restart ${LOGGING_SERVICE}  return_stderr=True
1594840c839SGeorge Keishing    Should Be Empty  ${stderr}
1604840c839SGeorge Keishing
1614840c839SGeorge Keishing    Sleep  10s  reason=Wait for service to restart properly.
1624840c839SGeorge Keishing
1634840c839SGeorge Keishing
1644840c839SGeorge KeishingRun IPMI Command Returned
1654840c839SGeorge Keishing    [Documentation]  Run the IPMI command and return the output.
1664840c839SGeorge Keishing    [Arguments]    ${args}
167*2a2dbbd1SSridevi Ramesh
168*2a2dbbd1SSridevi Ramesh    # Description of Argument(s):
169*2a2dbbd1SSridevi Ramesh    # args      IPMI raw data
170*2a2dbbd1SSridevi Ramesh    #           (e.g: 0x00 0x03 0x03).
171*2a2dbbd1SSridevi Ramesh
1724840c839SGeorge Keishing    ${output_1}=    Execute Command   /tmp/ipmitool -I dbus raw ${args}
173409df05dSGeorge Keishing    RETURN    ${output_1}
1744840c839SGeorge Keishing
1754840c839SGeorge Keishing
1764840c839SGeorge KeishingCheck IPMI OEMpartialadd Reject
1774840c839SGeorge Keishing    [Documentation]  Check if IPMI rejects the OEM partial add command.
1784840c839SGeorge Keishing    [Arguments]    ${args}
179*2a2dbbd1SSridevi Ramesh
180*2a2dbbd1SSridevi Ramesh    # Description of Argument(s):
181*2a2dbbd1SSridevi Ramesh    # args      IPMI raw data
182*2a2dbbd1SSridevi Ramesh    #           (e.g: 0x00 0x03 0x03).
183*2a2dbbd1SSridevi Ramesh
1844840c839SGeorge Keishing    Login To OS Host  ${OS_HOST}  ${OS_USERNAME}  ${OS_PASSWORD}
1854840c839SGeorge Keishing    ${stdout}  ${stderr}  ${output_2}=  Execute Command  ipmitool raw ${args}
1864840c839SGeorge Keishing    ...        return_stdout=True  return_stderr=True  return_rc=True
187409df05dSGeorge Keishing    RETURN  ${stderr}
1884840c839SGeorge Keishing
1894840c839SGeorge Keishing
1906716d6a8SGeorge KeishingTest Setup Execution
1916716d6a8SGeorge Keishing   [Documentation]  Do test case setup tasks.
1926716d6a8SGeorge Keishing
1936716d6a8SGeorge Keishing    Redfish.Login
1946716d6a8SGeorge Keishing    Redfish Purge Event Log
1956716d6a8SGeorge Keishing
1966716d6a8SGeorge Keishing
1974840c839SGeorge KeishingSuite Setup Execution
1984840c839SGeorge Keishing    [Documentation]  Validates input parameters & check if HOST OS is up.
1994840c839SGeorge Keishing
2004840c839SGeorge Keishing    Should Not Be Empty
2014840c839SGeorge Keishing    ...   ${OS_HOST}  msg=You must provide DNS name/IP of the OS host.
2024840c839SGeorge Keishing    Should Not Be Empty
2034840c839SGeorge Keishing    ...   ${OS_USERNAME}  msg=You must provide OS host user name.
2044840c839SGeorge Keishing    Should Not Be Empty
2054840c839SGeorge Keishing    ...   ${OS_PASSWORD}  msg=You must provide OS host user password.
2064840c839SGeorge Keishing
2074840c839SGeorge Keishing    # Boot to OS.
2086716d6a8SGeorge Keishing    Redfish Power On
2096716d6a8SGeorge Keishing
2106716d6a8SGeorge Keishing    Redfish.Login
2116716d6a8SGeorge Keishing    Redfish Purge Event Log
2124840c839SGeorge Keishing
2134840c839SGeorge Keishing    Login To OS Host  ${OS_HOST}  ${OS_USERNAME}  ${OS_PASSWORD}
2144840c839SGeorge Keishing    Open Connection And Log In
2154840c839SGeorge Keishing
2164840c839SGeorge Keishing
2174840c839SGeorge KeishingCheck IPMI OEMpartialadd Accept
2184840c839SGeorge Keishing    [Documentation]  Check if IPMI accepts the OEM partial add command.
2194840c839SGeorge Keishing    [Arguments]    ${args}
220*2a2dbbd1SSridevi Ramesh
221*2a2dbbd1SSridevi Ramesh    # Description of Argument(s):
222*2a2dbbd1SSridevi Ramesh    # args      IPMI raw data
223*2a2dbbd1SSridevi Ramesh    #           (e.g: 0x00 0x03 0x03).
224*2a2dbbd1SSridevi Ramesh
2254840c839SGeorge Keishing    Login To OS Host  ${OS_HOST}  ${OS_USERNAME}  ${OS_PASSWORD}
2264840c839SGeorge Keishing    ${stdout}  ${stderr}  ${output_3}=  Execute Command  ipmitool raw ${args}
2274840c839SGeorge Keishing    ...         return_stdout=True  return_stderr=True  return_rc=True
2284840c839SGeorge Keishing    Should Be Equal  ${output_3}  ${0}  msg=${stderr}
229409df05dSGeorge Keishing    RETURN  ${stderr}
2306716d6a8SGeorge Keishing
2316716d6a8SGeorge Keishing
2326716d6a8SGeorge KeishingEvent Log Should Exist
2336716d6a8SGeorge Keishing    [Documentation]  Event log entries should exist.
2346716d6a8SGeorge Keishing
2356716d6a8SGeorge Keishing    ${elogs}=  Get Event Logs
2366716d6a8SGeorge Keishing    Should Not Be Empty  ${elogs}  msg=System event log entry is not empty.
237