Move SR master schedules to Fabric4 cluster

Change-Id: I784d673cc9ad825480038449eb2bfdb7997a37a1
diff --git a/TestON/JenkinsFile/FabricJenkinsfileTrigger b/TestON/JenkinsFile/FabricJenkinsfileTrigger
index 6507fc1..d1efa2c 100644
--- a/TestON/JenkinsFile/FabricJenkinsfileTrigger
+++ b/TestON/JenkinsFile/FabricJenkinsfileTrigger
@@ -34,7 +34,7 @@
 before_previous_version = "1.12"
 
 // Function that will initialize the configuration of the Fabric.
-funcs.initializeTrend( "Fabric" );
+funcs.initializeTrend( "Fabric" )
 funcs.initialize( "Fabric" )
 triggerFuncs.init( funcs )
 
@@ -42,13 +42,11 @@
 // It will only be used by the VM_BMJenkinsTrigger not in here.
 wikiContents = ""
 
-// Having two different SR and SR1 to allow current_version and previous_version to be run on same machine.
 testcases = [
     "FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
     "HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
     "SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ],
-    "SR" : [ tests : "", nodeName : [ "Fabric2", "Fabric3" ], wikiContent : "" ],
-    "SR1" : [ tests : "", nodeName : [ "Fabric2", "Fabric3" ], wikiContent : "" ],
+    "SR" : [ tests : "", nodeName : [ "Fabric2", "Fabric3", "Fabric4" ], wikiContent : "" ],
     "USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ]
 ]
 
@@ -119,7 +117,7 @@
         SR_choices += adder( "SR", "extra_B", true )
     }
     // removing last comma added at the end of the last test name.
-    SR_choices =  triggerFuncs.lastCommaRemover( SR_choices )
+    SR_choices = triggerFuncs.lastCommaRemover( SR_choices )
 }
 
 
@@ -131,7 +129,6 @@
 }else{
     // set the list of the tests to run.
     testcases[ "SR" ][ "tests" ] = SR_choices
-    testcases[ "SR1" ][ "tests" ] = SR_choices
     println "Defaulting to " + day + " tests:"
 }
 
@@ -141,7 +138,8 @@
 // This will hold the block of code to be run.
 def runTest = [
     "Fabric2" : [:],
-    "Fabric3" : [:]
+    "Fabric3" : [:],
+    "Fabric4" : [:]
 ]
 if ( manually_run ){
     // for manual run situation.
@@ -153,8 +151,8 @@
         }
     }
 }else{
-    // for automated situation, it will save current and previous version to Fabric2 and before_previous_version to Fabric3.
-    runTest[ "Fabric2" ][ "SR1" ] = triggerFuncs.trigger_pipeline( current_version, testcases[ "SR1" ][ "tests" ], testcases[ "SR1" ][ "nodeName" ][ 0 ], "SR", manually_run, onos_tag )
+    // for automated situation, it will save current version to Fabric4, previous version to Fabric2 and before_previous_version to Fabric3.
+    runTest[ "Fabric4" ][ "SR" ] = triggerFuncs.trigger_pipeline( current_version, testcases[ "SR" ][ "tests" ], testcases[ "SR" ][ "nodeName" ][ 2 ], "SR", manually_run, onos_tag )
     runTest[ "Fabric2" ][ "SR" ] = triggerFuncs.trigger_pipeline( previous_version, testcases[ "SR" ][ "tests" ], testcases[ "SR" ][ "nodeName" ][ 0 ], "SR", manually_run, onos_tag )
     runTest[ "Fabric3" ][ "SR" ] = triggerFuncs.trigger_pipeline( before_previous_version, testcases[ "SR" ][ "tests" ], testcases[ "SR" ][ "nodeName" ][ 1 ], "SR", manually_run, onos_tag )
 }
@@ -162,28 +160,34 @@
 def finalList = [:]
 
 // It will run each category of test to run sequentially on each branch.
-// In our case, it will run SR1 first then SR on Fabric2 and just SR on Fabric3
 finalList[ "Fabric2" ] = triggerFuncs.runTestSeq( runTest[ "Fabric2" ] )
 finalList[ "Fabric3" ] = triggerFuncs.runTestSeq( runTest[ "Fabric3" ] )
+finalList[ "Fabric4" ] = triggerFuncs.runTestSeq( runTest[ "Fabric4" ] )
 
-// It will then run Fabric2 and Fabric3 to be run concurrently.
+// It will then run Fabric2, Fabric3 and Fabric4 concurrently.
 // In our case,
-//                      ----> Fabric2 : current -> previous
-// This pipeline ----->
-//                      ----> Fabric3 : before_previous
+//                      ----> Fabric4 : current_version
+// This pipeline -----> ----> Fabric2 : previous_version
+//                      ----> Fabric3 : before_previous_version
 parallel finalList
 
 // Way we are generating pie graphs. not supported in SegmentRouting yet.
 /*
 if ( !manually_run ){
+    funcs.generateStatGraph( "TestStation-Fabric4s",
+                             funcs.branchWithPrefix( "current_version" ),
+                             AllTheTests,
+                             stat_graph_generator_file,
+                             pie_graph_generator_file,
+                             graph_saved_directory )
     funcs.generateStatGraph( "TestStation-Fabric2s",
-                             funcs.branchWithPrefix( "master" ),
+                             funcs.branchWithPrefix( "previous_version" ),
                              AllTheTests,
                              stat_graph_generator_file,
                              pie_graph_generator_file,
                              graph_saved_directory )
     funcs.generateStatGraph( "TestStation-Fabric3s",
-                             funcs.branchWithPrefix( "1.12" ),
+                             funcs.branchWithPrefix( "before_previous_version" ),
                              AllTheTests,
                              stat_graph_generator_file,
                              pie_graph_generator_file,
@@ -206,7 +210,11 @@
 }
 
 // check which node is on.
-// 1.12 runs on Fabric3 and rest on 1.13 and master
 def nodeOn( branch ){
-    return branch == "1.12" ? 1 : 0;
+    switch( branch ) {
+        case current_version: return 2
+        case previous_version: return 0
+        case before_previous_version: return 1
+        default: return 2
+    }
 }
diff --git a/TestON/JenkinsFile/README b/TestON/JenkinsFile/README
index 18307e2..2c24fd6 100644
--- a/TestON/JenkinsFile/README
+++ b/TestON/JenkinsFile/README
@@ -23,17 +23,15 @@
      previous_version = "1.13"
      before_previous_version = "1.12"
   3) If you want certain branch to be run on different machine then change
-     a) line 157 - 159:
-        testcases[ "SR1" ][ "nodeName" ][ <node you want> ] 0 : Fabric2, 1: Fabric3
+     a) line 155 - 157:
+        testcases[ "SR" ][ "nodeName" ][ <node you want> ] 0: Fabric2, 1: Fabric3, 2: Fabric4
      b) Then, go to dependencies/JenkinsCommonFuncs.groovy
         change def fabricOn( branch ) on line 86.
-        Currently, only 1.12 runs on Fabric3 and rest are running Fabric2.
+        Currently, master, 1.13 and 1.12 run on Fabric4, 2 and 3 respectively.
      c) Make sure to change the URLs on Wiki as well. If 1.12 runs on Fabric2 instead of Fabric3, then you
         have to update the URL from
           https://jenkins.onosproject.org/view/QA/job/postjob-Fabric3/lastSuccessfulBuild/artifact/SRBridging_onos-1.12_20-builds_graph.jpg
-
           to
-
           https://jenkins.onosproject.org/view/QA/job/postjob-Fabric2/lastSuccessfulBuild/artifact/SRBridging_onos-1.12_20-builds_graph.jpg
 
 
@@ -65,4 +63,4 @@
    3) go to dependencies/PerformanceFuncs.groovy and add a new test in the dictionary.
    4) It explains details about which to add in the file.
    5) Make a Rscript for that test.
-   6) add your new graph to the wiki page.
\ No newline at end of file
+   6) add your new graph to the wiki page.
diff --git a/TestON/JenkinsFile/SRJenkinsFile b/TestON/JenkinsFile/SRJenkinsFile
index fa3bb04..3d3f309 100644
--- a/TestON/JenkinsFile/SRJenkinsFile
+++ b/TestON/JenkinsFile/SRJenkinsFile
@@ -35,7 +35,7 @@
 // additional setup for Segment routing because it is running multiple branch concurrently on different machines.
 funcs.additionalInitForSR( jobName )
 
-// read the TestON.property depends on which branch it is running. ( currently 1.13 and master on Fabric2, 1.12 on Fabric3 )
+// read the TestON.property depends on which branch it is running. ( currently master on Fabric4, 1.13 on Fabric2 and 1.12 on Fabric3 )
 def prop = null
 prop = funcs.getProperties()
 SR = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SR" ]
diff --git a/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy b/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
index 0b03c69..bbf12a4 100644
--- a/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
+++ b/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
@@ -87,7 +87,11 @@
   // gets the fabric machines with the branch of onos.
   // branch : master, 1.12, 1.13...
 
-  return branch.reverse().take(4).reverse() == "1.12" ? '3' : '2'
+  switch( branch.reverse().take(4).reverse() ) {
+    case "master": return "4"
+    case "1.13": return "2"
+    case "1.12": return "3"
+  }
 }
 def printType(){
   // print the test type and test machine that was initialized.