Customizable timeout for scale test operations

Change-Id: Ic9839c2cf0d7f562db2ea025002cb105ffa75fde
diff --git a/jjb/pipeline/voltha/master/voltha-scale-test.groovy b/jjb/pipeline/voltha/master/voltha-scale-test.groovy
index 6ec2fe3..f89349c 100644
--- a/jjb/pipeline/voltha/master/voltha-scale-test.groovy
+++ b/jjb/pipeline/voltha/master/voltha-scale-test.groovy
@@ -453,7 +453,7 @@
             _TAG=$_TAG bash $WORKSPACE/pprof.sh &
           fi
         '''
-        timeout(time: 15, unit: 'MINUTES') {
+        timeout(time: "${testTimeout.toInteger() + 5}", unit: 'MINUTES') {
           sh '''
             ROBOT_PARAMS="--exitonfailure \
               -v olt:${olts} \
@@ -465,6 +465,7 @@
               -v withEapol:${withEapol} \
               -v withDhcp:${withDhcp} \
               -v withIgmp:${withIgmp} \
+              -v timeout:${testTimeout}m \
               -v withMaclearning:${withMaclearning} \
               --noncritical non-critical \
               -e onu-upgrade -e igmp -e teardown "
@@ -511,7 +512,7 @@
         }
       }
       options {
-          timeout(time: 11, unit: 'MINUTES')
+          timeout(time: "${testTimeout.toInteger() + 1}", unit: 'MINUTES')
       }
       steps {
         sh '''
@@ -534,6 +535,7 @@
                   -v withEapol:${withEapol} \
                   -v withDhcp:${withDhcp} \
                   -v withIgmp:${withIgmp} \
+                  -v timeout:${testTimeout}m \
                   -v withMaclearning:${withMaclearning}
                   -v image_version:BBSM_IMG_00002 \
                   -v image_url:http://bbsim0:50074/images/software-image.img \
@@ -577,7 +579,7 @@
         }
       }
       options {
-          timeout(time: 11, unit: 'MINUTES')
+          timeout(time: "${testTimeout.toInteger() + 1}", unit: 'MINUTES')
       }
       steps {
         sh returnStdout: false, script: """
@@ -603,6 +605,7 @@
                   -v withEapol:${withEapol} \
                   -v withDhcp:${withDhcp} \
                   -v withIgmp:${withIgmp} \
+                  -v timeout:${testTimeout}m \
                   -v withMaclearning:${withMaclearning}
                   -v ONOS_SSH_PORT:30115 \
                   -v ONOS_REST_PORT:30120 \
@@ -632,7 +635,7 @@
     }
     stage("Device removal") {
       options {
-          timeout(time: 15, unit: 'MINUTES')
+          timeout(time: "${testTimeout.toInteger() + 5}", unit: 'MINUTES')
       }
       steps {
         sh '''
@@ -657,6 +660,7 @@
                   -v withEapol:${withEapol} \
                   -v withDhcp:${withDhcp} \
                   -v withIgmp:${withIgmp} \
+                  -v timeout:${testTimeout}m \
                   -v withMaclearning:${withMaclearning} \
                   --noncritical non-critical \
                   -i teardown"
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index 43e2185..205ae5e 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -134,6 +134,7 @@
           withDhcp: true
           withIgmp: true
           withMaclearning: true
+          testTimeout: 20
           onosReplicas: 3
           atomixReplicas: 3
           extraHelmFlags: >
@@ -712,6 +713,11 @@
           default: '{karafHome}'
           description: 'Karaf home'
 
+      - string:
+          name: testTimeout
+          default: '{testTimeout}'
+          description: 'How long the scale test can run for in minutes, e.g 10, 15'
+
       # remove once voltha-2.6 is deprecated
       - string:
           name: kindVolthaChange
@@ -794,6 +800,7 @@
     withMibTemplate: true
     karafHome: 'apache-karaf-4.2.14'
     logLevel: 'INFO'
+    testTimeout: 10
     dockerRegistry: 10.90.0.101:30500
     trigger-comment: vv7CBoQQYYonvaN8xcru
     time-trigger: 0 0 29 2 *
@@ -901,6 +908,7 @@
     withMibTemplate: true
     karafHome: 'apache-karaf-4.2.14'
     logLevel: 'INFO'
+    testTimeout: 10
     dockerRegistry: 10.90.0.69:30500
 
     <<: *voltha-scale-job-parameters