VOL-4334: Fix robot tests that stop logging prematurely when Delete Device
          is involved in TearDown step

Change-Id: I2e9a88ff591dfd4d178b6ed968bcc7b08446d740
diff --git a/tests/tt-workflow/Voltha_TT_FailureScenarios.robot b/tests/tt-workflow/Voltha_TT_FailureScenarios.robot
index 0ec2909..46ba95d 100755
--- a/tests/tt-workflow/Voltha_TT_FailureScenarios.robot
+++ b/tests/tt-workflow/Voltha_TT_FailureScenarios.robot
@@ -71,8 +71,9 @@
     [Tags]    functionalTT    PowerSwitchOnuRebootTT    PowerSwitch
     [Setup]    Start Logging    RebootOnu_PowerSwitch_TT
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    RebootOnu_PowerSwitch_TT
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    RebootOnu_PowerSwitch_TT
     # Add OLT device
     Setup
     # Performing Sanity Test to make sure subscribers are all DHCP and pingable
@@ -129,8 +130,9 @@
     [Tags]    functionalTT    PhysicalOltRebootTT
     [Setup]    Start Logging    RebootOlt_Physical_TT
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    RebootOlt_Physical_TT
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    RebootOlt_Physical_TT
     # Add OLT device
     Setup
     # Performing Sanity Test to make sure subscribers are all DHCP and pingable
@@ -177,8 +179,9 @@
     [Tags]    functionalTT    OnuSoftRebootTT
     [Setup]    Start Logging    SoftRebootOnu_TT
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    SoftRebootOnu_TT
     ...           AND             Delete All Devices and Verify
+    ...           AND             Collect Logs
+    ...           AND             Stop Logging    SoftRebootOnu_TT
     # Add OLT device
     Setup
     # Performing Sanity Test to make sure subscribers are all DHCP and pingable
@@ -229,8 +232,9 @@
     [Tags]    functionalTT    OltSoftRebootTT
     [Setup]    Start Logging    SoftRebootOlt_TT
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    SoftRebootOlt_TT
     ...           AND             Delete All Devices and Verify
+    ...           AND             Collect Logs
+    ...           AND             Stop Logging    SoftRebootOlt_TT
     # Add OLT device
     Setup
     # Performing Sanity Test to make sure subscribers are all DHCP and pingable
@@ -278,8 +282,9 @@
     [Tags]    functionalTT    Restart-OpenOnu-TT
     [Setup]    Start Logging    Restart-OpenOnu-TT
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    Restart-OpenOnu-TT
     ...           AND             Delete All Devices and Verify
+    ...           AND             Collect Logs
+    ...           AND             Stop Logging    Restart-OpenOnu-TT
     # Add OLT device
     Setup
     # Performing Sanity Test to make sure subscribers are all DHCP and pingable
@@ -306,8 +311,9 @@
     [Tags]    functionalTT    Restart-OpenOlt-Before-Subscription-TT
     [Setup]    Start Logging    Restart-OpenOlt-Before-Subscription-TT
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    Restart-OpenOlt-Before-Subscription-TT
     ...           AND             Delete All Devices and Verify
+    ...           AND             Collect Logs
+    ...           AND             Stop Logging    Restart-OpenOlt-Before-Subscription-TT
     # Add OLT device
     Setup
     Run Keyword If    ${has_dataplane}    Clean Up Linux