Merge "VOL-2187 WIP add scale test jenkins job using ec2"
diff --git a/jjb/cord-macros.yaml b/jjb/cord-macros.yaml
index 668c2f7..2410b3c 100644
--- a/jjb/cord-macros.yaml
+++ b/jjb/cord-macros.yaml
@@ -160,3 +160,23 @@
             - file-id: pipconf
               target: '$HOME/.config/pip/pip.conf'
 
+# wrapper to provide SSH key and fill in ~/.ssh/known_hosts file for use with rsync
+# Name matches macro in ONOS JJB, for future unification
+- wrapper:
+    name: onf-infra-rsync-wrappers
+    wrappers:
+      - mask-passwords
+      - timeout:
+          type: absolute
+          timeout: '{build-timeout}'
+          timeout-var: 'BUILD_TIMEOUT'
+          fail: true
+      - timestamps
+      - ssh-agent-credentials:
+          users:
+            - '{jenkins-ssh-credential}'
+      - config-file-provider:
+          files:
+            - file-id: known_hosts
+              target: '$HOME/.ssh/known_hosts'
+
diff --git a/jjb/cord-test/nightly-build-pipeline.yaml b/jjb/cord-test/nightly-build-pipeline.yaml
index 7fdce88..728ccad 100644
--- a/jjb/cord-test/nightly-build-pipeline.yaml
+++ b/jjb/cord-test/nightly-build-pipeline.yaml
@@ -864,7 +864,7 @@
 
       - bool:
           name: released
-          default: false
+          default: '{released}'
           description: "Pulls released version images when true"
 
       - bool:
@@ -877,11 +877,6 @@
           default: true
           description: "Re-install olt software bringing up CORD"
 
-      - bool:
-          name: withPatchset
-          default: false
-          description: "Apply a Gerrit patchset during the build"
-
     concurrent: true
 
     pipeline-scm:
diff --git a/jjb/cord-test/voltha.yaml b/jjb/cord-test/voltha.yaml
index 5da9055..e7062dc 100644
--- a/jjb/cord-test/voltha.yaml
+++ b/jjb/cord-test/voltha.yaml
@@ -37,7 +37,7 @@
           branch: 'master'
           test-repo: 'voltha-system-tests'
           Jenkinsfile: 'Jenkinsfile-voltha-bal31-build'
-          oltDebVersion: 'openolt_asfvolt16.deb'
+          oltDebVersion: 'openolt-2.2.deb'
           profile: '1T4GEM-bal31'
 
       # onlab pod1 test job - BAL3.1 tests using voltha branch
@@ -55,6 +55,7 @@
           config-pod: 'flex-ocp-cord'
           release: 'master'
           branch: 'master'
+          released: false
           test-repo: 'voltha-system-tests'
           Jenkinsfile: 'Jenkinsfile-voltha-build'
           oltDebVersion: 'openolt-seba-2.0.deb'
@@ -78,6 +79,7 @@
           config-pod: 'flex-ocp-cord'
           release: 'master'
           branch: 'master'
+          released: false
           test-repo: 'voltha-system-tests'
           Jenkinsfile: 'Jenkinsfile-voltha-build'
           oltDebVersion: 'openolt-seba-2.0.deb'
@@ -125,9 +127,10 @@
           config-pod: 'onf-demo-pod'
           release: 'master'
           branch: 'master'
+          released: false
           test-repo: 'voltha-system-tests'
-          Jenkinsfile: 'Jenkinsfile-voltha-build'
-          oltDebVersion: 'openolt-seba-2.0.deb'
+          Jenkinsfile: 'Jenkinsfile-voltha-bal31-build'
+          oltDebVersion: 'openolt-2.2.deb'
           configurePod: true
           profile: 'Default'
           time: '1'
@@ -149,8 +152,8 @@
           release: 'master'
           branch: 'master'
           test-repo: 'voltha-system-tests'
-          Jenkinsfile: 'Jenkinsfile-voltha-build'
-          oltDebVersion: 'openolt-seba-2.0.deb'
+          Jenkinsfile: 'Jenkinsfile-voltha-bal31-build'
+          oltDebVersion: 'openolt-2.2.deb'
           configurePod: true
           profile: '1T4GEM'
       - 'build_pod_test':
@@ -168,12 +171,12 @@
           release: 'master'
           branch: 'master'
           test-repo: 'voltha-system-tests'
-          Jenkinsfile: 'Jenkinsfile-voltha-build'
-          oltDebVersion: 'openolt-seba-2.0.deb'
+          Jenkinsfile: 'Jenkinsfile-voltha-bal31-build'
+          oltDebVersion: 'openolt-2.2.deb'
           configurePod: true
           profile: 'Default'
 
-      # ONF DEM) OCP test job - voltha-master branch 
+      # ONF DEMO OCP test job - voltha-master branch 
       - 'build_pod_test':
           testvm: 'menlo-demo-pod'
           config-pod: 'onf-demo-pod'
diff --git a/jjb/pipeline/voltha-go-tests.groovy b/jjb/pipeline/voltha-go-tests.groovy
index 3af8bd9..916e037 100644
--- a/jjb/pipeline/voltha-go-tests.groovy
+++ b/jjb/pipeline/voltha-go-tests.groovy
@@ -25,7 +25,21 @@
   options {
       timeout(time: 40, unit: 'MINUTES')
   }
-
+  environment {
+    KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
+    VOLTCONFIG="$HOME/.volt/config-minimal"
+    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$WORKSPACE/kind-voltha/bin"
+    TYPE="minimal"
+    FANCY=0
+    WITH_SIM_ADAPTERS="n"
+    WITH_RADIUS="y"
+    WITH_BBSIM="y"
+    DEPLOY_K8S="y"
+    VOLTHA_LOG_LEVEL="DEBUG"
+    CONFIG_SADIS="y"
+    EXTRA_HELM_FLAGS="${params.extraHelmFlags}"
+    ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs"
+  }
   stages {
 
     stage('Download kind-voltha') {
@@ -40,7 +54,7 @@
       steps {
         sh """
            cd kind-voltha/
-           EXTRA_HELM_FLAGS="${params.extraHelmFlags}" VOLTHA_LOG_LEVEL=DEBUG TYPE=minimal WITH_RADIUS=y WITH_BBSIM=y INSTALL_ONOS_APPS=y CONFIG_SADIS=y WITH_SIM_ADAPTERS=n FANCY=0 ./voltha up
+           ./voltha up
            """
       }
     }
@@ -48,13 +62,9 @@
     stage('Run E2E Tests') {
       steps {
         sh '''
+           rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs
            git clone https://gerrit.opencord.org/voltha-system-tests
-           cd kind-voltha/
-           export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")"
-           export VOLTCONFIG="/home/jenkins/.volt/config-minimal"
-           export PATH=$WORKSPACE/kind-voltha/bin:$PATH
-           export ROBOT_VAR_FILE=$WORKSPACE/voltha-system-tests/tests/data/${robotVarFile}
-           make -C $WORKSPACE/voltha-system-tests sanity-kind || true
+           make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true
            '''
       }
     }
@@ -63,15 +73,9 @@
   post {
     always {
       sh '''
-         # copy robot logs
-         if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
-         cp -r $WORKSPACE/voltha-system-tests/tests/*/*.html ./RobotLogs || true
-         cp -r $WORKSPACE/voltha-system-tests/tests/*/*.xml ./RobotLogs || true
+         set +e
          cd kind-voltha/
          cp install-minimal.log $WORKSPACE/
-         export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")"
-         export VOLTCONFIG="/home/jenkins/.volt/config-minimal"
-         export PATH=$WORKSPACE/kind-voltha/bin:$PATH
          kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
          kubectl get nodes -o wide
          kubectl get pods -o wide
diff --git a/jjb/pipeline/voltha-physical-tests.groovy b/jjb/pipeline/voltha-physical-tests.groovy
new file mode 100644
index 0000000..85d1f0f
--- /dev/null
+++ b/jjb/pipeline/voltha-physical-tests.groovy
@@ -0,0 +1,325 @@
+// Copyright 2019-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.
+
+// deploy VOLTHA built from patchset on a physical pod and run e2e test
+// uses kind-voltha to deploy voltha-2.X
+
+node {
+    // Need this so that deployment_config has global scope when it's read later
+    deployment_config = null
+    localDeploymentConfigFile = null
+    localKindVolthaValuesFile = null
+    localSadisConfigFile = null
+}
+
+pipeline {
+
+  /* no label, executor is determined by JJB */
+  agent {
+    label "${params.buildNode}"
+  }
+  options {
+      timeout(time: 60, unit: 'MINUTES')
+  }
+
+  environment {
+    KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
+    VOLTCONFIG="$HOME/.volt/config-minimal"
+    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$WORKSPACE/kind-voltha/bin"
+    TYPE="minimal"
+    FANCY=0
+    //VOL-2194 ONOS SSH and REST ports hardcoded to 30115/30120 in tests
+    ONOS_SSH_PORT=30115
+    ONOS_API_PORT=30120
+  }
+
+  stages {
+    stage ('Initialize') {
+      steps {
+        sh returnStdout: true, script: """
+        test -e $WORKSPACE/kind-voltha/voltha && cd $WORKSPACE/kind-voltha && ./voltha down
+        cd $WORKSPACE
+        rm -rf $WORKSPACE/*
+        """
+        script {
+          if (env.configRepo && ! env.localConfigDir) {
+            env.localConfigDir = "$WORKSPACE"
+            sh returnStdout: true, script: "git clone -b master ${cordRepoUrl}/${configRepo}"
+          }
+          localDeploymentConfigFile = "${env.localConfigDir}/${params.deploymentConfigFile}"
+          localKindVolthaValuesFile = "${env.localConfigDir}/${params.kindVolthaValuesFile}"
+          localSadisConfigFile = "${env.localConfigDir}/${params.sadisConfigFile}"
+          if ( ! params.withPatchset ) {
+            sh returnStdout: false, script: """
+            mkdir -p voltha
+            cd voltha
+            git clone -b ${branch} ${cordRepoUrl}/voltha-system-tests
+            """
+          }
+        }
+      }
+    }
+
+    stage('Get Patch') {
+      when {
+        expression { params.withPatchset }
+      }
+      steps {
+        checkout(changelog: false, \
+          poll: false,
+          scm: [$class: 'RepoScm', \
+            manifestRepositoryUrl: "${params.manifestUrl}", \
+            manifestBranch: "${params.manifestBranch}", \
+            currentBranch: true, \
+            destinationDir: 'voltha', \
+            forceSync: true,
+            resetFirst: true, \
+            quiet: true, \
+            jobs: 4, \
+            showAllChanges: true] \
+          )
+        sh returnStdout: false, script: """
+        cd voltha
+        PROJECT_PATH=\$(xmllint --xpath "string(//project[@name=\\\"${gerritProject}\\\"]/@path)" .repo/manifest.xml)
+        repo download "\$PROJECT_PATH" "${gerritChangeNumber}/${gerritPatchsetNumber}"
+        """
+      }
+    }
+
+    stage('Check config files') {
+      steps {
+        script {
+          try {
+            deployment_config = readYaml file: "${localDeploymentConfigFile}"
+          } catch (err) {
+            echo "Error reading ${localDeploymentConfigFile}"
+            throw err
+          }
+          sh returnStdout: false, script: """
+          if [ ! -e ${localKindVolthaValuesFile} ]; then echo "${localKindVolthaValuesFile} not found"; exit 1; fi
+          if [ ! -e ${localSadisConfigFile} ]; then echo "${localSadisConfigFile} not found"; exit 1; fi
+          """
+        }
+      }
+    }
+
+    stage('Create KinD Cluster') {
+      steps {
+        sh returnStdout: false, script: """
+        git clone https://github.com/ciena/kind-voltha.git
+        cd kind-voltha/
+        JUST_K8S=y ./voltha up
+        """
+      }
+    }
+
+    stage('Build and Push Images') {
+      when {
+        expression { params.withPatchset }
+      }
+      steps {
+        sh returnStdout: false, script: """
+        if ! [[ "${gerritProject}" =~ ^(voltha-system-tests)\$ ]]; then
+          make -C $WORKSPACE/voltha/${gerritProject} DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build
+          docker images | grep citest
+          for image in \$(docker images -f "reference=*/*citest" --format "{{.Repository}}")
+          do
+            echo "Pushing \$image to nodes"
+            kind load docker-image \$image:citest --name voltha-\$TYPE --nodes voltha-\$TYPE-worker,voltha-\$TYPE-worker2
+            docker rmi \$image:citest \$image:latest || true
+          done
+        fi
+        """
+      }
+    }
+
+    stage('Deploy Voltha') {
+      environment {
+        WITH_SIM_ADAPTERS="n"
+        WITH_RADIUS="y"
+        DEPLOY_K8S="n"
+        VOLTHA_LOG_LEVEL="debug"
+      }
+      steps {
+        script {
+          if ( params.withPatchset ) {
+            sh returnStdout: false, script: """
+            export EXTRA_HELM_FLAGS='-f ${localKindVolthaValuesFile} '
+
+            IMAGES=""
+            if [ "${gerritProject}" = "voltha-go" ]; then
+                IMAGES="cli ofagent rw_core ro_core "
+            elif [ "${gerritProject}" = "voltha-openolt-adapter" ]; then
+                IMAGES="adapter_open_olt "
+            elif [ "${gerritProject}" = "voltha-openonu-adapter" ]; then
+                IMAGES="adapter_open_onu "
+            elif [ "${gerritProject}" = "voltha-api-server" ]; then
+                IMAGES="afrouter afrouterd "
+            else
+                echo "No images to push"
+            fi
+
+            for I in \$IMAGES
+            do
+                EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
+            done
+
+            cd $WORKSPACE/kind-voltha/
+            echo \$EXTRA_HELM_FLAGS
+            ./voltha up
+            """
+          } else {
+            sh returnStdout: false, script: """
+            export EXTRA_HELM_FLAGS='-f ${localKindVolthaValuesFile} '
+            cd $WORKSPACE/kind-voltha/
+            echo \$EXTRA_HELM_FLAGS
+            ./voltha up
+            """
+          }
+        }
+      }
+    }
+
+    stage('Push Tech-Profile') {
+      when {
+        expression { params.profile != "Default" }
+      }
+      steps {
+        sh returnStdout: false, script: """
+        etcd_container=\$(kubectl get pods -n voltha | grep voltha-etcd-cluster | awk 'NR==1{print \$1}')
+        kubectl cp $WORKSPACE/voltha/voltha-system-tests/tests/data/TechProfile-${profile}.json voltha/\$etcd_container:/tmp/flexpod.json
+        kubectl exec -it \$etcd_container -n voltha -- /bin/sh -c 'cat /tmp/flexpod.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/xgspon/64'
+        """
+      }
+    }
+
+    stage('Push Sadis-config') {
+      steps {
+        sh returnStdout: false, script: """
+        curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:$ONOS_API_PORT/onos/v1/network/configuration --data @${localSadisConfigFile}
+        """
+      }
+    }
+
+    stage('Reinstall OLT software') {
+      when {
+        expression { params.reinstallOlt }
+      }
+      steps {
+        script {
+          deployment_config.olts.each { olt ->
+            sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'service bal_core_dist stop' || true"
+            sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'service bal_core_dist stop' || true"
+            sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'dpkg --remove asfvolt16 && dpkg --purge asfvolt16'"
+            waitUntil {
+              olt_sw_present = sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'dpkg --list | grep asfvolt16 | wc -l'"
+              return olt_sw_present.toInteger() == 0
+            }
+            sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'dpkg --install ${oltDebVersion}'"
+            waitUntil {
+              olt_sw_present = sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'dpkg --list | grep asfvolt16 | wc -l'"
+              return olt_sw_present.toInteger() == 1
+            }
+            if ( olt.fortygig ) {
+              // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded
+              sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'echo port ce128 sp=40000 >> /broadcom/qax.soc ; /opt/bcm68620/svk_init.sh'"
+            }
+          }
+        }
+      }
+    }
+
+    stage('Restart OLT processes') {
+      steps {
+        script {
+          deployment_config.olts.each { olt ->
+            sh returnStdout: true, script: """
+            ssh-keyscan -H ${olt.ip} >> ~/.ssh/known_hosts
+            sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'service bal_core_dist stop' || true
+            sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'service openolt stop' || true
+            sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'rm -f /var/log/bal_core_dist.log /var/log/openolt.log'
+            sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'service bal_core_dist start &'
+            sleep 5
+            sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'service openolt start &'
+            """
+            waitUntil {
+              onu_discovered = sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'grep \"onu discover indication\" /var/log/openolt.log | wc -l'"
+              return onu_discovered.toInteger() > 0
+            }
+          }
+        }
+      }
+    }
+
+    stage('Run E2E Tests') {
+      environment {
+        ROBOT_CONFIG_FILE="${localDeploymentConfigFile}"
+        ROBOT_MISC_ARGS="--removekeywords wuks -d $WORKSPACE/RobotLogs"
+        ROBOT_FILE="Voltha_PODTests.robot"
+      }
+      steps {
+        sh returnStdout: false, script: """
+        cd voltha
+        git clone -b ${branch} ${cordRepoUrl}/cord-tester
+        git clone -b ${branch} ${cordRepoUrl}/voltha # VOL-2104 recommends we get rid of this
+        mkdir -p $WORKSPACE/RobotLogs
+        make -C $WORKSPACE/voltha/voltha-system-tests voltha-test || true
+        """
+      }
+    }
+  }
+
+  post {
+    always {
+      sh returnStdout: true, script: """
+      set +e
+      cp kind-voltha/install-minimal.log $WORKSPACE/
+      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
+      kubectl get nodes -o wide
+      kubectl get pods -o wide
+      kubectl get pods -n voltha -o wide
+      ## get default pod logs
+      for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
+      do
+        if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
+          kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
+        else
+          kubectl logs \$pod> $WORKSPACE/\$pod.log;
+        fi
+      done
+      ## get voltha pod logs
+      for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
+      do
+        if [[ \$pod == *"-api-"* ]]; then
+          kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log;
+        elif [[ \$pod == "bbsim-"* ]]; then
+          kubectl logs \$pod -n voltha -p > $WORKSPACE/\$pod.log;
+        else
+          kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
+        fi
+      done
+      """
+      step([$class: 'RobotPublisher',
+        disableArchiveOutput: false,
+        logFileName: 'RobotLogs/log*.html',
+        otherFiles: '',
+        outputFileName: 'RobotLogs/output*.xml',
+        outputPath: '.',
+        passThreshold: 80,
+        reportFileName: 'RobotLogs/report*.html',
+        unstableThreshold: 0]);
+      archiveArtifacts artifacts: '*.log'
+    }
+  }
+}
diff --git a/jjb/shell/sync-dir.sh b/jjb/shell/sync-dir.sh
new file mode 100644
index 0000000..d7f4218
--- /dev/null
+++ b/jjb/shell/sync-dir.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+# Copyright 2019-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.
+
+# sync-dir.sh - run build step then sync a directory to a remote server
+set -eu -o pipefail
+
+# when not running under Jenkins, use current dir as workspace, a blank project
+# name
+WORKSPACE=${WORKSPACE:-.}
+
+# run the build command
+$BUILD_COMMAND
+
+# sync the files to the target
+rsync -rvzh --delete-after --exclude=.git "$WORKSPACE/$BUILD_OUTPUT_PATH" "$SYNC_TARGET_SERVER:$SYNC_TARGET_PATH"
diff --git a/jjb/templates/sync-dir.yaml b/jjb/templates/sync-dir.yaml
new file mode 100644
index 0000000..ef4db6a
--- /dev/null
+++ b/jjb/templates/sync-dir.yaml
@@ -0,0 +1,65 @@
+---
+# sync built directory to a remote server
+
+- job-template:
+    id: sync-dir
+    name: "sync-dir_{project}"
+    description: |
+      Created by {id} job-template from ci-management/jjb/templates/sync-dir.yaml
+      After merge run a build step then upload files to a directory remote server.
+
+    parameters:
+      - string:
+          name: BUILD_COMMAND
+          default: '{build-command}'
+          description: 'Name of the command to run to generate artifacts'
+
+      - string:
+          name: BUILD_OUTPUT_PATH
+          default: '{build-output-path}'
+          description: 'Path of files where build output is created by build command, relative to code checkout location'
+
+      - string:
+          name: SYNC_TARGET_SERVER
+          default: '{sync-target-server}'
+          description: 'Name of server where built files will be synced'
+
+      - string:
+          name: SYNC_TARGET_PATH
+          default: '{sync-target-path}'
+          description: 'Directory path on target server where the files will be synced'
+
+    triggers:
+      - cord-infra-gerrit-trigger-merge:
+          gerrit-server-name: '{gerrit-server-name}'
+          project-regexp: '^{project}$'
+          branch-regexp: '{branch-regexp}'
+          file-include-regexp: '{all-files-regexp}'
+          dependency-jobs: '{dependency-jobs}'
+
+    properties:
+      - cord-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+          artifact-num-to-keep: '{artifact-num-to-keep}'
+
+    wrappers:
+      - onf-infra-rsync-wrappers:
+          build-timeout: '{build-timeout}'
+          jenkins-ssh-credential: '{gerrit-ssh-credential}'
+
+    scm:
+      - lf-infra-gerrit-scm:
+          git-url: '$GIT_URL/$GERRIT_PROJECT'
+          refspec: '$GERRIT_REFSPEC'
+          branch: '$GERRIT_BRANCH'
+          submodule-recursive: 'false'
+          choosing-strategy: gerrit
+          jenkins-ssh-credential: '{gerrit-ssh-credential}'
+
+    node: '{build-node}'
+    project-type: freestyle
+    concurrent: true
+
+    builders:
+      - shell: !include-raw-escape: ../shell/sync-dir.sh
+
diff --git a/jjb/verify/voltha-docs.yaml b/jjb/verify/voltha-docs.yaml
new file mode 100644
index 0000000..cf3d4ac
--- /dev/null
+++ b/jjb/verify/voltha-docs.yaml
@@ -0,0 +1,32 @@
+---
+# verification jobs for 'voltha-docs' repo
+
+- project:
+    name: voltha-docs
+    project: '{name}'
+
+    jobs:
+      - 'verify-voltha-docs-jobs':
+          branch-regexp: '{supported-branches-regexp}'
+      - 'post-submit-voltha-docs-jobs':
+          branch-regexp: '{supported-branches-regexp}'
+
+- job-group:
+    name: 'verify-voltha-docs-jobs'
+    jobs:
+      - 'verify-licensed'
+      - 'tag-collision-reject'
+      - 'make-unit-test':
+          unit-test-targets: 'test'
+          unit-test-keep-going: 'true'
+          junit-allow-empty-results: true
+
+- job-group:
+    name: 'post-submit-voltha-docs-jobs'
+    jobs:
+      - 'sync-dir':
+          dependency-jobs: 'version-tag'
+          build-command: 'make html'
+          build-output-path: '_build/html/'
+          sync-target-server: 'guide.opencord.org'
+          sync-target-path: '/var/www/voltha-docs/'
diff --git a/jjb/voltha-e2e.yaml b/jjb/voltha-e2e.yaml
index db064c7..b9eba3f 100644
--- a/jjb/voltha-e2e.yaml
+++ b/jjb/voltha-e2e.yaml
@@ -8,30 +8,45 @@
 
     jobs:
       - 'voltha-periodic-test':
-          name: 'voltha-system-tests'
+          name: 'periodic-voltha-sanity-test'
           pipeline-script: 'voltha-go-tests.groovy'
           default-image-tag: 'master'
+          make-target: sanity-multi-kind
+          onus: 2
+          pons: 2
+          time-trigger: "H H/3 * * *"
+
+      - 'voltha-periodic-test':
+          name: 'periodic-voltha-scale-test'
+          pipeline-script: 'voltha-go-tests.groovy'
+          default-image-tag: 'master'
+          make-target: scale-multi-kind
+          onus: 2
+          pons: 8
+          time-trigger: "H H/3 * * *"
 
       # Per-patchset Pod builds on Tucson pod
-      - 'build_physical_voltha_patchset':
+      - 'verify_physical_voltha_patchset':
+          name: 'verify_physical_voltha_patchset'
           testvm: 'tucson-pod'
           config-pod: 'tucson-pod'
           branch: 'master'
-          release: 'patchset'
-          test-repo: 'voltha-system-tests'
-          Jenkinsfile: 'Jenkinsfile-voltha-build'
+          pipeline-script: 'voltha-physical-tests.groovy'
           oltDebVersion: 'openolt-seba-2.0.deb'
-          configurePod: true
           profile: 'Default'
+          withPatchset: true
 
-      - 'build_physical_voltha_patchset_test':
+      # Manual build job for Tucson pod
+      # Allow local testing without disrupting above job
+      - 'build_physical_voltha_manual':
+          name: 'build_tucson-pod_manual'
           testvm: 'tucson-pod'
           config-pod: 'tucson-pod'
           branch: 'master'
-          release: 'patchset'
-          test-repo: 'voltha-system-tests'
-          Jenkinsfile: 'Jenkinsfile-voltha-test'
+          pipeline-script: 'voltha-physical-tests.groovy'
+          oltDebVersion: 'openolt-seba-2.0.deb'
           profile: 'Default'
+          withPatchset: false
 
 - job-template:
     id: 'voltha-periodic-test'
@@ -59,34 +74,19 @@
           description: 'Name of the Jenkins node to run the job on'
 
       - string:
-          name: numOnus
-          default: '1'
-          description: 'Number of onus per pon port'
-
-      - string:
-          name: emulationMode
-          default: '--set emulation_mode=both'
-          description: 'Emulation for BBSIM (both|aaa)'
-
-      - string:
           name: testTimeout
           default: '90'
           description: 'timeout for olt/onu validations'
 
       - string:
-          name: testTags
-          default: '-e notready'
-          description: 'test tags'
-
-      - string:
           name: extraHelmFlags
-          default: '--set defaults.image_tag={default-image-tag},onu=2,pon=2'
+          default: '--set defaults.image_tag={default-image-tag},onu={onus},pon={pons}'
           description: 'Helm flags to pass to ./voltha up'
 
       - string:
-          name: robotVarFile
-          default: 'bbsim-kind-2x2.yaml'
-          description: 'Pod config file to use for tests'
+          name: makeTarget
+          default: '{make-target}'
+          description: 'Makefile target to invoke during test'
 
     project-type: pipeline
     concurrent: false
@@ -96,7 +96,7 @@
     triggers:
       - timed: |
                  TZ=America/Los_Angeles
-                 H/30 * * * *
+                 {time-trigger}
 
 - job-template:
     id: 'voltha-patch-test'
@@ -189,12 +189,12 @@
 # POD Per Patchset Pipeline Jobs
 
 - job-template:
-    name: 'build_physical_voltha_patchset'
-    id: build_physical_voltha_patchset
+    name: '{name}'
+    id: verify_physical_voltha_patchset
     description: |
                   <!-- Managed by Jenkins Job Builder -->
-                  Manual Build on POD {config-pod} using {Jenkinsfile} <br /><br />
-                  Created from job-template {id} from ci-management/jjb/cord-test/per-patch-pipeline.yaml <br />
+                  Automated build on POD {config-pod} using {pipeline-script} <br /><br />
+                  Created from job-template {id} from ci-management/jjb/voltha-e2e.yaml <br />
                   Created by Andy Bavier, andy@opennetworking.org <br />
                   Copyright (c) 2019 Open Networking Foundation (ONF)
     project-type: pipeline
@@ -207,9 +207,9 @@
 
     parameters:
       - string:
-          name: TestNodeName
+          name: buildNode
           default: '{testvm}'
-          description: 'Jenkins node name of TestVM Node'
+          description: 'Pod management node'
 
       - string:
           name: manifestUrl
@@ -242,24 +242,33 @@
           description: 'The URL of the CORD Project repository'
 
       - string:
-          name: configBaseDir
-          default: 'pod-configs'
-          description: 'The directory inside the POD configs repository'
-
-      - string:
-          name: configDeploymentDir
-          default: 'deployment-configs'
-          description: 'The deployment configs folder'
-
-      - string:
-          name: configKubernetesDir
-          default: 'kubernetes-configs'
-          description: 'The kubernetes config folder'
-
-      - string:
-          name: configFileName
+          name: podName
           default: '{config-pod}'
-          description: 'The config file'
+
+      - string:
+          name: deploymentConfigFile
+          default: 'pod-configs/deployment-configs/{config-pod}.yaml'
+          description: 'Path of deployment config file'
+
+      - string:
+          name: kindVolthaValuesFile
+          default: 'pod-configs/kubernetes-configs/voltha/{config-pod}.yml'
+          description: 'Path of kind-voltha values override file'
+
+      - string:
+          name: sadisConfigFile
+          default: 'voltha/voltha-system-tests/tests/data/{config-pod}-sadis.json'
+          description: 'Path of SADIS config to load'
+
+      - string:
+          name: localConfigDir
+          default: null
+          description: 'If specified, config file paths are relative to this dir; otherwise $WORKSPACE'
+
+      - string:
+          name: configRepo
+          default: 'pod-configs'
+          description: 'A repository containing the config files, will be checked out if specified'
 
       - string:
           name: oltDebVersion
@@ -288,22 +297,12 @@
       - bool:
           name: withPatchset
           default: true
-          description: "Apply a Gerrit patchset during the build"
+          description: "Build with Gerrit patchset"
 
-      - bool:
-          name: released
-          default: false
-          description: "Pulls released version images when true"
-
+    project-type: pipeline
     concurrent: true
 
-    pipeline-scm:
-      script-path: '{Jenkinsfile}'
-      scm:
-        - git:
-            url: '{gerrit-server-url}/{test-repo}'
-            branches:
-              - '{branch}'
+    dsl: !include-raw-escape: pipeline/{pipeline-script}
 
     triggers:
       - gerrit:
@@ -318,23 +317,21 @@
                 comment-contains-value: '^hardware test$'
           projects:
             - project-compare-type: REG_EXP
-              project-pattern: '^(voltha-go|voltha-openolt-adapter|voltha-openonu-adapter|voltha-api-server)$'
+              project-pattern: '^(voltha-go|voltha-openolt-adapter|voltha-openonu-adapter|voltha-api-server|voltha-system-tests)$'
               branches:
                 - branch-compare-type: PLAIN
                   branch-pattern: 'master'
 
 - job-template:
-    name: 'build_physical_voltha_patchset_test'
-    id: build_physical_voltha_patchset_test
+    name: '{name}'
+    id: build_physical_voltha_manual
     description: |
                   <!-- Managed by Jenkins Job Builder -->
-                  Post Tests on {config-pod} triggered by build_{config-pod}_{branch} <br /><br />
-                  Created from job-template {id} from ci-management/jjb/cord-test/per-patch-pipeline.yaml <br />
+                  Automated build on POD {config-pod} using {pipeline-script} <br /><br />
+                  Created from job-template {id} from ci-management/jjb/voltha-e2e.yaml <br />
                   Created by Andy Bavier, andy@opennetworking.org <br />
                   Copyright (c) 2019 Open Networking Foundation (ONF)
-
     project-type: pipeline
-
     sandbox: true
 
     properties:
@@ -344,9 +341,34 @@
 
     parameters:
       - string:
-          name: TestNodeName
+          name: buildNode
           default: '{testvm}'
-          description: 'Jenkins node name of TestVM Node'
+          description: 'Pod management node'
+
+      - string:
+          name: manifestUrl
+          default: '{gerrit-server-url}/{voltha-test-manifest-repo}'
+          description: 'URL to the repo manifest'
+
+      - string:
+          name: manifestBranch
+          default: '$GERRIT_BRANCH'
+          description: 'Name of the repo branch to use'
+
+      - string:
+          name: gerritProject
+          default: '$GERRIT_PROJECT'
+          description: 'Name of the Gerrit project'
+
+      - string:
+          name: gerritChangeNumber
+          default: '$GERRIT_CHANGE_NUMBER'
+          description: 'Changeset number in Gerrit'
+
+      - string:
+          name: gerritPatchsetNumber
+          default: '$GERRIT_PATCHSET_NUMBER'
+          description: 'PatchSet number in Gerrit'
 
       - string:
           name: cordRepoUrl
@@ -354,24 +376,42 @@
           description: 'The URL of the CORD Project repository'
 
       - string:
-          name: configBaseDir
-          default: 'pod-configs'
-          description: 'The directory inside the POD configs repository'
-
-      - string:
-          name: configDeploymentDir
-          default: 'deployment-configs'
-          description: 'The deployment configs folder'
-
-      - string:
-          name: configKubernetesDir
-          default: 'kubernetes-configs'
-          description: 'The kubernetes config folder'
-
-      - string:
-          name: configFileName
+          name: podName
           default: '{config-pod}'
-          description: 'The config file'
+
+      - string:
+          name: deploymentConfigFile
+          default: 'pod-configs/deployment-configs/{config-pod}.yaml'
+          description: 'Path of deployment config file'
+
+      - string:
+          name: kindVolthaValuesFile
+          default: 'pod-configs/kubernetes-configs/voltha/{config-pod}.yml'
+          description: 'Path of kind-voltha values override file'
+
+      - string:
+          name: sadisConfigFile
+          default: 'voltha/voltha-system-tests/tests/data/{config-pod}-sadis.json'
+          description: 'Path of SADIS config to load'
+
+      - string:
+          name: localConfigDir
+          default: null
+          description: 'If specified, config file paths are relative to this dir; otherwise $WORKSPACE'
+
+      - string:
+          name: configRepo
+          default: 'pod-configs'
+          description: 'A repository containing the config files, will be checked out if specified'
+
+      - string:
+          name: oltDebVersion
+          default: '{oltDebVersion}'
+          description: 'OLT Software version to install'
+
+      - string:
+          name: branch
+          default: '{branch}'
 
       - string:
           name: profile
@@ -379,25 +419,21 @@
           description: 'Technology Profile pushed to the ETCD'
 
       - string:
-          name: branch
-          default: '{branch}'
-
-      - string:
           name: notificationEmail
           default: 'andy@opennetworking.org'
           description: ''
 
+      - bool:
+          name: reinstallOlt
+          default: false
+          description: "Re-install OLT software"
+
+      - bool:
+          name: withPatchset
+          default: false
+          description: "Build with Gerrit patchset"
+
+    project-type: pipeline
     concurrent: true
 
-    pipeline-scm:
-      script-path: '{Jenkinsfile}'
-      scm:
-        - git:
-            url: '{gerrit-server-url}/{test-repo}'
-            branches:
-              - '{branch}'
-
-    triggers:
-      - reverse:
-          jobs: 'build_physical_voltha_patchset'
-          result: 'success'
+    dsl: !include-raw-escape: pipeline/{pipeline-script}