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

Change-Id: I2e9a88ff591dfd4d178b6ed968bcc7b08446d740
diff --git a/tests/dt-workflow/Voltha_DT_FailureScenarios.robot b/tests/dt-workflow/Voltha_DT_FailureScenarios.robot
index ccd7106..d9cba37 100755
--- a/tests/dt-workflow/Voltha_DT_FailureScenarios.robot
+++ b/tests/dt-workflow/Voltha_DT_FailureScenarios.robot
@@ -72,8 +72,9 @@
     [Tags]    functionalDt    PowerSwitchOnuRebootDt    VOL-2819    PowerSwitch
     [Setup]    Start Logging    RebootOnu_PowerSwitch_Dt
     [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
-    ...           AND             Stop Logging    RebootOnu_PowerSwitch_Dt
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    RebootOnu_PowerSwitch_Dt
     # Add OLT device
     Setup
     # Performing Sanity Test to make sure subscribers are all DHCP and pingable
@@ -137,8 +138,9 @@
     [Tags]    functionalDt   PhysicalOltRebootDt   VOL-2817
     [Setup]    Start Logging    RebootOlt_Physical_Dt
     [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
-    ...           AND             Stop Logging    RebootOlt_Physical_Dt
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    RebootOlt_Physical_Dt
     # Add OLT device
     Setup
     # Performing Sanity Test to make sure subscribers are all DHCP and pingable
diff --git a/tests/dt-workflow/Voltha_DT_MultiOLT_Tests.robot b/tests/dt-workflow/Voltha_DT_MultiOLT_Tests.robot
index 91af1c9..8a92269 100644
--- a/tests/dt-workflow/Voltha_DT_MultiOLT_Tests.robot
+++ b/tests/dt-workflow/Voltha_DT_MultiOLT_Tests.robot
@@ -119,8 +119,9 @@
     [Tags]    MultiOLTSoftRebootDt    functionalDt
     [Setup]    Start Logging    MultiOLTSoftRebootDt
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    MultiOLTSoftRebootDt
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    MultiOLTSoftRebootDt
     Pass Execution If    ${olt_count} == 1    Skipping test: just one OLT
     Clear All Devices Then Perform Setup And Sanity
     # Reboot the first OLT