Modified params and fixed bugs

Change-Id: I15de03d12a63d2d4d2fdff65ec78ba7ab5e67a21
diff --git a/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.params b/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.params
index 97e32c3..97e2aab 100755
--- a/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.params
+++ b/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.params
@@ -42,9 +42,9 @@
 
     <TEST>
         <batch_size>1000</batch_size>
-        <min_intents>500000</min_intents>
-        <max_intents>1000000</max_intents>
-        <check_interval>1000</check_interval>
+        <min_intents>800000</min_intents>
+        <max_intents>10000000</max_intents>
+        <check_interval>10000</check_interval>
     </TEST>
 
 </PARAMS>
diff --git a/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py b/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py
index 793d5ea..867acc7 100644
--- a/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py
+++ b/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py
@@ -20,6 +20,11 @@
         - Building ONOS ( optional )
             - Install ONOS package
             - Build ONOS package
+        - Set up cell
+            - Create cell file
+            - Set cell file
+            - Verify cell file
+        - Kill ONOS process
         """
 
         main.case( "Constructing test variables and building ONOS package" )
@@ -57,6 +62,9 @@
         main.ONOSip = main.ONOSbench.getOnosIps()
         main.log.info(main.ONOSip)
 
+        # main.scale[ 0 ] determines the current number of ONOS controller
+        main.numCtrls = int( main.scale[ 0 ] )
+
         # Assigning ONOS cli handles to a list
         for i in range( 1,  main.maxNodes + 1 ):
             main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
@@ -103,22 +111,6 @@
             main.log.warn( "Did not pull new code so skipping mvn " +
                            "clean install" )
 
-    def CASE1( self, main ):
-        """
-        - Set up cell
-            - Create cell file
-            - Set cell file
-            - Verify cell file
-        - Kill ONOS process
-        - Uninstall ONOS cluster
-        - Verify ONOS start up
-        - Install ONOS cluster
-        - Connect to cli
-        """
-
-        # main.scale[ 0 ] determines the current number of ONOS controller
-        main.numCtrls = int( main.scale[ 0 ] )
-
         main.case( "Starting up " + str( main.numCtrls ) +
                    " node(s) ONOS cluster" )
 
@@ -159,6 +151,26 @@
                                  onpass="Successfully created ONOS package",
                                  onfail="Failed to create ONOS package" )
 
+        commit = main.ONOSbench.getVersion()
+        commit = commit.split(" ")[1]
+
+        try:
+            dbFileName="/tmp/MaxIntentDB"
+            dbfile = open(dbFileName, "w+")
+            temp = "'" + commit + "',"
+            dbfile.write(temp)
+            dbfile.close()
+        except IOError:
+            main.log.warn("Error opening " + dbFileName + " to write results.")
+
+    def CASE1( self, main ):
+        """
+        - Uninstall ONOS cluster
+        - Verify ONOS start up
+        - Install ONOS cluster
+        - Connect to cli
+        """
+
         main.step( "Uninstalling ONOS package" )
         onosUninstallResult = main.TRUE
         for i in range( main.maxNodes ):
@@ -386,10 +398,22 @@
         except pexpect.TIMEOUT:
             main.log.exception("Timeout exception caught")
 
+        maxIntents = main.intentFunctions.getIntents( main )
+        maxFlows = main.intentFunctions.getFlows( main )
+
         main.log.report("Done pushing intents")
         main.log.info("Summary: Intents=" + str(expectedIntents) + " Flows=" + str(expectedFlows))
-        main.log.info("Installed intents: " + str(main.intentFunctions.getIntents(main)) +
-                      "\nAdded flows: " + str(main.intentFunctions.getFlows(main)))
+        main.log.info("Installed intents: " + str(maxIntents) +
+                      "\nAdded flows: " + str(maxFlows))
+
+        try:
+            dbFileName="/tmp/MaxIntentDB"
+            dbfile = open(dbFileName, "a+")
+            temp = "'" + str(maxIntents) + "',"
+            dbfile.write(temp)
+            dbfile.close()
+        except IOError:
+            main.log.warn("Error opening " + dbFileName + " to write results.")
 
         # Stopping mininet
         if main.switch == "of":
@@ -509,10 +533,22 @@
         except pexpect.TIMEOUT:
             main.log.exception("Timeout exception caught")
 
+        maxIntents = main.intentFunctions.getIntents( main )
+        maxFlows = main.intentFunctions.getFlows( main )
+
         main.log.report("Done pushing intents")
         main.log.info("Summary: Intents=" + str(expectedIntents) + " Flows=" + str(expectedFlows))
-        main.log.info("Installed intents: " + str(main.intentFunctions.getIntents(main)) +
-                      "\nAdded flows: " + str(main.intentFunctions.getFlows(main)))
+        main.log.info("Installed intents: " + str(maxIntents) +
+                      "\nAdded flows: " + str(maxFlows))
+
+        try:
+            dbFileName="/tmp/MaxIntentDB"
+            dbfile = open(dbFileName, "a+")
+            temp = "'" + str(maxIntents) + "',"
+            dbfile.write(temp)
+            dbfile.close()
+        except IOError:
+            main.log.warn("Error opening " + dbFileName + " to write results.")
 
         # Stopping mininet
         if main.switch == "of":