blob: 02754b076029c11b451a180704032a504b972353 [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
51*** Keywords ***
52
53Verify logging-test
54 [Documentation] Verify existence of prerequisite logging-test.
55
56 Open Connection And Log In
57 ${out} ${stderr}= Execute Command which logging-test return_stderr=True
58 Should Be Empty ${stderr}
59 Should Contain ${out} logging-test
60
61Clear Existing Error Logs
62 [Documentation] If error log isn't empty, reboot the BMC to clear the log.
63
64 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
65 Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
66 Initiate BMC Reboot
67 Wait Until Keyword Succeeds 10 min 10 sec
68 ... Is BMC Ready
69 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
70 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
71
72Create Test Error Log
73 [Documentation] Generate test error log.
74
75 # Test error log entry example:
76 # "/xyz/openbmc_project/logging/entry/1": {
77 # "AdditionalData": [
78 # "STRING=FOO"
79 # ],
80 # "Id": 1,
81 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
82 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
83 # "Timestamp": 1487743963328,
84 # "associations": []
85 # }
86
87 Execute Command On BMC logging-test -c AutoTestSimple
88
89Verify Test Error Log
90 [Documentation] Verify test error log entries.
91 ${content}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Message
92 Should Be Equal ${content}
93 ... example.xyz.openbmc_project.Example.Elog.AutoTestSimple
94 ${content}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Severity
95 Should Be Equal ${content}
96 ... xyz.openbmc_project.Logging.Entry.Level.Error