Revert "Checking that no flows are provisioned on a disabled device"

This reverts commit 8b6dc263eca0b35d595f21a1ae62d74e879e95fc.

Revert "fix disable onu reason for all workflows"

This reverts commit 0ec95eb9e0142bc7298133c1334082ce772d184a.

Revert no flows provisioned on disabled device

Change-Id: I96ea99b6ce977d3902216780bcfe01ddcbcfd460
diff --git a/libraries/utils.robot b/libraries/utils.robot
index 27e0c81..234f5a7 100755
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -339,6 +339,7 @@
         ...    ${onu_port}    ${nni_port}    ${src['s_tag']}
         # Verify ONU state in voltha
         ${onu_reasons}=  Create List     omci-flows-pushed
+        Run Keyword If    ${supress_add_subscriber}    Append To List    ${onu_reasons}    onu-reenabled
         Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device
         ...    ENABLED    ACTIVE    REACHABLE
         ...    ${src['onu']}    onu=True    onu_reason=${onu_reasons}
@@ -399,6 +400,7 @@
         ...    ${onu_port}    ${src['service']}
         # Verify ONU state in voltha
         ${onu_reasons}=  Create List     omci-flows-pushed
+        Run Keyword If    ${supress_add_subscriber}    Append To List    ${onu_reasons}    onu-reenabled
         Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device
         ...    ENABLED    ACTIVE    REACHABLE
         ...    ${src['onu']}    onu=True    onu_reason=${onu_reasons}
diff --git a/tests/dt-workflow/Voltha_DT_PODTests.robot b/tests/dt-workflow/Voltha_DT_PODTests.robot
index 11fc497..9991d4c 100755
--- a/tests/dt-workflow/Voltha_DT_PODTests.robot
+++ b/tests/dt-workflow/Voltha_DT_PODTests.robot
@@ -275,20 +275,24 @@
         Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate ONUs After OLT Disable
         ...    ${num_onus}    ${olt_serial_number}
         # Verify ONOS Flows
-        # When we disable the device we shouldn't have any flows provisioned on it
+        # 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}
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Verify Subscriber Access Flows Added Count DT    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
-        ...    ${of_id}    0
+        ...    ${of_id}    ${onos_flows_count}
         # Verify VOLTHA Flows
-        # OLT should only have 1 default flow for LLDP
-        Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Flows    1
-        ...    ${olt_device_id}
+        # 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
+        Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Flows
+        ...    ${olt_flows}    ${olt_device_id}
         ${List_ONU_Serial}    Create List
         Set Suite Variable    ${List_ONU_Serial}
         Build ONU SN List    ${List_ONU_Serial}    ${olt_serial_number}    ${num_onus}
         Log    ${List_ONU_Serial}
         Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate ONU Flows
-        ...    ${List_ONU_Serial}    0
+        ...    ${List_ONU_Serial}    ${onu_flows}
         # Delete OLT and Validate Empty Device List
         Delete Device    ${olt_device_id}
         # Check that the OLT and the ONUs are actually removed from the system
diff --git a/tests/openonu-go-adapter/Voltha_ONUMibAudit.robot b/tests/openonu-go-adapter/Voltha_ONUMibAudit.robot
index 618d0d2..c68a0c0 100755
--- a/tests/openonu-go-adapter/Voltha_ONUMibAudit.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUMibAudit.robot
@@ -116,7 +116,11 @@
         ...    ELSE       Perform Sanity Test    ${suppressaddsubscriber}
         Run Keyword If    ${print2console}    Log    Disable ONUs.    console=yes
         Disable Onu Device
-        Current State Test All Onus    tech-profile-config-delete-success
+        ${alternativeonustates}=  Create List     omci-flows-deleted
+        Run Keyword If    "${workflow}"=="DT"    Current State Test All Onus    omci-admin-lock
+        ...    ELSE IF    "${workflow}"=="TT"    Current State Test All Onus    omci-admin-lock
+        ...    ELSE       Current State Test All Onus    omci-admin-lock    alternativeonustate=${alternativeonustates}
+        #check all ports are disabled in ONOS
         Wait for all ONU Ports in ONOS Disabled    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${unitag_sub}
         Run Keyword If    ${print2console}    Log    Enable ONUs.    console=yes
         Enable Onu Device
diff --git a/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot b/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
index 010d05d..51b82bc 100755
--- a/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
@@ -378,7 +378,10 @@
     ...    ELSE IF    "${workflow}"=="TT"    Perform Sanity Tests TT
     ...    ELSE       Perform Sanity Test
     Disable Onu Device
-    Current State Test All Onus    tech-profile-config-delete-success
+    ${alternativeonustates}=  Create List     omci-flows-deleted
+    Run Keyword If    "${workflow}"=="DT"    Current State Test All Onus    omci-admin-lock
+    ...    ELSE IF    "${workflow}"=="TT"    Current State Test All Onus    omci-admin-lock
+    ...    ELSE       Current State Test All Onus    omci-admin-lock    alternativeonustate=${alternativeonustates}
     #check no port is enabled in ONOS
     Wait for Ports in ONOS for all OLTs    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    0    BBSM
     Wait for all ONU Ports in ONOS Disabled    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${unitag_sub}
@@ -387,11 +390,13 @@
     Build ONU SN List    ${List_ONU_Serial}
     FOR  ${onu_sn}  IN  @{List_ONU_Serial}
         Wait Until Keyword Succeeds    ${timeout}    2s    Validate Tech Profiles and Flows in ETCD Data Per Onu
-        ...    ${onu_sn}   ${INFRA_NAMESPACE}   ${kvstoreprefix}  must_exist=False    check_tcont_map_empty=True
+        ...    ${onu_sn}   ${INFRA_NAMESPACE}   ${kvstoreprefix}  must_exist=True    check_tcont_map_empty=False
         ...    check_default_flow_att=False
     END
     Reconcile Onu Adapter    ${NAMESPACE}    ${usekill2restart}    UNKNOWN
-    Current State Test All Onus    tech-profile-config-delete-success
+    Run Keyword If    "${workflow}"=="DT"    Current State Test All Onus    omci-admin-lock
+    ...    ELSE IF    "${workflow}"=="TT"    Current State Test All Onus    omci-admin-lock
+    ...    ELSE       Current State Test All Onus    omci-admin-lock    alternativeonustate=${alternativeonustates}
     Wait for all ONU Ports in ONOS Disabled    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${unitag_sub}
     Enable Onu Device
     Run Keyword If    "${workflow}"=="DT"    Perform Sanity Test DT     ${suppressaddsubscriber}
@@ -426,7 +431,10 @@
     ...    ELSE IF    "${workflow}"=="TT"    Perform Sanity Tests TT    ${suppressaddsubscriber}
     ...    ELSE       Perform Sanity Test    ${suppressaddsubscriber}
     Disable Onu Device
-    Current State Test All Onus    tech-profile-config-delete-success
+    ${alternativeonustates}=  Create List     omci-flows-deleted
+    Run Keyword If    "${workflow}"=="DT"    Current State Test All Onus    omci-admin-lock
+    ...    ELSE IF    "${workflow}"=="TT"    Current State Test All Onus    omci-admin-lock
+    ...    ELSE       Current State Test All Onus    omci-admin-lock    alternativeonustate=${alternativeonustates}
     Wait for all ONU Ports in ONOS Disabled    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${unitag_sub}
     Enable Onu Device
     Run Keyword If    "${workflow}"=="DT"    Perform Sanity Test DT     ${suppressaddsubscriber}
diff --git a/tests/tt-workflow/Voltha_TT_PODTests.robot b/tests/tt-workflow/Voltha_TT_PODTests.robot
index 28d4e5f..4d57cb9 100755
--- a/tests/tt-workflow/Voltha_TT_PODTests.robot
+++ b/tests/tt-workflow/Voltha_TT_PODTests.robot
@@ -146,12 +146,28 @@
         Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate ONUs After OLT Disable
         ...    ${num_onus}    ${olt_serial_number}
         # Verify ONOS Flows
-        # When we disable the device should only have 3 default flows LLDP, IGMP and DHCP
+        # Number of Access Flows on ONOS equals 16 * the Number of Active ONUs + 3 for default LLDP, IGMP and DHCP
+        ${onos_flows_count}=    Run Keyword If    ${has_dataplane}    Evaluate    16 * ${num_of_provisioned_onus} + 3
+        ...    ELSE    Evaluate    15 * ${num_of_provisioned_onus} + 3
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
-        ...    Verify Added Flow Count for OLT TT    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}    3
+        ...    Verify Added Flow Count for OLT TT    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
+        ...    ${onos_flows_count}
         # Verify VOLTHA Flows
-        Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Flows    3
+        # Number of per OLT Flows equals 10 * Number of Active ONUs  + 3 for default LLDP, IGMP and DHCP
+        ${olt_flows}=    Run Keyword If    ${has_dataplane}    Evaluate    10 * ${num_of_provisioned_onus} + 3
+        ...    ELSE    Evaluate    9 * ${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}=    Run Keyword If    ${has_dataplane}    Set Variable    10
+        ...    ELSE    Set Variable    9
+        Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate OLT Flows    ${olt_flows}
         ...    ${olt_device_id}
+        ${List_ONU_Serial}    Create List
+        Set Suite Variable    ${List_ONU_Serial}
+        Build ONU SN List    ${List_ONU_Serial}    ${olt_serial_number}    ${num_onus}
+        Log    ${List_ONU_Serial}
+        # TODO: Fix ${onu_flows} calculations based on UNIs provisioned
+        # Run Keyword    Wait Until Keyword Succeeds    ${timeout}    5s    Validate ONU Flows
+        # ...    ${List_ONU_Serial}    ${onu_flows}
         # Delete OLT and Validate Empty Device List
         Delete Device    ${olt_device_id}
         # Check that the OLT and the ONUs are actually removed from the system
@@ -248,7 +264,7 @@
         Disable Device    ${onu_device_id}
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Validate Device    DISABLED    UNKNOWN
-        ...    REACHABLE    ${src['onu']}    onu=True    onu_reason=tech-profile-config-delete-success
+        ...    REACHABLE    ${src['onu']}    onu=True    onu_reason=omci-admin-lock
         Wait For All UNI Ports Are Disabled per ONU   ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${src['onu']}
         Run Keyword If    ${has_dataplane}    Run Keyword And Continue On Failure
         ...    Wait Until Keyword Succeeds    ${timeout}    2s