Merge "SEBA-292 adding e2e xos-tosca verify tests"
diff --git a/jjb/cord-test/att-workflow.yaml b/jjb/cord-test/att-workflow.yaml
index f640d38..149212c 100644
--- a/jjb/cord-test/att-workflow.yaml
+++ b/jjb/cord-test/att-workflow.yaml
@@ -9,6 +9,7 @@
     build-timeout: '300'
 
     jobs:
+      # onlab pod1 build
       - 'build_pod_manual':
          testvm: 'onf-build'
          config-pod: 'onlab-pod1'
@@ -18,6 +19,25 @@
          oltDebVersion: 'openolt-master.deb'
          configurePod: true
 
+      # onlab pod1 build
+      - 'build_pod_timer':
+         testvm: 'onf-build'
+         config-pod: 'onlab-pod1'
+         profile: 'att-workflow'
+         branch: 'master'
+         Jenkinsfile: 'Jenkinsfile-attworkflow-build'
+         oltDebVersion: 'openolt-master.deb'
+         configurePod: true
+         time: '3'
+
+     # onlab pod1 test job
+      - 'build_pod_test':
+         testvm: 'onf-build'
+         config-pod: 'onlab-pod1'
+         profile: 'att-workflow'
+         branch: 'master'
+         Jenkinsfile: 'Jenkinsfile-attworkflow-test'
+
       # onlab pod2 build
       - 'build_pod_manual':
          testvm: 'onf-build'
@@ -28,22 +48,6 @@
          oltDebVersion: 'openolt-master.deb'
          configurePod: true
 
-     # onlab pod1 test job
-      - 'build_pod_test_manual':
-         testvm: 'onf-build'
-         config-pod: 'onlab-pod1'
-         profile: 'att-workflow'
-         branch: 'master'
-         Jenkinsfile: 'Jenkinsfile-attworkflow-test'
-
-     # onlab pod2 test job
-      - 'build_pod_test_manual':
-         testvm: 'onf-build'
-         config-pod: 'onlab-pod2'
-         profile: 'att-workflow'
-         branch: 'master'
-         Jenkinsfile: 'Jenkinsfile-attworkflow-test'
-
     # flex pod1 with olt/onu
       - 'build_pod_timer':
          testvm: 'qa-testvm-pod'
diff --git a/jjb/cord-test/nightly-build-pipeline.yaml b/jjb/cord-test/nightly-build-pipeline.yaml
index 6491736..f97356a 100644
--- a/jjb/cord-test/nightly-build-pipeline.yaml
+++ b/jjb/cord-test/nightly-build-pipeline.yaml
@@ -15,7 +15,7 @@
 
 
 - job-template:
-    name: 'build_{profile}_{config-pod}_{branch}'
+    name: 'build_{profile}_{config-pod}_{branch}_manual'
     id: build_pod_manual
     description: |
                   <!-- Managed by Jenkins Job Builder -->
@@ -254,71 +254,3 @@
       - reverse:
           jobs: 'build_{profile}_{config-pod}_{branch}'
           result: 'success'
-
-
-- job-template:
-    name: 'build_{profile}_{config-pod}_{branch}_test'
-    id: build_pod_test_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/cord-test-pipeline.yaml <br />
-                  Created by Kailash Khalasi - kailash@opennetworking.org <br />
-                  Copyright (c) 2017 Open Networking Foundation (ONF)
-
-    <<: *test-pipe-job-boiler-plate
-
-    parameters:
-      - string:
-         name: TestNodeName
-         default: '{testvm}'
-         description: 'Jenkins node name of TestVM Node'
-
-      - 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: configToscaDir
-         default: 'tosca-configs'
-         description: 'The tosca config folder'
-
-      - string:
-         name: configFileName
-         default: '{config-pod}'
-         description: 'The config file'
-
-      - string:
-         name: branch
-         default: '{branch}'
-
-      - string:
-         name: notificationEmail
-         default: 'kailash@opennetworking.org, you@opennetworking.org, suchitra@opennetworking.org'
-         description: ''
-
-    concurrent: true
-
-    pipeline-scm:
-      script-path: '{Jenkinsfile}'
-      scm:
-        - git:
-           url: '{gerrit-server-url}/cord-tester'
-           branches:
-             - '{branch}'
diff --git a/jjb/defaults.yaml b/jjb/defaults.yaml
index 37be9ec..94d103a 100644
--- a/jjb/defaults.yaml
+++ b/jjb/defaults.yaml
@@ -72,7 +72,7 @@
 
     # matching repos that should be version tagged by the version-tag job
     # (basically the same as imagebuilder projects + helm charts + tools
-    version-tag-projects-regexp: '^(xos.*|helm-charts|automation-tools|cord-tester|chameleon|rcord|mcord|ecord|acordion|addressmanager|epc-service|exampleservice|fabric|fabric-crossconnect|globalxos|hippie-oss|hss_db|hypercache|internetemulator|kubernetes-service|monitoring|olt-service|onos-service|openstack|progran|sdn-controller|simpleexampleservice|templateservice|vEE|vEG|vBBU|venb|vHSS|vMME|vnaas|vPGWC|vPGWU|vrouter|vsg|vsg-hw|vSGW|vSM|vspgwc|vspgwu|vtn-service|vtr|att-workflow-driver)$'
+    version-tag-projects-regexp: '^(xos.*|helm-charts|automation-tools|cord-tester|chameleon|rcord|mcord|ecord|acordion|addressmanager|epc-service|exampleservice|fabric|fabric-crossconnect|globalxos|hippie-oss|hss_db|hypercache|internetemulator|kubernetes-service|monitoring|olt-service|onos-service|openstack|progran|sdn-controller|simpleexampleservice|templateservice|vEE|vEG|vBBU|venb|vHSS|vMME|vnaas|vPGWC|vPGWU|vrouter|vsg|vsg-hw|vSGW|vSM|vspgwc|vspgwu|vtn-service|vtr|att-workflow-driver|ves-agent)$'
 
     # for matching files with file-include-regexp
     all-files-regexp: '.*'
diff --git a/jjb/pipeline/all-xos-api-test-helm.groovy b/jjb/pipeline/all-xos-api-test-helm.groovy
index 4271bad..d942d90 100644
--- a/jjb/pipeline/all-xos-api-test-helm.groovy
+++ b/jjb/pipeline/all-xos-api-test-helm.groovy
@@ -141,8 +141,11 @@
            # not indented because heredoc requires it
            cat << EOF > $WORKSPACE/xos_tags.yaml
 ---
-xos_coreImage: 'xosproject/xos-core:\$XOS_VERSION'
-xos_chameleonImage: 'xosproject/chameleon:\$XOS_VERSION'
+images:
+  xos_core:
+    tag: '\$XOS_VERSION'
+  xos_chameleon:
+    tag: '\$XOS_VERSION'
 EOF
            """
       }
@@ -252,9 +255,9 @@
              helm dep update xos-services/hippie-oss
              helm install \${helm_install_args} xos-services/hippie-oss -n hippie-oss
 
-           elif [[ "$GERRIT_PROJECT" =~ ^(att-workflow-driver)\$ ]]; then
-             helm dep update xos-services/att-workflow-driver
-             helm install \${helm_install_args} xos-services/att-workflow-driver -n att-workflow-driver
+           elif [[ "$GERRIT_PROJECT" =~ ^(att-workflow-driver|fabric-crossconnect)\$ ]]; then
+             helm dep update xos-profiles/att-workflow
+             helm install \${helm_install_args} xos-profiles/att-workflow -n att-workflow
 
            elif [[ "$GERRIT_PROJECT" =~ ^(xos|xos-tosca|cord-tester|helm-charts)\$ ]]; then
              echo "No additional charts to install for testing $GERRIT_PROJECT"
diff --git a/jjb/pipeline/license-check.groovy b/jjb/pipeline/license-check.groovy
index 69212c6..cc8c903 100644
--- a/jjb/pipeline/license-check.groovy
+++ b/jjb/pipeline/license-check.groovy
@@ -13,10 +13,7 @@
 // limitations under the License.
 
 repos = params.repos.split(",")
-
-def stepsForParallel = repos.collectEntries {
-    ["${it}" : checkRepo(it)]
-}
+echo repos[0]
 
 node ("${TestNodeName}") {
     timeout (100) {
@@ -25,7 +22,10 @@
                 sh returnStdout: true, script: "rm -rf *"
             }
             stage ("Check repositories") {
-                parallel stepsForParallel
+
+                for(int i=0; i < repos.size(); i++) {
+                    checkRepo(repos[i])
+                }
             }
             currentBuild.result = 'SUCCESS'
         } catch (err) {
@@ -37,7 +37,6 @@
 }
 
 def checkRepo(repo) {
-    return {
         withCredentials([sshUserPrivateKey(credentialsId: '315e1f56-7193-464e-8af1-97bf7b1ee541', keyFileVariable: 'KEY')]) {
             sh returnStdout: true, script: """
                 chmod 600 $KEY && eval `ssh-agent -s` && ssh-add $KEY &&
@@ -45,6 +44,5 @@
                 git clone -b ${branch} ssh://mcord-private@gerrit.opencord.org:29418/${repo}
             """
         }
-        hub_detect("--detect.source.path=${repo} --detect.blackduck.signature.scanner.snippet.mode=true --detect.project.name=${prefix}-${repo} --detect.project.version.name=${branch} --detect.search.depth=20")
-    }
+        hub_detect("--detect.source.path=${repo} --detect.project.name=${prefix}-${repo} --detect.project.version.name=${branch} --snippet-matching --full-snippet-scan")
 }
diff --git a/jjb/pipeline/siab.groovy b/jjb/pipeline/siab.groovy
index e6074c1..e4f7431 100644
--- a/jjb/pipeline/siab.groovy
+++ b/jjb/pipeline/siab.groovy
@@ -39,7 +39,7 @@
       steps {
         sh """
             pushd $WORKSPACE/automation-tools/seba-in-a-box
-            make -j2
+            make ${params.version} -j2
             popd
             """
             }
@@ -55,6 +55,19 @@
             }
         }
 
+    stage ('Display Kafka Events') {
+      steps {
+        sh """
+            pushd $WORKSPACE/automation-tools/seba-in-a-box
+            CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
+            kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+            kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+            kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+            popd
+            """
+            }
+        }
+
      stage('Publish') {
       steps {
         sh """
diff --git a/jjb/pipeline/xos-synchronizer-update.groovy b/jjb/pipeline/xos-synchronizer-update.groovy
index 0bd9f92..b02ca11 100644
--- a/jjb/pipeline/xos-synchronizer-update.groovy
+++ b/jjb/pipeline/xos-synchronizer-update.groovy
@@ -137,8 +137,11 @@
            # not indented because heredoc requires it
            cat << EOF > $WORKSPACE/xos_tags.yaml
 ---
-xos_coreImage: 'xosproject/xos-core:\$XOS_VERSION'
-xos_chameleonImage: 'xosproject/chameleon:\$XOS_VERSION'
+images:
+  xos_core:
+    tag: '\$XOS_VERSION'
+  xos_chameleon:
+    tag: '\$XOS_VERSION'
 EOF
            """
       }
diff --git a/jjb/shell/tagcollisionreject.sh b/jjb/shell/tagcollisionreject.sh
index 09c014c..7a2307a 100755
--- a/jjb/shell/tagcollisionreject.sh
+++ b/jjb/shell/tagcollisionreject.sh
@@ -100,9 +100,12 @@
         if [[ "${p_version}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
         then
           echo "  OK: Parent '$p_image:$p_version' is a released SemVer version"
-        elif [[ "${p_version}" =~ ^([0-9]+)\.([0-9]+).*$ ]]
+        elif [[ "${p_version}" =~ ^.*([0-9]+)\.([0-9]+).*$ ]]
         then
-          # handle the non-SemVer 'ubuntu:16.04' and 'postgres:10.3-alpine' cases
+          # handle non-SemVer versions that have a Major.Minor version specifier in the name
+          #  'ubuntu:16.04'
+          #  'postgres:10.3-alpine'
+          #  'openjdk:8-jre-alpine3.8'
           echo "  OK: Parent '$p_image:$p_version' is using a non-SemVer, but sufficient, version"
         else
           echo "  ERROR: Parent '$p_image:$p_version' is NOT using an specific version"
diff --git a/jjb/shell/versiontag.sh b/jjb/shell/versiontag.sh
index 60042d8..96e8568 100755
--- a/jjb/shell/versiontag.sh
+++ b/jjb/shell/versiontag.sh
@@ -101,9 +101,12 @@
         if [[ "${p_version}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
         then
           echo "  OK: Parent '$p_image:$p_version' is a released SemVer version"
-        elif [[ "${p_version}" =~ ^([0-9]+)\.([0-9]+).*$ ]]
+        elif [[ "${p_version}" =~ ^.*([0-9]+)\.([0-9]+).*$ ]]
         then
-          # handle the non-SemVer 'ubuntu:16.04' and 'postgres:10.3-alpine' cases
+          # handle non-SemVer versions that have a Major.Minor version specifier in the name
+          #  'ubuntu:16.04'
+          #  'postgres:10.3-alpine'
+          #  'openjdk:8-jre-alpine3.8'
           echo "  OK: Parent '$p_image:$p_version' is using a non-SemVer, but sufficient, version"
         else
           echo "  ERROR: Parent '$p_image:$p_version' is NOT using an specific version"
diff --git a/jjb/siab.yaml b/jjb/siab.yaml
index 9be9b67..8a13a74 100644
--- a/jjb/siab.yaml
+++ b/jjb/siab.yaml
@@ -7,11 +7,12 @@
     project-name: '{name}'
 
     jobs:
-      - 'siab-build-test'
+      - 'siab-stable'
+      - 'siab-latest'
 
 - job-template:
-    id: 'siab-build-test'
-    name: 'seba-in-a-box-build-test'
+    id: 'siab-stable'
+    name: 'seba-in-a-box-build-test-stable'
 
     description: |
       <!-- Managed by Jenkins Job Builder -->
@@ -34,6 +35,11 @@
           default: 'qct-pod3-node1'
           description: 'Name of the Jenkins node to run the job on'
 
+      - string:
+          name: version
+          default: 'stable'
+          description: 'Latest | Stable'
+
     project-type: pipeline
     concurrent: false
 
@@ -42,4 +48,45 @@
     triggers:
        - timed: |
                  TZ=America/Los_Angeles
-                 H * * * *
+                 0 */2 * * *
+
+- job-template:
+    id: 'siab-latest'
+    name: 'seba-in-a-box-build-test-latest'
+
+    description: |
+      <!-- Managed by Jenkins Job Builder -->
+      Created by {id} job-template from ci-management/jjb/siba.yaml  <br /><br />
+      E2E Validation for Seba-in-a-Box
+
+    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: 'qct-pod3-node1'
+          description: 'Name of the Jenkins node to run the job on'
+
+      - string:
+          name: version
+          default: 'latest'
+          description: 'Latest | Stable'
+
+    project-type: pipeline
+    concurrent: false
+
+    dsl: !include-raw-escape: pipeline/siab.groovy
+
+    triggers:
+       - timed: |
+                 TZ=America/Los_Angeles
+                 59 */2 * * *
+
diff --git a/jjb/verify/fabric-crossconnect.yaml b/jjb/verify/fabric-crossconnect.yaml
index 55a42bd..17716dc 100644
--- a/jjb/verify/fabric-crossconnect.yaml
+++ b/jjb/verify/fabric-crossconnect.yaml
@@ -19,6 +19,6 @@
           dependency-jobs: 'verify_fabric-crossconnect_tag-collision'
       - 'xos-unit-test':
           dependency-jobs: 'verify_fabric-crossconnect_sonarqube'
-#      - 'api-test':
-#          dependency-jobs: 'verify_fabric-crossconnect_unit-test'
-#          pipeline_script: 'all-xos-api-test-helm.groovy'
+      - 'api-test':
+          dependency-jobs: 'verify_fabric-crossconnect_unit-test'
+          pipeline_script: 'all-xos-api-test-helm.groovy'
diff --git a/jjb/verify/ves-agent.yaml b/jjb/verify/ves-agent.yaml
index fca6a70..36b755a 100644
--- a/jjb/verify/ves-agent.yaml
+++ b/jjb/verify/ves-agent.yaml
@@ -13,6 +13,8 @@
     name: 'verify-ves-agent-jobs'
     jobs:
       - 'verify-licensed'
+      - 'tag-collision-reject':
+          dependency-jobs: 'verify_ves-agent_licensed'
       - 'verify-sonarqube':
           dependency-jobs: 'verify_ves-agent_tag-collision'
           sonar-prep-commands: './build.sh'