Michael Tritz | 935c18e | 2017-03-08 11:45:41 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test Error logging. |
| 3 | |
| 4 | Resource ../lib/connection_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
| 6 | Resource ../lib/utils.robot |
| 7 | Resource ../lib/state_manager.robot |
| 8 | |
| 9 | Suite Setup Run Keywords Verify logging-test AND |
| 10 | ... Clear Existing Error Logs |
| 11 | Test Setup Open Connection And Log In |
| 12 | Test Teardown Close All Connections |
| 13 | Suite Teardown Clear Existing Error Logs |
| 14 | |
| 15 | *** Test Cases *** |
| 16 | |
| 17 | Create 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 | |
| 25 | Test 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 | |
| 38 | Test 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 Keishing | 04bc481 | 2017-03-30 03:33:31 -0500 | [diff] [blame] | 51 | Create 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 | |
| 81 | Create 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 |
Sweta Potthuri | 9ce8eeb | 2017-05-08 04:20:11 -0500 | [diff] [blame] | 116 | Should Be True ${time_stamp2} > ${time_stamp1} |
George Keishing | 04bc481 | 2017-03-30 03:33:31 -0500 | [diff] [blame] | 117 | |
Sweta Potthuri | 9ce8eeb | 2017-05-08 04:20:11 -0500 | [diff] [blame] | 118 | Create Test Error Log And Delete |
| 119 | [Documentation] Create an error log and delete it. |
| 120 | [Tags] Create_Test_Error_Log_And_Delete |
| 121 | |
| 122 | Delete Error Logs And Verify |
| 123 | Create Test Error Log |
| 124 | Delete Error Logs And Verify |
| 125 | |
| 126 | Create Multiple Test Error Logs And Delete All |
| 127 | [Documentation] Create multiple error logs and delete all. |
| 128 | [Tags] Create_Multiple_Test_Error_Logs_And_Delete_All |
| 129 | |
| 130 | Delete Error Logs And Verify |
| 131 | Create Test Error Log |
| 132 | Create Test Error Log |
| 133 | Create Test Error Log |
| 134 | Delete Error Logs And Verify |
| 135 | |
| 136 | Create Two Test Error Logs And Delete One |
| 137 | [Documentation] Create two error logs and delete the first entry. |
| 138 | [Tags] Create_Two_Test_Error_Logs_And_Delete_One |
| 139 | |
| 140 | Delete Error Logs And Verify |
| 141 | Create Test Error Log |
| 142 | ${entry_id}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Id |
| 143 | Create Test Error Log |
| 144 | Delete Error log Entry ${BMC_LOGGING_ENTRY}/${entry_id} |
| 145 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/${entry_id} |
| 146 | Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 147 | Delete Error Logs And Verify |
George Keishing | 04bc481 | 2017-03-30 03:33:31 -0500 | [diff] [blame] | 148 | |
Michael Tritz | 935c18e | 2017-03-08 11:45:41 -0600 | [diff] [blame] | 149 | *** Keywords *** |
| 150 | |
| 151 | Verify logging-test |
| 152 | [Documentation] Verify existence of prerequisite logging-test. |
| 153 | |
| 154 | Open Connection And Log In |
| 155 | ${out} ${stderr}= Execute Command which logging-test return_stderr=True |
| 156 | Should Be Empty ${stderr} |
| 157 | Should Contain ${out} logging-test |
| 158 | |
| 159 | Clear Existing Error Logs |
| 160 | [Documentation] If error log isn't empty, reboot the BMC to clear the log. |
| 161 | |
| 162 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1} |
| 163 | Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND} |
| 164 | Initiate BMC Reboot |
| 165 | Wait Until Keyword Succeeds 10 min 10 sec |
| 166 | ... Is BMC Ready |
| 167 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1} |
| 168 | Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 169 | |
| 170 | Create Test Error Log |
| 171 | [Documentation] Generate test error log. |
| 172 | |
| 173 | # Test error log entry example: |
| 174 | # "/xyz/openbmc_project/logging/entry/1": { |
| 175 | # "AdditionalData": [ |
| 176 | # "STRING=FOO" |
| 177 | # ], |
| 178 | # "Id": 1, |
| 179 | # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple", |
| 180 | # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error", |
| 181 | # "Timestamp": 1487743963328, |
| 182 | # "associations": [] |
| 183 | # } |
| 184 | |
| 185 | Execute Command On BMC logging-test -c AutoTestSimple |
| 186 | |
| 187 | Verify Test Error Log |
| 188 | [Documentation] Verify test error log entries. |
Sweta Potthuri | 9ce8eeb | 2017-05-08 04:20:11 -0500 | [diff] [blame] | 189 | ${entry_id}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Message |
| 190 | Should Be Equal ${entry_id} |
Michael Tritz | 935c18e | 2017-03-08 11:45:41 -0600 | [diff] [blame] | 191 | ... example.xyz.openbmc_project.Example.Elog.AutoTestSimple |
Sweta Potthuri | 9ce8eeb | 2017-05-08 04:20:11 -0500 | [diff] [blame] | 192 | ${entry_id}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Severity |
| 193 | Should Be Equal ${entry_id} |
Michael Tritz | 935c18e | 2017-03-08 11:45:41 -0600 | [diff] [blame] | 194 | ... xyz.openbmc_project.Logging.Entry.Level.Error |
George Keishing | 04bc481 | 2017-03-30 03:33:31 -0500 | [diff] [blame] | 195 | |
Sweta Potthuri | 9ce8eeb | 2017-05-08 04:20:11 -0500 | [diff] [blame] | 196 | Delete Error Logs And Verify |
| 197 | [Documentation] Delete all error logs and verify. |
| 198 | |
| 199 | Delete Error logs |
| 200 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/list |
| 201 | Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND} |