Merge "[VOL-4536] Using a single ONOS instance in the certification jobs"
diff --git a/jjb/onos-app-release.yaml b/jjb/onos-app-release.yaml
index e168556..99c9a1d 100644
--- a/jjb/onos-app-release.yaml
+++ b/jjb/onos-app-release.yaml
@@ -32,7 +32,7 @@
       - string:
           name: appRepo
           default: ''
-          description: 'Name of the app repository on the OpenCORD Gerrit server.\n e.g. vtn'
+          description: 'Name of the app repository on the OpenCORD Gerrit server.\n e.g. olt'
 
       - string:
           name: appName
@@ -47,7 +47,7 @@
       - string:
           name: nextApiVersion
           default: ''
-          description: 'Version to release.\n e.g. 1.0.0'
+          description: 'Snapshot version to move the code forward to.\n e.g. 1.1.0'
 
       - string:
           name: version
diff --git a/jjb/pipeline/onos-app-release.groovy b/jjb/pipeline/onos-app-release.groovy
index f8d87de..dc022e1 100644
--- a/jjb/pipeline/onos-app-release.groovy
+++ b/jjb/pipeline/onos-app-release.groovy
@@ -83,10 +83,14 @@
   }
 
   stage ('Move to release version') {
+    sh 'echo app version ' + version
+    sh 'echo api version ' + apiVersion
+
     //Splitting version and apiVersion and check if apiVersion different from empty then update API it.
     //Allows to release apps that dont' have api.version (e.g. bng,pppoe,kafka)
     changeVersion(version)
-    if (apiVersion != "") {
+    if (!params.apiVersion.isEmpty()) {
+       sh 'echo releasing api version' + '"' + apiVersion +'"'
        changeApiVersion(appName, apiVersion)
     }
     sh 'git add -A && git commit -m "Release app version ' + version + ' with API version ' + apiVersion + '"'
@@ -113,8 +117,13 @@
   stage ('Move to next SNAPSHOT version') {
     def snapshot = nextVersion + '-SNAPSHOT'
     def apiSnapshot = nextApiVersion + '-SNAPSHOT'
+
+    sh 'echo next app version ' + nextVersion
+    sh 'echo next api version ' + nextApiVersion
+
     changeVersion(snapshot)
-    if (apiVersion != "") {
+    if (!params.nextApiVersion.isEmpty()) {
+       sh 'echo moving to next api version' + '"' + nextApiVersion +'"'
        changeApiVersion(appName, apiSnapshot)
     }
     sh 'git add -A && git commit -m "Starting snapshot ' + snapshot + ' with API version ' + apiSnapshot + '"'
diff --git a/jjb/pipeline/voltha/master/software-upgrades.groovy b/jjb/pipeline/voltha/master/software-upgrades.groovy
index d531523..387cbda 100755
--- a/jjb/pipeline/voltha/master/software-upgrades.groovy
+++ b/jjb/pipeline/voltha/master/software-upgrades.groovy
@@ -34,16 +34,16 @@
       """
       def extraHelmFlags = extraHelmFlags.trim()
       if ("${name}" == "onos-app-upgrade" || "${name}" == "onu-software-upgrade" || "${name}" == "voltha-component-upgrade") {
-          extraHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel.toUpperCase()},onu=1,pon=1 --set onos-classic.replicas=3,onos-classic.atomix.replicas=3 "
+          extraHelmFlags = " --set global.log_level=${logLevel.toUpperCase()},onu=1,pon=1 --set onos-classic.replicas=3,onos-classic.atomix.replicas=3 " + extraHelmFlags
       }
       if ("${name}" == "onu-image-dwl-simultaneously") {
-          extraHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel.toUpperCase()},onu=2,pon=2 --set onos-classic.replicas=3,onos-classic.atomix.replicas=3 "
+          extraHelmFlags = " --set global.log_level=${logLevel.toUpperCase()},onu=2,pon=2 --set onos-classic.replicas=3,onos-classic.atomix.replicas=3 " + extraHelmFlags
       }
       if ("${name}" == "onos-app-upgrade" || "${name}" == "onu-software-upgrade" || "${name}" == "onu-image-dwl-simultaneously") {
-          extraHelmFlags = extraHelmFlags + "--set global.image_tag=master --set onos-classic.image.tag=master "
+          extraHelmFlags = " --set global.image_tag=master --set onos-classic.image.tag=master " + extraHelmFlags
       }
       if ("${name}" == "voltha-component-upgrade") {
-          extraHelmFlags = extraHelmFlags + "--set images.onos_config_loader.tag=master-onos-config-loader --set onos-classic.image.tag=master "
+          extraHelmFlags = " --set images.onos_config_loader.tag=master-onos-config-loader --set onos-classic.image.tag=master " + extraHelmFlags
       }
       extraHelmFlags = extraHelmFlags + " --set onos-classic.onosSshPort=30115 --set onos-classic.onosApiPort=30120 "
       extraHelmFlags = extraHelmFlags + " --set voltha.onos_classic.replicas=3"
@@ -52,7 +52,7 @@
          String[] split;
          onosImg = onosImg.trim()
          split = onosImg.split(':')
-        extraHelmFlags = extraHelmFlags + "--set onos-classic.image.repository=" + split[0] +",onos-classic.image.tag=" + split[1] + " "
+        extraHelmFlags = extraHelmFlags + " --set onos-classic.image.repository=" + split[0] +",onos-classic.image.tag=" + split[1] + " "
       }
       def olts = 1
       if ("${name}" == "onu-image-dwl-simultaneously") {
diff --git a/jjb/pipeline/voltha/voltha-2.8/physical-build.groovy b/jjb/pipeline/voltha/voltha-2.8/physical-build.groovy
index c1029bf..5952828 100644
--- a/jjb/pipeline/voltha/voltha-2.8/physical-build.groovy
+++ b/jjb/pipeline/voltha/voltha-2.8/physical-build.groovy
@@ -319,10 +319,18 @@
               timeout(5) {
                 waitUntil {
                   olt_sw_present = sh returnStdout: true, script: """
-                  if [ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]; then
+                  if [[ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]]; then
                     sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep asfvolt16 | wc -l'
-                  else
+                  elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"asgvolt64"* ]]; then
                     sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep asgvolt64 | wc -l'
+                  elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600x-w"* ]]; then
+                    sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep rlt-1600x-w | wc -l'
+                  elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600g-w"* ]]; then
+                    sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep rlt-1600g-w | wc -l'
+                  elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-3200g-w"* ]]; then
+                    sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep rlt-3200g-w | wc -l'
+                  else
+                    echo Unknown Debian package for openolt
                   fi
                   if (${deployment_config.olts[i].fortygig}); then
                     if [[ "${params.inBandManagement}" == "true" ]]; then
diff --git a/jjb/pipeline/voltha/voltha-2.8/software-upgrades.groovy b/jjb/pipeline/voltha/voltha-2.8/software-upgrades.groovy
index 8cae8d6..9b59ae5 100644
--- a/jjb/pipeline/voltha/voltha-2.8/software-upgrades.groovy
+++ b/jjb/pipeline/voltha/voltha-2.8/software-upgrades.groovy
@@ -33,16 +33,16 @@
       _TAG=kail-${name} kail -n ${infraNamespace} -n ${volthaNamespace} > ${logsDir}/onos-voltha-startup-combined.log &
       """
       def extraHelmFlags = extraHelmFlags.trim()
-      extraHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel.toUpperCase()},onu=1,pon=1 --set onos-classic.replicas=3,onos-classic.atomix.replicas=3 "
+      extraHelmFlags = " --set global.log_level=${logLevel.toUpperCase()},onu=1,pon=1 --set onos-classic.replicas=3,onos-classic.atomix.replicas=3 " + extraHelmFlags
 
-      extraHelmFlags = extraHelmFlags + " --set onos-classic.onosSshPort=30115 --set onos-classic.onosApiPort=30120 "
-      extraHelmFlags = extraHelmFlags + " --set voltha.onos_classic.replicas=3"
+      extraHelmFlags = " --set onos-classic.onosSshPort=30115 --set onos-classic.onosApiPort=30120 " + extraHelmFlags
+      extraHelmFlags = " --set voltha.onos_classic.replicas=3 " + extraHelmFlags
       //ONOS custom image handling
       if ( onosImg.trim() != '' ) {
          String[] split;
          onosImg = onosImg.trim()
          split = onosImg.split(':')
-        extraHelmFlags = extraHelmFlags + "--set onos-classic.image.repository=" + split[0] +",onos-classic.image.tag=" + split[1] + " "
+        extraHelmFlags = extraHelmFlags + " --set onos-classic.image.repository=" + split[0] +",onos-classic.image.tag=" + split[1] + " "
       }
       def localCharts = false
       if (branch != "master") {
diff --git a/jjb/pipeline/voltha/voltha-2.8/voltha-scale-test.groovy b/jjb/pipeline/voltha/voltha-2.8/voltha-scale-test.groovy
index bc14f57..e314995 100644
--- a/jjb/pipeline/voltha/voltha-2.8/voltha-scale-test.groovy
+++ b/jjb/pipeline/voltha/voltha-2.8/voltha-scale-test.groovy
@@ -275,7 +275,6 @@
               atomixReplica: atomixReplicas,
               kafkaReplica: kafkaReplicas,
               etcdReplica: etcdReplicas,
-              onosReplica: onosReplicas,
             ])
 
             stackHelmFlags = " --set onu=${onus},pon=${pons} --set global.log_level=${logLevel.toLowerCase()} "
@@ -291,6 +290,7 @@
               extraHelmFlags: stackHelmFlags,
               localCharts: localCharts,
               adaptersToWait: 0, // no need to wait for adapters, 2.8 is kafka based
+              onosReplica: onosReplicas,
             ])
             sh """
               set +x
diff --git a/jjb/pipeline/voltha/voltha-2.9/physical-build.groovy b/jjb/pipeline/voltha/voltha-2.9/physical-build.groovy
index 28241f8..51313a6 100644
--- a/jjb/pipeline/voltha/voltha-2.9/physical-build.groovy
+++ b/jjb/pipeline/voltha/voltha-2.9/physical-build.groovy
@@ -322,10 +322,18 @@
               timeout(5) {
                 waitUntil {
                   olt_sw_present = sh returnStdout: true, script: """
-                  if [ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]; then
+                  if [[ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]]; then
                     sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep asfvolt16 | wc -l'
-                  else
+                  elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"asgvolt64"* ]]; then
                     sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep asgvolt64 | wc -l'
+                  elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600x-w"* ]]; then
+                    sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep rlt-1600x-w | wc -l'
+                  elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600g-w"* ]]; then
+                    sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep rlt-1600g-w | wc -l'
+                  elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-3200g-w"* ]]; then
+                    sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep rlt-3200g-w | wc -l'
+                  else
+                    echo Unknown Debian package for openolt
                   fi
                   if (${deployment_config.olts[i].fortygig}); then
                     if [[ "${params.inBandManagement}" == "true" ]]; then
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index 3a3cc91..d7840af 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -103,6 +103,23 @@
           onosStatInterval: 30
           onosGroupInterval: 30
 
+      # 4k ONTs jobs
+      - 'voltha-scale-measurements':
+          name: 'voltha-scale-measurements-master-2-64-32-dt-subscribers'
+          'disable-job': false
+          build-node: 'voltha-scale-1'
+          time-trigger: "H H/4 * * *"
+          olts: 2
+          pons: 64
+          onus: 32
+          withFlows: true
+          provisionSubscribers: true
+          workflow: dt
+          withEapol: false
+          withDhcp: false
+          withIgmp: false
+          extraHelmFlags: '-f /home/jenkins/voltha-scale/voltha-values.yaml --set uni=1 --set etcd.persistence.enabled=true,etcd.persistence.storageClass=longhorn'
+
       # multi-stack jobs
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-10-stacks-2-16-32-att-subscribers'
@@ -208,7 +225,7 @@
           openoltAdapterImg: ''
           openonuAdapterImg: ''
           openonuAdapterGoImg: ''
-          onosImg: ''
+          onosImg: 'voltha/voltha-onos:5.0.4'
           extraHelmFlags: "-f /home/jenkins/voltha-scale/voltha-values.yaml --set etcd.persistence.enabled=true,etcd.persistence.storageClass=longhorn"
 
       - 'voltha-scale-measurements':
@@ -262,7 +279,7 @@
           openoltAdapterImg: ''
           openonuAdapterImg: ''
           openonuAdapterGoImg: ''
-          onosImg: ''
+          onosImg: 'voltha/voltha-onos:5.0.4'
           extraHelmFlags: "-f /home/jenkins/voltha-scale/voltha-values.yaml "
 
       - 'voltha-scale-measurements':
diff --git a/jjb/voltha-test/voltha.yaml b/jjb/voltha-test/voltha.yaml
index 87c55b3..71d0498 100644
--- a/jjb/voltha-test/voltha.yaml
+++ b/jjb/voltha-test/voltha.yaml
@@ -433,12 +433,14 @@
       - 'build_voltha_pod_release_timer':
           build-node: 'dt-berlin-community-pod'
           config-pod: 'dt-berlin-pod-multi-olt'
+          'disable-job': true
           name-extension: '_DT'
           work-flow: 'DT'
           profile: '1T8GEM'
           num-of-onos: '3'
           num-of-atomix: '3'
-          time: '1'
+          # Update time trigger value while re-enabling the job
+          time: ''
 
       # Berlin POD test job - master versions: uses tech profile on voltha branch
       - 'build_voltha_pod_test':
@@ -447,6 +449,7 @@
           config-pod: 'dt-berlin-pod-multi-olt'
           release: 'master'
           branch: 'master'
+          'disable-job': true
           name-extension: '_DT'
           work-flow: 'DT'
           test-repo: 'voltha-system-tests'
@@ -459,11 +462,13 @@
           build-node: 'dt-berlin-community-pod'
           config-pod: 'dt-berlin-pod-gpon'
           name-extension: '_DT'
+          'disable-job': true
           work-flow: 'DT'
           profile: '1T8GEM'
           num-of-onos: '3'
           num-of-atomix: '3'
-          time: '7'
+          # Update time trigger value while re-enabling the job
+          time: ''
 
       # Berlin POD test job - master versions: uses 1T8GEM tech profile on voltha branch
       - 'build_voltha_pod_test':
@@ -471,6 +476,7 @@
           build-node: 'dt-berlin-community-pod'
           config-pod: 'dt-berlin-pod-gpon'
           name-extension: '_DT'
+          'disable-job': true
           work-flow: 'DT'
           release: 'master'
           branch: 'master'
@@ -490,9 +496,7 @@
           profile: '1T8GEM'
           num-of-onos: '3'
           num-of-atomix: '3'
-          # Update time trigger value while re-enabling the job
-          time: ''
-          'disable-job': true
+          time: '1'
           pipeline-script: 'voltha/voltha-2.8/physical-build.groovy'
 
       # Berlin POD test job - master versions: uses 1T8GEM tech profile on voltha branch
@@ -506,7 +510,6 @@
           test-repo: 'voltha-system-tests'
           profile: '1T8GEM'
           power-switch: True
-          'disable-job': true
           pipeline-script: 'voltha/voltha-2.8/voltha-dt-physical-functional-tests.groovy'
 
       # Berlin pod with olt/onu - voltha-2.8 versions timer based job , two OLTs
@@ -521,7 +524,7 @@
           num-of-onos: '3'
           num-of-atomix: '3'
           pipeline-script: 'voltha/voltha-2.8/physical-build.groovy'
-          time: '13'
+          time: '8'
 
       # Berlin POD test job - voltha-2.8 versions: uses tech profile on voltha branch
       - 'build_voltha_pod_test':
@@ -546,7 +549,7 @@
           branch: 'voltha-2.8'
           profile: '1T8GEM'
           reinstall-olt: false
-          extraHelmFlags: "--set adapter_adtran_olt.kv_store_data_prefix='service/voltha/voltha_voltha' --set network.netconfUserSecret='' --set adapter_adtran_olt.topics.core_topic=voltha_voltha_rwcore --set onos-classic.image.tag=master"
+          extraHelmFlags: "--set adapter_adtran_olt.kv_store_data_prefix='service/voltha/voltha_voltha' --set network.netconfUserSecret='' --set adapter_adtran_olt.topics.core_topic=voltha_voltha_rwcore"
           num-of-onos: '3'
           num-of-atomix: '3'
           pipeline-script: 'voltha/voltha-2.8/physical-build.groovy'