creating xos-att-workflow "workflow validation" post test job

Change-Id: I14c744acc0d036c29ca8359b232e9dcf3c3eb13d
diff --git a/jjb/pipeline/xos-integration-tests.groovy b/jjb/pipeline/xos-integration-tests.groovy
index 652b323..18b3fb8 100644
--- a/jjb/pipeline/xos-integration-tests.groovy
+++ b/jjb/pipeline/xos-integration-tests.groovy
@@ -77,8 +77,7 @@
       }
     }
 
-
-    stage('install profile') {
+    stage('install xos') {
       steps {
         sh """
            #!/usr/bin/env bash
@@ -92,7 +91,7 @@
            helm-repo-tools/wait_for_pods.sh
 
            helm dep up xos-core
-           helm install xos-core -n xos-core
+           helm install --set images.xos_core.tag:master xos-core -n xos-core
 
            helm dep update xos-profiles/seba-services
            helm install xos-profiles/seba-services
@@ -119,6 +118,39 @@
            """
       }
     }
+
+    stage('install profile') {
+      when { expression { return params.InstallService } }
+      steps {
+        sh """
+           #!/usr/bin/env bash
+           set -eu -o pipefail
+
+           pushd cord/helm-charts
+
+           helm dep update ${params.helmChart}
+           helm install --set image.tag=master ${params.helmChart} --set att-workflow-driver.kafkaService=cord-kafka -n ${params.service}
+
+           helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
+
+           # wait for services to load
+           JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
+           sleep 300
+           echo "# Checking helm deployments"
+           kubectl get pods
+           helm list
+
+           for hchart in \$(helm list -q);
+           do
+             echo "## 'helm status' for chart: \${hchart} ##"
+             helm status "\${hchart}"
+           done
+           popd
+
+           """
+      }
+    }
+
     stage('test') {
       steps {
         sh """
@@ -134,11 +166,18 @@
       }
     }
   }
+
   post {
     always {
       sh """
          kubectl get pods --all-namespaces
 
+         ## get pod logs
+         for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
+         do
+           kubectl logs \$pod> $WORKSPACE/\$pod.log;
+         done || true
+
          # copy robot logs
          if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
          cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/${params.TestDir}/Log/*ml ./RobotLogs
@@ -163,7 +202,8 @@
             passThreshold: 100,
             reportFileName: 'RobotLogs/report*.html',
             unstableThreshold: 0]);
-         step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org, teo@opennetworking.org", sendToIndividuals: false])
+         archiveArtifacts artifacts: '*.log'
+         step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${params.notificationEmail}", sendToIndividuals: false])
 
     }
   }
diff --git a/jjb/xos-integration-tests.yaml b/jjb/xos-integration-tests.yaml
index 761939f..fdf3e39 100644
--- a/jjb/xos-integration-tests.yaml
+++ b/jjb/xos-integration-tests.yaml
@@ -10,6 +10,7 @@
       - 'data-model-scale'
       - 'data-migrations'
       - 'data-backup'
+      - 'att-wf'
 
 - job-template:
     id: 'data-model-scale'
@@ -55,6 +56,10 @@
          default: 'robot -d Log -T -v xos_chameleon_url:127.0.0.1 -v xos_chameleon_port:30006 -v cord_kafka:\$CORD_KAFKA_IP -v num_olts:10 -v num_onus:1 -v num_pon_ports:10 -v timeout:360s xos-scale-att-workflow.robot'
          description: 'Exact command to execute the tests including arguments'
 
+      - string:
+         name: notificationEmail
+         default: 'kailash@opennetworking.org, teo@opennetworking.org'
+         description: ''
 
     project-type: pipeline
     concurrent: false
@@ -110,6 +115,10 @@
          default: 'robot -d Log -T -v helm_chart:$WORKSPACE/cord/helm-charts/xos-services/simpleexampleservice xos-remove-service.robot xos-service-migrations.robot'
          description: 'Exact command to execute the tests including arguments'
 
+      - string:
+         name: notificationEmail
+         default: 'kailash@opennetworking.org, smbaker@opennetworking.org'
+         description: ''
 
     project-type: pipeline
     concurrent: false
@@ -165,6 +174,10 @@
          default: 'robot -d Log -T xos-backup.robot'
          description: 'Exact command to execute the tests including arguments'
 
+      - string:
+         name: notificationEmail
+         default: 'kailash@opennetworking.org, smbaker@opennetworking.org'
+         description: ''
 
     project-type: pipeline
     concurrent: false
@@ -175,3 +188,77 @@
       - reverse:
           jobs: 'docker-publish_xos'
           result: 'success'
+
+- job-template:
+    id: 'att-wf'
+    name: 'att-workflow-validation-test'
+
+    description: |
+      <!-- Managed by Jenkins Job Builder -->
+      Created by {id} job-template from ci-management/jjb/xos-integration-tests.yaml  <br /><br />
+
+    properties:
+      - cord-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+          artifact-num-to-keep: '{artifact-num-to-keep}'
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: '{build-timeout}'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    parameters:
+      - string:
+         name: executorNode
+         default: 'ubuntu16.04-basebuild-4c-8g'
+         description: 'Name of the Jenkins node to run the job on'
+
+      - string:
+         name: manifestUrl
+         default: '{gerrit-server-url}/{cord-repo-manifest}'
+         description: 'URL to the repo manifest'
+
+      - string:
+         name: manifestBranch
+         default: 'master'
+         description: 'Name of the repo branch to use'
+
+      - string:
+         name: service
+         default: 'att-workflow-driver'
+         description: 'Name of the service being tested'
+
+      - string:
+         name: helmChart
+         default: 'workflows/att-workflow'
+         description: 'Directory/name of the service helm-chart'
+
+      - string:
+         name: TestDir
+         default: 'xos-att-workflow-driver-tests'
+         description: 'Directory where tests reside'
+
+      - string:
+         name: TestCommand
+         default: 'robot -d Log -T -v xos_chameleon_url:127.0.0.1 -v xos_chameleon_port:30006 -v cord_kafka:\$CORD_KAFKA_IP ATT_Workflow.robot'
+         description: 'Exact command to execute the tests including arguments'
+
+      - string:
+         name: notificationEmail
+         default: 'kailash@opennetworking.org, teo@opennetworking.org'
+         description: ''
+
+      - bool:
+         name: InstallService
+         default: true
+         description: 'Set to true when testing a particular xos-service'
+
+    project-type: pipeline
+    concurrent: false
+
+    dsl: !include-raw-escape: pipeline/xos-integration-tests.groovy
+
+    triggers:
+      - reverse:
+          jobs: 'docker-publish_att-workflow-driver'
+          result: 'success'