Adding parameter to define topologies size in scale-matrix test

Change-Id: Ic2f05bd3c0890092da727a061e714fdb4518bba6
diff --git a/jjb/pipeline/voltha-scale-matrix.groovy b/jjb/pipeline/voltha-scale-matrix.groovy
index 7a8b4a2..8d35c2b 100644
--- a/jjb/pipeline/voltha-scale-matrix.groovy
+++ b/jjb/pipeline/voltha-scale-matrix.groovy
@@ -12,12 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-topologies = [
-  ['olt': 1, 'onu': 1, 'pon': 1],
-  ['olt': 1, 'onu': 2, 'pon': 1],
-  ['olt': 1, 'onu': 2, 'pon': 2],
-]
-
 pipeline {
 
   agent {
@@ -62,6 +56,31 @@
   }
 
   stages {
+    stage ('Parse parameters') {
+      steps {
+        script {
+          format = "format is 'olt-pon-onu' separated bya comma, eg: '1-16-16, 1-16-32, 2-16-32'"
+          source = params.topologies
+
+          if (source == null || source == "") {
+            throw new Exception("You need to specify some deployment topologies, " + format)
+          }
+
+          topologies = []
+
+          for(topo in source.split(",")) {
+            t = topo.split("-")
+            topologies.add(['olt': t[0].trim(), 'pon': t[1].trim(), 'onu': t[2].trim()])
+          }
+
+          if (topologies.size() == 0) {
+            throw new Exception("Not enough topologies defined, " + format)
+          }
+          println "Deploying topologies:"
+          println topologies
+        }
+      }
+    }
     stage ('Cleanup') {
       steps {
         timeout(time: 10, unit: 'MINUTES') {
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index ad3c6e8..23dec7e 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -289,6 +289,7 @@
       - 'voltha-scale-matrix':
           name: 'voltha-scale-matrix-voltha-master-dev'
           build-node: 'voltha-scale'
+          time-trigger: H 0 * * * #
 
       # development matrix
       - 'voltha-scale-matrix':
@@ -298,6 +299,7 @@
           atomixReplicas: 3
           kafkaReplicas: 3
           etcdReplicas: 3
+          topologies: 1-16-16, 1-16-32, 2-16-32
 
 # list of parameters for the VOLTHA Jobs,
 # used as anchor so that can be shared across multiple jobs
@@ -728,6 +730,7 @@
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
     # default values
+    time-trigger: 0 0 29 2 *
     release: master
     build-node: 'voltha-scale'
     volthaSystemTestsChange: ''
@@ -736,6 +739,7 @@
     atomixReplicas: 0
     kafkaReplicas: 1
     etcdReplicas: 1
+    topologies: 1-1-1, 1-2-2, 2-2-2
 
     project-type: pipeline
     concurrent: false
@@ -782,3 +786,13 @@
           name: etcdReplicas
           default: '{etcdReplicas}'
           description: 'How many ETCD instances to run'
+
+      - string:
+          name: topologies
+          default: '{topologies}'
+          description: 'Topologies configuration, comma separate list of "olt-pon-onu" eg: "1-16-16, 1-16-32"'
+
+    triggers:
+      - timed: |
+                 TZ=America/Los_Angeles
+                 {time-trigger}