[VOL-3632] Creation of bbsim based job for multiple olts

Change-Id: I0d9a2bfd1b1d90c3e7580b7d21849702c459a2ce
diff --git a/jjb/pipeline/voltha-nightly-tests-bbsim.groovy b/jjb/pipeline/voltha-nightly-tests-bbsim.groovy
index 73346b9..606ebcc 100644
--- a/jjb/pipeline/voltha-nightly-tests-bbsim.groovy
+++ b/jjb/pipeline/voltha-nightly-tests-bbsim.groovy
@@ -41,6 +41,7 @@
     ROBOT_MISC_ARGS="-e PowerSwitch ${params.extraRobotArgs}"
     KARAF_HOME="${params.karafHome}"
     DIAGS_PROFILE="VOLTHA_PROFILE"
+    NUM_OF_BBSIM="${olts}"
   }
   stages {
     stage('Clone kind-voltha') {
@@ -118,7 +119,7 @@
            ./log-combine.sh > /dev/null &
 
            export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
-           make -C $WORKSPACE/voltha-system-tests functional-single-kind || true
+           make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true
            '''
       }
     }
@@ -127,13 +128,18 @@
       environment {
         ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/AlarmTests"
       }
+      when {
+        expression {
+          return params.withAlarms
+        }
+      }
       steps {
         sh '''
            set +e
            mkdir -p $WORKSPACE/RobotLogs
 
            export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
-           make -C $WORKSPACE/voltha-system-tests bbsim-alarms-kind || true
+           make -C $WORKSPACE/voltha-system-tests ${makeAlarmtestTarget} || true
            '''
       }
     }
@@ -148,7 +154,7 @@
            mkdir -p $WORKSPACE/RobotLogs
 
            export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
-           make -C $WORKSPACE/voltha-system-tests bbsim-failurescenarios || true
+           make -C $WORKSPACE/voltha-system-tests ${makeFailtestTarget} || true
            '''
       }
     }
@@ -163,7 +169,7 @@
            mkdir -p $WORKSPACE/RobotLogs
 
            export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
-           make -C $WORKSPACE/voltha-system-tests bbsim-errorscenarios || true
+           make -C $WORKSPACE/voltha-system-tests ${makeErrortestTarget} || true
            '''
       }
     }
diff --git a/jjb/voltha-e2e.yaml b/jjb/voltha-e2e.yaml
index 0f2bfdd..4420fd6 100644
--- a/jjb/voltha-e2e.yaml
+++ b/jjb/voltha-e2e.yaml
@@ -6,6 +6,11 @@
 
     project-name: '{name}'
     manualBranch: ''
+    olts: 1
+    withAlarms: true
+    make-target-failtest: bbsim-failurescenarios
+    make-target-errortest: bbsim-errorscenarios
+    make-target-alarmtest: bbsim-alarms-kind
 
     jobs:
       - 'voltha-periodic-test':
@@ -13,7 +18,27 @@
           pipeline-script: 'voltha-nightly-tests-bbsim.groovy'
           build-node: 'qct-pod4-node2'
           make-target: functional-single-kind
+          make-target-failtest: bbsim-failurescenarios
+          make-target-errortest: bbsim-errorscenarios
+          make-target-alarmtest: bbsim-alarms-kind
+          withAlarms: true
           code-branch: 'master'
+          olts: 1
+          onus: 2
+          pons: 2
+          time-trigger: "H H/12 * * *"
+
+      - 'voltha-periodic-test':
+          name: 'periodic-voltha-multiple-olts-test-bbsim'
+          pipeline-script: 'voltha-nightly-tests-bbsim.groovy'
+          build-node: 'qct-pod4-node2'
+          make-target: functional-multi-olt
+          make-target-failtest: bbsim-multi-olt-failurescenarios
+          make-target-errortest: bbsim-multi-olt-errorscenarios
+          make-target-alarmtest: bbsim-alarms-kind
+          withAlarms: false
+          code-branch: 'master'
+          olts: 2
           onus: 2
           pons: 2
           time-trigger: "H H/12 * * *"
@@ -22,6 +47,10 @@
           name: 'periodic-voltha-test-bbsim-openonugo'
           pipeline-script: 'voltha-nightly-tests-bbsim.groovy'
           build-node: 'qct-pod4-node2'
+          make-target-failtest: bbsim-failurescenarios
+          make-target-errortest: bbsim-errorscenarios
+          make-target-alarmtest: bbsim-alarms-kind
+          withAlarms: true
           make-target: functional-single-kind
           code-branch: 'master'
           work-flow: 'DT'
@@ -35,6 +64,10 @@
           pipeline-script: 'voltha-nightly-tests-bbsim.groovy'
           build-node: 'qct-pod4-node2'
           make-target: functional-single-kind
+          make-target-failtest: bbsim-failurescenarios
+          make-target-errortest: bbsim-errorscenarios
+          make-target-alarmtest: bbsim-alarms-kind
+          withAlarms: true
           code-branch: 'voltha-2.5'
           onus: 2
           pons: 2
@@ -151,6 +184,7 @@
     kindVolthaChange: ''
     extraHelmFlags: ''
     sandbox: true
+    olts: 1
 
     description: |
       <!-- Managed by Jenkins Job Builder -->
@@ -178,12 +212,32 @@
           default: '--set onu={onus},pon={pons},{extraHelmFlags}'
           description: 'Helm flags to pass to ./voltha up'
 
+      - bool:
+          name: withAlarms
+          default: false
+          description: "Run alarm based tests when true"
+
       - string:
           name: makeTarget
           default: '{make-target}'
           description: 'Makefile target to invoke during test'
 
       - string:
+          name: makeFailtestTarget
+          default: '{make-target-failtest}'
+          description: 'Makefile target to invoke during failure/based test'
+
+      - string:
+          name: makeErrortestTarget
+          default: '{make-target-errortest}'
+          description: 'Makefile target to invoke during error test'
+
+      - string:
+          name: makeAlarmtestTarget
+          default: '{make-target-alarmtest}'
+          description: 'Makefile target to invoke during alarm test'
+
+      - string:
           name: manifestUrl
           default: '{gerrit-server-url}/{voltha-test-manifest-repo}'
           description: 'Repo manifest URL for code checkout'
@@ -238,6 +292,11 @@
           default: '{kindVolthaChange}'
           description: 'Download a change for gerrit in the kind-voltha repo, example value: "refs/changes/32/19132/1"'
 
+      - string:
+          name: olts
+          default: '{olts}'
+          description: 'How many BBSim instances to run'
+
     project-type: pipeline
     concurrent: true