[VOL-3686][VOL-3687][VOL-3688] Create Reconcile Testsuite for OpenOnu-Go-Adapter and refactoring of existing OpenOnu-Go-Adapter Testsuites and Library
- add new target in Makefile
- implement option to use delete (default) or kill for restart of onu adapter

Change-Id: Icbcbd6e8a74e0f8be2fbeb27f70c11da8a76b6aa
diff --git a/Makefile b/Makefile
index 80c300a..5612ea8 100755
--- a/Makefile
+++ b/Makefile
@@ -148,6 +148,13 @@
 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
+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
+
 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/onos.robot b/libraries/onos.robot
index a1542a4..6e8f6e4 100755
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -470,6 +470,14 @@
         ...    Should Be Equal As Integers    ${rc}    0
     END
 
+Assert ONU Port Is Disabled
+    [Arguments]    ${onos_ssh_connection}    ${deviceId}    ${onu_port}
+    [Documentation]    Verifies if the ONU port is disabled in ONOS
+    ${onu_port_disabled}=    Execute ONOS CLI Command on open connection     ${onos_ssh_connection}
+    ...    ports -d ${deviceId} | grep port=${onu_port}
+    Log    ${onu_port_disabled}
+    Should Not Be Empty    ${onu_port_disabled}
+
 Assert Ports in ONOS
     [Arguments]    ${onos_ssh_connection}     ${count}     ${deviceId}    ${filter}
     [Documentation]    Check that a certain number of ports are enabled in ONOS
diff --git a/libraries/Voltha_ONUUtilities.robot b/libraries/onu_utilities.robot
similarity index 78%
rename from libraries/Voltha_ONUUtilities.robot
rename to libraries/onu_utilities.robot
index 1389715..41f598e 100755
--- a/libraries/Voltha_ONUUtilities.robot
+++ b/libraries/onu_utilities.robot
@@ -19,16 +19,35 @@
 ${defaultstackname}    minimal
 
 *** Keywords ***
-Do Power On ONU Device
-    [Documentation]    This keyword power on all onus.
-    ${namespace}=    Set Variable    voltha
+Calculate Timeout
+    [Documentation]    Calculates the timeout regarding num-onus in case of more than 4 onus
+    [Arguments]    ${basetimeout}=60s
+    ${new_timeout}    Fetch From Left    ${basetimeout}    s
+    ${new_timeout}=    evaluate    ${new_timeout}+((${num_all_onus}-4)*10)
+    ${new_timeout}=    Set Variable If    (not ${debugmode}) and (${new_timeout}>300)
+    ...    300   ${new_timeout}
+    ${new_timeout}=    Catenate    SEPARATOR=    ${new_timeout}    s
+    [Return]    ${new_timeout}
+
+Power On ONU Device
+    [Documentation]    This keyword turns on the power for all onus.
+    [Arguments]    ${namespace}
     FOR    ${I}    IN RANGE    0    ${num_all_onus}
         ${src}=    Set Variable    ${hosts.src[${I}]}
         ${result}=    Exec Pod In Kube    ${namespace}    bbsim    bbsimctl onu poweron ${src['onu']}
         Should Contain    ${result}    successfully    msg=Can not poweron ${src['onu']}    values=False
     END
 
-Do Current State Test
+Power Off ONU Device
+    [Documentation]    This keyword turns off the power for all onus.
+    [Arguments]    ${namespace}
+    FOR    ${I}    IN RANGE    0    ${num_all_onus}
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        ${result}=    Exec Pod In Kube    ${namespace}    bbsim    bbsimctl onu shutdown ${src['onu']}
+        Should Contain    ${result}    successfully    msg=Can not shutdown ${src['onu']}    values=False
+    END
+
+Current State Test
     [Documentation]    This keyword checks the passed state of the given onu.
     [Arguments]    ${state}    ${onu}    ${reqadminstate}=${EMPTY}    ${reqoperstatus}=${EMPTY}
     ...    ${reqconnectstatus}=${EMPTY}
@@ -41,11 +60,12 @@
     ...    Validate Device    ${admin_state}    ${oper_status}    ${connect_status}
     ...    ${onu}    onu=True    onu_reason=${onu_state}
 
-Do Current State Test All Onus
+Current State Test All Onus
     [Documentation]    This keyword checks the passed state of all onus.
     ...                Hint: ${timeStart} will be not evaluated here!
     [Arguments]    ${state}    ${reqadminstate}=${EMPTY}    ${reqoperstatus}=${EMPTY}    ${reqconnectstatus}=${EMPTY}
     ...    ${alternativeonustate}=${EMPTY}
+    ${timeStart}=    Get Current Date
     ${list_onus}    Create List
     Build ONU SN List    ${list_onus}
     ${admin_state}    ${oper_status}    ${connect_status}    ${onu_state_nb}    ${onu_state}=    Map State    ${state}
@@ -58,17 +78,6 @@
     ...    ${admin_state}    ${oper_status}    ${connect_status}
     ...    ${onu_state}    ${list_onus}    ${timeStart}    alternate_reason=${alternativeonustate}
 
-Do Current Reason Test All Onus
-    [Documentation]    This keyword checks the passed state of all onus.
-    ...                Hint: ${timeStart} will be not evaluated here!
-    [Arguments]    ${state}
-    ${list_onus}    Create List
-    Build ONU SN List    ${list_onus}
-    ${admin_state}    ${oper_status}    ${connect_status}    ${onu_state_nb}    ${onu_state}=    Map State    ${state}
-    Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    50ms
-    ...    Validate ONU Devices MIB State With Duration
-    ...    ${onu_state}    ${list_onus}    ${timeStart}
-
 Log Ports
     [Documentation]    This keyword logs all port data available in ONOS of first port per ONU
     [Arguments]    ${onlyenabled}=False
@@ -86,6 +95,47 @@
     ${rc}    ${output}=    Run and Return Rc and Output    ${cmd}
     Log    ${output}
 
+Kill And Check Onu Adaptor
+    [Documentation]    This keyword kills ONU Adaptor and waits for it to come up again
+    ...    Following steps will be executed:
+    ...    - kill openonu adaptor
+    ...    - check openonu adaptor is ready again
+    [Arguments]    ${namespace}
+    ${list_openonu_apps}   Create List    adapter-open-onu
+    ${adaptorname}=    Set Variable    open-onu
+    Kill Adaptor    ${namespace}    ${adaptorname}
+    Sleep    5s
+    Wait For Pods Ready    ${namespace}    ${list_openonu_apps}
+
+Restart And Check Onu Adaptor
+    [Documentation]    This keyword restarts ONU Adaptor and waits for it to come up again
+    ...    Following steps will be executed:
+    ...    - restart openonu adaptor
+    ...    - check openonu adaptor is ready again
+    [Arguments]    ${namespace}
+    ${list_openonu_apps}   Create List    adapter-open-onu
+    ${adaptorname}=    Set Variable    open-onu
+    Restart Pod    ${namespace}    ${adaptorname}
+    Sleep    5s
+    Wait For Pods Ready    ${namespace}    ${list_openonu_apps}
+
+Disable Onu Device
+    [Documentation]    This keyword disables all onus.
+    FOR    ${I}    IN RANGE    0    ${num_all_onus}
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
+        Disable Device    ${onu_device_id}
+        Wait Until Keyword Succeeds    20s    2s    Test Devices Disabled in VOLTHA    Id=${onu_device_id}
+    END
+
+Enable Onu Device
+    [Documentation]    This keyword enables all onus.
+    FOR    ${I}    IN RANGE    0    ${num_all_onus}
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
+        Enable Device    ${onu_device_id}
+    END
+
 Verify MIB Template Data Available
     [Documentation]    This keyword verifies MIB Template Data stored in etcd
     ${namespace}=    Set Variable    default
@@ -108,6 +158,34 @@
     ${result}=    Exec Pod In Kube    ${namespace}    ${podname}    ${commandget}
     Should Be Empty    ${result}    Could not delete MIB Template Data stored in etcd!
 
+Set Tech Profile
+    [Documentation]    This keyword sets the passed TechProfile for the test
+    [Arguments]    ${TechProfile}
+    Log To Console    \nTechProfile:${TechProfile}
+    ${namespace}=    Set Variable    default
+    ${podname}=    Set Variable    etcd
+    ${src}=    Set Variable    ${data_dir}/TechProfile-${TechProfile}.json
+    ${dest}=    Set Variable    /tmp/flexpod.json
+    ${command}    Catenate
+    ...    /bin/sh -c 'cat    ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
+    Copy File To Pod    ${namespace}    ${podname}    ${src}    ${dest}
+    Exec Pod In Kube    ${namespace}    ${podname}    ${command}
+    ${commandget}    Catenate
+    ...    /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
+    Exec Pod In Kube    ${namespace}    ${podname}    ${commandget}
+
+Remove Tech Profile
+    [Documentation]    This keyword removes TechProfile
+    Log To Console    \nTechProfile:${TechProfile}
+    ${namespace}=    Set Variable    default
+    ${podname}=    Set Variable    etcd
+    ${command}    Catenate
+    ...    /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
+    Exec Pod In Kube    ${namespace}    ${podname}    ${command}
+    ${commandget}    Catenate
+    ...    /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
+    Exec Pod In Kube    ${namespace}    ${podname}    ${commandget}
+
 Validate Onu Data In Etcd
     [Documentation]    This keyword validates openonu-go-adapter Data stored in etcd.
     ...                It checks unique of  serial_number and combination of pon, onu and uni in tp_path.
@@ -186,7 +264,7 @@
         ...    ELSE IF    ${oldsetvidvalid} and not ${setvidequal}
         ...               Should Not Be Equal As Integers    ${prevsetvid}    ${setvid}
     END
-    log Many   ${vlan_rules}
+    log Many    ${vlan_rules}
     [Return]    ${vlan_rules}
 
 Get ONU Go Adapter ETCD Data
@@ -279,7 +357,7 @@
     [Return]    ${env_name}
 
 Wait for Ports in ONOS for all OLTs
-    [Documentation]    Waits untill a certain number of ports are enabled in all ONOS
+    [Documentation]    Waits untill a certain number of ports are enabled in all OLTs
     [Arguments]    ${onos_ssh_connection}    ${count}    ${filter}    ${max_wait_time}=10m
     FOR    ${J}    IN RANGE    0    ${num_olts}
         ${olt_serial_number}=    Set Variable    ${list_olts}[${J}][sn]
@@ -290,6 +368,18 @@
         Wait for Ports in ONOS    ${onos_ssh_connection}    ${count}    ${of_id}    BBSM    ${max_wait_time}
     END
 
+Wait for all ONU Ports in ONOS Disabled
+    [Documentation]    Waits untill a all ONU ports are disabled in all ONOS
+    [Arguments]    ${onos_ssh_connection}
+    FOR    ${I}    IN RANGE    0    ${num_all_onus}
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        ${of_id}=    Wait Until Keyword Succeeds    ${timeout}    15s    Validate OLT Device in ONOS
+        ...    ${src['olt']}
+       ${onu_port}=    Wait Until Keyword Succeeds    ${timeout}    2s    Get ONU Port in ONOS    ${src['onu']}    ${of_id}
+        Wait Until Keyword Succeeds    ${timeout}    2s    Assert ONU Port Is Disabled    ${onos_ssh_connection}    ${of_id}
+        ...    ${onu_port}
+    END
+
 Map State
     [Documentation]    This keyword converts the passed numeric value or name of a onu state to its state values.
     [Arguments]    ${state}
diff --git a/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot b/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
new file mode 100755
index 0000000..cd56983
--- /dev/null
+++ b/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
@@ -0,0 +1,343 @@
+# Copyright 2020 - present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation     Test deifferent Reconcile scenarios of ONU Go adapter with ATT workflows only
+...               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!
+...               This behaviour of BBSim can be modified by 'oltRebootDelay: 60' in BBSim section of helm chart or
+...               used values.yaml during 'voltha up'.
+Suite Setup       Setup Suite
+Suite Teardown    Teardown Suite
+Test Setup        Setup
+Test Teardown     Teardown
+Library           Collections
+Library           String
+Library           OperatingSystem
+Library           XML
+Library           RequestsLibrary
+Library           ../../libraries/DependencyLibrary.py
+Resource          ../../libraries/onos.robot
+Resource          ../../libraries/voltctl.robot
+Resource          ../../libraries/voltha.robot
+Resource          ../../libraries/utils.robot
+Resource          ../../libraries/k8s.robot
+Resource          ../../libraries/onu_utilities.robot
+Resource          ../../variables/variables.robot
+
+*** Variables ***
+${namespace}      voltha
+${timeout}        60s
+${of_id}          0
+${logical_id}     0
+${has_dataplane}    True
+${external_libs}    True
+${teardown_device}    True
+${scripts}        ../../scripts
+# Per-test logging on failure is turned off by default; set this variable to enable
+${container_log_dir}    ${None}
+# flag for first test, needed due default timeout in BBSim to mimic OLT reboot of 60 seconds
+${firsttest}    True
+# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
+# example: -v debugmode:True
+${debugmode}    False
+# logging flag to enable Collect Logs, can be passed via the command line too
+# example: -v logging:True
+${logging}    False
+# if True execution will be paused before clean up, only use in case of manual testing, do not use in ci pipeline!
+# example: -v pausebeforecleanup:True
+${pausebeforecleanup}    False
+# if True some outputs to console are done during running tests e.g. long duration flow test
+# example: -v print2console:True
+${print2console}    False
+# if True (hard) kill will be used to restart onu adapter, else (soft) restart mechanism of k8s will be used
+# example: -v usekill2restart:True
+${usekill2restart}    False
+${data_dir}    ../data
+
+
+*** Test Cases ***
+Reconcile In Starting-OpenOmci
+    [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”
+    ...    - 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
+    ...    - delete ONU and MIB-template in KV-store
+    [Tags]    functionalOnuGo    ReconcileStartingOpenOmciOnuGo
+    [Setup]    Run Keywords    Start Logging    ReconcileStartingOpenOmciOnuGo
+    ...    AND    Setup Test
+    Run Keyword If    ${has_dataplane}    Clean Up Linux
+    Run Keyword If    '${num_all_onus}'=='1'
+    ...    Do Reconcile In Determined State    starting-openomci
+    ...    ELSE    Pass Execution    ${skip_message}    skipped
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
+    ...    AND    Teardown Test
+    ...    AND    Stop Logging    ReconcileStartingOpenOmciOnuGo
+
+Reconcile In Initial-Mib-Downloaded
+    [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”
+    ...    - 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
+    ...    - delete ONU and MIB-template in KV-store
+    [Tags]    functionalOnuGo    ReconcileInitialMibDownloadedOnuGo
+    [Setup]    Run Keywords    Start Logging    ReconcileInitialMibDownloadedOnuGo
+    ...    AND    Setup Test
+    Run Keyword If    ${has_dataplane}    Clean Up Linux
+    Run Keyword If    '${num_all_onus}'=='1'
+    ...    Do Reconcile In Determined State    initial-mib-downloaded
+    ...    ELSE    Pass Execution    ${skip_message}    skipped
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
+    ...    AND    Teardown Test
+    ...    AND    Stop Logging    ReconcileInitialMibDownloadedOnuGo
+
+Reconcile In Omci-Flows-Pushed
+    [Documentation]    Validates the Reconcile in omci-flows-pushed
+    ...    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”
+    ...    - kill the open-onu-adapter-go
+    ...    -- wait for open-onu-adapter-go to restart
+    ...    -- wait for device reason “omci-flows-pushed”
+    ...    - disable onu device
+    ...    -- wait for device reason “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
+    ...    - delete ONU and MIB-template in KV-store
+    [Tags]    functionalOnuGo    ReconcileOmciFlowsPushedOnuGo
+    [Setup]    Run Keywords    Start Logging    ReconcileOmciFlowsPushedOnuGo
+    ...    AND    Setup Test
+    Run Keyword If    ${has_dataplane}    Clean Up Linux
+    Run Keyword If    '${num_all_onus}'=='1'
+    ...    Do Reconcile In Omci-Flows-Pushed
+    ...    ELSE    Pass Execution    ${skip_message}    skipped
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
+    ...    AND    Teardown Test
+    ...    AND    Stop Logging    ReconcileOmciFlowsPushedOnuGo
+
+Reconcile For Disabled Onu Device
+    [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”
+    ...    - 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”
+    ...    - enable onu device
+    ...    -- wait for device reason “onu-reenabled”
+    ...    --- check for default EAPOL-flow and enabled UNI-port in ONOS
+    ...    - delete ONU and MIB-template in KV-store
+    [Tags]    functionalOnuGo    ReconcileDisabledOnuDeviceOnuGo
+    [Setup]    Run Keywords    Start Logging    ReconcileDisabledOnuDeviceOnuGo
+    ...    AND    Setup Test
+    Run Keyword If    ${has_dataplane}    Clean Up Linux
+    Run Keyword If    '${num_all_onus}'=='1'
+    ...    Do Reconcile For Disabled Onu Device
+    ...    ELSE    Pass Execution    ${skip_message}    skipped
+    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
+    ...    AND    Teardown Test
+    ...    AND    Stop Logging    ReconcileDisabledOnuDeviceOnuGo
+
+*** Keywords ***
+Setup Suite
+    [Documentation]    Set up the test suite
+    ${LogInfo}=    Catenate
+    ...    \r\nPassed arguments:
+    ...    debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
+    ...    print2console:${print2console}
+    Log    ${LogInfo}    console=yes
+    Common Test Suite Setup
+    # prepare skip message in yellow for console log
+    ${skip}=  Evaluate  "\\033[33mSKIP\\033[0m"
+    ${skipped}=  Evaluate  "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
+    ${skip_message}    Catenate    ${skipped} | ${skip} |
+    Set Suite Variable    ${skip_message}
+    ${onos_ssh_connection}    Open ONOS SSH Connection    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
+    Set Suite Variable  ${onos_ssh_connection}
+    # delete etcd MIB Template Data
+    Delete MIB Template Data
+
+Teardown Suite
+    [Documentation]    Replaces the Suite Teardown in utils.robot.
+    ...    Cleans up and checks all ONU ports disabled in ONOS.
+    ...    Furthermore gives the possibility to pause the execution.
+    Run Keyword If    ${pausebeforecleanup}    Import Library    Dialogs
+    Run Keyword If    ${pausebeforecleanup}    Pause Execution    Press OK to continue with clean up!
+    Run Keyword If    ${pausebeforecleanup}    Log    Teardown will be continued...    console=yes
+    Run Keyword If    ${teardown_device}    Delete All Devices and Verify
+    Run Keyword If    ${usekill2restart}    Restart Pod    ${namespace}    open-onu
+    Validate Onu Data In Etcd    0
+    Wait for Ports in ONOS for all OLTs      ${onos_ssh_connection}  0   BBSM    ${timeout}
+    Close All ONOS SSH Connections
+
+Setup Test
+    [Documentation]    Pre-test Setup
+    #test for empty device list
+    Test Empty Device List
+    Run Keyword If    ${has_dataplane}    Wait Until Keyword Succeeds    120s    10s    Openolt is Up
+    ...    ${olt_ssh_ip}    ${olt_user}    ${olt_pass}
+    Run Keyword If    ${has_dataplane}    Sleep    60s
+    #restart open-onu pod to reset crash loop back off mechansim of kubenetes
+    Run Keyword If    "${firsttest}"=="False" and "${usekill2restart}"=="True"    Restart Pod    ${namespace}    open-onu
+    Run Keyword If    "${firsttest}"=="False"    Sleep    35s
+    ${firsttest}    Set Variable    False
+    Set Suite Variable    ${firsttest}
+    # Create a list of olt ids (logical and device_id)
+    ${olt_ids}    Create List
+    FOR    ${I}    IN RANGE    0    ${num_olts}
+        #create/preprovision device
+        ${olt_device_id}=    Create Device    ${list_olts}[${I}][ip]    ${OLT_PORT}
+        ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
+        #validate olt states
+        Wait Until Keyword Succeeds    ${timeout}    5s
+        ...    Validate OLT Device    PREPROVISIONED    UNKNOWN    UNKNOWN    ${olt_device_id}
+        Sleep    5s
+        ${logical_id}=    Get Logical Device ID From SN    ${olt_serial_number}
+        ${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}
+
+Teardown Test
+    [Documentation]    Post-test Teardown
+    Run Keyword If    ${teardown_device}    Delete All Devices and Verify
+    # delete etcd MIB Template Data
+    Delete MIB Template Data
+    Sleep    5s
+
+Do Reconcile In Determined State
+    [Documentation]    This keyword reconciles ONU device when passed reason is reached and
+    ...    check the state afterwards.
+    ...    Following steps will be executed:
+    ...    - 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
+    [Arguments]    ${expected_onu_reason}
+    FOR    ${I}    IN RANGE    0    ${num_olts}
+        #get olt serial number
+        ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
+        #validate olt states
+        ${olt_device_id}=    Get OLTDeviceID From OLT List    ${olt_serial_number}
+        Enable Device    ${olt_device_id}
+    END
+    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}
+
+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'
+    ...    - disable onu device
+    ...    - wait for openonu reason 'tech-profile-config-delete-success'
+    ...    - 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'
+    ...    - enable onu device
+    ...    - wait for openonu reason 'onu-reenabled'
+    ...    - check default (eapol) flow
+    ...    - port check
+    FOR    ${I}    IN RANGE    0    ${num_olts}
+        #get olt serial number
+        ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
+        #validate olt states
+        ${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
+    Disable Onu Device
+    Current State Test All Onus    tech-profile-config-delete-success
+    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
+    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}
+
+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”
+    ...    - kill the open-onu-adapter-go
+    ...    -- wait for open-onu-adapter-go to restart
+    ...    -- wait for device reason “omci-flows-pushed”
+    ...    - disable onu device
+    ...    -- wait for device reason “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
+    ...    - delete ONU and MIB-template in KV-store
+    FOR    ${I}    IN RANGE    0    ${num_olts}
+        #get olt serial number
+        ${olt_serial_number}=    Set Variable    ${list_olts}[${I}][sn]
+        #validate olt states
+        ${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    ${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}
+    Disable Onu Device
+    Current State Test All Onus    tech-profile-config-delete-success
+    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}
diff --git a/tests/openonu-go-adapter/Voltha_ONUStateTests.robot b/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
index f943b4c..a46ae97 100755
--- a/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
@@ -29,10 +29,11 @@
 Resource          ../../libraries/voltha.robot
 Resource          ../../libraries/utils.robot
 Resource          ../../libraries/k8s.robot
+Resource          ../../libraries/onu_utilities.robot
 Resource          ../../variables/variables.robot
-Resource          ../../libraries/Voltha_ONUUtilities.robot
 
 *** Variables ***
+${namespace}      voltha
 ${timeout}        60s
 ${of_id}          0
 ${logical_id}     0
@@ -151,17 +152,6 @@
     [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
     ...    AND    Stop Logging    DisableEnableONUDevice
 
-Reconcile Onu Device
-    [Documentation]    Reconciles ONU Device and check state
-    ...    Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
-    [Tags]    functionalOnuGo    ReconcileOnuGo
-    [Setup]    Start Logging    ReconcileONUDevice
-    Run Keyword If    '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
-    ...    Do Reconcile Onu Device
-    ...    ELSE    Pass Execution    ${skip_message}    skipped
-    [Teardown]    Run Keywords    Run Keyword If    ${logging}    Collect Logs
-    ...    AND    Stop Logging    ReconcileONUDevice
-
 Power Off Power On Onu Device
     [Documentation]    Power off and Power on of all ONU Devices and check state
     ...    Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
@@ -199,8 +189,9 @@
     ${skipped}=  Evaluate  "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
     ${skip_message}    Catenate    ${skipped} | ${skip} |
     Set Suite Variable    ${skip_message}
-    Set Suite Variable    ${all_onu_timeout}    ${timeout}
-    Run Keyword If   ${num_all_onus}>4    Calculate Timeout
+    ${all_onu_timeout}=    Run Keyword If   ${num_all_onus}>4    Calculate Timeout   ${timeout}
+    ...    ELSE    Set Variable    ${timeout}
+    Set Suite Variable    ${all_onu_timeout}
     ${techprofile}=    Set Variable If    "${techprofile}"=="1T1GEM"    default    ${techprofile}
     Set Suite Variable    ${techprofile}
     Run Keyword If    "${techprofile}"=="default"   Log To Console    \nTechProfile:default (1T1GEM)
@@ -229,12 +220,8 @@
     Run Keyword If    ${pausebeforecleanup}    Log    Teardown will be continued...    console=yes
     Run Keyword If    ${teardown_device}    Delete All Devices and Verify
     Validate Onu Data In Etcd    0
-    # Re-open ssh connection to onos since no keep alive is implemented in  SSH library
-    Close ONOS SSH Connection   ${onos_ssh_connection}
-    ${onos_ssh_connection}    Open ONOS SSH Connection    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
-    Set Suite Variable  ${onos_ssh_connection}
     Wait for Ports in ONOS for all OLTs      ${onos_ssh_connection}  0   BBSM    ${timeout}
-    Close ONOS SSH Connection   ${onos_ssh_connection}
+    Close All ONOS SSH Connections
     Remove Tech Profile
 
 Setup Test
@@ -261,15 +248,6 @@
     END
     Set Global Variable    ${olt_ids}
 
-Calculate Timeout
-    [Documentation]    Calculates the timeout regarding num-onus in case of more than 4 onus
-    ${all_onu_timeout}    Fetch From Left    ${all_onu_timeout}    s
-    ${all_onu_timeout}=    evaluate    ${all_onu_timeout}+((${num_all_onus}-4)*10)
-    ${all_onu_timeout}=    Set Variable If    (not ${debugmode}) and (${all_onu_timeout}>300)
-    ...    300   ${all_onu_timeout}
-    ${all_onu_timeout}=    Catenate    SEPARATOR=    ${all_onu_timeout}    s
-    Set Suite Variable    ${all_onu_timeout}
-
 Do ONU Up To State Test
     [Documentation]    This keyword performs Up2State Test
     ...    All states up to the passed have to be checked
@@ -365,7 +343,7 @@
     log     ${flowsresult}
     #check  for previous state is kept (normally omci-flows-pushed)
     Sleep    10s
-    Run Keyword And Continue On Failure    Do Current State Test All Onus    ${state2test}
+    Run Keyword And Continue On Failure    Current State Test All Onus    ${state2test}
     ${secondvlanrules}=    Run Keyword And Continue On Failure    Validate Vlan Rules In Etcd    nbofcookieslice=3
     ...    prevvlanrules=${firstvlanrules}
     FOR    ${J}    IN RANGE    0    ${num_olts}
@@ -383,14 +361,10 @@
     #check  for previous state is kept (normally omci-flows-pushed)
     Sleep    10s
     Run Keyword If    ${print2console}    Log    \r\nStart State Test All Onus.    console=yes
-    Run Keyword And Continue On Failure    Do Current State Test All Onus    ${state2test}
+    Run Keyword And Continue On Failure    Current State Test All Onus    ${state2test}
     Run Keyword If    ${print2console}    Log    \r\nFinished State Test All Onus.    console=yes
     Run Keyword And Continue On Failure    Validate Vlan Rules In Etcd    prevvlanrules=${firstvlanrules}
     ...                                    setvidequal=True
-    # Re-open ssh connection to onos since no keep alive is implemented in  SSH library
-    Close ONOS SSH Connection   ${onos_ssh_connection}
-    ${onos_ssh_connection}    Open ONOS SSH Connection    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
-    Set Suite Variable  ${onos_ssh_connection}
 
 Do Onu Subscriber Add Per OLT
     [Documentation]    Add Subscriber per OLT
@@ -443,34 +417,6 @@
         ...    console=yes
     END
 
-Set Tech Profile
-    [Documentation]    This keyword set the passed TechProfile for the test
-    [Arguments]    ${TechProfile}
-    Log To Console    \nTechProfile:${TechProfile}
-    ${namespace}=    Set Variable    default
-    ${podname}=    Set Variable    etcd
-    ${src}=    Set Variable    ${data_dir}/TechProfile-${TechProfile}.json
-    ${dest}=    Set Variable    /tmp/flexpod.json
-    ${command}    Catenate
-    ...    /bin/sh -c 'cat    ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
-    Copy File To Pod    ${namespace}    ${podname}    ${src}    ${dest}
-    Exec Pod In Kube    ${namespace}    ${podname}    ${command}
-    ${commandget}    Catenate
-    ...    /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
-    Exec Pod In Kube    ${namespace}    ${podname}    ${commandget}
-
-Remove Tech Profile
-    [Documentation]    This keyword removes TechProfile
-    Log To Console    \nTechProfile:${TechProfile}
-    ${namespace}=    Set Variable    default
-    ${podname}=    Set Variable    etcd
-    ${command}    Catenate
-    ...    /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
-    Exec Pod In Kube    ${namespace}    ${podname}    ${command}
-    ${commandget}    Catenate
-    ...    /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
-    Exec Pod In Kube    ${namespace}    ${podname}    ${commandget}
-
 Do Check Tech Profile
     [Documentation]    This keyword checks the loaded TechProfile
     ${namespace}=    Set Variable    default
@@ -495,91 +441,41 @@
     [Documentation]    This keyword disables/enables all onus and checks the states.
     [Arguments]    ${state2check}=${state2test}    ${checkstatebeforedisable}=True
     ...    ${state2checkafterdisable}=tech-profile-config-delete-success
-    Run Keyword If    ${checkstatebeforedisable}    Do Current State Test All Onus    ${state2check}
-    Do Disable Onu Device
+    Run Keyword If    ${checkstatebeforedisable}    Current State Test All Onus    ${state2check}
+    Disable Onu Device
     ${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}
-    Do Current State Test All Onus    ${state2checkafterdisable}    alternativeonustate=${alternative_onu_reason}
+    Current State Test All Onus    ${state2checkafterdisable}    alternativeonustate=${alternative_onu_reason}
     Log Ports
     #check no port is enabled in ONOS
     Wait for Ports in ONOS for all OLTs    ${onos_ssh_connection}    0    BBSM
-    Do Enable Onu Device
-    Do Current State Test All Onus    ${state2check}
+    Enable Onu Device
+    Current State Test All Onus    ${state2check}
     Log Ports    onlyenabled=True
     #check that all the UNI ports show up in ONOS again
     Wait for Ports in ONOS for all OLTs    ${onos_ssh_connection}    ${num_all_onus}    BBSM
 
-Do Reconcile Onu Device
-    [Documentation]    This keyword reconciles ONU device and check the state afterwards.
-    ...    Following steps will be executed:
-    ...    - restart openonu adaptor
-    ...    - check openonu adaptor is ready again
-    ...    - check previous state is kept
-    ...    - ONU-Disable
-    ...    - wait some seconds
-    ...    - check for state omci-admin-lock
-    ...    - ONU-Enable
-    ...    - wait some seconds
-    ...    - check for state onu-reenabled
-    ...    - port check
-    ${list_openonu_apps}   Create List    adapter-open-onu
-    ${namespace}=    Set Variable    voltha
-    ${adaptorname}=    Set Variable    open-onu
-    Kill Adaptor    ${namespace}    ${adaptorname}
-    Sleep    5s
-    Wait For Pods Ready    ${namespace}    ${list_openonu_apps}
-    Do Disable Enable Onu Test
-    Do Onu Port Check
-
 Do Power Off Power On Onu Device
     [Documentation]    This keyword power off/on all onus and checks the states.
-    Do Power Off ONU Device
+    Power Off ONU Device    ${namespace}
     Sleep    5s
-    #Do Current State Test All Onus    stopping-openomci
-    Do Current State Test All Onus    tech-profile-config-delete-success
+    Current State Test All Onus    tech-profile-config-delete-success
     ...    ENABLED    DISCOVERED    UNREACHABLE    alternativeonustate=omci-flows-deleted
-    Do Power On ONU Device
-    Do Current State Test All Onus    ${state2test}
+    Power On ONU Device    ${namespace}
+    Current State Test All Onus    ${state2test}
 
 Do Soft Reboot Onu Device
     [Documentation]    This keyword reboots softly all onus and checks the states.
-    ${namespace}=    Set Variable    voltha
     FOR    ${I}    IN RANGE    0    ${num_all_onus}
         ${src}=    Set Variable    ${hosts.src[${I}]}
         ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
         Reboot ONU    ${onu_device_id}   False
     END
-    Run Keyword Unless    ${has_dataplane}    Do Current State Test All Onus    tech-profile-config-delete-success
+    Run Keyword Unless    ${has_dataplane}    Current State Test All Onus    tech-profile-config-delete-success
     ...   ENABLED    DISCOVERED    REACHABLE    alternativeonustate=omci-flows-deleted
     Sleep    5s
     Run Keyword Unless    ${has_dataplane}    Do Disable Enable Onu Test    checkstatebeforedisable=False
     ...    state2checkafterdisable=omci-admin-lock
-    Run Keyword If    ${has_dataplane}    Do Current State Test All Onus    omci-flows-pushed
+    Run Keyword If    ${has_dataplane}    Current State Test All Onus    omci-flows-pushed
     Do Onu Port Check
-
-Do Disable Onu Device
-    [Documentation]    This keyword disables all onus.
-    FOR    ${I}    IN RANGE    0    ${num_all_onus}
-        ${src}=    Set Variable    ${hosts.src[${I}]}
-        ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
-        Disable Device    ${onu_device_id}
-        Wait Until Keyword Succeeds    20s    2s    Test Devices Disabled in VOLTHA    Id=${onu_device_id}
-    END
-
-Do Enable Onu Device
-    [Documentation]    This keyword enables all onus.
-    FOR    ${I}    IN RANGE    0    ${num_all_onus}
-        ${src}=    Set Variable    ${hosts.src[${I}]}
-        ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
-        Enable Device    ${onu_device_id}
-    END
-
-Do Power Off ONU Device
-    [Documentation]    This keyword power off all onus.
-    ${namespace}=    Set Variable    voltha
-    FOR    ${I}    IN RANGE    0    ${num_all_onus}
-        ${src}=    Set Variable    ${hosts.src[${I}]}
-        ${result}=    Exec Pod In Kube    ${namespace}    bbsim    bbsimctl onu shutdown ${src['onu']}
-        Should Contain    ${result}    successfully    msg=Can not shutdown ${src['onu']}    values=False
-    END
diff --git a/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot b/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot
index b106b35..1f3645a 100755
--- a/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot
@@ -31,11 +31,11 @@
 Resource          ../../libraries/voltha.robot
 Resource          ../../libraries/utils.robot
 Resource          ../../libraries/k8s.robot
+Resource          ../../libraries/onu_utilities.robot
 Resource          ../../variables/variables.robot
-Resource          ../../libraries/Voltha_ONUUtilities.robot
 
 *** Variables ***
-${NAMESPACE}      voltha
+${namespace}      voltha
 ${timeout}        60s
 ${of_id}          0
 ${logical_id}     0
@@ -101,14 +101,10 @@
     Run Keyword If    ${pausebeforecleanup}    Pause Execution    Press OK to continue with clean up!
     Run Keyword If    ${pausebeforecleanup}    Log    Teardown will be continued...    console=yes
     Run Keyword If    ${teardown_device}    Delete All Devices and Verify
-    # Re-open ssh connection to onos since no keep alive is implemented in  SSH library
-    Close ONOS SSH Connection   ${onos_ssh_connection}
-    ${onos_ssh_connection}    Open ONOS SSH Connection    ${ONOS_SSH_IP}    ${ONOS_SSH_PORT}
-    Set Suite Variable  ${onos_ssh_connection}
     Wait for Ports in ONOS for all OLTs      ${onos_ssh_connection}  0   BBSM
     # delete etcd MIB Template Data (for repeating test)
     Delete MIB Template Data
-    Close ONOS SSH Connection   ${onos_ssh_connection}
+    Close All ONOS SSH Connections
 
 Perform ONU MIB Template Data Test
     [Documentation]    This keyword performs ONU MIB Template Data Test
@@ -120,7 +116,7 @@
     # Start first Onu
     ${src}=    Set Variable    ${hosts.src[${0}]}
     Log    \r\nONU ${src['onu']}: startup with MIB upload cycle and storage of template data to etcd.    console=yes
-    ${result}=    Exec Pod In Kube    ${NAMESPACE}    bbsim    bbsimctl onu poweron ${src['onu']}
+    ${result}=    Exec Pod In Kube    ${namespace}    bbsim    bbsimctl onu poweron ${src['onu']}
     Should Contain    ${result}    successfully    msg=Can not poweron ${src['onu']}    values=False
     ${timeStart}=    Get Current Date
     ${firstonustartup}=    Get ONU Startup Duration    ${firstonu}    ${timeStart}
@@ -130,7 +126,7 @@
     # Start second Onu
     ${src}=    Set Variable    ${hosts.src[${1}]}
     Log    ONU ${src['onu']}: startup without MIB upload cycle by using of template data of etcd.    console=yes
-    ${result}=    Exec Pod In Kube    ${NAMESPACE}    bbsim    bbsimctl onu poweron ${src['onu']}
+    ${result}=    Exec Pod In Kube    ${namespace}    bbsim    bbsimctl onu poweron ${src['onu']}
     Should Contain    ${result}    successfully    msg=Can not poweron ${src['onu']}    values=False
     ${timeStart}=    Get Current Date
     ${secondonustartup}=    Get ONU Startup Duration    ${secondonu}    ${timeStart}