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 16*f699f55dSGeorge KeishingForce Tags Event_Logging 17*f699f55dSGeorge Keishing 18759c6f97SGeorge Keishing** Variables *** 19759c6f97SGeorge Keishing 20759c6f97SGeorge Keishing${max_num_event_logs} ${200} 21759c6f97SGeorge Keishing 228cca7fb8SGeorge Keishing*** Test Cases *** 238cca7fb8SGeorge Keishing 248cca7fb8SGeorge KeishingEvent Log Check After BMC Reboot 258cca7fb8SGeorge Keishing [Documentation] Check event log after BMC rebooted. 268cca7fb8SGeorge Keishing [Tags] Event_Log_Check_After_BMC_Reboot 278cca7fb8SGeorge Keishing 288cca7fb8SGeorge Keishing Redfish Purge Event Log 298cca7fb8SGeorge Keishing Event Log Should Not Exist 308cca7fb8SGeorge Keishing 318cca7fb8SGeorge Keishing Redfish OBMC Reboot (off) 328cca7fb8SGeorge Keishing 338cca7fb8SGeorge Keishing Redfish.Login 348cca7fb8SGeorge Keishing Wait Until Keyword Succeeds 1 mins 15 secs Redfish.Get ${EVENT_LOG_URI}Entries 358cca7fb8SGeorge Keishing 368cca7fb8SGeorge Keishing Event Log Should Not Exist 378cca7fb8SGeorge Keishing 388cca7fb8SGeorge Keishing 39b0a491f2SGeorge KeishingEvent Log Check After Host Poweron 40b0a491f2SGeorge Keishing [Documentation] Check event log after host has booted. 41b0a491f2SGeorge Keishing [Tags] Event_Log_Check_After_Host_Poweron 42b0a491f2SGeorge Keishing 43b0a491f2SGeorge Keishing Redfish Purge Event Log 44b0a491f2SGeorge Keishing Event Log Should Not Exist 45b0a491f2SGeorge Keishing 46b0a491f2SGeorge Keishing Redfish Power On 47b0a491f2SGeorge Keishing 48b0a491f2SGeorge Keishing Redfish.Login 49b0a491f2SGeorge Keishing Event Log Should Not Exist 50b0a491f2SGeorge Keishing 51b0a491f2SGeorge Keishing 52b0a491f2SGeorge KeishingCreate Test Event Log And Verify 53b0a491f2SGeorge Keishing [Documentation] Create event logs and verify via redfish. 54b0a491f2SGeorge Keishing [Tags] Create_Test_Event_Log_And_Verify 55b0a491f2SGeorge Keishing 56b0a491f2SGeorge Keishing Create Test Error Log 57b0a491f2SGeorge Keishing Event Log Should Exist 58b0a491f2SGeorge Keishing 59b0a491f2SGeorge Keishing 6020c08e41SRahul MaheshwariDelete Redfish Event Log And Verify 6120c08e41SRahul Maheshwari [Documentation] Delete Redfish event log and verify via Redfish. 6220c08e41SRahul Maheshwari [Tags] Delete_Redfish_Event_Log_And_Verify 6320c08e41SRahul Maheshwari 6420c08e41SRahul Maheshwari Redfish.Login 6520c08e41SRahul Maheshwari Redfish Purge Event Log 6620c08e41SRahul Maheshwari Create Test PEL Log 6720c08e41SRahul Maheshwari ${elog_entry}= Get Event Logs 6820c08e41SRahul Maheshwari 6920c08e41SRahul Maheshwari Redfish.Delete /redfish/v1/Systems/system/LogServices/EventLog/Entries/${elog_entry[0]["Id"]} 7020c08e41SRahul Maheshwari 7120c08e41SRahul Maheshwari ${error_entries}= Get Redfish Error Entries 7220c08e41SRahul Maheshwari Should Be Empty ${error_entries} 7320c08e41SRahul Maheshwari 7420c08e41SRahul Maheshwari 75b0a491f2SGeorge KeishingTest Event Log Persistency On Restart 76b0a491f2SGeorge Keishing [Documentation] Restart logging service and verify event logs. 77b0a491f2SGeorge Keishing [Tags] Test_Event_Log_Persistency_On_Restart 78b0a491f2SGeorge Keishing 79b0a491f2SGeorge Keishing Create Test Error Log 80b0a491f2SGeorge Keishing Event Log Should Exist 81b0a491f2SGeorge Keishing 82b0a491f2SGeorge Keishing BMC Execute Command 83b0a491f2SGeorge Keishing ... systemctl restart xyz.openbmc_project.Logging.service 84b0a491f2SGeorge Keishing Sleep 10s reason=Wait for logging service to restart properly. 85b0a491f2SGeorge Keishing 86b0a491f2SGeorge Keishing Event Log Should Exist 87b0a491f2SGeorge Keishing 88b0a491f2SGeorge Keishing 89b0a491f2SGeorge KeishingTest Event Entry Numbering Reset On Restart 90b0a491f2SGeorge Keishing [Documentation] Restart logging service and verify event logs entry starts 91b0a491f2SGeorge Keishing ... from entry "Id" 1. 92b0a491f2SGeorge Keishing [Tags] Test_Event_Entry_Numbering_Reset_On_Restart 9320560f9cSRahul Maheshwari [Setup] Redfish Power Off stack_mode=skip 94b0a491f2SGeorge Keishing 95b0a491f2SGeorge Keishing #{ 96b0a491f2SGeorge Keishing # "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection", 97b0a491f2SGeorge Keishing # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries", 98b0a491f2SGeorge Keishing # "@odata.type": "#LogEntryCollection.LogEntryCollection", 99b0a491f2SGeorge Keishing # "Description": "Collection of System Event Log Entries", 100b0a491f2SGeorge Keishing # "Members": [ 101b0a491f2SGeorge Keishing # { 102b0a491f2SGeorge Keishing # "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry", 103b0a491f2SGeorge Keishing # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1", 104b0a491f2SGeorge Keishing # "@odata.type": "#LogEntry.v1_4_0.LogEntry", 105b0a491f2SGeorge Keishing # "Created": "2019-05-29T13:19:27+00:00", 106b0a491f2SGeorge Keishing # "EntryType": "Event", 107b0a491f2SGeorge Keishing # "Id": "1", <----- Event log ID 108b0a491f2SGeorge Keishing # "Message": "org.open_power.Host.Error.Event", 109b0a491f2SGeorge Keishing # "Name": "System DBus Event Log Entry", 110b0a491f2SGeorge Keishing # "Severity": "Critical" 111b0a491f2SGeorge Keishing # } 112b0a491f2SGeorge Keishing # ], 113b0a491f2SGeorge Keishing # "Members@odata.count": 1, 114b0a491f2SGeorge Keishing # "Name": "System Event Log Entries" 115b0a491f2SGeorge Keishing #} 116b0a491f2SGeorge Keishing 11720560f9cSRahul Maheshwari Create Test PEL Log 11820560f9cSRahul Maheshwari Create Test PEL Log 119b0a491f2SGeorge Keishing Event Log Should Exist 120b0a491f2SGeorge Keishing 121b0a491f2SGeorge Keishing Redfish Purge Event Log 122b0a491f2SGeorge Keishing Event Log Should Not Exist 123b0a491f2SGeorge Keishing 124b0a491f2SGeorge Keishing BMC Execute Command 125b0a491f2SGeorge Keishing ... systemctl restart xyz.openbmc_project.Logging.service 126b0a491f2SGeorge Keishing Sleep 10s reason=Wait for logging service to restart properly. 127b0a491f2SGeorge Keishing 12820560f9cSRahul Maheshwari Create Test PEL Log 129b0a491f2SGeorge Keishing ${elogs}= Get Event Logs 13020560f9cSRahul Maheshwari Should Be Equal ${elogs[0]["Id"]} 1 msg=Event log entry is not 1 131b0a491f2SGeorge Keishing 132b0a491f2SGeorge Keishing 133b0a491f2SGeorge KeishingTest Event Log Persistency On Reboot 134b0a491f2SGeorge Keishing [Documentation] Reboot BMC and verify event log. 135b0a491f2SGeorge Keishing [Tags] Test_Event_Log_Persistency_On_Reboot 136b0a491f2SGeorge Keishing 137b0a491f2SGeorge Keishing Redfish Purge Event Log 138b0a491f2SGeorge Keishing Create Test Error Log 139b0a491f2SGeorge Keishing Event Log Should Exist 140b0a491f2SGeorge Keishing 141b0a491f2SGeorge Keishing Redfish OBMC Reboot (off) 142b0a491f2SGeorge Keishing 143b0a491f2SGeorge Keishing Redfish.Login 144b0a491f2SGeorge Keishing Wait Until Keyword Succeeds 1 mins 15 secs Redfish.Get ${EVENT_LOG_URI}Entries 145b0a491f2SGeorge Keishing 146b0a491f2SGeorge Keishing Event Log Should Exist 147b0a491f2SGeorge Keishing 148b0a491f2SGeorge Keishing 149148d08c2SGeorge KeishingCreate Test Event Log And Verify Time Stamp 150148d08c2SGeorge Keishing [Documentation] Create event logs and verify time stamp. 151148d08c2SGeorge Keishing [Tags] Create_Test_Event_Log_And_Verify_Time_Stamp 152148d08c2SGeorge Keishing 153148d08c2SGeorge Keishing #{ 154148d08c2SGeorge Keishing # "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection", 155148d08c2SGeorge Keishing # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries", 156148d08c2SGeorge Keishing # "@odata.type": "#LogEntryCollection.LogEntryCollection", 157148d08c2SGeorge Keishing # "Description": "Collection of System Event Log Entries", 158148d08c2SGeorge Keishing # "Members": [ 159148d08c2SGeorge Keishing # { 160148d08c2SGeorge Keishing # "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry", 161148d08c2SGeorge Keishing # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1", 162148d08c2SGeorge Keishing # "@odata.type": "#LogEntry.v1_4_0.LogEntry", 163f4372444Sdnirmala # "Created": "2023-05-10T10:26:02.186+00:00", <--- Time stamp 164148d08c2SGeorge Keishing # "EntryType": "Event", 165148d08c2SGeorge Keishing # "Id": "1", 166148d08c2SGeorge Keishing # "Message": "org.open_power.Host.Error.Event", 167148d08c2SGeorge Keishing # "Name": "System DBus Event Log Entry", 168148d08c2SGeorge Keishing # "Severity": "Critical" 169148d08c2SGeorge Keishing # } 170148d08c2SGeorge Keishing # ], 171148d08c2SGeorge Keishing # "Members@odata.count": 1, 172148d08c2SGeorge Keishing # "Name": "System Event Log Entries" 173148d08c2SGeorge Keishing #} 174148d08c2SGeorge Keishing 175148d08c2SGeorge Keishing Redfish Purge Event Log 176148d08c2SGeorge Keishing 177148d08c2SGeorge Keishing Create Test Error Log 178148d08c2SGeorge Keishing Sleep 2s 179148d08c2SGeorge Keishing Create Test Error Log 180148d08c2SGeorge Keishing 181148d08c2SGeorge Keishing ${elog_entry}= Get Event Logs 182148d08c2SGeorge Keishing 183148d08c2SGeorge Keishing # The event log generated is associated with the epoc time and unique 184148d08c2SGeorge Keishing # for every error and in increasing time stamp. 185f4372444Sdnirmala ${time_stamp1}= Convert Date ${elog_entry[0]["Created"].split('.')[0]} epoch 186f4372444Sdnirmala ${time_stamp2}= Convert Date ${elog_entry[1]["Created"].split('.')[0]} epoch 187148d08c2SGeorge Keishing 188148d08c2SGeorge Keishing Should Be True ${time_stamp2} > ${time_stamp1} 189148d08c2SGeorge Keishing 190148d08c2SGeorge Keishing 19124034a99SRahul Maheshwari# TODO: openbmc/openbmc-test-automation#1789 1926462f26dSRahul MaheshwariVerify Setting Error Log As Resolved 1936462f26dSRahul Maheshwari [Documentation] Verify modified field of error log is updated when error log is marked resolved. 1946462f26dSRahul Maheshwari [Tags] Verify_Setting_Error_Log_As_Resolved 1956462f26dSRahul Maheshwari 1966462f26dSRahul Maheshwari Create Test PEL Log 1976462f26dSRahul Maheshwari ${elog_entry}= Get Event Logs 1986462f26dSRahul Maheshwari 1996462f26dSRahul Maheshwari # Wait for 5 seconds after creating error log. 2006462f26dSRahul Maheshwari Sleep 5s 2016462f26dSRahul Maheshwari 2026462f26dSRahul Maheshwari # Mark error log as resolved by setting it to true. 2036462f26dSRahul Maheshwari Redfish.Patch ${EVENT_LOG_URI}Entries/${elog_entry[0]["Id"]} body={'Resolved':True} 2046462f26dSRahul Maheshwari 2056462f26dSRahul Maheshwari ${elog_entry}= Get Event Logs 2066462f26dSRahul Maheshwari 2076462f26dSRahul Maheshwari # Example error log with resolve field set to true: 2086462f26dSRahul Maheshwari # { 2096462f26dSRahul Maheshwari # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/2045", 2106462f26dSRahul Maheshwari # "@odata.type": "#LogEntry.v1_8_0.LogEntry", 2116462f26dSRahul Maheshwari # "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/EventLog/attachment/2045", 212f4372444Sdnirmala # "Created": "2023-05-10T10:26:02.186+00:00", 2136462f26dSRahul Maheshwari # "EntryType": "Event", 2146462f26dSRahul Maheshwari # "Id": "2045", 2156462f26dSRahul Maheshwari # "Message": "xyz.openbmc_project.Host.Error.Event", 216f4372444Sdnirmala # "Modified": "2023-05-10T10:26:02.186+00:00", 2176462f26dSRahul Maheshwari # "Name": "System Event Log Entry", 2186462f26dSRahul Maheshwari # "Resolved": true, 2196462f26dSRahul Maheshwari # "Severity": "OK" 2206462f26dSRahul Maheshwari # } 2216462f26dSRahul Maheshwari 2226462f26dSRahul Maheshwari Should Be Equal As Strings ${elog_entry[0]["Resolved"]} True 2236462f26dSRahul Maheshwari 2246462f26dSRahul Maheshwari # Difference created and modified time of error log should be around 5 seconds. 225f4372444Sdnirmala ${creation_time}= Convert Date ${elog_entry[0]["Created"].split('.')[0]} epoch 226f4372444Sdnirmala ${modification_time}= Convert Date ${elog_entry[0]["Modified"].split('.')[0]} epoch 2276462f26dSRahul Maheshwari 2286462f26dSRahul Maheshwari ${diff}= Subtract Date From Date ${modification_time} ${creation_time} 2296462f26dSRahul Maheshwari ${diff}= Convert To Number ${diff} 2306462f26dSRahul Maheshwari Should Be True 4 < ${diff} < 8 2316462f26dSRahul Maheshwari 2326462f26dSRahul Maheshwari 233ddbc88c7SGeorge KeishingVerify IPMI SEL Delete 234ddbc88c7SGeorge Keishing [Documentation] Verify IPMI SEL delete operation. 235ddbc88c7SGeorge Keishing [Tags] Verify_IPMI_SEL_Delete 236ddbc88c7SGeorge Keishing 237ddbc88c7SGeorge Keishing Redfish Purge Event Log 238ddbc88c7SGeorge Keishing Create Test Error Log 239ddbc88c7SGeorge Keishing 240ddbc88c7SGeorge Keishing ${sel_list}= Run IPMI Standard Command sel list 241ddbc88c7SGeorge Keishing Should Not Be Equal As Strings ${sel_list} SEL has no entries 242ddbc88c7SGeorge Keishing 243ddbc88c7SGeorge Keishing # Example of SEL List: 244ddbc88c7SGeorge Keishing # 4 | 04/21/2017 | 10:51:16 | System Event #0x01 | Undetermined system hardware failure | Asserted 245ddbc88c7SGeorge Keishing 246ddbc88c7SGeorge Keishing ${sel_entry}= Fetch from Left ${sel_list} | 247ddbc88c7SGeorge Keishing ${sel_entry}= Evaluate $sel_entry.replace(' ','') 248ddbc88c7SGeorge Keishing ${sel_entry}= Convert To Integer 0x${sel_entry} 249ddbc88c7SGeorge Keishing 250ddbc88c7SGeorge Keishing ${sel_delete}= Run IPMI Standard Command sel delete ${sel_entry} 251ddbc88c7SGeorge Keishing Should Be Equal As Strings ${sel_delete} Deleted entry ${sel_entry} 252ddbc88c7SGeorge Keishing ... case_insensitive=True 253ddbc88c7SGeorge Keishing 254ddbc88c7SGeorge Keishing ${sel_list}= Run IPMI Standard Command sel list 255ddbc88c7SGeorge Keishing Should Be Equal As Strings ${sel_list} SEL has no entries 256ddbc88c7SGeorge Keishing ... case_insensitive=True 257ddbc88c7SGeorge Keishing 258ddbc88c7SGeorge Keishing 2590b76e421SGeorge KeishingDelete Non Existing SEL Event Entry 2600b76e421SGeorge Keishing [Documentation] Delete non existing SEL event entry. 2610b76e421SGeorge Keishing [Tags] Delete_Non_Existing_SEL_Event_Entry 2620b76e421SGeorge Keishing 2630b76e421SGeorge Keishing ${sel_delete}= Run Keyword And Expect Error * 2640b76e421SGeorge Keishing ... Run IPMI Standard Command sel delete 100 2650b76e421SGeorge Keishing Should Contain ${sel_delete} Unable to delete entry 2660b76e421SGeorge Keishing ... case_insensitive=True 2670b76e421SGeorge Keishing 2680b76e421SGeorge Keishing 2690b76e421SGeorge KeishingDelete Invalid SEL Event Entry 2700b76e421SGeorge Keishing [Documentation] Delete invalid SEL event entry. 2710b76e421SGeorge Keishing [Tags] Delete_Invalid_SEL_Event_Entry 2720b76e421SGeorge Keishing 2730b76e421SGeorge Keishing ${sel_delete}= Run Keyword And Expect Error * 2740b76e421SGeorge Keishing ... Run IPMI Standard Command sel delete abc 2750b76e421SGeorge Keishing Should Contain ${sel_delete} Given SEL ID 'abc' is invalid 2760b76e421SGeorge Keishing ... case_insensitive=True 2770b76e421SGeorge Keishing 2780b76e421SGeorge Keishing 2790b76e421SGeorge KeishingVerify IPMI SEL Event Entries 2800b76e421SGeorge Keishing [Documentation] Verify IPMI SEL's entries info. 2810b76e421SGeorge Keishing [Tags] Verify_IPMI_SEL_Event_Entries 2820b76e421SGeorge Keishing 2830b76e421SGeorge Keishing # Generate error logs of random count. 2840b76e421SGeorge Keishing ${count}= Evaluate random.randint(1, 5) modules=random 2850b76e421SGeorge Keishing Repeat Keyword ${count} Create Test Error Log 2860b76e421SGeorge Keishing 2870b76e421SGeorge Keishing ${sel_entries_count}= Get IPMI SEL Setting Entries 2880b76e421SGeorge Keishing Should Be Equal As Strings ${sel_entries_count} ${count} 2890b76e421SGeorge Keishing 2900b76e421SGeorge Keishing 2910b76e421SGeorge KeishingVerify IPMI SEL Event Last Add Time 2920b76e421SGeorge Keishing [Documentation] Verify IPMI SEL's last added timestamp. 2930b76e421SGeorge Keishing [Tags] Verify_IPMI_SEL_Event_Last_Add_Time 2940b76e421SGeorge Keishing 2950b76e421SGeorge Keishing Create Test Error Log 2960b76e421SGeorge Keishing ${sel_time}= Run IPMI Standard Command sel time get 2970b76e421SGeorge Keishing ${sel_time}= Convert Date ${sel_time} 2980b76e421SGeorge Keishing ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=True 2990b76e421SGeorge Keishing 3000b76e421SGeorge Keishing ${sel_last_add_time}= Get IPMI SEL Setting Last Add Time 3010b76e421SGeorge Keishing ${sel_last_add_time}= Convert Date ${sel_last_add_time} 3020b76e421SGeorge Keishing ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=True 3030b76e421SGeorge Keishing 3040b76e421SGeorge Keishing ${time_diff}= 3050b76e421SGeorge Keishing ... Subtract Date From Date ${sel_last_add_time} ${sel_time} 3060b76e421SGeorge Keishing 3070b76e421SGeorge Keishing # Verify if the delay in current time check and last add SEL time 3080b76e421SGeorge Keishing # is less or equals to 2 seconds. 3090b76e421SGeorge Keishing Should Be True ${time_diff} <= 2 3100b76e421SGeorge Keishing 3110b76e421SGeorge Keishing 312d35b5319SGeorge KeishingCreate Test Event Log And Delete 313d35b5319SGeorge Keishing [Documentation] Create an event log and delete it. 314d35b5319SGeorge Keishing [Tags] Create_Test_Event_Log_And_Delete 315d35b5319SGeorge Keishing 316d35b5319SGeorge Keishing Create Test Error Log 317d35b5319SGeorge Keishing Redfish Purge Event Log 318d35b5319SGeorge Keishing Event Log Should Not Exist 319d35b5319SGeorge Keishing 320d35b5319SGeorge Keishing 321d35b5319SGeorge KeishingCreate Multiple Test Event Logs And Delete All 322d35b5319SGeorge Keishing [Documentation] Create multiple event logs and delete all. 323d35b5319SGeorge Keishing [Tags] Create_Multiple_Test_Event_Logs_And_Delete_All 324d35b5319SGeorge Keishing 325d35b5319SGeorge Keishing Create Test Error Log 326d35b5319SGeorge Keishing Create Test Error Log 327d35b5319SGeorge Keishing Create Test Error Log 328d35b5319SGeorge Keishing Redfish Purge Event Log 329d35b5319SGeorge Keishing Event Log Should Not Exist 330d35b5319SGeorge Keishing 331d35b5319SGeorge Keishing 332ddbc88c7SGeorge KeishingCreate Two Test Event Logs And Delete One 333ddbc88c7SGeorge Keishing [Documentation] Create two event logs and delete the first entry. 33489f499d5SGeorge Keishing [Tags] Create_Two_Test_Event_Logs_And_Delete_One 335c2d33651SRahul Maheshwari [Setup] Redfish Power Off stack_mode=skip 336ddbc88c7SGeorge Keishing 337ddbc88c7SGeorge Keishing Redfish Purge Event Log 338c2d33651SRahul Maheshwari Create Test PEL Log 339c2d33651SRahul Maheshwari Create Test PEL Log 340c2d33651SRahul Maheshwari ${error_entries_before}= Get Redfish Error Entries 341c2d33651SRahul Maheshwari Redfish.Delete /redfish/v1/Systems/system/LogServices/EventLog/Entries/${error_entries_before[0]} 342c2d33651SRahul Maheshwari 343c2d33651SRahul Maheshwari ${error_entries_after}= Get Redfish Error Entries 344c2d33651SRahul Maheshwari Should Not Contain ${error_entries_after} ${error_entries_before[0]} 345c2d33651SRahul Maheshwari Should Contain ${error_entries_after} ${error_entries_before[1]} 346ddbc88c7SGeorge Keishing 347ddbc88c7SGeorge Keishing 348d35b5319SGeorge KeishingVerify Watchdog Timedout Event 349d35b5319SGeorge Keishing [Documentation] Trigger watchdog timed out and verify event log generated. 350d35b5319SGeorge Keishing [Tags] Verify_Watchdog_Timedout_Event 3512ab62414SGeorge Keishing [Teardown] Run Keywords Test Teardown Execution AND Redfish Power Off stack_mode=skip 352d35b5319SGeorge Keishing 3532ab62414SGeorge Keishing Redfish Power Off stack_mode=skip 354d35b5319SGeorge Keishing 355d35b5319SGeorge Keishing # Clear errors if there are any. 356d35b5319SGeorge Keishing Redfish.Login 357d35b5319SGeorge Keishing Redfish Purge Event Log 358d35b5319SGeorge Keishing 3592ab62414SGeorge Keishing # Reference: [Old legacy REST code] Trigger Host Watchdog Error 3602ab62414SGeorge Keishing # Currently, no known redfish interface to set to trigger watchdog timer. 3612ab62414SGeorge Keishing 3622ab62414SGeorge Keishing Redfish Initiate Auto Reboot 1000 363d35b5319SGeorge Keishing 364d35b5319SGeorge Keishing # Logging takes time to generate the timeout error. 3652ab62414SGeorge Keishing Wait Until Keyword Succeeds 3 min 20 sec Verify Watchdog EventLog Content 366d35b5319SGeorge Keishing 367d35b5319SGeorge Keishing 368d35b5319SGeorge KeishingVerify Event Logs Capping 369d35b5319SGeorge Keishing [Documentation] Verify event logs capping. 370d35b5319SGeorge Keishing [Tags] Verify_Event_Logs_Capping 371d35b5319SGeorge Keishing 372d35b5319SGeorge Keishing Redfish Purge Event Log 373d35b5319SGeorge Keishing 374033ee18fSGeorge Keishing ${cmd}= Catenate uptime; for i in {1..201}; do /tmp/tarball/bin/logging-test -c 375033ee18fSGeorge Keishing ... AutoTestSimple;sleep 1;done; uptime 376d35b5319SGeorge Keishing BMC Execute Command ${cmd} 377d35b5319SGeorge Keishing 378d35b5319SGeorge Keishing ${elogs}= Get Event Logs 379d35b5319SGeorge Keishing ${count}= Get Length ${elogs} 380d35b5319SGeorge Keishing Run Keyword If ${count} > 200 381d35b5319SGeorge Keishing ... Fail Error logs created exceeded max capacity 200. 382d35b5319SGeorge Keishing 383d35b5319SGeorge Keishing 384759c6f97SGeorge KeishingTest Event Log Wrapping 385759c6f97SGeorge Keishing [Documentation] Verify event log entries wraps when 200 max cap is reached. 386759c6f97SGeorge Keishing [Tags] Test_Event_Log_Wrapping 387759c6f97SGeorge Keishing 388759c6f97SGeorge Keishing # Restarting logging service in order to clear logs and get the next log 389759c6f97SGeorge Keishing # ID set to 1. 390759c6f97SGeorge Keishing BMC Execute Command 391759c6f97SGeorge Keishing ... systemctl restart xyz.openbmc_project.Logging.service 392759c6f97SGeorge Keishing Sleep 10s reason=Wait for logging service to restart properly. 393759c6f97SGeorge Keishing 394759c6f97SGeorge Keishing # Create ${max_num_event_logs} event logs. 395033ee18fSGeorge Keishing ${cmd}= Catenate uptime; for i in {1..${max_num_event_logs}}; do /tmp/tarball/bin/logging-test -c 396033ee18fSGeorge Keishing ... AutoTestSimple;sleep 1;done; uptime 397759c6f97SGeorge Keishing BMC Execute Command ${cmd} 398759c6f97SGeorge Keishing 399759c6f97SGeorge Keishing # Verify that event logs with IDs 1 and ${max_num_event_logs} exist. 400759c6f97SGeorge Keishing ${event_log}= Get Event Logs 401759c6f97SGeorge Keishing 402759c6f97SGeorge Keishing ${log_entries}= Filter Struct ${event_log} [('Id', '1')] 40339c00518SMichael Walsh Rprint Vars log_entries 404759c6f97SGeorge Keishing Should Be Equal As Strings ${log_entries[0]["Id"]} 1 405759c6f97SGeorge Keishing 406759c6f97SGeorge Keishing ${log_entries}= Filter Struct ${event_log} [('Id', '${max_num_event_logs}')] 40739c00518SMichael Walsh Rprint Vars log_entries 408759c6f97SGeorge Keishing Should Be Equal As Strings ${log_entries[0]["Id"]} ${max_num_event_logs} 409759c6f97SGeorge Keishing 410759c6f97SGeorge Keishing # Create event log and verify the entry ID, ${max_num_event_logs + 1}. 411759c6f97SGeorge Keishing ${next_event_log_id}= Set Variable ${max_num_event_logs + 1} 412759c6f97SGeorge Keishing 413759c6f97SGeorge Keishing Create Test Error Log 414759c6f97SGeorge Keishing 415759c6f97SGeorge Keishing ${event_log}= Get Event Logs 416759c6f97SGeorge Keishing 417759c6f97SGeorge Keishing ${log_entries}= Filter Struct ${event_log} [('Id', '${next_event_log_id}')] 41839c00518SMichael Walsh Rprint Vars log_entries 419759c6f97SGeorge Keishing Should Be Equal As Strings ${log_entries[0]["Id"]} ${next_event_log_id} 420759c6f97SGeorge Keishing 421759c6f97SGeorge Keishing # Event log 1 should be wrapped. 422759c6f97SGeorge Keishing ${log_entries}= Filter Struct ${event_log} [('Id', '1')] 42339c00518SMichael Walsh Rprint Vars log_entries 424759c6f97SGeorge Keishing 425759c6f97SGeorge Keishing ${length_log_entries} Get Length ${log_entries} 426759c6f97SGeorge Keishing Should Be Equal As Integers ${length_log_entries} 0 427759c6f97SGeorge Keishing ... msg=The event log should have wrapped such that entry ID 1 is now purged. 428759c6f97SGeorge Keishing 429759c6f97SGeorge Keishing 4302e092d04SdnirmalaVerify Default Value Of Resolved Field Is False For An Error Log Via Redfish 4312e092d04Sdnirmala [Documentation] Verify the Resolve field status is false for an error log from Redfish. 4322e092d04Sdnirmala [Tags] Verify_Default_Value_Of_Resolved_Field_Is_False_For_An_Error_Log_Via_Redfish 4332e092d04Sdnirmala 4342e092d04Sdnirmala Redfish Purge Event Log 4352e092d04Sdnirmala Create Test Error Log 4362e092d04Sdnirmala 4372e092d04Sdnirmala # Check resolve field value of created error log. 4382e092d04Sdnirmala ${elog_entry}= Get Event Logs 4392e092d04Sdnirmala Should Be Equal ${elog_entry[0]["Resolved"]} ${False} 4402e092d04Sdnirmala 4412e092d04Sdnirmala 4428cca7fb8SGeorge Keishing*** Keywords *** 4438cca7fb8SGeorge Keishing 4442f36947bSGeorge KeishingSuite Setup Execution 4452f36947bSGeorge Keishing [Documentation] Do test case setup tasks. 4462f36947bSGeorge Keishing 4472f36947bSGeorge Keishing Redfish.Login 4482f36947bSGeorge Keishing 4492f36947bSGeorge Keishing Redfish Purge Event Log 4502f36947bSGeorge Keishing 4512f36947bSGeorge Keishing ${status}= Run Keyword And Return Status Logging Test Binary Exist 4522f36947bSGeorge Keishing Run Keyword If ${status} == ${False} Install Tarball 4532f36947bSGeorge Keishing 4542f36947bSGeorge Keishing 4558cca7fb8SGeorge KeishingSuite Teardown Execution 4568cca7fb8SGeorge Keishing [Documentation] Do the post suite teardown. 4578cca7fb8SGeorge Keishing 4588cca7fb8SGeorge Keishing Redfish.Logout 4598cca7fb8SGeorge Keishing 4608cca7fb8SGeorge Keishing 461b0a491f2SGeorge KeishingTest Setup Execution 4628cca7fb8SGeorge Keishing [Documentation] Do test case setup tasks. 4638cca7fb8SGeorge Keishing 4640b76e421SGeorge Keishing Redfish Purge Event Log 4650b76e421SGeorge Keishing 4668cca7fb8SGeorge Keishing ${status}= Run Keyword And Return Status Logging Test Binary Exist 4678cca7fb8SGeorge Keishing Run Keyword If ${status} == ${False} Install Tarball 4688cca7fb8SGeorge Keishing 4698cca7fb8SGeorge Keishing 4708cca7fb8SGeorge KeishingTest Teardown Execution 4718cca7fb8SGeorge Keishing [Documentation] Do the post test teardown. 4728cca7fb8SGeorge Keishing 4738cca7fb8SGeorge Keishing FFDC On Test Case Fail 474e5c5ebdfSGeorge Keishing Redfish.Login 475b0a491f2SGeorge Keishing Redfish Purge Event Log 4768cca7fb8SGeorge Keishing 4778cca7fb8SGeorge Keishing 47820c08e41SRahul MaheshwariGet Redfish Error Entries 47920c08e41SRahul Maheshwari [Documentation] Return Redfish error ids list. 48020c08e41SRahul Maheshwari ${error_uris}= redfish_utils.get_member_list /redfish/v1/Systems/system/LogServices/EventLog/Entries 48120c08e41SRahul Maheshwari ${error_ids}= Create List 48220c08e41SRahul Maheshwari 48320c08e41SRahul Maheshwari FOR ${error_uri} IN @{error_uris} 48420c08e41SRahul Maheshwari ${error_id}= Fetch From Right ${error_uri} / 48520c08e41SRahul Maheshwari Append To List ${error_ids} ${error_id} 48620c08e41SRahul Maheshwari END 48720c08e41SRahul Maheshwari 48820c08e41SRahul Maheshwari [Return] ${error_ids} 48920c08e41SRahul Maheshwari 49020c08e41SRahul Maheshwari 4918cca7fb8SGeorge KeishingEvent Log Should Not Exist 4928cca7fb8SGeorge Keishing [Documentation] Event log entries should not exist. 4938cca7fb8SGeorge Keishing 4948cca7fb8SGeorge Keishing ${elogs}= Get Event Logs 4958cca7fb8SGeorge Keishing Should Be Empty ${elogs} msg=System event log entry is not empty. 496b0a491f2SGeorge Keishing 497b0a491f2SGeorge Keishing 498b0a491f2SGeorge KeishingEvent Log Should Exist 499b0a491f2SGeorge Keishing [Documentation] Event log entries should exist. 500b0a491f2SGeorge Keishing 501b0a491f2SGeorge Keishing ${elogs}= Get Event Logs 502b0a491f2SGeorge Keishing Should Not Be Empty ${elogs} msg=System event log entry is not empty. 503d35b5319SGeorge Keishing 504d35b5319SGeorge Keishing 505d35b5319SGeorge KeishingVerify Watchdog EventLog Content 506d35b5319SGeorge Keishing [Documentation] Verify watchdog event log content. 507d35b5319SGeorge Keishing 508d35b5319SGeorge Keishing # Example: 509d35b5319SGeorge Keishing # { 510d35b5319SGeorge Keishing # "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry", 511d35b5319SGeorge Keishing # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/31", 512d35b5319SGeorge Keishing # "@odata.type": "#LogEntry.v1_4_0.LogEntry", 513d35b5319SGeorge Keishing # "Created": "2019-05-31T18:41:33+00:00", 514d35b5319SGeorge Keishing # "EntryType": "Event", 515d35b5319SGeorge Keishing # "Id": "31", 516d35b5319SGeorge Keishing # "Message": "org.open_power.Host.Boot.Error.WatchdogTimedOut", 517d35b5319SGeorge Keishing # "Name": "System DBus Event Log Entry", 518d35b5319SGeorge Keishing # "Severity": "Critical" 519d35b5319SGeorge Keishing # } 520d35b5319SGeorge Keishing 5212ab62414SGeorge Keishing ${elog_list}= Get Event Logs 5222ab62414SGeorge Keishing 5232ab62414SGeorge Keishing Rprint Vars elog_list 5242ab62414SGeorge Keishing 5252ab62414SGeorge Keishing FOR ${entry} IN @{elog_list} 5262ab62414SGeorge Keishing ${found_match}= Run Keyword And Return Status Is Watchdog Error Found ${entry} 5272ab62414SGeorge Keishing Exit For Loop If '${found_match}' == 'True' 5282ab62414SGeorge Keishing END 5292ab62414SGeorge Keishing 5302ab62414SGeorge Keishing Run Keyword If '${found_match}' == 'False' Fail msg=No watchdog error logged. 5312ab62414SGeorge Keishing 5322ab62414SGeorge Keishing 5332ab62414SGeorge KeishingIs Watchdog Error Found 5342ab62414SGeorge Keishing [Documentation] Check if the give log entry matches specific watchdog error. 5352ab62414SGeorge Keishing [Arguments] ${elog} 5362ab62414SGeorge Keishing 5372ab62414SGeorge Keishing # Description of argument(s): 5382ab62414SGeorge Keishing # elog Error log entry dictionary data. 5392ab62414SGeorge Keishing 5402ab62414SGeorge Keishing Should Contain Any 5412ab62414SGeorge Keishing ... ${elog["Message"]} org.open_power.Host.Boot.Error.WatchdogTimedOut 5422ab62414SGeorge Keishing ... CEC Hardware - Hostboot-Service Processor Interface 543d35b5319SGeorge Keishing ... msg=Watchdog timeout event log was not found. 5442ab62414SGeorge Keishing 5452ab62414SGeorge Keishing Log To Console Matched Found: ${elog} 546