Merge branch 'HA' of https://github.com/OPENNETWORKINGLAB/ONLabTest into HA_merge

Conflicts:
	TestON/drivers/common/cli/onosclidriver.py
diff --git a/TestON/core/Thread.py b/TestON/core/Thread.py
new file mode 100644
index 0000000..e20abc3
--- /dev/null
+++ b/TestON/core/Thread.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+import threading
+
+class Thread(threading.Thread):
+    def __init__(self, target = None, threadID=None, name="", args=(), kwargs={}):
+        super(Thread, self).__init__()
+        self.threadID = threadID
+        self.name = name
+        self.target = target
+        self.args = args
+        self.kwargs = kwargs
+        self.result = None
+
+    def run( self ):
+        try:
+            if self.target is not None:
+                if len(self.args) != 0:
+                    self.result = self.target( *self.args )
+                else:
+                    self.result = self.target()
+        except Exception as e:
+            print "Thread-" + str(self.threadID) + \
+                  ":something went wrong with " + self.name + " method"
+            print e
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 142505a..3b5985b 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -31,6 +31,7 @@
 import __builtin__
 import new
 import xmldict
+import importlib
 module = new.module("test")
 import openspeak
 global path, drivers_path, core_path, tests_path,logs_path
@@ -46,6 +47,7 @@
 sys.path.append(tests_path)
 
 from core.utilities import Utilities
+from core.Thread import Thread
 
 
 class TestON:
@@ -87,6 +89,7 @@
         self.loggerClass = "Logger"
         self.logs_path = logs_path
         self.driver = ''
+        self.Thread = Thread
 	
         
         self.configparser()
@@ -146,7 +149,6 @@
         '''
         This method will initialize specified component
         '''
-        import importlib
         global driver_options
         self.log.info("Creating component Handle: "+component)
         driver_options = {}
@@ -447,7 +449,7 @@
                 import json
                 response_dict = json.loads(response)
             except Exception, e:
-                main.log.exception(e)
+                main.log.exception( e )
                 main.log.error("Json Parser is unable to parse the string")
             return response_dict
         
@@ -465,7 +467,7 @@
             try :
                 response_dict = xmldict.xml_to_dict("<response> "+str(response)+" </response>")
             except Exception, e:
-                main.log.exception(e)
+                main.log.exception( e )
             return response_dict
         
     def dict_to_return_format(self,response,return_format,response_dict):
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 4f40b07..d6702c7 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -19,6 +19,8 @@
 import sys
 import pexpect
 import re
+import json
+import types
 sys.path.append( "../" )
 from drivers.common.clidriver import CLI
 
@@ -80,18 +82,11 @@
         """
         response = main.TRUE
         try:
-            self.handle.sendline( "" )
-            i = self.handle.expect( [ "onos>", "\$" ] )
-            if i == 0:
-                self.handle.sendline( "system:shutdown" )
-                self.handle.expect( "Confirm" )
-                self.handle.sendline( "yes" )
-                self.handle.expect( "\$" )
+            self.logout()
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
             self.handle.sendline( "exit" )
             self.handle.expect( "closed" )
-
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
             response = main.FALSE
@@ -109,15 +104,15 @@
         """
         try:
             self.handle.sendline( "" )
-            i = self.handle.expect( [
-                "onos>",
-                "\$" ], timeout=10 )
-            if i == 0:
+            i = self.handle.expect( [ "onos>", "\$", pexpect.TIMEOUT ],
+                                    timeout=10 )
+            if i == 0:  # In ONOS CLI
                 self.handle.sendline( "logout" )
                 self.handle.expect( "\$" )
-            elif i == 1:
+            elif i == 1:  # not in CLI
                 return main.TRUE
-
+            elif i == 3:  # Timeout
+                return main.FALSE
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
             return None
@@ -482,9 +477,14 @@
         by issuing command: 'onos> feature:uninstall <feature_str>'
         """
         try:
-            cmdStr = "feature:uninstall " + str( featureStr )
-            self.sendline( cmdStr )
-            # TODO: Check for possible error responses from karaf
+            cmdStr = 'feature:list -i | grep "' + featureStr + '"'
+            handle = self.sendline( cmdStr )
+            if handle != '':
+                cmdStr = "feature:uninstall " + str( featureStr )
+                self.sendline( cmdStr )
+                # TODO: Check for possible error responses from karaf
+            else:
+                main.log.info( "Feature needs to be installed before uninstalling it" )
             return main.TRUE
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
@@ -711,7 +711,6 @@
         None if no match
         """
         try:
-            import json
             if deviceId is None:
                 return None
             else:
@@ -743,7 +742,6 @@
                  main.FALSE any device has no master
         """
         try:
-            import json
             rawRoles = self.roles()
             rolesJson = json.loads( rawRoles )
             # search json for the device with id then return the device
@@ -847,7 +845,6 @@
 
         Return None if there is no match
         """
-        import json
         try:
             if mac is None:
                 return None
@@ -1296,16 +1293,26 @@
             main.cleanup()
             main.exit()
 
-    def removeIntent( self, intentId ):
+    def removeIntent( self, intentId, app = 'org.onosproject.cli',
+        purge = False, sync = False ):
         """
-        Remove intent for specified intent id
-
+        Remove intent for specified application id and intent id
+        Optional args:- 
+        -s or --sync: Waits for the removal before returning
+        -p or --purge: Purge the intent from the store after removal  
+        
         Returns:
             main.False on error and
             cli output otherwise
         """
         try:
-            cmdStr = "remove-intent org.onosproject.cli " + str( intentId )
+            cmdStr = "remove-intent "
+            if purge:
+                cmdStr += " -p"
+            if sync:
+                cmdStr += " -s"
+
+            cmdStr += " " + app + " " + str( intentId )
             handle = self.sendline( cmdStr )
             if re.search( "Error", handle ):
                 main.log.error( "Error in removing intent" )
@@ -1388,6 +1395,66 @@
             main.cleanup()
             main.exit()
 
+    def getIntentState(self, intentsId, intentsJson=None):
+        """
+            Check intent state.
+            Accepts a single intent ID (string type) or a list of intent IDs.
+            Returns the state(string type) of the id if a single intent ID is
+            accepted.
+            Returns a dictionary with intent IDs as the key and its corresponding
+            states as the values
+            Parameters:
+            intentId: intent ID (string type)
+            intentsJson: parsed json object from the onos:intents api
+            Returns:
+            state = An intent's state- INSTALL,WITHDRAWN etc.
+            stateDict = Dictionary of intent's state. intent ID as the keys and
+            state as the values.
+        """
+        try:
+            state = "State is Undefined"
+            if not intentsJson:
+                intentsJsonTemp = json.loads(self.intents())
+            else:
+                intentsJsonTemp = json.loads(intentsJson)
+            if isinstance(intentsId,types.StringType):
+                for intent in intentsJsonTemp:
+                    if intentsId == intent['id']:
+                        state = intent['state']
+                        return state
+                main.log.info("Cannot find intent ID" + str(intentsId) +" on the list")
+                return state
+            elif isinstance(intentsId,types.ListType):
+                dictList = []
+                for ID in intentsId:
+                    stateDict = {}
+                    for intents in intentsJsonTemp:
+                        if ID == intents['id']:
+                            stateDict['state'] = intents['state']
+                            stateDict['id'] = ID
+                            dictList.append(stateDict)
+                            break
+                if len(intentsId) != len(dictList):
+                    main.log.info("Cannot find some of the intent ID state")
+                return dictList
+            else:
+                main.log.info("Invalid intents ID entry")
+                return None
+            main.log.info("Something went wrong getting intent ID state")
+            return None
+        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:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
     def flows( self, jsonFormat=True ):
         """
         Optional:
@@ -1579,6 +1646,26 @@
             main.cleanup()
             main.exit()
 
+    def FlowAddedCount( self, deviceId ):
+        """
+        Determine the number of flow rules for the given device id that are
+        in the added state
+        """
+        try:
+            cmdStr = "flows any " + str( deviceId ) + " | " +\
+                     "grep 'state=ADDED' | wc -l"
+            handle = self.sendline( cmdStr )
+            return handle
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
     def getAllDevicesId( self ):
         """
         Use 'devices' function to obtain list of all devices
@@ -1670,7 +1757,6 @@
         Return the first device from the devices api whose 'id' contains 'dpid'
         Return None if there is no match
         """
-        import json
         try:
             if dpid is None:
                 return None
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.params b/TestON/tests/IntentPerfNext/IntentPerfNext.params
index 7b3f876..90ef160 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.params
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.params
@@ -49,7 +49,7 @@
 
     <DB>
         <intentFilePath>
-        /home/admin/ONLabTest/TestON/tests/IntentPerfNext/intentInstallPathDb.log
+        /home/admin/ONLabTest/TestON/tests/IntentPerfNext/intentLatencyResultDb.log
         </intentFilePath>
     </DB>
 
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.py b/TestON/tests/IntentPerfNext/IntentPerfNext.py
index 422f1c9..cb226e7 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.py
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.py
@@ -375,6 +375,10 @@
         ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
         ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
         ONOSUser = main.params[ 'CTRL' ][ 'user' ]
+       
+        ONOSIpList = []
+        for i in range( 1, 8 ):
+            ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
 
         defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
 
@@ -391,6 +395,51 @@
 
         # NOTE: May need to configure interface depending on topology
         intfs = main.params[ 'TEST' ][ 'intfs' ]
+        
+        # Distribute switches according to cluster count
+        for i in range( 1, 9 ):
+            if clusterCount == 1:
+                main.Mininet1.assignSwController(
+                    sw=str( i ), ip1=ONOSIpList[ 0 ],
+                    port1=defaultSwPort
+                )
+            elif clusterCount == 3:
+                if i < 3:
+                    index = 0
+                elif i < 6 and i >= 3:
+                    index = 1
+                else:
+                    index = 2
+                main.Mininet1.assignSwController(
+                    sw=str( i ), ip1=ONOSIpList[ index ],
+                    port1=defaultSwPort
+                )
+            elif clusterCount == 5:
+                if i < 3:
+                    index = 0
+                elif i < 5 and i >= 3:
+                    index = 1
+                elif i < 7 and i >= 5:
+                    index = 2
+                elif i == 7:
+                    index = 3
+                else:
+                    index = 4
+                main.Mininet1.assignSwController(
+                    sw=str( i ), ip1=ONOSIpList[ index ],
+                    port1=defaultSwPort
+                )
+            elif clusterCount == 7:
+                if i < 6:
+                    index = i
+                else:
+                    index = 6
+                main.Mininet1.assignSwController(
+                    sw=str( i ), ip1=ONOSIpList[ index ],
+                    port1=defaultSwPort
+                )
+
+        time.sleep(10)
 
         devicesJsonStr = main.ONOS1cli.devices()
         devicesJsonObj = json.loads( devicesJsonStr )
@@ -418,14 +467,15 @@
             intentsStr = main.ONOS1cli.intents( jsonFormat=True )
             intentsObj = json.loads( intentsStr )
             for intent in intentsObj:
+                main.log.info(intent)
                 if intent[ 'state' ] == "INSTALLED":
                     main.log.info( "Intent installed successfully" )
                     intentId = intent[ 'id' ]
                     main.log.info( "Intent id: " + str( intentId ) )
-                else:
-                    # TODO: Add error handling
-                    main.log.info( "Intent installation failed" )
-                    intentId = ""
+                #else:
+                    #TODO: Add error handling
+                    #main.log.info( "Intent installation failed" )
+                    #intentId = ""
 
             main.log.info( "Disabling interface " + intfs )
             t0System = time.time() * 1000
@@ -509,7 +559,7 @@
                   intentRerouteLat7 ) / clusterCount
 
             main.log.info( "Intent reroute latency avg for iteration " +
-                           str( i ) + ": " + str( intentRerouteLatAvg ) )
+                           str( i ) + ": " + str( intentRerouteLatAvg )+ " ms")
 
             if intentRerouteLatAvg > 0.0 and \
                intentRerouteLatAvg < 1000 and i > numIgnore:
@@ -690,6 +740,11 @@
             # Resets after each batch calculation
             maxInstallLat = []
             maxWithdrawLat = []
+            # Max single intent install measurement of all nodes
+            # For example, if batch size is 1000, result latency
+            # will be divided by 1000
+            maxSingleInstallLat = []
+            maxSingleWithdrawLat = []
             # Statistical gathering loop over number of iterations
             for i in range( 0, int( numIter ) ):
                 main.log.info( "Pushing " +
@@ -703,7 +758,7 @@
                         deviceIdList[ 7 ] + "/2",
                         batchIntentSize,
                         saveDir, ONOSIpList[ node - 1 ],
-                        numMult=nThread, appId=node )
+                        numMult=nThread )
 
                 # Wait sufficient time for intents to start
                 # installing
@@ -731,25 +786,36 @@
                     with open( saveDir ) as fOnos:
                         lineCount = 0
                         for line in fOnos:
-                            line = line[ 1: ]
-                            line = line.split( ": " )
+                            line_temp = ""
                             main.log.info( "Line read: " + str( line ) )
+                            line_temp = line[ 1: ]
+                            line_temp = line_temp.split( ": " )
                             #Prevent split method if line doesn't have
                             #space
-                            if " " in str(line):
-                                result = line[ 1 ].split( " " )[ 0 ]
+                            if " " in str(line_temp):
+                                result = line_temp[ 1 ].split( " " )[ 0 ]
                             else:
                                 main.log.warn( "Empty line read" )
                                 result = 0
                             # TODO: add parameters before appending latency
                             if lineCount == 0:
-                                batchInstallLat.append( int( result ) )
+                                if "Failure" in str(line):
+                                    main.log.warn("Intent installation failed")
+                                    result = 'NA' 
+                                else:
+                                    main.log.info("Install result: "+result)
+                                    batchInstallLat.append( int( result ) )
                                 installResult = result
                             elif lineCount == 1:
-                                batchWithdrawLat.append( int( result ) )
+                                if "Failure" in str(line):
+                                    main.log.warn("Intent withdraw failed")
+                                    result = 'NA'
+                                else:
+                                    main.log.info("Withdraw result: "+result)
+                                    batchWithdrawLat.append( int( result ) )
                                 withdrawResult = result
                             else:
-                                main.log.warn("Invalid results")
+                                main.log.warn("Invalid results: excess lines")
                                 installResult = 'NA'
                                 withdrawResult = 'NA'
                             lineCount += 1
@@ -762,16 +828,33 @@
                                    str( batchIntentSize ) + "intents: " +
                                    str( withdrawResult ) + " ms" )
 
+                    main.log.info( "Single intent install latency ONOS" +
+                                    str( node ) + " with " +
+                                    str( batchIntentSize ) + "intents: " +
+                                    str( float(installResult) /\
+                                         int(batchIntentSize) ) + " ms" )
+                    main.log.info( "Single intent withdraw latency ONOS" +
+                                    str( node ) + " with " +
+                                    str( batchIntentSize ) + "intents: " +
+                                    str( float(withdrawResult) /\
+                                         int(batchIntentSize) ) + " ms" )
+
                 #NOTE: END node loop
 
                 if len( batchInstallLat ) > 0 and int( i ) > numIgnore:
                     maxInstallLat.append( max( batchInstallLat ) )
+                    maxSingleInstallLat.append( 
+                            max( batchInstallLat ) / int( batchIntentSize ) 
+                    )
                 elif len( batchInstallLat ) == 0:
                     # If I failed to read anything from the file,
                     # increase the wait time before checking intents
                     sleepTime += 30
                 if len( batchWithdrawLat ) > 0 and int( i ) > numIgnore:
                     maxWithdrawLat.append( max( batchWithdrawLat ) )
+                    maxSingleWithdrawLat.append( 
+                            max( batchWithdrawLat ) / int( batchIntentSize ) 
+                    )
                 batchInstallLat = []
                 batchWithdrawLat = []
 
@@ -781,12 +864,16 @@
             #NOTE: END iteration loop
 
             if maxInstallLat:
-                avgInstallLat = str( round(
-                                            sum( maxInstallLat ) /
-                                            len( maxInstallLat )
+                avgInstallLat = str( round( numpy.average(maxInstallLat)
                                           , 2 ))
                 stdInstallLat = str( round(
                                     numpy.std(maxInstallLat), 2))
+                avgSingleInstallLat = str( round( 
+                                            numpy.average(maxSingleInstallLat)
+                                           , 3 ))
+                stdSingleInstallLat = str( round(
+                                            numpy.std(maxSingleInstallLat),
+                                            3 ))
             else:
                 avgInstallLat = "NA"
                 stdInstallLat = "NA"
@@ -794,12 +881,16 @@
                 assertion = main.FALSE
 
             if maxWithdrawLat:
-                avgWithdrawLat = str( round(
-                                            sum( maxWithdrawLat ) /
-                                            len( maxWithdrawLat )
+                avgWithdrawLat = str( round( numpy.average(maxWithdrawLat)
                                             , 2 ))
                 stdWithdrawLat = str( round(
                                     numpy.std(maxWithdrawLat), 2))
+                avgSingleWithdrawLat = str( round( 
+                                            numpy.average(maxSingleWithdrawLat)
+                                           , 3 ))
+                stdSingleWithdrawLat = str( round(
+                                            numpy.std(maxSingleWithdrawLat),
+                                            3 ))
             else:
                 avgWithdrawLat = "NA"
                 stdWithdrawLat = "NA"
@@ -812,6 +903,12 @@
             main.log.report( "Std Deviation of batch installation latency " +
                              ": " +
                              str( stdInstallLat ) + " ms" )
+            main.log.report( "Avg of single installation latency " +
+                             "of size " + str( batchIntentSize ) + ": " +
+                             str( avgSingleInstallLat ) + " ms" )
+            main.log.report( "Std Deviation of single installation latency " +
+                             ": " +
+                             str( stdSingleInstallLat ) + " ms" )
 
             main.log.report( "Avg of batch withdraw latency " +
                              "of size " + str( batchIntentSize ) + ": " +
@@ -819,10 +916,16 @@
             main.log.report( "Std Deviation of batch withdraw latency " +
                              ": " +
                              str( stdWithdrawLat ) + " ms" )
+            main.log.report( "Avg of single withdraw latency " +
+                             "of size " + str( batchIntentSize ) + ": " +
+                             str( avgSingleWithdrawLat ) + " ms" )
+            main.log.report( "Std Deviation of single withdraw latency " +
+                             ": " +
+                             str( stdSingleWithdrawLat ) + " ms" )
 
             dbCmd = (
-                "INSERT INTO intent_latency_tests VALUES("
-                "'"+timeToPost+"','intent_latency_results',"
+                "INSERT INTO intents_latency_tests VALUES("
+                "'"+timeToPost+"','intents_latency_results',"
                 ""+runNum+","+str(clusterCount)+","+str(batchIntentSize)+","
                 ""+str(avgInstallLat)+","+str(stdInstallLat)+","
                 ""+str(avgWithdrawLat)+","+str(stdWithdrawLat)+");"
diff --git a/TestON/tests/MultiProd13/MultiProd13.py b/TestON/tests/MultiProd13/MultiProd13.py
index 52519d8..c68640e 100644
--- a/TestON/tests/MultiProd13/MultiProd13.py
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -11,7 +11,7 @@
 
 time.sleep( 1 )
 
-class MultiProd:
+class MultiProd13:
 
     def __init__( self ):
         self.default = ''
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
index af23c70..edc7540 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -11,10 +11,11 @@
     # 9. Install 114 point intents and verify ping all
     # 10. Remove all intents on ONOS
     # 1,2,3,[4,5,6,5,70,80,5,10,5,9,5,71,81,5,10,5]*100
+    # 1,2,3,4,5,6,10,12,3,4,5,6,10,13,3,4,5,6,10
 
-    <testcases>1,2,3,4,5,12,3,4,5,13,3,4,5</testcases>
+    <testcases>1,2,3,4,5,6,10</testcases>
     <ENV>
-        <cellName>choTest5</cellName>
+        <cellName>fiveNodes</cellName>
     </ENV>
     <GIT>
         #autoPull 'on' or 'off'
@@ -44,15 +45,15 @@
     </TOPO3>
     <CTRL>
 	<numCtrl>5</numCtrl>
-        <ip1>10.128.40.41</ip1>
+        <ip1>10.128.10.21</ip1>
 	<port1>6633</port1>
-	<ip2>10.128.40.42</ip2>
+	<ip2>10.128.10.22</ip2>
 	<port2>6633</port2>
-	<ip3>10.128.40.43</ip3>
+	<ip3>10.128.10.23</ip3>
 	<port3>6633</port3>
-        <ip4>10.128.40.44</ip4>
+        <ip4>10.128.10.24</ip4>
 	<port4>6633</port4>
-	<ip5>10.128.40.45</ip5>
+	<ip5>10.128.10.25</ip5>
 	<port5>6633</port5>
     </CTRL>
     <HOSTS>
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index eb71518..955d996 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -25,6 +25,9 @@
         """
         import time
 
+        global intentState
+        main.threadID = 0
+        main.pingTimeout = 300
         main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
         main.ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
         main.ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
@@ -39,7 +42,13 @@
         cell_name = main.params[ 'ENV' ][ 'cellName' ]
         git_pull = main.params[ 'GIT' ][ 'autoPull' ]
         git_branch = main.params[ 'GIT' ][ 'branch' ]
-
+        
+        main.CLIs = []
+        main.nodes = []
+        for i in range( 1, int(main.numCtrls) + 1 ):
+            main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+            main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+        
         main.case( "Set up test environment" )
         main.log.report( "Set up test environment" )
         main.log.report( "_______________________" )
@@ -86,7 +95,7 @@
         uninstallResult = main.TRUE
         for i in range( 1, int( main.numCtrls ) + 1 ):
             ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            main.log.info( "Unintsalling package on ONOS Node IP: " + ONOS_ip )
+            main.log.info( "Uninstalling package on ONOS Node IP: " + ONOS_ip )
             u_result = main.ONOSbench.onosUninstall( ONOS_ip )
             utilities.assert_equals( expect=main.TRUE, actual=u_result,
                                      onpass="Test step PASS",
@@ -123,20 +132,34 @@
         karafTimeout = "3600000"
         # need to wait here for sometime. This will be removed once ONOS is
         # stable enough
-        time.sleep( 20 )
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            ONOScli = 'ONOScli' + str( i )
-            main.log.info( "ONOS Node " + ONOS_ip + " cli start:" )
-            exec "startcli=main." + ONOScli + \
-                ".startOnosCli(ONOS_ip, karafTimeout=karafTimeout)"
-            utilities.assert_equals( expect=main.TRUE, actual=startcli,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            cliResult = ( cliResult and startcli )
-
-        case1Result = ( cp_result and cell_result
-                        and packageResult and installResult and statusResult and cliResult )
+        time.sleep( 25 )
+        main.log.step(" Start ONOS cli using thread ")
+        startCliResult  = main.TRUE
+        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.nodes[i].ip_address ] )
+            pool.append(t)
+            t.start()
+            main.threadID = main.threadID + 1
+        for t in pool:
+            t.join()
+            startCliResult = startCliResult and t.result
+        time2 = time.time()
+        
+        if not startCliResult:
+                main.log.info("ONOS CLI did not start up properly")
+                main.cleanup()
+                main.exit()
+        else:
+            main.log.info("Successful CLI startup")
+            startCliResult = main.TRUE
+        case1Result = installResult and uninstallResult and statusResult and startCliResult
+        
+        main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
         utilities.assert_equals( expect=main.TRUE, actual=case1Result,
                                  onpass="Set up test environment PASS",
                                  onfail="Set up test environment FAIL" )
@@ -151,7 +174,7 @@
         main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
         main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
         main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
-
+        main.pingTimeout = 60
         main.log.report(
             "Assign and Balance all Mininet switches across controllers" )
         main.log.report(
@@ -217,20 +240,19 @@
         main.deviceLinks = []
         main.deviceActiveLinksCount = []
         main.devicePortsEnabledCount = []
-
+        
         main.log.report(
             "Collect and Store topology details from ONOS before running any Tests" )
         main.log.report(
             "____________________________________________________________________" )
         main.case( "Collect and Store Topology Deatils from ONOS" )
-
         main.step( "Collect and store current number of switches and links" )
         topology_output = main.ONOScli1.topology()
         topology_result = main.ONOSbench.getTopology( topology_output )
         numOnosDevices = topology_result[ 'devices' ]
         numOnosLinks = topology_result[ 'links' ]
 
-        if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
+        if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks >= int(numOnosLinks) ) ):
             main.step( "Store Device DPIDs" )
             for i in range( 1, (main.numMNswitches+1) ):
                 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
@@ -255,22 +277,50 @@
             print "Length of Links Store", len( main.deviceLinks )
 
             main.step( "Collect and store each Device ports enabled Count" )
-            for i in range( 1, ( main.numMNswitches + 1) ):
-                portResult = main.ONOScli1.getDevicePortsEnabledCount(
-                    "of:00000000000000" + format( i,'02x' ) )
-                portTemp = re.split( r'\t+', portResult )
-                portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
-                main.devicePortsEnabledCount.append( portCount )
+            time1 = time.time()
+            for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
+                pool = []
+                for cli in main.CLIs:
+                    dpid = "of:00000000000000" + format( i,'02x' )
+                    t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
+                    t.start()
+                    pool.append(t)
+                    i = i + 1
+                    main.threadID = main.threadID + 1
+                for thread in pool:
+                    thread.join()
+                    portResult = thread.result
+                    portTemp = re.split( r'\t+', portResult )
+                    portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+                    main.devicePortsEnabledCount.append( portCount )
             print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
+            time2 = time.time()
+            main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
 
             main.step( "Collect and store each Device active links Count" )
-            for i in range( 1, ( main.numMNswitches + 1) ):
-                linkCountResult = main.ONOScli1.getDeviceLinksActiveCount(
-                    "of:00000000000000" + format( i,'02x' ) )
-                linkCountTemp = re.split( r'\t+', linkCountResult )
-                linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
-                main.deviceActiveLinksCount.append( linkCount )
-            print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
+            time1 = time.time()
+            
+            for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
+                pool = []
+                for cli in main.CLIs:
+                    dpid = "of:00000000000000" + format( i,'02x' )
+                    t = main.Thread( target = cli.getDeviceLinksActiveCount,
+                                     threadID = main.threadID,
+                                     name = "getDevicePortsEnabledCount",
+                                     args = [dpid])
+                    t.start()
+                    pool.append(t)
+                    i = i + 1
+                    main.threadID = main.threadID + 1
+                for thread in pool:
+                    thread.join()
+                    linkCountResult = thread.result
+                    linkCountTemp = re.split( r'\t+', linkCountResult )
+                    linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+                    main.deviceActiveLinksCount.append( linkCount )
+                print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
+            time2 = time.time()
+            main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
 
         else:
             main.log.info("Devices (expected): %s, Links (expected): %s" % 
@@ -278,9 +328,9 @@
             main.log.info("Devices (actual): %s, Links (actual): %s" %
                     ( numOnosDevices , numOnosLinks ) )
             main.log.info("Topology does not match, exiting CHO test...")
-            time.sleep(300)
-            #main.cleanup()
-            #main.exit()
+            #time.sleep(300)
+            main.cleanup()
+            main.exit()
 
         # just returning TRUE for now as this one just collects data
         case3Result = main.TRUE
@@ -295,27 +345,44 @@
         import re
         import copy
         import time
-
         main.log.report( "Enable Reactive forwarding and Verify ping all" )
         main.log.report( "______________________________________________" )
         main.case( "Enable Reactive forwarding and Verify ping all" )
         main.step( "Enable Reactive forwarding" )
         installResult = main.TRUE
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            onosFeature = 'onos-app-fwd'
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            ONOScli = 'ONOScli' + str( i )
-            main.log.info( "Enabling Reactive mode on ONOS Node " + ONOS_ip )
-            exec "inResult=main." + ONOScli + ".featureInstall(onosFeature)"
-            time.sleep( 3 )
-            installResult = inResult and installResult
-
+        feature = "onos-app-fwd"
+        
+        pool = []
+        time1 = time.time()
+        for cli in main.CLIs:
+            t = main.Thread( target=cli.featureInstall,
+                    threadID=main.threadID,
+                    name="featureInstall",
+                    args=['onos-app-fwd'])
+            pool.append(t)
+            t.start()
+            main.threadID = main.threadID + 1
+            
+        installResult = main.TRUE
+        for t in pool:
+            t.join()
+            installResult = installResult and t.result
+        time2 = time.time()
+        
+        if not installResult:
+                main.log.info("Did not install onos-app-fwd feature properly")
+                main.cleanup()
+                main.exit()
+        else:
+            main.log.info("Successful feature:install onos-app-fwd")
+        main.log.info("Time for feature:install onos-app-fwd: %2f seconds" %(time2-time1))
+        
         time.sleep( 5 )
 
         main.step( "Verify Pingall" )
         ping_result = main.FALSE
         time1 = time.time()
-        ping_result = main.Mininet1.pingall()
+        ping_result = main.Mininet1.pingall(timeout=main.pingTimeout)
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -330,19 +397,33 @@
 
         main.step( "Disable Reactive forwarding" )
         uninstallResult = main.TRUE
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            onosFeature = 'onos-app-fwd'
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            ONOScli = 'ONOScli' + str( i )
-            main.log.info( "Disabling Reactive mode on ONOS Node " + ONOS_ip )
-            exec "unResult=main." + ONOScli + ".featureUninstall(onosFeature)"
-            uninstallResult = unResult and uninstallResult
+        pool = []
+        time1 = time.time()
+        for cli in main.CLIs:
+            t = main.Thread( target=cli.featureUninstall,
+                             threadID=main.threadID,
+                             name="featureUninstall",
+                             args=['onos-app-fwd'])
+            pool.append(t)
+            t.start()
+            main.threadID = main.threadID + 1
+        for t in pool:
+            t.join()
+            uninstallResult = uninstallResult and t.result
+        time2 = time.time()
+        
+        if not uninstallResult:
+                main.log.info("Did not uninstall onos-app-fwd feature properly")
+                main.cleanup()
+                main.exit()
+        else:
+            main.log.info("Successful feature:uninstall onos-app-fwd")
+        main.log.info("Time for feature:uninstall onos-app-fwd: %2f seconds" %(time2-time1))
 
         # Waiting for reative flows to be cleared.
-        time.sleep( 10 )
-
-        case3Result = installResult and ping_result and uninstallResult
-        utilities.assert_equals( expect=main.TRUE, actual=case3Result,
+        time.sleep( 5 )
+        case4Result =  installResult and uninstallResult and ping_result
+        utilities.assert_equals( expect=main.TRUE, actual=case4Result,
                                  onpass="Reactive Mode Pingall test PASS",
                                  onfail="Reactive Mode Pingall test FAIL" )
 
@@ -351,6 +432,7 @@
         Compare current ONOS topology with reference data
         """
         import re
+        
         devicesDPIDTemp = []
         hostMACsTemp = []
         deviceLinksTemp = []
@@ -363,22 +445,35 @@
         main.case( "Compare ONOS topology with reference data" )
 
         main.step( "Compare current Device ports enabled with reference" )
-        for i in range( 1, 26 ):
-            portResult = main.ONOScli1.getDevicePortsEnabledCount(
-                "of:00000000000000" +
-                format(
-                    i,
-                    '02x' ) )
-            portTemp = re.split( r'\t+', portResult )
-            portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
-            devicePortsEnabledCountTemp.append( portCount )
-            time.sleep( 2 )
+        time1 = time.time()
+        for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
+            pool = []
+            for cli in main.CLIs:
+                dpid = "of:00000000000000" + format( i,'02x' )
+                t = main.Thread(target = cli.getDevicePortsEnabledCount,
+                        threadID = main.threadID,
+                        name = "getDevicePortsEnabledCount",
+                        args = [dpid])
+                t.start()
+                pool.append(t)
+                i = i + 1
+                main.threadID = main.threadID + 1
+            for thread in pool:
+                thread.join()
+                portResult = thread.result
+                portTemp = re.split( r'\t+', portResult )
+                portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+                devicePortsEnabledCountTemp.append( portCount )
+        print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
+        time2 = time.time()
+        main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
         main.log.info (
             "Device Enabled ports EXPECTED: %s" % 
 	     str( main.devicePortsEnabledCount ) )
         main.log.info (
             "Device Enabled ports ACTUAL: %s" % 
             str( devicePortsEnabledCountTemp ) )
+        
         if ( cmp( main.devicePortsEnabledCount,
                   devicePortsEnabledCountTemp ) == 0 ):
             stepResult1 = main.TRUE
@@ -386,16 +481,28 @@
             stepResult1 = main.FALSE
 
         main.step( "Compare Device active links with reference" )
-        for i in range( 1, 26 ):
-            linkResult = main.ONOScli1.getDeviceLinksActiveCount(
-                "of:00000000000000" +
-                format(
-                    i,
-                    '02x' ) )
-            linkTemp = re.split( r'\t+', linkResult )
-            linkCount = linkTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
-            deviceActiveLinksCountTemp.append( linkCount )
-            time.sleep( 3 )
+        time1 = time.time()
+        for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
+            pool = []
+            for cli in main.CLIs:
+                dpid = "of:00000000000000" + format( i,'02x' )
+                t = main.Thread(target = cli.getDeviceLinksActiveCount,
+                        threadID = main.threadID,
+                        name = "getDevicePortsEnabledCount",
+                        args = [dpid])
+                t.start()
+                pool.append(t)
+                i = i + 1
+                main.threadID = main.threadID + 1
+            for thread in pool:
+                thread.join()
+                linkCountResult = thread.result
+                linkCountTemp = re.split( r'\t+', linkCountResult )
+                linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+                deviceActiveLinksCountTemp.append( linkCount )
+            print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
+        time2 = time.time()
+        main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
         main.log.info (
             "Device Active links EXPECTED: %s" %
               str( main.deviceActiveLinksCount ) )
@@ -422,21 +529,42 @@
         main.log.report( "Add 300 host intents and verify pingall" )
         main.log.report( "_______________________________________" )
         import itertools
-
+        
         main.case( "Install 300 host intents" )
         main.step( "Add host Intents" )
         intentResult = main.TRUE
-        hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
-        for i in range( len( hostCombos ) ):
-            iResult = main.ONOScli1.addHostIntent(
-                hostCombos[ i ][ 0 ],
-                hostCombos[ i ][ 1 ] )
-            intentResult = ( intentResult and iResult )
+        hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) 
+        
+        intentIdList = []
+        time1 = time.time()
+        for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
+            pool = []
+            for cli in main.CLIs:
+                if i >= len( hostCombos ):
+                    break
+                t = main.Thread( target=cli.addHostIntent,
+                        threadID=main.threadID,
+                        name="addHostIntent",
+                        args=[hostCombos[i][0],hostCombos[i][1]])
+                pool.append(t)
+                t.start()
+                i = i + 1
+                main.threadID = main.threadID + 1
+            for thread in pool:
+                thread.join()
+                intentIdList.append(thread.result)
+        time2 = time.time()
+        main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
+        intentResult = main.TRUE
+        intentsJson = main.ONOScli2.intents()
+        getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+                intentsJson = intentsJson)
+        print getIntentStateResult
 
         main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
-        pingResult = main.Mininet1.pingall()
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -447,11 +575,11 @@
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        case4Result = ( intentResult and pingResult )
-        #case4Result = pingResult
+        case6Result = ( intentResult and pingResult )
+        
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case4Result,
+            actual=case6Result,
             onpass="Install 300 Host Intents and Ping All test PASS",
             onfail="Install 300 Host Intents and Ping All test FAIL" )
 
@@ -518,7 +646,7 @@
         main.step( "Verify Ping across all hosts" )
         pingResultLinkDown = main.FALSE
         time1 = time.time()
-        pingResultLinkDown = main.Mininet1.pingall()
+        pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout)
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -555,15 +683,15 @@
         for i in range( int( switchLinksToToggle ) ):
             main.Mininet1.link(
                 END1=link1End1,
-                END2=randomLink1[ i ],
+                END2=main.randomLink1[ i ],
                 OPTION="up" )
             main.Mininet1.link(
                 END1=link2End1,
-                END2=randomLink2[ i ],
+                END2=main.randomLink2[ i ],
                 OPTION="up" )
             main.Mininet1.link(
                 END1=link3End1,
-                END2=randomLink3[ i ],
+                END2=main.randomLink3[ i ],
                 OPTION="up" )
         time.sleep( link_sleep )
 
@@ -813,6 +941,7 @@
             onfail="Ping all test after Point intents addition failed" )
 
     def CASE10( self ):
+        import time
         """
          Remove all Intents
         """
@@ -840,10 +969,30 @@
                 intentsTemp = intentsList[ i ].split( ',' )
                 intentIdList.append( intentsTemp[ 0 ] )
             print "Intent IDs: ", intentIdList
-            for id in range( len( intentIdList ) ):
-                print "Removing intent id (round 1) :", intentIdList[ id ]
-                main.ONOScli1.removeIntent( intentId=intentIdList[ id ] )
-                #time.sleep( 1 )
+            
+            results = main.TRUE
+            time1 = time.time()
+            
+            for i in xrange(0,len( intentIdList ), int(main.numCtrls)):
+                pool = []
+                for cli in main.CLIs:
+                    if i >= len(intentIdList):
+                        break
+                    print "Removing intent id (round 1) :", intentIdList[ i ]
+                    t = main.Thread(target=cli.removeIntent,
+                            threadID=main.threadID,
+                            name="removeIntent",
+                            args=[intentIdList[i],'org.onosproject.cli',False,False])
+                    pool.append(t)
+                    t.start()
+                    i = i + 1
+                    main.threadID = main.threadID + 1
+                for t in pool:
+                    t.join()
+                    results = results and t.result
+                
+            time2 = time.time()
+            main.log.info("Time for feature:install onos-app-fwd: %2f seconds" %(time2-time1))
 
             main.log.info(
                 "Verify all intents are removed and if any leftovers try remove one more time" )
@@ -859,27 +1008,42 @@
                 "" )
             intentsList1 = intentsList1.splitlines()
             intentsList1 = intentsList1[ 1: ]
+            
             print "Round 2 (leftover) intents to remove: ", intentsList1
             intentIdList1 = []
             if ( len( intentsList1 ) > 1 ):
                 for i in range( len( intentsList1 ) ):
-                    intentsTemp1 = intentsList[ i ].split( ',' )
-                    intentIdList1.append( intentsTemp1[ 0 ] )
+                    intentsTemp1 = intentsList1[ i ].split( ',' )
+                    intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
                 print "Leftover Intent IDs: ", intentIdList1
-                for id in range( len( intentIdList1 ) ):
-                    print "Removing intent id (round 2):", intentIdList1[ id ]
-                    main.ONOScli1.removeIntent(
-                        intentId=intentIdList1[ id ] )
-                    #time.sleep( 2 )
+                for i in xrange(0, len( intentIdList1 ), int(main.numCtrls)):
+                    pool = []
+                    for cli in main.CLIs:
+                        if i >= len(intentIdList1):
+                            break
+                        print "Removing intent id (round 2) :", intentIdList1[ i ]
+                        t = main.Thread(target=cli.removeIntent,threadID=main.threadID,
+                                name="removeIntent",
+                                args=[intentIdList1[i],'org.onosproject.cli',True,False])
+                        pool.append(t)
+                        t.start()
+                        i = i + 1
+                        main.threadID = main.threadID + 1
+                        
+                    for t in pool:
+                        t.join()
+                        results = results and t.result
+                step1Result = results
             else:
                 print "There are no more intents that need to be removed"
                 step1Result = main.TRUE
         else:
             print "No Intent IDs found in Intents list: ", intentsList
             step1Result = main.FALSE
-
-        caseResult7 = step1Result
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult7,
+        
+        print main.ONOScli1.intents()
+        caseResult10 = step1Result
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
                                  onpass="Intent removal test successful",
                                  onfail="Intent removal test failed" )
 
@@ -891,47 +1055,82 @@
         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" )
         main.log.report( "_____________________________________________________" )
         main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
         main.step( "Enable intent based Reactive forwarding" )
-        installResult = main.TRUE
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            onosFeature = 'onos-app-ifwd'
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            ONOScli = 'ONOScli' + str( i )
-            main.log.info( "Enabling Intent based Reactive forwarding on ONOS Node " + ONOS_ip )
-            exec "inResult=main." + ONOScli + ".featureInstall(onosFeature)"
-            time.sleep( 3 )
-            installResult = inResult and installResult
-
-        time.sleep( 5 )
-
+        installResult = main.FALSE
+        feature = "onos-app-ifwd"
+        
+        pool = []
+        time1 = time.time()
+        for cli,feature in main.CLIs:
+            t = main.Thread(target=cli,threadID=threadID,
+                    name="featureInstall",args=[feature])
+            pool.append(t)
+            t.start()
+            threadID = threadID + 1
+            
+        results = []
+        for thread in pool:
+            thread.join()
+            results.append(thread.result)
+        time2 = time.time()
+        
+        if( all(result == main.TRUE for result in results) == False):
+                main.log.info("Did not install onos-app-ifwd feature properly")
+                main.cleanup()
+                main.exit()
+        else:
+            main.log.info("Successful feature:install onos-app-ifwd")
+            installResult = main.TRUE
+        main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
+        
         main.step( "Verify Pingall" )
         ping_result = main.FALSE
         time1 = time.time()
-        ping_result = main.Mininet1.pingall()
+        ping_result = main.Mininet1.pingall(timeout=600)
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-
+        
         if ping_result == main.TRUE:
             main.log.report( "Pingall Test in Reactive mode successful" )
         else:
             main.log.report( "Pingall Test in Reactive mode failed" )
 
         main.step( "Disable Intent based Reactive forwarding" )
-        uninstallResult = main.TRUE
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            onosFeature = 'onos-app-ifwd'
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            ONOScli = 'ONOScli' + str( i )
-            main.log.info( "Disabling Intent based Reactive forwarding on ONOS Node " + ONOS_ip )
-            exec "unResult=main." + ONOScli + ".featureUninstall(onosFeature)"
-            uninstallResult = unResult and uninstallResult
+        uninstallResult = main.FALSE
+        
+        pool = []
+        time1 = time.time()
+        for cli,feature in main.CLIs:
+            t = main.Thread(target=cli,threadID=threadID,
+                    name="featureUninstall",args=[feature])
+            pool.append(t)
+            t.start()
+            threadID = threadID + 1
+            
+        results = []
+        for thread in pool:
+            thread.join()
+            results.append(thread.result)
+        time2 = time.time()
+        
+        if( all(result == main.TRUE for result in results) == False):
+                main.log.info("Did not uninstall onos-app-ifwd feature properly")
+                main.cleanup()
+                main.exit()
+        else:
+            main.log.info("Successful feature:uninstall onos-app-ifwd")
+            uninstallResult = main.TRUE
+        main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
 
         # Waiting for reative flows to be cleared.
         time.sleep( 10 )
@@ -948,12 +1147,14 @@
         import re
         import time
         import copy
+        
 
+        Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
         newTopo = main.params['TOPO2']['topo']
         main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
         main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
         main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
-
+        main.pingTimeout = 60
         main.log.report(
             "Load Chordal topology and Balance all Mininet switches across controllers" )
         main.log.report(
@@ -1027,16 +1228,30 @@
         #karafTimeout = "3600000" # This is not needed here as it is already set before.
         # need to wait here sometime for ONOS to bootup.
         time.sleep( 30 )
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            ONOScli = 'ONOScli' + str( i )
-            main.log.info( "ONOS Node " + ONOS_ip + " cli start:" )
-            exec "startcli=main." + ONOScli + \
-                ".startOnosCli(ONOS_ip)"
-            utilities.assert_equals( expect=main.TRUE, actual=startcli,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            cliResult = ( cliResult and startcli )
+
+        main.log.step(" Start ONOS cli using thread ")
+        pool = []
+        time1 = time.time()
+        for i in range( int( main.numCtrls ) ):
+            t = main.Thread(target=cli.startOnosCli,
+                    threadID=main.threadID,
+                    name="startOnosCli",
+                    args=[nodes[i].ip_address])
+            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))
 
         main.step( "Balance devices across controllers" )
         for i in range( int( main.numCtrls ) ):
@@ -1063,7 +1278,7 @@
         main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
         main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
         main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
-
+        main.pingTimeout = 600
         main.log.report(
             "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
         main.log.report(
@@ -1137,16 +1352,35 @@
         #karafTimeout = "3600000" # This is not needed here as it is already set before.
         # need to wait here sometime for ONOS to bootup.
         time.sleep( 30 )
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            ONOScli = 'ONOScli' + str( i )
-            main.log.info( "ONOS Node " + ONOS_ip + " cli start:" )
-            exec "startcli=main." + ONOScli + \
-                ".startOnosCli(ONOS_ip)"
-            utilities.assert_equals( expect=main.TRUE, actual=startcli,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            cliResult = ( cliResult and startcli )
+        
+        main.log.step(" Start ONOS cli using thread ")
+        pool = []
+        for i in range( int( main.numCtrls ) ):
+            t = main.Thread(target=cli.startOnosCli,
+                    threadID=main.threadID,
+                    name="startOnosCli",
+                    args=[nodes[i].ip_address])
+            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))
+
+        main.step( "Balance devices across controllers" )
+        for i in range( int( main.numCtrls ) ):
+            balanceResult = main.ONOScli1.balanceMasters()
+            # giving some breathing time for ONOS to complete re-balance
+            time.sleep( 3 )
 
         main.step( "Balance devices across controllers" )
         for i in range( int( main.numCtrls ) ):
@@ -1160,3 +1394,127 @@
             actual=case13Result,
             onpass="Starting new Spine topology test PASS",
             onfail="Starting new Spine topology test FAIL" )
+
+    def CASE14( self ):
+        """
+        Install 300 host intents and verify ping all for Chordal Topology
+        """
+        main.log.report( "Add 300 host intents and verify pingall" )
+        main.log.report( "_______________________________________" )
+        import itertools
+        
+        main.case( "Install 300 host intents" )
+        main.step( "Add host Intents" )
+        intentResult = main.TRUE
+        hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) 
+        
+        intentIdList = []
+        time1 = time.time()
+        
+        for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
+            pool = []
+            for cli in main.CLIs:
+                if i >= len( hostCombos ):
+                    break
+                t = main.Thread( target=cli.addHostIntent,
+                        threadID=main.threadID,
+                        name="addHostIntent",
+                        args=[hostCombos[i][0],hostCombos[i][1]])
+                pool.append(t)
+                t.start()
+                i = i + 1
+                main.threadID = main.threadID + 1
+            for thread in pool:
+                thread.join()
+                intentIdList.append(thread.result)
+        time2 = time.time()
+        main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
+        intentResult = main.TRUE
+        intentsJson = main.ONOScli2.intents()
+        getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+                intentsJson = intentsJson)
+        print getIntentStateResult
+
+        main.step( "Verify Ping across all hosts" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+        time2 = time.time()
+        timeDiff = round( ( time2 - time1 ), 2 )
+        main.log.report(
+            "Time taken for Ping All: " +
+            str( timeDiff ) +
+            " seconds" )
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
+
+        case14Result = ( intentResult and pingResult )
+        
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case14Result,
+            onpass="Install 300 Host Intents and Ping All test PASS",
+            onfail="Install 300 Host Intents and Ping All test FAIL" )
+
+    def CASE15( self ):
+        """
+        Install 300 host intents and verify ping all for Spine Topology
+        """
+        main.log.report( "Add 300 host intents and verify pingall" )
+        main.log.report( "_______________________________________" )
+        import itertools
+        
+        main.case( "Install 300 host intents" )
+        main.step( "Add host Intents" )
+        intentResult = main.TRUE
+        hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) 
+        
+        intentIdList = []
+        time1 = time.time()
+        for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
+            pool = []
+            for cli in main.CLIs:
+                if i >= len( hostCombos ):
+                    break
+                t = main.Thread( target=cli.addHostIntent,
+                        threadID=main.threadID,
+                        name="addHostIntent",
+                        args=[hostCombos[i][0],hostCombos[i][1]])
+                pool.append(t)
+                t.start()
+                i = i + 1
+                main.threadID = main.threadID + 1
+            for thread in pool:
+                thread.join()
+                intentIdList.append(thread.result)
+        time2 = time.time()
+        main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
+        intentResult = main.TRUE
+        intentsJson = main.ONOScli2.intents()
+        getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+                intentsJson = intentsJson)
+        print getIntentStateResult
+
+        main.step( "Verify Ping across all hosts" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+        time2 = time.time()
+        timeDiff = round( ( time2 - time1 ), 2 )
+        main.log.report(
+            "Time taken for Ping All: " +
+            str( timeDiff ) +
+            " seconds" )
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
+
+        case15Result = ( intentResult and pingResult )
+        
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case15Result,
+            onpass="Install 300 Host Intents and Ping All test PASS",
+            onfail="Install 300 Host Intents and Ping All test FAIL" )
+
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/OnosCHO/OnosCHO.topo
index b36c789..53de6dc 100644
--- a/TestON/tests/OnosCHO/OnosCHO.topo
+++ b/TestON/tests/OnosCHO/OnosCHO.topo
@@ -2,16 +2,18 @@
     <COMPONENT>
 
         <ONOSbench>
-            <host>10.128.40.40</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
+            <COMPONENTS>
+                <home>~/onos</home>
+            </COMPONENTS>
         </ONOSbench>
 
         <ONOScli1>
-            <host>10.128.40.40</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -20,7 +22,7 @@
         </ONOScli1>
 
 	 <ONOScli2>
-            <host>10.128.40.40</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -29,7 +31,7 @@
         </ONOScli2>
 
 	 <ONOScli3>
-            <host>10.128.40.40</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -38,7 +40,7 @@
         </ONOScli3>
 
         <ONOScli4>
-            <host>10.128.40.40</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -47,7 +49,7 @@
         </ONOScli4>
 
 	 <ONOScli5>
-            <host>10.128.40.40</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -56,7 +58,7 @@
         </ONOScli5>
 	
         <ONOS1>
-            <host>10.128.40.40</host>
+            <host>10.128.10.21</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -65,7 +67,7 @@
         </ONOS1>
 
 	<ONOS2>
-            <host>10.128.40.40</host>
+            <host>10.128.10.22</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -74,7 +76,7 @@
         </ONOS2>
 	
 	<ONOS3>
-            <host>10.128.40.40</host>
+            <host>10.128.10.23</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -83,7 +85,7 @@
         </ONOS3>
 
         <ONOS4>
-            <host>10.128.40.40</host>
+            <host>10.128.10.24</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -92,7 +94,7 @@
         </ONOS4>
 
 	<ONOS5>
-            <host>10.128.40.40</host>
+            <host>10.128.10.25</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -101,7 +103,7 @@
         </ONOS5>
 	
         <Mininet1>
-            <host>10.128.40.50</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>MininetCliDriver</type>
@@ -116,7 +118,7 @@
         </Mininet1>
 
         <Mininet2>
-            <host>10.128.40.50</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>RemoteMininetDriver</type>
diff --git a/TestON/tests/ProdFunc/ProdFunc.bakpy b/TestON/tests/ProdFunc/ProdFunc.bakpy
new file mode 100755
index 0000000..c79143b
--- /dev/null
+++ b/TestON/tests/ProdFunc/ProdFunc.bakpy
@@ -0,0 +1,1480 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+# import sys
+# import os
+# import re
+import json
+
+time.sleep( 1 )
+
+
+class ProdFunc:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        import time
+        """
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-log
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.case( "Setting up test environment" )
+        main.log.report(
+            "This testcase is testing setting up test environment" )
+        main.log.report( "__________________________________" )
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Git checkout and get version" )
+        #main.ONOSbench.gitCheckout( "master" )
+        gitPullResult = main.ONOSbench.gitPull()
+        main.log.info( "git_pull_result = " + str( gitPullResult ))
+        main.ONOSbench.getVersion( report=True )
+
+        if gitPullResult == 1:
+            main.step( "Using mvn clean & install" )
+            main.ONOSbench.cleanInstall()
+        elif gitPullResult == 0:
+            main.log.report(
+                "Git Pull Failed, look into logs for detailed reason" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.ONOSbench.onosInstall()
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup()
+        if onos1Isup == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        
+        main.step( "Starting Mininet CLI..." )
+        # Starting the mininet using the old way
+        main.step( "Starting Mininet ..." )
+        netIsUp = main.Mininet1.startNet()
+        if netIsUp:
+            main.log.info("Mininet CLI is up")
+        
+        case1Result = ( packageResult and
+                        cellResult and verifyResult
+                        and onosInstallResult and
+                        onos1Isup and startResult )
+        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+                                 onpass="Test startup successful",
+                                 onfail="Test startup NOT successful" )
+
+    def CASE2( self, main ):
+        """
+        Switch Down
+        """
+        # NOTE: You should probably run a topology check after this
+        import time
+
+        main.case( "Switch down discovery" )
+        main.log.report( "This testcase is testing a switch down discovery" )
+        main.log.report( "__________________________________" )
+
+        switchSleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
+
+        description = "Killing a switch to ensure it is discovered correctly"
+        main.log.report( description )
+        main.case( description )
+
+        # TODO: Make this switch parameterizable
+        main.step( "Kill s28 " )
+        main.log.report( "Deleting s28" )
+        # FIXME: use new dynamic topo functions
+        main.Mininet1.delSwitch( "s28" )
+        main.log.info(
+            "Waiting " +
+            str( switchSleep ) +
+            " seconds for switch down to be discovered" )
+        time.sleep( switchSleep )
+        # Peek at the deleted switch
+        device = main.ONOS2.getDevice( dpid="0028" )
+        print "device = ", device
+        if device[ u'available' ] == 'False':
+            case2Result = main.FALSE
+        else:
+            case2Result = main.TRUE
+        utilities.assert_equals( expect=main.TRUE, actual=case2Result,
+                                 onpass="Switch down discovery successful",
+                                 onfail="Switch down discovery failed" )
+
+    def CASE15( self, main ):
+        """
+        Cleanup sequence:
+        onos-service <nodeIp> stop
+        onos-uninstall
+
+        TODO: Define rest of cleanup
+
+        """
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.case( "Cleaning up test environment" )
+
+        main.step( "Testing ONOS kill function" )
+        killResult = main.ONOSbench.onosKill( ONOS1Ip )
+
+        main.step( "Stopping ONOS service" )
+        stopResult = main.ONOSbench.onosStop( ONOS1Ip )
+
+        main.step( "Uninstalling ONOS service" )
+        uninstallResult = main.ONOSbench.onosUninstall()
+
+        case11Result = killResult and stopResult and uninstallResult
+        utilities.assert_equals( expect=main.TRUE, actual=case11Result,
+                                 onpass="Cleanup successful",
+                                 onfail="Cleanup failed" )
+
+    def CASE3( self, main ):
+        """
+        Test 'onos' command and its functionality in driver
+        """
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.case( "Testing 'onos' command" )
+
+        main.step( "Sending command 'onos -w <onos-ip> system:name'" )
+        cmdstr1 = "system:name"
+        cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 )
+        main.log.info( "onos command returned: " + cmdResult1 )
+
+        main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
+        cmdstr2 = "onos:topology"
+        cmdResult2 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 )
+        main.log.info( "onos command returned: " + cmdResult2 )
+
+    def CASE20( self ):
+        """
+            Exit from mininet cli
+            reinstall ONOS
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.log.report( "This testcase exits the mininet cli and reinstalls" +
+                         "ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+        main.step( "Disconnecting mininet and restarting ONOS" )
+        mininetDisconnect = main.Mininet1.disconnect()
+        print "mininetDisconnect = ", mininetDisconnect        
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        onosInstallResult = main.ONOSbench.onosInstall()
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup()
+        if onos1Isup == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        case20Result = mininetDisconnect and cellResult and verifyResult \
+            and onosInstallResult and onos1Isup and \
+            startResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case20Result,
+            onpass= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS successful",
+            onfail= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS failed" )
+
+    def CASE21( self, main ):
+        """
+            On ONOS bench, run this command:
+             ./~/ONOS/tools/test/bin/onos-topo-cfg
+            which starts the rest and copies the links
+            json file to the onos instance.
+            Note that in case of Packet Optical, the links are not learnt
+            from the topology, instead the links are learnt
+            from the json config file
+        """
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+        main.step( "Starting LINC-OE and other components" )
+        startConsoleResult = main.LincOE1.startConsole()
+        opticalMnScript = main.LincOE2.runOpticalMnScript()
+        onosTopoCfgResult = main.ONOSbench.runOnosTopoCfg(
+            instanceName=main.params[ 'CTRL' ][ 'ip1' ],
+            jsonFile=main.params[ 'OPTICAL' ][ 'jsonfile' ] )
+
+        print "start_console_result =", startConsoleResult
+        print "optical_mn_script = ", opticalMnScript
+        print "onos_topo_cfg_result =", onosTopoCfgResult
+
+        case21Result = startConsoleResult and opticalMnScript and \
+            onosTopoCfgResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case21Result,
+            onpass="Packet optical topology spawned successsfully",
+            onfail="Packet optical topology spawning failed" )
+
+    def CASE22( self, main ):
+        """
+            Curretly we use, 4 linear switch optical topology and
+            2 packet layer mininet switches each with one host.
+            Therefore, the roadmCount variable = 4,
+            packetLayerSWCount variable = 2 and hostCount = 2
+            and this is hardcoded in the testcase. If the topology changes,
+            these hardcoded values need to be changed
+        """
+        main.log.report(
+            "This testcase compares the optical+packet topology against what" +
+            " is expected" )
+        main.case( "Topology comparision" )
+        main.step( "Topology comparision" )
+        main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        devicesResult = main.ONOS3.devices( jsonFormat=False )
+
+        print "devices_result = ", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        devicesLinewise = devicesLinewise[ 1: ]
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devicesLinewise:
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type == 'SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 4:
+            print "Number of Optical Switches = %d and is" % roadmCount +\
+                  " correctly detected"
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
+            opticalSWResult = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
+            opticalSWResult = main.FALSE
+
+        if packetLayerSWCount == 2:
+            print "Number of Packet layer or mininet Switches = %d "\
+                    % packetLayerSWCount + "and is correctly detected"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
+            packetSWResult = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and"\
+                    % packetLayerSWCount + " is wrong"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
+            packetSWResult = main.FALSE
+        print "_________________________________"
+
+        linksResult = main.ONOS3.links( jsonFormat=False )
+        print "links_result = ", linksResult
+        print "_________________________________"
+
+        # NOTE:Since only point intents are added, there is no
+        # requirement to discover the hosts
+        # Therfore, the below portion of the code is commented.
+        """
+        #Discover hosts using pingall
+        pingallResult = main.LincOE2.pingall()
+
+        hostsResult = main.ONOS3.hosts( jsonFormat=False )
+        main.log.info( "hosts_result = "+hostsResult )
+        main.log.info( "_________________________________" )
+        hostsLinewise = hostsResult.split( "\n" )
+        hostsLinewise = hostsLinewise[ 1:-1 ]
+        hostCount = 0
+        for line in hostsLinewise:
+            hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
+            hostCount +=1
+        if hostCount ==2:
+            print "Number of hosts = %d and is correctly detected" %hostCount
+            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
+                            is correctly detected" )
+            hostDiscovery = main.TRUE
+        else:
+            print "Number of hosts = %d and is wrong" %hostCount
+            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
+                            is wrong" )
+            hostDiscovery = main.FALSE
+        """
+        case22Result = opticalSWResult and packetSWResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case22Result,
+            onpass="Packet optical topology discovery successful",
+            onfail="Packet optical topology discovery failed" )
+
+    def CASE23( self, main ):
+        import time
+        """
+            Add bidirectional point intents between 2 packet layer( mininet )
+            devices and
+            ping mininet hosts
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 " +
+            "packet layer( mininet ) devices and ping mininet hosts" )
+        main.case( "Topology comparision" )
+        main.step( "Adding point intents" )
+        ptpIntentResult = main.ONOS3.addPointIntent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0002/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOS3.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        ptpIntentResult = main.ONOS3.addPointIntent(
+            "of:0000ffffffff0002/1",
+            "of:0000ffffffff0001/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOS3.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        time.sleep( 10 )
+        flowHandle = main.ONOS3.flows()
+        main.log.info( "flows :" + flowHandle )
+
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep( 30 )
+        intentHandle = main.ONOS3.intents( jsonFormat=False )
+        main.log.info( "intents :" + intentHandle )
+
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h2" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h2  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h2 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h2 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Point intents for packet optical have not ben installed" +
+                " correctly. Cleaning up" )
+        if PingResult == main.TRUE:
+            main.log.report(
+                "Point Intents for packet optical have been " +
+                "installed correctly" )
+
+        case23Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23Result,
+            onpass= "Point intents addition for packet optical and" +
+                    "Pingall Test successful",
+            onfail= "Point intents addition for packet optical and" +
+                    "Pingall Test NOT successful" )
+
+    def CASE24( self, main ):
+        import time
+        import json
+        """
+            Test Rerouting of Packet Optical by bringing a port down
+            ( port 22 ) of a switch( switchID=1 ), so that link
+            ( between switch1 port22 - switch4-port30 ) is inactive
+            and do a ping test. If rerouting is successful,
+            ping should pass. also check the flows
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+        main.step( "Bring a port down and verify the link state" )
+        main.LincOE1.portDown( swId="1", ptId="22" )
+        linksNonjson = main.ONOS3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+
+        links = main.ONOS3.links()
+        main.log.info( "links = " + links )
+
+        linksResult = json.loads( links )
+        linksStateResult = main.FALSE
+        for item in linksResult:
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "22":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff04" and item[
+                        'dst' ][ 'port' ] == "30":
+                    linksState = item[ 'state' ]
+                    if linksState == "INACTIVE":
+                        main.log.info(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        linksStateResult = main.TRUE
+                        break
+                    else:
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
+                        linksStateResult = main.FALSE
+
+        print "links_state_result = ", linksStateResult
+        time.sleep( 10 )
+        flowHandle = main.ONOS3.flows()
+        main.log.info( "flows :" + flowHandle )
+
+        main.step( "Verify Rerouting by a ping test" )
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h2" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h2  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h2 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h2 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.TRUE:
+            main.log.report( "Ping test successful " )
+        if PingResult == main.FALSE:
+            main.log.report( "Ping test failed" )
+
+        case24Result = PingResult and linksStateResult
+        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
+
+    def CASE4( self, main ):
+        import re
+        import time
+        main.log.report( "This testcase is testing the assignment of" +
+                         " all the switches to all the controllers and" +
+                         " discovering the hosts in reactive mode" )
+        main.log.report( "__________________________________" )
+        main.case( "Pingall Test" )
+        main.step( "Assigning switches to controllers" )
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        for i in range( 1, 29 ):
+            if i == 1:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 2 and i < 5:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 5 and i < 8:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 8 and i < 18:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 18 and i < 28:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            else:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+        SwitchMastership = main.TRUE
+        for i in range( 1, 29 ):
+            if i == 1:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 2 and i < 5:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 5 and i < 8:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 8 and i < 18:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 18 and i < 28:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            else:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is" + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+
+        if SwitchMastership == main.TRUE:
+            main.log.report( "Controller assignmnet successful" )
+        else:
+            main.log.report( "Controller assignmnet failed" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=SwitchMastership,
+            onpass="MasterControllers assigned correctly" )
+        """
+        for i in range ( 1,29 ):
+            main.Mininet1.assignSwController( sw=str( i ),count=5,
+                    ip1=ONOS1Ip,port1=ONOS1Port,
+                    ip2=ONOS2Ip,port2=ONOS2Port,
+                    ip3=ONOS3Ip,port3=ONOS3Port,
+                    ip4=ONOS4Ip,port4=ONOS4Port,
+                    ip5=ONOS5Ip,port5=ONOS5Port )
+        """
+        # REACTIVE FWD test
+
+        main.step( "Get list of hosts from Mininet" )
+        hostList = main.Mininet1.getHosts()
+        main.log.info( hostList )
+
+        main.step( "Get host list in ONOS format" )
+        hostOnosList = main.ONOS2.getHostsId( hostList )
+        main.log.info( hostOnosList )
+        # time.sleep( 5 )
+
+        main.step( "Pingall" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+        # Start onos cli again because u might have dropped out of
+        # onos prompt to the shell prompt
+        # if there was no activity
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+
+        case4Result = SwitchMastership and pingResult
+        if pingResult == main.TRUE:
+            main.log.report( "Pingall Test in reactive mode to" +
+                             " discover the hosts successful" )
+        else:
+            main.log.report( "Pingall Test in reactive mode to" +
+                             " discover the hosts failed" )
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case4Result,
+            onpass="Controller assignment and Pingall Test successful",
+            onfail="Controller assignment and Pingall Test NOT successful" )
+
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        main.step( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd uninstalled" )
+
+        # After reactive forwarding is disabled, the reactive flows on
+        # switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
+
+        flows = main.ONOS2.flows()
+        #main.log.info( flows )
+
+        case10Result = appUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case10Result,
+            onpass="Reactive forwarding app uninstallation successful",
+            onfail="Reactive forwarding app uninstallation failed" )
+
+    def CASE6( self ):
+        main.log.report( "This testcase is testing the addition of" +
+                         " host intents and then does pingall" )
+        main.log.report( "__________________________________" )
+        main.case( "Obtaining host id's" )
+        main.step( "Get hosts" )
+        hosts = main.ONOS2.hosts()
+        main.log.info( hosts )
+
+        main.step( "Get all devices id" )
+        devicesIdList = main.ONOS2.getAllDevicesId()
+        main.log.info( devicesIdList )
+
+        # ONOS displays the hosts in hex format unlike mininet which does
+        # in decimal format
+        # So take care while adding intents
+        """
+        main.step( "Add host-to-host intents for mininet hosts h8 and h18 or
+                    ONOS hosts h8 and h12" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
+        print "______________________________________________________"
+        """
+        for i in range( 8, 18 ):
+            main.log.info(
+                "Adding host intent between h" + str( i ) +
+                " and h" + str( i + 10 ) )
+            host1 = "00:00:00:00:00:" + \
+                str( hex( i )[ 2: ] ).zfill( 2 ).upper()
+            host2 = "00:00:00:00:00:" + \
+                str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
+            # NOTE: get host can return None
+            # TODO: handle this
+            host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
+            host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
+            main.ONOS2.addHostIntent( host1Id, host2Id )
+            hIntents = main.ONOS2.intents( jsonFormat=False )
+            main.log.info( "intents:" + hIntents )
+
+        time.sleep( 10 )
+        hIntents = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intents:" + hIntents )
+        main.ONOS2.flows()
+
+        count = 1
+        i = 8
+        PingResult = main.TRUE
+        # while i<10:
+        while i < 18:
+            main.log.info(
+                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost(
+                src="h" + str( i ), target="h" + str( i + 10 ) )
+            if ping == main.FALSE and count < 5:
+                count += 1
+                # i = 8
+                PingResult = main.FALSE
+                main.log.report( "Ping between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 " failed. Making attempt number " +
+                                 str( count ) +
+                                 " in 2 seconds" )
+                time.sleep( 2 )
+            elif ping == main.FALSE:
+                main.log.report( "All ping attempts between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 "have failed" )
+                i = 19
+                PingResult = main.FALSE
+            elif ping == main.TRUE:
+                main.log.info( "Ping test between h" +
+                               str( i ) +
+                               " and h" +
+                               str( i +
+                                    10 ) +
+                               "passed!" )
+                i += 1
+                PingResult = main.TRUE
+            else:
+                main.log.info( "Unknown error" )
+                PingResult = main.ERROR
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Ping all test after Host intent addition failed.Cleaning up" )
+            # main.cleanup()
+            # main.exit()
+        if PingResult == main.TRUE:
+            main.log.report(
+                "Ping all test after Host intent addition successful" )
+
+        case6Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case6Result,
+            onpass="Pingall Test after Host intents addition successful",
+            onfail="Pingall Test after Host intents addition failed" )
+
+    def CASE5( self, main ):
+        import json
+        # assumes that sts is already in you PYTHONPATH
+        from sts.topology.teston_topology import TestONTopology
+        # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        main.log.report( "This testcase is testing if all ONOS nodes" +
+                         " are in topology sync with mininet" )
+        main.log.report( "__________________________________" )
+        main.case( "Comparing Mininet topology with the topology of ONOS" )
+        main.step( "Start continuous pings" )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source1' ],
+            target=main.params[ 'PING' ][ 'target1' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source2' ],
+            target=main.params[ 'PING' ][ 'target2' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source3' ],
+            target=main.params[ 'PING' ][ 'target3' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source4' ],
+            target=main.params[ 'PING' ][ 'target4' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source5' ],
+            target=main.params[ 'PING' ][ 'target5' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source6' ],
+            target=main.params[ 'PING' ][ 'target6' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source7' ],
+            target=main.params[ 'PING' ][ 'target7' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source8' ],
+            target=main.params[ 'PING' ][ 'target8' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source9' ],
+            target=main.params[ 'PING' ][ 'target9' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source10' ],
+            target=main.params[ 'PING' ][ 'target10' ],
+            pingTime=500 )
+
+        main.step( "Create TestONTopology object" )
+        global ctrls
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
+                temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
+                temp = temp + ( "ONOS" + str( count ), )
+                temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
+                temp = temp + \
+                    ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
+                ctrls.append( temp )
+                count = count + 1
+            else:
+                break
+        global MNTopo
+        Topo = TestONTopology(
+            main.Mininet1,
+            ctrls )  # can also add Intent API info for intent operations
+        MNTopo = Topo
+
+        TopologyCheck = main.TRUE
+        main.step( "Compare ONOS Topology to MN Topology" )
+        devicesJson = main.ONOS2.devices()
+        linksJson = main.ONOS2.links()
+        # portsJson = main.ONOS2.ports()
+
+        result1 = main.Mininet1.compareSwitches(
+            MNTopo,
+            json.loads( devicesJson ) )
+        result2 = main.Mininet1.compareLinks(
+            MNTopo,
+            json.loads( linksJson ) )
+        # result3 = main.Mininet1.comparePorts(
+        # MNTopo, json.loads( portsJson ) )
+
+        # result = result1 and result2 and result3
+        result = result1 and result2
+
+        print "***********************"
+        if result == main.TRUE:
+            main.log.report( "ONOS" + " Topology matches MN Topology" )
+        else:
+            main.log.report( "ONOS" + " Topology does not match MN Topology" )
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=result,
+            onpass="ONOS" +
+            " Topology matches MN Topology",
+            onfail="ONOS" +
+            " Topology does not match MN Topology" )
+
+        TopologyCheck = TopologyCheck and result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=TopologyCheck,
+            onpass="Topology checks passed",
+            onfail="Topology checks failed" )
+
+    def CASE7( self, main ):
+        from sts.topology.teston_topology import TestONTopology
+
+        linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+        main.log.report( "This testscase is killing a link to ensure that" +
+                         " link discovery is consistent" )
+        main.log.report( "__________________________________" )
+        main.log.report( "Killing a link to ensure that link discovery" +
+                         " is consistent" )
+        main.case( "Killing a link to Ensure that Link Discovery" +
+                   "is Working Properly" )
+        """
+        main.step( "Start continuous pings" )
+
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
+                               target=main.params[ 'PING' ][ 'target1' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
+                               target=main.params[ 'PING' ][ 'target2' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
+                               target=main.params[ 'PING' ][ 'target3' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
+                               target=main.params[ 'PING' ][ 'target4' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
+                               target=main.params[ 'PING' ][ 'target5' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
+                               target=main.params[ 'PING' ][ 'target6' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
+                               target=main.params[ 'PING' ][ 'target7' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
+                               target=main.params[ 'PING' ][ 'target8' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
+                               target=main.params[ 'PING' ][ 'target9' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
+                               target=main.params[ 'PING' ][ 'target10' ],
+                               pingTime=500 )
+        """
+        main.step( "Determine the current number of switches and links" )
+        topologyOutput = main.ONOS2.topology()
+        topologyResult = main.ONOS1.getTopology( topologyOutput )
+        activeSwitches = topologyResult[ 'devices' ]
+        links = topologyResult[ 'links' ]
+        print "activeSwitches = ", type( activeSwitches )
+        print "links = ", type( links )
+        main.log.info(
+            "Currently there are %s switches and %s links" %
+            ( str( activeSwitches ), str( links ) ) )
+
+        main.step( "Kill Link between s3 and s28" )
+        main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
+        time.sleep( linkSleep )
+        topologyOutput = main.ONOS2.topology()
+        LinkDown = main.ONOS1.checkStatus(
+            topologyOutput, activeSwitches, str(
+                int( links ) - 2 ) )
+        if LinkDown == main.TRUE:
+            main.log.report( "Link Down discovered properly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=LinkDown,
+            onpass="Link Down discovered properly",
+            onfail="Link down was not discovered in " +
+            str( linkSleep ) +
+            " seconds" )
+
+        # Check ping result here..add code for it
+
+        main.step( "Bring link between s3 and s28 back up" )
+        LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
+        time.sleep( linkSleep )
+        topologyOutput = main.ONOS2.topology()
+        LinkUp = main.ONOS1.checkStatus(
+            topologyOutput,
+            activeSwitches,
+            str( links ) )
+        if LinkUp == main.TRUE:
+            main.log.report( "Link up discovered properly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=LinkUp,
+            onpass="Link up discovered properly",
+            onfail="Link up was not discovered in " +
+            str( linkSleep ) +
+            " seconds" )
+
+        # NOTE Check ping result here..add code for it
+
+        main.step( "Compare ONOS Topology to MN Topology" )
+        Topo = TestONTopology(
+            main.Mininet1,
+            ctrls )  # can also add Intent API info for intent operations
+        MNTopo = Topo
+        TopologyCheck = main.TRUE
+
+        devicesJson = main.ONOS2.devices()
+        linksJson = main.ONOS2.links()
+        portsJson = main.ONOS2.ports()
+
+        result1 = main.Mininet1.compareSwitches(
+            MNTopo,
+            json.loads( devicesJson ) )
+        result2 = main.Mininet1.compareLinks(
+            MNTopo,
+            json.loads( linksJson ) )
+        # result3 = main.Mininet1.comparePorts(
+        # MNTopo, json.loads( portsJson ) )
+
+        # result = result1 and result2 and result3
+        result = result1 and result2
+        print "***********************"
+
+        if result == main.TRUE:
+            main.log.report( "ONOS" + " Topology matches MN Topology" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=result,
+            onpass="ONOS" +
+            " Topology matches MN Topology",
+            onfail="ONOS" +
+            " Topology does not match MN Topology" )
+
+        TopologyCheck = TopologyCheck and result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=TopologyCheck,
+            onpass="Topology checks passed",
+            onfail="Topology checks failed" )
+
+        result = LinkDown and LinkUp and TopologyCheck
+        utilities.assert_equals( expect=main.TRUE, actual=result,
+                                 onpass="Link failure is discovered correctly",
+                                 onfail="Link Discovery failed" )
+
+    def CASE8( self ):
+        """
+        Intent removal
+        """
+        import time
+        main.log.report( "This testcase removes any previously added intents" +
+                         " before adding any new set of intents" )
+        main.log.report( "__________________________________" )
+        main.log.info( "intent removal" )
+        main.case( "Removing installed intents" )
+        main.step( "Obtain the intent id's" )
+        intentResult = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + intentResult )
+        intentLinewise = intentResult.split( "\n" )
+        intentList = []
+        for line in intentLinewise:
+            if line.startswith( "id=" ):
+                intentList.append( line )
+
+        intentids = []
+        for line in intentList:
+            intentids.append( line.split( "," )[ 0 ].split( "=" )[ 1 ] )
+        for id in intentids:
+            print "id = ", id
+
+        main.step(
+            "Iterate through the intentids list and remove each intent" )
+        for id in intentids:
+            main.ONOS2.removeIntent( intentId=id )
+
+        intentResult = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + intentResult )
+
+        case8Result = main.TRUE
+        if case8Result == main.TRUE:
+            main.log.report( "Intent removal successful" )
+        else:
+            main.log.report( "Intent removal failed" )
+
+        PingResult = main.TRUE
+        if case8Result == main.TRUE:
+            i = 8
+            while i < 18:
+                main.log.info(
+                    "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+                ping = main.Mininet1.pingHost(
+                    src="h" + str( i ), target="h" + str( i + 10 ) )
+                if ping == main.TRUE:
+                    i = 19
+                    PingResult = PingResult and main.TRUE
+                elif ping == main.FALSE:
+                    i += 1
+                    PingResult = PingResult and main.FALSE
+                else:
+                    main.log.info( "Unknown error" )
+                    PingResult = main.ERROR
+
+            # Note: If the ping result failed, that means the intents have been
+            # withdrawn correctly.
+        if PingResult == main.TRUE:
+            main.log.report( "Installed intents have not been withdrawn correctly" )
+            # main.cleanup()
+            # main.exit()
+        if PingResult == main.FALSE:
+            main.log.report( "Installed intents have been withdrawn correctly" )
+
+        case8Result = case8Result and PingResult
+
+        if case8Result == main.FALSE:
+            main.log.report( "Intent removal successful" )
+        else:
+            main.log.report( "Intent removal failed" )
+
+        utilities.assert_equals( expect=main.FALSE, actual=case8Result,
+                                 onpass="Intent removal test passed",
+                                 onfail="Intent removal test failed" )
+
+    def CASE9( self ):
+        main.log.report(
+            "This testcase adds point intents and then does pingall" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Adding point intents" )
+        main.case(
+            "Adding bidirectional point for mn hosts" +
+            "( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22, " +
+            "h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )" )
+
+        main.step( "Add point intents for mn hosts h8 and h18 or" +
+                   "ONOS hosts h8 and h12" )
+        # main.step(var1)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/1",
+            "of:0000000000006018/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006018/1",
+            "of:0000000000003008/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
+        main.step(var2)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003009/1",
+            "of:0000000000006019/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006019/1",
+            "of:0000000000003009/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
+        main.step(var3)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003010/1",
+            "of:0000000000006020/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006020/1",
+            "of:0000000000003010/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var4 = "Add point intents for mininet hosts h11 and h21 or" +\
+               " ONOS hosts hB and h15"
+        main.case(var4)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003011/1",
+            "of:0000000000006021/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006021/1",
+            "of:0000000000003011/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var5 = "Add point intents for mininet hosts h12 and h22 " +\
+               "ONOS hosts hC and h16"
+        main.case(var5)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003012/1",
+            "of:0000000000006022/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006022/1",
+            "of:0000000000003012/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var6 = "Add point intents for mininet hosts h13 and h23 or" +\
+               " ONOS hosts hD and h17"
+        main.case(var6)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003013/1",
+            "of:0000000000006023/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006023/1",
+            "of:0000000000003013/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var7 = "Add point intents for mininet hosts h14 and h24 or" +\
+               " ONOS hosts hE and h18"
+        main.case(var7)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003014/1",
+            "of:0000000000006024/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006024/1",
+            "of:0000000000003014/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var8 = "Add point intents for mininet hosts h15 and h25 or" +\
+               " ONOS hosts hF and h19"
+        main.case(var8)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003015/1",
+            "of:0000000000006025/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006025/1",
+            "of:0000000000003015/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var9 = "Add intents for mininet hosts h16 and h26 or" +\
+               " ONOS hosts h10 and h1A"
+        main.case(var9)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003016/1",
+            "of:0000000000006026/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006026/1",
+            "of:0000000000003016/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var10 = "Add point intents for mininet hosts h17 and h27 or" +\
+                " ONOS hosts h11 and h1B"
+        main.case(var10)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003017/1",
+            "of:0000000000006027/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006027/1",
+            "of:0000000000003017/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            main.log.info( getIntentResult )
+
+        print(
+            "___________________________________________________________" )
+
+        flowHandle = main.ONOS2.flows()
+        #main.log.info( "flows :" + flowHandle )
+
+        count = 1
+        i = 8
+        PingResult = main.TRUE
+        while i < 18:
+            main.log.info(
+                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost(
+                src="h" + str( i ), target="h" + str( i + 10 ) )
+            if ping == main.FALSE and count < 5:
+                count += 1
+                # i = 8
+                PingResult = main.FALSE
+                main.log.report( "Ping between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 " failed. Making attempt number " +
+                                 str( count ) +
+                                 " in 2 seconds" )
+                time.sleep( 2 )
+            elif ping == main.FALSE:
+                main.log.report( "All ping attempts between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 "have failed" )
+                i = 19
+                PingResult = main.FALSE
+            elif ping == main.TRUE:
+                main.log.info( "Ping test between h" +
+                               str( i ) +
+                               " and h" +
+                               str( i +
+                                    10 ) +
+                               "passed!" )
+                i += 1
+                PingResult = main.TRUE
+            else:
+                main.log.info( "Unknown error" )
+                PingResult = main.ERROR
+
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Point intents have not ben installed correctly. Cleaning up" )
+            # main.cleanup()
+            # main.exit()
+        if PingResult == main.TRUE:
+            main.log.report( "Point Intents have been installed correctly" )
+
+        case9Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case9Result,
+            onpass="Point intents addition and Pingall Test successful",
+            onfail="Point intents addition and Pingall Test NOT successful" )
+
+
+    def CASE11( self ):
+        # NOTE: This testcase require reactive forwarding mode enabled
+        # NOTE: in the beginning and then uninstall it before adding 
+        # NOTE: point intents. Again the app is installed so that 
+        # NOTE: testcase 10 can be ran successively
+        import time
+        main.log.report(
+            "This testcase moves a host from one switch to another to add" +
+            "point intents between them and then perform ping" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Moving host from one switch to another" )
+        main.case( "Moving host from a device and attach it to another device" )
+        main.step( "Moving host h9 from device s9 and attach it to s8" )
+        main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
+        
+        time.sleep(15) #Time delay to have all the flows ready
+        main.step( "Pingall" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+        hosts = main.ONOS2.hosts( jsonFormat = False )
+        main.log.info( hosts )
+        
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd uninstalled" )
+
+        main.step( "Add point intents between hosts on the same device")
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/1",
+            "of:0000000000003008/3" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+    
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/3",
+            "of:0000000000003008/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+        
+        main.case( "Ping hosts on the same devices" )
+        ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
+        
+        main.case( "Installing reactive forwarding app" )
+        # Install onos-app-fwd app to enable reactive forwarding
+        appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd installed" )
+
+
+        if ping == main.FALSE:
+            main.log.report(
+                "Point intents for hosts on same devices haven't" +
+                " been installed correctly. Cleaning up" )
+        if ping == main.TRUE:
+            main.log.report(
+                "Point intents for hosts on same devices" +
+                "installed correctly. Cleaning up" )
+
+        case11Result = ping and pingResult 
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case11Result,
+            onpass= "Point intents for hosts on same devices" +
+                    "Ping Test successful",
+            onfail= "Point intents for hosts on same devices" +
+                    "Ping Test NOT successful" )
diff --git a/TestON/tests/ProdFunc/ProdFunc.params b/TestON/tests/ProdFunc/ProdFunc.params
index 1189301..c02cbd0 100755
--- a/TestON/tests/ProdFunc/ProdFunc.params
+++ b/TestON/tests/ProdFunc/ProdFunc.params
@@ -1,6 +1,7 @@
 <PARAMS>
     
-    <testcases>1,4,10,5,6,7,8,9,2,8,20,21,22,10,23,24</testcases>
+    <testcases>1,4,11,10,8,12,5,6</testcases>
+
     #Environment variables
     <ENV>
         <cellName>driver_test</cellName>
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
old mode 100755
new mode 100644
index 645ae22..fdba3ad
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -133,7 +133,7 @@
                                  onpass="Switch down discovery successful",
                                  onfail="Switch down discovery failed" )
 
-    def CASE11( self, main ):
+    def CASE101( self, main ):
         """
         Cleanup sequence:
         onos-service <nodeIp> stop
@@ -528,7 +528,7 @@
         import time
         main.log.report( "This testcase is testing the assignment of" +
                          " all the switches to all the controllers and" +
-                         " discovering the hists in reactive mode" )
+                         " discovering the hosts in reactive mode" )
         main.log.report( "__________________________________" )
         main.case( "Pingall Test" )
         main.step( "Assigning switches to controllers" )
@@ -688,7 +688,113 @@
             onpass="Reactive forwarding app uninstallation successful",
             onfail="Reactive forwarding app uninstallation failed" )
 
+
+    def CASE11( self ):
+        # NOTE: This testcase require reactive forwarding mode enabled
+        # NOTE: in the beginning and then uninstall it before adding 
+        # NOTE: point intents. Again the app is installed so that 
+        # NOTE: testcase 10 can be ran successively
+        import time
+        main.log.report(
+            "This testcase moves a host from one switch to another to add" +
+            "point intents between them and then perform ping" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Moving host from one switch to another" )
+        main.case( "Moving host from a device and attach it to another device" )
+        main.step( "Moving host h9 from device s9 and attach it to s8" )
+        main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
+
+        time.sleep(15) #Time delay to have all the flows ready
+        main.step( "Pingall" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+        hosts = main.ONOS2.hosts( jsonFormat = False )
+        main.log.info( hosts )
+        
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd uninstalled" )
+
+        main.step( "Add point intents between hosts on the same device")
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/1",
+            "of:0000000000003008/3" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/3",
+            "of:0000000000003008/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        main.case( "Ping hosts on the same devices" )
+        ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
+
+        '''
+        main.case( "Installing reactive forwarding app" )
+        # Install onos-app-fwd app to enable reactive forwarding
+        appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd installed" )
+        '''
+
+        if ping == main.FALSE:
+            main.log.report(
+                "Point intents for hosts on same devices haven't" +
+                " been installed correctly. Cleaning up" )
+        if ping == main.TRUE:
+            main.log.report(
+                "Point intents for hosts on same devices" +
+                "installed correctly. Cleaning up" )
+
+        case11Result = ping and pingResult
+        utilities.assert_equals(
+            expect = main.TRUE,
+            actual = case11Result,
+            onpass = "Point intents for hosts on same devices" +
+                    "Ping Test successful",
+            onfail = "Point intents for hosts on same devices" +
+                    "Ping Test NOT successful" )
+
+
+    def CASE12( self ):
+        """
+        Verify the default flows on each switch
+        """
+        main.log.report( "This testcase is verifying num of default" +
+                         " flows on each switch" )
+        main.log.report( "__________________________________" )
+        main.case( "Verify num of default flows on each switch" )
+        main.step( "Obtaining the device id's and flowrule count on them" )
+
+        case12Result = main.TRUE
+        idList = main.ONOS2.getAllDevicesId()
+        for id in idList:
+            count = main.ONOS2.FlowAddedCount( id )
+            main.log.info("count = " +count)
+            if int(count) != 3:
+                case12Result = main.FALSE
+                break
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case12Result,
+            onpass = "Expected default num of flows exist",
+            onfail = "Expected default num of flows do not exist")
+    
+    
+        
+
     def CASE6( self ):
+        import time
         main.log.report( "This testcase is testing the addition of" +
                          " host intents and then does pingall" )
         main.log.report( "__________________________________" )
@@ -740,15 +846,15 @@
             # NOTE: get host can return None
             # TODO: handle this
             host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
+      
             host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
             main.ONOS2.addHostIntent( host1Id, host2Id )
-            hIntents = main.ONOS2.intents( jsonFormat=False )
-            main.log.info( "intents:" + hIntents )
 
         time.sleep( 10 )
         hIntents = main.ONOS2.intents( jsonFormat=False )
         main.log.info( "intents:" + hIntents )
-        main.ONOS2.flows()
+        flows = main.ONOS2.flows()
+        main.log.info( "flows:" + flows )     
 
         count = 1
         i = 8
@@ -1077,14 +1183,11 @@
         intentResult = main.ONOS2.intents( jsonFormat=False )
         main.log.info( "intent_result = " + intentResult )
         intentLinewise = intentResult.split( "\n" )
-        intentList = []
-        for line in intentLinewise:
-            if line.startswith( "id=" ):
-                intentList.append( line )
 
-        intentids = []
-        for line in intentList:
-            intentids.append( line.split( "," )[ 0 ].split( "=" )[ 1 ] )
+        intentList = [line for line in intentLinewise \
+            if line.startswith( "id=")]
+        intentids = [line.split( "," )[ 0 ].split( "=" )[ 1 ] for line in \
+            intentList]
         for id in intentids:
             print "id = ", id
 
@@ -1095,8 +1198,20 @@
 
         intentResult = main.ONOS2.intents( jsonFormat=False )
         main.log.info( "intent_result = " + intentResult )
-
-        case8Result = main.TRUE
+        
+        intentList = [line for line in intentResult.split( "\n" ) \
+            if line.startswith( "id=")]
+        intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
+            intentList]
+        for state in intentState:
+            print state
+        
+        case8Result = main.TRUE        
+        for state in intentState:
+            if state != 'WITHDRAWN':
+                case8Result = main.FALSE
+                break
+                
         if case8Result == main.TRUE:
             main.log.report( "Intent removal successful" )
         else:
@@ -1328,7 +1443,7 @@
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            main.log.info( getIntentResult )
+            #main.log.info( getIntentResult )
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006027/1",
@@ -1336,7 +1451,7 @@
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            main.log.info( getIntentResult )
+            #main.log.info( getIntentResult )
 
         print(
             "___________________________________________________________" )
diff --git a/TestON/tests/ProdFunc/ProdFunc.topo b/TestON/tests/ProdFunc/ProdFunc.topo
index c3fe280..73a0b4f 100755
--- a/TestON/tests/ProdFunc/ProdFunc.topo
+++ b/TestON/tests/ProdFunc/ProdFunc.topo
@@ -63,7 +63,7 @@
                 #Specify the Option for mininet
                 <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
                 <arg2> --topo mytopo </arg2>
-                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
                 <controller> remote </controller>
             </COMPONENTS>
         </Mininet2>
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.params b/TestON/tests/ProdFunc13/ProdFunc13.params
index bb3c11c..f28d620 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.params
+++ b/TestON/tests/ProdFunc13/ProdFunc13.params
@@ -1,6 +1,6 @@
 <PARAMS>
     
-    <testcases>1,4,10,5,6,7,8,9,2,20,21,22,10,23,24</testcases>
+    <testcases>1,4,11,10,5,6,7,8,12,9,2,20,21,22,10,23,24</testcases>
 
     #Environment variables
     <ENV>
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
index 13dc26d..afa538f 100644
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -133,7 +133,7 @@
                                  onpass="Switch down discovery successful",
                                  onfail="Switch down discovery failed" )
 
-    def CASE11( self, main ):
+    def CASE101( self, main ):
         """
         Cleanup sequence:
         onos-service <nodeIp> stop
@@ -528,7 +528,7 @@
         import time
         main.log.report( "This testcase is testing the assignment of" +
                          " all the switches to all the controllers and" +
-                         " discovering the hists in reactive mode" )
+                         " discovering the hosts in reactive mode" )
         main.log.report( "__________________________________" )
         main.case( "Pingall Test" )
         main.step( "Assigning switches to controllers" )
@@ -688,7 +688,107 @@
             onpass="Reactive forwarding app uninstallation successful",
             onfail="Reactive forwarding app uninstallation failed" )
 
+
+    def CASE11( self ):
+        # NOTE: This testcase require reactive forwarding mode enabled
+        # NOTE: in the beginning and then uninstall it before adding 
+        # NOTE: point intents. Again the app is installed so that 
+        # NOTE: testcase 10 can be ran successively
+        import time
+        main.log.report(
+            "This testcase moves a host from one switch to another to add" +
+            "point intents between them and then perform ping" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Moving host from one switch to another" )
+        main.case( "Moving host from a device and attach it to another device" )
+        main.step( "Moving host h9 from device s9 and attach it to s8" )
+        main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
+
+        time.sleep(15) #Time delay to have all the flows ready
+        main.step( "Pingall" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+        hosts = main.ONOS2.hosts( jsonFormat = False )
+        main.log.info( hosts )
+        
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd uninstalled" )
+
+        main.step( "Add point intents between hosts on the same device")
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/1",
+            "of:0000000000003008/3" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/3",
+            "of:0000000000003008/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        main.case( "Ping hosts on the same devices" )
+        ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
+
+        '''
+        main.case( "Installing reactive forwarding app" )
+        # Install onos-app-fwd app to enable reactive forwarding
+        appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd installed" )
+        '''
+
+        if ping == main.FALSE:
+            main.log.report(
+                "Point intents for hosts on same devices haven't" +
+                " been installed correctly. Cleaning up" )
+        if ping == main.TRUE:
+            main.log.report(
+                "Point intents for hosts on same devices" +
+                "installed correctly. Cleaning up" )
+
+        case11Result = ping and pingResult
+        utilities.assert_equals(
+            expect = main.TRUE,
+            actual = case11Result,
+            onpass = "Point intents for hosts on same devices" +
+                    "Ping Test successful",
+            onfail = "Point intents for hosts on same devices" +
+                    "Ping Test NOT successful" )
+
+
+    def CASE12( self ):
+        """
+        Verify the default flows on each switch
+        """
+        case12Result = main.TRUE
+        idList = main.ONOS2.getAllDevicesId()
+        for id in idList:
+            count = main.ONOS2.FlowStateCount( id )
+            print "count = ", count
+            if count != 5:
+                case12Result = main.FALSE
+        
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case12Result,
+            onpass = "Expected default num of flows exist",
+            onfail = "Expected default num of flows do not exist")
+    
+    
+        
+
     def CASE6( self ):
+        import time
         main.log.report( "This testcase is testing the addition of" +
                          " host intents and then does pingall" )
         main.log.report( "__________________________________" )
@@ -740,15 +840,15 @@
             # NOTE: get host can return None
             # TODO: handle this
             host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
+      
             host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
             main.ONOS2.addHostIntent( host1Id, host2Id )
-            hIntents = main.ONOS2.intents( jsonFormat=False )
-            main.log.info( "intents:" + hIntents )
 
         time.sleep( 10 )
         hIntents = main.ONOS2.intents( jsonFormat=False )
         main.log.info( "intents:" + hIntents )
-        main.ONOS2.flows()
+        flows = main.ONOS2.flows()
+        main.log.info( "flows:" + flows )     
 
         count = 1
         i = 8
@@ -1077,14 +1177,11 @@
         intentResult = main.ONOS2.intents( jsonFormat=False )
         main.log.info( "intent_result = " + intentResult )
         intentLinewise = intentResult.split( "\n" )
-        intentList = []
-        for line in intentLinewise:
-            if line.startswith( "id=" ):
-                intentList.append( line )
 
-        intentids = []
-        for line in intentList:
-            intentids.append( line.split( "," )[ 0 ].split( "=" )[ 1 ] )
+        intentList = [line for line in intentLinewise \
+            if line.startswith( "id=")]
+        intentids = [line.split( "," )[ 0 ].split( "=" )[ 1 ] for line in \
+            intentList]
         for id in intentids:
             print "id = ", id
 
@@ -1095,8 +1192,20 @@
 
         intentResult = main.ONOS2.intents( jsonFormat=False )
         main.log.info( "intent_result = " + intentResult )
-
-        case8Result = main.TRUE
+        
+        intentList = [line for line in intentResult.split( "\n" ) \
+            if line.startswith( "id=")]
+        intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
+            intentList]
+        for state in intentState:
+            print state
+        
+        case8Result = main.TRUE        
+        for state in intentState:
+            if state != 'WITHDRAWN':
+                case8Result = main.FALSE
+                break
+                
         if case8Result == main.TRUE:
             main.log.report( "Intent removal successful" )
         else:
@@ -1328,7 +1437,7 @@
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            main.log.info( getIntentResult )
+            #main.log.info( getIntentResult )
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006027/1",
@@ -1336,7 +1445,7 @@
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            main.log.info( getIntentResult )
+            #main.log.info( getIntentResult )
 
         print(
             "___________________________________________________________" )