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

Change-Id: I2e9a88ff591dfd4d178b6ed968bcc7b08446d740
diff --git a/tests/functional/Voltha_PODTests.robot b/tests/functional/Voltha_PODTests.robot
index 6871e4f..f58f9b3 100755
--- a/tests/functional/Voltha_PODTests.robot
+++ b/tests/functional/Voltha_PODTests.robot
@@ -466,8 +466,9 @@
     # Creates Devices in the Setup
     [Setup]    Start Logging    DisableONU_AuthCheck
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    DisableONU_AuthCheck
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    DisableONU_AuthCheck
     Clean WPA Process
     FOR    ${I}    IN RANGE    0    ${num_all_onus}
         ${src}=    Set Variable    ${hosts.src[${I}]}
@@ -677,8 +678,9 @@
     [Setup]    Run Keywords    Start Logging    DisableEnableOltPonPort
     ...        AND    Setup
     [Teardown]    Run Keywords    Collect Logs
-    ...           AND             Stop Logging    DisableEnableOltPonPort
     ...           AND             Delete All Devices and Verify
+    ...           AND             Run Keyword If    ${logging}    Collect Logs
+    ...           AND             Stop Logging    DisableEnableOltPonPort
     Run Keyword If    ${has_dataplane}    Clean Up Linux
     Wait Until Keyword Succeeds    ${timeout}    2s    Perform Sanity Test
     # Multi-OLTs