Merge "[VOL-3944] Migration of missing berlin pod jobs to voltha-2.7"
diff --git a/jjb/pipeline/voltha/master/software-upgrades.groovy b/jjb/pipeline/voltha/master/software-upgrades.groovy
index 7802907..f10ee9f 100644
--- a/jjb/pipeline/voltha/master/software-upgrades.groovy
+++ b/jjb/pipeline/voltha/master/software-upgrades.groovy
@@ -48,6 +48,7 @@
       volthaDeploy([workflow: "att", extraHelmFlags: extraHelmFlags, localCharts: localCharts])
       // start logging
       sh """
+      rm -rf $WORKSPACE/${name} || true
       mkdir -p $WORKSPACE/${name}
       _TAG=kail-${name} kail -n infra -n voltha > $WORKSPACE/${name}/onos-voltha-combined.log &
       """
@@ -109,6 +110,10 @@
           export ROBOT_MISC_ARGS="-d \$ROBOT_LOGS_DIR -v voltha_comps_under_test:\$VOLTHA_COMPS_UNDER_TEST -e PowerSwitch"
           export TARGET=voltha-comp-upgrade-test
         fi
+        if [[ ${name} == 'onu-software-upgrade' ]]; then
+          export ROBOT_MISC_ARGS="-d \$ROBOT_LOGS_DIR -v onu_image_name:${onuImageName.trim()} -v onu_image_url:${onuImageUrl.trim()} -v onu_image_version:${onuImageVersion.trim()} -v onu_image_crc:${onuImageCrc.trim()} -v onu_image_local_dir:${onuImageLocalDir.trim()} -e PowerSwitch"
+          export TARGET=onu-upgrade-test
+        fi
         export VOLTCONFIG=$HOME/.volt/config-minimal
         export KUBECONFIG=$HOME/.kube/kind-config-voltha-minimal
         # Run the specified tests
@@ -137,8 +142,7 @@
 def get_pods_info(dest) {
   // collect pod details, this is here in case of failure
   sh """
-  rm -rf ${dest} || true
-  mkdir -p ${dest}
+  mkdir -p ${dest} || true
   kubectl get pods --all-namespaces -o wide > ${dest}/pods.txt || true
   kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee ${dest}/pod-images.txt || true
   kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee ${dest}/pod-imagesId.txt || true
@@ -157,7 +161,7 @@
     label "${params.buildNode}"
   }
   options {
-    timeout(time: 30, unit: 'MINUTES')
+    timeout(time: 40, unit: 'MINUTES')
   }
   environment {
     PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
@@ -174,10 +178,36 @@
         ])
       }
     }
+    stage('Cleanup') {
+      steps {
+        // remove port-forwarding
+        sh """
+          # remove orphaned port-forward from different namespaces
+          ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9
+        """
+        helmTeardown(['infra', 'voltha'])
+      }
+    }
+    stage('Install latest voltctl') {
+      steps {
+        sh """
+          # install voltctl
+          HOSTOS="\$(uname -s | tr "[:upper:]" "[:lower:"])"
+          HOSTARCH="\$(uname -m | tr "[:upper:]" "[:lower:"])"
+          if [ "\$HOSTARCH" == "x86_64" ]; then
+              HOSTARCH="amd64"
+          fi
+          VC_VERSION="\$(curl --fail -sSL https://api.github.com/repos/opencord/voltctl/releases/latest | jq -r .tag_name | sed -e 's/^v//g')"
+          curl -Lo $WORKSPACE/bin/voltctl https://github.com/opencord/voltctl/releases/download/v\$VC_VERSION/voltctl-\$VC_VERSION-\$HOSTOS-\$HOSTARCH
+          chmod +x $WORKSPACE/bin/voltctl
+        """
+      }
+    }
     stage('Run Test') {
       steps {
         test_software_upgrade("onos-app-upgrade")
         test_software_upgrade("voltha-component-upgrade")
+        test_software_upgrade("onu-software-upgrade")
       }
     }
   }
@@ -192,6 +222,7 @@
       sh '''
       gzip $WORKSPACE/onos-app-upgrade/onos-voltha-combined.log || true
       gzip $WORKSPACE/voltha-component-upgrade/onos-voltha-combined.log || true
+      gzip $WORKSPACE/onu-software-upgrade/onos-voltha-combined.log || true
       '''
       step([$class: 'RobotPublisher',
          disableArchiveOutput: false,
diff --git a/jjb/software-upgrades.yaml b/jjb/software-upgrades.yaml
index b887912..b06a377 100644
--- a/jjb/software-upgrades.yaml
+++ b/jjb/software-upgrades.yaml
@@ -26,10 +26,15 @@
           mcast-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/mcast-app/2.2.0-SNAPSHOT/mcast-app-2.2.0-20210316.083454-5.oar'
           kafka-version: '2.6.0.SNAPSHOT'
           kafka-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/kafka/2.6.0-SNAPSHOT/kafka-2.6.0-20210311.093145-2.oar'
-          adapter-open-olt-image: 'voltha/voltha-openolt-adapter:3.1.6'
+          adapter-open-olt-image: 'voltha/voltha-openolt-adapter:3.2.0'
           adapter-open-onu-image: 'voltha/voltha-openonu-adapter-go:1.2.6'
-          rw-core-image: 'voltha/voltha-rw-core:2.6.3'
+          rw-core-image: 'voltha/voltha-rw-core:2.7.0'
           ofagent-image: 'voltha/voltha-ofagent-go:1.5.2'
+          onu-image-name: 'software-image.img'
+          onu-image-url: 'http://bbsim0:50074/images'
+          onu-image-version: 'v1.0.0'
+          onu-image-crc: '0'
+          onu-image-local-dir: '/tmp'
           time-trigger: "H H/23 * * *"
 
 - job-template:
@@ -181,6 +186,31 @@
           default: '{ofagent-image}'
           description: 'Voltha Ofagent Component Image'
 
+      - string:
+          name: onuImageName
+          default: '{onu-image-name}'
+          description: 'Name of ONU Image to Upgrade'
+
+      - string:
+          name: onuImageUrl
+          default: '{onu-image-url}'
+          description: 'Url of ONU Image to Upgrade'
+
+      - string:
+          name: onuImageVersion
+          default: '{onu-image-version}'
+          description: 'Version of ONU Image to Upgrade'
+
+      - string:
+          name: onuImageCrc
+          default: '{onu-image-crc}'
+          description: 'CRC of ONU Image to Upgrade'
+
+      - string:
+          name: onuImageLocalDir
+          default: '{onu-image-local-dir}'
+          description: 'Local Dir of ONU Image to Upgrade'
+
     project-type: pipeline
     concurrent: true
 
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index 5ad2686..fe5f46f 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -189,8 +189,9 @@
           withEapol: true
           withDhcp: true
           withIgmp: false
-          extraHelmFlags: '--set authRetry=true,dhcpRetry=true'
-#          onosImg: andreacampanella/voltha-onos:olt-mac-integration
+          extraHelmFlags: '--set authRetry=true,dhcpRetry=true --set global.log_correlation.enabled=true'
+          onosImg: registry.menlo.onlab.us/voltha-dev/voltha-onos:default-tp
+          volthaHelmChartsChange: refs/changes/29/23729/3
 
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-2-16-32-dt-subscribers'
diff --git a/vars/createKubernetesCluster.groovy b/vars/createKubernetesCluster.groovy
index f640b16..48a0bea 100644
--- a/vars/createKubernetesCluster.groovy
+++ b/vars/createKubernetesCluster.groovy
@@ -41,7 +41,8 @@
       if [ "\$HOSTARCH" == "x86_64" ]; then
           HOSTARCH="amd64"
       fi
-      curl -Lo $WORKSPACE/bin/voltctl https://github.com/opencord/voltctl/releases/download/v1.3.1/voltctl-1.3.1-\$HOSTOS-\$HOSTARCH
+      VC_VERSION="\$(curl --fail -sSL https://api.github.com/repos/opencord/voltctl/releases/latest | jq -r .tag_name | sed -e 's/^v//g')"
+      curl -Lo $WORKSPACE/bin/voltctl https://github.com/opencord/voltctl/releases/download/v\$VC_VERSION/voltctl-\$VC_VERSION-\$HOSTOS-\$HOSTARCH
       chmod +x $WORKSPACE/bin/voltctl
 
       # start the kind cluster