Poll for BMC errors

Test procedure:
  - Boot Host
  - Delete errors
  - Poll every 10 seconds for 48 hours
  - Check if error exists and fail on error

Resolves  openbmc/openbmc-test-automation#791

Change-Id: Ie73e62392e17039a6b0a33ff6502158e75ce0fec
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/extended/test_bmc_poll_errors.robot b/extended/test_bmc_poll_errors.robot
new file mode 100644
index 0000000..7ceed27
--- /dev/null
+++ b/extended/test_bmc_poll_errors.robot
@@ -0,0 +1,60 @@
+*** Settings ***
+Documentation     BMC error polling test to check errors every 10 seconds.
+
+Resource          ../lib/rest_client.robot
+Resource          ../lib/openbmc_ffdc.robot
+Resource          ../lib/resource.txt
+Resource          ../lib/boot_utils.robot
+
+Suite Setup      Setup The Suite
+Test Teardown    Post Test Case Execution
+
+*** Variables ***
+
+# Default duration and interval of test to run.
+${POLL_DURATION}  48 hours
+${POLL_INTERVAL}  10 second
+
+*** Test Cases ***
+
+Poll BMC For Errors
+    [Documentation]  Poll BMC for errors.
+    ...  exist.
+    [Tags]  Poll_BMC_For_Errors
+
+    Repeat Keyword  ${POLL_DURATION}
+    ...  Run Keywords  Enumerate Sensors And Check For Errors
+    ...  AND  Sleep  ${POLL_INTERVAL}
+
+*** Keywords ***
+
+Enumerate Sensors And Check For Errors
+    [Documentation]  Enumerate and check if there is any error reported.
+
+    ${resp}=  OpenBMC Get Request  /xyz/openbmc_project/sensors/
+    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK}
+
+    Error Logs Should Not Exist
+
+
+Setup The Suite
+    [Documentation]  Do test setup initialization.
+
+    Should Not Be Empty
+    ...  ${OS_HOST}  msg=You must provide hostname or IP of the OS host.
+    Should Not Be Empty
+    ...  ${OS_USERNAME}  msg=You must provide OS host user name.
+    Should Not Be Empty
+    ...  ${OS_PASSWORD}  msg=You must provide OS host user password.
+
+    # Boot to OS.
+    REST Power On
+
+    Delete Error Logs
+    Error Logs Should Not Exist
+
+Post Test Case Execution
+    [Documentation]  Do the post test teardown.
+    ...  1. Capture FFDC on test failure.
+
+    FFDC On Test Case Fail
diff --git a/lib/openbmc_ffdc_utils.robot b/lib/openbmc_ffdc_utils.robot
index 556555b..1779959 100644
--- a/lib/openbmc_ffdc_utils.robot
+++ b/lib/openbmc_ffdc_utils.robot
@@ -112,3 +112,10 @@
     Write Data To File  OPENBMC HOST \t: ${OPENBMC_HOST}${\n}
     ${model_name}=  Get BMC System Model
     Write Data To File  SYSTEM TYPE \t: ${model_name}
+
+
+Error Logs Should Not Exist
+    [Documentation]  Verify that error logs do not exist.
+
+    ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}/list  quiet=${1}
+    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND}