blob: 6c657f5e737504e5ba83df8b76608fcbc9138919 [file] [log] [blame]
Michael Tritz935c18e2017-03-08 11:45:41 -06001*** Settings ***
2Documentation Test Error logging.
3
4Resource ../lib/connection_client.robot
5Resource ../lib/openbmc_ffdc.robot
6Resource ../lib/utils.robot
7Resource ../lib/state_manager.robot
8
9Suite Setup Run Keywords Verify logging-test AND
10... Clear Existing Error Logs
11Test Setup Open Connection And Log In
12Test Teardown Close All Connections
13Suite Teardown Clear Existing Error Logs
14
15*** Test Cases ***
16
17Create Test Error And Verify
18 [Documentation] Create error logs and verify via REST.
19 [Tags] Create_Test_Error_And_Verify
20
21 Create Test Error Log
22 Verify Test Error Log
23
24
25Test Error Persistency On Restart
26 [Documentation] Restart logging service and verify error logs don't exist.
27 [Tags] Test_Error_Persistency_On_Restart
28
29 Create Test Error Log
30 Verify Test Error Log
31 Execute Command On BMC
32 ... systemctl restart xyz.openbmc_project.Logging.service
33 Sleep 10s reason=Wait for logging service to restart properly.
34 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
35 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
36
37
38Test Error Persistency On Reboot
39 [Documentation] Reboot BMC and verify error logs don't exist.
40 [Tags] Test_Error_Persistency_On_Reboot
41
42 Create Test Error Log
43 Verify Test Error Log
44 Initiate BMC Reboot
45 Wait Until Keyword Succeeds 10 min 10 sec
46 ... Is BMC Ready
47 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
48 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
49
50
George Keishing04bc4812017-03-30 03:33:31 -050051Create Test Error And Verify Resolved Field
52 [Documentation] Create error log and verify "Resolved"
53 ... field is 0.
54 [Tags] Create_Test_Error_And_Verify_Resolved_Field
55
56 # Example Error log:
57 # "/xyz/openbmc_project/logging/entry/1": {
58 # "AdditionalData": [
59 # "STRING=FOO"
60 # ],
61 # "Id": 1,
62 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
63 # "Resolved": 0,
64 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
65 # "Timestamp": 1490817164983,
66 # "associations": []
67 # },
68
69 # It's work in progress, but it's mnfg need. To mark an error as
70 # resolved, without deleting the error, mfg will set this bool
71 # property.
72 # In this test context we are making sure "Resolved" field is "0"
73 # by default.
74
75 Delete Error logs
76 Create Test Error Log
77 ${resolved}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Resolved
78 Should Be True ${resolved} == 0
79
80
81Create Test Errors And Verify Time Stamp
82 [Documentation] Create error logs and verify time stamp.
83 [Tags] Create_Test_Error_And_Verify_Time_Stamp
84
85 # Example Error logs:
86 # "/xyz/openbmc_project/logging/entry/1": {
87 # "AdditionalData": [
88 # "STRING=FOO"
89 # ],
90 # "Id": 1,
91 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
92 # "Resolved": 0,
93 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
94 # "Timestamp": 1490818990051, <--- Time stamp
95 # "associations": []
96 # },
97 # "/xyz/openbmc_project/logging/entry/2": {
98 # "AdditionalData": [
99 # "STRING=FOO"
100 # ],
101 # "Id": 2,
102 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
103 # "Resolved": 0,
104 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
105 # "Timestamp": 1490818992116, <---- Time stamp
106 # "associations": []
107 # },
108
109 Delete Error logs
110 Create Test Error Log
111 Create Test Error Log
112 # The error log generated is associated with the epoc time and unique
113 # for every error and in increasing time stamp.
114 ${time_stamp1}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Timestamp
115 ${time_stamp2}= Read Attribute ${BMC_LOGGING_ENTRY}${2} Timestamp
116 Should Be True ${time_stamp2} > ${time_stamp1}
117
118
Michael Tritz935c18e2017-03-08 11:45:41 -0600119*** Keywords ***
120
121Verify logging-test
122 [Documentation] Verify existence of prerequisite logging-test.
123
124 Open Connection And Log In
125 ${out} ${stderr}= Execute Command which logging-test return_stderr=True
126 Should Be Empty ${stderr}
127 Should Contain ${out} logging-test
128
129Clear Existing Error Logs
130 [Documentation] If error log isn't empty, reboot the BMC to clear the log.
131
132 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
133 Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
134 Initiate BMC Reboot
135 Wait Until Keyword Succeeds 10 min 10 sec
136 ... Is BMC Ready
137 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
138 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
139
140Create Test Error Log
141 [Documentation] Generate test error log.
142
143 # Test error log entry example:
144 # "/xyz/openbmc_project/logging/entry/1": {
145 # "AdditionalData": [
146 # "STRING=FOO"
147 # ],
148 # "Id": 1,
149 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
150 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
151 # "Timestamp": 1487743963328,
152 # "associations": []
153 # }
154
155 Execute Command On BMC logging-test -c AutoTestSimple
156
157Verify Test Error Log
158 [Documentation] Verify test error log entries.
159 ${content}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Message
160 Should Be Equal ${content}
161 ... example.xyz.openbmc_project.Example.Elog.AutoTestSimple
162 ${content}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Severity
163 Should Be Equal ${content}
164 ... xyz.openbmc_project.Logging.Entry.Level.Error
George Keishing04bc4812017-03-30 03:33:31 -0500165