18cca7fb8SGeorge Keishing*** Settings *** 28cca7fb8SGeorge KeishingDocumentation Inventory of hardware resources under systems. 38cca7fb8SGeorge Keishing 48cca7fb8SGeorge KeishingResource ../../../lib/bmc_redfish_resource.robot 58cca7fb8SGeorge KeishingResource ../../../lib/bmc_redfish_utils.robot 68cca7fb8SGeorge KeishingResource ../../../lib/logging_utils.robot 78cca7fb8SGeorge KeishingResource ../../../lib/openbmc_ffdc.robot 88fe6024eSGeorge KeishingResource ../../../lib/ipmi_client.robot 9759c6f97SGeorge KeishingLibrary ../../../lib/logging_utils.py 108cca7fb8SGeorge Keishing 112f36947bSGeorge KeishingSuite Setup Suite Setup Execution 122f36947bSGeorge KeishingSuite Teardown Suite Teardown Execution 13b0a491f2SGeorge KeishingTest Setup Test Setup Execution 148cca7fb8SGeorge KeishingTest Teardown Test Teardown Execution 158cca7fb8SGeorge Keishing 16759c6f97SGeorge Keishing** Variables *** 17759c6f97SGeorge Keishing 18759c6f97SGeorge Keishing${max_num_event_logs} ${200} 19759c6f97SGeorge Keishing 208cca7fb8SGeorge Keishing*** Test Cases *** 218cca7fb8SGeorge Keishing 228cca7fb8SGeorge KeishingEvent Log Check After BMC Reboot 238cca7fb8SGeorge Keishing [Documentation] Check event log after BMC rebooted. 248cca7fb8SGeorge Keishing [Tags] Event_Log_Check_After_BMC_Reboot 258cca7fb8SGeorge Keishing 268cca7fb8SGeorge Keishing Redfish Purge Event Log 278cca7fb8SGeorge Keishing Event Log Should Not Exist 288cca7fb8SGeorge Keishing 298cca7fb8SGeorge Keishing Redfish OBMC Reboot (off) 308cca7fb8SGeorge Keishing 318cca7fb8SGeorge Keishing Redfish.Login 328cca7fb8SGeorge Keishing Wait Until Keyword Succeeds 1 mins 15 secs Redfish.Get ${EVENT_LOG_URI}Entries 338cca7fb8SGeorge Keishing 348cca7fb8SGeorge Keishing Event Log Should Not Exist 358cca7fb8SGeorge Keishing 368cca7fb8SGeorge Keishing 37b0a491f2SGeorge KeishingEvent Log Check After Host Poweron 38b0a491f2SGeorge Keishing [Documentation] Check event log after host has booted. 39b0a491f2SGeorge Keishing [Tags] Event_Log_Check_After_Host_Poweron 40b0a491f2SGeorge Keishing 41b0a491f2SGeorge Keishing Redfish Purge Event Log 42b0a491f2SGeorge Keishing Event Log Should Not Exist 43b0a491f2SGeorge Keishing 44b0a491f2SGeorge Keishing Redfish Power On 45b0a491f2SGeorge Keishing 46b0a491f2SGeorge Keishing Redfish.Login 47b0a491f2SGeorge Keishing Event Log Should Not Exist 48b0a491f2SGeorge Keishing 49b0a491f2SGeorge Keishing 50b0a491f2SGeorge KeishingCreate Test Event Log And Verify 51b0a491f2SGeorge Keishing [Documentation] Create event logs and verify via redfish. 52b0a491f2SGeorge Keishing [Tags] Create_Test_Event_Log_And_Verify 53b0a491f2SGeorge Keishing 54b0a491f2SGeorge Keishing Create Test Error Log 55b0a491f2SGeorge Keishing Event Log Should Exist 56b0a491f2SGeorge Keishing 57b0a491f2SGeorge Keishing 5820c08e41SRahul MaheshwariDelete Redfish Event Log And Verify 5920c08e41SRahul Maheshwari [Documentation] Delete Redfish event log and verify via Redfish. 6020c08e41SRahul Maheshwari [Tags] Delete_Redfish_Event_Log_And_Verify 6120c08e41SRahul Maheshwari 6220c08e41SRahul Maheshwari Redfish.Login 6320c08e41SRahul Maheshwari Redfish Purge Event Log 6420c08e41SRahul Maheshwari Create Test PEL Log 6520c08e41SRahul Maheshwari ${elog_entry}= Get Event Logs 6620c08e41SRahul Maheshwari 6720c08e41SRahul Maheshwari Redfish.Delete /redfish/v1/Systems/system/LogServices/EventLog/Entries/${elog_entry[0]["Id"]} 6820c08e41SRahul Maheshwari 6920c08e41SRahul Maheshwari ${error_entries}= Get Redfish Error Entries 7020c08e41SRahul Maheshwari Should Be Empty ${error_entries} 7120c08e41SRahul Maheshwari 7220c08e41SRahul Maheshwari 73b0a491f2SGeorge KeishingTest Event Log Persistency On Restart 74b0a491f2SGeorge Keishing [Documentation] Restart logging service and verify event logs. 75b0a491f2SGeorge Keishing [Tags] Test_Event_Log_Persistency_On_Restart 76b0a491f2SGeorge Keishing 77b0a491f2SGeorge Keishing Create Test Error Log 78b0a491f2SGeorge Keishing Event Log Should Exist 79b0a491f2SGeorge Keishing 80b0a491f2SGeorge Keishing BMC Execute Command 81b0a491f2SGeorge Keishing ... systemctl restart xyz.openbmc_project.Logging.service 82b0a491f2SGeorge Keishing Sleep 10s reason=Wait for logging service to restart properly. 83b0a491f2SGeorge Keishing 84b0a491f2SGeorge Keishing Event Log Should Exist 85b0a491f2SGeorge Keishing 86b0a491f2SGeorge Keishing 87b0a491f2SGeorge KeishingTest Event Entry Numbering Reset On Restart 88b0a491f2SGeorge Keishing [Documentation] Restart logging service and verify event logs entry starts 89b0a491f2SGeorge Keishing ... from entry "Id" 1. 90b0a491f2SGeorge Keishing [Tags] Test_Event_Entry_Numbering_Reset_On_Restart 9120560f9cSRahul Maheshwari [Setup] Redfish Power Off stack_mode=skip 92b0a491f2SGeorge Keishing 93b0a491f2SGeorge Keishing #{ 94b0a491f2SGeorge Keishing # "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection", 95b0a491f2SGeorge Keishing # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries", 96b0a491f2SGeorge Keishing # "@odata.type": "#LogEntryCollection.LogEntryCollection", 97b0a491f2SGeorge Keishing # "Description": "Collection of System Event Log Entries", 98b0a491f2SGeorge Keishing # "Members": [ 99b0a491f2SGeorge Keishing # { 100b0a491f2SGeorge Keishing # "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry", 101b0a491f2SGeorge Keishing # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1", 102b0a491f2SGeorge Keishing # "@odata.type": "#LogEntry.v1_4_0.LogEntry", 103b0a491f2SGeorge Keishing # "Created": "2019-05-29T13:19:27+00:00", 104b0a491f2SGeorge Keishing # "EntryType": "Event", 105b0a491f2SGeorge Keishing # "Id": "1", <----- Event log ID 106b0a491f2SGeorge Keishing # "Message": "org.open_power.Host.Error.Event", 107b0a491f2SGeorge Keishing # "Name": "System DBus Event Log Entry", 108b0a491f2SGeorge Keishing # "Severity": "Critical" 109b0a491f2SGeorge Keishing # } 110b0a491f2SGeorge Keishing # ], 111b0a491f2SGeorge Keishing # "Members@odata.count": 1, 112b0a491f2SGeorge Keishing # "Name": "System Event Log Entries" 113b0a491f2SGeorge Keishing #} 114b0a491f2SGeorge Keishing 11520560f9cSRahul Maheshwari Create Test PEL Log 11620560f9cSRahul Maheshwari Create Test PEL Log 117b0a491f2SGeorge Keishing Event Log Should Exist 118b0a491f2SGeorge Keishing 119b0a491f2SGeorge Keishing Redfish Purge Event Log 120b0a491f2SGeorge Keishing Event Log Should Not Exist 121b0a491f2SGeorge Keishing 122b0a491f2SGeorge Keishing BMC Execute Command 123b0a491f2SGeorge Keishing ... systemctl restart xyz.openbmc_project.Logging.service 124b0a491f2SGeorge Keishing Sleep 10s reason=Wait for logging service to restart properly. 125b0a491f2SGeorge Keishing 12620560f9cSRahul Maheshwari Create Test PEL Log 127b0a491f2SGeorge Keishing ${elogs}= Get Event Logs 12820560f9cSRahul Maheshwari Should Be Equal ${elogs[0]["Id"]} 1 msg=Event log entry is not 1 129b0a491f2SGeorge Keishing 130b0a491f2SGeorge Keishing 131b0a491f2SGeorge KeishingTest Event Log Persistency On Reboot 132b0a491f2SGeorge Keishing [Documentation] Reboot BMC and verify event log. 133b0a491f2SGeorge Keishing [Tags] Test_Event_Log_Persistency_On_Reboot 134b0a491f2SGeorge Keishing 135b0a491f2SGeorge Keishing Redfish Purge Event Log 136b0a491f2SGeorge Keishing Create Test Error Log 137b0a491f2SGeorge Keishing Event Log Should Exist 138b0a491f2SGeorge Keishing 139b0a491f2SGeorge Keishing Redfish OBMC Reboot (off) 140b0a491f2SGeorge Keishing 141b0a491f2SGeorge Keishing Redfish.Login 142b0a491f2SGeorge Keishing Wait Until Keyword Succeeds 1 mins 15 secs Redfish.Get ${EVENT_LOG_URI}Entries 143b0a491f2SGeorge Keishing 144b0a491f2SGeorge Keishing Event Log Should Exist 145b0a491f2SGeorge Keishing 146b0a491f2SGeorge Keishing 147148d08c2SGeorge KeishingCreate Test Event Log And Verify Time Stamp 148148d08c2SGeorge Keishing [Documentation] Create event logs and verify time stamp. 149148d08c2SGeorge Keishing [Tags] Create_Test_Event_Log_And_Verify_Time_Stamp 150148d08c2SGeorge Keishing 151148d08c2SGeorge Keishing #{ 152148d08c2SGeorge Keishing # "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection", 153148d08c2SGeorge Keishing # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries", 154148d08c2SGeorge Keishing # "@odata.type": "#LogEntryCollection.LogEntryCollection", 155148d08c2SGeorge Keishing # "Description": "Collection of System Event Log Entries", 156148d08c2SGeorge Keishing # "Members": [ 157148d08c2SGeorge Keishing # { 158148d08c2SGeorge Keishing # "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry", 159148d08c2SGeorge Keishing # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1", 160148d08c2SGeorge Keishing # "@odata.type": "#LogEntry.v1_4_0.LogEntry", 161148d08c2SGeorge Keishing # "Created": "2019-05-29T13:19:27+00:00", <--- Time stamp 162148d08c2SGeorge Keishing # "EntryType": "Event", 163148d08c2SGeorge Keishing # "Id": "1", 164148d08c2SGeorge Keishing # "Message": "org.open_power.Host.Error.Event", 165148d08c2SGeorge Keishing # "Name": "System DBus Event Log Entry", 166148d08c2SGeorge Keishing # "Severity": "Critical" 167148d08c2SGeorge Keishing # } 168148d08c2SGeorge Keishing # ], 169148d08c2SGeorge Keishing # "Members@odata.count": 1, 170148d08c2SGeorge Keishing # "Name": "System Event Log Entries" 171148d08c2SGeorge Keishing #} 172148d08c2SGeorge Keishing 173148d08c2SGeorge Keishing Redfish Purge Event Log 174148d08c2SGeorge Keishing 175148d08c2SGeorge Keishing Create Test Error Log 176148d08c2SGeorge Keishing Sleep 2s 177148d08c2SGeorge Keishing Create Test Error Log 178148d08c2SGeorge Keishing 179148d08c2SGeorge Keishing ${elog_entry}= Get Event Logs 180148d08c2SGeorge Keishing 181148d08c2SGeorge Keishing # The event log generated is associated with the epoc time and unique 182148d08c2SGeorge Keishing # for every error and in increasing time stamp. 183148d08c2SGeorge Keishing ${time_stamp1}= Convert Date ${elog_entry[0]["Created"]} epoch 184148d08c2SGeorge Keishing ${time_stamp2}= Convert Date ${elog_entry[1]["Created"]} epoch 185148d08c2SGeorge Keishing 186148d08c2SGeorge Keishing Should Be True ${time_stamp2} > ${time_stamp1} 187148d08c2SGeorge Keishing 188148d08c2SGeorge Keishing 18924034a99SRahul Maheshwari# TODO: openbmc/openbmc-test-automation#1789 1906462f26dSRahul MaheshwariVerify Setting Error Log As Resolved 1916462f26dSRahul Maheshwari [Documentation] Verify modified field of error log is updated when error log is marked resolved. 1926462f26dSRahul Maheshwari [Tags] Verify_Setting_Error_Log_As_Resolved 1936462f26dSRahul Maheshwari 1946462f26dSRahul Maheshwari Create Test PEL Log 1956462f26dSRahul Maheshwari ${elog_entry}= Get Event Logs 1966462f26dSRahul Maheshwari 1976462f26dSRahul Maheshwari # Wait for 5 seconds after creating error log. 1986462f26dSRahul Maheshwari Sleep 5s 1996462f26dSRahul Maheshwari 2006462f26dSRahul Maheshwari # Mark error log as resolved by setting it to true. 2016462f26dSRahul Maheshwari Redfish.Patch ${EVENT_LOG_URI}Entries/${elog_entry[0]["Id"]} body={'Resolved':True} 2026462f26dSRahul Maheshwari 2036462f26dSRahul Maheshwari ${elog_entry}= Get Event Logs 2046462f26dSRahul Maheshwari 2056462f26dSRahul Maheshwari # Example error log with resolve field set to true: 2066462f26dSRahul Maheshwari # { 2076462f26dSRahul Maheshwari # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/2045", 2086462f26dSRahul Maheshwari # "@odata.type": "#LogEntry.v1_8_0.LogEntry", 2096462f26dSRahul Maheshwari # "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/EventLog/attachment/2045", 2106462f26dSRahul Maheshwari # "Created": "2021-05-11T04:45:07+00:00", 2116462f26dSRahul Maheshwari # "EntryType": "Event", 2126462f26dSRahul Maheshwari # "Id": "2045", 2136462f26dSRahul Maheshwari # "Message": "xyz.openbmc_project.Host.Error.Event", 2146462f26dSRahul Maheshwari # "Modified": "2021-05-11T07:24:36+00:00", 2156462f26dSRahul Maheshwari # "Name": "System Event Log Entry", 2166462f26dSRahul Maheshwari # "Resolved": true, 2176462f26dSRahul Maheshwari # "Severity": "OK" 2186462f26dSRahul Maheshwari # } 2196462f26dSRahul Maheshwari 2206462f26dSRahul Maheshwari Should Be Equal As Strings ${elog_entry[0]["Resolved"]} True 2216462f26dSRahul Maheshwari 2226462f26dSRahul Maheshwari # Difference created and modified time of error log should be around 5 seconds. 2236462f26dSRahul Maheshwari ${creation_time}= Convert Date ${elog_entry[0]["Created"]} epoch 2246462f26dSRahul Maheshwari ${modification_time}= Convert Date ${elog_entry[0]["Modified"]} epoch 2256462f26dSRahul Maheshwari 2266462f26dSRahul Maheshwari ${diff}= Subtract Date From Date ${modification_time} ${creation_time} 2276462f26dSRahul Maheshwari ${diff}= Convert To Number ${diff} 2286462f26dSRahul Maheshwari Should Be True 4 < ${diff} < 8 2296462f26dSRahul Maheshwari 2306462f26dSRahul Maheshwari 231ddbc88c7SGeorge KeishingVerify IPMI SEL Delete 232ddbc88c7SGeorge Keishing [Documentation] Verify IPMI SEL delete operation. 233ddbc88c7SGeorge Keishing [Tags] Verify_IPMI_SEL_Delete 234ddbc88c7SGeorge Keishing 235ddbc88c7SGeorge Keishing Redfish Purge Event Log 236ddbc88c7SGeorge Keishing Create Test Error Log 237ddbc88c7SGeorge Keishing 238ddbc88c7SGeorge Keishing ${sel_list}= Run IPMI Standard Command sel list 239ddbc88c7SGeorge Keishing Should Not Be Equal As Strings ${sel_list} SEL has no entries 240ddbc88c7SGeorge Keishing 241ddbc88c7SGeorge Keishing # Example of SEL List: 242ddbc88c7SGeorge Keishing # 4 | 04/21/2017 | 10:51:16 | System Event #0x01 | Undetermined system hardware failure | Asserted 243ddbc88c7SGeorge Keishing 244ddbc88c7SGeorge Keishing ${sel_entry}= Fetch from Left ${sel_list} | 245ddbc88c7SGeorge Keishing ${sel_entry}= Evaluate $sel_entry.replace(' ','') 246ddbc88c7SGeorge Keishing ${sel_entry}= Convert To Integer 0x${sel_entry} 247ddbc88c7SGeorge Keishing 248ddbc88c7SGeorge Keishing ${sel_delete}= Run IPMI Standard Command sel delete ${sel_entry} 249ddbc88c7SGeorge Keishing Should Be Equal As Strings ${sel_delete} Deleted entry ${sel_entry} 250ddbc88c7SGeorge Keishing ... case_insensitive=True 251ddbc88c7SGeorge Keishing 252ddbc88c7SGeorge Keishing ${sel_list}= Run IPMI Standard Command sel list 253ddbc88c7SGeorge Keishing Should Be Equal As Strings ${sel_list} SEL has no entries 254ddbc88c7SGeorge Keishing ... case_insensitive=True 255ddbc88c7SGeorge Keishing 256ddbc88c7SGeorge Keishing 2570b76e421SGeorge KeishingDelete Non Existing SEL Event Entry 2580b76e421SGeorge Keishing [Documentation] Delete non existing SEL event entry. 2590b76e421SGeorge Keishing [Tags] Delete_Non_Existing_SEL_Event_Entry 2600b76e421SGeorge Keishing 2610b76e421SGeorge Keishing ${sel_delete}= Run Keyword And Expect Error * 2620b76e421SGeorge Keishing ... Run IPMI Standard Command sel delete 100 2630b76e421SGeorge Keishing Should Contain ${sel_delete} Unable to delete entry 2640b76e421SGeorge Keishing ... case_insensitive=True 2650b76e421SGeorge Keishing 2660b76e421SGeorge Keishing 2670b76e421SGeorge KeishingDelete Invalid SEL Event Entry 2680b76e421SGeorge Keishing [Documentation] Delete invalid SEL event entry. 2690b76e421SGeorge Keishing [Tags] Delete_Invalid_SEL_Event_Entry 2700b76e421SGeorge Keishing 2710b76e421SGeorge Keishing ${sel_delete}= Run Keyword And Expect Error * 2720b76e421SGeorge Keishing ... Run IPMI Standard Command sel delete abc 2730b76e421SGeorge Keishing Should Contain ${sel_delete} Given SEL ID 'abc' is invalid 2740b76e421SGeorge Keishing ... case_insensitive=True 2750b76e421SGeorge Keishing 2760b76e421SGeorge Keishing 2770b76e421SGeorge KeishingVerify IPMI SEL Event Entries 2780b76e421SGeorge Keishing [Documentation] Verify IPMI SEL's entries info. 2790b76e421SGeorge Keishing [Tags] Verify_IPMI_SEL_Event_Entries 2800b76e421SGeorge Keishing 2810b76e421SGeorge Keishing # Generate error logs of random count. 2820b76e421SGeorge Keishing ${count}= Evaluate random.randint(1, 5) modules=random 2830b76e421SGeorge Keishing Repeat Keyword ${count} Create Test Error Log 2840b76e421SGeorge Keishing 2850b76e421SGeorge Keishing ${sel_entries_count}= Get IPMI SEL Setting Entries 2860b76e421SGeorge Keishing Should Be Equal As Strings ${sel_entries_count} ${count} 2870b76e421SGeorge Keishing 2880b76e421SGeorge Keishing 2890b76e421SGeorge KeishingVerify IPMI SEL Event Last Add Time 2900b76e421SGeorge Keishing [Documentation] Verify IPMI SEL's last added timestamp. 2910b76e421SGeorge Keishing [Tags] Verify_IPMI_SEL_Event_Last_Add_Time 2920b76e421SGeorge Keishing 2930b76e421SGeorge Keishing Create Test Error Log 2940b76e421SGeorge Keishing ${sel_time}= Run IPMI Standard Command sel time get 2950b76e421SGeorge Keishing ${sel_time}= Convert Date ${sel_time} 2960b76e421SGeorge Keishing ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=True 2970b76e421SGeorge Keishing 2980b76e421SGeorge Keishing ${sel_last_add_time}= Get IPMI SEL Setting Last Add Time 2990b76e421SGeorge Keishing ${sel_last_add_time}= Convert Date ${sel_last_add_time} 3000b76e421SGeorge Keishing ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=True 3010b76e421SGeorge Keishing 3020b76e421SGeorge Keishing ${time_diff}= 3030b76e421SGeorge Keishing ... Subtract Date From Date ${sel_last_add_time} ${sel_time} 3040b76e421SGeorge Keishing 3050b76e421SGeorge Keishing # Verify if the delay in current time check and last add SEL time 3060b76e421SGeorge Keishing # is less or equals to 2 seconds. 3070b76e421SGeorge Keishing Should Be True ${time_diff} <= 2 3080b76e421SGeorge Keishing 3090b76e421SGeorge Keishing 310d35b5319SGeorge KeishingCreate Test Event Log And Delete 311d35b5319SGeorge Keishing [Documentation] Create an event log and delete it. 312d35b5319SGeorge Keishing [Tags] Create_Test_Event_Log_And_Delete 313d35b5319SGeorge Keishing 314d35b5319SGeorge Keishing Create Test Error Log 315d35b5319SGeorge Keishing Redfish Purge Event Log 316d35b5319SGeorge Keishing Event Log Should Not Exist 317d35b5319SGeorge Keishing 318d35b5319SGeorge Keishing 319d35b5319SGeorge KeishingCreate Multiple Test Event Logs And Delete All 320d35b5319SGeorge Keishing [Documentation] Create multiple event logs and delete all. 321d35b5319SGeorge Keishing [Tags] Create_Multiple_Test_Event_Logs_And_Delete_All 322d35b5319SGeorge Keishing 323d35b5319SGeorge Keishing Create Test Error Log 324d35b5319SGeorge Keishing Create Test Error Log 325d35b5319SGeorge Keishing Create Test Error Log 326d35b5319SGeorge Keishing Redfish Purge Event Log 327d35b5319SGeorge Keishing Event Log Should Not Exist 328d35b5319SGeorge Keishing 329d35b5319SGeorge Keishing 330ddbc88c7SGeorge KeishingCreate Two Test Event Logs And Delete One 331ddbc88c7SGeorge Keishing [Documentation] Create two event logs and delete the first entry. 33289f499d5SGeorge Keishing [Tags] Create_Two_Test_Event_Logs_And_Delete_One 333c2d33651SRahul Maheshwari [Setup] Redfish Power Off stack_mode=skip 334ddbc88c7SGeorge Keishing 335ddbc88c7SGeorge Keishing Redfish Purge Event Log 336c2d33651SRahul Maheshwari Create Test PEL Log 337c2d33651SRahul Maheshwari Create Test PEL Log 338c2d33651SRahul Maheshwari ${error_entries_before}= Get Redfish Error Entries 339c2d33651SRahul Maheshwari Redfish.Delete /redfish/v1/Systems/system/LogServices/EventLog/Entries/${error_entries_before[0]} 340c2d33651SRahul Maheshwari 341c2d33651SRahul Maheshwari ${error_entries_after}= Get Redfish Error Entries 342c2d33651SRahul Maheshwari Should Not Contain ${error_entries_after} ${error_entries_before[0]} 343c2d33651SRahul Maheshwari Should Contain ${error_entries_after} ${error_entries_before[1]} 344ddbc88c7SGeorge Keishing 345ddbc88c7SGeorge Keishing 346d35b5319SGeorge KeishingVerify Watchdog Timedout Event 347d35b5319SGeorge Keishing [Documentation] Trigger watchdog timed out and verify event log generated. 348d35b5319SGeorge Keishing [Tags] Verify_Watchdog_Timedout_Event 349d35b5319SGeorge Keishing 350d35b5319SGeorge Keishing Redfish Power On 351d35b5319SGeorge Keishing 352d35b5319SGeorge Keishing # Clear errors if there are any. 353d35b5319SGeorge Keishing Redfish.Login 354d35b5319SGeorge Keishing Redfish Purge Event Log 355d35b5319SGeorge Keishing 356d35b5319SGeorge Keishing Trigger Host Watchdog Error 357d35b5319SGeorge Keishing 358d35b5319SGeorge Keishing # Logging takes time to generate the timeout error. 359d35b5319SGeorge Keishing Wait Until Keyword Succeeds 2 min 30 sec 360d35b5319SGeorge Keishing ... Verify Watchdog EventLog Content 361d35b5319SGeorge Keishing 362d226bbd0STim Lee ${running_states}= Create Dictionary 363d226bbd0STim Lee ... bmc=Enabled 364d226bbd0STim Lee ... chassis=On 365d226bbd0STim Lee ... host=Enabled 366d226bbd0STim Lee ... boot_progress=OSBootStarted 367d226bbd0STim Lee 368d226bbd0STim Lee Wait Until Keyword Succeeds 1 min 10 sec Match State ${running_states} 369d35b5319SGeorge Keishing 370d35b5319SGeorge KeishingVerify Event Logs Capping 371d35b5319SGeorge Keishing [Documentation] Verify event logs capping. 372d35b5319SGeorge Keishing [Tags] Verify_Event_Logs_Capping 373d35b5319SGeorge Keishing 374d35b5319SGeorge Keishing Redfish Purge Event Log 375d35b5319SGeorge Keishing 376*033ee18fSGeorge Keishing ${cmd}= Catenate uptime; for i in {1..201}; do /tmp/tarball/bin/logging-test -c 377*033ee18fSGeorge Keishing ... AutoTestSimple;sleep 1;done; uptime 378d35b5319SGeorge Keishing BMC Execute Command ${cmd} 379d35b5319SGeorge Keishing 380d35b5319SGeorge Keishing ${elogs}= Get Event Logs 381d35b5319SGeorge Keishing ${count}= Get Length ${elogs} 382d35b5319SGeorge Keishing Run Keyword If ${count} > 200 383d35b5319SGeorge Keishing ... Fail Error logs created exceeded max capacity 200. 384d35b5319SGeorge Keishing 385d35b5319SGeorge Keishing 386759c6f97SGeorge KeishingTest Event Log Wrapping 387759c6f97SGeorge Keishing [Documentation] Verify event log entries wraps when 200 max cap is reached. 388759c6f97SGeorge Keishing [Tags] Test_Event_Log_Wrapping 389759c6f97SGeorge Keishing 390759c6f97SGeorge Keishing # Restarting logging service in order to clear logs and get the next log 391759c6f97SGeorge Keishing # ID set to 1. 392759c6f97SGeorge Keishing BMC Execute Command 393759c6f97SGeorge Keishing ... systemctl restart xyz.openbmc_project.Logging.service 394759c6f97SGeorge Keishing Sleep 10s reason=Wait for logging service to restart properly. 395759c6f97SGeorge Keishing 396759c6f97SGeorge Keishing # Create ${max_num_event_logs} event logs. 397*033ee18fSGeorge Keishing ${cmd}= Catenate uptime; for i in {1..${max_num_event_logs}}; do /tmp/tarball/bin/logging-test -c 398*033ee18fSGeorge Keishing ... AutoTestSimple;sleep 1;done; uptime 399759c6f97SGeorge Keishing BMC Execute Command ${cmd} 400759c6f97SGeorge Keishing 401759c6f97SGeorge Keishing # Verify that event logs with IDs 1 and ${max_num_event_logs} exist. 402759c6f97SGeorge Keishing ${event_log}= Get Event Logs 403759c6f97SGeorge Keishing 404759c6f97SGeorge Keishing ${log_entries}= Filter Struct ${event_log} [('Id', '1')] 40539c00518SMichael Walsh Rprint Vars log_entries 406759c6f97SGeorge Keishing Should Be Equal As Strings ${log_entries[0]["Id"]} 1 407759c6f97SGeorge Keishing 408759c6f97SGeorge Keishing ${log_entries}= Filter Struct ${event_log} [('Id', '${max_num_event_logs}')] 40939c00518SMichael Walsh Rprint Vars log_entries 410759c6f97SGeorge Keishing Should Be Equal As Strings ${log_entries[0]["Id"]} ${max_num_event_logs} 411759c6f97SGeorge Keishing 412759c6f97SGeorge Keishing # Create event log and verify the entry ID, ${max_num_event_logs + 1}. 413759c6f97SGeorge Keishing ${next_event_log_id}= Set Variable ${max_num_event_logs + 1} 414759c6f97SGeorge Keishing 415759c6f97SGeorge Keishing Create Test Error Log 416759c6f97SGeorge Keishing 417759c6f97SGeorge Keishing ${event_log}= Get Event Logs 418759c6f97SGeorge Keishing 419759c6f97SGeorge Keishing ${log_entries}= Filter Struct ${event_log} [('Id', '${next_event_log_id}')] 42039c00518SMichael Walsh Rprint Vars log_entries 421759c6f97SGeorge Keishing Should Be Equal As Strings ${log_entries[0]["Id"]} ${next_event_log_id} 422759c6f97SGeorge Keishing 423759c6f97SGeorge Keishing # Event log 1 should be wrapped. 424759c6f97SGeorge Keishing ${log_entries}= Filter Struct ${event_log} [('Id', '1')] 42539c00518SMichael Walsh Rprint Vars log_entries 426759c6f97SGeorge Keishing 427759c6f97SGeorge Keishing ${length_log_entries} Get Length ${log_entries} 428759c6f97SGeorge Keishing Should Be Equal As Integers ${length_log_entries} 0 429759c6f97SGeorge Keishing ... msg=The event log should have wrapped such that entry ID 1 is now purged. 430759c6f97SGeorge Keishing 431759c6f97SGeorge Keishing 4328cca7fb8SGeorge Keishing*** Keywords *** 4338cca7fb8SGeorge Keishing 4342f36947bSGeorge KeishingSuite Setup Execution 4352f36947bSGeorge Keishing [Documentation] Do test case setup tasks. 4362f36947bSGeorge Keishing 4372f36947bSGeorge Keishing Redfish.Login 4382f36947bSGeorge Keishing 4392f36947bSGeorge Keishing Redfish Purge Event Log 4402f36947bSGeorge Keishing 4412f36947bSGeorge Keishing ${status}= Run Keyword And Return Status Logging Test Binary Exist 4422f36947bSGeorge Keishing Run Keyword If ${status} == ${False} Install Tarball 4432f36947bSGeorge Keishing 4442f36947bSGeorge Keishing 4458cca7fb8SGeorge KeishingSuite Teardown Execution 4468cca7fb8SGeorge Keishing [Documentation] Do the post suite teardown. 4478cca7fb8SGeorge Keishing 4488cca7fb8SGeorge Keishing Redfish.Logout 4498cca7fb8SGeorge Keishing 4508cca7fb8SGeorge Keishing 451b0a491f2SGeorge KeishingTest Setup Execution 4528cca7fb8SGeorge Keishing [Documentation] Do test case setup tasks. 4538cca7fb8SGeorge Keishing 4540b76e421SGeorge Keishing Redfish Purge Event Log 4550b76e421SGeorge Keishing 4568cca7fb8SGeorge Keishing ${status}= Run Keyword And Return Status Logging Test Binary Exist 4578cca7fb8SGeorge Keishing Run Keyword If ${status} == ${False} Install Tarball 4588cca7fb8SGeorge Keishing 4598cca7fb8SGeorge Keishing 4608cca7fb8SGeorge KeishingTest Teardown Execution 4618cca7fb8SGeorge Keishing [Documentation] Do the post test teardown. 4628cca7fb8SGeorge Keishing 4638cca7fb8SGeorge Keishing FFDC On Test Case Fail 464e5c5ebdfSGeorge Keishing Redfish.Login 465b0a491f2SGeorge Keishing Redfish Purge Event Log 4668cca7fb8SGeorge Keishing 4678cca7fb8SGeorge Keishing 46820c08e41SRahul MaheshwariGet Redfish Error Entries 46920c08e41SRahul Maheshwari [Documentation] Return Redfish error ids list. 47020c08e41SRahul Maheshwari ${error_uris}= redfish_utils.get_member_list /redfish/v1/Systems/system/LogServices/EventLog/Entries 47120c08e41SRahul Maheshwari ${error_ids}= Create List 47220c08e41SRahul Maheshwari 47320c08e41SRahul Maheshwari FOR ${error_uri} IN @{error_uris} 47420c08e41SRahul Maheshwari ${error_id}= Fetch From Right ${error_uri} / 47520c08e41SRahul Maheshwari Append To List ${error_ids} ${error_id} 47620c08e41SRahul Maheshwari END 47720c08e41SRahul Maheshwari 47820c08e41SRahul Maheshwari [Return] ${error_ids} 47920c08e41SRahul Maheshwari 48020c08e41SRahul Maheshwari 4818cca7fb8SGeorge KeishingEvent Log Should Not Exist 4828cca7fb8SGeorge Keishing [Documentation] Event log entries should not exist. 4838cca7fb8SGeorge Keishing 4848cca7fb8SGeorge Keishing ${elogs}= Get Event Logs 4858cca7fb8SGeorge Keishing Should Be Empty ${elogs} msg=System event log entry is not empty. 486b0a491f2SGeorge Keishing 487b0a491f2SGeorge Keishing 488b0a491f2SGeorge KeishingEvent Log Should Exist 489b0a491f2SGeorge Keishing [Documentation] Event log entries should exist. 490b0a491f2SGeorge Keishing 491b0a491f2SGeorge Keishing ${elogs}= Get Event Logs 492b0a491f2SGeorge Keishing Should Not Be Empty ${elogs} msg=System event log entry is not empty. 493d35b5319SGeorge Keishing 494d35b5319SGeorge Keishing 495d35b5319SGeorge KeishingVerify Watchdog EventLog Content 496d35b5319SGeorge Keishing [Documentation] Verify watchdog event log content. 497d35b5319SGeorge Keishing 498d35b5319SGeorge Keishing # Example: 499d35b5319SGeorge Keishing # { 500d35b5319SGeorge Keishing # "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry", 501d35b5319SGeorge Keishing # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/31", 502d35b5319SGeorge Keishing # "@odata.type": "#LogEntry.v1_4_0.LogEntry", 503d35b5319SGeorge Keishing # "Created": "2019-05-31T18:41:33+00:00", 504d35b5319SGeorge Keishing # "EntryType": "Event", 505d35b5319SGeorge Keishing # "Id": "31", 506d35b5319SGeorge Keishing # "Message": "org.open_power.Host.Boot.Error.WatchdogTimedOut", 507d35b5319SGeorge Keishing # "Name": "System DBus Event Log Entry", 508d35b5319SGeorge Keishing # "Severity": "Critical" 509d35b5319SGeorge Keishing # } 510d35b5319SGeorge Keishing 511d35b5319SGeorge Keishing ${elog}= Get Event Logs 512d35b5319SGeorge Keishing Should Be Equal As Strings 513d35b5319SGeorge Keishing ... ${elog[0]["Message"]} org.open_power.Host.Boot.Error.WatchdogTimedOut 514d35b5319SGeorge Keishing ... msg=Watchdog timeout event log was not found. 515d35b5319SGeorge Keishing Should Be Equal As Strings 516d35b5319SGeorge Keishing ... ${elog[0]["Severity"]} Critical 517d35b5319SGeorge Keishing ... msg=Watchdog timeout severity unexpected value. 518