Merge "[VOL-4543] Added voltha-scale-measurements-master-onu-upgrade-2-16-32-att-subscribers job"
diff --git a/jjb/pipeline/voltha/master/voltha-scale-test.groovy b/jjb/pipeline/voltha/master/voltha-scale-test.groovy
index 39c1f05..5c7ddbf 100644
--- a/jjb/pipeline/voltha/master/voltha-scale-test.groovy
+++ b/jjb/pipeline/voltha/master/voltha-scale-test.groovy
@@ -466,7 +466,7 @@
               -v withDhcp:${withDhcp} \
               -v withIgmp:${withIgmp} \
               --noncritical non-critical \
-              -e igmp -e teardown "
+              -e onu-upgrade -e igmp -e teardown "
 
             if [ ${withEapol} = false ] ; then
               ROBOT_PARAMS+="-e authentication "
@@ -485,6 +485,10 @@
               ROBOT_PARAMS+="-i setup -i activation "
             fi
 
+            if [ ${withOnuUpgrade} = true ] ; then
+              ROBOT_PARAMS+="-e flow-before "
+            fi
+
             cd $WORKSPACE/voltha-system-tests
             source ./vst_venv/bin/activate
             robot -d $WORKSPACE/RobotLogs \
@@ -496,6 +500,71 @@
         }
       }
     }
+    stage('Run ONU Upgrade Tests') {
+      environment {
+        ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/OnuUpgradeTests"
+      }
+      when {
+        expression {
+          return params.withOnuUpgrade
+        }
+      }
+      options {
+          timeout(time: 20, unit: 'MINUTES')
+      }
+      steps {
+        sh '''
+          set +e
+          mkdir -p $ROBOT_LOGS_DIR
+          cd $WORKSPACE/voltha-system-tests
+          make vst_venv
+        '''
+        script {
+          Exception caughtException = null
+
+          catchError(buildResult: 'SUCCESS', stageResult: 'ABORTED') {
+            try {
+              sh '''
+                ROBOT_PARAMS="--exitonfailure \
+                  -v olt:${olts} \
+                  -v pon:${pons} \
+                  -v onu:${onus} \
+                  -v workflow:${workflow} \
+                  -v withEapol:${withEapol} \
+                  -v withDhcp:${withDhcp} \
+                  -v withIgmp:${withIgmp} \
+                  -v image_version:BBSM_IMG_00002 \
+                  -v image_url:http://bbsim0:50074/images/software-image.img \
+                  -v image_vendor:BBSM \
+                  -v image_activate_on_success:false \
+                  -v image_commit_on_success:false \
+                  -v image_crc:0 \
+                  -v ONOS_SSH_PORT:30115 \
+                  -v ONOS_REST_PORT:30120 \
+                  --noncritical non-critical \
+                  -i onu-upgrade \
+                  -e setup -e activation -e flow-before \
+                  -e authentication -e provision -e flow-after \
+                  -e dhcp -e igmp -e teardown "
+                cd $WORKSPACE/voltha-system-tests
+                source ./vst_venv/bin/activate
+                robot -d $ROBOT_LOGS_DIR \
+                $ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
+              '''
+            } catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
+              // if the error is a timeout don't mark the build as failed
+              println "ONU Upgrade test timed out"
+            } catch (Throwable e) {
+              caughtException = e
+            }
+          }
+
+          if (caughtException) {
+            error caughtException.message
+          }
+        }
+      }
+    }
     stage('Run Igmp Tests') {
       environment {
         ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/IgmpTests"
@@ -538,7 +607,7 @@
                   -i igmp \
                   -e setup -e activation -e flow-before \
                   -e authentication -e provision -e flow-after \
-                  -e dhcp -e teardown "
+                  -e dhcp -e onu-upgrade -e teardown "
                 cd $WORKSPACE/voltha-system-tests
                 source ./vst_venv/bin/activate
                 robot -d $ROBOT_LOGS_DIR \
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index 6a2d68f..fbd01a2 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -66,6 +66,22 @@
           extraHelmFlags: '--set authRetry=false,dhcpRetry=false -f /home/jenkins/voltha-scale/voltha-values.yaml --set etcd.persistence.enabled=true,etcd.persistence.storageClass=longhorn'
 
       - 'voltha-scale-measurements':
+          name: 'voltha-scale-measurements-master-onu-upgrade-2-16-32-att-subscribers'
+          'disable-job': false
+          build-node: 'voltha-scale-1'
+          time-trigger: "H H/12 * * *"
+          olts: 2
+          pons: 16
+          onus: 32
+          withOnuUpgrade: true
+          withFlows: true
+          provisionSubscribers: false
+          withEapol: false
+          withDhcp: false
+          withIgmp: false
+          extraHelmFlags: '--set authRetry=false,dhcpRetry=false -f /home/jenkins/voltha-scale/voltha-values.yaml --set etcd.persistence.enabled=true,etcd.persistence.storageClass=longhorn'
+
+      - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-2-16-32-dt-subscribers'
           'disable-job': false
           build-node: 'voltha-scale-1'
@@ -124,7 +140,7 @@
 
       - 'voltha-scale-measurements':
             name: 'voltha-scale-measurements-master-1-64-63-dt-subscribers'
-            'disable-job': false
+            'disable-job': true
             build-node: 'voltha-scale-1'
             time-trigger: "H H/4 * * *"
             olts: 1
@@ -495,34 +511,39 @@
           description: 'Which workflow are we testing (att, dt, tt)'
 
       - bool:
+          name: withOnuUpgrade
+          default: '{withOnuUpgrade}'
+          description: 'Whether to run the ONU Upgrade test'
+
+      - bool:
           name: withFlows
           default: '{withFlows}'
-          description: 'Wheter to push flows from ONOS'
+          description: 'Whether to push flows from ONOS'
 
       - bool:
           name: provisionSubscribers
           default: '{provisionSubscribers}'
-          description: 'Wheter to provision subscribers durint the tests'
+          description: 'Whether to provision subscribers during the tests'
 
       - bool:
           name: withEapol
           default: '{withEapol}'
-          description: 'Wheter EAPOL is enabled for the test'
+          description: 'Whether EAPOL is enabled for the test'
 
       - bool:
           name: withDhcp
           default: '{withDhcp}'
-          description: 'Wheter DHCP is enabled for the test'
+          description: 'Whether DHCP is enabled for the test'
 
       - bool:
           name: withIgmp
           default: '{withIgmp}'
-          description: 'Wheter IGMP is enabled for the test'
+          description: 'Whether IGMP is enabled for the test'
 
       - bool:
           name: withLLDP
           default: '{withLLDP}'
-          description: 'Wheter Link Discovery is enabled for the test'
+          description: 'Whether Link Discovery is enabled for the test'
 
       - bool:
           name: withMonitoring
@@ -698,6 +719,7 @@
     pons: 2
     onus: 2
     workflow: att
+    withOnuUpgrade: false
     withFlows: false
     provisionSubscribers: false
     withEapol: true
@@ -803,6 +825,7 @@
     pons: 2
     onus: 2
     workflow: att
+    withOnuUpgrade: false
     withFlows: true
     provisionSubscribers: true
     withEapol: true