Improve SCPF tests
    - Add flowObj param to check if test run with FlowObject
    - Clean up old FlowObject tests

Change-Id: I04f455983a13a3221306fdde12ff6e9392fe7399
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
index c7c156c..7c7953a 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.params
@@ -60,8 +60,12 @@
         <neighbors>0,a</neighbors>           #a == all nodes (-1)
         <flowRuleBUEnabled>true</flowRuleBUEnabled>
         <skipReleaseResourcesOnWithdrawal>true</skipReleaseResourcesOnWithdrawal>
+        <flowObj>False</flowObj>
     </TEST>
-
+    <DATABASE>
+        <dbName>/tmp/IntentEventTPDB</dbName>
+        <dbFlowObj>/tmp/IntentEventTPflowObjDB</dbFlowObj>
+    </DATABASE>
     <METRICS>
         <intents_rate>intents-events-metrics|grep "Intent Installed Events"|cut -d ' ' -f7</intents_rate>
         <intents_withdrawn>intents-events-metrics|grep "Intent Withdrawn Events"|cut -d ' ' -f7</intents_withdrawn>
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
index 2caa008..a5944ac 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
@@ -41,8 +41,17 @@
         numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",")
         flowRuleBU = main.params[ 'TEST' ][ 'flowRuleBUEnabled' ]
         skipRelRsrc = main.params[ 'TEST'][ 'skipReleaseResourcesOnWithdrawal']
+
         homeDir = os.path.expanduser('~')
 
+        main.flowObj = main.params['TEST']['flowObj']
+        if main.flowObj == "True":
+            main.flowObj = True
+            main.dbFileName = main.params['DATABASE']['dbFlowObj']
+        else:
+            main.flowObj = False
+            main.dbFileName = main.params['DATABASE']['dbName']
+
         main.exceptions = [0]*11
         main.warnings = [0]*11
         main.errors = [0]*11
@@ -86,7 +95,7 @@
             commit = (commit.split(" "))[1]
 
             main.step("Creating results file")
-            resultsDB = open("/tmp/IntentEventTPDB", "w+")
+            resultsDB = open(main.dbFileName, "w+")
             resultsDB.close()
 
         # -- END OF INIT SECTION --#
@@ -159,6 +168,19 @@
 
         main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.store.flow.impl.DistributedFlowRuleStore", "backupEnabled " + str(flowRuleBU))
         main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.net.intent.impl.IntentManager", "skipReleaseResourcesOnWithdrawal " + skipRelRsrc)
+        if main.flowObj:
+            main.step("Set Intent Compiler use Flow Object")
+            stepResult = utilities.retry(main.ONOSbench.onosCfgSet,
+                                         main.FALSE,
+                                         args=[ONOSIp[0],
+                                               "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
+                                               "useFlowObjectives true"],
+                                         sleep=3,
+                                         attempts=3)
+            utilities.assert_equals(expect=main.TRUE,
+                                    actual=stepResult,
+                                    onpass="Successfully set Intent compiler use Flow object",
+                                    onfail="Failed to set up")
         devices = int(clusterCount)*10
 
         main.step("Setting up null provider")
@@ -307,7 +329,7 @@
             main.ONOSbench.handle.expect(":~")
             main.log.info("Stopping intentperf" )
 
-            with open("/tmp/IntentEventTPDB", "a") as resultsDB:
+            with open(main.dbFileName, "a") as resultsDB:
                 for node in groupResult:
                     resultString = "'" + commit + "',"
                     resultString += "'1gig',"