[ONOS-7674] Adjust Jenkins File to the changes of RScript refactoring

    - Created new file that will contain all the location information.
      This will prevent user to change location of the file in multiple
      places whenever there is a change of location.
Change-Id: Ida166a69d4c93389180365e44d238e2c063c5797
diff --git a/TestON/JenkinsFile/CHO_Graph_Generator b/TestON/JenkinsFile/CHO_Graph_Generator
index 6e9bc24..1ed8eb6 100644
--- a/TestON/JenkinsFile/CHO_Graph_Generator
+++ b/TestON/JenkinsFile/CHO_Graph_Generator
@@ -1,10 +1,12 @@
 #!groovy
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
 
+fileRelated.init()
 branches = params.ONOSbranch
 branchList = branches.tokenize( "\n;, " )
-script_file = "~/OnosSystemTest/TestON/JenkinsFile/wikiGraphRScripts/trendCHO.R"
-saving_directory = "/var/jenkins/workspace/postjob-Fabric5/"
-scriptDir = "~/CHO_Jenkins_Scripts/"
+script_file = fileRelated.trendCHO
+saving_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric5/"
+scriptDir = fileRelated.CHOScriptDir
 
 graphScript = generateGraphScript( branchList )
 
diff --git a/TestON/JenkinsFile/FUNCJenkinsFile b/TestON/JenkinsFile/FUNCJenkinsFile
index 8592090..ce61765 100644
--- a/TestON/JenkinsFile/FUNCJenkinsFile
+++ b/TestON/JenkinsFile/FUNCJenkinsFile
@@ -1,15 +1,18 @@
 #!groovy
 funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
 test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
 
+fileRelated.init()
 funcs.initialize( "FUNC" );
+
 // This is a Jenkinsfile for a scripted pipeline for the FUNC tests
 def prop = null
 prop = funcs.getProperties()
 FUNC = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "FUNC" ]
 
-graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-VM/"
+graph_generator_file = fileRelated.trendIndividual
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
 
 echo( "Testcases:" )
 def testsToRun = null
@@ -29,4 +32,4 @@
     tests[ test ].call()
 }
 funcs.generateOverallGraph( prop, FUNC, graph_saved_directory )
-funcs.sendResultToSlack( start,  prop[ "manualRun" ], prop[ "WikiPrefix" ] )
\ No newline at end of file
+funcs.sendResultToSlack( start,  prop[ "manualRun" ], prop[ "WikiPrefix" ] )
diff --git a/TestON/JenkinsFile/FabricJenkinsfileTrigger b/TestON/JenkinsFile/FabricJenkinsfileTrigger
index da75805..fca468c 100644
--- a/TestON/JenkinsFile/FabricJenkinsfileTrigger
+++ b/TestON/JenkinsFile/FabricJenkinsfileTrigger
@@ -3,7 +3,9 @@
 funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
 test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
 triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
 
+fileRelated.init()
 current_version = "master"
 previous_version = "1.13"
 before_previous_version = "1.12"
@@ -53,9 +55,9 @@
 FUNC_choices = ""
 HA_choices = ""
 SR_choices = ""
-stat_graph_generator_file = "testCategoryBuildStats.R"
-pie_graph_generator_file = "testCategoryPiePassFail.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-Fabric/"
+stat_graph_generator_file = fileRelated.histogramMultiple
+pie_graph_generator_file = fileRelated.pieMultiple
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric/"
 
 post_result = params.PostResult
 if( !manually_run ){
diff --git a/TestON/JenkinsFile/GeneralFuncs.groovy b/TestON/JenkinsFile/GeneralFuncs.groovy
index 70b0fe0..a0c70c9 100644
--- a/TestON/JenkinsFile/GeneralFuncs.groovy
+++ b/TestON/JenkinsFile/GeneralFuncs.groovy
@@ -6,13 +6,10 @@
 def basicGraphPart( rFileName, host, port, user, pass, subject, branchName ){
   return " Rscript " + rFileName + " " + host + " " + port + " " + user + " " + pass + " " + subject + " " + branchName
 }
-def initBasicVars(){
-  rScriptLocation = "~/OnosSystemTest/TestON/JenkinsFile/scripts/"
-}
 def getTestList( tests ){
     list = ""
     for( String test : tests.keySet() )
         list += test + ","
     return list[ 0..-2 ]
 }
-return this;
\ No newline at end of file
+return this;
diff --git a/TestON/JenkinsFile/HAJenkinsFile b/TestON/JenkinsFile/HAJenkinsFile
index a03b71e..61d2acf 100644
--- a/TestON/JenkinsFile/HAJenkinsFile
+++ b/TestON/JenkinsFile/HAJenkinsFile
@@ -1,15 +1,17 @@
 #!groovy
 funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
 test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
 
+fileRelated.init()
 funcs.initialize( "HA" );
 // This is a Jenkinsfile for a scripted pipeline for the HA tests
 def prop = null
 prop = funcs.getProperties()
 HA = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "HA" ]
 
-graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-VM/"
+graph_generator_file = fileRelated.trendIndividual
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
 
 echo( "Testcases:" )
 def testsToRun = null
diff --git a/TestON/JenkinsFile/JenkinsCommonFuncs.groovy b/TestON/JenkinsFile/JenkinsCommonFuncs.groovy
index fd7253b..8c0322f 100644
--- a/TestON/JenkinsFile/JenkinsCommonFuncs.groovy
+++ b/TestON/JenkinsFile/JenkinsCommonFuncs.groovy
@@ -1,6 +1,9 @@
 #!groovy
 import groovy.time.*
 generalFuncs = evaluate readTrusted( 'TestON/JenkinsFile/GeneralFuncs.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+
+fileRelated.init()
 
 def initializeTrend( machine ){
   table_name = "executed_test_tests"
@@ -9,7 +12,6 @@
   this.machine = machine
   isSCPF = false
   isTrend = true
-  generalFuncs.initBasicVars();
 }
 def initialize( type, SCPFfuncs ){
   init( type )
@@ -22,8 +24,8 @@
   SCPFfunc = null
   table_name = "executed_test_tests"
   result_name = "executed_test_results"
-  trend_generator_file = generalFuncs.rScriptLocation + "testCategoryTrend.R"
-  build_stats_generator_file = generalFuncs.rScriptLocation + "testCategoryBuildStats.R"
+  trend_generator_file = fileRelated.trendMultiple
+  build_stats_generator_file = fileRelated.histogramMultiple
   isSCPF = false
 }
 def init( type ){
@@ -35,7 +37,6 @@
   testType = type;
   testMachine = "TestStation-" + machineType[ type ] + "s";
   isTrend = false
-  generalFuncs.initBasicVars();
 }
 def additionalInitForSR( branch ){
   testMachine = ( ( new StringBuilder( testMachine ) ).insert( testMachine.size()-1, fabricOn( branch ) ) ).toString()
@@ -297,9 +298,9 @@
           string( credentialsId: 'db_host', variable: 'host' ),
           string( credentialsId: 'db_port', variable: 'port' ) ] ) {
               sh '''#!/bin/bash
-              ''' + generalFuncs.basicGraphPart( generalFuncs.rScriptLocation + stat_file, host, port, user, pass, type, branch ) + " \"" + testListPart + "\" latest " + save_path + '''
-              ''' + getOverallPieGraph( generalFuncs.rScriptLocation + pie_file, host, port, user, pass, branch, type, pieTestListPart, 'y', save_path ) + '''
-              ''' + getOverallPieGraph( generalFuncs.rScriptLocation + pie_file, host, port, user, pass, branch, type, pieTestListPart, 'n', save_path )
+              ''' + generalFuncs.basicGraphPart( stat_file, host, port, user, pass, type, branch ) + " \"" + testListPart + "\" latest " + save_path + '''
+              ''' + getOverallPieGraph( pie_file, host, port, user, pass, branch, type, pieTestListPart, 'y', save_path ) + '''
+              ''' + getOverallPieGraph( pie_file, host, port, user, pass, branch, type, pieTestListPart, 'n', save_path )
           }
         }
       postResult( [], true )
diff --git a/TestON/JenkinsFile/JenkinsPathAndFiles.groovy b/TestON/JenkinsFile/JenkinsPathAndFiles.groovy
new file mode 100644
index 0000000..fc89730
--- /dev/null
+++ b/TestON/JenkinsFile/JenkinsPathAndFiles.groovy
@@ -0,0 +1,23 @@
+#!groovy
+
+def initLocation(){
+    jenkinsFolder = "~/OnosSystemTest/TestON/JenkinsFile/"
+    rScriptLocation = jenkinsFolder + "wikiGraphRScripts/"
+    jenkinsWorkspace = "/var/jenkins/workspace/"
+    SCPFSpecificLocation = rScriptLocation + "SCPFspecificGraphRScripts/"
+    CHOScriptDir = "~/CHO_Jenkins_Scripts/"
+}
+def initFiles(){
+    trendIndividual = rScriptLocation + "trendIndividualTest.R"
+    trendMultiple = rScriptLocation + "trendMultipleTests.R"
+    trendSCPF = rScriptLocation + "trendSCPF.R"
+    trendCHO = rScriptLocation + "trendCHO.R"
+    histogramMultiple = rScriptLocation + "histogramMultipleTestGroups.R"
+    pieMultiple = rScriptLocation + "pieMultipleTests.R"
+}
+def init(){
+    initLocation()
+    initFiles()
+}
+return this;
+
diff --git a/TestON/JenkinsFile/Overall_Graph_Generator b/TestON/JenkinsFile/Overall_Graph_Generator
index ba34a89..14fe796 100644
--- a/TestON/JenkinsFile/Overall_Graph_Generator
+++ b/TestON/JenkinsFile/Overall_Graph_Generator
@@ -1,10 +1,12 @@
 #!groovy
 funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
 test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
 
-stat_graph_generator_file = "testCategoryBuildStats.R"
-pie_graph_generator_file = "testCategoryPiePassFail.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-VM/"
+fileRelated.init()
+stat_graph_generator_file = fileRelated.histogramMultiple
+pie_graph_generator_file = fileRelated.pieMultiple
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
 
 funcs.initializeTrend( "VM" )
 
@@ -16,4 +18,4 @@
                          AllTheTests,
                          stat_graph_generator_file,
                          pie_graph_generator_file,
-                         graph_saved_directory )
\ No newline at end of file
+                         graph_saved_directory )
diff --git a/TestON/JenkinsFile/PerformanceFuncs.groovy b/TestON/JenkinsFile/PerformanceFuncs.groovy
index 5077bd9..c5613f2 100644
--- a/TestON/JenkinsFile/PerformanceFuncs.groovy
+++ b/TestON/JenkinsFile/PerformanceFuncs.groovy
@@ -1,5 +1,7 @@
 #!groovy
-//generalFuncs = evaluate readTrusted( 'TestON/JenkinsFile/GeneralFuncs.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+
+fileRelated.init()
 def init(){
     none = [ "" ]
     batches = [ 1, 100, 1000 ]
@@ -24,7 +26,7 @@
         SCPFintentInstallWithdrawLatWithFlowObj: [ flows:true, test:'SCPFintentInstallWithdrawLat --params TEST/flowObj=True', table:'intent_latency_fobj_tests', results:'intent_latency_fobj_results', file:'IntentInstallWithdrawLatDBWFO', rFile:'SCPFIntentInstallWithdrawRerouteLat.R y', extra:batches, finalResult:0 ],
         SCPFmastershipFailoverLat:               [ flows:false, test:'SCPFmastershipFailoverLat', table:'mastership_failover_tests', results:'mastership_failover_results', file:'mastershipFailoverLatDB', rFile:'SCPFmastershipFailoverLat.R', extra:none, finalResult:1, graphTitle:[ 'Mastership Failover Test' ], dbCols:[ 'kill_deact_avg,deact_role_avg' ], dbWhere:'AND scale=5', y_axis:'Latency (ms)' ]
     ]
-    graph_saved_directory = "/var/jenkins/workspace/postjob-BM/"
+    graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-BM/"
 }
 def getGraphCommand( rFileName, extras, host, port, user, pass, testName, branchName, isOldFlow ){
     result = ""
@@ -35,14 +37,14 @@
 }
 def generateGraph( rFileName, batch, host, port, user, pass, testName, branchName, isOldFlow ){
 
-    return generalFuncs.basicGraphPart( generalFuncs.rScriptLocation + rFileName, host, port, user, pass, testName, branchName ) +
+    return generalFuncs.basicGraphPart( fileRelated.SCPFSpecificLocation + rFileName, host, port, user, pass, testName, branchName ) +
            " " + batch + " " + usingOldFlow( isOldFlow, testName ) + graph_saved_directory
 }
 def generateCombinedResultGraph( host, port, user, pass, testName, branchName, isOldFlow ){
     result = ""
 
     for ( int i=0; i< SCPF[ testName ][ 'graphTitle' ].size(); i++ ){
-        result += generalFuncs.basicGraphPart( generalFuncs.rScriptLocation + "SCPFLineGraph.R", host, port, user, pass, "\"" + SCPF[ testName ][ 'graphTitle' ][ i ] + "\"", branchName ) +
+        result += generalFuncs.basicGraphPart(  fileRelated.trendSCPF, host, port, user, pass, "\"" + SCPF[ testName ][ 'graphTitle' ][ i ] + "\"", branchName ) +
         " " + 50 + " \"SELECT " + checkIfList( testName, 'dbCols', i ) + ", build FROM " + SCPF[ testName ][ 'table' ] + " WHERE  branch=\'" + branchName + "\' " + sqlOldFlow( isOldFlow, testName ) +
         checkIfList( testName, 'dbWhere', i ) + " ORDER BY date DESC LIMIT 50\" \"" + SCPF[ testName ][ 'y_axis' ] + "\" " + hasOldFlow( isOldFlow, testName ) + graph_saved_directory + ";"
     }
diff --git a/TestON/JenkinsFile/SRJenkinsFile b/TestON/JenkinsFile/SRJenkinsFile
index a583774..95b18d5 100644
--- a/TestON/JenkinsFile/SRJenkinsFile
+++ b/TestON/JenkinsFile/SRJenkinsFile
@@ -1,7 +1,9 @@
 #!groovy
 funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
 test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
 
+fileRelated.init()
 funcs.initialize( "SR" );
 jobName = env.JOB_NAME
 funcs.additionalInitForSR( jobName )
@@ -10,8 +12,8 @@
 prop = funcs.getProperties()
 SR = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SR" ]
 
-graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-Fabric" + funcs.fabricOn( prop[ "ONOSBranch" ] ) + "/"
+graph_generator_file = fileRelated.trendIndividual
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + funcs.fabricOn( prop[ "ONOSBranch" ] ) + "/"
 
 echo( "Testcases:" )
 def testsToRun = null
diff --git a/TestON/JenkinsFile/Trend_Graph_Generator b/TestON/JenkinsFile/Trend_Graph_Generator
index 5f3ccfd..52fc77f 100644
--- a/TestON/JenkinsFile/Trend_Graph_Generator
+++ b/TestON/JenkinsFile/Trend_Graph_Generator
@@ -1,5 +1,8 @@
 #!groovy
 funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+
+fileRelated.init()
 nodeCluster = params.NodeCluster
 
 funcs.initializeTrend( nodeCluster );
@@ -12,8 +15,8 @@
 prop[ "ONOSBranch" ] = params.ONOSbranch
 
 
-graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-" + nodeCluster + ( nodeCluster == "Fabric" ? funcs.fabricOn( prop[ "ONOSBranch" ] ) : "" ) + "/"
+graph_generator_file = fileRelated.trendIndividual
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-" + nodeCluster + ( nodeCluster == "Fabric" ? funcs.fabricOn( prop[ "ONOSBranch" ] ) : "" ) + "/"
 
 def testsToRun = null
 testsToRun = funcs.getTestsToRun( Tests )
diff --git a/TestON/JenkinsFile/USECASEJenkinsFile b/TestON/JenkinsFile/USECASEJenkinsFile
index 34abfa9..af56bc5 100644
--- a/TestON/JenkinsFile/USECASEJenkinsFile
+++ b/TestON/JenkinsFile/USECASEJenkinsFile
@@ -1,15 +1,17 @@
 #!groovy
 funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
 test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
 
+fileRelated.init()
 funcs.initialize( "USECASE" );
 // This is a Jenkinsfile for a scripted pipeline for the USECASE tests
 def prop = null
 prop = funcs.getProperties()
 USECASE = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "USECASE" ]
 
-graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-BM/"
+graph_generator_file = fileRelated.trendIndividual
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-BM/"
 
 echo( "Testcases:" )
 def testsToRun = null
@@ -29,4 +31,4 @@
     tests[ test ].call()
 }
 funcs.sendResultToSlack( start,  prop[ "manualRun" ], prop[ "WikiPrefix" ] )
-funcs.generateOverallGraph( prop, USECASE, graph_saved_directory )
\ No newline at end of file
+funcs.generateOverallGraph( prop, USECASE, graph_saved_directory )
diff --git a/TestON/JenkinsFile/VM_BMJenkinsfileTrigger b/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
index 3d03048..b90faed 100644
--- a/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
+++ b/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
@@ -3,7 +3,9 @@
 funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
 test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
 triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
 
+fileRelated.init()
 current_version = "master"
 previous_version = "1.13"
 before_previous_version = "1.12"
@@ -56,9 +58,9 @@
 FUNC_choices = ""
 HA_choices = ""
 SR_choices = ""
-stat_graph_generator_file = "testCategoryBuildStats.R"
-pie_graph_generator_file = "testCategoryPiePassFail.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-VM/"
+stat_graph_generator_file = fileRelated.histogramMultiple
+pie_graph_generator_file = fileRelated.pieMultiple
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
 
 post_result = params.PostResult
 if( !manually_run ){
@@ -381,7 +383,7 @@
 }
 def postToWiki( contents ){
     node( testMachine ){
-        workspace = "/var/jenkins/workspace/all-pipeline-trigger/"
+        workspace = fileRelated.jenkinsWorkspace + "all-pipeline-trigger/"
         filename = "jenkinsSchedule.txt"
         writeFile file: workspace + filename, text: contents
         funcs.publishToConfluence( "false", "true",