blob: c9db34e4f49adc6e908b8256476718b6c53eb7dc [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2
George Keishing505d5b42017-02-21 11:01:54 -06003Documentation eSEL's Test cases.
Chris Austenb29d2e82016-06-07 12:25:35 -05004
George Keishing505d5b42017-02-21 11:01:54 -06005Resource ../lib/ipmi_client.robot
6Resource ../lib/openbmc_ffdc.robot
7Variables ../data/variables.py
Chris Austenb29d2e82016-06-07 12:25:35 -05008
George Keishing505d5b42017-02-21 11:01:54 -06009Suite Setup Open Connection And Log In
George Keishing616c2782017-02-23 13:04:04 -060010Suite Teardown Test Cleanup On Exit
George Keishing505d5b42017-02-21 11:01:54 -060011Test Teardown FFDC On Test Case Fail
12
13Force Tags eSEL_Logging
14
15*** Variables ***
16
17${RESERVE_ID} raw 0x0a 0x42
18${RAW_PREFIX} raw 0x32 0xf0 0x
19
20${RAW_SUFFIX} 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x00
21... 0xdf 0x00 0x00 0x00 0x00 0x20 0x00 0x04 0x12 0x35 0x6f 0xaa 0x00 0x00
22
23${RAW_SEL_COMMIT} raw 0x0a 0x44 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x20
24... 0x00 0x04 0x12 0x35 0x6f 0x02 0x00 0x01
25
26${LOGGING_SERVICE} xyz.openbmc_project.Logging.service
Chris Austenb29d2e82016-06-07 12:25:35 -050027
George Keishing616c2782017-02-23 13:04:04 -060028${ESEL_DATA} ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00
29
Chris Austenb29d2e82016-06-07 12:25:35 -050030*** Test Cases ***
31
George Keishing505d5b42017-02-21 11:01:54 -060032Verify eSEL Using REST
George Keishing616c2782017-02-23 13:04:04 -060033 [Documentation] Generate eSEL log and verify using REST.
George Keishing505d5b42017-02-21 11:01:54 -060034 [setup] Restart Logging Service
35 [Tags] Verify_eSEL_Using_REST
36
George Keishing616c2782017-02-23 13:04:04 -060037 # Prior eSEL log shouldn't exist.
George Keishing505d5b42017-02-21 11:01:54 -060038 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
39 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
George Keishing616c2782017-02-23 13:04:04 -060040 Create eSEL
George Keishing505d5b42017-02-21 11:01:54 -060041 # New eSEL log should exist
42 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
43 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
44
45
George Keishing616c2782017-02-23 13:04:04 -060046Verify eSEL Entries Using REST
47 [Documentation] Verify that eSEL entries have data.
48 [setup] Restart Logging Service
49 [Tags] Verify_eSEL_Entries_Using_REST
50 Create eSEL
51 Verify eSEL Entries
52
53
54Verify Multiple eSEL Using REST
55 [Documentation] Generate multiple eSEL log and Verify using REST.
56 [setup] Restart Logging Service
57 [Tags] Verify_Multiple_eSEL_Using_REST
58 Create eSEL
59 Create eSEL
60 ${entries}= Count eSEL Entries
61 Should Be Equal As Integers ${entries} ${2}
62
63
Chris Austenb29d2e82016-06-07 12:25:35 -050064Test Wrong Reservation_ID
George Keishingcac24c72016-09-23 04:44:19 -050065 [Documentation] This testcase is to test BMC can handle multi-requestor's
66 ... oem partial add command with incorrect reservation id.
67 ... It simulates sending partial add command with fake content
68 ... and wrong Reservation ID. This command will be rejected.
69 [Tags] Test_Wrong_Reservation_ID
Gunnar Mills56b32892016-11-14 13:56:17 -060070
Gunnar Mills1cd544d2016-12-06 11:19:22 -060071 ${rev_id_1}= Run IPMI Command Returned 0x0a 0x42
72 ${rev_id_ls}= Get Substring ${rev_id_1} 1 3
73 ${rev_id_ms}= Get Substring ${rev_id_1} -2
Chris Austenb29d2e82016-06-07 12:25:35 -050074 Run IPMI command 0x0a 0x42
Gunnar Mills1cd544d2016-12-06 11:19:22 -060075 ${output}= Check IPMI Oempartialadd Reject 0x32 0xf0 0x${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
Chris Austenb29d2e82016-06-07 12:25:35 -050076 Should Contain ${output} Reservation cancelled
77
78Test Correct Reservation_ID
George Keishingcac24c72016-09-23 04:44:19 -050079 [Documentation] This testcase is to test BMC can handle multi-requestor's
80 ... oem partial add command with correct reservation id. It
81 ... simulates sending partial add command with fake content
82 ... and correct Reservation ID. This command will be accepted.
83 [Tags] Test_Correct_Reservation_ID
Gunnar Mills56b32892016-11-14 13:56:17 -060084
Chris Austenb29d2e82016-06-07 12:25:35 -050085 Run IPMI command 0x0a 0x42
Gunnar Mills1cd544d2016-12-06 11:19:22 -060086 ${rev_id_2}= Run IPMI Command Returned 0x0a 0x42
87 ${rev_id_ls}= Get Substring ${rev_id_2} 1 3
88 ${rev_id_ms}= Get Substring ${rev_id_2} -2
89 ${output}= Check IPMI Oempartialadd Accept 0x32 0xf0 0x${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
Chris Austenb29d2e82016-06-07 12:25:35 -050090 Should Be Empty ${output}
91
92Clear Test File
93 [Documentation] Clear /tmp/esel
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060094 [Tags] Clear_Test_File
Gunnar Mills56b32892016-11-14 13:56:17 -060095
Chris Austenb29d2e82016-06-07 12:25:35 -050096 Execute Command rm /tmp/esel
97 Execute Command sync
98
99*** Keywords ***
100
George Keishing616c2782017-02-23 13:04:04 -0600101Create eSEL
102 [Documentation] Create an eSEL.
103 Open Connection And Log In
104 ${Resv_id}= Run Dbus IPMI Standard Command ${RESERVE_ID}
105 ${cmd}= Catenate
106 ... ${RAW_PREFIX}${Resv_id.strip().rsplit(' ', 1)[0]} ${RAW_SUFFIX}
107 Run Dbus IPMI Standard Command ${cmd}
108 Run Dbus IPMI Standard Command ${RAW_SEL_COMMIT}
109
110
111Count eSEL Entries
112 [Documentation] Count eSEL entries logged.
113 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}
114 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
115 ${jsondata}= To JSON ${resp.content}
116 ${count}= Get Length ${jsondata["data"]}
117 [Return] ${count}
118
119
120Verify eSEL Entries
121 [Documentation] Verify eSEL entries logged.
122 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
123 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
124 ${jsondata}= To JSON ${resp.content}
125 # "data": {
126 # "AdditionalData": [
127 # "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00 "
128 # ],
129 # "Id": 1,
130 # "Message": "org.open_power.Error.Host.Event.Event",
131 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Emergency",
132 # "Timestamp": 1485904869061
133 # }
134
135 Should Be Equal As Integers ${jsondata["data"]["Id"]} ${1}
136 Should Be Equal As Strings
137 ... ${jsondata["data"]["AdditionalData"][0].rstrip()} ${ESEL_DATA}
138
139
140Test Cleanup On Exit
141 [Documentation] Cleanup test logs and connection.
142 Restart Logging Service
143 Close All Connections
144
145
George Keishing505d5b42017-02-21 11:01:54 -0600146Restart Logging Service
147 [Documentation] Restart Logging to clear eSEL log.
148 ${MainPID} ${stderr}= Execute Command
149 ... systemctl restart ${LOGGING_SERVICE} return_stderr=True
150 Should Be Empty ${stderr}
151
152 Sleep 10s reason=Wait for service to restart properly.
153
Chris Austenb29d2e82016-06-07 12:25:35 -0500154Run IPMI Command Returned
Gunnar Mills38032802016-12-12 13:43:40 -0600155 [Arguments] ${args}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600156 ${output_1}= Execute Command /tmp/ipmitool -I dbus raw ${args}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600157 [Return] ${output_1}
Chris Austenb29d2e82016-06-07 12:25:35 -0500158
159Check IPMI Oempartialadd Reject
Gunnar Mills38032802016-12-12 13:43:40 -0600160 [Arguments] ${args}
Chris Austenb29d2e82016-06-07 12:25:35 -0500161 ${stdout} ${stderr} ${output_2}= Execute Command /tmp/ipmitool -I dbus raw ${args} return_stdout=True return_stderr= True return_rc=True
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600162 [Return] ${stderr}
Chris Austenb29d2e82016-06-07 12:25:35 -0500163
164Check IPMI Oempartialadd Accept
Gunnar Mills38032802016-12-12 13:43:40 -0600165 [Arguments] ${args}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600166 ${stdout} ${stderr} ${output_3}= Execute Command /tmp/ipmitool -I dbus raw ${args} return_stdout=True return_stderr= True return_rc=True
Chris Austenb29d2e82016-06-07 12:25:35 -0500167 Should Be Equal ${output_3} ${0} msg=${stderr}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600168 [Return] ${stderr}
Chris Austenb29d2e82016-06-07 12:25:35 -0500169