xref: /openbmc/openbmc-test-automation/redfish/systems/eventlog/test_esel.robot (revision 6ba6b22f371ca82aadeca7b2eec6d59955fbe7e3)
1*** Settings ***
2
3Documentation       eSEL's Test cases.
4
5Resource            ../../../lib/ipmi_client.robot
6Resource            ../../../lib/openbmc_ffdc.robot
7Resource            ../../../lib/utils.robot
8Resource            ../../../lib/boot_utils.robot
9Resource            ../../../lib/esel_utils.robot
10Resource            ../../../lib/boot_utils.robot
11Variables           ../../../data/variables.py
12
13Suite Setup         Suite Setup Execution
14Suite Teardown      Suite Teardown Execution
15Test Setup          Test Setup Execution
16Test Teardown       FFDC On Test Case Fail
17
18Test Tags          eSEL
19
20*** Variables ***
21
22${stack_mode}            skip
23
24${LOGGING_SERVICE}       xyz.openbmc_project.Logging.service
25
26${ESEL_DATA}             ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00
27
28${IPMI_RAW_PREFIX}       0x3a 0xf0 0x
29
30*** Test Cases ***
31
32Verify eSEL Using Redfish
33    [Documentation]  Generate eSEL log and verify using redfish.
34    [Tags]  Verify_eSEL_Using_Redfish
35
36    Create eSEL  ${IPMI_RAW_PREFIX}
37    Event Log Should Exist
38
39
40Verify eSEL Entries Using Redfish
41    [Documentation]  Verify that eSEL entries have data.
42    [Tags]  Verify_eSEL_Entries_Using_Redfish
43
44    Create eSEL  ${IPMI_RAW_PREFIX}
45    Redfish.Login
46    Verify eSEL Entries
47
48
49Verify eSEL Description And EntryID Using REST
50    [Documentation]  Create eSEL log and verify "Description" and "EntryID"
51    ...  are not empty via REST.
52    [Tags]  Verify_eSEL_Description_And_EntryID_Using_REST
53
54    # {
55    # "AdditionalData": [
56    #     "CALLOUT_INVENTORY_PATH=",
57    #     "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00",
58    #     "_PID=1175"
59    # ],
60    # "Description": "An error was detected with the base platform,
61    #  but was not able to be deciphered. Contact your next level of support.",
62    # "EventID": "FQPSPAA0011M",
63    # "Id": 1,
64    # "Message": "org.open_power.Host.Error.Event",
65    # "Resolved": 0,
66    # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
67    # "Timestamp": 1524233022072,
68    # "Associations": [
69    #    [
70    #        "callout",
71    #        "fault",
72    #        ""
73    #    ]
74    # ]
75
76    Create eSEL  ${IPMI_RAW_PREFIX}
77
78    ${elog_entry}=  Get URL List  ${BMC_LOGGING_ENTRY}
79    ${desc}=  Read Attribute  ${elog_entry[0]}  Description
80    Should Not Be Empty  ${desc}  msg=${desc} is not populated.
81
82    ${event_id}=  Read Attribute  ${elog_entry[0]}  EventID
83    Should Not Be Equal  ${event_id}  ${None}
84    ...  msg=${event_id} is populated default "None".
85
86
87Verify Multiple eSEL Using Redfish
88    [Documentation]  Generate multiple eSEL log and verify using redfish
89    [Tags]  Verify_Multiple_eSEL_Using_Redfish
90
91    Create eSEL  ${IPMI_RAW_PREFIX}
92    ${entries}=  Count eSEL Entries
93    Should Be Equal As Integers  ${entries}  ${2}
94    ...  msg=Expecting 2 eSELs but found ${entries}.
95
96
97Check eSEL AdditionalData
98    [Documentation]  Generate eSEL log and verify AdditionalData is
99    ...              not empty.
100    [Tags]  Check_eSEL_AdditionalData
101
102    Create eSEL  ${IPMI_RAW_PREFIX}
103    ${elog_entry}=  Get URL List  ${BMC_LOGGING_ENTRY}
104    ${resp}=  OpenBMC Get Request  ${elog_entry[0]}
105    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK}
106    # "/xyz/openbmc_project/logging/entry/1": {
107    #    "Timestamp": 1487743771812,
108    #    "AdditionalData": [],
109    #    "Message": "org.open_power.Error.Host.Event.Event",
110    #    "Id": 1,
111    #    "Severity": "xyz.openbmc_project.Logging.Entry.Level.Emergency"
112    # }
113    Should Not Be Empty  ${resp.json()["data"]["AdditionalData"]}
114
115
116Test Wrong Reservation_ID
117    [Documentation]  This testcase is to test BMC can handle multi-requestor's
118    ...              oem partial add command with incorrect reservation id.
119    ...              It simulates sending partial add command with fake content
120    ...              and wrong Reservation ID. This command will be rejected.
121    [Tags]  Test_Wrong_Reservation_ID
122
123    ${rev_id_1}=   Run Inband IPMI Raw Command  0x0a 0x42
124    ${rev_id_ls}=   Get Substring   ${rev_id_1}   1   3
125    ${rev_id_ms}=   Get Substring   ${rev_id_1}   -2
126    Run Inband IPMI Raw Command   0x0a 0x42
127    ${output}=  Check IPMI OEMpartialadd Reject
128    ...  ${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
129    Should Contain   ${output}   Reservation cancelled
130
131Test Correct Reservation_ID
132    [Documentation]  This testcase is to test BMC can handle multi-requestor's
133    ...              oem partial add command with correct reservation id. It
134    ...              simulates sending partial add command with fake content
135    ...              and correct Reservation ID. This command will be accepted.
136    [Tags]  Test_Correct_Reservation_ID
137
138    Run Inband IPMI Raw Command  0x0a 0x42
139    ${rev_id_2}=    Run Inband IPMI Raw Command  0x0a 0x42
140    ${rev_id_ls}=   Get Substring   ${rev_id_2}   1   3
141    ${rev_id_ms}=   Get Substring   ${rev_id_2}   -2
142    ${output}=  Check IPMI OEMpartialadd Accept
143    ...  ${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
144    Should Be Empty    ${output}
145
146
147*** Keywords ***
148
149
150Suite Teardown Execution
151    [Documentation]  Cleanup test logs and connection.
152    Close All Connections
153    Redfish.Logout
154
155
156Restart Logging Service
157    [Documentation]  Restart Logging to clear eSEL log.
158    ${MainPID}  ${stderr}=  Execute Command
159    ...  systemctl restart ${LOGGING_SERVICE}  return_stderr=True
160    Should Be Empty  ${stderr}
161
162    Sleep  10s  reason=Wait for service to restart properly.
163
164
165Run IPMI Command Returned
166    [Documentation]  Run the IPMI command and return the output.
167    [Arguments]    ${args}
168
169    # Description of Argument(s):
170    # args      IPMI raw data
171    #           (e.g: 0x00 0x03 0x03).
172
173    ${output_1}=    Execute Command   /tmp/ipmitool -I dbus raw ${args}
174    RETURN    ${output_1}
175
176
177Check IPMI OEMpartialadd Reject
178    [Documentation]  Check if IPMI rejects the OEM partial add command.
179    [Arguments]    ${args}
180
181    # Description of Argument(s):
182    # args      IPMI raw data
183    #           (e.g: 0x00 0x03 0x03).
184
185    Login To OS Host  ${OS_HOST}  ${OS_USERNAME}  ${OS_PASSWORD}
186    ${stdout}  ${stderr}  ${output_2}=  Execute Command  ipmitool raw ${args}
187    ...        return_stdout=True  return_stderr=True  return_rc=True
188    RETURN  ${stderr}
189
190
191Test Setup Execution
192   [Documentation]  Do test case setup tasks.
193
194    Redfish.Login
195    Redfish Purge Event Log
196
197
198Suite Setup Execution
199    [Documentation]  Validates input parameters & check if HOST OS is up.
200
201    Should Not Be Empty
202    ...   ${OS_HOST}  msg=You must provide DNS name/IP of the OS host.
203    Should Not Be Empty
204    ...   ${OS_USERNAME}  msg=You must provide OS host user name.
205    Should Not Be Empty
206    ...   ${OS_PASSWORD}  msg=You must provide OS host user password.
207
208    # Boot to OS.
209    Redfish Power On
210
211    Redfish.Login
212    Redfish Purge Event Log
213
214    Login To OS Host  ${OS_HOST}  ${OS_USERNAME}  ${OS_PASSWORD}
215    Open Connection And Log In
216
217
218Check IPMI OEMpartialadd Accept
219    [Documentation]  Check if IPMI accepts the OEM partial add command.
220    [Arguments]    ${args}
221
222    # Description of Argument(s):
223    # args      IPMI raw data
224    #           (e.g: 0x00 0x03 0x03).
225
226    Login To OS Host  ${OS_HOST}  ${OS_USERNAME}  ${OS_PASSWORD}
227    ${stdout}  ${stderr}  ${output_3}=  Execute Command  ipmitool raw ${args}
228    ...         return_stdout=True  return_stderr=True  return_rc=True
229    Should Be Equal  ${output_3}  ${0}  msg=${stderr}
230    RETURN  ${stderr}
231
232
233Event Log Should Exist
234    [Documentation]  Event log entries should exist.
235
236    ${elogs}=  Get Event Logs
237    Should Not Be Empty  ${elogs}  msg=System event log entry is not empty.
238