[VOL-3780] Unifying tucson POD pipelines and migrating to voltha charts

Change-Id: I010087d59ae9745904aa1effa0b4bbad5e5b84f1
diff --git a/jjb/voltha-e2e.yaml b/jjb/voltha-e2e.yaml
index a3c86f8..d5b8bad 100755
--- a/jjb/voltha-e2e.yaml
+++ b/jjb/voltha-e2e.yaml
@@ -216,46 +216,67 @@
           time-trigger: "@daily"
           work-flow: DT
 
-      # Per-patchset Pod builds on Tucson pod
+      # Per-patchset Pod builds on Tucson pod (master)
       - 'verify_physical_voltha_patchset_auto':
           name: 'verify_physical_voltha_patchset_auto'
-          build-node: 'tucson-pod'
-          config-pod: 'tucson-pod'
-          oltDebVersionMaster: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
-          oltDebVersionVoltha23: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
-          profile: 'Default'
           default-test-args: '-i sanityORDeleteOLT -i PowerSwitch -X'
 
-      # Per-patchset Pod builds on Tucson pod
-      - 'verify_physical_voltha_patchset_manual':
-          name: 'verify_physical_voltha_patchset_manual'
-          build-node: 'tucson-pod'
-          config-pod: 'tucson-pod'
+      # Per-patchset Pod builds on Tucson pod (voltha-2.7)
+      - 'verify_physical_voltha_patchset_auto':
+          name: 'verify_physical_voltha_patchset_auto_voltha-2.7'
           oltDebVersionMaster: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
           oltDebVersionVoltha23: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
+          default-test-args: '-i sanityORDeleteOLT -i PowerSwitch -X'
+          pipeline-script: 'voltha/voltha-2.7/voltha-physical-build-and-tests.groovy'
+          branch-pattern: voltha-2.7
+
+      # Per-patchset Pod builds on Tucson pod (master)
+      - 'verify_physical_voltha_patchset_manual':
+          name: 'verify_physical_voltha_patchset_manual'
           profile: 'Default'
           trigger-string: 'hardware test'
           default-test-args: '-i sanityORDeleteOLT -i PowerSwitch -X'
+          branch-pattern: master
 
 
-      # Per-patchset Pod builds on Tucson pod
+      # Per-patchset Pod builds on Tucson pod  (master)
       - 'verify_physical_voltha_patchset_manual':
           name: 'verify_physical_voltha_patchset_manual_DT'
-          build-node: 'tucson-pod'
-          config-pod: 'tucson-pod-DT'
+          workflow: 'dt'
+          profile: 'Default'
+          pipeline-script: 'voltha/voltha-2.7/voltha-dt-physical-build-and-tests.groovy'
+          trigger-string: 'DT hardware test'
+          default-test-args: '-i sanityDt -i PowerSwitch -X'
+          branch-pattern: master
+
+      # Per-patchset Pod builds on Tucson pod (voltha-2.7)
+      - 'verify_physical_voltha_patchset_manual':
+          name: 'verify_physical_voltha_patchset_manual_voltha-2.7'
           oltDebVersionMaster: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
           oltDebVersionVoltha23: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
           profile: 'Default'
-          pipeline-script: 'voltha-dt-physical-build-and-tests.groovy'
+          pipeline-script: 'voltha/voltha-2.7/voltha-physical-build-and-tests.groovy'
+          trigger-string: 'hardware test'
+          default-test-args: '-i sanityORDeleteOLT -i PowerSwitch -X'
+          branch-pattern: voltha-2.7
+
+
+      # Per-patchset Pod builds on Tucson pod  (voltha-2.7)
+      - 'verify_physical_voltha_patchset_manual':
+          name: 'verify_physical_voltha_patchset_manual_DT_voltha-2.7'
+          workflow: 'dt'
+          oltDebVersionMaster: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
+          oltDebVersionVoltha23: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
+          profile: 'Default'
+          pipeline-script: 'voltha/voltha-2.7/voltha-physical-build-and-tests.groovy'
           trigger-string: 'DT hardware test'
           default-test-args: '-i sanityDt -i PowerSwitch -X'
-
+          branch-pattern: voltha-2.7
 
       # Manual build job for Tucson pod
       # Allow local testing without disrupting above job
       - 'build_physical_voltha_manual':
           name: 'build_tucson-pod_manual'
-          build-node: 'tucson-pod'
           config-pod: 'tucson-pod'
           manualBranch: 'master'
           oltDebVersionMaster: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
@@ -482,11 +503,6 @@
           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"'
@@ -531,25 +547,9 @@
                   pattern: '{all-files-regexp}'
 
 # POD Per Patchset Pipeline Jobs
-
-- job-template:
-    name: '{name}'
-    id: verify_physical_voltha_patchset_auto
-    description: |
-                  <!-- Managed by Jenkins Job Builder -->
-                  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)
-    sandbox: true
-    pipeline-script: 'voltha-physical-build-and-tests.groovy'
-    default-test-args: '-i sanityORDeleteOLT -X'
-
-    properties:
-      - cord-infra-properties:
-          build-days-to-keep: '{build-days-to-keep}'
-          artifact-num-to-keep: '{artifact-num-to-keep}'
-
+# to use these parameters in a job: `<<: *voltha-physical-patchset-parameters`
+- voltha-physical-patchset-parameters: &voltha-physical-patchset-parameters
+    name: voltha-physical-patchset-parameters
     parameters:
       - string:
           name: buildNode
@@ -557,14 +557,9 @@
           description: 'Pod management node'
 
       - string:
-          name: manifestUrl
-          default: '{gerrit-server-url}/{voltha-test-manifest-repo}'
-          description: 'URL to the repo manifest'
-
-      - string:
           name: branch
           default: '$GERRIT_BRANCH'
-          description: 'Name of the branch to use'
+          description: 'Name of the repo branch to use'
 
       - string:
           name: gerritProject
@@ -572,61 +567,56 @@
           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: gerritRefspec
           default: '$GERRIT_REFSPEC'
           description: 'RefSpec number in Gerrit'
 
       - string:
+          name: gerritComment
+          default: '$GERRIT_EVENT_COMMENT_TEXT'
+          description: 'RefSpec number in Gerrit'
+
+      - string:
           name: cordRepoUrl
           default: '{gerrit-server-url}'
           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
+          default: '{config-pod}'
+          description: 'The config file'
+
+      - string:
           name: podName
           default: '{config-pod}'
 
       - 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-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: oltDebVersionMaster
           default: '{oltDebVersionMaster}'
           description: 'OLT Software version to install for master branch builds'
 
       - string:
-          name: oltDebVersion
+          name: oltDebVersionVoltha23
           default: '{oltDebVersionVoltha23}'
           description: 'OLT Software version to install for voltha-2.3 branch builds'
 
@@ -646,14 +636,94 @@
           description: "Re-install OLT software"
 
       - string:
+          name: extraRobotArgs
+          default: '{default-test-args}'
+          description: 'Arguments to pass to robot'
+
+      - 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: workflow
+          default: '{workflow}'
+          description: 'Installs and uses the specified work flow on the POD'
+
+      # deprecated parameters, remove after VOLTHA-2.8 is released
+      - 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: manifestUrl
+          default: '{gerrit-server-url}/{voltha-test-manifest-repo}'
+          description: 'URL to the repo manifest'
+
+      - 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: 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: manualBranch
           default: '{manualBranch}'
           description: "If a non-empty string, build manually as a specific branch, not with a specific patchset"
 
-      - string:
-          name: extraRobotArgs
-          default: '{default-test-args}'
-          description: 'Arguments to pass to robot'
+- job-template:
+    name: '{name}'
+    id: verify_physical_voltha_patchset_auto
+    description: |
+                  <!-- Managed by Jenkins Job Builder -->
+                  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)
+    sandbox: true
+    pipeline-script: 'voltha/master/tucson-build-and-test.groovy'
+    default-test-args: '-i sanityORDeleteOLT -X'
+    branch-pattern: '{all-branches-regexp}'
+    build-node: 'tucson-pod'
+    config-pod: 'tucson-pod'
+    workflow: 'att'
+    profile: 'Default'
+    oltDebVersionMaster: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
+    oltDebVersionVoltha23: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
+    volthaSystemTestsChange: ''
+    volthaHelmChartsChange: ''
+
+    properties:
+      - cord-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+          artifact-num-to-keep: '{artifact-num-to-keep}'
+
+    <<: *voltha-physical-patchset-parameters
 
     project-type: pipeline
     concurrent: true
@@ -690,119 +760,25 @@
                   Created by Andy Bavier, andy@opennetworking.org <br />
                   Copyright (c) 2019 Open Networking Foundation (ONF)
     sandbox: true
-    pipeline-script: 'voltha-physical-build-and-tests.groovy'
+    build-node: 'tucson-pod'
+    config-pod: 'tucson-pod'
+    oltDebVersionMaster: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
+    oltDebVersionVoltha23: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
+    pipeline-script: 'voltha/master/tucson-build-and-test.groovy'
     trigger-string: 'hardware test'
     default-test-args: '-i sanityORDeleteOLT -X'
+    branch-pattern: '{all-branches-regexp}'
+    volthaSystemTestsChange: ''
+    volthaHelmChartsChange: ''
+    workflow: 'att'
 
     properties:
       - cord-infra-properties:
           build-days-to-keep: '{build-days-to-keep}'
           artifact-num-to-keep: '{artifact-num-to-keep}'
 
-    parameters:
-      - string:
-          name: buildNode
-          default: '{build-node}'
-          description: 'Pod management node'
+    <<: *voltha-physical-patchset-parameters
 
-      - string:
-          name: manifestUrl
-          default: '{gerrit-server-url}/{voltha-test-manifest-repo}'
-          description: 'URL to the repo manifest'
-
-      - string:
-          name: branch
-          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: gerritRefspec
-          default: '$GERRIT_REFSPEC'
-          description: 'RefSpec number in Gerrit'
-
-      - string:
-          name: cordRepoUrl
-          default: '{gerrit-server-url}'
-          description: 'The URL of the CORD Project repository'
-
-      - string:
-          name: podName
-          default: '{config-pod}'
-
-      - 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-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: oltDebVersionMaster
-          default: '{oltDebVersionMaster}'
-          description: 'OLT Software version to install for master branch builds'
-
-      - string:
-          name: oltDebVersionVoltha23
-          default: '{oltDebVersionVoltha23}'
-          description: 'OLT Software version to install for voltha-2.3 branch builds'
-
-      - string:
-          name: profile
-          default: '{profile}'
-          description: 'Technology Profile pushed to the ETCD'
-
-      - string:
-          name: notificationEmail
-          default: 'andy@opennetworking.org'
-          description: ''
-
-      - bool:
-          name: reinstallOlt
-          default: true
-          description: "Re-install OLT software"
-
-      - string:
-          name: manualBranch
-          default: '{manualBranch}'
-          description: "If a non-empty string, build manually on a specific branch, not with a specific patchset"
-
-      - string:
-          name: extraRobotArgs
-          default: '{default-test-args}'
-          description: 'Arguments to pass to robot'
 
     project-type: pipeline
     concurrent: true
@@ -827,7 +803,7 @@
               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}'
+                  branch-pattern: '{branch-pattern}'
 
 
 - job-template:
@@ -840,7 +816,7 @@
                   Created by Andy Bavier, andy@opennetworking.org <br />
                   Copyright (c) 2019 Open Networking Foundation (ONF)
     sandbox: true
-    pipeline-script: 'voltha-physical-build-and-tests.groovy'
+    pipeline-script: 'voltha/voltha-2.7/voltha-physical-build-and-tests.groovy'
 
     properties:
       - cord-infra-properties: