Fixing property file overwritting in Jenkins Pipelines

Change-Id: Ic7325da3ed73cb07af01ce67e1f44db3215216c3
diff --git a/TestON/JenkinsFile/FUNCJenkinsFile b/TestON/JenkinsFile/FUNCJenkinsFile
index 6989fd5..caa8669 100644
--- a/TestON/JenkinsFile/FUNCJenkinsFile
+++ b/TestON/JenkinsFile/FUNCJenkinsFile
@@ -35,7 +35,7 @@
 def prop = null
 
 // Read the TestONOS.property from the VM
-prop = funcs.getProperties()
+prop = funcs.getProperties( "FUNC" )
 
 // get the list of the test and init branch to it.
 FUNC_tests = test_list.getTestsFromCategory( "FUNC" )
diff --git a/TestON/JenkinsFile/HAJenkinsFile b/TestON/JenkinsFile/HAJenkinsFile
index 9eee0f9..b5f1a7e 100644
--- a/TestON/JenkinsFile/HAJenkinsFile
+++ b/TestON/JenkinsFile/HAJenkinsFile
@@ -35,7 +35,7 @@
 def prop = null
 
 // Read the TestONOS.property from the VM
-prop = funcs.getProperties()
+prop = funcs.getProperties( "HA" )
 
 // get the list of the test and init branch to it.
 HA_tests = test_list.getTestsFromCategory( "HA" )
diff --git a/TestON/JenkinsFile/SCPFJenkinsFile b/TestON/JenkinsFile/SCPFJenkinsFile
index cf31c9d..b553af4 100644
--- a/TestON/JenkinsFile/SCPFJenkinsFile
+++ b/TestON/JenkinsFile/SCPFJenkinsFile
@@ -30,7 +30,7 @@
 
 // read the information from TestON.property on BM
 def prop = null
-prop = funcs.getProperties()
+prop = funcs.getProperties( "SCPF" )
 
 // get the list of the test to run.
 echo( "Testcases:" )
diff --git a/TestON/JenkinsFile/SCPF_Graph_Generator b/TestON/JenkinsFile/SCPF_Graph_Generator
index da57cd0..8e3abb8 100644
--- a/TestON/JenkinsFile/SCPF_Graph_Generator
+++ b/TestON/JenkinsFile/SCPF_Graph_Generator
@@ -27,7 +27,7 @@
 funcs.initialize( "SCPF", SCPFfuncs );
 
 def prop = null
-prop = funcs.getProperties()
+prop = funcs.getProperties( "SCPF" )
 
 // get the variables from the Jenkins parameters.
 def Tests = params.Test
diff --git a/TestON/JenkinsFile/SRHAJenkinsFile b/TestON/JenkinsFile/SRHAJenkinsFile
index 3ca8810..90c882c 100644
--- a/TestON/JenkinsFile/SRHAJenkinsFile
+++ b/TestON/JenkinsFile/SRHAJenkinsFile
@@ -39,7 +39,7 @@
 // read the TestON.property depends on which branch it is running.
 // ( currently master on Fabric4, 2.1 on Fabric3 and 1.15 on Fabric2 )
 def prop = null
-prop = funcs.getProperties()
+prop = funcs.getProperties( "SRHA" )
 SRHA_tests = test_list.getTestsFromCategory( "SRHA" )
 
 // set the file paths and directory
diff --git a/TestON/JenkinsFile/SRJenkinsFile b/TestON/JenkinsFile/SRJenkinsFile
index e4af109..c24a47b 100644
--- a/TestON/JenkinsFile/SRJenkinsFile
+++ b/TestON/JenkinsFile/SRJenkinsFile
@@ -39,7 +39,7 @@
 // read the TestON.property depends on which branch it is running.
 // ( currently master on Fabric4, 1.15 on Fabric2 and 2.1 on Fabric3 )
 def prop = null
-prop = funcs.getProperties()
+prop = funcs.getProperties( "SR" )
 SR_tests = test_list.getTestsFromCategory( "SR" )
 
 // set the file paths and directory
diff --git a/TestON/JenkinsFile/Trend_Graph_Generator b/TestON/JenkinsFile/Trend_Graph_Generator
index 2779d9b..77e57c9 100644
--- a/TestON/JenkinsFile/Trend_Graph_Generator
+++ b/TestON/JenkinsFile/Trend_Graph_Generator
@@ -36,7 +36,7 @@
     funcs.additionalInitForSR( params.ONOSbranch )
 }
 def prop = null
-prop = funcs.getProperties()
+prop = funcs.getProperties( "FUNC" )
 
 // get the list of the tests from the parameters.
 def Tests = params.Test
diff --git a/TestON/JenkinsFile/USECASEJenkinsFile b/TestON/JenkinsFile/USECASEJenkinsFile
index 62da8ff..4200f9a 100644
--- a/TestON/JenkinsFile/USECASEJenkinsFile
+++ b/TestON/JenkinsFile/USECASEJenkinsFile
@@ -32,7 +32,7 @@
 
 // read the TestON.property files and save it as a dictionary
 def prop = null
-prop = funcs.getProperties()
+prop = funcs.getProperties( "USECASE" )
 USECASE_tests = test_list.getTestsFromCategory( "USECASE" )
 
 // save directory and file.
diff --git a/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy b/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
index d64f12e..94d2dbd 100644
--- a/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
+++ b/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
@@ -121,11 +121,11 @@
     echo testMachine
 }
 
-def getProperties(){
+def getProperties( category ){
     // get the properties of the test by reading the TestONOS.property
 
     node( testMachine ) {
-        return readProperties( file: '/var/jenkins/TestONOS.property' )
+        return readProperties( file: '/var/jenkins/TestONOS-' + category + '.property' )
     }
 }
 
diff --git a/TestON/JenkinsFile/dependencies/TriggerFuncs.groovy b/TestON/JenkinsFile/dependencies/TriggerFuncs.groovy
index 4eb22ab..5def939 100644
--- a/TestON/JenkinsFile/dependencies/TriggerFuncs.groovy
+++ b/TestON/JenkinsFile/dependencies/TriggerFuncs.groovy
@@ -113,7 +113,7 @@
     println "test_branch with prefix: " + test_branch
     node( "TestStation-" + nodeName + "s" ) {
         envSetup( onos_branch, test_branch, onosTag, jobOn, manuallyRun )
-        exportEnvProperty( onos_branch, test_branch, wiki, tests, post_result, manuallyRun, onosTag, isOldFlow )
+        exportEnvProperty( onos_branch, test_branch, jobOn, wiki, tests, post_result, manuallyRun, onosTag, isOldFlow )
     }
 
     jobToRun = jobOn + "-pipeline-" + ( manuallyRun ? "manually" : wiki )
@@ -131,20 +131,22 @@
 }
 
 // export Environment properties.
-def exportEnvProperty( onos_branch, test_branch, wiki, tests, postResult, manually_run, onosTag, isOldFlow ){
+def exportEnvProperty( onos_branch, test_branch, jobOn, wiki, tests, postResult, manually_run, onosTag, isOldFlow ){
     // export environment properties to the machine.
 
+    filePath = "/var/jenkins/TestONOS-" + jobOn + ".property"
+
     stage( "export Property" ) {
         sh '''
-            echo "ONOSBranch=''' + onos_branch + '''" > /var/jenkins/TestONOS.property
-            echo "TestONBranch=''' + test_branch + '''" >> /var/jenkins/TestONOS.property
-            echo "ONOSTag=''' + onosTag + '''" >> /var/jenkins/TestONOS.property
-            echo "WikiPrefix=''' + wiki + '''" >> /var/jenkins/TestONOS.property
-            echo "ONOSJAVAOPTS=''' + env.ONOSJAVAOPTS + '''" >> /var/jenkins/TestONOS.property
-            echo "Tests=''' + tests + '''" >> /var/jenkins/TestONOS.property
-            echo "postResult=''' + postResult + '''" >> /var/jenkins/TestONOS.property
-            echo "manualRun=''' + manually_run + '''" >> /var/jenkins/TestONOS.property
-            echo "isOldFlow=''' + isOldFlow + '''" >> /var/jenkins/TestONOS.property
+            echo "ONOSBranch=''' + onos_branch + '''" > ''' + filePath + '''
+            echo "TestONBranch=''' + test_branch + '''" >> ''' + filePath + '''
+            echo "ONOSTag=''' + onosTag + '''" >> ''' + filePath + '''
+            echo "WikiPrefix=''' + wiki + '''" >> ''' + filePath + '''
+            echo "ONOSJAVAOPTS=''' + env.ONOSJAVAOPTS + '''" >> ''' + filePath + '''
+            echo "Tests=''' + tests + '''" >> ''' + filePath + '''
+            echo "postResult=''' + postResult + '''" >> ''' + filePath + '''
+            echo "manualRun=''' + manually_run + '''" >> ''' + filePath + '''
+            echo "isOldFlow=''' + isOldFlow + '''" >> ''' + filePath + '''
         '''
     }
 }