[ONOS-7994](JJB):Combine TestON Pipeline Scripts Containing Similar Code

Change-Id: Ief2b0c61125cf9fbad02806fd3988f97b3ba7c92
diff --git a/jjb/OnosSystemTest/onos-test-pipeline.yaml b/jjb/OnosSystemTest/onos-test-pipeline.yaml
index d1486fb..704125c 100644
--- a/jjb/OnosSystemTest/onos-test-pipeline.yaml
+++ b/jjb/OnosSystemTest/onos-test-pipeline.yaml
@@ -55,54 +55,10 @@
       - 'SRHA'
 
 - job-template:
-    name: all-pipeline-trigger
+    name: 'master-trigger'
     description: |
                   <!-- Managed by Jenkins Job Builder -->
-                  all-pipeline-trigger can trigger any TestON test on any branch of ONOS and TestON, by running the test category pipeline that contains the test. <br />
-                  This pipeline is triggered by timer for the nightly builds. <br />
-                  Created by Devin Lim - devin@opennetworking.org<br />
-                  Copyright (c) 2017 Open Networking Foundation (ONF)
-
-    <<: *test-pipe-job-boiler-plate
-
-    parameters:
-
-      - bool:
-         name: manual_run
-         default: false
-         description: |
-                       Check this option if you are manually running this job (you most likely are). <br />
-
-      - text:
-         name: machines
-         default: |
-                   vm
-                   bm
-                   fabric
-         description: 'Specify the machine-trigger you want to run.'
-
-      - lf-infra-parameters:
-         project: 'OnosSystemTest'
-         branch: 'master'
-         stream: 'master'
-         lftools-version: '<1.0.0'
-
-    concurrent: true
-
-    pipeline-scm:
-      script-path: '{jenkins-path}/JenkinsfileTrigger'
-      scm:
-        - git:
-           url: '{gitURL}'
-           branches:
-             - 'master'
-
-- job-template:
-    name: '{machine}-pipeline-trigger'
-    id: pipeline-trigger
-    description: |
-                  <!-- Managed by Jenkins Job Builder -->
-                  {machine}-pipeline-trigger can trigger Segment Routing TestON test on any branch of ONOS and TestON, by running the test category pipeline that contains the test. <br />
+                  master-trigger can trigger TestON tests on any branches of ONOS and TestON, by running the test category pipeline that contains the test. <br />
                   This pipeline is triggered by timer for the nightly builds. <br />
                   You may manually trigger this pipeline as well - provide the tests to run and the branch of ONOS and TestON. <br /> <br />
                   Note: <i>The console output for this job does <b>not</b> contain any test result logs.</i><br />
@@ -118,8 +74,16 @@
          name: manual_run
          default: false
          description: |
-                       Check this option if you are manually running this job (you most likely are). <br />
-                       You must specify which tests to run in the text field below.
+                       Check this option if you are manually running this job. <br />
+                       You must specify which tests to run in the text field below. <br />
+                       Leave this unchecked if simulating a nightly test run.
+
+      - string:
+         name: simulate_day
+         default: ""
+         description: |
+                       Enter a day prefix (first 3 letters of a day, lowercase) to simulate running a nightly test on that day. Leave this field empty to default to today.<br />
+                       The "manual_run" parameter must not be selected for this to take effect.
 
       - bool:
          name: PostResult
@@ -149,11 +113,6 @@
          description: "ONOS and TestON versions to run on. Multiple branches supported."
 
       - string:
-         name: simulate_day
-         default: ""
-         description: 'Enter a day prefix (first 3 letters of a day, lowercase) to simulate running a nightly test on that day. Leave this field empty to default to today. Example: type "sun" for Sunday'
-
-      - string:
          name: ONOSJAVAOPTS
          default: "\"${{JAVA_OPTS:--Xms8G -Xmx8G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Dkaraf.log.console=INFO -Dds.lock.timeout.milliseconds=60000}}\""
          description: 'ONOS cell JAVA_OPTS setting.'
@@ -166,7 +125,7 @@
       - text:
          name: Tests
          default: |
-                   {testList}
+                  ""
 
          description: 'Specify the tests you want to run, if manual_run is selected.'
 
@@ -185,7 +144,7 @@
                 30 11 * * 6,7
 
     pipeline-scm:
-      script-path: '{jenkins-path}/{fileName}JenkinsfileTrigger'
+      script-path: '{jenkins-path}/MasterTrigger.groovy'
       scm:
         - git:
            url: '{gitURL}'
@@ -210,6 +169,17 @@
          default: 'DO_NOT_MANUALLY_TRIGGER_A_BUILD_HERE'
          description: |
                        <a href="https://jenkins.onosproject.org/view/QA/job/all-pipeline-trigger/">all-pipeline-trigger</a> triggers this pipeline automatically.
+      - string:
+         name: 'Category'
+         default: '{type}'
+         description: |
+                       Category of the pipeline. Primarily used when triggered by the upstream master-trigger job.
+
+      - string:
+         name: 'Branch'
+         default: '{version}'
+         description: |
+                       Branch of the pipeline. Primarily used when triggered by the upstream master-trigger job.
 
       - lf-infra-parameters:
          project: 'OnosSystemTest'
@@ -220,7 +190,7 @@
     concurrent: false
 
     pipeline-scm:
-      script-path: '{jenkins-path}/{type}JenkinsFile'
+      script-path: '{jenkins-path}/CommonJenkinsFile'
       scm:
         - git:
            url: '{gitURL}'
@@ -544,27 +514,7 @@
     <<: *var-init-boiler-plate
 
     jobs:
-      - 'all-pipeline-trigger'
-      - 'pipeline-trigger':
-         machine: 'vm'
-         testList: |
-                    {FUNC}
-                    {HA}
-         fileName: 'VM_BM'
-
-      - 'pipeline-trigger':
-         machine: 'bm'
-         testList: |
-                    {SCPF}
-                    {USECASE}
-         fileName: 'VM_BM'
-
-      - 'pipeline-trigger':
-         machine: 'fabric'
-         testList: |
-                    {SR}
-                    {SRHA}
-         fileName: 'Fabric'
+      - 'master-trigger'
 
 - project:
     name: build-pipeline