[VOL-4072] Added BBSim Device Creation to mock load on Soak Pod for DT and Soak specific Pre-Test Setup in DT Failure Suite

Change-Id: I7cb6576431418299cab46d8fae0039236987dd53
diff --git a/tests/dt-workflow/Voltha_DT_FailureScenarios.robot b/tests/dt-workflow/Voltha_DT_FailureScenarios.robot
index 7389f51..0aef9c0 100755
--- a/tests/dt-workflow/Voltha_DT_FailureScenarios.robot
+++ b/tests/dt-workflow/Voltha_DT_FailureScenarios.robot
@@ -55,6 +55,9 @@
 # Per-test logging on failure is turned off by default; set this variable to enable
 ${container_log_dir}    ${None}
 
+# Flag specific to Soak Jobs
+${SOAK_TEST}    False
+
 *** Test Cases ***
 Verify ONU after Rebooting Physically for DT
     [Documentation]    Test the ONU functionality by physically turning on/off ONU.
@@ -235,7 +238,7 @@
     ...    simulate a POD crash. The test then scales the rw-core back to a single instance
     ...    and configures ONOS for access. The test succeeds if the device is able to
     ...    complete the DHCP sequence.
-    [Tags]    functionalDt    olt-adapter-restart-Dt
+    [Tags]    functionalDt    olt-adapter-restart-Dt    soak
     [Setup]    Start Logging    OltAdapterRestart-Dt
     #...        AND             Clear All Devices Then Create New Device
     [Teardown]   Run Keywords    Collect Logs
@@ -299,7 +302,7 @@
 Verify restart ofagent container after subscriber is provisioned for DT
     [Documentation]    Restart ofagent container after VOLTHA is operational.
     ...    Prerequisite : ONUs are authenticated and pingable.
-    [Tags]    functionalDt   ofagentRestart-Dt
+    [Tags]    functionalDt   ofagentRestart-Dt    soak
     [Setup]    Start Logging    ofagentRestart-Dt
     [Teardown]    Run Keywords    Collect Logs
     ...           AND             Stop Logging    ofagentRestart-Dt
@@ -362,7 +365,7 @@
     ...    simulate a POD crash. The test then scales the rw-core back to a single instance
     ...    and configures ONOS for access. The test succeeds if the device is able to
     ...    complete the DHCP sequence.
-    [Tags]    functionalDt    rwcore-restart-Dt
+    [Tags]    functionalDt    rwcore-restart-Dt    soak
     [Setup]    Run Keywords    Start Logging    RwCoreFailAndRestart-Dt
     ...        AND             Clear All Devices Then Create New Device
     [Teardown]   Run Keywords    Collect Logs
@@ -535,12 +538,34 @@
     ...    ${List_ONU_Serial}    ${onu_flows}
 
 *** Keywords ***
+Setup Soak
+    [Documentation]    Pre-test Setup for Soak Job
+    ${olt_ids}    Create List
+    FOR    ${I}    IN RANGE    0    ${num_olts}
+        ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
+        ${olt_device_id}=    Get Device ID From SN    ${olt_serial_number}
+        ${logical_id}=    Get Logical Device ID From SN    ${olt_serial_number}
+        ${of_id}=    Wait Until Keyword Succeeds    ${timeout}    15s    Validate OLT Device in ONOS
+        ...    ${olt_serial_number}
+        ${nni_port}=    Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    2s
+        ...    Get NNI Port in ONOS    ${of_id}
+        Set Global Variable    ${nni_port}
+        ${olt}    Create Dictionary    device_id    ${olt_device_id}    logical_id    ${logical_id}
+        ...    of_id    ${of_id}    sn    ${olt_serial_number}
+        Append To List    ${olt_ids}    ${olt}
+    END
+    Set Global Variable    ${olt_ids}
+
 Setup Suite
     [Documentation]    Set up the test suite
     Common Test Suite Setup
     #power_switch.robot needs it to support different vendor's power switch
     ${switch_type}=    Get Variable Value    ${web_power_switch.type}
     Run Keyword If  "${switch_type}"!=""    Set Global Variable    ${powerswitch_type}    ${switch_type}
+    # Run Pre-test Setup for Soak Job
+    # Note: As soak requirement, it expects that the devices under test are already created and enabled
+    Run Keyword If    '${SOAK_TEST}'=='True'    Setup Soak
+
 
 Clear All Devices Then Create New Device
     [Documentation]    Remove any devices from VOLTHA and ONOS