Merge "Supporting DT workflow in tucson pipeline"
diff --git a/jjb/pipeline/voltha/master/tucson-build-and-test.groovy b/jjb/pipeline/voltha/master/tucson-build-and-test.groovy
index e6e1bbd..3c3b942 100644
--- a/jjb/pipeline/voltha/master/tucson-build-and-test.groovy
+++ b/jjb/pipeline/voltha/master/tucson-build-and-test.groovy
@@ -53,6 +53,11 @@
         sh returnStdout: true, script: "rm -rf ${configBaseDir}"
         sh returnStdout: true, script: "git clone -b master ${cordRepoUrl}/${configBaseDir}"
         script {
+
+          if (params.workflow.toUpperCase() == "TT") {
+            error("The Tucson POD does not support TT workflow at the moment")
+          }
+
           if ( params.workflow.toUpperCase() == "DT" ) {
             deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
           }
@@ -247,14 +252,28 @@
     stage('Run E2E Tests') {
       steps {
         script {
+          // different workflows need different make targets and different robot files
           if ( params.workflow.toUpperCase() == "DT" ) {
             robotConfigFile = "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
+            robotFile = "Voltha_DT_PODTests.robot"
+            makeTarget = "voltha-dt-test"
+            robotFunctionalKeyword = "-i functionalDt"
+            robotDataplaneKeyword = "-i dataplaneDt"
           }
           else if ( params.workflow.toUpperCase() == "TT" ) {
+            // TODO the TT tests have diffent tags, address once/if TT is support on the Tucson POD
             robotConfigFile = "${configBaseDir}/${configDeploymentDir}/${configFileName}-TT.yaml"
+            robotFile = "Voltha_TT_PODTests.robot"
+            makeTarget = "voltha-tt-test"
+            robotFunctionalKeyword = "-i functionalTt"
+            robotDataplaneKeyword = "-i dataplaneTt"
           }
           else {
             robotConfigFile = "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
+            robotFile = "Voltha_PODTests.robot"
+            makeTarget = "voltha-test"
+            robotFunctionalKeyword = "-i functional"
+            robotDataplaneKeyword = "-i dataplane"
           }
         }
         sh returnStdout: false, script: """
@@ -262,22 +281,22 @@
 
         export ROBOT_CONFIG_FILE="$WORKSPACE/${robotConfigFile}"
         export ROBOT_MISC_ARGS="${params.extraRobotArgs} --removekeywords wuks -d $WORKSPACE/RobotLogs -v container_log_dir:$WORKSPACE "
-        export ROBOT_FILE="Voltha_PODTests.robot"
+        export ROBOT_FILE="${robotFile}"
 
         # 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 [[ "${gerritComment}" =~ \$REGEX ]]; then
-          ROBOT_MISC_ARGS+="-i functional"
+          ROBOT_MISC_ARGS+="${robotFunctionalKeyword} "
         fi
         # Likewise for dataplane tests
         REGEX="dataplane tests"
         if [[ "${gerritComment}" =~ \$REGEX ]]; then
-          ROBOT_MISC_ARGS+="-i dataplane"
+          ROBOT_MISC_ARGS+="${robotDataplaneKeyword}"
         fi
 
-        make -C $WORKSPACE/voltha-system-tests voltha-test || true
+        make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true
         """
       }
     }
diff --git a/jjb/voltha-e2e.yaml b/jjb/voltha-e2e.yaml
index c89c0d4..958cd22 100755
--- a/jjb/voltha-e2e.yaml
+++ b/jjb/voltha-e2e.yaml
@@ -469,78 +469,59 @@
               flags: ""
               teardown: true
 
-      # Per-patchset Pod builds on Tucson pod (master)
+      # ATT Per-patchset Pod builds on Tucson pod (master)
       - 'verify_physical_voltha_patchset_auto':
           name: 'verify_physical_voltha_patchset_auto'
-          default-test-args: '-i sanityORDeleteOLT -i PowerSwitch -X'
           extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master'
+          workflow: 'att'
 
-      # Per-patchset Pod builds on Tucson pod (voltha-2.7)
+      # ATT 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.4.1-dev-c5dcc7f2b27df1c42868b3a79a5416808511bb1d-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
+          workflow: 'att'
 
-      # Per-patchset Pod builds on Tucson pod (master)
+      # ATT Manual 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
           extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master'
+          workflow: 'att'
 
+      #  ATT Manual 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.4.1-dev-c5dcc7f2b27df1c42868b3a79a5416808511bb1d-40G-NNI.deb'
+          oltDebVersionVoltha23: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
+          pipeline-script: 'voltha/voltha-2.7/voltha-physical-build-and-tests.groovy'
+          trigger-string: 'hardware test'
+          branch-pattern: voltha-2.7
+          workflow: 'att'
 
-      # Per-patchset Pod builds on Tucson pod  (master)
+      # DT Manual Pod builds on Tucson pod  (master)
       - 'verify_physical_voltha_patchset_manual':
           name: 'verify_physical_voltha_patchset_manual_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
           extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=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.4.1-dev-c5dcc7f2b27df1c42868b3a79a5416808511bb1d-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: '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)
+      # DT 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.4.1-dev-c5dcc7f2b27df1c42868b3a79a5416808511bb1d-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'
-          config-pod: 'tucson-pod'
-          manualBranch: 'master'
-          oltDebVersionMaster: 'openolt_asfvolt16-3.4.1-dev-c5dcc7f2b27df1c42868b3a79a5416808511bb1d-40G-NNI.deb'
-          oltDebVersionVoltha23: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
-          profile: 'Default'
-          default-test-args: '-i sanityORDeleteOLT -i PowerSwitch -X'
-          extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master'
-
 - job-template:
     id: 'voltha-periodic-test'
     name: '{name}'
@@ -1109,11 +1090,10 @@
                   Copyright (c) 2019 Open Networking Foundation (ONF)
     sandbox: true
     pipeline-script: 'voltha/master/tucson-build-and-test.groovy'
-    default-test-args: '-i sanityORDeleteOLT -X'
+    default-test-args: '-i sanityORDeleteOLT -i PowerSwitch -X'
     branch-pattern: '{all-branches-regexp}'
     build-node: 'tucson-pod'
     config-pod: 'tucson-pod'
-    workflow: 'att'
     profile: 'Default'
     oltDebVersionMaster: 'openolt_asfvolt16-3.4.1-dev-c5dcc7f2b27df1c42868b3a79a5416808511bb1d-40G-NNI.deb'
     oltDebVersionVoltha23: 'openolt_asfvolt16-3.3.3-1a5d68b50d8bcc5ba6cb1630d3294c30c37cd2f5-40G-NNI.deb'
@@ -1168,11 +1148,11 @@
     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'
+    default-test-args: '-i sanityORDeleteOLT -i PowerSwitch -X'
     branch-pattern: '{all-branches-regexp}'
     volthaSystemTestsChange: ''
     volthaHelmChartsChange: ''
-    workflow: 'att'
+    profile: 'Default'
     extraHelmFlags: ''
 
     properties:
@@ -1207,130 +1187,3 @@
               branches:
                 - branch-compare-type: REG_EXP
                   branch-pattern: '{branch-pattern}'
-
-- job-template:
-    name: '{name}'
-    id: build_physical_voltha_manual
-    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/voltha-2.7/voltha-physical-build-and-tests.groovy'
-
-    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'
-
-      - 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 manifest 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: false
-          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: '-e bbsim -X'
-          description: 'Arguments to pass to robot'
-
-    project-type: pipeline
-    concurrent: true
-
-    dsl: !include-raw-escape: pipeline/{pipeline-script}