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