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_MultiTcontTests.robot b/tests/tt-workflow/Voltha_TT_MultiTcontTests.robot
index 0bcd263..3f4bafc 100755
--- a/tests/tt-workflow/Voltha_TT_MultiTcontTests.robot
+++ b/tests/tt-workflow/Voltha_TT_MultiTcontTests.robot
@@ -74,8 +74,9 @@
     [Setup]    Run Keywords    Start Logging    TcontType1Onu1
     ...        AND             Setup
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    TcontType1Onu1
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    TcontType1Onu1
     Run Keyword If    ${has_dataplane}    Clean Up Linux
     Wait Until Keyword Succeeds    ${timeout}    2s    Perform Sanity Tests TT
     # Find the ONU as required for this test
@@ -115,8 +116,9 @@
     [Setup]    Run Keywords    Start Logging    TcontType2Type4Onu1
     ...        AND             Setup
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    TcontType2Type4Onu1
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    TcontType2Type4Onu1
     Run Keyword If    ${has_dataplane}    Clean Up Linux
     Wait Until Keyword Succeeds    ${timeout}    2s    Perform Sanity Test TT
 
@@ -192,8 +194,9 @@
     [Setup]    Run Keywords    Start Logging    TcontType1Type4Onu1Onu2Onu3
     ...        AND             Setup
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    TcontType1Type4Onu1Onu2Onu3
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    TcontType1Type4Onu1Onu2Onu3
     # Push multi-tcont sadis to ONOS
     Send File To Onos    ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT-multi-tcont.json
     Run Keyword If    ${has_dataplane}    Clean Up Linux
@@ -308,8 +311,9 @@
     [Setup]    Run Keywords    Start Logging    TcontType2Onu1Type3Onu2
     ...        AND             Setup
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    TcontType2Onu1Type3Onu2
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    TcontType2Onu1Type3Onu2
     # Push multi-tcont sadis to ONOS
     Send File To Onos    ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT-multi-tcont.json
     Run Keyword If    ${has_dataplane}    Clean Up Linux
@@ -407,8 +411,9 @@
     [Setup]    Run Keywords    Start Logging    TcontType4Onu1Type5Onu2
     ...        AND             Setup
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    TcontType4Onu1Type5Onu2
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    TcontType4Onu1Type5Onu2
     Run Keyword If    ${has_dataplane}    Clean Up Linux
     Send File To Onos    ${CURDIR}/../../tests/data/flex-ocp-cord-sadis-TT-multi-tcont-1.json
     Wait Until Keyword Succeeds    ${timeout}    2s    Perform Sanity Test TT