[VOL-4115] Added more scenarios to DT Soak testing, and logging flag to enable/disable Collect Logs

Change-Id: Ieecd5aa63716f38a84d845274b4657f679e6c3e1
diff --git a/tests/dt-workflow/Voltha_DT_PODTests.robot b/tests/dt-workflow/Voltha_DT_PODTests.robot
index 7f03385..378b673 100644
--- a/tests/dt-workflow/Voltha_DT_PODTests.robot
+++ b/tests/dt-workflow/Voltha_DT_PODTests.robot
@@ -63,6 +63,10 @@
 # Per-test logging on failure is turned off by default; set this variable to enable
 ${container_log_dir}    ${None}
 
+# logging flag to enable Collect Logs, can be passed via the command line too
+# example: -v logging:False
+${logging}    True
+
 # Flag specific to Soak Jobs
 ${SOAK_TEST}    False
 ${bbsim_port}    50060
@@ -74,7 +78,7 @@
     ...    controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
     [Tags]    functionalDt   PowerSwitch    RebootAllDTONUs    soak
     [Setup]    Start Logging    RebootAllDTONUs
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    RebootAllDTONUs
     Power Switch Connection Suite    ${web_power_switch.ip}    ${web_power_switch.user}    ${web_power_switch.password}
     FOR    ${I}    IN RANGE    0    ${num_all_onus}
@@ -91,7 +95,7 @@
     ...    but only to mock the load on Soak POD.
     [Tags]    soak
     [Setup]    Start Logging    soakPodCreateBBSimLoad
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    soakPodCreateBBSimLoad
     ${num_bbsim}    Get Length    ${bbsim}
     FOR    ${I}    IN RANGE    0    ${num_bbsim}
@@ -119,7 +123,7 @@
     ...    Inner vlans from the RG should not change
     [Tags]    sanityDt   soak
     [Setup]    Start Logging    SanityTestDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    SanityTestDt
     Setup    ${SOAK_TEST}
     Run Keyword If    ${has_dataplane}    Clean Up Linux
@@ -133,7 +137,7 @@
     ...    Re-add the subscriber, and validate that the flows are present and pings are successful
     [Tags]    functionalDt    SubAddDeleteDt    soak
     [Setup]    Start Logging     SubAddDeleteDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    SubAddDeleteDt
     FOR    ${I}    IN RANGE    0    ${num_all_onus}
         ${src}=    Set Variable    ${hosts.src[${I}]}
@@ -200,7 +204,7 @@
     ...    Perform enable on the ONUs and validate that the pings are successful
     [Tags]    functionalDt    DisableEnableONUDt    soak
     [Setup]    Start Logging    DisableEnableONUDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    DisableEnableONUDt
     FOR    ${I}    IN RANGE    0    ${num_all_onus}
         ${src}=    Set Variable    ${hosts.src[${I}]}
@@ -239,9 +243,9 @@
     ...    Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
     ...    Perform disable on the OLT and validate ONUs state and that the pings do not succeed
     ...    Perform delete on the OLT, Re-do Setup (Recreate the OLT) and Perform Sanity Test DT
-    [Tags]    functionalDt    DisableDeleteOLTDt
+    [Tags]    functionalDt    DisableDeleteOLTDt    soak
     [Setup]    Start Logging    DisableDeleteOLTDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    DisableDeleteOLTDt
     # Disable and Validate OLT Device
     FOR   ${I}    IN RANGE    0    ${olt_count}
@@ -288,7 +292,7 @@
         ...    Verify Device Flows Removed    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
     END
     # Re-do Setup (Recreate the OLT) and Perform Sanity Test DT
-    Run Keyword    Setup
+    Run Keyword    Setup    ${SOAK_TEST}
     Run Keyword If    ${has_dataplane}    Clean Up Linux
     Wait Until Keyword Succeeds    ${timeout}   2s    Perform Sanity Test DT
     #Run Keyword If    ${has_dataplane}    Clean Up Linux
@@ -300,7 +304,7 @@
     ...    Perform enable on the OLT and validate that the pings are successful
     [Tags]    functionalDt    DisableEnableOLTDt   soak
     [Setup]    Start Logging    DisableEnableOLTDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    DisableEnableOLTDt
     # Disable and Validate OLT Device
     FOR   ${I}    IN RANGE    0    ${olt_count}
@@ -355,9 +359,9 @@
     ...    Disable and Delete the OLT
     ...    Create/Enable the same OLT again
     ...    Validate DHCP/E2E pings succeed for all the ONUs connected to the OLT
-    [Tags]    functionalDt    DeleteReAddOLTDt
+    [Tags]    functionalDt    DeleteReAddOLTDt    soak
     [Setup]    Start Logging    DeleteReAddOLTDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    DeleteReAddOLTDt
     FOR    ${I}    IN RANGE    0    ${olt_count}
         ${olt_serial_number}=    Get From Dictionary    ${olt_ids}[${I}]    sn
@@ -367,7 +371,7 @@
         ...    Verify Device Flows Removed    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
     END
     # Recreate the OLTs
-    Setup
+    Setup    ${SOAK_TEST}
     Run Keyword If    ${has_dataplane}    Clean Up Linux
     Wait Until Keyword Succeeds    ${timeout}   2s    Perform Sanity Test DT
 
@@ -378,7 +382,7 @@
     ...    so calling setup at the end to add the devices back to avoid the confusion.
     [Tags]    functionalDt    DisableDeleteONUOLTDt
     [Setup]    Start Logging    DisableDeleteONUOLTDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    DisableDeleteONUOLTDt
     @{onu_reason}=    Create List    initial-mib-downloaded    omci-flows-pushed
     FOR    ${I}    IN RANGE    0    ${num_all_onus}
@@ -441,7 +445,7 @@
     ...    Assumes iperf3 and jq installed on client and iperf -s running on DHCP server
     [Tags]    dataplaneDt    BandwidthProfileTCPDt    VOL-3061    soakDataplane
     [Setup]    Start Logging    BandwidthProfileTCPDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND    Stop Logging    BandwidthProfileTCPDt
     Pass Execution If   '${has_dataplane}'=='False'    Bandwidth profile validation can be done only in
     ...    physical pod.  Skipping this test in BBSIM.
@@ -502,7 +506,7 @@
     ...    Assumes iperf3 and jq installed on client and iperf -s running on DHCP server
     [Tags]    dataplaneDt    BandwidthProfileUDPDt    VOL-3061    soakDataplane
     [Setup]    Start Logging    BandwidthProfileUDPDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND    Stop Logging    BandwidthProfileUDPDt
     Pass Execution If   '${has_dataplane}'=='False'    Bandwidth profile validation can be done only in
     ...    physical pod.  Skipping this test in BBSIM.
@@ -573,7 +577,7 @@
     ...    the pbits are preserved by the PON.
     [Tags]    dataplaneDt    TechProfileDt    VOL-3291    soakDataplane
     [Setup]    Start Logging    TechProfileDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND    Stop Logging    TechProfileDt
     Pass Execution If   '${has_dataplane}'=='False'
     ...    Skipping test: Technology profile validation can be done only in physical pod
@@ -618,9 +622,9 @@
     ...    Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityDt test was executed)
     ...    Perform disable on the OLT PON Port and validate that the pings do not succeed
     ...    Perform enable on the OLT PON Port and validate that the pings are successful
-    [Tags]    functionalDt    DisableEnableOltPonPortDt    VOL-2577
+    [Tags]    functionalDt    DisableEnableOltPonPortDt    VOL-2577    soak
     [Setup]    Start Logging    DisableEnableOltPonPortDt
-    [Teardown]    Run Keywords    Collect Logs
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...           AND             Stop Logging    DisableEnableOltPonPortDt
     FOR   ${I}    IN RANGE    0    ${olt_count}
         ${olt_serial_number}=    Get From Dictionary    ${olt_ids}[${I}]    sn