Fix association and error log tests

Fixes:
   - Install tarball if not installed.
   - Remove installing tarball from __init__.txt.

Resolve  openbmc/openbmc-test-automation#976

Change-Id: I15a10948dce9fd9f0ddb9a2c9345f461d282ed6f
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/__init__.robot b/tests/__init__.robot
index b99cb42..2ff43e2 100644
--- a/tests/__init__.robot
+++ b/tests/__init__.robot
@@ -22,9 +22,6 @@
     Run Keyword And Ignore Error  Log PNOR Driver Details
     Run Keyword And Ignore Error  Log BMC Model
     Run Keyword And Ignore Error  Enable Core Dump On BMC
-    Run Keyword If  '${DEBUG_TARBALL_PATH}' != '${EMPTY}'
-    ...   Run Keyword And Ignore Error
-    ...   Install Debug Tarball On BMC  ${DEBUG_TARBALL_PATH}
 
 Log BMC Driver Details
     [Documentation]   Get BMC driver details and log.
diff --git a/tests/test_association.robot b/tests/test_association.robot
index 55ead3e..0b33627 100755
--- a/tests/test_association.robot
+++ b/tests/test_association.robot
@@ -5,17 +5,16 @@
 Resource            ../lib/openbmc_ffdc.robot
 Resource            ../lib/utils.robot
 Resource            ../lib/state_manager.robot
+Resource            ../lib/boot_utils.robot
 
-Suite Setup         Run Keywords  Verify callout-test  AND
-...                 Boot Host
-Test Setup          Clear Existing Error Logs
-
+Test Setup          Test Setup Execution
 Test Teardown       Close All Connections
-Suite Teardown      Clear Existing Error Logs
 
 ***Variables***
 ${target_device_path}  /sys/devices/platform/gpio-fsi/fsi0/slave@00:00/raw
 
+${stack_mode}          skip
+
 *** Test Cases ***
 
 Create Test Error Callout And Verify
@@ -207,22 +206,15 @@
 
 *** Keywords ***
 
-Verify callout-test
+Callout Test Binary Exist
     [Documentation]  Verify existence of prerequisite callout-test.
 
     Open Connection And Log In
-    ${out}  ${stderr}=  Execute Command  which callout-test  return_stderr=True
+    ${out}  ${stderr}=  Execute Command
+    ...  which /tmp/tarball/bin/callout-test  return_stderr=True
     Should Be Empty  ${stderr}
     Should Contain  ${out}  callout-test
 
-Clear Existing Error Logs
-    [Documentation]  If error log isn't empty, restart the logging service on
-    ...              the BMC
-
-    Open Connection And Log In
-    Delete Error Logs
-    ${resp}=  OpenBMC Get Request  /xyz/openbmc_project/logging/entry/
-    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND}
 
 Create Test Error With Callout
     [Documentation]  Generate test error log with callout for CPU0.
@@ -254,7 +246,7 @@
     # },
 
     Execute Command On BMC
-    ...  callout-test ${target_device_path}
+    ...  /tmp/tarball/bin/callout-test ${target_device_path}
 
 Verify Test Error Log And Callout
     [Documentation]  Verify test error log entries.
@@ -272,8 +264,20 @@
     Should Be Equal  ${content[0]}
     ...  /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
 
-Boot Host
-    [Documentation]  Boot the host if current state is "Off".
-    ${current_state}=  Get Host State
-    Run Keyword If  '${current_state}' == 'Off'
-    ...  Initiate Host Boot
+
+Test Setup Execution
+   [Documentation]  Do test case setup tasks.
+
+   REST Power On
+   ${status}=  Run Keyword And Return Status  Callout Test Binary Exist
+   Run Keyword If  ${status} == ${False}  Install Tarball
+   Delete Error Logs
+
+
+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}
+
diff --git a/tests/test_error_log.robot b/tests/test_error_log.robot
index db72112..dfabfc3 100644
--- a/tests/test_error_log.robot
+++ b/tests/test_error_log.robot
@@ -8,9 +8,7 @@
 Resource            ../lib/ipmi_client.robot
 Resource            ../lib/boot_utils.robot
 
-Suite Setup         Run Keywords  Verify logging-test  AND
-...                 Delete Error Logs And Verify
-Test Setup          Open Connection And Log In
+Test Setup          Test Setup Execution
 Test Teardown       Post Test Case Execution
 Suite Teardown      Delete Error Logs And Verify
 
@@ -336,7 +334,7 @@
 
     Delete Error Logs And Verify
     ${cmd}=  Set Variable
-    ...  for i in {1..101}; do logging-test -c AutoTestSimple;done
+    ...  for i in {1..101}; do /tmp/tarball/bin/logging-test -c AutoTestSimple;done
     Execute Command On BMC  ${cmd}
     ${count}=  Count Error Entries
     Run Keyword If  ${count} > 100
@@ -381,11 +379,12 @@
     ...  ${elog["Severity"]}  xyz.openbmc_project.Logging.Entry.Level.Informational
 
 
-Verify logging-test
+Logging Test Binary Exist
     [Documentation]  Verify existence of prerequisite logging-test.
 
     Open Connection And Log In
-    ${out}  ${stderr}=  Execute Command  which logging-test  return_stderr=True
+    ${out}  ${stderr}=  Execute Command
+    ...  which /tmp/tarball/bin/logging-test  return_stderr=True
     Should Be Empty  ${stderr}
     Should Contain  ${out}  logging-test
 
@@ -415,7 +414,7 @@
     #     "associations": []
     # }
 
-    Execute Command On BMC  logging-test -c AutoTestSimple
+    Execute Command On BMC  /tmp/tarball/bin/logging-test -c AutoTestSimple
 
 Count Error Entries
     [Documentation]  Count Error entries.
@@ -443,6 +442,23 @@
     ${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.
+
+   ${status}=  Run Keyword And Return Status  Logging Test Binary Exist
+   Run Keyword If  ${status} == ${False}  Install Tarball
+   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}
+
+
 Post Test Case Execution
    [Documentation]  Do the post test teardown.
    # 1. Capture FFDC on test failure.