Adding timeout in voltha scale multi stack jobs

Change-Id: I1180d7e00366be0d22b0b51307f5902b155cac6d
diff --git a/jjb/pipeline/voltha/master/voltha-scale-multi-stack-experimental.groovy b/jjb/pipeline/voltha/master/voltha-scale-multi-stack-experimental.groovy
index b5b70fb..723ee08 100644
--- a/jjb/pipeline/voltha/master/voltha-scale-multi-stack-experimental.groovy
+++ b/jjb/pipeline/voltha/master/voltha-scale-multi-stack-experimental.groovy
@@ -72,6 +72,14 @@
             helmTeardown(namespaces)
           }
           sh returnStdout: false, script: """
+            # remove all persistent volume claims
+            kubectl delete pvc --all-namespaces --all
+            PVCS=\$(kubectl get pvc --all-namespaces} --no-headers | wc -l)
+            while [[ \$PVCS != 0 ]]; do
+              sleep 5
+              PVCS=\$(kubectl get pvc --all-namespaces} --no-headers | wc -l)
+            done
+
             helm repo add onf https://charts.opencord.org
             helm repo add cord https://charts.opencord.org
             helm repo update
@@ -388,44 +396,46 @@
 
 def deploy_voltha_stacks(numberOfStacks) {
   for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
-    stage("Deploy VOLTHA stack " + i) {
-      def extraHelmFlags = "${params.extraHelmFlags} --set global.log_level=${logLevel},enablePerf=true,onu=${onus},pon=${pons} "
-      extraHelmFlags += " --set securityContext.enabled=false "
+    timeout(time: 10, unit: 'MINUTES') {
+      stage("Deploy VOLTHA stack " + i) {
+        def extraHelmFlags = "${params.extraHelmFlags} --set global.log_level=${logLevel},enablePerf=true,onu=${onus},pon=${pons} "
+        extraHelmFlags += " --set securityContext.enabled=false "
 
-      // temporary for Redis patch
-      extraHelmFlags += " -f $WORKSPACE/voltha-helm-charts/voltha-stack/values-redis.yaml "
+        // temporary for Redis patch
+        extraHelmFlags += " -f $WORKSPACE/voltha-helm-charts/voltha-stack/values-redis.yaml "
 
-      // override BBSim to use the public one
-      extraHelmFlags += " --set images.bbsim.repository=voltha/bbsim,images.bbsim.tag=master "
+        // override BBSim to use the public one
+        extraHelmFlags += " --set images.bbsim.repository=voltha/bbsim,images.bbsim.tag=master "
 
-      def volthaHelmFlags = extraHelmFlags +
-        ofAgentConnections(onosReplicas.toInteger(), "voltha-infra", "infra")
+        def volthaHelmFlags = extraHelmFlags +
+          ofAgentConnections(onosReplicas.toInteger(), "voltha-infra", "infra")
 
-      volthaHelmFlags += " --set voltha.ingress.enabled=true --set voltha.ingress.enableVirtualHosts=true --set voltha.fullHostnameOverride=voltha${i}.scale2.dev "
+        volthaHelmFlags += " --set voltha.ingress.enabled=true --set voltha.ingress.enableVirtualHosts=true --set voltha.fullHostnameOverride=voltha${i}.scale2.dev "
 
-      def localCharts = false
-      if (volthaHelmChartsChange != "") {
-        localCharts = true
+        def localCharts = false
+        if (volthaHelmChartsChange != "") {
+          localCharts = true
+        }
+
+        volthaStackDeploy([
+          bbsimReplica: olts.toInteger(),
+          infraNamespace: "infra",
+          volthaNamespace: "voltha${i}",
+          stackName: "voltha${i}",
+          stackId: i,
+          workflow: workflow,
+          extraHelmFlags: volthaHelmFlags,
+          localCharts: localCharts,
+        ])
       }
-
-      volthaStackDeploy([
-        bbsimReplica: olts.toInteger(),
-        infraNamespace: "infra",
-        volthaNamespace: "voltha${i}",
-        stackName: "voltha${i}",
-        stackId: i,
-        workflow: workflow,
-        extraHelmFlags: volthaHelmFlags,
-        localCharts: localCharts,
-      ])
     }
   }
 }
 
 def test_voltha_stacks(numberOfStacks) {
   for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
-    stage("Test VOLTHA stack " + i) {
-      timeout(time: 15, unit: 'MINUTES') {
+    timeout(time: 15, unit: 'MINUTES') {
+      stage("Test VOLTHA stack " + i) {
         sh """
 
         # we are restarting the voltha-api port-forward for each stack, no need to have a different voltconfig file
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index 880c9db..3c4c5f4 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -37,19 +37,18 @@
           time-trigger: "H 0 29 2 *"
           withMonitoring: true
           logLevel: WARN
-          volthaStacks: 2
+          volthaStacks: 10
           olts: 2
-          pons: 2
-          onus: 2
+          pons: 16
+          onus: 32
           withFlows: true
           provisionSubscribers: true
           workflow: dt
           withEapol: false
           withDhcp: false
           withIgmp: false
-          volthaHelmChartsChange: "refs/changes/04/23104/1"
-          volthaSystemTestsChange: "refs/changes/31/25131/4"
-          # extraHelmFlags: "-f voltha-stack/values-redis.yaml "
+          volthaHelmChartsChange: "refs/changes/04/23104/4"
+          extraHelmFlags: " --set global.image_org=matteoscandolo/,global.image_tag=redis "
 
       # jobs for 1024 ONUs with openonu-go and clustered ONOS (2 OLTs)
       - 'voltha-scale-measurements':
@@ -114,7 +113,7 @@
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-10-stacks-2-16-32-att-subscribers'
           build-node: 'voltha-scale-2'
-          'disable-job': false
+          'disable-job': true
           pipeline-script: 'voltha/master/voltha-scale-multi-stack.groovy'
           time-trigger: "H H/4 * * *"
           withMonitoring: false
@@ -134,7 +133,7 @@
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-10-stacks-2-16-32-dt-subscribers'
           build-node: 'voltha-scale-2'
-          'disable-job': false
+          'disable-job': true
           pipeline-script: 'voltha/master/voltha-scale-multi-stack.groovy'
           time-trigger: "H H/4 * * *"
           withMonitoring: false
@@ -154,7 +153,7 @@
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-10-stacks-2-16-32-tt-subscribers'
           build-node: 'voltha-scale-2'
-          'disable-job': false
+          'disable-job': true
           pipeline-script: 'voltha/master/voltha-scale-multi-stack.groovy'
           time-trigger: "H H/4 * * *"
           withMonitoring: false
diff --git a/vars/helmTeardown.groovy b/vars/helmTeardown.groovy
index 71fd263..6070fca 100644
--- a/vars/helmTeardown.groovy
+++ b/vars/helmTeardown.groovy
@@ -22,8 +22,8 @@
         set +x
         PODS=\$(kubectl get pods -n ${n} --no-headers | wc -l)
         while [[ \$PODS != 0 ]]; do
-        sleep 5
-        PODS=\$(kubectl get pods -n ${n} --no-headers | wc -l)
+          sleep 5
+          PODS=\$(kubectl get pods -n ${n} --no-headers | wc -l)
         done
         """
     }