[VOL-4139] OLT Flow Validation Failure in Disable and Delete OLT TC for TT

Change-Id: I8a1327a51cef3b11b2c2230f5bd273a98bc11057
diff --git a/libraries/onos.robot b/libraries/onos.robot
index 4e68927..f2e7a27 100755
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -258,6 +258,13 @@
     ...    flows -s ADDED ${olt_of_id} | grep -v deviceId | grep -v ETH_TYPE:lldp | grep -v ETH_TYPE:arp | wc -l
     Should Be Equal As Integers    ${access_flows_added}    ${expected_flows}
 
+Verify Added Flow Count for OLT TT
+    [Arguments]    ${ip}    ${port}    ${olt_of_id}    ${expected_flows}
+    [Documentation]    Total number of added flows given OLT with subscriber flows
+    ${access_flows_added}=    Execute ONOS CLI Command    ${ip}    ${port}
+    ...    flows -s ADDED ${olt_of_id} | grep -v deviceId | wc -l
+    Should Be Equal As Integers    ${access_flows_added}    ${expected_flows}
+
 Verify Default Downstream Flows are added in ONOS for OLT TT
     [Arguments]    ${ip}    ${port}    ${olt_of_id}    ${nni_port}
     [Documentation]    Verifies if the Default Downstream Flows are added in ONOS for the OLT
diff --git a/tests/dt-workflow/Voltha_DT_PODTests.robot b/tests/dt-workflow/Voltha_DT_PODTests.robot
index be3c297..9547077 100644
--- a/tests/dt-workflow/Voltha_DT_PODTests.robot
+++ b/tests/dt-workflow/Voltha_DT_PODTests.robot
@@ -256,8 +256,6 @@
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Validate OLT Device    DISABLED    UNKNOWN    REACHABLE
         ...    ${olt_serial_number}
-        Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    DISABLED    UNKNOWN    REACHABLE
-        ...    ${olt_serial_number}
         ${num_onus}=    Set Variable    ${list_olts}[${I}][onucount]
         # Validate ONUs
         Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate ONUs After OLT Disable
diff --git a/tests/tt-workflow/Voltha_TT_PODTests.robot b/tests/tt-workflow/Voltha_TT_PODTests.robot
index 619b28f..e9299ff 100755
--- a/tests/tt-workflow/Voltha_TT_PODTests.robot
+++ b/tests/tt-workflow/Voltha_TT_PODTests.robot
@@ -108,10 +108,19 @@
     ...    Assuming that all the ONUs are DHCP/pingable (i.e. assuming sanityTt 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 TT
-    [Tags]    functionalTT    DisableDeleteOLTTt    notready
+    [Tags]    functionalTT    DisableDeleteOLTTt
     [Setup]    Start Logging    DisableDeleteOLTTt
     [Teardown]    Run Keywords    Collect Logs
     ...           AND             Stop Logging    DisableDeleteOLTTt
+    @{particular_onu_device_port}=      Create List
+        FOR   ${I}    IN RANGE    0    ${num_all_onus}
+            ${src}=    Set Variable    ${hosts.src[${I}]}
+            ${onu_port}=    Wait Until Keyword Succeeds    ${timeout}    2s    Get ONU Port in ONOS    ${src['onu']}
+            ...    ${of_id}
+            Append To List  ${particular_onu_device_port}    ${onu_port}
+        END
+        ${list_onu_port}=    Remove Duplicates    ${particular_onu_device_port}
+        ${num_of_provisioned_onus}=    Get Length  ${list_onu_port}
     # Disable and Validate OLT Device
     FOR   ${I}    IN RANGE    0    ${olt_count}
         ${olt_serial_number}=    Get From Dictionary    ${olt_ids}[${I}]    sn
@@ -121,23 +130,21 @@
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Validate OLT Device    DISABLED    UNKNOWN    REACHABLE
         ...    ${olt_serial_number}
-        Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Device    DISABLED    UNKNOWN    REACHABLE
-        ...    ${olt_serial_number}
         ${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}    ${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}
+        # Number of Access Flows on ONOS equals 16 * the Number of Active ONUs + 3 for default LLDP, IGMP and DHCP
+        ${onos_flows_count}=    Evaluate    16 * ${num_of_provisioned_onus} + 3
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
-        ...    Verify Default Downstream Flows are added in ONOS for OLT TT    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
-        ...    ${nni_port}
+        ...    Verify Added Flow Count for OLT TT    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
+        ...    ${onos_flows_count}
         # Verify VOLTHA Flows
-        # Number of per OLT Flows equals Twice the Number of Active ONUs (each for downstream and upstream) + 1 for LLDP
-        ${olt_flows}=    Evaluate    2 * ${num_onus} + 1
-        # Number of per ONU Flows equals 2 (one each for downstream and upstream)
-        ${onu_flows}=    Set Variable    2
+        # Number of per OLT Flows equals 10 * Number of Active ONUs  + 3 for default LLDP, IGMP and DHCP
+        ${olt_flows}=    Evaluate    10 * ${num_of_provisioned_onus} + 3
+        # Number of per ONU Flows equals 6 for 3play service data plane + 4 for Trap to Host Flows
+        ${onu_flows}=    Set Variable    10
         Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Flows    ${olt_flows}
         ...    ${olt_device_id}
         ${List_ONU_Serial}    Create List