[VOL-3641] Checking OLT removed based on serial number and ONUs disabled for correct OLT

Change-Id: I302c20afcfe33d1dd919b07e414656c11a07f784
diff --git a/libraries/utils.robot b/libraries/utils.robot
index 7f161d2..6e6a8cb 100644
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -601,10 +601,11 @@
 Validate ONUs After OLT Disable
     [Documentation]    Validates the ONUs state in Voltha, ONUs port state in ONOS
     ...    and that pings do not succeed After corresponding OLT is Disabled
-    [Arguments]      ${num_onus}
+    [Arguments]      ${num_onus}    ${olt_serial_number}
     FOR    ${I}    IN RANGE    0    ${num_onus}
         ${src}=    Set Variable    ${hosts.src[${I}]}
         ${dst}=    Set Variable    ${hosts.dst[${I}]}
+        Continue For Loop If    "${olt_serial_number}"!="${src['olt']}"
         ${of_id}=    Get ofID From OLT List    ${src['olt']}
         ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
         ${onu_port}=    Wait Until Keyword Succeeds    ${timeout}    2s    Get ONU Port in ONOS    ${src['onu']}
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index 59b85f9..a7158d6 100755
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -715,6 +715,16 @@
     END
     List Should Not Contain Value    ${ids}    ${id}
 
+Validate all ONUS for OLT Removed
+    [Arguments]    ${num_all_onus}    ${hosts}    ${olt_serial_number}    ${timeout}
+    [Documentation]    Verifys that all the ONUS for OLT ${serial_number}, has been removed
+    FOR    ${J}    IN RANGE    0    ${num_all_onus}
+        ${src}=    Set Variable    ${hosts.src[${J}]}
+        Continue For Loop If    "${olt_serial_number}"!="${src['olt']}"
+        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
+        ...    Validate Device Removed    ${src['onu']}
+    END
+
 Reboot ONU
     [Arguments]    ${onu_id}    ${validate_device}=True
     [Documentation]   Using voltctl command reboot ONU and verify that ONU comes up to running state
diff --git a/tests/dt-workflow/Voltha_DT_PODTests.robot b/tests/dt-workflow/Voltha_DT_PODTests.robot
index e08410a..8e7083c 100644
--- a/tests/dt-workflow/Voltha_DT_PODTests.robot
+++ b/tests/dt-workflow/Voltha_DT_PODTests.robot
@@ -252,7 +252,7 @@
         ${num_onus}=    Set Variable    ${list_olts}[${I}][onucount]
         # Validate ONUs
         Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate ONUs After OLT Disable
-        ...    ${num_onus}
+        ...    ${num_onus}    ${olt_serial_number}
         # Verify ONOS Flows
         # Number of Access Flows on ONOS equals 4 * the Number of Active ONUs (2 for each downstream and upstream)
         ${onos_flows_count}=    Evaluate    4 * ${num_onus}
@@ -274,7 +274,11 @@
         ...    ${List_ONU_Serial}    ${onu_flows}
         # Delete OLT and Validate Empty Device List
         Delete Device    ${olt_device_id}
-        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s    Test Empty Device List
+        # Check that the OLT and the ONUs are actually removed from the system
+        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device Removed
+        ...    ${olt_serial_number}
+        Run Keyword and Continue On Failure    Validate all ONUS for OLT Removed    ${num_all_onus}    ${hosts}
+        ...    ${olt_serial_number}    ${timeout}
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Verify Device Flows Removed    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
         Run Keyword and Ignore Error    Collect Logs