Merge "Fixing voltha-2.6 scale pipeline (do not use openonu-go master image)"
diff --git a/jjb/cord-test/voltha.yaml b/jjb/cord-test/voltha.yaml
index 6e3d996..e1e2b17 100644
--- a/jjb/cord-test/voltha.yaml
+++ b/jjb/cord-test/voltha.yaml
@@ -610,7 +610,7 @@
           configurePod: true
           profile: '1T8GEM'
           reinstall-olt: false
-          openoltAdapterChart: '/home/community/adtran-2021-01-19/voltha-adapter-adtran-olt'
+          openoltAdapterChart: '/home/community/adtran-2021-01-29/voltha-adapter-adtran-olt'
           time: '9'
 
 
diff --git a/jjb/defaults.yaml b/jjb/defaults.yaml
index a21ea1f..0f133db 100644
--- a/jjb/defaults.yaml
+++ b/jjb/defaults.yaml
@@ -84,6 +84,7 @@
     modern-branches-regexp: '^(master|cord-7.0|cord-6.1|cord-6.0|seba-1.0|voltha-2.3|voltha-2.4)$'
     platform-branches-regexp: '^(master|cord-7.0|cord-6.1)$'
     seba-branches-regexp: '^(master|cord-7.0|seba-1.0)$'
+    kind-voltha-regexp: '^(voltha-2.6)$'
 
     # matchs all project repos
     all-projects-regexp: '.*'
diff --git a/jjb/omec-ci.yaml b/jjb/omec-ci.yaml
index 674ed2a..fe03e2d 100644
--- a/jjb/omec-ci.yaml
+++ b/jjb/omec-ci.yaml
@@ -1116,6 +1116,11 @@
           default: '{registry-proxy}/upf-epc-pfcpiface:master-latest'
           description: 'Docker image for pfcpiface. Leave empty to use default helm-charts value'
 
+      - string:
+          name: maintainers
+          default: 'you@opennetworking.org'
+          description: "The person that sould be notified if this job fails"
+
     concurrent: false
 
     triggers:
diff --git a/jjb/pipeline/voltha-dt-physical-build-and-tests.groovy b/jjb/pipeline/voltha-dt-physical-build-and-tests.groovy
index 8b74eb6..42e253c 100644
--- a/jjb/pipeline/voltha-dt-physical-build-and-tests.groovy
+++ b/jjb/pipeline/voltha-dt-physical-build-and-tests.groovy
@@ -196,6 +196,8 @@
               IMAGES="adapter_open_olt "
           elif [ "${gerritProject}" = "voltha-openonu-adapter" ]; then
               IMAGES="adapter_open_onu "
+          elif [ "${gerritProject}" = "voltha-openonu-adapter-go" ]; then
+              IMAGES="adapter_open_onu_go "
           elif [ "${gerritProject}" = "voltha-api-server" ]; then
               IMAGES="afrouter afrouterd "
           else
diff --git a/jjb/pipeline/voltha-openonu-go-test-bbsim.groovy b/jjb/pipeline/voltha-openonu-go-test-bbsim.groovy
index 7e6c688..f7e2b60 100755
--- a/jjb/pipeline/voltha-openonu-go-test-bbsim.groovy
+++ b/jjb/pipeline/voltha-openonu-go-test-bbsim.groovy
@@ -23,7 +23,7 @@
     label "${params.buildNode}"
   }
   options {
-    timeout(time: 115, unit: 'MINUTES')
+    timeout(time: 130, unit: 'MINUTES')
   }
   environment {
     KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
@@ -280,7 +280,7 @@
            export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
 
            # start logging
-           mkdir -p $WORKSPACE/dt
+           mkdir -p $WORKSPACE/reconciledt
            _TAG=kail-reconcile-dt kail -n voltha -n default > $WORKSPACE/reconciledt/onos-voltha-combined.log &
 
            DEPLOY_K8S=n ./voltha up
@@ -334,7 +334,7 @@
            fi
 
            # start logging
-           mkdir -p $WORKSPACE/att
+           mkdir -p $WORKSPACE/reconcileatt
            _TAG=kail-reconcile-att kail -n voltha -n default > $WORKSPACE/reconcileatt/onos-voltha-combined.log &
 
            DEPLOY_K8S=n ./voltha up
@@ -382,7 +382,7 @@
            export BBSIM_CFG="configs/bbsim-sadis-tt.yaml"
 
            # start logging
-           mkdir -p $WORKSPACE/tt
+           mkdir -p $WORKSPACE/reconcilett
            _TAG=kail-reconcile-tt kail -n voltha -n default > $WORKSPACE/reconcilett/onos-voltha-combined.log &
 
            DEPLOY_K8S=n ./voltha up
diff --git a/jjb/pipeline/voltha-openonu-go-tests.groovy b/jjb/pipeline/voltha-openonu-go-tests.groovy
index 27daa51..e86d61f 100755
--- a/jjb/pipeline/voltha-openonu-go-tests.groovy
+++ b/jjb/pipeline/voltha-openonu-go-tests.groovy
@@ -229,7 +229,10 @@
           mkdir -p $ROBOT_LOGS_DIR/1t8gem
           export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
           export TARGET_1T8GEM=1t8gem-openonu-go-adapter-test
-          export NAME=voltha_voltha
+
+          if [ "${branch}" != "voltha-2.6" ]; then
+            export NAME=voltha_voltha
+          fi
 
           make -C $WORKSPACE/voltha-system-tests \$TARGET_1T8GEM || true
 
diff --git a/jjb/pipeline/voltha-physical-build-and-tests.groovy b/jjb/pipeline/voltha-physical-build-and-tests.groovy
index 306a426..f72b15d 100644
--- a/jjb/pipeline/voltha-physical-build-and-tests.groovy
+++ b/jjb/pipeline/voltha-physical-build-and-tests.groovy
@@ -192,6 +192,8 @@
               IMAGES="adapter_open_olt "
           elif [ "${gerritProject}" = "voltha-openonu-adapter" ]; then
               IMAGES="adapter_open_onu "
+          elif [ "${gerritProject}" = "voltha-openonu-adapter-go" ]; then
+              IMAGES="adapter_open_onu_go "
           elif [ "${gerritProject}" = "voltha-api-server" ]; then
               IMAGES="afrouter afrouterd "
           else
diff --git a/jjb/pipeline/voltha-scale-test.groovy b/jjb/pipeline/voltha-scale-test.groovy
index ae0f63f..7959f48 100644
--- a/jjb/pipeline/voltha-scale-test.groovy
+++ b/jjb/pipeline/voltha-scale-test.groovy
@@ -284,13 +284,13 @@
               EXTRA_HELM_FLAGS+="--set images.bbsim.repository=${dockerRegistry}/voltha/bbsim,images.bbsim.tag=voltha-scale "
             fi
 
-            helm upgrade --install voltha-infra onf/voltha-infra \
+            helm upgrade --install voltha-infra onf/voltha-infra \$EXTRA_HELM_FLAGS \
               --set onos-classic.replicas=${onosReplicas},onos-classic.atomix.replicas=${atomixReplicas} \
               --set etcd.enabled=false,kafka.enabled=false \
               --set global.log_level=${logLevel} \
               -f $WORKSPACE/voltha-helm-charts/examples/${workflow}-values.yaml
 
-            helm upgrade --install voltha1 onf/voltha-stack \
+            helm upgrade --install voltha1 onf/voltha-stack \$EXTRA_HELM_FLAGS \
               --set global.stack_name=voltha1 \
               --set global.voltha_infra_name=voltha-infra \
               --set global.voltha_infra_namespace=default \
@@ -301,15 +301,16 @@
               --set voltha-adapter-openolt.services.kafka.adapter.address=kafka.default.svc:9092 \
               --set voltha-adapter-openolt.services.kafka.cluster.address=kafka.default.svc:9092 \
               --set voltha-adapter-openolt.services.etcd.address=etcd.default.svc:2379 \
-              --set voltha-adapter-openonu.services.kafka.adapter.service=kafka.default.svc \
-              --set voltha-adapter-openonu.services.kafka.cluster.service=kafka.default.svc \
-              --set voltha-adapter-openonu.services.etcd.service=etcd.default.svc
+              --set voltha-adapter-openonu.services.kafka.adapter.address=kafka.default.svc:9092 \
+              --set voltha-adapter-openonu.services.kafka.cluster.address=kafka.default.svc:9092 \
+              --set voltha-adapter-openonu.services.etcd.address=etcd.default.svc:2379
               # TODO having to set all of these values is annoying, is there a better solution?
 
 
             for i in {0..${olts.toInteger() - 1}}; do
               stackId=1
-              helm upgrade --install bbsim\$i onf/bbsim --set olt_id="\${stackId}\${i}" \
+              helm upgrade --install bbsim\$i onf/bbsim \$EXTRA_HELM_FLAGS \
+                --set olt_id="\${stackId}\${i}" \
                 --set onu=${onus},pon=${pons} \
                 --set global.log_level=${logLevel.toLowerCase()} \
                 -f $WORKSPACE/voltha-helm-charts/examples/${workflow}-values.yaml
diff --git a/jjb/pipeline/voltha/master/bbsim-tests.groovy b/jjb/pipeline/voltha/master/bbsim-tests.groovy
new file mode 100644
index 0000000..8d9458c
--- /dev/null
+++ b/jjb/pipeline/voltha/master/bbsim-tests.groovy
@@ -0,0 +1,168 @@
+// 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.
+
+// voltha-2.x e2e tests
+// uses bbsim to simulate OLT/ONUs
+
+def customImageFlags(image) {
+  return "--set images.${image}.tag=citest,images.${image}.pullPolicy=Never "
+}
+
+def test_workflow(name) {
+  stage('Deploy - '+ name + ' workflow') {
+      def extraHelmFlags = "${extraHelmFlags} --set global.log_level=DEBUG,onu=1,pon=1 "
+
+      if (gerritProject != "") {
+        extraHelmFlags = extraHelmFlags + customImageFlags("${gerritProject}")
+      }
+
+      volthaDeploy([workflow: name, extraHelmFlags: extraHelmFlags])
+      // start logging
+      sh """
+      mkdir -p $WORKSPACE/${name}
+      _TAG=kail-${name} kail -n infra -n voltha > $WORKSPACE/${name}/onos-voltha-combined.log &
+      """
+      // forward ONOS and VOLTHA ports
+      sh """
+      _TAG=onos-port-forward kubectl port-forward --address 0.0.0.0 -n infra svc/voltha-infra-onos-classic-hs 8101:8101&
+      _TAG=onos-port-forward kubectl port-forward --address 0.0.0.0 -n infra svc/voltha-infra-onos-classic-hs 8181:8181&
+      _TAG=voltha-port-forward kubectl port-forward --address 0.0.0.0 -n voltha svc/voltha-voltha-api 55555:55555&
+      """
+  }
+  stage('Test VOLTHA - '+ name + ' workflow') {
+      sh """
+      ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/${name.toUpperCase()}Workflow"
+      mkdir -p \$ROBOT_LOGS_DIR
+      export ROBOT_MISC_ARGS="-d \$ROBOT_LOGS_DIR -e PowerSwitch"
+
+      # By default, all tests tagged 'sanity' are run.  This covers basic functionality
+      # like running through the ATT workflow for a single subscriber.
+      export TARGET=sanity-kind-${name}
+
+      # If the Gerrit comment contains a line with "functional tests" then run the full
+      # functional test suite.  This covers tests tagged either 'sanity' or 'functional'.
+      # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
+      REGEX="functional tests"
+      if [[ "\$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
+        export TARGET=functional-single-kind-${name}
+      fi
+
+      if [[ "${gerritProject}" == "bbsim" ]]; then
+        echo "Running BBSim specific Tests"
+        export TARGET=sanity-bbsim-${name}
+      fi
+
+      export VOLTCONFIG=$HOME/.volt/config
+      export KUBECONFIG=$HOME/.kube/config
+
+      # Run the specified tests
+      make -C $WORKSPACE/voltha-system-tests \$TARGET || true
+      """
+      // stop logging
+      sh """
+        P_IDS="\$(ps e -ww -A | grep "_TAG=kail-${name}" | grep -v grep | awk '{print \$1}')"
+        if [ -n "\$P_IDS" ]; then
+          echo \$P_IDS
+          for P_ID in \$P_IDS; do
+            kill -9 \$P_ID
+          done
+        fi
+      """
+      // remove port-forwarding
+      sh """
+        # remove orphaned port-forward from different namespaces
+        ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9
+      """
+      // collect pod details
+      sh """
+      kubectl get pods --all-namespaces -o wide > \$WORKSPACE/${name}/pods.txt || true
+      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee \$WORKSPACE/att/pod-images.txt || true
+      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee \$WORKSPACE/att/pod-imagesId.txt || true
+      """
+      helmTeardown(['infra', 'voltha'])
+  }
+}
+
+pipeline {
+
+  /* no label, executor is determined by JJB */
+  agent {
+    label "${params.buildNode}"
+  }
+  options {
+    timeout(time: 30, unit: 'MINUTES')
+  }
+  environment {
+    PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
+    KUBECONFIG="$HOME/.kube/kind-config-${clusterName}"
+  }
+
+  stages{
+    stage('Download Code') {
+      steps {
+        getVolthaCode([
+          branch: "${branch}",
+          gerritProject: "${gerritProject}",
+          gerritRefspec: "${gerritRefspec}",
+          volthaSystemTestsChange: "${volthaSystemTestsChange}",
+          volthaHelmChartsChange: "${volthaHelmChartsChange}",
+        ])
+      }
+    }
+    stage('Build patch') {
+      steps {
+        // NOTE that the correct patch has already been checked out
+        // during the getVolthaCode step
+        buildVolthaComponent("${gerritProject}")
+      }
+    }
+    stage('Create K8s Cluster') {
+      steps {
+        createKubernetesCluster([nodes: 3])
+      }
+    }
+    stage('Load image in kind nodes') {
+      steps {
+        loadToKind()
+      }
+    }
+    stage('Run Test') {
+      steps {
+        test_workflow("att")
+        test_workflow("dt")
+        test_workflow("tt")
+      }
+    }
+  }
+
+  post {
+    always {
+      sh '''
+      gzip $WORKSPACE/att/onos-voltha-combined.log || true
+      gzip $WORKSPACE/dt/onos-voltha-combined.log || true
+      gzip $WORKSPACE/tt/onos-voltha-combined.log || true
+      '''
+      step([$class: 'RobotPublisher',
+         disableArchiveOutput: false,
+         logFileName: 'RobotLogs/*/log*.html',
+         otherFiles: '',
+         outputFileName: 'RobotLogs/*/output*.xml',
+         outputPath: '.',
+         passThreshold: 100,
+         reportFileName: 'RobotLogs/*/report*.html',
+         unstableThreshold: 0]);
+      archiveArtifacts artifacts: '*.log,**/*.log,**/*.gz,*.gz'
+    }
+  }
+}
diff --git a/jjb/verify/bbsim-sadis-server.yaml b/jjb/verify/bbsim-sadis-server.yaml
index 5cdbc5c..4abebd2 100644
--- a/jjb/verify/bbsim-sadis-server.yaml
+++ b/jjb/verify/bbsim-sadis-server.yaml
@@ -8,6 +8,11 @@
     jobs:
       - 'verify-bbsim-sadis-server-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'verify-bbsim-sadis-server-jobs-voltha-2.6':
+          name-extension: '-voltha-2.6'
+          branch-regexp: '{kind-voltha-regexp}'
+      - 'verify-bbsim-sadis-server-jobs-master':
+          branch-regexp: '^master$'
       - 'publish-bbsim-sadis-server-jobs':
           branch-regexp: '{all-branches-regexp}'
 
@@ -22,10 +27,20 @@
           dest-gopath: "github.com/opencord"
           unit-test-targets: 'lint sca test'
           unit-test-keep-going: 'true'
+
+- job-group:
+    name: 'verify-bbsim-sadis-server-jobs-voltha-2.6'
+    jobs:
       - 'voltha-patch-test':
           pipeline-script: 'voltha-bbsim-tests.groovy'
 
 - job-group:
+    name: 'verify-bbsim-sadis-server-jobs-master'
+    jobs:
+      - 'voltha-patch-test':
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
+
+- job-group:
     name: 'publish-bbsim-sadis-server-jobs'
     jobs:
       - 'docker-publish':
diff --git a/jjb/verify/bbsim.yaml b/jjb/verify/bbsim.yaml
index 1310f01..14553c0 100644
--- a/jjb/verify/bbsim.yaml
+++ b/jjb/verify/bbsim.yaml
@@ -8,6 +8,12 @@
     jobs:
       - 'verify-bbsim-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'verify-bbsim-jobs-voltha-2.6':
+          name-extension: '-voltha-2.6'
+          override-branch: 'voltha-2.6'
+          branch-regexp: '{kind-voltha-regexp}'
+      - 'verify-bbsim-jobs-master':
+          branch-regexp: '^master$'
       - 'publish-bbsim-jobs':
           branch-regexp: '{all-branches-regexp}'
 
@@ -22,10 +28,20 @@
           dest-gopath: "github.com/opencord"
           unit-test-targets: 'lint sca test'
           unit-test-keep-going: 'true'
+
+- job-group:
+    name: 'verify-bbsim-jobs-voltha-2.6'
+    jobs:
       - 'voltha-patch-test':
           pipeline-script: 'voltha-bbsim-tests.groovy'
 
 - job-group:
+    name: 'verify-bbsim-jobs-master'
+    jobs:
+      - 'voltha-patch-test':
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
+
+- job-group:
     name: 'publish-bbsim-jobs'
     jobs:
       - 'docker-publish':
diff --git a/jjb/verify/kind-voltha.yaml b/jjb/verify/kind-voltha.yaml
index e66be45..952b1c0 100644
--- a/jjb/verify/kind-voltha.yaml
+++ b/jjb/verify/kind-voltha.yaml
@@ -17,6 +17,7 @@
       - 'make-unit-test':
           unit-test-targets: 'test'
           junit-allow-empty-results: true
+      # Remove kind-voltha test on master once we are not depending on it anymore
       - 'voltha-patch-test':
           pipeline-script: 'voltha-bbsim-tests.groovy'
       - 'voltha-patch-test':
diff --git a/jjb/verify/ofagent-go.yaml b/jjb/verify/ofagent-go.yaml
index 0c7aa13..f3475ee 100644
--- a/jjb/verify/ofagent-go.yaml
+++ b/jjb/verify/ofagent-go.yaml
@@ -8,6 +8,12 @@
     jobs:
       - 'verify-ofagent-go-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'verify-ofagent-jobs-voltha-2.6':
+          name-extension: '-voltha-2.6'
+          override-branch: 'voltha-2.6'
+          branch-regexp: '{kind-voltha-regexp}'
+      - 'verify-ofagent-jobs-master':
+          branch-regexp: '^master$'
       - 'publish-ofagent-go-jobs':
           branch-regexp: '{all-branches-regexp}'
 
@@ -23,10 +29,20 @@
           unit-test-targets: 'lint sca test'
           unit-test-keep-going: 'true'
           junit-allow-empty-results: true
+
+- job-group:
+    name: 'verify-ofagent-jobs-voltha-2.6'
+    jobs:
       - 'voltha-patch-test':
           pipeline-script: 'voltha-bbsim-tests.groovy'
 
 - job-group:
+    name: 'verify-ofagent-jobs-master'
+    jobs:
+      - 'voltha-patch-test':
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
+
+- job-group:
     name: 'publish-ofagent-go-jobs'
     jobs:
       - 'docker-publish':
diff --git a/jjb/verify/ofagent-py.yaml b/jjb/verify/ofagent-py.yaml
index 2a5ea78..733cbf7 100644
--- a/jjb/verify/ofagent-py.yaml
+++ b/jjb/verify/ofagent-py.yaml
@@ -1,6 +1,8 @@
 ---
 # verification jobs for 'ofagent-py' repo
 
+# NOTE ofagent-py is unmaintained, should we keep running tests?
+
 - project:
     name: ofagent-py
     project: '{name}'
diff --git a/jjb/verify/voltctl.yaml b/jjb/verify/voltctl.yaml
index 74c98e2..d7fca71 100644
--- a/jjb/verify/voltctl.yaml
+++ b/jjb/verify/voltctl.yaml
@@ -25,7 +25,7 @@
           unit-test-keep-going: 'true'
           dependency-jobs: 'verify_voltctl_tag-collision'
       - 'voltha-patch-test':
-          pipeline-script: 'voltha-bbsim-tests.groovy'
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
 
 - job-group:
     name: 'post-submit-voltctl-jobs'
diff --git a/jjb/verify/voltha-api-server.yaml b/jjb/verify/voltha-api-server.yaml
index 2e379fc..a0dea40 100644
--- a/jjb/verify/voltha-api-server.yaml
+++ b/jjb/verify/voltha-api-server.yaml
@@ -1,6 +1,8 @@
 ---
 # verification jobs for 'voltha-api-server' repo
 
+# NOTE voltha-api-server is unmaintained, should we keep running tests?
+
 - project:
     name: voltha-api-server
     project: '{name}'
diff --git a/jjb/verify/voltha-go.yaml b/jjb/verify/voltha-go.yaml
index 3ae3bc6..bfefd07 100644
--- a/jjb/verify/voltha-go.yaml
+++ b/jjb/verify/voltha-go.yaml
@@ -8,6 +8,12 @@
     jobs:
       - 'verify-voltha-go-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'verify-voltha-go-jobs-voltha-2.6':
+          name-extension: '-voltha-2.6'
+          override-branch: 'voltha-2.6'
+          branch-regexp: '{kind-voltha-regexp}'
+      - 'verify-voltha-go-jobs-master':
+          branch-regexp: '^master$'
       - 'publish-voltha-go-jobs':
           branch-regexp: '{all-branches-regexp}'
 
@@ -31,10 +37,20 @@
           name-extension: "-tests"
           unit-test-targets: 'test'
           unit-test-keep-going: 'true'
+
+- job-group:
+    name: 'verify-voltha-go-jobs-voltha-2.6'
+    jobs:
       - 'voltha-patch-test':
           pipeline-script: 'voltha-bbsim-tests.groovy'
 
 - job-group:
+    name: 'verify-voltha-go-jobs-master'
+    jobs:
+      - 'voltha-patch-test':
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
+
+- job-group:
     name: 'publish-voltha-go-jobs'
     jobs:
       - 'docker-publish':
diff --git a/jjb/verify/voltha-helm-charts.yaml b/jjb/verify/voltha-helm-charts.yaml
index 6301abe..77b8dc4 100644
--- a/jjb/verify/voltha-helm-charts.yaml
+++ b/jjb/verify/voltha-helm-charts.yaml
@@ -8,6 +8,12 @@
     jobs:
       - 'verify-voltha-helm-charts-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'verify-voltha-helm-charts-jobs-voltha-2.6':
+          name-extension: '-voltha-2.6'
+          override-branch: 'voltha-2.6'
+          branch-regexp: '{kind-voltha-regexp}'
+      - 'verify-voltha-helm-charts-jobs-master':
+          branch-regexp: '^master$'
 
 - job-group:
     name: 'verify-voltha-helm-charts-jobs'
@@ -17,7 +23,15 @@
           dependency-jobs: 'verify_voltha-helm-charts_licensed'
       - 'verify-helm-lint':
           dependency-jobs: 'verify_voltha-helm-charts_tag-collision'
+
+- job-group:
+    name: 'verify-voltha-helm-charts-jobs-voltha-2.6'
+    jobs:
       - 'voltha-patch-test':
-          dependency-jobs: 'verify_voltha-helm-charts_helm-lint'
-          build-timeout: 20
           pipeline-script: 'voltha-bbsim-tests.groovy'
+
+- job-group:
+    name: 'verify-voltha-helm-charts-jobs-master'
+    jobs:
+      - 'voltha-patch-test':
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
diff --git a/jjb/verify/voltha-onos.yaml b/jjb/verify/voltha-onos.yaml
index c28e5b4..5d5dd88 100644
--- a/jjb/verify/voltha-onos.yaml
+++ b/jjb/verify/voltha-onos.yaml
@@ -8,6 +8,12 @@
     jobs:
       - 'verify-voltha-onos-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'verify-voltha-onos-jobs-voltha-2.6':
+          name-extension: '-voltha-2.6'
+          override-branch: 'voltha-2.6'
+          branch-regexp: '{kind-voltha-regexp}'
+      - 'verify-voltha-onos-jobs-master':
+          branch-regexp: '^master$'
       - 'publish-voltha-onos-jobs':
           branch-regexp: '{all-branches-regexp}'
 
@@ -17,15 +23,20 @@
       - 'verify-licensed'
       - 'tag-collision-reject':
           dependency-jobs: 'verify_voltha-onos_licensed'
-      # No need to build the container as part of the unit-tests as it's
-      # built in 'voltha-patch-test'
-      # - 'make-unit-test':
-      #     unit-test-targets: 'build'
-      #     junit-allow-empty-results: true
+
+- job-group:
+    name: 'verify-voltha-onos-jobs-voltha-2.6'
+    jobs:
       - 'voltha-patch-test':
           pipeline-script: 'voltha-bbsim-tests.groovy'
 
 - job-group:
+    name: 'verify-voltha-onos-jobs-master'
+    jobs:
+      - 'voltha-patch-test':
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
+
+- job-group:
     name: 'publish-voltha-onos-jobs'
     jobs:
       - 'docker-publish':
diff --git a/jjb/verify/voltha-openolt-adapter.yaml b/jjb/verify/voltha-openolt-adapter.yaml
index 6f9c4c8..6e845a8 100644
--- a/jjb/verify/voltha-openolt-adapter.yaml
+++ b/jjb/verify/voltha-openolt-adapter.yaml
@@ -8,6 +8,12 @@
     jobs:
       - 'verify-voltha-openolt-adapter-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'verify-voltha-openolt-adapter-jobs-voltha-2.6':
+          name-extension: '-voltha-2.6'
+          override-branch: 'voltha-2.6'
+          branch-regexp: '{kind-voltha-regexp}'
+      - 'verify-voltha-openolt-adapter-jobs-master':
+          branch-regexp: '^master$'
       - 'publish-voltha-openolt-adapter-jobs':
           branch-regexp: '{all-branches-regexp}'
 
@@ -31,10 +37,20 @@
           unit-test-keep-going: 'true'
           junit-allow-empty-results: true
           build-node: 'ubuntu16.04-basebuild-2c-4g'
+
+- job-group:
+    name: 'verify-voltha-openolt-adapter-jobs-voltha-2.6'
+    jobs:
       - 'voltha-patch-test':
           pipeline-script: 'voltha-bbsim-tests.groovy'
 
 - job-group:
+    name: 'verify-voltha-openolt-adapter-jobs-master'
+    jobs:
+      - 'voltha-patch-test':
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
+
+- job-group:
     name: 'publish-voltha-openolt-adapter-jobs'
     jobs:
       - 'docker-publish':
diff --git a/jjb/verify/voltha-openonu-adapter-go.yaml b/jjb/verify/voltha-openonu-adapter-go.yaml
index c55dabd..de5ca20 100644
--- a/jjb/verify/voltha-openonu-adapter-go.yaml
+++ b/jjb/verify/voltha-openonu-adapter-go.yaml
@@ -8,6 +8,12 @@
     jobs:
       - 'verify-voltha-openonu-adapter-go-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'verify-voltha-openonu-adapter-go-jobs-voltha-2.6':
+          name-extension: '-voltha-2.6'
+          override-branch: 'voltha-2.6'
+          branch-regexp: '{kind-voltha-regexp}'
+      - 'verify-voltha-openonu-adapter-go-jobs-master':
+          branch-regexp: '^master$'
       - 'publish-voltha-openonu-adapter-go-jobs':
           branch-regexp: '{all-branches-regexp}'
 
@@ -30,8 +36,18 @@
           unit-test-keep-going: 'true'
           junit-allow-empty-results: true
           build-node: 'ubuntu16.04-basebuild-2c-4g'
+
+- job-group:
+    name: 'verify-voltha-openonu-adapter-go-jobs-voltha-2.6'
+    jobs:
       - 'voltha-patch-test':
-          pipeline-script: 'voltha-openonu-go-tests.groovy'
+          pipeline-script: 'voltha-bbsim-tests.groovy'
+
+- job-group:
+    name: 'verify-voltha-openonu-adapter-go-jobs-master'
+    jobs:
+      - 'voltha-patch-test':
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
 
 - job-group:
     name: 'publish-voltha-openonu-adapter-go-jobs'
diff --git a/jjb/verify/voltha-openonu-adapter.yaml b/jjb/verify/voltha-openonu-adapter.yaml
index 68bee87..65afee2 100644
--- a/jjb/verify/voltha-openonu-adapter.yaml
+++ b/jjb/verify/voltha-openonu-adapter.yaml
@@ -8,6 +8,12 @@
     jobs:
       - 'verify-voltha-openonu-adapter-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'verify-voltha-openonu-adapter-jobs-voltha-2.6':
+          name-extension: '-voltha-2.6'
+          override-branch: 'voltha-2.6'
+          branch-regexp: '{kind-voltha-regexp}'
+      - 'verify-voltha-openonu-adapter-jobs-master':
+          branch-regexp: '^master$'
       - 'publish-voltha-openonu-adapter-jobs':
           branch-regexp: '{all-branches-regexp}'
 
@@ -27,10 +33,20 @@
           unit-test-keep-going: 'true'
           junit-allow-empty-results: true
           build-timeout: 15
+
+- job-group:
+    name: 'verify-voltha-openonu-adapter-jobs-voltha-2.6'
+    jobs:
       - 'voltha-patch-test':
           pipeline-script: 'voltha-bbsim-tests.groovy'
 
 - job-group:
+    name: 'verify-voltha-openonu-adapter-jobs-master'
+    jobs:
+      - 'voltha-patch-test':
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
+
+- job-group:
     name: 'publish-voltha-openonu-adapter-jobs'
     jobs:
       - 'docker-publish':
diff --git a/jjb/verify/voltha-system-tests.yaml b/jjb/verify/voltha-system-tests.yaml
index 724589c..937c388 100644
--- a/jjb/verify/voltha-system-tests.yaml
+++ b/jjb/verify/voltha-system-tests.yaml
@@ -8,6 +8,12 @@
     jobs:
       - 'verify-voltha-system-tests-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'verify-voltha-system-tests-jobs-voltha-2.6':
+          name-extension: '-voltha-2.6'
+          override-branch: 'voltha-2.6'
+          branch-regexp: '{kind-voltha-regexp}'
+      - 'verify-voltha-system-tests-jobs-master':
+          branch-regexp: '^master$'
 
 - job-group:
     name: 'verify-voltha-system-tests-jobs'
@@ -19,7 +25,15 @@
           dependency-jobs: 'verify_voltha-system-tests_tag-collision'
           unit-test-targets: 'lint'
           junit-allow-empty-results: true
+
+- job-group:
+    name: 'verify-voltha-system-tests-jobs-voltha-2.6'
+    jobs:
       - 'voltha-patch-test':
-          build-timeout: 20
           pipeline-script: 'voltha-bbsim-tests.groovy'
-          dependency-jobs: 'verify_voltha-system-tests_unit-test'
+
+- job-group:
+    name: 'verify-voltha-system-tests-jobs-master'
+    jobs:
+      - 'voltha-patch-test':
+          pipeline-script: 'voltha/master/bbsim-tests.groovy'
diff --git a/jjb/voltha-e2e.yaml b/jjb/voltha-e2e.yaml
index 5cb86b9..0bc47df 100755
--- a/jjb/voltha-e2e.yaml
+++ b/jjb/voltha-e2e.yaml
@@ -351,8 +351,11 @@
     name: 'verify_{project}_sanity-test{name-extension}'
     override-branch: '$GERRIT_BRANCH'
     sandbox: true
+    build-timeout: 20
     volthaSystemTestsChange: ''
+    volthaHelmChartsChange: ''
     kindVolthaChange: ''
+    branch-regexp: '{all-branches-regexp}'
 
     description: |
       <!-- Managed by Jenkins Job Builder -->
@@ -376,11 +379,6 @@
           description: 'Name of the Jenkins node to run the job on'
 
       - string:
-          name: branch
-          default: '{override-branch}'
-          description: 'Name of the branch to use'
-
-      - string:
           name: gerritProject
           default: '$GERRIT_PROJECT'
           description: 'Name of the Gerrit project'
@@ -401,6 +399,22 @@
           description: 'Download a change for gerrit in the voltha-system-tests repo, example value: "refs/changes/79/18779/13"'
 
       - string:
+          name: volthaSystemTestsChange
+          default: '{volthaSystemTestsChange}'
+          description: 'Download a change for gerrit in the voltha-system-tests repo, example value: "refs/changes/79/18779/13"'
+
+      - string:
+          name: volthaHelmChartsChange
+          default: '{volthaHelmChartsChange}'
+          description: 'Download a change for gerrit in the voltha-helm-charts repo, example value: "refs/changes/79/18779/13"'
+
+      - string:
+          name: branch
+          default: '{override-branch}'
+          description: 'Name of the branch to use'
+
+      # deprecated params (not used in master, remove after 2.6 support is dropped)
+      - string:
           name: kindVolthaChange
           default: '{kindVolthaChange}'
           description: 'Download a change for gerrit in the kind-voltha repo, example value: "refs/changes/32/19132/1"'
@@ -428,7 +442,7 @@
               project-pattern: '^{project}$'
               branches:
                 - branch-compare-type: REG_EXP
-                  branch-pattern: '{all-branches-regexp}'
+                  branch-pattern: '{branch-regexp}'
               file-paths:
                 - compare-type: REG_EXP
                   pattern: '{all-files-regexp}'
@@ -572,7 +586,7 @@
                 approval-value: '+2'
           projects:
             - project-compare-type: REG_EXP
-              project-pattern: '^(voltha-openolt-adapter|voltha-openonu-adapter|voltha-go)$'
+              project-pattern: '^(voltha-openolt-adapter|voltha-openonu-adapter|voltha-openonu-adapter-go|voltha-go)$'
               branches:
                 - branch-compare-type: REG_EXP
                   branch-pattern: '{all-branches-regexp}'
@@ -717,7 +731,7 @@
                 comment-contains-value: '^{trigger-string} with delay$'
           projects:
             - project-compare-type: REG_EXP
-              project-pattern: '^(voltha-go|voltha-openolt-adapter|voltha-openonu-adapter|voltha-api-server|voltha-system-tests|ofagent-py|ofagent-go|voltha-onos|kind-voltha|voltha-helm-charts)$'
+              project-pattern: '^(voltha-go|voltha-openolt-adapter|voltha-openonu-adapter|voltha-openonu-adapter-go|voltha-api-server|voltha-system-tests|ofagent-py|ofagent-go|voltha-onos|kind-voltha|voltha-helm-charts)$'
               branches:
                 - branch-compare-type: REG_EXP
                   branch-pattern: '{all-branches-regexp}'
diff --git a/vars/buildVolthaComponent.groovy b/vars/buildVolthaComponent.groovy
new file mode 100644
index 0000000..c0e4163
--- /dev/null
+++ b/vars/buildVolthaComponent.groovy
@@ -0,0 +1,15 @@
+def call(String project) {
+  // project is the gerrit project name
+
+  if (project != 'voltha-system-tests' &&
+    project != 'voltha-helm-charts' &&
+    project != '') {
+
+    sh """
+    make -C $WORKSPACE/${project} DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build
+    """
+  } else {
+    println "The project ${project} does not require to be built."
+  }
+
+}
diff --git a/vars/createKubernetesCluster.groovy b/vars/createKubernetesCluster.groovy
new file mode 100644
index 0000000..fccbaed
--- /dev/null
+++ b/vars/createKubernetesCluster.groovy
@@ -0,0 +1,69 @@
+// sets up a kubernetes cluster (using kind)
+
+def call(Map config) {
+    // note that I can't define this outside the function as there's no global scope in Groovy
+    def defaultConfig = [
+      nodes: 1,
+      name: "kind-ci"
+    ]
+
+    if (!config) {
+        config = [:]
+    }
+
+    def cfg = defaultConfig + config
+
+    println "Deploying Kind cluster with the following parameters: ${cfg}."
+
+    // TODO support different configs
+    def data = """
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+nodes:
+- role: control-plane
+- role: worker
+- role: worker
+    """
+    writeFile(file: 'kind.cfg', text: data)
+
+    // TODO skip cluster creation if cluster is already there
+    sh """
+      mkdir -p $WORKSPACE/bin
+
+      # download kind (should we add it to the base image?)
+      curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.9.0/kind-linux-amd64
+      chmod +x ./kind
+      mv ./kind $WORKSPACE/bin/kind
+
+      # install voltctl
+      HOSTOS="\$(uname -s | tr "[:upper:]" "[:lower:"])"
+      HOSTARCH="\$(uname -m | tr "[:upper:]" "[:lower:"])"
+      if [ "\$HOSTARCH" == "x86_64" ]; then
+          HOSTARCH="amd64"
+      fi
+      curl -Lo ./voltctl https://github.com/opencord/voltctl/releases/download/v1.3.1/voltctl-1.3.1-\$HOSTOS-\$HOSTARCH
+      chmod +x ./voltctl
+      mv ./voltctl $WORKSPACE/bin/
+
+      # start the kind cluster
+      kind create cluster --name ${cfg.name} --config kind.cfg
+
+      # remove NoSchedule taint from nodes
+      for MNODE in \$(kubectl get node --selector='node-role.kubernetes.io/master' -o json | jq -r '.items[].metadata.name'); do
+          kubectl taint node "\$MNODE" node-role.kubernetes.io/master:NoSchedule-
+      done
+
+      mkdir -p $HOME/.volt
+      voltctl -s localhost:55555 config > $HOME/.volt/config
+
+      mkdir -p $HOME/.kube
+      kind get kubeconfig --name ${cfg.name} > $HOME/.kube/config
+
+      # add helm repositories
+      helm repo add onf https://charts.opencord.org
+      helm repo update
+
+      # download kail
+      bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/bin"
+  """
+}
diff --git a/vars/getVolthaCode.groovy b/vars/getVolthaCode.groovy
new file mode 100644
index 0000000..815e719
--- /dev/null
+++ b/vars/getVolthaCode.groovy
@@ -0,0 +1,109 @@
+// TODO the 3 stages are very similar, most of the code can be shared
+
+def call(Map config) {
+
+  def defaultConfig = [
+    branch: "master",
+    gerritProject: "",
+    gerritRefspec: "",
+    volthaSystemTestsChange: "",
+    volthaHelmChartsChange: "",
+  ]
+
+  if (!config) {
+      config = [:]
+  }
+
+  def cfg = defaultConfig + config
+
+  println "Downloading VOLTHA code with the following parameters: ${cfg}."
+
+  stage('Download Patch') {
+    // We are always downloading those repos, if the patch under test is in one of those
+    // just checkout the patch, no need to clone it again
+    if (cfg.gerritProject != 'voltha-system-tests' &&
+      cfg.gerritProject != 'voltha-helm-charts' &&
+      cfg.gerritProject != '') {
+      checkout([
+        $class: 'GitSCM',
+        userRemoteConfigs: [[
+          url: "https://gerrit.opencord.org/${cfg.gerritProject}",
+        ]],
+        branches: [[ name: "${cfg.branch}", ]],
+        extensions: [
+          [$class: 'WipeWorkspace'],
+          [$class: 'RelativeTargetDirectory', relativeTargetDir: "${cfg.gerritProject}"],
+          [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
+        ],
+      ])
+      sh """
+        pushd $WORKSPACE/${cfg.gerritProject}
+        git fetch https://gerrit.opencord.org/${cfg.gerritProject} ${cfg.gerritRefspec} && git checkout FETCH_HEAD
+
+        echo "Currently on commit: \n"
+        git log -1 --oneline
+        popd
+      """
+    }
+  }
+  stage('Clone voltha-system-tests') {
+    checkout([
+      $class: 'GitSCM',
+      userRemoteConfigs: [[
+        url: "https://gerrit.opencord.org/voltha-system-tests",
+      ]],
+      branches: [[ name: "${cfg.branch}", ]],
+      extensions: [
+        [$class: 'WipeWorkspace'],
+        [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
+        [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
+      ],
+    ])
+    if (cfg.volthaSystemTestsChange != '' && cfg.gerritProject != 'voltha-system-tests') {
+      sh """
+        cd $WORKSPACE/voltha-system-tests
+        git fetch https://gerrit.opencord.org/voltha-system-tests ${cfg.volthaSystemTestsChange} && git checkout FETCH_HEAD
+      """
+    }
+    else if (cfg.gerritProject == 'voltha-system-tests') {
+      sh """
+        pushd $WORKSPACE/${cfg.gerritProject}
+        git fetch https://gerrit.opencord.org/${cfg.gerritProject} ${cfg.gerritRefspec} && git checkout FETCH_HEAD
+
+        echo "Currently on commit: \n"
+        git log -1 --oneline
+        popd
+      """
+    }
+  }
+  stage('Clone voltha-helm-charts') {
+    checkout([
+      $class: 'GitSCM',
+      userRemoteConfigs: [[
+        url: "https://gerrit.opencord.org/voltha-helm-charts",
+      ]],
+      branches: [[ name: "master", ]],
+      extensions: [
+        [$class: 'WipeWorkspace'],
+        [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-helm-charts"],
+        [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
+      ],
+    ])
+    if (cfg.volthaHelmChartsChange != '' && cfg.gerritProject != 'voltha-helm-charts') {
+      sh """
+        cd $WORKSPACE/voltha-helm-charts
+        git fetch https://gerrit.opencord.org/voltha-helm-charts ${cfg.volthaHelmChartsChange} && git checkout FETCH_HEAD
+      """
+    }
+    else if (cfg.gerritProject == 'voltha-helm-charts') {
+      sh """
+        pushd $WORKSPACE/${cfg.gerritProject}
+        git fetch https://gerrit.opencord.org/${cfg.gerritProject} ${cfg.gerritRefspec} && git checkout FETCH_HEAD
+
+        echo "Currently on commit: \n"
+        git log -1 --oneline
+        popd
+      """
+    }
+  }
+}
diff --git a/vars/hello.groovy b/vars/hello.groovy
deleted file mode 100644
index b40894b..0000000
--- a/vars/hello.groovy
+++ /dev/null
@@ -1,6 +0,0 @@
-// vars/sayHello.groovy
-def call(String name = 'human') {
-    // Any valid steps can be called from this code, just like in other
-    // Scripted Pipeline
-    echo "Hello, ${name}."
-}
diff --git a/vars/helmTeardown.groovy b/vars/helmTeardown.groovy
new file mode 100644
index 0000000..3dff0ab
--- /dev/null
+++ b/vars/helmTeardown.groovy
@@ -0,0 +1,30 @@
+
+def call(List namespaces = ['default'], List excludes = ['docker-registry']) {
+
+    println "Tearing down charts in namespaces: ${namespaces.join(', ')}."
+
+    def exc = excludes.join("|")
+    for(int i = 0;i<namespaces.size();i++) {
+        def n = namespaces[i]
+        sh """
+          for hchart in \$(helm list -n ${n} -q | grep -E -v '${exc}');
+          do
+              echo "Purging chart: \${hchart}"
+              helm delete -n ${n} "\${hchart}"
+          done
+        """
+    }
+
+    println "Waiting for pods to be removed from namespaces: ${namespaces.join(', ')}."
+    for(int i = 0;i<namespaces.size();i++) {
+        def n = namespaces[i]
+        sh """
+        set +x
+        PODS=\$(kubectl get pods -n ${n} --no-headers | wc -l)
+        while [[ \$PODS != 0 ]]; do
+        sleep 5
+        PODS=\$(kubectl get pods -n ${n} --no-headers | wc -l)
+        done
+        """
+    }
+}
diff --git a/vars/loadToKind.groovy b/vars/loadToKind.groovy
new file mode 100644
index 0000000..7df6bc5
--- /dev/null
+++ b/vars/loadToKind.groovy
@@ -0,0 +1,34 @@
+// loads all the images tagged as citest on a Kind cluster
+
+def call(Map config) {
+  def defaultConfig = [
+    name: "kind-ci"
+  ]
+
+  if (!config) {
+      config = [:]
+  }
+
+  def cfg = defaultConfig + config
+
+  def images = sh (
+    script: 'docker images -f "reference=**/*citest" --format "{{.Repository}}"',
+    returnStdout: true
+  ).trim()
+
+  def list = images.split("\n")
+
+  for(int i = 0;i<list.size();i++) {
+    def image = list[i].trim()
+
+    if (!image) {
+      return
+    }
+
+    println "Loading image ${image} on Kind cluster ${cfg.name}"
+
+    sh """
+      kind load docker-image ${image}:citest --name ${cfg.name} --nodes ${cfg.name}-worker,${cfg.name}-worker2
+    """
+  }
+}
diff --git a/vars/volthaDeploy.groovy b/vars/volthaDeploy.groovy
new file mode 100644
index 0000000..eb9faca
--- /dev/null
+++ b/vars/volthaDeploy.groovy
@@ -0,0 +1,29 @@
+// this keyword is dedicated to deploy a single VOLTHA stack with infra
+// If you need to deploy different configurations you can use the volthaInfraDeploy and volthaStackDeploy keywords
+
+def call(Map config) {
+    // note that I can't define this outside the function as there's no global scope in Groovy
+    def defaultConfig = [
+      onosReplica: 1,
+      atomixReplica: 1,
+      kafkaReplica: 1,
+      etcdReplica: 1,
+      bbsimReplica: 1,
+      infraNamespace: "infra",
+      volthaNamespace: "voltha",
+      workflow: "att",
+      extraHelmFlags: "",
+    ]
+
+    if (!config) {
+        config = [:]
+    }
+
+    def cfg = defaultConfig + config
+
+    println "Deploying VOLTHA with the following parameters: ${cfg}."
+
+    volthaInfraDeploy(cfg)
+
+    volthaStackDeploy(cfg)
+}
diff --git a/vars/volthaInfraDeploy.groovy b/vars/volthaInfraDeploy.groovy
new file mode 100644
index 0000000..ecea1ad
--- /dev/null
+++ b/vars/volthaInfraDeploy.groovy
@@ -0,0 +1,41 @@
+// usage
+//
+// stage('test stage') {
+//   steps {
+//     volthaDeploy([
+//       onosReplica: 3
+//     ])
+//   }
+// }
+
+
+def call(Map config) {
+    // NOTE use params or directule extraHelmFlags??
+    def defaultConfig = [
+      onosReplica: 1,
+      atomixReplica: 1,
+      kafkaReplica: 1,
+      etcdReplica: 1,
+      infraNamespace: "infra",
+      workflow: "att",
+      extraHelmFlags: "",
+    ]
+
+    if (!config) {
+        config = [:]
+    }
+
+    def cfg = defaultConfig + config
+
+    println "Deploying VOLTHA Infra with the following parameters: ${cfg}."
+
+    sh """
+    kubectl create namespace ${cfg.infraNamespace} || true
+    kubectl create configmap -n ${cfg.infraNamespace} kube-config "--from-file=kube_config=$KUBECONFIG"  || true
+    """
+    // TODO support multiple replicas
+    sh """
+    helm upgrade --install --create-namespace -n ${cfg.infraNamespace} voltha-infra onf/voltha-infra ${cfg.extraHelmFlags} \
+          -f $WORKSPACE/voltha-helm-charts/examples/${cfg.workflow}-values.yaml
+    """
+}
diff --git a/vars/volthaStackDeploy.groovy b/vars/volthaStackDeploy.groovy
new file mode 100644
index 0000000..78d90bf
--- /dev/null
+++ b/vars/volthaStackDeploy.groovy
@@ -0,0 +1,63 @@
+
+def call(Map config) {
+    // note that I can't define this outside the function as there's no global scope in Groovy
+    def defaultConfig = [
+      onosReplica: 1,
+      atomixReplica: 1,
+      kafkaReplica: 1,
+      etcdReplica: 1,
+      bbsimReplica: 1,
+      infraNamespace: "infra",
+      volthaNamespace: "voltha",
+      stackName: "voltha",
+      workflow: "att",
+      extraHelmFlags: "",
+    ]
+
+    if (!config) {
+        config = [:]
+    }
+
+    def cfg = defaultConfig + config
+
+    println "Deploying VOLTHA Stack with the following parameters: ${cfg}."
+
+    sh """
+    helm upgrade --install --create-namespace -n ${cfg.volthaNamespace} ${cfg.stackName} onf/voltha-stack ${cfg.extraHelmFlags} \
+          --set global.stack_name=${cfg.stackName} \
+          --set global.voltha_infra_name=voltha-infra \
+          --set global.voltha_infra_namespace=${cfg.infraNamespace} \
+    """
+
+    for(int i = 0;i<cfg.bbsimReplica;i++) {
+      // TODO differentiate olt_id between different stacks
+       sh """
+         helm upgrade --install --create-namespace -n ${cfg.volthaNamespace} bbsim${i} onf/bbsim ${cfg.extraHelmFlags} \
+         --set olt_id="1${i}" \
+         -f $WORKSPACE/voltha-helm-charts/examples/${cfg.workflow}-values.yaml
+       """
+    }
+
+    println "Wait for VOLTHA Stack ${cfg.stackName} to start"
+
+    sh """
+        set +x
+        voltha=\$(kubectl get pods -n ${cfg.volthaNamespace} -l app.kubernetes.io/part-of=voltha --no-headers | grep "0/" | wc -l)
+        while [[ \$voltha != 0 ]]; do
+          sleep 5
+          voltha=\$(kubectl get pods -n ${cfg.volthaNamespace} -l app.kubernetes.io/part-of=voltha --no-headers | grep "0/" | wc -l)
+        done
+    """
+
+    // also make sure that the ONOS config is loaded
+    println "Wait for ONOS Config loader to complete"
+
+    sh """
+        set +x
+        config=\$(kubectl get jobs.batch -n ${cfg.infraNamespace} --no-headers | grep "0/" | wc -l)
+        while [[ \$config != 0 ]]; do
+          sleep 5
+          config=\$(kubectl get jobs.batch -n ${cfg.infraNamespace} --no-headers | grep "0/" | wc -l)
+        done
+    """
+}