diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index a6436ca..073e368 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1275,7 +1275,7 @@
             main.log.error( "Connection failed to the host" )
         return response
 
-    def stopNet( self, timeout=5):
+    def stopNet( self, fileName = "", timeout=5):
         """
         Stops mininet.
         Returns main.TRUE if the mininet successfully stops and
@@ -1304,7 +1304,7 @@
                 main.log.info( self.name + ": Stopped")
                 self.handle.sendline( "sudo mn -c" )
                 response = main.TRUE
-
+                
                 if i == 1:
                     main.log.info( " Mininet trying to exit while not " +
                                    "in the mininet prompt" )
@@ -1314,6 +1314,10 @@
                     main.log.error( "Something went wrong exiting mininet " +
                                     "TIMEOUT" )
                 
+                if fileName:
+                    self.handle.sendline("")
+                    self.handle.expect('\$')
+                    self.handle.sendline("sudo kill -9 \`ps -ef | grep \""+ fileName +"\" | grep -v grep | awk '{print $2}'\`")
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
index 02a016c..9066177 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -8,22 +8,22 @@
     # 6. Install 300 host intents and verify ping all
     # 7. Randomly bring some core links down and verify pingall
     # 8. Bring core links Up that were down and verify pingall
-    # 9. Install 114 point intents and verify ping all
+    # 9. Install 300 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
+    # 1,2,3,4,5,6,10,12,3,4,5,6,10,13,3,4,5,6,10 [2,3,4,5,6,70,80,10,9,10]*25
 
-    <testcases>1,[2,3,4,5,6,70,80,10,12,3,4,5,14,10,13,3,4,5,15,10]*3</testcases>
+    <testcases>1,2,[3,4,5,6,70,80,10,9,71,81,10]*25,12,[3,41,5,72,82,14,10]*25,13,[3,42,5,73,83,15,10]*25</testcases>
     <ENV>
-        <cellName>choTest5New</cellName>
+        <cellName>choTest5</cellName>
     </ENV>
     <GIT>
         #autoPull 'on' or 'off'
         <autoPull>off</autoPull>
         <branch>master</branch>
-    </GIT>
+    </GIT>-t
     <TOPO1>
-	<topo>~/mininet/custom/topoAtt.py</topo>
+	<topo>~/mininet/custom/topoAtt.py</topo>t
 	<numSwitches>25</numSwitches>
 	<numHosts>25</numHosts>
 	<numLinks>114</numLinks>
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index 93dc11b..7c09872 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -42,7 +42,7 @@
         cell_name = main.params[ 'ENV' ][ 'cellName' ]
         git_pull = main.params[ 'GIT' ][ 'autoPull' ]
         git_branch = main.params[ 'GIT' ][ 'branch' ]
-        
+        main.newTopo = ""
         main.CLIs = []
         main.nodes = []
         for i in range( 1, int(main.numCtrls) + 1 ):
@@ -102,8 +102,8 @@
                                      onfail="Test step FAIL" )
             uninstallResult = ( uninstallResult and u_result )
 
-        main.step( "Removing copy-cat logs from ONOS nodes" )
-        main.ONOSbench.onosRemoveRaftLogs()
+        #main.step( "Removing copy-cat logs from ONOS nodes" )
+        #main.ONOSbench.onosRemoveRaftLogs()
 
         main.step( "Install ONOS package on all Nodes" )
         installResult = main.TRUE
@@ -126,7 +126,7 @@
                                      onpass="Test step PASS",
                                      onfail="Test step FAIL" )
             statusResult = ( statusResult and onos_status )
-
+        
         main.step( "Start ONOS CLI on all nodes" )
         cliResult = main.TRUE
         karafTimeout = "3600000"
@@ -152,8 +152,8 @@
         
         if not startCliResult:
                 main.log.info("ONOS CLI did not start up properly")
-                main.cleanup()
-                main.exit()
+                #main.cleanup()
+                #main.exit()
         else:
             main.log.info("Successful CLI startup")
             startCliResult = main.TRUE
@@ -164,28 +164,35 @@
                                  onpass="Set up test environment PASS",
                                  onfail="Set up test environment FAIL" )
         time.sleep(30)
+
     def CASE2( self, main ):
         """
-        This test loads a Topology (ATT) on Mininet and balances all switches.
+        This test script Loads a new Topology (Att) on CHO setup and balances all switches
         """
         import re
         import time
         import copy
+
         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.pingTimeout = 60 
         main.log.report(
-            "Assign and Balance all Mininet switches across controllers" )
+            "Load Att topology and Balance all Mininet switches across controllers" )
         main.log.report(
-            "_________________________________________________________" )
-        # need to wait here for sometime. This will be removed once ONOS is
-        # stable enough
-        time.sleep( 15 )
+            "________________________________________________________________________" )
         main.case(
             "Assign and Balance all Mininet switches across controllers" )
+        main.step( "Stop any previous Mininet network topology" )
+        cliResult = main.TRUE
+        if main.newTopo == main.params['TOPO3']['topo']:
+            stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
+
+        main.step( "Start Mininet with Att topology" )
+        main.newTopo = main.params['TOPO1']['topo']
+        startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
+
         main.step( "Assign switches to controllers" )
-        netStatus = main.Mininet1.startNet()
         for i in range( 1, ( main.numMNswitches + 1 ) ):  # 1 to ( num of switches +1 )
             main.Mininet1.assignSwController(
                 sw=str( i ),
@@ -214,19 +221,22 @@
             main.log.report( "Controller assignment successfull" )
         else:
             main.log.report( "Controller assignment failed" )
-        time.sleep( 15 )
-
-        #main.step( "Balance devices across controllers" )
-        #for i in range( int( main.numCtrls ) ):
-        #    balanceResult = main.ONOScli1.balanceMasters()
+        time.sleep( 5 )
+        #Don't balance master for now..
+        """
+        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 )
-
-        #utilities.assert_equals(
-         #   expect=main.TRUE,
-          #  actual=balanceResult,
-           # onpass="Assign and Balance devices test PASS",
-            #onfail="Assign and Balance devices test FAIL" )
+            time.sleep( 3 )
+        """
+        case2Result = ( switch_mastership and startStatus )
+        time.sleep(45)
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case2Result,
+            onpass="Starting new Att topology test PASS",
+            onfail="Starting new Att topology test FAIL" )
 
     def CASE3( self, main ):
         """
@@ -245,14 +255,13 @@
             "Collect and Store topology details from ONOS before running any Tests" )
         main.log.report(
             "____________________________________________________________________" )
-        main.case( "Collect and Store Topology Deatils from ONOS" )
+        main.case( "Collect and Store Topology Details 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[ 'deviceCount' ]
         numOnosLinks = topology_result[ 'linkCount' ]
-        print numOnosDevices
-        print numOnosLinks
+        topoResult = main.TRUE
 
         if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks >= int(numOnosLinks) ) ):
             main.step( "Store Device DPIDs" )
@@ -264,7 +273,10 @@
             for i in range( 1, ( main.numMNhosts + 1 ) ):
                 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
             print "Host MACs in Store: \n", str( main.hostMACs )
-
+            main.MACsDict = {}
+            for i in range(len(main.deviceDPIDs)):
+                main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
+            print main.MACsDict
             main.step( "Collect and store all Devices Links" )
             linksResult = main.ONOScli1.links( jsonFormat=False )
             ansi_escape = re.compile( r'\x1b[^m]*m' )
@@ -330,24 +342,26 @@
             main.log.info("Devices (actual): %s, Links (actual): %s" %
                     ( numOnosDevices , numOnosLinks ) )
             main.log.info("Topology does not match, exiting CHO test...")
+            topoResult = main.FALSE
+            
             #time.sleep(300)
-            main.cleanup()
-            main.exit()
+            #main.cleanup()
+            #main.exit()
 
         # just returning TRUE for now as this one just collects data
-        case3Result = main.TRUE
+        case3Result = topoResult
         utilities.assert_equals( expect=main.TRUE, actual=case3Result,
                                  onpass="Saving ONOS topology data test PASS",
                                  onfail="Saving ONOS topology data test FAIL" )
 
     def CASE4( self, main ):
         """
-        Enable onos-app-fwd, Verify Reactive forwarding through ping all and Disable it
+        Verify Reactive forwarding (Att Topology)
         """
         import re
         import copy
         import time
-        main.log.report( "Enable Reactive forwarding and Verify ping all" )
+        main.log.report( "Verify Reactive forwarding (Att Topology)" )
         main.log.report( "______________________________________________" )
         main.case( "Enable Reactive forwarding and Verify ping all" )
         main.step( "Enable Reactive forwarding" )
@@ -373,8 +387,8 @@
         
         if not installResult:
                 main.log.info("Did not install onos-app-fwd feature properly")
-                main.cleanup()
-                main.exit()
+                #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))
@@ -416,14 +430,192 @@
         
         if not uninstallResult:
                 main.log.info("Did not uninstall onos-app-fwd feature properly")
-                main.cleanup()
-                main.exit()
+                #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( 20 )
+        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" )
+
+    def CASE41( self, main ):
+        """
+        Verify Reactive forwarding (Chordal Topology)
+        """
+        import re
+        import copy
+        import time
+        main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
+        main.log.report( "______________________________________________" )
+        main.case( "Enable Reactive forwarding and Verify ping all" )
+        main.step( "Enable Reactive forwarding" )
+        installResult = main.TRUE
+        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(timeout=main.pingTimeout)
+        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 Reactive forwarding" )
+        uninstallResult = main.TRUE
+        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( 20 )
+        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" )
+
+    def CASE42( self, main ):
+        """
+        Verify Reactive forwarding (Spine Topology)
+        """
+        import re
+        import copy
+        import time
+        main.log.report( "Verify Reactive forwarding (Spine Topology)" )
+        main.log.report( "______________________________________________" )
+        main.case( "Enable Reactive forwarding and Verify ping all" )
+        main.step( "Enable Reactive forwarding" )
+        installResult = main.TRUE
+        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(timeout=main.pingTimeout)
+        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 Reactive forwarding" )
+        uninstallResult = main.TRUE
+        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( 20 )
         case4Result =  installResult and uninstallResult and ping_result
         utilities.assert_equals( expect=main.TRUE, actual=case4Result,
                                  onpass="Reactive Mode Pingall test PASS",
@@ -526,9 +718,9 @@
 
     def CASE6( self ):
         """
-        Install 300 host intents and verify ping all
+        Install 300 host intents and verify ping all (Att Topology)
         """
-        main.log.report( "Add 300 host intents and verify pingall" )
+        main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
         main.log.report( "_______________________________________" )
         import itertools
         import time
@@ -539,6 +731,11 @@
         
         intentIdList = []
         time1 = time.time()
+        """
+        for i in xrange(0 ,len(hostCombos)):
+            tempId = ONOScli1.addHostIntent( hostCombos[i][0],hostCombos[i][1]] )
+            intentIdList.append(hostCombos[i][0],hostCombos[i][1]])
+        """
         for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
             pool = []
             for cli in main.CLIs:
@@ -549,7 +746,7 @@
                         name="addHostIntent",
                         args=[hostCombos[i][0],hostCombos[i][1]])
                 pool.append(t)
-                time.sleep(1)
+                #time.sleep(1)
                 t.start()
                 i = i + 1
                 main.threadID = main.threadID + 1
@@ -557,12 +754,13 @@
                 thread.join()
                 intentIdList.append(thread.result)
         time2 = time.time()
-        main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
+        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
+        # Takes awhile for all the onos to get the intents
         time.sleep(30)
         main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
@@ -588,7 +786,7 @@
 
     def CASE70( self, main ):
         """
-        Randomly bring some core links down and verify ping all ( Host Intents Scenario )
+        Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
         """
         import random
         main.randomLink1 = []
@@ -603,15 +801,15 @@
         switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
         link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
 
-        main.log.report( "Host intents - Randomly bring some core links down and verify ping all" )
-        main.log.report( "_________________________________________________________________" )
+        main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
+        main.log.report( "___________________________________________________________________________" )
         main.case( "Host intents - Randomly bring some core links down and verify ping all" )
         main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
         if ( int( switchLinksToToggle ) ==
              0 or int( switchLinksToToggle ) > 5 ):
             main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
-            main.cleanup()
-            main.exit()
+            #main.cleanup()
+            #main.exit()
         else:
             main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
 
@@ -667,7 +865,7 @@
 
     def CASE80( self, main ):
         """
-        Bring the core links up that are down and verify ping all ( Host Intents Scenario )
+        Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
         """
         import random
         link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
@@ -677,7 +875,7 @@
         switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
 
         main.log.report(
-            "Host intents - Bring the core links up that are down and verify ping all" )
+            "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
         main.log.report(
             "__________________________________________________________________" )
         main.case(
@@ -732,7 +930,7 @@
 
     def CASE71( self, main ):
         """
-        Randomly bring some core links down and verify ping all ( Point Intents Scenario )
+        Randomly bring some core links down and verify ping all ( Point Intents-Att Topo )
         """
         import random
         main.randomLink1 = []
@@ -747,7 +945,7 @@
         switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
         link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
 
-        main.log.report( "Point Intents - Randomly bring some core links down and verify ping all" )
+        main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo" )
         main.log.report( "__________________________________________________________________" )
         main.case( "Point Intents - Randomly bring some core links down and verify ping all" )
         main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
@@ -755,8 +953,8 @@
              0 or int( switchLinksToToggle ) > 5 ):
             main.log.info(
                 "Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
-            main.cleanup()
-            main.exit()
+            #main.cleanup()
+            #main.exit()
         else:
             main.log.info(
                 "User provided Core switch links range to toggle is correct, proceeding to run the test" )
@@ -813,7 +1011,7 @@
 
     def CASE81( self, main ):
         """
-        Bring the core links up that are down and verify ping all ( Point Intents Scenario )
+        Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
         """
         import random
         link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
@@ -823,7 +1021,7 @@
         switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
 
         main.log.report(
-            "Point intents - Bring the core links up that are down and verify ping all" )
+            "Bring the core links up that are down and verify ping all (Point Intents-Att Topo" )
         main.log.report(
             "___________________________________________________________________" )
         main.case(
@@ -876,56 +1074,272 @@
                                  onpass="Link Up Test PASS",
                                  onfail="Link Up Test FAIL" )
 
+    def CASE72( self, main ):
+        """
+        Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
+        """
+        import random
+        import itertools 
+        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+        
+        main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
+        main.log.report( "___________________________________________________________________________" )
+        main.case( "Host intents - Randomly bring some core links down and verify ping all" )
+        switches = []
+        switchesComb = []
+        for i in range( main.numMNswitches ):
+            switches.append('s%d'%(i+1))
+        switchesLinksComb = list(itertools.combinations(switches,2))
+        main.randomLinks = random.sample(switchesLinksComb, 5 )
+        print main.randomLinks
+        main.step( "Cut links on random devices" )
+        
+        for switch in main.randomLinks:
+            main.Mininet1.link(
+                END1=switch[0],
+                END2=switch[1],
+                OPTION="down")
+        time.sleep( link_sleep )
+
+        topology_output = main.ONOScli2.topology()
+        linkDown = main.ONOSbench.checkStatus(
+            topology_output, main.numMNswitches, str(
+                int( main.numMNlinks ) - 5 * 2 ) )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linkDown,
+            onpass="Link Down discovered properly",
+            onfail="Link down was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
+
+        main.step( "Verify Ping across all hosts" )
+        pingResultLinkDown = main.FALSE
+        time1 = time.time()
+        pingResultLinkDown = 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=pingResultLinkDown,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
+
+        caseResult72 = pingResultLinkDown
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult72,
+                                 onpass="Random Link cut Test PASS",
+                                 onfail="Random Link cut Test FAIL" )
+
+    def CASE82( self, main ):
+        """
+        Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
+        """
+        import random
+        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+       
+        main.log.report(
+            "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
+        main.log.report(
+            "__________________________________________________________________" )
+        main.case(
+            "Host intents - Bring the core links up that are down and verify ping all" )
+        main.step( "Bring randomly cut links on devices up" )
+        
+        for switch in main.randomLinks:
+            main.Mininet1.link(
+                END1=switch[0],
+                END2=switch[1],
+                OPTION="up")
+
+        time.sleep( link_sleep )
+
+        topology_output = main.ONOScli2.topology()
+        linkUp = main.ONOSbench.checkStatus(
+            topology_output,
+            main.numMNswitches,
+            str( main.numMNlinks ) )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linkUp,
+            onpass="Link up discovered properly",
+            onfail="Link up was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
+
+        main.step( "Verify Ping across all hosts" )
+        pingResultLinkUp = main.FALSE
+        time1 = time.time()
+        pingResultLinkUp = main.Mininet1.pingall()
+        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=pingResultLinkUp,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
+
+        caseResult82 = linkUp and pingResultLinkUp
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult82,
+                                 onpass="Link Up Test PASS",
+                                 onfail="Link Up Test FAIL" )
+ 
+    def CASE73( self, main ):
+        """
+        Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
+        """
+        import random
+        main.pingTimeout = 600
+        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+        main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
+        main.log.report( "___________________________________________________________________________" )
+
+        main.someLinks = [('s1','s9'),('s3','s9'),('s6','s10'),('s8','s10')]
+        for switch in main.someLinks:
+            main.Mininet1.link(
+                END1=switch[0],
+                END2=switch[1],
+                OPTION="down" )
+        time.sleep( link_sleep )
+
+        topology_output = main.ONOScli2.topology()
+        linkDown = main.ONOSbench.checkStatus(
+            topology_output, main.numMNswitches, str(
+                int( main.numMNlinks ) - 8 ))
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linkDown,
+            onpass="Link Down discovered properly",
+            onfail="Link down was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
+
+        main.step( "Verify Ping across all hosts" )
+        pingResultLinkDown = main.FALSE
+        time1 = time.time()
+        pingResultLinkDown = 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=pingResultLinkDown,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
+
+        caseResult73 = linkDown and pingResultLinkDown
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult73,
+                                 onpass="Random Link cut Test PASS",
+                                 onfail="Random Link cut Test FAIL" )
+
+    def CASE83( self, main ):
+        """
+        Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
+        """
+        import random
+
+        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+        main.log.report(
+            "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
+        main.log.report(
+            "__________________________________________________________________" )
+        main.case(
+            "Host intents - Bring the core links up that are down and verify ping all" )
+        
+        for switch in main.someLinks:
+            main.Mininet1.link(
+                END1=switch[0],
+                END2=switch[1],
+                OPTION="up")
+        time.sleep( link_sleep )
+
+        topology_output = main.ONOScli2.topology()
+        linkUp = main.ONOSbench.checkStatus(
+            topology_output,
+            main.numMNswitches,
+            str( main.numMNlinks ) )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linkUp,
+            onpass="Link up discovered properly",
+            onfail="Link up was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
+
+        main.step( "Verify Ping across all hosts" )
+        pingResultLinkUp = main.FALSE
+        time1 = time.time()
+        pingResultLinkUp = main.Mininet1.pingall()
+        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=pingResultLinkUp,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
+
+        caseResult83 = linkUp and pingResultLinkUp
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult83,
+                                 onpass="Link Up Test PASS",
+                                 onfail="Link Up Test FAIL" )
+        
     def CASE9( self ):
         """
-        Install 114 point intents and verify Ping all works
+        Install 600 point intents and verify ping all (Att Topology)
         """
-        import copy
-        main.log.report( "Install 114 point intents and verify Ping all" )
-        main.log.report( "___________________________________________" )
-        main.case( "Install 114 point intents and Ping all" )
-        deviceLinksCopy = copy.copy( main.deviceLinks )
-        main.step( "Install 114 point intents" )
-        for i in range( len( deviceLinksCopy ) ):
-            pointLink = str(
-                deviceLinksCopy[ i ] ).replace(
-                "src=",
-                "" ).replace(
-                "dst=",
-                "" ).split( ',' )
-            point1 = pointLink[ 0 ].split( '/' )
-            point2 = pointLink[ 1 ].split( '/' )
-            installResult = main.ONOScli1.addPointIntent(
-                point1[ 0 ], point2[ 0 ], int(
-                    point1[ 1 ] ), int(
-                    point2[ 1 ] ) )
-            if installResult == main.TRUE:
-                print "Installed Point intent between :", point1[ 0 ], int( point1[ 1 ] ), point2[ 0 ], int( point2[ 1 ] )
-
-        main.step( "Obtain the intent id's" )
-        intentsList = main.ONOScli1.getAllIntentIds()
-        ansi_escape = re.compile( r'\x1b[^m]*m' )
-        intentsList = ansi_escape.sub( '', intentsList )
-        intentsList = intentsList.replace(
-            " onos:intents | grep id=",
-            "" ).replace(
-            "id=",
-            "" ).replace(
-            "\r\r",
-             "" )
-        intentsList = intentsList.splitlines()
-        intentsList = intentsList[ 1: ]
+        main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
+        main.log.report( "_______________________________________" )
+        import itertools
+        import time
+        main.case( "Install 600 point intents" )
+        main.step( "Add point Intents" )
+        intentResult = main.TRUE
+        deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) 
+        
         intentIdList = []
-        for i in range( len( intentsList ) ):
-            intentsTemp = intentsList[ i ].split( ',' )
-            intentIdList.append( intentsTemp[ 0 ] )
-        print "Intent IDs: ", intentIdList
-        print "Total Intents installed: ", len( intentIdList )
-
+        time1 = time.time()
+        """
+        for i in xrange(0 ,len(hostCombos)):
+            tempId = ONOScli1.addHostIntent( hostCombos[i][0],hostCombos[i][1]] )
+            intentIdList.append(hostCombos[i][0],hostCombos[i][1]])
+        """
+        for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
+            pool = []
+            for cli in main.CLIs:
+                if i >= len( deviceCombos ):
+                    break
+                t = main.Thread( target=cli.addPointIntent,
+                        threadID=main.threadID,
+                        name="addPointIntent",
+                        args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
+                pool.append(t)
+                #time.sleep(1)
+                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 point intents: %2f seconds" %(time2-time1)) 
+        intentResult = main.TRUE
+        intentsJson = main.ONOScli2.intents()
+        getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+                intentsJson = intentsJson)
+        print getIntentStateResult
+        # Takes awhile for all the onos to get the intents
+        time.sleep(30)
         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(
@@ -936,13 +1350,15 @@
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        case8_result = installResult and pingResult
+        case6Result = ( intentResult and pingResult )
+        
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case8_result,
-            onpass="Ping all test after Point intents addition successful",
-            onfail="Ping all test after Point intents addition failed" )
-
+            actual=case6Result,
+            onpass="Install 600 point Intents and Ping All test PASS",
+            onfail="Install 600 point Intents and Ping All test FAIL" )
+        main.cleanup()
+        main.exit()
     def CASE90( self ):
         """
         Install single-multi point intents and verify Ping all works
@@ -1176,6 +1592,8 @@
             results = main.TRUE
             main.log.info("Removing intent...")
             while moreIntents:
+                if removeIntentCount == 5:
+                    break
                 removeIntentCount = removeIntentCount + 1
                 intentsList1 = main.ONOScli1.getAllIntentIds()
                 if len( intentsList1 ) == 0:
@@ -1194,7 +1612,7 @@
                 print "Round %d intents to remove: " %(removeIntentCount)
                 print intentsList1
                 intentIdList1 = []
-                if ( len( intentsList1 ) > 1 ):
+                if ( len( intentsList1 ) > 0 ):
                     moreIntents = main.TRUE
                     for i in range( len( intentsList1 ) ):
                         intentsTemp1 = intentsList1[ i ].split( ',' )
@@ -1203,13 +1621,12 @@
                     print len(intentIdList1)
                     for intent in intentIdList1:
                         main.CLIs[0].removeIntent(intent,'org.onosproject.cli',True,False)
+                    time.sleep(10)
                 else:
                     time.sleep(15)
-                    if len(main.ONOScli1.intents()):
+                    if len( main.ONOScli1.intents()):
                         continue
                     break
-                if removeIntentCount == 5:
-                    break
 
             else:
                 print "There are no more intents that need to be removed"
@@ -1260,8 +1677,8 @@
         
         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()
+                #main.cleanup()
+                #main.exit()
         else:
             main.log.info("Successful feature:install onos-app-ifwd")
             installResult = main.TRUE
@@ -1303,8 +1720,9 @@
         
         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()
+                uninstallResult = main.FALSE
+                #main.cleanup()
+                #main.exit()
         else:
             main.log.info("Successful feature:uninstall onos-app-ifwd")
             uninstallResult = main.TRUE
@@ -1326,40 +1744,23 @@
         import time
         import copy
 
-        Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
-        newTopo = main.params['TOPO2']['topo']
+        main.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
-        
-        time.sleep(60)
+        main.pingTimeout = 120
         main.log.report(
             "Load Chordal topology and Balance all Mininet switches across controllers" )
         main.log.report(
             "________________________________________________________________________" )
-        # need to wait here for sometime until ONOS bootup
-        time.sleep( 15 )
         main.case(
             "Assign and Balance all Mininet switches across controllers" )
         main.step( "Stop any previous Mininet network topology" )
-        stopStatus = main.Mininet1.stopNet()
-
-        # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
-        main.step( "Stop ONOS on all Nodes" )
-        stopResult = main.TRUE
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
-            sresult = main.ONOSbench.onosStop( ONOS_ip )
-            utilities.assert_equals( expect=main.TRUE, actual=sresult,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            stopResult = ( stopResult and sresult )
-
+        stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
+        time.sleep(10)
         main.step( "Start Mininet with Chordal topology" )
-        startStatus = main.Mininet1.startNet(topoFile = newTopo)
-
+        startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
+        time.sleep(15)
         main.step( "Assign switches to controllers" )
         for i in range( 1, ( main.numMNswitches + 1 ) ):  # 1 to ( num of switches +1 )
             main.Mininet1.assignSwController(
@@ -1390,61 +1791,23 @@
         else:
             main.log.report( "Controller assignment failed" )
         time.sleep( 5 )
-
-        main.step( "Start ONOS on all Nodes" )
-        startResult = main.TRUE
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
-            sresult = main.ONOSbench.onosStart( ONOS_ip )
-            utilities.assert_equals( expect=main.TRUE, actual=sresult,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            startResult = ( startResult and sresult )
-
-        main.step( "Start ONOS CLI on all nodes" )
-        cliResult = main.TRUE
-        #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 )
-
-        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))
-
+        #Don't balance master for now..
+        """
         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 )
-
-        case12Result = ( startResult and cliResult )
+        """
+        case12Result = switch_mastership
+        time.sleep(30)
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case12Result,
             onpass="Starting new Chordal topology test PASS",
             onfail="Starting new Chordal topology test FAIL" )
-
+        
     def CASE13( self, main ):
         """
         This test script Loads a new Topology (Spine) on CHO setup and balances all switches
@@ -1453,44 +1816,29 @@
         import time
         import copy
 
-        newTopo = main.params['TOPO3']['topo']
+        main.newTopo = main.params['TOPO3']['topo']
         main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
         main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
         main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
         main.pingTimeout = 600
         
-        time.sleep(60)
         main.log.report(
             "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
         main.log.report(
             "________________________________________________________________________" )
         # need to wait here for sometime until ONOS bootup
-        time.sleep( 15 )
         main.case(
             "Assign and Balance all Mininet switches across controllers" )
         main.step( "Stop any previous Mininet network topology" )
-        stopStatus = main.Mininet1.stopNet()
-
-        # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
-        main.step( "Stop ONOS on all Nodes" )
-        stopResult = main.TRUE
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
-            sresult = main.ONOSbench.onosStop( ONOS_ip )
-            utilities.assert_equals( expect=main.TRUE, actual=sresult,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            stopResult = ( stopResult and sresult )
-
+        stopStatus = main.Mininet1.stopNet(fileName = "topoSpine" )
         main.step( "Start Mininet with Spine topology" )
-        startStatus = main.Mininet1.startNet(topoFile = newTopo)
-
+        startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
+        time.sleep(20)
         main.step( "Assign switches to controllers" )
         for i in range( 1, ( main.numMNswitches + 1 ) ):  # 1 to ( num of switches +1 )
             main.Mininet1.assignSwController(
                 sw=str( i ),
-                count=int( main.numCtrls ),
+                count= 1,
                 ip1=main.ONOS1_ip,
                 port1=main.ONOS1_port,
                 ip2=main.ONOS2_ip,
@@ -1510,54 +1858,15 @@
                 switch_mastership = switch_mastership and main.TRUE
             else:
                 switch_mastership = main.FALSE
-
+        
         if switch_mastership == main.TRUE:
             main.log.report( "Controller assignment successfull" )
         else:
             main.log.report( "Controller assignment failed" )
         time.sleep( 5 )
-
-        main.step( "Start ONOS on all Nodes" )
-        startResult = main.TRUE
-        for i in range( 1, int( main.numCtrls ) + 1 ):
-            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
-            main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
-            sresult = main.ONOSbench.onosStart( ONOS_ip )
-            utilities.assert_equals( expect=main.TRUE, actual=sresult,
-                                     onpass="Test step PASS",
-                                     onfail="Test step FAIL" )
-            startResult = ( startResult and sresult )
-
-        main.step( "Start ONOS CLI on all nodes" )
-        cliResult = main.TRUE
-        #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 )
-        
-        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
@@ -1568,8 +1877,9 @@
             balanceResult = main.ONOScli1.balanceMasters()
             # giving some breathing time for ONOS to complete re-balance
             time.sleep( 3 )
-
-        case13Result = ( startResult and cliResult )
+        """
+        case13Result = switch_mastership
+        time.sleep(30)
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case13Result,
@@ -1580,7 +1890,7 @@
         """
         Install 300 host intents and verify ping all for Chordal Topology
         """
-        main.log.report( "Add 300 host intents and verify pingall" )
+        main.log.report( "Add 300 host intents and verify pingall (Chordal Topo)" )
         main.log.report( "_______________________________________" )
         import itertools
         
@@ -1640,17 +1950,17 @@
 
     def CASE15( self ):
         """
-        Install 300 host intents and verify ping all for Spine Topology
+        Install 2278 host intents and verify ping all for Spine Topology
         """
-        main.log.report( "Add 300 host intents and verify pingall" )
+        main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
         main.log.report( "_______________________________________" )
         import itertools
         
-        main.case( "Install 300 host intents" )
+        main.case( "Install 2278 host intents" )
         main.step( "Add host Intents" )
         intentResult = main.TRUE
         hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) 
-        
+        main.pingTimeout = 300
         intentIdList = []
         time1 = time.time()
         for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
@@ -1696,7 +2006,69 @@
         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" )
+            onpass="Install 2278 Host Intents and Ping All test PASS",
+            onfail="Install 2278 Host Intents and Ping All test FAIL" )
+
+    def CASE99(self):
+        import time
+        # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
+        main.step( "Stop ONOS on all Nodes" )
+        stopResult = main.TRUE
+        for i in range( 1, int( main.numCtrls ) + 1 ):
+            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+            main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
+            sresult = main.ONOSbench.onosStop( ONOS_ip )
+            utilities.assert_equals( expect=main.TRUE, actual=sresult,
+                                     onpass="Test step PASS",
+                                     onfail="Test step FAIL" )
+            stopResult = ( stopResult and sresult )
+
+        main.step( "Start ONOS on all Nodes" )
+        startResult = main.TRUE
+        for i in range( 1, int( main.numCtrls ) + 1 ):
+            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+            main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
+            sresult = main.ONOSbench.onosStart( ONOS_ip )
+            utilities.assert_equals( expect=main.TRUE, actual=sresult,
+                                     onpass="Test step PASS",
+                                     onfail="Test step FAIL" )
+            startResult = ( startResult and sresult )
+    
+        main.step( "Start ONOS CLI on all nodes" )
+        cliResult = main.TRUE
+        time.sleep( 30 )
+        main.log.step(" Start ONOS cli using thread ")
+        pool = []
+        time1 = time.time()
+        for i in range( int( main.numCtrls ) ):
+            t = main.Thread(target=main.CLIs[i].startOnosCli,
+                    threadID=main.threadID,
+                    name="startOnosCli",
+                    args=[main.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))
+
+        case99Result = ( startResult and cliResult )
+        time.sleep(30)
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case99Result,
+            onpass="Starting new Chordal topology test PASS",
+            onfail="Starting new Chordal topology test FAIL" )
+
+
 
 
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/OnosCHO/OnosCHO.topo
index 040e3c5..161b89c 100644
--- a/TestON/tests/OnosCHO/OnosCHO.topo
+++ b/TestON/tests/OnosCHO/OnosCHO.topo
@@ -7,7 +7,9 @@
             <password>onos_test</password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
+            <COMPONENTS>
+                <home> ~/ONOS</home>
+            </COMPONENTS>
         </ONOSbench>
 
         <ONOScli1>
