1*** Settings ***
2
3Documentation    Module to test IPMI SEL functionality.
4Resource         ../lib/ipmi_client.robot
5Resource         ../lib/openbmc_ffdc.robot
6Variables        ../data/ipmi_raw_cmd_table.py
7
8Test Teardown    FFDC On Test Case Fail
9
10*** Variables ***
11
12${sensor_number}      0x17
13
14
15*** Test Cases ***
16
17Verify IPMI SEL Version
18    [Documentation]  Verify IPMI SEL's version info.
19    [Tags]  Verify_IPMI_SEL_Version
20    ${version_info}=  Get IPMI SEL Setting  Version
21    ${setting_status}=  Fetch From Left  ${version_info}  (
22    ${setting_status}=  Evaluate  $setting_status.replace(' ','')
23
24    Should Be True  ${setting_status} >= 1.5
25    Should Contain  ${version_info}  v2 compliant  case_insensitive=True
26
27
28Verify Empty SEL
29    [Documentation]  Verify empty SEL list.
30    [Tags]  Verify_Empty_SEL
31
32    Run IPMI Standard Command  sel clear
33    Sleep  5s
34
35    ${resp}=  Run IPMI Standard Command  sel list
36    Should Contain  ${resp}  SEL has no entries  case_insensitive=True
37
38
39Verify Add SEL Entry
40    [Documentation]  Verify add SEL entry.
41    [Tags]  Verify_Add_SEL_Entry
42    [Teardown]  Run Keywords  FFDC On Test Case Fail  AND  Run IPMI Standard Command  sel clear
43
44    Run IPMI Standard Command  sel clear
45    Sleep  5s
46
47    # The IPMI raw command to generate Temp sensor  error is no longer working.
48    # Our aim is to check if the SEL command is listed in IPMI or not.
49    # Original keyword "Create SEL" for reference
50    Create Test PEL Log
51
52    # Get last SEL entry.
53    ${resp}=  Run IPMI Standard Command  sel elist last 1
54    #  output:
55    #  1 | 11/17/2021 | 07:49:20 | System Event #0x01 | Undetermined system hardware failure | Asserted
56    Run Keywords  Should Contain  ${resp}  system hardware failure  AND
57    ...  Should Contain  ${resp}  Asserted  msg=Add SEL Entry failed.
58
59
60Verify Reserve SEL
61    [Documentation]  Verify reserve SEL.
62    [Tags]  Verify_Reserve_SEL
63
64    ${resp}=  Run IPMI Standard Command
65    ...  raw ${IPMI_RAW_CMD['SEL_entry']['Reserve'][0]}
66    ${reserve_id}=  Split String  ${resp}
67
68    # Execute clear SEL raw command with Reservation ID.
69    # Command will not execute unless the correct Reservation ID value is provided.
70    Run IPMI Standard Command
71    ...  raw 0x0a 0x47 0x${reserve_id[0]} 0x${reserve_id[1]} 0x43 0x4c 0x52 0xaa
72
73
74*** Keywords ***
75
76Create SEL
77    [Documentation]  Create a SEL.
78
79    # Create a SEL.
80    # Example:
81    # a | 02/14/2020 | 01:16:58 | Temperature #0x17 |  | Asserted
82    Run IPMI Command
83    ...  0x0a 0x44 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x04 0x01 ${sensor_number} 0x00 0xa0 0x04 0x07
84