Server health from GUI header - Phase 4.
Resolves openbmc/openbmc-test-automation#1300
Change-Id: I331d5a6df1ed7497a4dcead889088e5977f15995
Signed-off-by: Sivas SRR <sivas.srr@in.ibm.com>
diff --git a/extended/test_error_log.robot b/extended/test_error_log.robot
index 6f6c2f8..5779805 100644
--- a/extended/test_error_log.robot
+++ b/extended/test_error_log.robot
@@ -377,107 +377,6 @@
*** Keywords ***
-Get IPMI SEL Setting
- [Documentation] Returns status for given IPMI SEL setting.
- [Arguments] ${setting}
- # Description of argument(s):
- # setting SEL setting which needs to be read(e.g. "Last Add Time").
-
- ${resp}= Run IPMI Standard Command sel info
-
- ${setting_line}= Get Lines Containing String ${resp} ${setting}
- ... case-insensitive
- ${setting_status}= Fetch From Right ${setting_line} :${SPACE}
-
- [Return] ${setting_status}
-
-
-Verify Watchdog Errorlog Content
- [Documentation] Verify watchdog errorlog content.
- # Example:
- # "/xyz/openbmc_project/logging/entry/1":
- # {
- # "AdditionalData": [],
- # "Id": 1,
- # "Message": "org.open_power.Host.Boot.Error.WatchdogTimedOut",
- # "Resolved": 0,
- # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
- # "Timestamp": 1492715244828,
- # "associations": []
- # },
-
- ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
- ${elog}= Read Properties ${elog_entry[0]}
- Should Be Equal As Strings
- ... ${elog["Message"]} org.open_power.Host.Boot.Error.WatchdogTimedOut
- Should Be Equal As Strings
- ... ${elog["Severity"]} xyz.openbmc_project.Logging.Entry.Level.Error
-
-
-Logging Test Binary Exist
- [Documentation] Verify existence of prerequisite logging-test.
-
- Open Connection And Log In
- ${out} ${stderr}= Execute Command
- ... which /tmp/tarball/bin/logging-test return_stderr=True
- Should Be Empty ${stderr}
- Should Contain ${out} logging-test
-
-Clear Existing Error Logs
- [Documentation] If error log isn't empty, reboot the BMC to clear the log.
-
- ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
- Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
- Initiate BMC Reboot
- Wait Until Keyword Succeeds 10 min 10 sec
- ... Is BMC Ready
- ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
- Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
-
-Create Test Error Log
- [Documentation] Generate test error log.
-
- # Test error log entry example:
- # "/xyz/openbmc_project/logging/entry/1": {
- # "AdditionalData": [
- # "STRING=FOO"
- # ],
- # "Id": 1,
- # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
- # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
- # "Timestamp": 1487743963328,
- # "associations": []
- # }
-
- Execute Command On BMC /tmp/tarball/bin/logging-test -c AutoTestSimple
-
-Count Error Entries
- [Documentation] Count Error entries.
-
- ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}
- Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
- ${jsondata}= To JSON ${resp.content}
- ${count}= Get Length ${jsondata["data"]}
- [Return] ${count}
-
-Verify Test Error Log
- [Documentation] Verify test error log entries.
- ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
- ${entry_id}= Read Attribute ${elog_entry[0]} Message
- Should Be Equal ${entry_id}
- ... example.xyz.openbmc_project.Example.Elog.AutoTestSimple
- ${entry_id}= Read Attribute ${elog_entry[0]} Severity
- Should Be Equal ${entry_id}
- ... xyz.openbmc_project.Logging.Entry.Level.Error
-
-Delete Error Logs And Verify
- [Documentation] Delete all error logs and verify.
-
- Delete All Error Logs
- ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/list quiet=${1}
- Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
-
-
Test Setup Execution
[Documentation] Do test case setup tasks.
@@ -486,14 +385,6 @@
Delete Error Logs And Verify
-Install Tarball
- [Documentation] Install tarball on BMC.
-
- Run Keyword If '${DEBUG_TARBALL_PATH}' == '${EMPTY}' Return From Keyword
- BMC Execute Command rm -rf /tmp/tarball
- Install Debug Tarball On BMC ${DEBUG_TARBALL_PATH}
-
-
Test Teardown Execution
[Documentation] Do the post test teardown.
# 1. Capture FFDC on test failure.
diff --git a/gui/obmc_gui/data/resource_variables.py b/gui/obmc_gui/data/resource_variables.py
index 6ba9aeb..8f67318 100644
--- a/gui/obmc_gui/data/resource_variables.py
+++ b/gui/obmc_gui/data/resource_variables.py
@@ -117,4 +117,10 @@
"//*[@id='event__actions-bar']/div[2]/div[2]/a"
xpath_number_of_events = \
"//*[@id='event__actions-bar']/div[2]/p[2]/span"
-
+ xpath_mark_as_resolved = \
+ "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
+ xpath_events_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
+ xpath_event_delete_no = \
+ "//*[@id='event__actions-bar']/div[2]/div[1]/div[2]/button[2]"
+ xpath_event_delete_yes = \
+ "//*[@id='event__actions-bar']/div[2]/div[1]/div[2]/button[1]"
diff --git a/gui/obmc_gui/test/gui_header/test_obmc_gui_server_health.robot b/gui/obmc_gui/test/gui_header/test_obmc_gui_server_health.robot
index d908d2b..05e5fe6 100644
--- a/gui/obmc_gui/test/gui_header/test_obmc_gui_server_health.robot
+++ b/gui/obmc_gui/test/gui_header/test_obmc_gui_server_health.robot
@@ -4,10 +4,17 @@
Resource ../../lib/resource.robot
Resource ../../../../lib/boot_utils.robot
+Resource ../../../../lib/utils.robot
+Resource ../../../../lib/openbmc_ffdc.robot
+Resource ../../../../lib/state_manager.robot
+Resource ../../../../lib/openbmc_ffdc_methods.robot
+Resource ../../../../lib/dump_utils.robot
Suite Setup Launch Browser And Login OpenBMC GUI
Suite Teardown Logout And Close Browser
-Test Setup Click Element ${xpath_select_server_health}
+Test Setup Test Setup Execution
+Test Teardown Test Teardown Execution
+
*** Test Cases ***
@@ -112,3 +119,68 @@
Page Should Contain Element ${xpath_number_of_events}
${number_of_events}= Get Text ${xpath_number_of_events}
Log To Console \n Number of Events:${number_of_events}
+
+
+Select All Error Logs And Mark As Resolved
+ [Documentation] Select all error logs and mark them as resolved.
+ [Tags] Select_All_Error_Logs_And_Mark_As_Resolved
+
+ Create Test Error Log
+ Create Test Error Log
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Click Element class:control__indicator
+ Run Keyword If ${number_of_events} > 0
+ ... Click Element ${xpath_mark_as_resolved}
+ Element Should Be Disabled ${xpath_mark_as_resolved}
+
+
+Select All Error Logs And Click Export
+ [Documentation] Select all error logs and click export element.
+ [Tags] Select_All_Error_Logs_And_Click_Export
+
+ Create Test Error Log
+ Create Test Error Log
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Click Element class:control__indicator
+ Page Should Contain Element ${xpath_events_export}
+ Run Keyword If ${number_of_events} > 0
+ ... Click Element ${xpath_events_export}
+
+
+Select All Error Logs And Delete
+ [Documentation] Select all error logs and delete them.
+ [Tags] Select_All_Error_Logs_And_Delete
+
+ Create Test Error Log
+ Create Test Error Log
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Click Element class:control__indicator
+ Page Should Contain Button ${xpath_event_action_delete}
+ Run Keyword If ${number_of_events} > 0
+ ... Click Element ${xpath_event_action_delete}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Should Be Equal ${number_of_events} 0
+
+
+*** Keywords ***
+
+Test Setup Execution
+ [Documentation] Do test case setup tasks.
+ ${status}= Run Keyword And Return Status Logging Test Binary Exist
+ Run Keyword If ${status} == ${False} Install Tarball
+ Delete Error Logs And Verify
+ Click Element ${xpath_select_server_health}
+
+
+Test Teardown Execution
+ [Documentation] Do the post test teardown.
+
+ FFDC On Test Case Fail
+ Delete All Error Logs
+ Close All Connections
diff --git a/lib/utils.robot b/lib/utils.robot
index 0b08f7e..4ed025c 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -1482,3 +1482,104 @@
BMC Execute Command ${cmd}
+Get IPMI SEL Setting
+ [Documentation] Returns status for given IPMI SEL setting.
+ [Arguments] ${setting}
+ # Description of argument(s):
+ # setting SEL setting which needs to be read(e.g. "Last Add Time").
+
+ ${resp}= Run IPMI Standard Command sel info
+
+ ${setting_line}= Get Lines Containing String ${resp} ${setting}
+ ... case-insensitive
+ ${setting_status}= Fetch From Right ${setting_line} :${SPACE}
+
+ [Return] ${setting_status}
+
+
+Verify Watchdog Errorlog Content
+ [Documentation] Verify watchdog errorlog content.
+ # Example:
+ # "/xyz/openbmc_project/logging/entry/1":
+ # {
+ # "AdditionalData": [],
+ # "Id": 1,
+ # "Message": "org.open_power.Host.Boot.Error.WatchdogTimedOut",
+ # "Resolved": 0,
+ # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
+ # "Timestamp": 1492715244828,
+ # "associations": []
+ # },
+
+ ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
+ ${elog}= Read Properties ${elog_entry[0]}
+ Should Be Equal As Strings
+ ... ${elog["Message"]} org.open_power.Host.Boot.Error.WatchdogTimedOut
+ Should Be Equal As Strings
+ ... ${elog["Severity"]} xyz.openbmc_project.Logging.Entry.Level.Error
+
+
+Logging Test Binary Exist
+ [Documentation] Verify existence of prerequisite logging-test.
+ Open Connection And Log In
+ ${out} ${stderr}= Execute Command
+ ... which /tmp/tarball/bin/logging-test return_stderr=True
+ Should Be Empty ${stderr}
+ Should Contain ${out} logging-test
+
+Clear Existing Error Logs
+ [Documentation] If error log isn't empty, reboot the BMC to clear the log.
+ ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
+ Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
+ Initiate BMC Reboot
+ Wait Until Keyword Succeeds 10 min 10 sec
+ ... Is BMC Ready
+ ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
+ Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
+
+Create Test Error Log
+ [Documentation] Generate test error log.
+ # Test error log entry example:
+ # "/xyz/openbmc_project/logging/entry/1": {
+ # "AdditionalData": [
+ # "STRING=FOO"
+ # ],
+ # "Id": 1,
+ # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
+ # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
+ # "Timestamp": 1487743963328,
+ # "associations": []
+ # }
+
+ Execute Command On BMC /tmp/tarball/bin/logging-test -c AutoTestSimple
+
+Count Error Entries
+ [Documentation] Count Error entries.
+ ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}
+ Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+ ${jsondata}= To JSON ${resp.content}
+ ${count}= Get Length ${jsondata["data"]}
+ [Return] ${count}
+
+Verify Test Error Log
+ [Documentation] Verify test error log entries.
+ ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
+ ${entry_id}= Read Attribute ${elog_entry[0]} Message
+ Should Be Equal ${entry_id}
+ ... example.xyz.openbmc_project.Example.Elog.AutoTestSimple
+ ${entry_id}= Read Attribute ${elog_entry[0]} Severity
+ Should Be Equal ${entry_id}
+ ... xyz.openbmc_project.Logging.Entry.Level.Error
+
+Delete Error Logs And Verify
+ [Documentation] Delete all error logs and verify.
+ Delete All Error Logs
+ ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/list quiet=${1}
+ Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
+
+
+Install Tarball
+ [Documentation] Install tarball on BMC.
+ Run Keyword If '${DEBUG_TARBALL_PATH}' == '${EMPTY}' Return From Keyword
+ BMC Execute Command rm -rf /tmp/tarball
+ Install Debug Tarball On BMC ${DEBUG_TARBALL_PATH}