Merge "Added FUNCintent test"
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..c24bb9d
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,6 @@
+[gerrit]
+host=gerrit.onosproject.org
+port=29418
+project=OnosSystemTest.git
+defaultremote=origin
+defaultbranch=master
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 8eea845..e4dbf9d 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -93,6 +93,7 @@
         self.Thread = Thread
         self.cleanupFlag = False
         self.cleanupLock = threading.Lock()
+        self.initiated = False
 
         self.configparser()
         verifyOptions(options)
@@ -151,6 +152,7 @@
         This method will initialize specified component
         '''
         global driver_options
+        self.initiated = False
         self.log.info("Creating component Handle: "+component)
         driver_options = {}
         if 'COMPONENTS' in self.componentDictionary[component].keys():
@@ -176,6 +178,7 @@
             self.exit()
 
         vars(self)[component] = driverObject
+        self.initiated = True
 
     def run(self):
         '''
@@ -353,7 +356,8 @@
             try:
                 if self.cleanupFlag is False:  # First thread to run this
                     self.cleanupFlag = True
-                    self.logger.testSummary(self)
+                    if self.initiated:
+                        self.logger.testSummary(self)
                     for component in self.componentDictionary.keys():
                         try :
                             tempObject  = vars(self)[component]
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 870293d..2f8bd47 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2578,14 +2578,6 @@
         Optional argument:
             * jsonFormat - boolean indicating if you want output in json
         """
-        # FIXME: add json output
-        # Sample JSON
-        # {
-        #     "electedTime": "13m ago",
-        #     "epoch": 4,
-        #     "leader": "10.128.30.17",
-        #     "topic": "intent-partition-3"
-        #  },
         try:
             cmdStr = "onos:leaders"
             if jsonFormat:
@@ -2605,6 +2597,63 @@
             main.cleanup()
             main.exit()
 
+    def leaderCandidates( self, jsonFormat=True ):
+        """
+        Returns the output of the leaders -c command.
+        Optional argument:
+            * jsonFormat - boolean indicating if you want output in json
+        """
+        try:
+            cmdStr = "onos:leaders -c"
+            if jsonFormat:
+                cmdStr += " -j"
+            output = self.sendline( cmdStr )
+            return output
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def specificLeaderCandidate(self,topic):
+        """
+        Returns a list in format [leader,candidate1,candidate2,...] for a given
+        topic parameter and an empty list if the topic doesn't exist
+        If no leader is elected leader in the returned list will be "none"
+        Returns None if there is a type error processing the json object
+        """
+        try:
+            cmdStr = "onos:leaders -c -j"
+            output = self.sendline( cmdStr )
+            output = json.loads(output)
+            results = []
+            for dict in output:
+                if dict["topic"] == topic:
+                    leader = dict["leader"]
+                    candidates = re.split(", ",dict["candidates"][1:-1])
+                    results.append(leader)
+                    results.extend(candidates)
+            return results
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
     def pendingMap( self, jsonFormat=True ):
         """
         Returns the output of the intent Pending map.
@@ -3511,7 +3560,7 @@
         except AssertionError:
             main.log.error( "Error in processing 'set-test-get' command: " +
                             str( output ) )
-            return None 
+            return None
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
             return None
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 8a87a49..37d55fe 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -115,15 +115,13 @@
                 pwd=self.pwd,
                 home=self.home )
 
-            self.handle.sendline( "cd " + self.home )
-            self.handle.expect( "\$" )
-
             if self.handle:
+                self.handle.sendline( "cd " + self.home )
+                self.handle.expect( "\$" )
                 return self.handle
             else:
-                main.log.info( "NO ONOS HANDLE" )
+                main.log.info( "Failed to create ONOS handle" )
                 return main.FALSE
-
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
diff --git a/TestON/drivers/component.py b/TestON/drivers/component.py
index f05be55..9199a4e 100644
--- a/TestON/drivers/component.py
+++ b/TestON/drivers/component.py
@@ -45,9 +45,8 @@
             return getattr( self.wrapped, name )
         except AttributeError as error:
             # NOTE: The first time we load a driver module we get this error
-            if "'module' object has no attribute '__path__'" in error\
-                    and self.count == 0:
-                self.count += 1
+            if "'module' object has no attribute '__path__'" in error:
+                pass
             else:
                 main.log.error( str(error.__class__) + " " + str(error) )
             try:
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/CHOtest/CHOtest.params
similarity index 92%
rename from TestON/tests/OnosCHO/OnosCHO.params
rename to TestON/tests/CHOtest/CHOtest.params
index 024bd11..31b4e08 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/CHOtest/CHOtest.params
@@ -12,13 +12,11 @@
     # 8X. Bring random links back up
     # 9X Point,Multi-single,Single-Multi Intents
 
-    <testcases>1,20,3,40,5,60</testcases>
-    <ENV>
-        <cellName>choTest3</cellName>
-    </ENV>
+    <testcases>1,20,3,[40,5,60,70,80,10,90,71,81,10]*50,21,3,[41,5,61,72,82,10,91,73,83,10]*50,22,3,[42,5,62,74,84,10,92,10]*50</testcases>
+
     <GIT>
         #autoPull 'on' or 'off'
-        <autoPull>off</autoPull>
+        <autoPull>on</autoPull>
         <branch>master</branch>
     </GIT>
 
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/CHOtest/CHOtest.py
similarity index 94%
rename from TestON/tests/OnosCHO/OnosCHO.py
rename to TestON/tests/CHOtest/CHOtest.py
index dfdfd39..20daf09 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/CHOtest/CHOtest.py
@@ -6,7 +6,7 @@
 import itertools
 
 
-class OnosCHO:
+class CHOtest:
 
     def __init__( self ):
         self.default = ''
@@ -14,13 +14,13 @@
     def CASE1( self, main ):
         """
         Startup sequence:
+        apply cell <name>
         git pull
         mvn clean install
         onos-package
-        apply cell <name>
         onos-verify-cell
         onos-uninstall
-		onos-install
+        onos-install
         onos-start-cli
         """
         import time
@@ -29,7 +29,6 @@
         main.threadID = 0
         main.pingTimeout = 300
         main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
-        cell_name = main.params[ 'ENV' ][ 'cellName' ]
         git_pull = main.params[ 'GIT' ][ 'autoPull' ]
         git_branch = main.params[ 'GIT' ][ 'branch' ]
         karafTimeout = main.params['CTRL']['karafCliTimeout']
@@ -44,6 +43,21 @@
         main.log.report( "Set up test environment" )
         main.log.report( "_______________________" )
 
+        main.step( "Apply Cell environment for ONOS" )
+        if ( main.onoscell ):
+            cellName = main.onoscell
+            cell_result = main.ONOSbench.setCell( cellName )
+            onosNodes = main.ONOSbench.getOnosIPfromCell()
+            main.onosIPs = onosNodes
+            utilities.assert_equals( expect=main.TRUE, actual=cell_result,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+        else:
+            main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
+            main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
+            main.clean()
+            main.exit()
+
         main.step( "Git checkout and pull " + git_branch )
         if git_pull == 'on':
             checkout_result = main.ONOSbench.gitCheckout( git_branch )
@@ -70,14 +84,6 @@
 
         main.ONOSbench.getVersion( report=True )
 
-        main.step( "Apply Cell environment for ONOS" )
-        cell_result = main.ONOSbench.setCell( cell_name )
-        onosNodes = main.ONOSbench.getOnosIPfromCell()
-        main.onosIPs = onosNodes
-        utilities.assert_equals( expect=main.TRUE, actual=cell_result,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
         main.step( "Create ONOS package" )
         packageResult = main.ONOSbench.onosPackage()
         utilities.assert_equals( expect=main.TRUE, actual=packageResult,
@@ -820,7 +826,7 @@
         main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
 
         intentResult = main.TRUE
-        intentsJson = main.ONOScli2.intents()
+        intentsJson = main.ONOScli1.intents()
         getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
                 intentsJson = intentsJson)
         print "len of intent ID", str(len(intentIdList))
@@ -849,8 +855,6 @@
                                  onfail="PING ALL FAIL" )
 
         case60Result = ( intentResult and pingResult )
-        waitForDebug = int (main.params[ 'ENV' ][ 'debugWait' ])
-        time.sleep(waitForDebug)
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case60Result,
@@ -892,7 +896,7 @@
         time2 = time.time()
         main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
         intentResult = main.TRUE
-        intentsJson = main.ONOScli2.intents()
+        intentsJson = main.ONOScli1.intents()
         getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
                 intentsJson = intentsJson)
         print getIntentStateResult
@@ -953,7 +957,7 @@
         time2 = time.time()
         main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
         intentResult = main.TRUE
-        intentsJson = main.ONOScli2.intents()
+        intentsJson = main.ONOScli1.intents()
         getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
                 intentsJson = intentsJson)
         print getIntentStateResult
@@ -1030,7 +1034,7 @@
                 OPTION="down" )
             time.sleep( link_sleep )
 
-        topology_output = main.ONOScli2.topology()
+        topology_output = main.ONOScli1.topology()
         linkDown = main.ONOSbench.checkStatus(
             topology_output, main.numMNswitches, str(
                 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
@@ -1096,7 +1100,7 @@
                 OPTION="up" )
             time.sleep( link_sleep )
 
-        topology_output = main.ONOScli2.topology()
+        topology_output = main.ONOScli1.topology()
         linkUp = main.ONOSbench.checkStatus(
             topology_output,
             main.numMNswitches,
@@ -1178,7 +1182,7 @@
                 OPTION="down" )
             time.sleep( link_sleep )
 
-        topology_output = main.ONOScli2.topology()
+        topology_output = main.ONOScli1.topology()
         linkDown = main.ONOSbench.checkStatus(
             topology_output, main.numMNswitches, str(
                 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
@@ -1244,7 +1248,7 @@
                 OPTION="up" )
             time.sleep( link_sleep )
 
-        topology_output = main.ONOScli2.topology()
+        topology_output = main.ONOScli1.topology()
         linkUp = main.ONOSbench.checkStatus(
             topology_output,
             main.numMNswitches,
@@ -1303,7 +1307,7 @@
                 OPTION="down")
             time.sleep( link_sleep )
 
-        topology_output = main.ONOScli2.topology()
+        topology_output = main.ONOScli1.topology()
         linkDown = main.ONOSbench.checkStatus(
             topology_output, main.numMNswitches, str(
                 int( main.numMNlinks ) - 5 * 2 ) )
@@ -1356,7 +1360,7 @@
                 OPTION="up")
             time.sleep( link_sleep )
 
-        topology_output = main.ONOScli2.topology()
+        topology_output = main.ONOScli1.topology()
         linkUp = main.ONOSbench.checkStatus(
             topology_output,
             main.numMNswitches,
@@ -1415,7 +1419,7 @@
                 OPTION="down")
             time.sleep( link_sleep )
 
-        topology_output = main.ONOScli2.topology()
+        topology_output = main.ONOScli1.topology()
         linkDown = main.ONOSbench.checkStatus(
             topology_output, main.numMNswitches, str(
                 int( main.numMNlinks ) - 5 * 2 ) )
@@ -1468,7 +1472,7 @@
                 OPTION="up")
             time.sleep( link_sleep )
 
-        topology_output = main.ONOScli2.topology()
+        topology_output = main.ONOScli1.topology()
         linkUp = main.ONOSbench.checkStatus(
             topology_output,
             main.numMNswitches,
@@ -1522,13 +1526,15 @@
         main.log.report( "___________________________________________________________________________" )
         
         linkIndex = range(4)
-        linkIndexS9 = random.sample(linkIndex,1)[0] 
+        linkIndexS9 = random.sample(linkIndex,1)[0]
         linkIndex.remove(linkIndexS9)
         linkIndexS10 = random.sample(linkIndex,1)[0]
         main.randomLink1 = link1End2top[linkIndexS9]
         main.randomLink2 = link2End2top[linkIndexS10]
         main.randomLink3 = random.sample(link1End2bot,1)[0]
         main.randomLink4 = random.sample(link2End2bot,1)[0]
+
+        # Work around for link state propagation delay. Added some sleep time.
         # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
         # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
         main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
@@ -1536,7 +1542,7 @@
         main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
         time.sleep( link_sleep )
 
-        topology_output = main.ONOScli2.topology()
+        topology_output = main.ONOScli1.topology()
         linkDown = main.ONOSbench.checkStatus(
             topology_output, main.numMNswitches, str(
                 int( main.numMNlinks ) - 8 ))
@@ -1581,15 +1587,16 @@
             "__________________________________________________________________" )
         main.case(
             "Host intents - Bring the core links up that are down and verify ping all" )
-        
-        #main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
-        #main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
+
+        # Work around for link state propagation delay. Added some sleep time.
+        # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
+        # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
         main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
         time.sleep( link_sleep )
         main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
         time.sleep( link_sleep )
 
-        topology_output = main.ONOScli2.topology()
+        topology_output = main.ONOScli1.topology()
         linkUp = main.ONOSbench.checkStatus(
             topology_output,
             main.numMNswitches,
@@ -1646,7 +1653,6 @@
                         name="addPointIntent",
                         args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4",main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
                 pool.append(t)
-                #time.sleep(1)
                 t.start()
                 i = i + 1
                 main.threadID = main.threadID + 1
@@ -1654,9 +1660,9 @@
                 thread.join()
                 intentIdList.append(thread.result)
         time2 = time.time()
-        main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) 
+        main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
         intentResult = main.TRUE
-        intentsJson = main.ONOScli2.intents()
+        intentsJson = main.ONOScli1.intents()
         getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
                 intentsJson = intentsJson)
         print getIntentStateResult
@@ -1717,9 +1723,9 @@
                 thread.join()
                 intentIdList.append(thread.result)
         time2 = time.time()
-        main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) 
+        main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
         intentResult = main.TRUE
-        intentsJson = main.ONOScli2.intents()
+        intentsJson = main.ONOScli1.intents()
         getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
                 intentsJson = intentsJson)
         print getIntentStateResult
@@ -1783,9 +1789,9 @@
                 thread.join()
                 intentIdList.append(thread.result)
         time2 = time.time()
-        main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) 
+        main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
         intentResult = main.TRUE
-        intentsJson = main.ONOScli2.intents()
+        intentsJson = main.ONOScli1.intents()
         getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
                 intentsJson = intentsJson)
         #print getIntentStateResult
@@ -2139,7 +2145,6 @@
             "\r\r",
              "" )
         intentsList = intentsList.splitlines()
-        #intentsList = intentsList[ 1: ]
         intentIdList = []
         step1Result = main.TRUE
         moreIntents = main.TRUE
@@ -2150,7 +2155,7 @@
             results = main.TRUE
             main.log.info("Removing intent...")
             while moreIntents:
-			#This is a work around for a major issue. We cycle through intents removal for up to 5 times.
+            # This is a work around only: cycle through intents removal for up to 5 times.
                 if removeIntentCount == 5:
                     break
                 removeIntentCount = removeIntentCount + 1
@@ -2167,7 +2172,6 @@
                     "\r\r",
                     "" )
                 intentsList1 = intentsList1.splitlines()
-                #intentsList1 = intentsList1[ 1: ]
                 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
                 print intentsList1
                 intentIdList1 = []
@@ -2200,7 +2204,7 @@
                     main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
                     time.sleep(10)
                     main.log.info("Purging WITHDRAWN Intents")
-                    purgeResult  = main.ONOScli2.purgeWithdrawnIntents()
+                    purgeResult  = main.ONOScli1.purgeWithdrawnIntents()
                 else:
                     time.sleep(10)
                     if len( main.ONOScli1.intents()):
@@ -2228,7 +2232,6 @@
         import copy
         import time
 
-        Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
         threadID = 0
 
         main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
@@ -2237,7 +2240,7 @@
         main.step( "Enable intent based Reactive forwarding" )
         installResult = main.FALSE
         feature = "onos-app-ifwd"
-        
+
         pool = []
         time1 = time.time()
         for cli,feature in main.CLIs:
@@ -2313,63 +2316,3 @@
         utilities.assert_equals( expect=main.TRUE, actual=case11Result,
                                  onpass="Intent based Reactive forwarding Pingall test PASS",
                                  onfail="Intent based Reactive forwarding Pingall test FAIL" )
-
-    def CASE99(self):
-        import time
-        # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
-        main.step( "Stop ONOS on all Nodes" )
-        stopResult = main.TRUE
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
-            sresult = main.ONOSbench.onosStop( ONOS_ip )
-            utilities.assert_equals( expect=main.TRUE, actual=sresult,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            stopResult = ( stopResult and sresult )
-
-        main.step( "Start ONOS on all Nodes" )
-        startResult = main.TRUE
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
-            sresult = main.ONOSbench.onosStart( ONOS_ip )
-            utilities.assert_equals( expect=main.TRUE, actual=sresult,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            startResult = ( startResult and sresult )
-    
-        main.step( "Start ONOS CLI on all nodes" )
-        cliResult = main.TRUE
-        time.sleep( 30 )
-        main.log.step(" Start ONOS cli using thread ")
-        pool = []
-        time1 = time.time()
-        for i in range( int( main.numCtrls ) ):
-            t = main.Thread(target=main.CLIs[i].startOnosCli,
-                    threadID=main.threadID,
-                    name="startOnosCli",
-                    args=main.onosIPs[i])
-            pool.append(t)
-            t.start()
-            main.threadID = main.threadID + 1
-        for t in pool:
-            t.join()
-            cliResult = cliResult and t.result
-        time2 = time.time()
-        
-        if not cliResult:
-                main.log.info("ONOS CLI did not start up properly")
-                #main.cleanup()
-                #main.exit()
-        else:
-            main.log.info("Successful CLI startup")
-        main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
-
-        case99Result = ( startResult and cliResult )
-        time.sleep(30)
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case99Result,
-            onpass="Starting new Chordal topology test PASS",
-            onfail="Starting new Chordal topology test FAIL" )
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/CHOtest/CHOtest.topo
similarity index 96%
rename from TestON/tests/OnosCHO/OnosCHO.topo
rename to TestON/tests/CHOtest/CHOtest.topo
index 76205b0..8b596e7 100644
--- a/TestON/tests/OnosCHO/OnosCHO.topo
+++ b/TestON/tests/CHOtest/CHOtest.topo
@@ -40,7 +40,7 @@
         </ONOScli3>
 
         <Mininet1>
-            <host>chONOS-MN</host>
+            <host>OCN</host>
             <user>admin</user>
             <password></password>
             <type>MininetCliDriver</type>
diff --git a/TestON/tests/OnosCHO/Dependencies/topoAtt.py b/TestON/tests/CHOtest/Dependencies/topoAtt.py
similarity index 100%
rename from TestON/tests/OnosCHO/Dependencies/topoAtt.py
rename to TestON/tests/CHOtest/Dependencies/topoAtt.py
diff --git a/TestON/tests/OnosCHO/Dependencies/topoChordal.py b/TestON/tests/CHOtest/Dependencies/topoChordal.py
similarity index 100%
rename from TestON/tests/OnosCHO/Dependencies/topoChordal.py
rename to TestON/tests/CHOtest/Dependencies/topoChordal.py
diff --git a/TestON/tests/OnosCHO/Dependencies/topoSpine.py b/TestON/tests/CHOtest/Dependencies/topoSpine.py
similarity index 100%
rename from TestON/tests/OnosCHO/Dependencies/topoSpine.py
rename to TestON/tests/CHOtest/Dependencies/topoSpine.py
diff --git a/TestON/tests/OnosCHO/README b/TestON/tests/CHOtest/README
similarity index 100%
rename from TestON/tests/OnosCHO/README
rename to TestON/tests/CHOtest/README
diff --git a/TestON/tests/OnosCHO/__init__.py b/TestON/tests/CHOtest/__init__.py
similarity index 100%
rename from TestON/tests/OnosCHO/__init__.py
rename to TestON/tests/CHOtest/__init__.py
diff --git a/TestON/tests/SCPFcbench/README b/TestON/tests/SCPFcbench/README
new file mode 100644
index 0000000..755caf1
--- /dev/null
+++ b/TestON/tests/SCPFcbench/README
@@ -0,0 +1,4 @@
+Summary: This is a performance test suite to test onos single instance with Cbench TP mode.
+Pre-requisites: OC1 - is the single onos cell also has cbench pre-installed for all users; 
+                this env variable is required on the TestStation. Passwordless login is set
+                from TestStation "admin" root user.
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.params b/TestON/tests/SCPFcbench/SCPFcbench.params
index 8a11b56..3e92294 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.params
+++ b/TestON/tests/SCPFcbench/SCPFcbench.params
@@ -33,6 +33,10 @@
         <user>admin</user>
         <ip1>localhost</ip1>
     </BENCH>
+    
+    <CBENCH>
+        <user>sdn</user>
+    </CBENCH>
 
     <JSON>
     </JSON>
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.py b/TestON/tests/SCPFcbench/SCPFcbench.py
index 79cdce2..fd15862 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.py
+++ b/TestON/tests/SCPFcbench/SCPFcbench.py
@@ -19,6 +19,8 @@
         import time 
         import os                    
         global init       
+        main.case("pre-condition for cbench test.")
+
         try: 
             if type(init) is not bool: 
                 init = False  
@@ -30,7 +32,8 @@
         gitPull = main.params[ 'GIT' ][ 'autopull' ]
         BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
         BENCHUser = main.params[ 'BENCH' ][ 'user' ]
-        MN1Ip = main.params[ 'MN' ][ 'ip1' ]
+        CBENCHuser = main.params[ 'CBENCH'][ 'user' ]
+        MN1Ip = os.environ[ main.params[ 'MN' ][ 'ip1' ] ]
         maxNodes = int(main.params[ 'availableNodes' ])
         skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]        
@@ -91,7 +94,7 @@
 
 
         print "Cellname is: "+ cellName + "ONOS IP is: " + str(ONOSIp)
-        main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,"drivers,openflow,fwd",ONOSIp[1])
+        main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,"drivers,openflow,fwd",[ONOSIp[1]])
  
         main.step( "Set Cell" )
         main.ONOSbench.setCell(cellName)
@@ -106,7 +109,7 @@
         main.step( "verify cells" )
         verifyCellResult = main.ONOSbench.verifyCell()
       
-        main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
+        main.log.report( "Initializing " + str( clusterCount ) + " node cluster." )
         for node in range(1, clusterCount + 1):
             main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
             main.ONOSbench.onosInstall( ONOSIp[node])
@@ -129,23 +132,31 @@
             check = main.ONOSbench.handle.before
             if "value=true" in check:
                 main.log.info("cfg set successful") 
+                stepResult = main.TRUE
                 break 
             if i == 4: 
-                main.log.info("Cfg set failed") 
+                main.log.info("Cfg set failed")
+                stepResult = main.FALSE
             else: 
                 time.sleep(5)
-                
+
+        utilities.assert_equals( expect=main.TRUE, 
+                                 actual=stepResult, 
+                                 onpass="Successfully configure onos for cbench test ", 
+                                 onfail="Failed to configure onos for cbench test" )
             
 
         
  
     def CASE2( self, main ):
-         
+        main.case("Running Cbench")
+        main.step("Issuing cbench commands and grab returned results")
+        validFlag = False
         mode = main.params[ 'TEST' ][ 'mode' ]
         if mode != "t":
             mode = " " 
 
-        runCbench = ( "ssh admin@" + ONOSIp[1] + " cbench -c localhost -p 6633 -m 1000 -l 25 -s 16 -M 100000 -w 15 -D 10000 -" + mode )
+        runCbench = ( "ssh " + CBENCHuser + "@" + ONOSIp[1] + " cbench -c localhost -p 6633 -m 1000 -l 25 -s 16 -M 100000 -w 15 -D 10000 -" + mode )
         main.ONOSbench.handle.sendline(runCbench)
         time.sleep(30)
         main.ONOSbench.handle.expect(":~") 
@@ -154,43 +165,52 @@
 
         output = output.splitlines()
         for line in output: 
-            if "RESULT: " in line: 
+            if "RESULT: " in line:
+                validFlag = True
                 print line
-                break 
-        
-        resultLine = line.split(" ") 
-        for word in resultLine:
-            if word == "min/max/avg/stdev": 
-                resultsIndex = resultLine.index(word)
-                print resultsIndex
-                break
+                resultLine = line.split(" ") 
+                for word in resultLine:
+                    if word == "min/max/avg/stdev": 
+                        resultsIndex = resultLine.index(word)
+                        print resultsIndex
+                        break
 
-        finalDataString = resultLine[resultsIndex + 2]
-        print finalDataString
-        finalDataList = finalDataString.split("/")
-        avg = finalDataList[2]
-        stdev = finalDataList[3]
+                finalDataString = resultLine[resultsIndex + 2]
+                print finalDataString
+                finalDataList = finalDataString.split("/")
+                avg = finalDataList[2]
+                stdev = finalDataList[3]
                                                      
-        main.log.info("Average: \t\t\t" + avg) 
-        main.log.info("Standard Deviation: \t" + stdev) 
+                main.log.info("Average: \t\t\t" + avg) 
+                main.log.info("Standard Deviation: \t" + stdev) 
+            
 
-        if mode == " ": 
-            mode = "l"
+                commit = main.ONOSbench.getVersion()
+                commit = (commit.split(" "))[1]
 
-        commit = main.ONOSbench.getVersion()
-        commit = (commit.split(" "))[1]
+                try:
+                    dbFileName="/tmp/CbenchDB"
+                    dbfile = open(dbFileName, "w+") 
+                    temp = "'" + commit + "'," 
+                    temp += "'" + mode + "'," 
+                    temp += "'" + avg + "',"
+                    temp += "'" + stdev + "'\n" 
+                    dbfile.write(temp)
+                    dbfile.close()
+                    main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d") 
+                except IOError:
+                    main.log.warn("Error opening " + dbFileName + " to write results.")
+                
+                stepResult = main.TRUE
+                break
+        if ( validFlag == False ):
+            main.log.warn("Cbench Test produced no valid results!!!!")
+            stepResult = main.FALSE
 
-        dbfile = open("CbenchDB", "w+") 
-        temp = "'" + commit + "'," 
-        temp += "'" + mode + "'," 
-        temp += "'" + avg + "',"
-        temp += "'" + stdev + "'\n" 
-        dbfile.write(temp)
-        dbfile.close()
-        main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d") 
-
-
-
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully tested onos for cbench. ",
+                                 onfail="Failed to obtain valid onos cbench result!" )
 
 
 
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.topo b/TestON/tests/SCPFcbench/SCPFcbench.topo
index cae9c93..7299023 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.topo
+++ b/TestON/tests/SCPFcbench/SCPFcbench.topo
@@ -5,25 +5,19 @@
         <ONOSbench>
             <host>localhost</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
-            <COMPONENTS><home>~/onos</home></COMPONENTS>
+            <COMPONENTS>
+                <home>~/onos</home>
+                <nodes>1</nodes>
+            </COMPONENTS>
         </ONOSbench>
 
-        <ONOS1cli>
-            <host>OCN</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1cli>
-
         <ONOS1>
             <host>OC1</host>
             <user>sdn</user>
-            <password>rocks</password>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>9</connect_order>
             <COMPONENTS> </COMPONENTS>
diff --git a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.params b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.params
index a3b104f..25a7b5c 100644
--- a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.params
+++ b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.params
@@ -4,7 +4,7 @@
     
     <isOnBaremetal>True</isOnBaremetal>
     <SCALE>1,3,3,5,5,7,7</SCALE>
-    <availableNodes>7</availableNodes>
+    <max>7</max>
     
 
 
@@ -64,7 +64,7 @@
 
     <BENCH>
         <user>admin</user>
-        <ip1>OCN</ip1>
+        <ip1>localhost</ip1>
     </BENCH>
 
     <JSON>
diff --git a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
index 0a3e0aa..6cc65ab 100644
--- a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.py
@@ -29,7 +29,8 @@
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         Apps = main.params[ 'ENV' ][ 'cellApps' ]
         BENCHUser = main.params[ 'BENCH' ][ 'user' ]
-        maxNodes = int(main.params[ 'availableNodes' ])
+        BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+        main.maxNodes = int(main.params[ 'max' ])
         skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]       
     
@@ -49,7 +50,7 @@
             clusterCount = int(scale[0])
 
             #Populate ONOSIp with ips from params
-            for i in range(1, maxNodes + 1):
+            for i in range(1, main.maxNodes + 1):
                 ipString = 'ip' + str(i)
                 ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
 
@@ -83,18 +84,15 @@
         scale.remove(scale[0])
         main.log.info("CLUSTER COUNT: " + str(clusterCount))
 
-        MN1Ip = ONOSIp[len(ONOSIp)-1]
-        BENCHIp = ONOSIp[len(ONOSIp)-2]
-
         #kill off all onos processes 
         main.log.step("Safety check, killing all ONOS processes")
         main.log.step("before initiating enviornment setup")
-        for node in range(1, maxNodes + 1):
+        for node in range(1, main.maxNodes + 1):
             main.ONOSbench.onosDie(ONOSIp[node])
 
         #Uninstall everywhere
         main.log.step( "Cleaning Enviornment..." )
-        for i in range(1, maxNodes + 1):
+        for i in range(1, main.maxNodes + 1):
             main.log.info(" Uninstalling ONOS " + str(i) )
             main.ONOSbench.onosUninstall( ONOSIp[i] )
 
@@ -104,7 +102,7 @@
         for node in range (1, clusterCount + 1):
             cellIp.append(ONOSIp[node])        
         
-        main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
+        main.ONOSbench.createCellFile(BENCHIp,cellName,"localhost",str(Apps), cellIp)
         main.log.info("Cell Ip list: " + str(cellIp))
         
         main.step( "Set Cell" )
@@ -135,8 +133,7 @@
             a(ONOSIp[node])
          
         main.log.info("Startup sequence complete")
-        main.ONOSbench.onosErrorLog(ONOSIp[1])
-        
+        main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d") 
     def CASE2( self, main ):
         #
         # This is the flow TP test 
@@ -166,14 +163,13 @@
         neighborList = (main.params[ 'TEST' ][ 'neighbors' ]).split(",")
         testCMD[0] = main.params[ 'TEST' ][ 'testCMD0' ]
         testCMD[1] = main.params[ 'TEST' ][ 'testCMD1' ]
-        maxNodes = main.params[ 'availableNodes' ]
+        main.maxNodes = main.params[ 'max' ]
         onBaremetal = main.params['isOnBaremetal']
         cooldown = main.params[ 'TEST' ][ 'cooldown' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
         BENCHUser = main.params[ 'BENCH' ][ 'user' ]
         MN1Ip = main.params[ 'MN' ][ 'ip1' ]
-        maxNodes = int(main.params[ 'availableNodes' ])
         homeDir = os.path.expanduser('~')
         flowRuleBackup = str(main.params[ 'TEST' ][ 'enableFlowRuleStoreBackup' ])
         main.log.info("Flow Rule Backup is set to:" + flowRuleBackup)
@@ -197,20 +193,7 @@
 
         #write file to change mem limit to 32 gigs (BAREMETAL ONLY!)
         if onBaremetal == "true":
-            filename = "/onos/tools/package/bin/onos-service"
-            serviceConfig = open(homeDir + filename, 'w+')
-            serviceConfig.write("#!/bin/bash\n ")
-            serviceConfig.write("#------------------------------------- \n ")
-            serviceConfig.write("# Starts ONOS Apache Karaf container\n ")
-            serviceConfig.write("#------------------------------------- \n ")
-            serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ")
-            serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G}" \n """)
-            serviceConfig.write("")
-            serviceConfig.write("ONOS_HOME=/opt/onos \n ")
-            serviceConfig.write("")
-            serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n")
-            serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """)
-            serviceConfig.close()
+            main.ONOSbench.jvmSet()
 
         for n in neighborList:
             main.log.step("\tSTARTING TEST")
@@ -220,10 +203,10 @@
             main.log.info("=============================================================")
             #write file to configure nil link
             ipCSV = ""
-            for i in range (1, int(maxNodes) + 1):
+            for i in range (1, int(main.maxNodes) + 1):
                 tempstr = "ip" + str(i)
                 ipCSV += main.params[ 'CTRL' ][ tempstr ] 
-                if i < int(maxNodes):
+                if i < int(main.maxNodes):
                     ipCSV +=","
             
             for i in range(3):
@@ -313,7 +296,8 @@
                 if test >= warmUp:
                     for i in result: 
                         if i == "": 
-                            main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
+                            main.log.error("Missing data point, critical failure incoming")
+
                     print result
                     maxes[test-warmUp] = max(result)
                     main.log.info("Data collection iteration: " + str(test-warmUp) + " of " + str(sampleSize))
diff --git a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.topo b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.topo
index d82f3fd..01370b6 100644
--- a/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.topo
+++ b/TestON/tests/SCPFflowTp1g/SCPFflowTp1g.topo
@@ -3,16 +3,19 @@
     <COMPONENT>
 
         <ONOSbench>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
-            <COMPONENTS><home>~/onos</home></COMPONENTS>
+            <COMPONENTS>
+                <home>~/onos</home>
+                <nodes>7</nodes> 
+            </COMPONENTS>
         </ONOSbench>
 
         <ONOS1cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -21,7 +24,7 @@
         </ONOS1cli>
 
         <ONOS2cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -30,7 +33,7 @@
         </ONOS2cli>
 
         <ONOS3cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -39,7 +42,7 @@
         </ONOS3cli>
 
         <ONOS4cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -48,7 +51,7 @@
         </ONOS4cli>
 
         <ONOS5cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -57,7 +60,7 @@
         </ONOS5cli>
 
         <ONOS6cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -66,7 +69,7 @@
         </ONOS6cli>
 
         <ONOS7cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
diff --git a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.params b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.params
index eefe54b..d1689de 100644
--- a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.params
+++ b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.params
@@ -11,7 +11,7 @@
     </ENV>
 
     <SCALE>1,3,3,5,5,7,7</SCALE>
-    <availableNodes>7</availableNodes>
+    <max>7</max>
 
     <GIT>
         <autopull>off</autopull>
diff --git a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
index 6fe4f73..053556a 100644
--- a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
@@ -34,7 +34,8 @@
         BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
         BENCHUser = main.params[ 'BENCH' ][ 'user' ]
         MN1Ip = main.params[ 'MN' ][ 'ip1' ]
-        maxNodes = int(main.params[ 'availableNodes' ])
+        maxNodes = int(main.params[ 'max' ])
+        main.maxNodes = maxNodes 
         skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",")
@@ -55,7 +56,10 @@
             global commit
 
             clusterCount = 0
-            ONOSIp = []
+            ONOSIp = main.ONOSbench.getOnosIps()
+            print ONOSIp
+            print main.ONOSbench.onosIps.values()
+
             scale = (main.params[ 'SCALE' ]).split(",")            
             clusterCount = int(scale[0])
 
@@ -76,15 +80,20 @@
                 checkoutResult = main.TRUE
                 pullResult = main.TRUE
                 main.log.info( "Skipped git checkout and pull" )
-        
+
+            main.log.step("Grabbing commit number") 
             commit = main.ONOSbench.getVersion()
             commit = (commit.split(" "))[1]
         
+            main.log.step("Creating results file") 
             resultsDB = open("IntentEventTPDB", "w+")
             resultsDB.close()
 
         # -- END OF INIT SECTION --#
-         
+
+        main.log.step("Adjusting scale") 
+        print str(scale) 
+        print str(ONOSIp)
         clusterCount = int(scale[0])
         scale.remove(scale[0])       
        
@@ -116,7 +125,7 @@
         for node in range (clusterCount):
             cellIp.append(ONOSIp[node])
          
-        main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
+        main.ONOSbench.createCellFile("localhost",cellName,MN1Ip,str(Apps), cellIp)
 
         main.step( "Set Cell" )
         main.ONOSbench.setCell(cellName)
diff --git a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.topo b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.topo
index d82f3fd..01370b6 100644
--- a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.topo
+++ b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.topo
@@ -3,16 +3,19 @@
     <COMPONENT>
 
         <ONOSbench>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
-            <COMPONENTS><home>~/onos</home></COMPONENTS>
+            <COMPONENTS>
+                <home>~/onos</home>
+                <nodes>7</nodes> 
+            </COMPONENTS>
         </ONOSbench>
 
         <ONOS1cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -21,7 +24,7 @@
         </ONOS1cli>
 
         <ONOS2cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -30,7 +33,7 @@
         </ONOS2cli>
 
         <ONOS3cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -39,7 +42,7 @@
         </ONOS3cli>
 
         <ONOS4cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -48,7 +51,7 @@
         </ONOS4cli>
 
         <ONOS5cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -57,7 +60,7 @@
         </ONOS5cli>
 
         <ONOS6cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -66,7 +69,7 @@
         </ONOS6cli>
 
         <ONOS7cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
diff --git a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
index 8aad63b..3aa47d8 100644
--- a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
+++ b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
@@ -3,7 +3,7 @@
     <testcases>1,2,1,2,1,2,1,2</testcases>
 
     <SCALE>1,3,5,7</SCALE>
-    <availableNodes>7</availableNodes>
+    <max>7</max>
  
     <ENV>
         <cellName>IntentInstallWithdrawCell</cellName>
@@ -52,12 +52,12 @@
     </CTRL>
 
     <MN>
-        <ip1>OCN</ip1>
+        <ip1>localhost</ip1>
     </MN>
 
     <BENCH>
         <user>admin</user>
-        <ip1>OCN</ip1>
+        <ip1>localhost</ip1>
     </BENCH>
 
     <JSON>
diff --git a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
index 34e9a8d..d9179cf 100644
--- a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
+++ b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
@@ -31,7 +31,7 @@
         BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
         BENCHUser = main.params[ 'BENCH' ][ 'user' ]
         MN1Ip = main.params[ 'MN' ][ 'ip1' ]
-        maxNodes = int(main.params[ 'availableNodes' ])
+        main.maxNodes = int(main.params[ 'max' ])
         skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]        
         switchCount = main.params[ 'TEST' ][ 'switchCount' ]
@@ -79,18 +79,15 @@
         clusterCount = int(scale[0])
         scale.remove(scale[0])       
 
-        MN1Ip = ONOSIp[len(ONOSIp)-1]
-        BENCHIp = ONOSIp[len(ONOSIp)-2]
-
         #kill off all onos processes 
         main.log.step("Safety check, killing all ONOS processes")
         main.log.step("before initiating enviornment setup")
-        for node in range(1, maxNodes + 1):
+        for node in range(1, main.maxNodes + 1):
             main.ONOSbench.onosDie(ONOSIp[node])
         
         #Uninstall everywhere
         main.log.step( "Cleaning Enviornment..." )
-        for i in range(1, maxNodes + 1):
+        for i in range(1, main.maxNodes + 1):
             main.log.info(" Uninstalling ONOS " + str(i) )
             main.ONOSbench.onosUninstall( ONOSIp[i] )
        
@@ -100,7 +97,7 @@
         for node in range (1, clusterCount + 1):
             cellIp.append(ONOSIp[node])
 
-        main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
+        main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), cellIp)
 
         main.step( "Set Cell" )
         main.ONOSbench.setCell(cellName)
diff --git a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo
index d82f3fd..01370b6 100644
--- a/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo
+++ b/TestON/tests/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo
@@ -3,16 +3,19 @@
     <COMPONENT>
 
         <ONOSbench>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
-            <COMPONENTS><home>~/onos</home></COMPONENTS>
+            <COMPONENTS>
+                <home>~/onos</home>
+                <nodes>7</nodes> 
+            </COMPONENTS>
         </ONOSbench>
 
         <ONOS1cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -21,7 +24,7 @@
         </ONOS1cli>
 
         <ONOS2cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -30,7 +33,7 @@
         </ONOS2cli>
 
         <ONOS3cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -39,7 +42,7 @@
         </ONOS3cli>
 
         <ONOS4cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -48,7 +51,7 @@
         </ONOS4cli>
 
         <ONOS5cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -57,7 +60,7 @@
         </ONOS5cli>
 
         <ONOS6cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -66,7 +69,7 @@
         </ONOS6cli>
 
         <ONOS7cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
diff --git a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.params b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.params
index 2e43679..896ef7f 100644
--- a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.params
+++ b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.params
@@ -3,7 +3,7 @@
     <testcases>1,2,1,2,1,2,1,2</testcases>
 
     <SCALE>1,3,5,7</SCALE>
-    <availableNodes>7</availableNodes>
+    <max>7</max>
  
     <ENV>
         <cellName>intentRerouteCell</cellName>
@@ -65,12 +65,12 @@
     </CTRL>
 
     <MN>
-        <ip1>OCN</ip1>
+        <ip1>localhost</ip1>
     </MN>
 
     <BENCH>
         <user>admin</user>
-        <ip1>OCN</ip1>
+        <ip1>localhost</ip1>
     </BENCH>
 
     <JSON>
diff --git a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index cc8892e..8bbf003 100644
--- a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -30,7 +30,9 @@
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         Apps = main.params[ 'ENV' ][ 'cellApps' ]
         BENCHUser = main.params[ 'BENCH' ][ 'user' ]
-        maxNodes = int(main.params[ 'availableNodes' ])
+        BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+        MN1Ip = main.params[ 'MN' ][ 'ip1' ]
+        main.maxNodes = int(main.params[ 'max' ])
         skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
         cellName = main.params[ 'ENV' ][ 'cellName' ]
 
@@ -78,18 +80,15 @@
         clusterCount = int(scale[0])
         scale.remove(scale[0])       
       
-        MN1Ip = ONOSIp[len(ONOSIp)-1]
-        BENCHIp = ONOSIp[len(ONOSIp)-2]
-
         #kill off all onos processes 
         main.log.step("Safety check, killing all ONOS processes")
         main.log.step("before initiating enviornment setup")
-        for node in range(1, maxNodes + 1):
+        for node in range(1, main.maxNodes + 1):
             main.ONOSbench.onosDie(ONOSIp[node])
         
         #Uninstall everywhere
         main.log.step( "Cleaning Enviornment..." )
-        for i in range(1, maxNodes + 1):
+        for i in range(1, main.maxNodes + 1):
             main.log.info(" Uninstalling ONOS " + str(i) )
             main.ONOSbench.onosUninstall( ONOSIp[i] )
        
@@ -98,8 +97,8 @@
         cellIp = []
         for node in range (1, clusterCount + 1):
             cellIp.append(ONOSIp[node])
-        
-        main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
+
+        main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), cellIp)
 
         main.step( "Set Cell" )
         main.ONOSbench.setCell(cellName)
@@ -342,8 +341,6 @@
                 main.ONOSbench.handle.sendline(cmd)
                 main.ONOSbench.handle.expect(":~")
                 
-                
-                
                 #wait for intent withdraw
                 main.ONOSbench.handle.sendline(withdrawCmd)
                 main.log.info(withdrawCmd) 
diff --git a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.topo b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.topo
index d82f3fd..01370b6 100644
--- a/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.topo
+++ b/TestON/tests/SCPFintentRerouteLat/SCPFintentRerouteLat.topo
@@ -3,16 +3,19 @@
     <COMPONENT>
 
         <ONOSbench>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
-            <COMPONENTS><home>~/onos</home></COMPONENTS>
+            <COMPONENTS>
+                <home>~/onos</home>
+                <nodes>7</nodes> 
+            </COMPONENTS>
         </ONOSbench>
 
         <ONOS1cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -21,7 +24,7 @@
         </ONOS1cli>
 
         <ONOS2cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -30,7 +33,7 @@
         </ONOS2cli>
 
         <ONOS3cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -39,7 +42,7 @@
         </ONOS3cli>
 
         <ONOS4cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -48,7 +51,7 @@
         </ONOS4cli>
 
         <ONOS5cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -57,7 +60,7 @@
         </ONOS5cli>
 
         <ONOS6cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -66,7 +69,7 @@
         </ONOS6cli>
 
         <ONOS7cli>
-            <host>OCN</host>
+            <host>localhost</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>