Merge "[EDGEPOD-358]: Add option for production in OMEC Jenkins Deploy Staging"
diff --git a/jjb/cord-test/voltha.yaml b/jjb/cord-test/voltha.yaml
index 7d84ef2..c461759 100644
--- a/jjb/cord-test/voltha.yaml
+++ b/jjb/cord-test/voltha.yaml
@@ -214,6 +214,33 @@
           profile: '1T8GEM'
           pipeline-script: 'voltha-dt-physical-functional-tests.groovy'
 
+
+      # Menlo pod with olt/onu - voltha-2.3  branch,  Default tech profile and timer based job
+      - 'build_voltha_pod_release':
+          build-node: 'menlo-demo-pod'
+          config-pod: 'onf-demo-pod'
+          release: '2.3'
+          branch: 'voltha-2.3'
+          name-extension: '_DT'
+          work-flow: 'DT'
+          test-repo: 'voltha-system-tests'
+          Jenkinsfile: 'Jenkinsfile-voltha-build'
+          oltDebVersion: 'openolt_asfvolt16-2.3.0-bc6e0853e0e8bf6bd7e4223d4a7ee0dd35ce634d.deb'
+          configurePod: true
+          profile: '1T8GEM'
+          time: '7'
+
+      # Menlo pod test job - uses tech profile on voltha branch
+      - 'build_voltha_pod_test':
+          build-node: 'menlo-demo-pod'
+          config-pod: 'onf-demo-pod'
+          release: '2.3'
+          branch: 'voltha-2.3'
+          name-extension: '_DT'
+          test-repo: 'voltha-system-tests'
+          profile: '1T8GEM'
+          pipeline-script: 'voltha-dt-physical-functional-tests.groovy'
+
       # Menlo DEMO-POD - 1 1TCONT 4 4GEMs TechProfile - Manual build and test job
       - 'build_pod_manual':
           build-node: 'menlo-demo-pod'
@@ -241,7 +268,7 @@
           branch: 'master'
           test-repo: 'voltha-system-tests'
           Jenkinsfile: 'Jenkinsfile-voltha-build'
-          oltDebVersion: 'openolt_asfvolt16_bal3.2.deb'
+          oltDebVersion: 'openolt_asfvolt16-2.3.0-bc6e0853e0e8bf6bd7e4223d4a7ee0dd35ce634d.deb'
           configurePod: true
           profile: 'Default'
 
@@ -262,7 +289,7 @@
           branch: 'master'
           test-repo: 'voltha-system-tests'
           Jenkinsfile: 'Jenkinsfile-voltha-build'
-          oltDebVersion: 'openolt_asfvolt16.deb'
+          oltDebVersion: 'openolt_asfvolt16-2.3.0-bc6e0853e0e8bf6bd7e4223d4a7ee0dd35ce634d.deb'
           configurePod: true
           profile: 'Default'
           time: '10'
@@ -284,7 +311,7 @@
           branch: 'voltha-2.3'
           test-repo: 'voltha-system-tests'
           Jenkinsfile: 'Jenkinsfile-voltha-build'
-          oltDebVersion: 'openolt_asfvolt16.deb'
+          oltDebVersion: 'openolt_asfvolt16-2.3.0-bc6e0853e0e8bf6bd7e4223d4a7ee0dd35ce634d.deb'
           configurePod: true
           profile: 'Default'
           time: '12'
diff --git a/jjb/pipeline/omec-postmerge.groovy b/jjb/pipeline/omec-postmerge.groovy
index abd983b..9df3600 100644
--- a/jjb/pipeline/omec-postmerge.groovy
+++ b/jjb/pipeline/omec-postmerge.groovy
@@ -21,6 +21,7 @@
 def spgwc_tag = ""
 def spgwu_tag = ""
 def abbreviated_commit_hash = ""
+def quietPeriodTime = 0
 
 pipeline {
 
@@ -65,6 +66,14 @@
             mme_tag = "${branchName}-${abbreviated_commit_hash}"
             break
           }
+          // Add quiet period to downstream job. This is to delay running the
+          // deploy staging job until midnight, so it will not interrupt any
+          // development on the staging cluster during the day.
+          def now = Math.floor((new Date()).getTime() / 1000.0) // Get current time in seconds
+          def PDTOffset = 25200                                 // PDT Offset from UTC in seconds
+          def oneDay = 86400                                    // 24 hours in seconds
+          quietPeriodTime = oneDay - (now - PDTOffset) % oneDay // number of seconds until next midnight
+          println "Quiet Period (seconds until next midnight): " + quietPeriodTime
         }
         build job: "omec-deploy-staging", parameters: [
               string(name: 'hssdb_tag', value: "${hssdb_tag}"),
@@ -72,7 +81,7 @@
               string(name: 'hss_tag', value: "${mme_tag}"),
               string(name: 'spgwc_tag', value: "${spgwc_tag}"),
               string(name: 'spgwu_tag', value: "${spgwu_tag}"),
-            ]
+            ], quietPeriod: quietPeriodTime
       }
     }
   }
diff --git a/jjb/pipeline/voltha-bbsim-tests.groovy b/jjb/pipeline/voltha-bbsim-tests.groovy
index 83ab621..7dfd54e 100644
--- a/jjb/pipeline/voltha-bbsim-tests.groovy
+++ b/jjb/pipeline/voltha-bbsim-tests.groovy
@@ -241,7 +241,8 @@
       sh '''
          set +e
          cp $WORKSPACE/voltha/kind-voltha/install-minimal.log $WORKSPACE/
-         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
+         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
+         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
          kubectl get nodes -o wide
          kubectl get pods -o wide
          kubectl get pods -n voltha -o wide
diff --git a/jjb/pipeline/voltha-dt-physical-functional-tests.groovy b/jjb/pipeline/voltha-dt-physical-functional-tests.groovy
index 455566a..61e3617 100644
--- a/jjb/pipeline/voltha-dt-physical-functional-tests.groovy
+++ b/jjb/pipeline/voltha-dt-physical-functional-tests.groovy
@@ -56,7 +56,7 @@
           )
         sh returnStdout: false, script: """
         cd voltha
-        git clone -b ${branch} ${cordRepoUrl}/cord-tester
+        git clone -b master ${cordRepoUrl}/cord-tester
         mkdir -p $WORKSPACE/bin
         bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/bin"
         cd $WORKSPACE
@@ -97,7 +97,8 @@
     always {
       sh returnStdout: false, script: '''
       set +e
-      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
+      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
+      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
       kubectl get nodes -o wide
       kubectl get pods -n voltha -o wide
 
diff --git a/jjb/pipeline/voltha-go-multi-tests.groovy b/jjb/pipeline/voltha-go-multi-tests.groovy
index f820809..b2fccfb 100644
--- a/jjb/pipeline/voltha-go-multi-tests.groovy
+++ b/jjb/pipeline/voltha-go-multi-tests.groovy
@@ -119,7 +119,8 @@
       sh '''
          set +e
          cp $HOME/kind-voltha/install-minimal.log $WORKSPACE/
-         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
+         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
+         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
          kubectl get nodes -o wide
          kubectl get pods -o wide
          kubectl get pods -n voltha -o wide
diff --git a/jjb/pipeline/voltha-go-tests.groovy b/jjb/pipeline/voltha-go-tests.groovy
index e6ed2e8..b5034ed 100644
--- a/jjb/pipeline/voltha-go-tests.groovy
+++ b/jjb/pipeline/voltha-go-tests.groovy
@@ -121,7 +121,8 @@
       sh '''
          set +e
          cp $HOME/kind-voltha/install-minimal.log $WORKSPACE/
-         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
+         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
+         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
          kubectl get nodes -o wide
          kubectl get pods -o wide
          kubectl get pods -n voltha -o wide
diff --git a/jjb/pipeline/voltha-physical-build-and-tests.groovy b/jjb/pipeline/voltha-physical-build-and-tests.groovy
index cd045c7..abc7929 100644
--- a/jjb/pipeline/voltha-physical-build-and-tests.groovy
+++ b/jjb/pipeline/voltha-physical-build-and-tests.groovy
@@ -339,7 +339,8 @@
       sh returnStdout: false, script: '''
       set +e
       cp $WORKSPACE/voltha/kind-voltha/install-minimal.log $WORKSPACE/
-      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
+      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
+      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
       kubectl get nodes -o wide
       kubectl get pods -o wide
       kubectl get pods -n voltha -o wide
diff --git a/jjb/pipeline/voltha-physical-functional-tests.groovy b/jjb/pipeline/voltha-physical-functional-tests.groovy
index 6b39bc7..9f007e7 100644
--- a/jjb/pipeline/voltha-physical-functional-tests.groovy
+++ b/jjb/pipeline/voltha-physical-functional-tests.groovy
@@ -131,7 +131,8 @@
     always {
       sh returnStdout: false, script: '''
       set +e
-      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
+      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
+      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
       kubectl get nodes -o wide
       kubectl get pods -n voltha -o wide
 
diff --git a/jjb/pipeline/voltha-scale-measurements.groovy b/jjb/pipeline/voltha-scale-measurements.groovy
index 7df33b1..9930f82 100644
--- a/jjb/pipeline/voltha-scale-measurements.groovy
+++ b/jjb/pipeline/voltha-scale-measurements.groovy
@@ -88,7 +88,7 @@
             voltctl adapter list | grep brcm_openomci_onu | wc -l
             """
 
-            return openolt_res.toInteger() == 1 && openonu_res.toInteger() == 1
+            return openolt_res.toInteger() >= 1 && openonu_res.toInteger() >= 1
           }
         }
       }
@@ -206,7 +206,8 @@
         cat ports.txt >> onos-ports-count.txt
       '''
       sh '''
-        kubectl get pods -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
+        kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
+        kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
       '''
       sh '''
         voltctl device list -o json > device-list.json
@@ -217,11 +218,11 @@
         curl -s -X GET -G http://127.0.0.1:31301/api/v1/query --data-urlencode 'query=avg(rate(container_cpu_usage_seconds_total[10m])*100) by (pod_name)' | jq . > cpu-usage.json
       '''
       sh '''
-        kubectl logs deployment/adapter-open-olt > open-olt-logs.txt
-        kubectl logs deployment/adapter-open-onu > open-onu-logs.txt
-        kubectl logs deployment/voltha-rw-core > voltha-rw-core-logs.txt
-        kubectl logs deployment/voltha-ofagent > voltha-ofagent-logs.txt
-        kubectl logs deployment/bbsim > bbsim-logs.txt
+        kubectl logs -l app=adapter-open-olt > open-olt-logs.txt
+        kubectl logs -l app=adapter-open-onu > open-onu-logs.txt
+        kubectl logs -l app=rw-core > voltha-rw-core-logs.txt
+        kubectl logs -l app=ofagent > voltha-ofagent-logs.txt
+        kubectl logs -l app=bbsim > bbsim-logs.txt
       '''
       sh '''
         rm -rf BBSM-12345123451234512345-00000000000001-v1.json device-list.json onus.txt ports.txt temp.txt
diff --git a/jjb/pipeline/voltha-system-test-bbsim.groovy b/jjb/pipeline/voltha-system-test-bbsim.groovy
index fcea75a..0455aa4 100644
--- a/jjb/pipeline/voltha-system-test-bbsim.groovy
+++ b/jjb/pipeline/voltha-system-test-bbsim.groovy
@@ -116,7 +116,8 @@
       sh '''
          set +e
          cp $WORKSPACE/kind-voltha/install-full.log $WORKSPACE/
-         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
+         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
+         kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
          kubectl get nodes -o wide
          kubectl get pods -o wide
          kubectl get pods -n voltha -o wide
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index 589cc40..1a654b1 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -80,13 +80,8 @@
           ponPorts: 16
           expectedOnus: 512
           BBSIMdelay: 200
-          # multi-adapter-tmp-changes
-          volthaImg: "matteoscandolo/voltha-rw-core:partition"
-          ofAgentImg: "voltha/voltha-ofagent-go:master"
-          openoltAdapterImg: "matteoscandolo/voltha-openolt-adapter:partition"
-          openonuAdapterImg: "matteoscandolo/voltha-openonu-adapter:partition"
-          openonuAdapterChart: "/home/cord/voltha-helm-charts/voltha-adapter-openonu"
-          extraHelmFlags: "--set use_ofagent_go=true -f /home/cord/partition-values.yaml"
+          # multi-adapter
+          extraHelmFlags: "--set replicas.adapter_open_onu=8"
       - 'voltha-scale-measurements-periodic':
           name: 'voltha-scale-measurements-periodic-16-64-200ms'
           build-node: 'onf-pod1-head-node'
@@ -95,14 +90,8 @@
           ponPorts: 16
           expectedOnus: 1024
           BBSIMdelay: 200
-          # multi-adapter-tmp-changes
-          volthaImg: "matteoscandolo/voltha-rw-core:partition"
-          ofAgentImg: "voltha/voltha-ofagent-go:master"
-          openoltAdapterImg: "matteoscandolo/voltha-openolt-adapter:partition"
-          openonuAdapterImg: "matteoscandolo/voltha-openonu-adapter:partition"
-          openonuAdapterChart: "/home/cord/voltha-helm-charts/voltha-adapter-openonu"
-          extraHelmFlags: "--set use_ofagent_go=true -f /home/cord/partition-values.yaml"
-
+          # multi-adapter
+          extraHelmFlags: "--set replicas.adapter_open_onu=8"
       - 'voltha-scale-measurements-periodic':
           name: 'voltha-scale-measurements-periodic-4-64-200ms'
           build-node: 'onf-pod1-head-node'
@@ -119,22 +108,7 @@
           ponPorts: 4
           expectedOnus: 256
           BBSIMdelay: 1000
-      - 'voltha-scale-measurements-periodic':
-          name: 'voltha-scale-measurements-periodic-4-128-200ms'
-          build-node: 'onf-pod1-head-node'
-          time-trigger: "H H/4 * * *"
-          onuPerPon: 128
-          ponPorts: 4
-          expectedOnus: 512
-          BBSIMdelay: 200
-      - 'voltha-scale-measurements-periodic':
-          name: 'voltha-scale-measurements-periodic-4-128-1000ms'
-          build-node: 'onf-pod1-head-node'
-          time-trigger: "H H/4 * * *"
-          onuPerPon: 128
-          ponPorts: 4
-          expectedOnus: 512
-          BBSIMdelay: 1000
+
       - 'voltha-scale-measurements-periodic':
           name: 'voltha-scale-measurements-periodic-1-128-200ms'
           build-node: 'onf-pod1-head-node'