Merge "[VOL-3007] Adding configuration support to the pipeline"
diff --git a/jjb/cord-test/nightly-build-pipeline.yaml b/jjb/cord-test/nightly-build-pipeline.yaml
index 6f36724..c78a2e3 100644
--- a/jjb/cord-test/nightly-build-pipeline.yaml
+++ b/jjb/cord-test/nightly-build-pipeline.yaml
@@ -922,6 +922,16 @@
           default: '{num-of-openonu}'
           description: 'Installs the specified Number of OpenOnu Adapters'
 
+      - string:
+          name: NumOfOnos
+          default: '{num-of-onos}'
+          description: 'Installs the specified Number of ONOS instances'
+
+      - string:
+          name: NumOfAtomix
+          default: '{num-of-atomix}'
+          description: 'Installs the specified Number of Atomix Instances'
+
       - bool:
           name: configurePod
           default: true
diff --git a/jjb/cord-test/voltha.yaml b/jjb/cord-test/voltha.yaml
index 50c7040..a54f0ee 100644
--- a/jjb/cord-test/voltha.yaml
+++ b/jjb/cord-test/voltha.yaml
@@ -12,6 +12,8 @@
     power-switch: False
     work-flow: ''
     num-of-openonu: '1'
+    num-of-onos: '1'
+    num-of-atomix: '0'
 
     jobs:
       # flex OCP pod with olt/onu - manual test job, voltha master build job
@@ -61,6 +63,8 @@
           release: 'master'
           branch: 'master'
           num-of-openonu: '2'
+          num-of-onos: '3'
+          num-of-atomix: '3'
           test-repo: 'voltha-system-tests'
           Jenkinsfile: 'Jenkinsfile-voltha-build'
           oltDebVersion: 'openolt_asfvolt16-2.3.0-bc6e0853e0e8bf6bd7e4223d4a7ee0dd35ce634d.deb'
@@ -85,6 +89,8 @@
           release: 'master'
           branch: 'master'
           num-of-openonu: '2'
+          num-of-onos: '3'
+          num-of-atomix: '3'
           test-repo: 'voltha-system-tests'
           Jenkinsfile: 'Jenkinsfile-voltha-build'
           oltDebVersion: 'openolt_asfvolt16-2.3.0-bc6e0853e0e8bf6bd7e4223d4a7ee0dd35ce634d.deb'
@@ -404,7 +410,7 @@
           Jenkinsfile: 'Jenkinsfile-voltha-build'
           oltDebVersion: 'openolt_asgvolt64.deb'
           configurePod: true
-          profile: '1T8GEM'
+          profile: 'Default'
           with-kind: true
           time: '11'
 
@@ -418,6 +424,6 @@
           release: 'master'
           branch: 'master'
           test-repo: 'voltha-system-tests'
-          profile: '1T8GEM'
+          profile: 'Default'
           power-switch: True
           pipeline-script: 'voltha-dt-physical-functional-tests.groovy'
diff --git a/jjb/device-management.yaml b/jjb/device-management.yaml
index cd8b9f6..ea1b9fc 100644
--- a/jjb/device-management.yaml
+++ b/jjb/device-management.yaml
@@ -15,7 +15,7 @@
           branch: 'master'
           oltDebVersion: 'openolt_asfvolt16-2.3.0-bc6e0853e0e8bf6bd7e4223d4a7ee0dd35ce634d.deb'
           profile: 'Default'
-          withPatchset: true
+          time-trigger: "@daily"
 
 - job-template:
     id: 'device-management-patch-test'
@@ -144,18 +144,18 @@
 
       - string:
           name: gerritProject
-          default: '$GERRIT_PROJECT'
+          default: 'device-management'
           description: 'Name of the Gerrit project'
 
       - string:
-          name: gerritChangeNumber
-          default: '$GERRIT_CHANGE_NUMBER'
-          description: 'Changeset number in Gerrit'
+          name: gerritRefSpec
+          default: '$GERRIT_REFSPEC'
+          description: 'Refspec for the Gerrit patchset'
 
       - string:
-          name: gerritPatchsetNumber
-          default: '$GERRIT_PATCHSET_NUMBER'
-          description: 'PatchSet number in Gerrit'
+          name: gerritEventCommentText
+          default: '$GERRIT_EVENT_COMMENT_TEXT'
+          description: 'Comment text from gerrit commit'
 
       - string:
           name: cordRepoUrl
@@ -215,11 +215,6 @@
           default: true
           description: "Re-install OLT software"
 
-      - bool:
-          name: withPatchset
-          default: true
-          description: "Build with Gerrit patchset"
-
       - string:
           name: extraRobotArgs
           default: '-i sanity'
diff --git a/jjb/pipeline/device-management-physical-build-and-tests.groovy b/jjb/pipeline/device-management-physical-build-and-tests.groovy
index ee16151..6c183ff 100644
--- a/jjb/pipeline/device-management-physical-build-and-tests.groovy
+++ b/jjb/pipeline/device-management-physical-build-and-tests.groovy
@@ -21,14 +21,6 @@
 localKindVolthaValuesFile = null
 localSadisConfigFile = null
 
-// The pipeline assumes these variables are always defined
-if ( ! params.withPatchset ) {
-  GERRIT_EVENT_COMMENT_TEXT = ""
-  GERRIT_PROJECT = ""
-  GERRIT_CHANGE_NUMBER = ""
-  GERRIT_PATCHSET_NUMBER = ""
-}
-
 pipeline {
 
   /* no label, executor is determined by JJB */
@@ -92,11 +84,11 @@
       steps {
         sh """
            pushd $WORKSPACE/
-           echo "${gerritProject}" "${gerritChangeNumber}" "${gerritPatchsetNumber}"
-           echo "${GERRIT_REFSPEC}"
            git clone https://gerrit.opencord.org/${gerritProject}
            cd "${gerritProject}"
-           git fetch https://gerrit.opencord.org/${gerritProject} "${GERRIT_REFSPEC}" && git checkout FETCH_HEAD
+           if [[ ! -z "${gerritRefSpec}" ]]; then
+               git fetch https://gerrit.opencord.org/${gerritProject} "${gerritRefSpec}" && git checkout FETCH_HEAD
+           fi
            popd
            """
       }
@@ -206,6 +198,7 @@
           sh returnStdout: false, script: """
               helm repo add cord https://charts.opencord.org
               helm repo update
+              helm del --purge voltha-kafka-dump || true
               helm install -n voltha-kafka-dump cord/voltha-kafka-dump
           """
         }
@@ -308,7 +301,7 @@
         sh returnStdout: false, script: """
         # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
         REGEX="hardware test with delay\$"
-        [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]] && sleep 10m || true
+        [[ "${gerritEventCommentText}" =~ \$REGEX ]] && sleep 10m || true
         """
       }
     }