diff --git a/Jenkinsfile-voltha-build b/Jenkinsfile-voltha-build
deleted file mode 100644
index b313570..0000000
--- a/Jenkinsfile-voltha-build
+++ /dev/null
@@ -1,402 +0,0 @@
-// Copyright 2017-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.
-
-node ("${TestNodeName}") {
-    def withKind = false
-    def VolthaEtcdPort = '2379'
-    if (params.withKind != null){
-        withKind = params.withKind
-    }
-    if (params.VolthaEtcdPort != null){
-        VolthaEtcdPort = params.VolthaEtcdPort
-    }
-    timeout (100) {
-        try {
-            stage ("Parse deployment configuration file") {
-                sh returnStdout: true, script: "rm -rf ${configBaseDir} voltha-system-tests kind-voltha"
-                sh returnStdout: true, script: "git clone -b master ${cordRepoUrl}/${configBaseDir}"
-                sh returnStdout: true, script: "git clone -b master ${cordRepoUrl}/voltha-system-tests"
-                sh returnStdout: true, script: "git clone -b master ${cordRepoUrl}/kind-voltha"
-                if ( params.workFlow == "DT" ) {
-                    deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
-                }
-                else if ( params.workFlow == "TT" )
-                {
-                    deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-TT.yaml"
-                }
-                else
-                {
-                    deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
-                }
-            }
-            stage('Clean up') {
-                timeout(15) {
-                    sh returnStdout: true, script: """
-                    echo "cleaning up"
-                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                    HELM_MAJOR=\$(helm version --client --short | sed -E -e 's/^.*v([0-9]+)\\.[0-9]+\\.[0-9]+.*\$/\\1/')
-                    for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet|local-path-storage|cattle|fleet');
-                    do
-                        echo "Purging chart: \${hchart}"
-                        if [ \$HELM_MAJOR -le 2 ]; then
-                            helm delete --purge "\${hchart}"
-                        else
-                            helm uninstall "\${hchart}"
-                        fi
-                    done
-                    if [ \$HELM_MAJOR -gt 2 ]; then
-                        for hchart in \$(helm list -q -n voltha | grep -E -v 'docker-registry|mavenrepo|ponnet|local-path-storage|cattle|fleet');
-                        do
-                            echo "Purging chart: \${hchart}"
-                            if [ \$HELM_MAJOR -le 2 ]; then
-                                helm delete --purge "\${hchart}"
-                            else
-                                helm uninstall -n voltha "\${hchart}"
-                            fi
-                        done
-                    fi
-                    """
-                    timeout(5) {
-                        waitUntil {
-                            helm_deleted = sh returnStdout: true, script: """
-
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                            HELM_MAJOR=\$(helm version --client --short | sed -E -e 's/^.*v([0-9]+)\\.[0-9]+\\.[0-9]+.*\$/\\1/')
-
-                            if [ \$HELM_MAJOR -le 2 ]; then
-                                helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet|local-path-storage|cattle|fleet' | wc -l
-                            else
-                                helm list -q --all-namespaces | grep -E -v 'docker-registry|mavenrepo|ponnet|local-path-storage|cattle|fleet' | wc -l
-                            fi
-                            """
-                            return helm_deleted.toInteger() == 0
-                        }
-                    }
-                    timeout(5) {
-                        waitUntil {
-                            kubectl_deleted = sh returnStdout: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
-                            kubectl get pods --all-namespaces --no-headers | grep -E -v 'kube-system|docker-registry|mavenrepo|ponnet|local-path-storage|cattle|fleet' | wc -l
-                            """
-                            return kubectl_deleted.toInteger() == 0
-                        }
-                    }
-                    timeout(1) {
-                        sh returnStdout: false, script: """
-                        #Remove all while true; do kubectl port-forward ...done; rules
-                        for port_fwd_id in `ps -ax | grep "port-forward" | grep -E "onos|voltha" | grep "while true"| awk '{print \$1}'`;
-                        do
-                            kill -9 \$port_fwd_id || true
-                        done
-
-                        #Remove all kubectl port-forward rules
-                        for port_fwd_id in `ps -ax | grep "port-forward" | grep -E "onos|voltha" | awk '{print \$1}'`;
-                        do
-                            kill -9 \$port_fwd_id || true
-                        done
-                        """
-                    }
-                }
-            }
-            stage('Install Voltha')  {
-                timeout(20) {
-                    sh returnStdout: true, script: """
-                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                    cd kind-voltha/
-                    export EXTRA_HELM_FLAGS=""
-                    if [ "${branch}" != "master" ]; then
-                        cd $WORKSPACE/kind-voltha
-                        # The releases/ file also specifies EXTRA_HELM_FLAGS
-                        source releases/${branch}
-                    fi
-                    # Make sure that the EXTRA_HELM_FLAGS from the releases/ file appear at the end to override earlier values
-                    export EXTRA_HELM_FLAGS="-f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/voltha/${configFileName}.yml \$EXTRA_HELM_FLAGS"
-
-                    # JENKINS_NODE_COOKIE=dontKillMe ask Jenkins doesn't kill the proces after this job.
-                    # we want the `while true; do kubectl port-forward` keep alive
-                    export JENKINS_NODE_COOKIE=dontKillMe
-                    export NUM_OF_OPENONU=${NumOfOpenOnu}
-                    export NUM_OF_ONOS=${NumOfOnos}
-                    export NUM_OF_ATOMIX=${NumOfAtomix}
-                    # VOL-2194 ONOS SSH and REST ports hardcoded to 30115/30120 in tests
-                    export ONOS_SSH_PORT=30115
-                    export ONOS_API_PORT=30120
-                    export VOLTHA_LOG_LEVEL=DEBUG
-                    export WITH_SIM_ADAPTERS=n
-                    export DEPLOY_K8S=no
-                    export INSTALL_KUBECTL=no
-                    export INSTALL_HELM=no
-                    export WITH_RADIUS=yes
-                    export FANCY=0
-                    export SCHEDULE_ON_CONTROL_NODES=yes
-                    export VOLTHA_ADAPTER_OPEN_OLT_CHART=${openoltAdapterChart}
-                    # VOL-3162 Forwaring port 2379 does not work on ONF demo pod
-                    export VOLTHA_ETCD_PORT=${VolthaEtcdPort}
-
-                    if [[ "${workFlow}" == "DT" ]]; then
-                       WITH_EAPOL=no WITH_DHCP=no WITH_IGMP=no WITH_RADIUS=no ./voltha up
-                    elif [[  "${workFlow}" == "TT" ]]; then
-                       WITH_EAPOL=no WITH_DHCP=yes WITH_INCREMENTAL_EVTO_UPDATE=yes WITH_IGMP=yes WITH_RADIUS=no ./voltha up
-                    else
-                       ./voltha up
-                    fi
-                    # Install BBSim when the parameter is checked
-                    if ( ${installBBSim} ); then
-                       helm upgrade --install -n voltha bbsim0 onf/bbsim --set olt_id=1 --set onu=${onuNumber},pon=${ponNumber}
-                    fi
-
-                    kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.image}{'\\n'}" | sort | uniq
-                    kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq
-                    kubectl get nodes -o wide
-                    kubectl get pods -n voltha -o wide
-                    kubectl get pods
-                    """
-                    }
-            }
-            if ( withKind && deployment_config.fabric_switches.size() > 0 ) {
-                stage('OpenFlow port forward for aggregation switch') {
-                    timeout(1) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        #This uses the default route out, porperly configured is the management
-                        mgmt_address=`ip route get 1 | awk '{print \$NF;exit}'`
-                        JENKINS_NODE_COOKIE=dontkill kubectl port-forward -n default service/onos-onos-classic-hs --address=\$mgmt_address 6653:6653 >> /dev/null 2>&1 &
-                        """
-                    }
-                }
-            }
-            if ( params.configurePod && params.profile != "Default" ) {
-                stage('Push Tech-Profile') {
-                    for(int i=0; i < deployment_config.olts.size(); i++) {
-                        def tech_prof_directory = "XGS-PON"
-                        // If no debian package is specified we default to GPON for the ADTRAN OLT.
-                        if (!deployment_config.olts[i].containsKey("oltDebVersion") || deployment_config.olts[i].oltDebVersion.contains("asgvolt64")){
-                            tech_prof_directory = "GPON"
-                        }
-                        timeout(1) {
-                            out_push_tp = sh returnStatus: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                            etcd_container=\$(kubectl get pods | grep etcd | awk 'NR==1{print \$1}')
-                            if [[ "${workFlow}" == "TT" ]]; then
-                               kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json
-                               put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/hsia.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/64')
-                               kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json
-                               put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/voip.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/65')
-                               kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST.json \$etcd_container:/tmp/mcast.json
-                               put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/mcast.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/66')
-                            else
-                               kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json
-                               put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/flexpod.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/64')
-                            fi
-
-                            """
-                            return out_push_tp == 0
-                        }
-                        timeout(1) {
-                            out_get_tp = sh returnStatus: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                            etcd_container=\$(kubectl get pods | grep etcd | awk 'NR==1{print \$1}')
-                            get_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64')
-                            """
-                            return out_get_tp == 0
-                        }
-                    }
-                }
-            }
-            stage('Push Sadis-config') {
-                timeout(1) {
-                    sadis_out = sh returnStatus: true, script: """
-                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                    etcd_container=\$(kubectl get pods | grep etcd | awk 'NR==1{print \$1}')
-                    kubectl cp $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json
-                    put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/MIB_Alpha.json | ETCDCTL_API=3 etcdctl put service/voltha/omci_mibs/templates/BRCM/BVM4K00BRA0915-0083/5023_020O02414')
-                    kubectl cp $WORKSPACE/voltha-system-tests/tests/data/MIB_Scom.json \$etcd_container:/tmp/MIB_Scom.json
-                    put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/MIB_Scom.json | ETCDCTL_API=3 etcdctl put service/voltha/omci_mibs/templates/SCOM/Glasfaser-Modem/090140.1.0.304')
-                    if [[ "${workFlow}" == "DT" ]]; then
-                        curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @$WORKSPACE/voltha-system-tests/tests/data/${configFileName}-sadis-DT.json
-                    elif [[ "${workFlow}" == "TT" ]]; then
-                        curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @$WORKSPACE/voltha-system-tests/tests/data/${configFileName}-sadis-TT.json
-                    else
-                        curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @$WORKSPACE/voltha-system-tests/tests/data/${configFileName}-sadis.json
-                    fi
-                    """
-                    return sadis_out == 0
-                }
-            }
-            if ( deployment_config.fabric_switches.size() > 0 ) {
-                stage('Switch Configurations in ONOS') {
-                    timeout(1) {
-                        def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json"
-                        if (params.inBandManagement){
-                             netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json"
-                        }
-                        netcfg_out = sh returnStatus: true, script: """
-                        curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @${netcfg}
-                        curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active
-
-                        """
-                        return netcfg_out == 0
-                    }
-                    timeout(1) {
-                        waitUntil {
-                            sr_active_out = sh returnStatus: true, script: """
-                            sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.dhcpl2relay"
-                            sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.aaa"
-                            sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.olt"
-                            sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set DEBUG org.onosproject.net.flowobjective.impl.FlowObjectiveManager"
-                            sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set DEBUG org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager"
-                            curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE
-                            sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled false"
-                            sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "cfg set org.onosproject.net.flow.impl.FlowRuleManager purgeOnDisconnection false"
-                            sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "cfg set org.onosproject.net.meter.impl.MeterManager purgeOnDisconnection false"
-                            """
-                            return sr_active_out == 0
-                        }
-                    }
-                    timeout(5) {
-                        for(int i=0; i < deployment_config.hosts.src.size(); i++) {
-                            for(int j=0; j < deployment_config.olts.size(); j++) {
-                                def aggPort = -1
-                                if(deployment_config.olts[j].serial == deployment_config.hosts.src[i].olt){
-                                    aggPort = deployment_config.olts[j].aggPort
-                                    if(aggPort == -1){
-                                        throw new Exception("Upstream port for the olt is not configured, field aggPort is empty")
-                                    }
-                                    xconnect_out = sh returnStatus: true, script: """
-                                    sleep 30
-                                    version=\$(sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "summary" | grep version)
-                                    sleep 10
-                                    if [[ \$version == *"version=2.2"* ]]; then
-                                        curl -X POST --user karaf:karaf --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"deviceId": "${deployment_config.fabric_switches[0].device_id}", "vlanId": "${deployment_config.hosts.src[i].s_tag}", "endpoints": [${deployment_config.fabric_switches[0].bngPort},${aggPort}]}' 'http://${deployment_config.nodes[0].ip}:30120/onos/segmentrouting/xconnect'
-                                    else
-                                        curl -X POST --user karaf:karaf --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"deviceId": "${deployment_config.fabric_switches[0].device_id}", "vlanId": "${deployment_config.hosts.src[i].s_tag}", "ports": [${deployment_config.fabric_switches[0].bngPort},${aggPort}]}' 'http://${deployment_config.nodes[0].ip}:30120/onos/segmentrouting/xconnect'
-                                    fi
-                                    """
-                                }
-
-                            }
-                        }
-                    }
-                }
-            }
-            if ( params.reinstallOlt ) {
-                stage('Reinstall OLT software') {
-                    for(int i=0; i < deployment_config.olts.size(); i++) {
-                        sh returnStdout: true, script: """
-                        if [[ "${branch}" != "master" ]] && [[ "${params.inBandManagement}" == "true" ]]; then
-                            ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
-                            sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'kill -9 `pgrep -f "[b]ash /opt/openolt/openolt_dev_mgmt_daemon_process_watchdog"` || true'
-                            sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} "dpkg --install ${deployment_config.olts[i].oltDebVersion23}"
-                        fi
-                        if [[ "${branch}" != "master" ]] && [[ "${params.inBandManagement}" == "false" ]]; then
-                            ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
-                            sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} "dpkg --install ${deployment_config.olts[i].oltDebVersion23}"
-                        fi
-                        if [[ "${branch}" == "master" ]] && [[ "${params.inBandManagement}" == "true" ]]; then
-                            ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
-                            sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'kill -9 `pgrep -f "[b]ash /opt/openolt/openolt_dev_mgmt_daemon_process_watchdog"` || true'
-                            sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} "dpkg --install ${deployment_config.olts[i].oltDebVersion}"
-                        fi
-                        if [[ "${branch}" == "master" ]] && [[ "${params.inBandManagement}" == "false" ]]; then
-                            ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
-                            sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} "dpkg --install ${deployment_config.olts[i].oltDebVersion}"
-                        fi
-                        sleep 10
-                        """
-                        timeout(5) {
-                            waitUntil {
-                                olt_sw_present = sh returnStdout: true, script: """
-                                if [ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]; then
-                                    sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep asfvolt16 | wc -l'
-                                else
-                                    sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep asgvolt64 | wc -l'
-                                fi
-                                if (${deployment_config.olts[i].fortygig}); then
-                                    if [[ "${params.inBandManagement}" == "true" ]]; then
-                                        ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
-                                        sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'mkdir -p /opt/openolt/'
-                                        sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'cp /root/watchdog-script/* /opt/openolt/'
-                                        sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'cp /root/bal_cli_appl/example_user_appl /broadcom'
-                                        sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'cp in-band-startup-script/* /etc/init.d/'
-                                    fi
-                                fi
-                                """
-                                return olt_sw_present.toInteger() > 0
-                            }
-                        }
-                    }
-                }
-                stage('Restart OLT processes') {
-                    for(int i=0; i < deployment_config.olts.size(); i++) {
-                        int waitTimerForOltUp = 360
-                        if ( params.inBandManagement ) {
-                            waitTimerForOltUp = 540
-                        }
-                        timeout(15) {
-                            sh returnStdout: true, script: """
-                            ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
-                            sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'rm -f /var/log/openolt.log; rm -f /var/log/dev_mgmt_daemon.log; rm -f /var/log/openolt_process_watchdog.log; reboot' || true
-                            sleep ${waitTimerForOltUp}
-                            """
-                        }
-                        timeout(15) {
-                            waitUntil {
-                                devprocess = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'ps -ef | grep dev_mgmt_daemon | wc -l'"
-                                return devprocess.toInteger() > 0
-                            }
-                        }
-                        timeout(15) {
-                            waitUntil {
-                                openoltprocess = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'ps -ef | grep openolt | wc -l'"
-                                return openoltprocess.toInteger() > 0
-                            }
-                        }
-                    }
-                }
-            }
-            /*if ( params.inBandManagement ) {
-                stage('Reboot OLT') {
-                    for(int i=0; i < deployment_config.olts.size(); i++) {
-                        timeout(10) {
-                            sh returnStdout: true, script: """
-                            ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
-                            sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'rm -f /var/log/openolt.log; rm -f /var/log/dev_mgmt_daemon.log; rm -f /var/log/startup.log; rm -f /var/log/openolt_process_watchdog.log; reboot' || true
-                            sleep 360
-                            """
-                        }
-                        timeout(15) {
-                            waitUntil {
-                                devprocess = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'ps -ef | grep dev_mgmt_daemon | wc -l'"
-                                return devprocess.toInteger() > 0
-                            }
-                        }
-                        timeout(15) {
-                            waitUntil {
-                                openoltprocess = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'ps -ef | grep openolt | wc -l'"
-                                return openoltprocess.toInteger() > 0
-                            }
-                        }
-                    }
-                }
-            }*/
-
-            currentBuild.result = 'SUCCESS'
-        } catch (err) {
-            currentBuild.result = 'FAILURE'
-            step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
-            throw err
-        }
-        echo "RESULT: ${currentBuild.result}"
-    }
-}
