[VOL-3701] ONU adapter restart test for DT

Change-Id: If709f9c8114b078a8523f510a469e3384a0d1b50
diff --git a/Makefile b/Makefile
index 68b25ae..38106ae 100755
--- a/Makefile
+++ b/Makefile
@@ -148,13 +148,20 @@
 mib-upload-templating-openonu-go-adapter-test: ROBOT_FILE := Voltha_ONUTemplateTests.robot
 mib-upload-templating-openonu-go-adapter-test: openonu-go-adapter-tests
 
-# target to invoke reconcile tests with openonu go adapter at single ONU
+# target to invoke reconcile tests with openonu go adapter at single ONU with ATT workflow
 reconcile-openonu-go-adapter-test: ROBOT_MISC_ARGS += -v logging:True -i functionalOnuGo
 reconcile-openonu-go-adapter-test: ROBOT_MISC_ARGS += -e notreadyOnuGo -X $(ROBOT_DEBUG_LOG_OPT)
 reconcile-openonu-go-adapter-test: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_SINGLE_PON_FILE)
 reconcile-openonu-go-adapter-test: ROBOT_FILE := Voltha_ONUReconcileTests.robot
 reconcile-openonu-go-adapter-test: openonu-go-adapter-tests
 
+# target to invoke reconcile tests with openonu go adapter at single ONU with DT workflow
+reconcile-openonu-go-adapter-test-dt: ROBOT_MISC_ARGS += -v logging:True -i functionalOnuGo -v workflow:DT
+reconcile-openonu-go-adapter-test-dt: ROBOT_MISC_ARGS += -e notreadyOnuGo -X $(ROBOT_DEBUG_LOG_OPT)
+reconcile-openonu-go-adapter-test-dt: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_DT_SINGLE_PON_FILE)
+reconcile-openonu-go-adapter-test-dt: ROBOT_FILE := Voltha_ONUReconcileTests.robot
+reconcile-openonu-go-adapter-test-dt: openonu-go-adapter-tests
+
 sanity-single-kind: ROBOT_MISC_ARGS += -i sanity $(ROBOT_DEBUG_LOG_OPT)
 sanity-single-kind: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_SINGLE_PON_FILE)
 sanity-single-kind: bbsim-kind
diff --git a/libraries/utils.robot b/libraries/utils.robot
index 247d870..d850b42 100755
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -185,6 +185,9 @@
 Perform Sanity Test
     [Documentation]    This keyword iterate all OLTs and performs Sanity Test Procedure
     ...    for all the ONUs connected to each OLT - ATT workflow
+    ...    For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
+    ...    In all other (common) cases flag has to be set False (default).
+    [Arguments]    ${supress_add_subscriber}=False
     FOR    ${J}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${J}][sn]
         ${onu_count}=    Set Variable    ${list_olts}[${J}][onucount]
@@ -198,14 +201,17 @@
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Verify Default Meter Present in ONOS    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
         Perform Sanity Test Per OLT    ${of_id}    ${nni_port}    ${olt_serial_number}   ${onu_count}
+        ...    ${supress_add_subscriber}
     END
 
 Perform Sanity Test Per OLT
-    [Arguments]    ${of_id}    ${nni_port}    ${olt_serial_number}    ${num_onus}
+    [Arguments]    ${of_id}    ${nni_port}    ${olt_serial_number}    ${num_onus}    ${supress_add_subscriber}=False
     [Documentation]    This keyword performs Sanity Test Procedure
     ...    Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD
     ...    This keyword can be used to call in any other tests where sanity check is required
     ...    and avoids duplication of code. - ATT workflow
+    ...    For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
+    ...    In all other (common) cases flag has to be set False (default).
     FOR    ${I}    IN RANGE    0    ${num_all_onus}
         ${src}=    Set Variable    ${hosts.src[${I}]}
         ${dst}=    Set Variable    ${hosts.dst[${I}]}
@@ -218,7 +224,8 @@
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds   120s   2s
         ...    Verify ONU Port Is Enabled   ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${src['onu']}
         # Verify EAPOL flows are added for the ONU port
-        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    2s
+        Run Keyword Unless    ${supress_add_subscriber}
+        ...    Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    2s
         ...    Verify Eapol Flows Added For ONU    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${onu_port}
         # Verify ONU state in voltha
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device
@@ -232,7 +239,8 @@
         ...    ${src['container_type']}    ${src['container_name']}    ${wpa_log}
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    2
         ...    Verify ONU in AAA-Users    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${onu_port}
-        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    2
+        Run Keyword Unless    ${supress_add_subscriber}
+        ...    Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    2
         ...    Execute ONOS CLI Command    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
         ...    volt-add-subscriber-access ${of_id} ${onu_port}
         # Verify that no pending flows exist for the ONU port
@@ -258,6 +266,9 @@
 
 Perform Sanity Test DT
     [Documentation]    This keyword iterate all OLTs and performs Sanity Test Procedure for DT workflow
+    ...    For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
+    ...    In all other (common) cases flag has to be set False (default).
+    [Arguments]    ${supress_add_subscriber}=False
     FOR    ${J}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${J}][sn]
         ${num_onus}=    Set Variable    ${list_olts}[${J}][onucount]
@@ -270,6 +281,7 @@
         ...    Get NNI Port in ONOS    ${of_id}
         Set Global Variable    ${nni_port}
         Perform Sanity Test DT Per OLT    ${of_id}    ${nni_port}    ${olt_serial_number}    ${num_onus}
+        ...    ${supress_add_subscriber}
         # 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}
@@ -293,11 +305,13 @@
 
 
 Perform Sanity Test DT Per OLT
-    [Arguments]    ${of_id}    ${nni_port}    ${olt_serial_number}    ${num_onus}
+    [Arguments]    ${of_id}    ${nni_port}    ${olt_serial_number}    ${num_onus}    ${supress_add_subscriber}=False
     [Documentation]    This keyword performs Sanity Test Procedure for DT Workflow
     ...    Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
     ...    This keyword can be used to call in any other tests where sanity check is required
     ...    and avoids duplication of code.
+    ...    For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
+    ...    In all other (common) cases flag has to be set False (default).
     FOR    ${I}    IN RANGE    0    ${num_all_onus}
         ${src}=    Set Variable    ${hosts.src[${I}]}
         ${dst}=    Set Variable    ${hosts.dst[${I}]}
@@ -309,17 +323,19 @@
         # Check ONU port is Enabled in ONOS
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds   120s   2s
         ...    Verify ONU Port Is Enabled   ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${src['onu']}
-        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    2
+        Run Keyword Unless    ${supress_add_subscriber}
+        ...    Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    2
         ...    Execute ONOS CLI Command    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
         ...    volt-add-subscriber-access ${of_id} ${onu_port}
         # Verify subscriber access flows are added for the ONU port
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Verify Subscriber Access Flows Added For ONU DT    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}
         ...    ${onu_port}    ${nni_port}    ${src['s_tag']}
-        # Verify ONU state in voltha
+        # Verify ONU state in voltha, in case of previous dis- and enable of ONU state will be onu-reenabled
+        ${onu_reasons}=  Create List     omci-flows-pushed    onu-reenabled
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device
         ...    ENABLED    ACTIVE    REACHABLE
-        ...    ${src['onu']}    onu=True    onu_reason=omci-flows-pushed
+        ...    ${src['onu']}    onu=True    onu_reason=${onu_reasons}
         # Verify Meters in ONOS
         Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s
         ...    Verify Meters in ONOS    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    ${of_id}    ${onu_port}
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index 6e67aad..bcc15b2 100755
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -351,7 +351,11 @@
         ${matched}=    Set Variable If    '${astate}' == '${admin_state}'    ${matched}    False
         ${matched}=    Set Variable If    '${opstatus}' == '${oper_status}'    ${matched}    False
         ${matched}=    Set Variable If    '${cstatus}' == '${connect_status}'    ${matched}    False
-        ${matched}=    Set Variable If    '${mib_state}' == '${onu_reason}' or '${mib_state}' == '${alternate_reason}'
+        ${len}=    Get Length    ${alternate_reason}
+		${matches}=    Run Keyword If     ${len} >= 1    Get Match Count    ${alternate_reason}    ${mib_state}
+        ...            ELSE    Set Variable    1
+        #${matched}=    Set Variable If    '${mib_state}' == '${onu_reason}' or '${mib_state}' == '${alternate_reason}'
+        ${matched}=    Set Variable If    '${mib_state}' == '${onu_reason}' or ${matches} >= 1
         ...   ${matched}    False
         Run Keyword If    ${matched} and ${print2console}    Log
         ...    \r\nONU ${sn} reached the state ${onu_reason} after ${timeTotalMs} sec.    console=yes
diff --git a/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot b/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
index cd56983..30ba316 100755
--- a/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 *** Settings ***
-Documentation     Test deifferent Reconcile scenarios of ONU Go adapter with ATT workflows only
+Documentation     Test different Reconcile scenarios of ONU Go adapter with all three workflows ATT, DT and TT.
 ...               Test suite is dedicated for only one ONU! Run robot with bbsim-kind.yaml only!
 ...               Not for DT/TT workflow!
 ...               Hint: default timeout in BBSim to mimic OLT reboot is 60 seconds!
@@ -50,6 +50,9 @@
 ${container_log_dir}    ${None}
 # flag for first test, needed due default timeout in BBSim to mimic OLT reboot of 60 seconds
 ${firsttest}    True
+# determines the environment workflow: DT, TT or ATT (default)
+# example: -v workflow:DT
+${workflow}    ATT
 # flag debugmode is used, if true timeout calculation various, can be passed via the command line too
 # example: -v debugmode:True
 ${debugmode}    False
@@ -73,11 +76,10 @@
     [Documentation]    Validates the Reconcile in Starting-OpenOmci
     ...    Reconcile test during “starting-openomci” in AT&T-workflow:
     ...    - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
-    ...    -- wait for device reason “starting-openomci”
+    ...    - wait for device reason “starting-openomci”
     ...    - kill the open-onu-adapter-go
-    ...    -- wait for open-onu-adapter-go to restart
-    ...    -- wait for device reason “omci-flows-pushed”
-    ...    --- check for default EAPOL-flow and enabled UNI-port in ONOS
+    ...    - wait for open-onu-adapter-go to restart
+    ...    - perform sanity test include add subscriber
     ...    - delete ONU and MIB-template in KV-store
     [Tags]    functionalOnuGo    ReconcileStartingOpenOmciOnuGo
     [Setup]    Run Keywords    Start Logging    ReconcileStartingOpenOmciOnuGo
@@ -94,11 +96,10 @@
     [Documentation]    Validates the Reconcile in initial-mib-downloaded
     ...    Reconcile test during “initial-mib-downloaded” in AT&T-workflow:
     ...    - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
-    ...    -- wait for device reason “initial-mib-downloaded”
+    ...    - wait for device reason “initial-mib-downloaded”
     ...    - kill the open-onu-adapter-go
-    ...    -- wait for open-onu-adapter-go to restart
-    ...    -- wait for device reason “omci-flows-pushed”
-    ...    --- check for default EAPOL-flow and enabled UNI-port in ONOS
+    ...    - wait for open-onu-adapter-go to restart
+    ...    - perform sanity test include add subscriber
     ...    - delete ONU and MIB-template in KV-store
     [Tags]    functionalOnuGo    ReconcileInitialMibDownloadedOnuGo
     [Setup]    Run Keywords    Start Logging    ReconcileInitialMibDownloadedOnuGo
@@ -116,16 +117,15 @@
     ...    Former testcase: Reconcile Onu Device in Testsuite Voltha_ONUStateTest.robot
     ...    Reconcile test during “omci-flows-pushed” in AT&T-workflow:
     ...    - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
-    ...    -- wait for device reason “omci-flows-pushed”
+    ...    - perform sanity test include add subscriber
     ...    - kill the open-onu-adapter-go
-    ...    -- wait for open-onu-adapter-go to restart
-    ...    -- wait for device reason “omci-flows-pushed”
+    ...    - wait for open-onu-adapter-go to restart
+    ...    - perform sanity test suppress add subscriber
     ...    - disable onu device
-    ...    -- wait for device reason “tech-profile-config-delete-success”
-    ...    -- check UNI-ports disabled in ONOS
+    ...    - wait for device corresponding onu reason e.g. “tech-profile-config-delete-success”
+    ...    - check UNI-ports disabled in ONOS
     ...    - enable onu device
-    ...    -- wait for device reason “omci-flows-pushed”
-    ...    --- check for default EAPOL-flow and enabled UNI-port in ONOS
+    ...    - perform sanity test suppress add subscriber
     ...    - delete ONU and MIB-template in KV-store
     [Tags]    functionalOnuGo    ReconcileOmciFlowsPushedOnuGo
     [Setup]    Run Keywords    Start Logging    ReconcileOmciFlowsPushedOnuGo
@@ -142,16 +142,15 @@
     [Documentation]    Validates the Reconcile for disabled Onu device
     ...    Reconcile test for disabled Onu device in AT&T-workflow:
     ...    - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
-    ...    -- wait for device reason “omci-flows-pushed”
+    ...    - perform sanity test include add subscriber
     ...    - disable onu device
-    ...    -- wait for device reason “tech-profile-config-delete-success”
-    ...    -- check UNI-ports disabled in ONOS
-   ...    - kill the open-onu-adapter-go
-    ...    -- wait for open-onu-adapter-go to restart
-    ...    -- check device reason is still “tech-profile-config-delete-success”
+    ...    - wait for device corresponding onu reason e.g. “tech-profile-config-delete-success”
+    ...    - check UNI-ports disabled in ONOS
+    ...    - kill the open-onu-adapter-go
+    ...    - wait for open-onu-adapter-go to restart
+    ...    - check device reason is still the same before restart
     ...    - enable onu device
-    ...    -- wait for device reason “onu-reenabled”
-    ...    --- check for default EAPOL-flow and enabled UNI-port in ONOS
+    ...    - perform sanity test suppress add subscriber
     ...    - delete ONU and MIB-template in KV-store
     [Tags]    functionalOnuGo    ReconcileDisabledOnuDeviceOnuGo
     [Setup]    Run Keywords    Start Logging    ReconcileDisabledOnuDeviceOnuGo
@@ -170,7 +169,7 @@
     ${LogInfo}=    Catenate
     ...    \r\nPassed arguments:
     ...    debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
-    ...    print2console:${print2console}
+    ...    print2console:${print2console}, usekill2restart:${usekill2restart}, workflow:${workflow}
     Log    ${LogInfo}    console=yes
     Common Test Suite Setup
     # prepare skip message in yellow for console log
@@ -239,11 +238,12 @@
     ...    - enable OLT device
     ...    - wait for passed openonu reason
     ...    - restart openonu adaptor
-    ...    - check openonu adaptor is ready again
-    ...    - wait for openonu reason 'omci-flows-pushed'
-    ...    - check default (eapol) flow
-    ...    - port check
+    ...    - perform sanity test include add subscriber
     [Arguments]    ${expected_onu_reason}
+    ${admin_state}    ${oper_status}    ${connect_status}    ${onu_state_nb}    ${onu_state}=    Map State
+    ...    ${expected_onu_reason}
+    Should Be True    ${onu_state_nb}<=5
+    ...    Wrong expected onu reason ${expected_onu_reason}, must be lower than 'omci-flows-pushed'!
     FOR    ${I}    IN RANGE    0    ${num_olts}
         #get olt serial number
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
@@ -254,29 +254,24 @@
     Current State Test All Onus    ${expected_onu_reason}
     Run Keyword If    ${usekill2restart}    Kill And Check Onu Adaptor    ${namespace}
     ...    ELSE    Restart And Check Onu Adaptor    ${namespace}
-    Current State Test All Onus    omci-flows-pushed
-    Wait for Ports in ONOS for all OLTs    ${onos_ssh_connection}    ${num_all_onus}    BBSM    ${timeout}
-    Wait Until Keyword Succeeds    ${timeout}    2s    Verify Eapol Flows Added    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
-    ...    ${num_all_onus}
-    ${flowsresult}=    Execute ONOS CLI Command    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    flows -s
-    log     ${flowsresult}
+    Run Keyword If    "${workflow}"=="DT"    Perform Sanity Test DT
+    ...    ELSE IF    "${workflow}"=="TT"    Perform Sanity Test TT
+    ...    ELSE       Perform Sanity Test
 
 Do Reconcile For Disabled Onu Device
     [Documentation]    This keyword reconciles ONU device for a disabled onu device and
     ...    check the state afterwards.
     ...    Following steps will be executed:
     ...    - enable OLT device
-    ...    - wait for openonu reason 'omci-flows-pushed'
+    ...    - perform sanity test include add subscriber
     ...    - disable onu device
-    ...    - wait for openonu reason 'tech-profile-config-delete-success'
+    ...    - wait for corresponding openonu reason
     ...    - check UNI-ports disabled in ONOS
     ...    - restart openonu adaptor
     ...    - check openonu adaptor is ready again
-    ...    - check device reason is still 'tech-profile-config-delete-success'
+    ...    - check device reason is still before restart
     ...    - enable onu device
-    ...    - wait for openonu reason 'onu-reenabled'
-    ...    - check default (eapol) flow
-    ...    - port check
+    ...    - perform sanity test suppress add subscriber
     FOR    ${I}    IN RANGE    0    ${num_olts}
         #get olt serial number
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
@@ -284,36 +279,34 @@
         ${olt_device_id}=    Get OLTDeviceID From OLT List    ${olt_serial_number}
         Enable Device    ${olt_device_id}
     END
-    Current State Test All Onus    omci-flows-pushed
+    Run Keyword If    "${workflow}"=="DT"    Perform Sanity Test DT
+    ...    ELSE IF    "${workflow}"=="TT"    Perform Sanity Test TT
+    ...    ELSE       Perform Sanity Test
     Disable Onu Device
-    Current State Test All Onus    tech-profile-config-delete-success
+    ${alternativeonustates}=  Create List     omci-flows-deleted    omci-admin-lock
+    Current State Test All Onus    tech-profile-config-delete-success    alternativeonustate=${alternativeonustates}
     Run Keyword If    ${usekill2restart}    Kill And Check Onu Adaptor    ${namespace}
     ...    ELSE    Restart And Check Onu Adaptor    ${namespace}
-    Current State Test All Onus    tech-profile-config-delete-success
+    Current State Test All Onus    tech-profile-config-delete-success    alternativeonustate=${alternativeonustates}
     Wait for all ONU Ports in ONOS Disabled    ${onos_ssh_connection}
     Enable Onu Device
-    Current State Test All Onus    onu-reenabled    alternativeonustate=omci-flows-pushed
-    Wait for Ports in ONOS for all OLTs    ${onos_ssh_connection}    ${num_all_onus}    BBSM    ${timeout}
-    Wait Until Keyword Succeeds    ${timeout}    2s    Verify Eapol Flows Added    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
-    ...    ${num_all_onus}
-    ${flowsresult}=    Execute ONOS CLI Command    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    flows -s
-    log     ${flowsresult}
+    Run Keyword If    "${workflow}"=="DT"    Perform Sanity Test DT    True
+    ...    ELSE IF    "${workflow}"=="TT"    Perform Sanity Test TT    True
+    ...    ELSE       Perform Sanity Test    True
 
 Do Reconcile In Omci-Flows-Pushed
     [Documentation]    This keyword reconciles ONU device in omci-flows-pushed and check the state afterwards.
     ...    Reconcile test during “omci-flows-pushed” in AT&T-workflow:
     ...    - create and enable one BBSIM-ONU (no MIB-template should be available in KV-store)
-    ...    -- wait for device reason “omci-flows-pushed”
+    ...    - perform sanity test include add subscriber
     ...    - kill the open-onu-adapter-go
-    ...    -- wait for open-onu-adapter-go to restart
-    ...    -- wait for device reason “omci-flows-pushed”
+    ...    - wait for open-onu-adapter-go to restart
+    ...    - perform sanity test suppress add subscriber
     ...    - disable onu device
-    ...    -- wait for device reason “tech-profile-config-delete-success”
-    ...    -- check UNI-ports disabled in ONOS
+    ...    - wait for corresponding device reason
+    ...    - check UNI-ports disabled in ONOS
     ...    - enable onu device
-    ...    -- wait for device reason “omci-flows-pushed”
-    ...    --- check for default EAPOL-flow and enabled UNI-port in ONOS
-    ...    - delete ONU and MIB-template in KV-store
+    ...    - perform sanity test supress add subscriber
     FOR    ${I}    IN RANGE    0    ${num_olts}
         #get olt serial number
         ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
@@ -321,23 +314,19 @@
         ${olt_device_id}=    Get OLTDeviceID From OLT List    ${olt_serial_number}
         Enable Device    ${olt_device_id}
     END
-    Current State Test All Onus    omci-flows-pushed
+    Run Keyword If    "${workflow}"=="DT"    Perform Sanity Test DT
+    ...    ELSE IF    "${workflow}"=="TT"    Perform Sanity Test TT
+    ...    ELSE       Perform Sanity Test
     Run Keyword If    ${usekill2restart}    Kill And Check Onu Adaptor    ${namespace}
     ...    ELSE    Restart And Check Onu Adaptor    ${namespace}
-    Current State Test All Onus    omci-flows-pushed
-    Wait for Ports in ONOS for all OLTs    ${onos_ssh_connection}    ${num_all_onus}    BBSM    ${timeout}
-    Wait Until Keyword Succeeds    ${timeout}    2s    Verify Eapol Flows Added    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
-    ...    ${num_all_onus}
-    ${flowsresult}=    Execute ONOS CLI Command    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    flows -s
-    log     ${flowsresult}
+    Run Keyword If    "${workflow}"=="DT"    Perform Sanity Test DT    True
+    ...    ELSE IF    "${workflow}"=="TT"    Perform Sanity Test TT    True
+    ...    ELSE       Perform Sanity Test    True
     Disable Onu Device
-    Current State Test All Onus    tech-profile-config-delete-success
+    ${alternativeonustates}=  Create List     omci-flows-deleted    omci-admin-lock
+    Current State Test All Onus    tech-profile-config-delete-success    alternativeonustate=${alternativeonustates}
     Wait for all ONU Ports in ONOS Disabled    ${onos_ssh_connection}
-    # Wait for Ports in ONOS for all OLTs    ${onos_ssh_connection}    0    BBSM    ${timeout}
     Enable Onu Device
-    Current State Test All Onus    omci-flows-pushed
-    Wait for Ports in ONOS for all OLTs    ${onos_ssh_connection}    ${num_all_onus}    BBSM    ${timeout}
-    Wait Until Keyword Succeeds    ${timeout}    2s    Verify Eapol Flows Added    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
-    ...    ${num_all_onus}
-    ${flowsresult}=    Execute ONOS CLI Command    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}    flows -s
-    log     ${flowsresult}
+    Run Keyword If    "${workflow}"=="DT"    Perform Sanity Test DT    True
+    ...    ELSE IF    "${workflow}"=="TT"    Perform Sanity Test TT    True
+    ...    ELSE       Perform Sanity Test    True
diff --git a/tests/openonu-go-adapter/Voltha_ONUStateTests.robot b/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
index a46ae97..3228783 100755
--- a/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
@@ -446,7 +446,8 @@
     ${alternative_onu_reason}=    Set Variable If
     ...    '${state2checkafterdisable}'=='tech-profile-config-delete-success'    omci-flows-deleted
     ...    '${state2checkafterdisable}'=='omci-admin-lock'    tech-profile-config-delete-success    ${EMPTY}
-    Current State Test All Onus    ${state2checkafterdisable}    alternativeonustate=${alternative_onu_reason}
+    ${alternativeonustates}=  Create List     ${alternative_onu_reason}
+    Current State Test All Onus    ${state2checkafterdisable}    alternativeonustate=${alternativeonustates}
     Log Ports
     #check no port is enabled in ONOS
     Wait for Ports in ONOS for all OLTs    ${onos_ssh_connection}    0    BBSM
@@ -460,8 +461,9 @@
     [Documentation]    This keyword power off/on all onus and checks the states.
     Power Off ONU Device    ${namespace}
     Sleep    5s
+    ${alternativeonustates}=  Create List     omci-flows-deleted
     Current State Test All Onus    tech-profile-config-delete-success
-    ...    ENABLED    DISCOVERED    UNREACHABLE    alternativeonustate=omci-flows-deleted
+    ...    ENABLED    DISCOVERED    UNREACHABLE    alternativeonustate=${alternativeonustates}
     Power On ONU Device    ${namespace}
     Current State Test All Onus    ${state2test}
 
@@ -472,8 +474,9 @@
         ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
         Reboot ONU    ${onu_device_id}   False
     END
+    ${alternativeonustates}=  Create List     omci-flows-deleted
     Run Keyword Unless    ${has_dataplane}    Current State Test All Onus    tech-profile-config-delete-success
-    ...   ENABLED    DISCOVERED    REACHABLE    alternativeonustate=omci-flows-deleted
+    ...   ENABLED    DISCOVERED    REACHABLE    alternativeonustate=${alternativeonustates}
     Sleep    5s
     Run Keyword Unless    ${has_dataplane}    Do Disable Enable Onu Test    checkstatebeforedisable=False
     ...    state2checkafterdisable=omci-admin-lock