diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 8934e50..3f07691 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -47,9 +47,6 @@
 
 from core.utilities import Utilities
 
-import logging 
-import datetime
-from optparse import OptionParser
 
 class TestON:
     '''
@@ -79,11 +76,11 @@
         self.init_result = self.TRUE
         self.testResult = "Summary"
         self.stepName =""
-        self.EXPERIMENTAL_MODE = False   
+        self.EXPERIMENTAL_MODE = False
         self.test_target = None
         self.lastcommand = None
-        self.testDir = tests_path 
-        self.configFile = config_path + "teston.cfg" 
+        self.testDir = tests_path
+        self.configFile = config_path + "teston.cfg"
         self.parsingClass = "xmlparser"
         self.parserPath = core_path + "/xmlparser"
         self.loggerPath = core_path + "/logger"
@@ -111,7 +108,7 @@
                 if 'test_target' in self.componentDictionary[component].keys():
                     self.test_target = component
              
-        # Checking for the openspeak file and test script 
+        # Checking for the openspeak file and test script
         self.logger.initlog(self)
 
         # Creating Drivers Handles
@@ -151,7 +148,7 @@
         '''
         global driver_options
         self.log.info("Creating component Handle: "+component)
-        driver_options = {}         
+        driver_options = {}
         if 'COMPONENTS' in self.componentDictionary[component].keys():
             driver_options =dict(self.componentDictionary[component]['COMPONENTS'])
 
@@ -171,7 +168,7 @@
                                               options = driver_options)
         if not connect_result:
             self.log.error("Exiting form the test execution because the connecting to the "+component+" component failed.")
-            self.exit() 
+            self.exit()
             
         vars(self)[component] = driverObject
                         
@@ -186,7 +183,7 @@
         self.testCaseResult = {}
         self.TOTAL_TC = 0
         self.TOTAL_TC_RUN = 0
-        self.TOTAL_TC_PLANNED = 0 
+        self.TOTAL_TC_PLANNED = 0
         self.TOTAL_TC_NORESULT = 0
         self.TOTAL_TC_FAIL = 0
         self.TOTAL_TC_PASS = 0
@@ -194,7 +191,7 @@
         self.stepCount = 0
         self.CASERESULT = self.TRUE
         
-        import testparser 
+        import testparser
         testFile = self.tests_path + "/"+self.TEST + "/"+self.TEST + ".py"
         test = testparser.TestParser(testFile)
         self.testscript = test.testscript
@@ -205,8 +202,8 @@
         result = self.TRUE
 	while(repeat):
             for self.CurrentTestCaseNumber in self.testcases_list:
-                result = self.runCase(self.CurrentTestCaseNumber) 
-	    repeat-=1                   
+                result = self.runCase(self.CurrentTestCaseNumber)
+	    repeat-=1
         return result
     
     def runCase(self,testCaseNumber):
@@ -219,7 +216,7 @@
         stopped = False
         try :
             self.stepList = self.code[self.testCaseNumber].keys()
-        except KeyError,e:
+        except KeyError:
             main.log.error("There is no Test-Case "+ self.testCaseNumber)
             return main.FALSE
         
@@ -258,8 +255,8 @@
         
     def addCaseHeader(self):
         caseHeader = "\n"+"*" * 30+"\n Result summary for Testcase"+str(self.CurrentTestCaseNumber)+"\n"+"*" * 30+"\n"
-        self.log.exact(caseHeader) 
-        caseHeader = "\n"+"*" * 40 +"\nStart of Test Case"+str(self.CurrentTestCaseNumber)+" : " 
+        self.log.exact(caseHeader)
+        caseHeader = "\n"+"*" * 40 +"\nStart of Test Case"+str(self.CurrentTestCaseNumber)+" : "
         for driver in self.componentDictionary.keys():
             vars(self)[driver+'log'].info(caseHeader)
     
@@ -282,28 +279,29 @@
         '''
         result = self.TRUE
         self.logger.testSummary(self)
-        
+
         #self.reportFile.close()
-        
+
 
         #utilities.send_mail()
         try :
             for component in self.componentDictionary.keys():
-                tempObject  = vars(self)[component]    
-                print "Disconnecting "+str(tempObject)
-         
+                tempObject  = vars(self)[component]
+                print "Disconnecting " + str(tempObject)
                 tempObject.disconnect()
-            #tempObject.execute(cmd="exit",prompt="(.*)",timeout=120) 
+            #tempObject.execute(cmd="exit",prompt="(.*)",timeout=120)
 
         except(Exception):
+            self.log.exception( "Exception while disconnecting from " +
+                                 str( component ) )
             #print " There is an error with closing hanldes"
             result = self.FALSE
         # Closing all the driver's session files
         for driver in self.componentDictionary.keys():
            vars(self)[driver].close_log_handles()
-           
+
         return result
-        
+
     def pause(self):
         '''
         This function will pause the test's execution, and will continue after user provide 'resume' command.
@@ -380,7 +378,7 @@
         if self.stepCount > 1 :
             stepHeader = "\n"+"-"*45+"\nEnd of Step "+previousStep+"\n"+"-"*45+"\n"
         
-        stepHeader += "\n"+"-"*45+"\nStart of Step"+stepName+"\n"+"-"*45+"\n" 
+        stepHeader += "\n"+"-"*45+"\nStart of Step"+stepName+"\n"+"-"*45+"\n"
         for driver in self.componentDictionary.keys():
             vars(self)[driver+'log'].info(stepHeader)
             
@@ -388,10 +386,10 @@
         '''
            Test's each test-case information will append to the logs.
         '''
-        self.CurrentTestCase = testCaseName 
+        self.CurrentTestCase = testCaseName
         testCaseName = " " + str(testCaseName) + ""
         self.log.case(testCaseName)
-        caseHeader = testCaseName+"\n"+"*" * 40+"\n" 
+        caseHeader = testCaseName+"\n"+"*" * 40+"\n"
         for driver in self.componentDictionary.keys():
             vars(self)[driver+'log'].info(caseHeader)
         
@@ -423,7 +421,7 @@
         ''' It will load the default response parser '''
         response_dict = {}
         response_dict = self.response_to_dict(response, return_format)
-        return_format_string = self.dict_to_return_format(response,return_format,response_dict)   
+        return_format_string = self.dict_to_return_format(response,return_format,response_dict)
         return return_format_string
     
     def response_to_dict(self,response,return_format):
@@ -434,7 +432,7 @@
         ini_match = re.search('^\s*\[', response)
         if json_match :
             main.log.info(" Response is in 'JSON' format and Converting to '"+return_format+"' format")
-            # Formatting the json string 
+            # Formatting the json string
             
             response = re.sub(r"{\s*'?(\w)", r'{"\1', response)
             response = re.sub(r",\s*'?(\w)", r',"\1', response)
@@ -454,14 +452,13 @@
             from configobj import ConfigObj
             response_file = open("respnse_file.temp",'w')
             response_file.write(response)
-            response_file.close() 
+            response_file.close()
             response_dict = ConfigObj("respnse_file.temp")
             return response_dict
             
         elif xml_match :
             main.log.info(" Response is in 'XML' format and Converting to '"+return_format+"' format")
             try :
-                from core import dicttoobject
                 response_dict = xmldict.xml_to_dict("<response> "+str(response)+" </response>")
             except Exception, e:
                 main.log.error(e)
@@ -485,7 +482,7 @@
                         table_data = table_data + get_table(temp_val)
                 else :
                     table_data = table_data + str(value_to_convert) +"\t"
-                return table_data 
+                return table_data
             
             for value in response_dict.values() :
                 response_table =  response_table + get_table(value)
@@ -510,7 +507,6 @@
             
         elif return_format == 'xml':
             ''' Will return in xml format'''
-            from core import dicttoobject
             response_xml = xmldict.dict_to_xml(response_dict)
             response_xml = re.sub(">\s*<", ">\n<", response_xml)
             return "\n"+response_xml
@@ -566,14 +562,14 @@
         main.classPath = "examples."+main.TEST+"."+main.TEST
                
 def verifyLogdir(options):
-    #Verifying Log directory option      
+    #Verifying Log directory option
     if options.logdir:
         main.logdir = options.logdir
     else :
-        main.logdir = main.FALSE  
+        main.logdir = main.FALSE
         
 def verifyMail(options):
-    # Checking the mailing list 
+    # Checking the mailing list
     if options.mail:
         main.mail = options.mail
     elif main.params.has_key('mail'):
@@ -582,10 +578,10 @@
         main.mail = 'paxweb@paxterrasolutions.com'
 
 def verifyTestCases(options):
-    #Getting Test cases list 
+    #Getting Test cases list
     if options.testcases:
-	testcases_list = options.testcases 
-        #sys.exit() 
+	testcases_list = options.testcases
+        #sys.exit()
         testcases_list = re.sub("(\[|\])", "", options.testcases)
         main.testcases_list = eval(testcases_list+",")
     else :
@@ -604,16 +600,16 @@
 	            if type(testcase)==int:
 		        testcase=[testcase]
 	            list1.extend(testcase)
-	    main.testcases_list=list1	                                     
+	    main.testcases_list=list1
         else :
             print "testcases not specifed in params, please provide in params file or 'testcases' commandline argument"
-            sys.exit() 
+            sys.exit()
                   
 def verifyTestScript(options):
     '''
     Verifyies test script.
     '''
-    main.openspeak = openspeak.OpenSpeak()        
+    main.openspeak = openspeak.OpenSpeak()
     openspeakfile = main.testDir+"/" + main.TEST + "/" + main.TEST + ".ospk"
     testfile = main.testDir+"/" + main.TEST + "/" + main.TEST + ".py"
     if os.path.exists(openspeakfile) :
@@ -629,20 +625,20 @@
         testModule = __import__(main.classPath, globals(), locals(), [main.TEST], -1)
     except(ImportError):
         print "There was an import error, it might mean that there is no test like "+main.TEST
-        main.exit()       
+        main.exit()
 
     testClass = getattr(testModule, main.TEST)
     main.testObject = testClass()
     load_parser()
-    main.params = main.parser.parseParams(main.classPath)    
-    main.topology = main.parser.parseTopology(main.classPath) 
+    main.params = main.parser.parseParams(main.classPath)
+    main.topology = main.parser.parseTopology(main.classPath)
     
 def verifyParams():
     try :
         main.params = main.params['PARAMS']
     except(KeyError):
         print "Error with the params file: Either the file not specified or the format is not correct"
-        main.exit()            
+        main.exit()
     
     try :
         main.topology = main.topology['TOPOLOGY']
@@ -681,9 +677,9 @@
                     main.exit()
             else :
                 print "No Such File Exists !!"+ confighash['config']['parser']['file'] +"using default parser"
-                load_defaultParser() 
-        elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :  
-            load_defaultParser() 
+                load_defaultParser()
+        elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :
+            load_defaultParser()
     else:
         load_defaultParser()
 
@@ -694,7 +690,7 @@
     moduleList = main.parserPath.split("/")
     newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
     try :
-        parsingClass = main.parsingClass 
+        parsingClass = main.parsingClass
         parsingModule = __import__(newModule, globals(), locals(), [parsingClass], -1)
         parsingClass = getattr(parsingModule, parsingClass)
         main.parser = parsingClass()
@@ -733,8 +729,8 @@
             else :
                 print "No Such File Exists !!"+confighash['config']['logger']['file']+ "Using default logger"
                 load_defaultlogger()
-        elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :  
-            load_defaultlogger() 
+        elif confighash['config']['parser']['file'] == None or confighash['config']['parser']['class'] == None :
+            load_defaultlogger()
     else:
         load_defaultlogger()
 
@@ -745,14 +741,14 @@
     moduleList = main.loggerPath.split("/")
     newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
     try :
-        loggerClass = main.loggerClass 
+        loggerClass = main.loggerClass
         loggerModule = __import__(newModule, globals(), locals(), [loggerClass], -1)
         loggerClass = getattr(loggerModule, loggerClass)
         main.logger = loggerClass()
 
     except ImportError:
         print sys.exc_info()[1]
-        main.exit()    
+        main.exit()
 
 def load_defaultlogger():
     '''
@@ -761,7 +757,7 @@
     moduleList = main.loggerPath.split("/")
     newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
     try :
-        loggerClass = main.loggerClass 
+        loggerClass = main.loggerClass
         loggerModule = __import__(newModule, globals(), locals(), [loggerClass], -1)
         loggerClass = getattr(loggerModule, loggerClass)
         main.logger = loggerClass()
diff --git a/TestON/dependencies/Jenkins_getresult_HA.py b/TestON/dependencies/Jenkins_getresult_HA.py
index 859612d..9cb3b8b 100755
--- a/TestON/dependencies/Jenkins_getresult_HA.py
+++ b/TestON/dependencies/Jenkins_getresult_HA.py
@@ -101,11 +101,12 @@
     f.close()
     #https://wiki.onosproject.org/display/OST/Test+Results+-+HA#Test+Results+-+HA
     #Example anchor on new wiki:        #TestResults-HA-TestHATestSanity
-    page_name = "Master+-+HA"
+    page_name = "Master-HA"
     if "ONOS-HA-Maint" in job:
-        page_name = "1.0+-+HA"
+        #NOTE if page name starts with number it prepends 'id-' to anchor links
+        page_name = "id-1.0-HA"
 
-    header += "<li><a href=\'#" + str(page_name) + str(test) + "\'> " + str(test) + " - Results: " + str(passes) + " Passed, " + str(fails) + " Failed</a></li>"
+    header += "<li><a href=\'#" + str(page_name) + "-Test" + str(test) + "\'> " + str(test) + " - Results: " + str(passes) + " Passed, " + str(fails) + " Failed</a></li>"
 
     #*********************
     #include any other phrase specific to case you would like to include in wiki here
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 52b1130..fbd863e 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -102,7 +102,8 @@
         """
         Starts Mininet accepts a topology(.py) file and/or an optional
         arguement ,to start the mininet, as a parameter.
-        Returns true if the mininet starts successfully
+        Returns main.TRUE if the mininet starts successfully and
+                main.FALSE otherwise
         """
         if self.handle:
             main.log.info(
@@ -189,9 +190,18 @@
                                         pexpect.EOF ,
                                         pexpect.TIMEOUT ],
                                         timeout)
-                main.log.info(self.name + ": Network started")
+                if i == 0:
+                    main.log.info(self.name + ": Network started")
+                    return main.TRUE
+                elif i == 1:
+                    main.log.error( self.name + ": Connection timeout" )
+                    return main.FALSE
+                elif i == 2:  # timeout
+                    main.log.error(
+                        self.name +
+                        ": Something took too long... " )
+                    return main.FALSE
                 return main.TRUE
-
         else:  # if no handle
             main.log.error(
                 self.name +
@@ -1255,40 +1265,61 @@
         disconnect the handle.
         """
         self.handle.sendline('')
-        i = 1
-        i = self.handle.expect( ['mininet>',pexpect.EOF,pexpect.TIMEOUT ], timeout = 2)
+        i = self.handle.expect( [ 'mininet>', pexpect.EOF, pexpect.TIMEOUT ],
+                                timeout = 2)
         if i == 0:
             self.stopNet()
-        response = ''
+        elif i == 1:
+            return main.TRUE
+        response = main.TRUE
         # print "Disconnecting Mininet"
         if self.handle:
             self.handle.sendline( "exit" )
             self.handle.expect( "exit" )
             self.handle.expect( "(.*)" )
-            main.log.info( "Mininet CLI is successfully disconnected" )
-            response = main.TRUE
         else:
             main.log.error( "Connection failed to the host" )
-            response = main.FALSE
-
         return response
 
-    def stopNet( self ):
+    def stopNet( self , timeout = 5):
         """
-        Stops mininet. returns true if the mininet succesfully stops.
+        Stops mininet.
+        Returns main.TRUE if the mininet succesfully stops and
+                main.FALSE if the pexpect handle does not exist.
+
+        Will cleanup and exit the test if mininet fails to stop
         """
-        
-        main.log.info( self.name + ": Disconnecting mininet..." )
+
+        main.log.info( self.name + ": Stopping mininet..." )
         response = ''
         if self.handle:
             try:
+                self.handle.sendline("")
+                i = self.handle.expect( [ 'mininet>',
+                                          '\$',
+                                          pexpect.EOF,
+                                          pexpect.TIMEOUT ],
+                                        timeout )
+                if i == 0:
+                    main.log.info( "Exiting mininet..." )
+               
                 response = self.execute(
                     cmd="exit",
                     prompt="(.*)",
                     timeout=120 )
-                main.log.info( self.name + ": Disconnected")
+                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" )
+                elif i == 2:
+                    main.log.error( "Something went wrong exiting mininet" )
+                elif i == 3:  # timeout
+                    main.log.error( "Something went wrong exiting mininet " +
+                                    "TIMEOUT" )
+                
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 3d91a20..389a077 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -336,7 +336,6 @@
         try:
             self.handle.sendline( "sudo pkill tcpdump" )
             self.handle.sendline( "" )
-            self.handle.sendline( "" )
             self.handle.expect( "\$" )
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -374,12 +373,7 @@
         """
         Called at the end of the test to disconnect the handle.
         """
-        response = ''
-        # print "Disconnecting Mininet"
         if self.handle:
-            self.handle.sendline( "exit" )
-            self.handle.expect( "exit" )
-            self.handle.expect( "(.*)" )
             # Close the ssh connection
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
@@ -387,6 +381,7 @@
             self.handle.expect( "closed" )
         else:
             main.log.error( "Connection failed to the host" )
+        return main.TRUE
 
     def getFlowTable( self, protoVersion, sw ):
         """
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 5deb911..5a040ec 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -43,7 +43,9 @@
                 if key == "home":
                     self.home = self.options[ 'home' ]
                     break
-
+            if self.home == None or self.home == "":
+                self.home = "~/ONOS"
+            
             self.name = self.options[ 'name' ]
             self.handle = super( OnosCliDriver, self ).connect(
                 user_name=self.user_name,
@@ -76,7 +78,7 @@
         """
         Called when Test is complete to disconnect the ONOS handle.
         """
-        response = ''
+        response = main.TRUE
         try:
             self.handle.sendline( "" )
             i = self.handle.expect( [ "onos>", "\$" ] )
@@ -92,7 +94,7 @@
 
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
-            return None
+            response = main.FALSE
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
@@ -146,7 +148,7 @@
                 # Expect the cellname in the ONOSCELL variable.
                 # Note that this variable name is subject to change
                 #   and that this driver will have to change accordingly
-                self.handle.expect( "ONOS_CELL=" + str( cellname ) )
+                self.handle.expect( "ONOS_CELL" )
                 handleBefore = self.handle.before
                 handleAfter = self.handle.after
                 # Get the rest of the handle
@@ -250,6 +252,41 @@
             main.cleanup()
             main.exit()
 
+    def log( self, cmdStr , level = "" ):
+        """
+            log  the commands in the onos CLI.
+            returns main.TRUE on success
+            returns main.FALSE if Error occured
+            Available level: DEBUG, TRACE, INFO, WARN, ERROR
+            Level defaults to INFO
+        """
+        try:
+            lvlStr = ""
+            if level:
+                lvlStr = "--level=" + level
+
+            self.handle.sendline( "" )
+            self.handle.expect( "onos>" )
+            self.handle.sendline( "log:log " + lvlStr + " " + cmdStr )
+            self.handle.expect( "onos>" )
+            
+            response = self.handle.before
+            if re.search( "Error", response ):
+                return main.FALSE
+            return main.TRUE
+
+        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.info( self.name + " ::::::" )
+            main.log.error( traceback.print_exc() )
+            main.log.info( self.name + " ::::::" )
+            main.cleanup()
+            main.exit()
+
     def sendline( self, cmdStr ):
         """
         Send a completely user specified string to
@@ -260,12 +297,9 @@
         sent using this method.
         """
         try:
-            self.handle.sendline( "" )
-            self.handle.expect( "onos>" )
-
-            self.handle.sendline( "log:log \"Sending CLI command: '"
-                                  + cmdStr + "'\"" )
-            self.handle.expect( "onos>" )
+            
+            logStr = "\"Sending CLI command: '" + cmdStr + "'\""
+            self.log( logStr )
             self.handle.sendline( cmdStr )
             self.handle.expect( "onos>" )
             main.log.info( "Command '" + str( cmdStr ) + "' sent to "
@@ -904,6 +938,7 @@
         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 )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index b4493f8..c2b3693 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -45,9 +45,9 @@
                 if key == "home":
                     self.home = self.options[ 'home' ]
                     break
-            if self.home == None or self.home == "":
+            if self.home is None or self.home == "":
                 self.home = "~/ONOS"
-            
+
             self.name = self.options[ 'name' ]
             self.handle = super( OnosDriver, self ).connect(
                 user_name=self.user_name,
@@ -79,7 +79,7 @@
         """
         Called when Test is complete to disconnect the ONOS handle.
         """
-        response = ''
+        response = main.TRUE
         try:
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
@@ -169,8 +169,8 @@
             self.handle.expect( "mvn clean install" )
             while True:
                 i = self.handle.expect( [
-                    'There\sis\sinsufficient\smemory\sfor\sthe\sJava\s\
-                            Runtime\sEnvironment\sto\scontinue',
+                    'There\sis\sinsufficient\smemory\sfor\sthe\sJava\s' +
+                        'Runtime\sEnvironment\sto\scontinue',
                     'BUILD\sFAILURE',
                     'BUILD\sSUCCESS',
                     'ONOS\$',
@@ -205,8 +205,8 @@
                     main.cleanup()
                     main.exit()
                 else:
-                    main.log.error( self.name + ": unexpected response from \
-                            mvn clean install" )
+                    main.log.error( self.name + ": unexpected response from " +
+                            "mvn clean install" )
                     # return main.FALSE
                     main.cleanup()
                     main.exit()
@@ -254,10 +254,8 @@
                     'Already up-to-date',
                     'Aborting',
                     'You\sare\snot\scurrently\son\sa\sbranch',
-                    'You\sasked\sme\sto\spull\swithout\stelling\sme\swhich\
-                            \sbranch\syou',
-                    'Pull\sis\snot\spossible\sbecause\syou\shave\sunmerged\
-                            \sfiles',
+                    'You asked me to pull without telling me which branch you',
+                    'Pull is not possible because you have unmerged files',
                     pexpect.TIMEOUT ],
                 timeout=300 )
             # debug
@@ -285,27 +283,26 @@
             elif i == 4:
                 main.log.info(
                     self.name +
-                    ": Git Pull - Aborting...\
-                            Are there conflicting git files?" )
+                    ": Git Pull - Aborting..." +
+                    "Are there conflicting git files?" )
                 return main.ERROR
             elif i == 5:
                 main.log.info(
                     self.name +
-                    ": Git Pull - You are not currently\
-                            on a branch so git pull failed!" )
+                    ": Git Pull - You are not currently " +
+                    "on a branch so git pull failed!" )
                 return main.ERROR
             elif i == 6:
                 main.log.info(
                     self.name +
-                    ": Git Pull - You have not configured\
-                             an upstream branch to pull from\
-                             . Git pull failed!" )
+                    ": Git Pull - You have not configured an upstream " +
+                    "branch to pull from. Git pull failed!" )
                 return main.ERROR
             elif i == 7:
                 main.log.info(
                     self.name +
-                    ": Git Pull - Pull is not possible\
-                            because you have unmerged files." )
+                    ": Git Pull - Pull is not possible because " +
+                    "you have unmerged files." )
                 return main.ERROR
             elif i == 8:
                 main.log.error( self.name + ": Git Pull - TIMEOUT" )
@@ -348,27 +345,23 @@
         try:
             self.handle.sendline( "cd " + self.home )
             self.handle.expect( self.home + "\$" )
-            main.log.info(
-                self.name +
-                ": Checking out git branch: " +
-                branch +
-                "..." )
+            main.log.info( self.name +
+                           ": Checking out git branch/ref: " + branch + "..." )
             cmd = "git checkout " + branch
             self.handle.sendline( cmd )
             self.handle.expect( cmd )
             i = self.handle.expect(
-                [
-                    'fatal',
-                    'Username\sfor\s(.*):\s',
-                    'Already\son\s\'',
-                    'Switched\sto\sbranch\s\'' +
-                    str( branch ),
-                    pexpect.TIMEOUT,
-                    'error: Your local changes to the following files\
-                            would be overwritten by checkout:',
-                    'error: you need to resolve your current index first' ],
+                [ 'fatal',
+                  'Username\sfor\s(.*):\s',
+                  'Already\son\s\'',
+                  'Switched\sto\sbranch\s\'' + str( branch ),
+                  pexpect.TIMEOUT,
+                  'error: Your local changes to the following files' +
+                          'would be overwritten by checkout:',
+                  'error: you need to resolve your current index first',
+                  "You are in 'detached HEAD' state.",
+                  "HEAD is now at " ],
                 timeout=60 )
-
             if i == 0:
                 main.log.error(
                     self.name +
@@ -381,12 +374,12 @@
                     ": Git checkout asking for username." +
                     " Please configure your local git repository to be able " +
                     "to access your remote repository passwordlessly" )
+                # TODO add support for authenticating
                 return main.ERROR
             elif i == 2:
                 main.log.info(
                     self.name +
-                    ": Git Checkout %s : Already on this branch" %
-                    branch )
+                    ": Git Checkout %s : Already on this branch" % branch )
                 self.handle.expect( self.home + "\$" )
                 # main.log.info( "DEBUG: after checkout cmd = "+
                 # self.handle.before )
@@ -394,8 +387,7 @@
             elif i == 3:
                 main.log.info(
                     self.name +
-                    ": Git checkout %s - Switched to this branch" %
-                    branch )
+                    ": Git checkout %s - Switched to this branch" % branch )
                 self.handle.expect( self.home + "\$" )
                 # main.log.info( "DEBUG: after checkout cmd = "+
                 # self.handle.before )
@@ -403,33 +395,45 @@
             elif i == 4:
                 main.log.error( self.name + ": Git Checkout- TIMEOUT" )
                 main.log.error(
-                    self.name + " Response was: " + str(
-                        self.handle.before ) )
+                    self.name + " Response was: " + str( self.handle.before ) )
                 return main.ERROR
             elif i == 5:
                 self.handle.expect( "Aborting" )
                 main.log.error(
                     self.name +
                     ": Git checkout error: \n" +
-                    "Your local changes to the following\
-                            files would be overwritten by checkout:" +
-                    str(
-                        self.handle.before ) )
+                    "Your local changes to the following files would" +
+                    " be overwritten by checkout:" +
+                    str( self.handle.before ) )
                 self.handle.expect( self.home + "\$" )
                 return main.ERROR
             elif i == 6:
-                main.log.error( self.name +
-                                ": Git checkout error: \n" +
-                                "You need to resolve your\
-                                        current index first:" +
-                                str( self.handle.before ) )
+                main.log.error(
+                    self.name +
+                    ": Git checkout error: \n" +
+                    "You need to resolve your current index first:" +
+                    str( self.handle.before ) )
                 self.handle.expect( self.home + "\$" )
                 return main.ERROR
+            elif i == 7:
+                main.log.info(
+                    self.name +
+                    ": Git checkout " + str( branch ) +
+                    " - You are in 'detached HEAD' state. HEAD is now at " +
+                    str( branch ) )
+                self.handle.expect( self.home + "\$" )
+                return main.TRUE
+            elif i == 8:  # Already in detached HEAD on the specified commit
+                main.log.info(
+                    self.name +
+                    ": Git Checkout %s : Already on commit" % branch )
+                self.handle.expect( self.home + "\$" )
+                return main.TRUE
             else:
                 main.log.error(
                     self.name +
-                    ": Git Checkout - Unexpected response,\
-                            check for pull errors" )
+                    ": Git Checkout - Unexpected response, " +
+                    "check for pull errors" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.ERROR
 
@@ -447,7 +451,7 @@
 
     def getVersion( self, report=False ):
         """
-        Writes the COMMIT number to the report to be parsed\
+        Writes the COMMIT number to the report to be parsed
                 by Jenkins data collecter.
         """
         try:
@@ -456,8 +460,8 @@
             self.handle.sendline(
                 "cd " +
                 self.home +
-                "; git log -1 --pretty=fuller --decorate=short | grep -A 6\
-                        \"commit\" --color=never" )
+                "; git log -1 --pretty=fuller --decorate=short | grep -A 6 " +
+                " \"commit\" --color=never" )
             # NOTE: for some reason there are backspaces inserted in this
             # phrase when run from Jenkins on some tests
             self.handle.expect( "never" )
@@ -1219,13 +1223,13 @@
                 result = main.TRUE
             else:
                 output = output + \
-                    "The number of links and switches does not match\
-                    what was expected"
+                    "The number of links and switches does not match " + \
+                    "what was expected"
                 result = main.FALSE
-            output = output + "\n ONOS sees %i devices (%i expected)\
-                     and %i links (%i expected)" %\
-                     ( int( devices ), int( numoswitch ),
-                       int( links ), int( numolink ) )
+            output = output + "\n ONOS sees %i devices" % int ( devices )
+            output = output + " (%i expected) " %  int( numoswitch )
+            output = output + "and %i links " % int( links )
+            output = output + "(%i expected)" % int( numolink )
             if logLevel == "report":
                 main.log.report( output )
             elif logLevel == "warn":
@@ -1487,3 +1491,102 @@
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
+
+    def setIpTables( self, ip, port='', action='add', packet_type='tcp',
+                     direction='INPUT', rule='DROP' ):
+        '''
+        Description:
+            add or remove iptables rule to DROP (default) packets from
+            specific IP and PORT
+        Usage:
+        * specify action ('add' or 'remove')
+          when removing, pass in the same argument as you would add. It will
+          delete that specific rule.
+        * specify the ip to block
+        * specify the destination port to block (defaults to all ports)
+        * optional packet type to block (default tcp)
+        * optional iptables rule (default DROP)
+        * optional direction to block (default 'INPUT')
+        Returns:
+            main.TRUE on success or
+            main.FALSE if given invalid input or
+            main.ERROR if there is an error in response from iptables
+        WARNING:
+        * This function uses root privilege iptables command which may result
+          in unwanted network errors. USE WITH CAUTION
+        '''
+        import time
+
+        # NOTE*********
+        #   The strict checking methods of this driver function is intentional
+        #   to discourage any misuse or error of iptables, which can cause
+        #   severe network errors
+        # *************
+
+        # NOTE: Sleep needed to give some time for rule to be added and
+        #       registered to the instance. If you are calling this function
+        #       multiple times this sleep will prevent any errors.
+        #       DO NOT REMOVE
+        time.sleep( 5 )
+        try:
+            # input validation
+            action_type = action.lower()
+            rule = rule.upper()
+            direction = direction.upper()
+            if action_type != 'add' and action_type != 'remove':
+                main.log.error( "Invalid action type. Use 'add' or "
+                                "'remove' table rule" )
+                if rule != 'DROP' and rule != 'ACCEPT' and rule != 'LOG':
+                    # NOTE Currently only supports rules DROP, ACCEPT, and LOG
+                    main.log.error( "Invalid rule. Valid rules are 'DROP' or "
+                                    "'ACCEPT' or 'LOG' only." )
+                    if direction != 'INPUT' and direction != 'OUTPUT':
+                        # NOTE currently only supports rules INPUT and OUPTUT
+                        main.log.error( "Invalid rule. Valid directions are"
+                                        " 'OUTPUT' or 'INPUT'" )
+                        return main.FALSE
+                    return main.FALSE
+                return main.FALSE
+            if action_type == 'add':
+                # -A is the 'append' action of iptables
+                actionFlag = '-A'
+            elif action_type == 'remove':
+                # -D is the 'delete' rule of iptables
+                actionFlag = '-D'
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            cmd = "sudo iptables " + actionFlag + " " +\
+                  direction +\
+                  " -p " + str( packet_type ) +\
+                  " -s " + str( ip )
+            if port:
+                cmd += " --dport " + str( port )
+            cmd += " -j " + str( rule )
+
+            self.handle.sendline( cmd )
+            self.handle.expect( "\$" )
+            main.log.warn( self.handle.before )
+
+            info_string = "On " + str( self.name )
+            info_string += " " + str( action_type )
+            info_string += " iptable rule [ "
+            info_string += " IP: " + str( ip )
+            info_string += " Port: " + str( port )
+            info_string += " Rule: " + str( rule )
+            info_string += " Direction: " + str( direction ) + " ]"
+            main.log.info( info_string )
+            return main.TRUE
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": Timeout exception in "
+                                "setIpTables function" )
+            return main.ERROR
+        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( "Unknown error:")
+            main.cleanup()
+            main.exit()
+
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 1b8998b..6d7fb2a 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -81,7 +81,7 @@
         while i == 5:
             i = self.handle.expect( [
 				    ssh_newkey,
-                                    'password:|\$',
+                                    'password:',
                                     pexpect.EOF,
                                     pexpect.TIMEOUT,
                                     refused,
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.params b/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
index 6f2002d..123fd0f 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
@@ -1,7 +1,7 @@
 <PARAMS>
     <testcases>1,2,8,3,4,5,14,[6],8,3,7,4,15,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
     <ENV>
-    <cellName>HA</cellName>
+        <cellName>HA</cellName>
     </ENV>
     <Git>False</Git>
     <branch> master </branch>
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
index ff38cfe..e9beb0c 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
@@ -150,24 +150,38 @@
             onos1Isup = main.ONOSbench.isup( ONOS1Ip )
             if not onos1Isup:
                 main.log.report( "ONOS1 didn't start!" )
+                main.ONOSbench.onosStop( ONOS1Ip )
+                main.ONOSbench.onosStart( ONOS1Ip )
             onos2Isup = main.ONOSbench.isup( ONOS2Ip )
             if not onos2Isup:
                 main.log.report( "ONOS2 didn't start!" )
+                main.ONOSbench.onosStop( ONOS2Ip )
+                main.ONOSbench.onosStart( ONOS2Ip )
             onos3Isup = main.ONOSbench.isup( ONOS3Ip )
             if not onos3Isup:
                 main.log.report( "ONOS3 didn't start!" )
+                main.ONOSbench.onosStop( ONOS3Ip )
+                main.ONOSbench.onosStart( ONOS3Ip )
             onos4Isup = main.ONOSbench.isup( ONOS4Ip )
             if not onos4Isup:
                 main.log.report( "ONOS4 didn't start!" )
+                main.ONOSbench.onosStop( ONOS4Ip )
+                main.ONOSbench.onosStart( ONOS4Ip )
             onos5Isup = main.ONOSbench.isup( ONOS5Ip )
             if not onos5Isup:
                 main.log.report( "ONOS5 didn't start!" )
+                main.ONOSbench.onosStop( ONOS5Ip )
+                main.ONOSbench.onosStart( ONOS5Ip )
             onos6Isup = main.ONOSbench.isup( ONOS6Ip )
             if not onos6Isup:
                 main.log.report( "ONOS6 didn't start!" )
+                main.ONOSbench.onosStop( ONOS6Ip )
+                main.ONOSbench.onosStart( ONOS6Ip )
             onos7Isup = main.ONOSbench.isup( ONOS7Ip )
             if not onos7Isup:
                 main.log.report( "ONOS7 didn't start!" )
+                main.ONOSbench.onosStop( ONOS7Ip )
+                main.ONOSbench.onosStart( ONOS7Ip )
             onosIsupResult = onos1Isup and onos2Isup and onos3Isup\
                 and onos4Isup and onos5Isup and onos6Isup and onos7Isup
             if onosIsupResult == main.TRUE:
@@ -378,9 +392,9 @@
             onfail="Switches were not successfully reassigned" )
         mastershipCheck = mastershipCheck and roleCall and roleCheck
         utilities.assert_equals( expect=main.TRUE, actual=mastershipCheck,
-                                onpass="Switch mastership correctly assigned",
-                                onfail="Error in ( re )assigning switch" +
-                                " mastership" )
+                                 onpass="Switch mastership correctly assigned",
+                                 onfail="Error in (re)assigning switch" +
+                                 " mastership" )
 
     def CASE3( self, main ):
         """
@@ -448,6 +462,7 @@
                 host1Id = host1Dict.get( 'id', None )
                 host2Id = host2Dict.get( 'id', None )
             if host1Id and host2Id:
+
                 tmpResult = main.ONOScli1.addHostIntent(
                     host1Id,
                     host2Id )
@@ -493,7 +508,7 @@
                                " and h" + str( i + 10 ) )
             elif ping == main.TRUE:
                 main.log.info( "Ping test passed!" )
-                PingResult = main.TRUE
+                # Don't set PingResult or you'd override failures
         if PingResult == main.FALSE:
             main.log.report(
                 "Intents have not been installed correctly, pings failed." )
@@ -1498,6 +1513,7 @@
         count = 0
         main.step( "Collecting topology information from ONOS" )
         startTime = time.time()
+        # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
             count = count + 1
             if count > 1:
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo b/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo
index 4d4156c..9305025 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo
@@ -151,7 +151,7 @@
                 <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
                 <arg2> --topo mytopo </arg2>
                 <arg3> </arg3>
-                <controller> remote </controller>
+                <controller> none </controller>
             </COMPONENTS>
         </Mininet1>
 
@@ -162,11 +162,7 @@
             <type>RemoteMininetDriver</type>
             <connect_order>17</connect_order>
             <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
+            </COMPONENTS>
         </Mininet2>
 
     </COMPONENT>
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
index 7d79860..595b78c 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
@@ -1,7 +1,7 @@
 <PARAMS>
     <testcases>1,2,8,3,4,5,14,[6],8,7,4,15,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
     <ENV>
-    <cellName>HA</cellName>
+        <cellName>HA</cellName>
     </ENV>
     <Git>False</Git>
     <branch> master </branch>
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
index 3d9adc7..de26e67 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
@@ -150,24 +150,38 @@
             onos1Isup = main.ONOSbench.isup( ONOS1Ip )
             if not onos1Isup:
                 main.log.report( "ONOS1 didn't start!" )
+                main.ONOSbench.onosStop( ONOS1Ip )
+                main.ONOSbench.onosStart( ONOS1Ip )
             onos2Isup = main.ONOSbench.isup( ONOS2Ip )
             if not onos2Isup:
                 main.log.report( "ONOS2 didn't start!" )
+                main.ONOSbench.onosStop( ONOS2Ip )
+                main.ONOSbench.onosStart( ONOS2Ip )
             onos3Isup = main.ONOSbench.isup( ONOS3Ip )
             if not onos3Isup:
                 main.log.report( "ONOS3 didn't start!" )
+                main.ONOSbench.onosStop( ONOS3Ip )
+                main.ONOSbench.onosStart( ONOS3Ip )
             onos4Isup = main.ONOSbench.isup( ONOS4Ip )
             if not onos4Isup:
                 main.log.report( "ONOS4 didn't start!" )
+                main.ONOSbench.onosStop( ONOS4Ip )
+                main.ONOSbench.onosStart( ONOS4Ip )
             onos5Isup = main.ONOSbench.isup( ONOS5Ip )
             if not onos5Isup:
                 main.log.report( "ONOS5 didn't start!" )
+                main.ONOSbench.onosStop( ONOS5Ip )
+                main.ONOSbench.onosStart( ONOS5Ip )
             onos6Isup = main.ONOSbench.isup( ONOS6Ip )
             if not onos6Isup:
                 main.log.report( "ONOS6 didn't start!" )
+                main.ONOSbench.onosStop( ONOS6Ip )
+                main.ONOSbench.onosStart( ONOS6Ip )
             onos7Isup = main.ONOSbench.isup( ONOS7Ip )
             if not onos7Isup:
                 main.log.report( "ONOS7 didn't start!" )
+                main.ONOSbench.onosStop( ONOS7Ip )
+                main.ONOSbench.onosStart( ONOS7Ip )
             onosIsupResult = onos1Isup and onos2Isup and onos3Isup\
                 and onos4Isup and onos5Isup and onos6Isup and onos7Isup
             if onosIsupResult == main.TRUE:
@@ -378,9 +392,9 @@
             onfail="Switches were not successfully reassigned" )
         mastershipCheck = mastershipCheck and roleCall and roleCheck
         utilities.assert_equals( expect=main.TRUE, actual=mastershipCheck,
-                                onpass="Switch mastership correctly assigned",
-                                onfail="Error in ( re )assigning switch" +
-                                " mastership" )
+                                 onpass="Switch mastership correctly assigned",
+                                 onfail="Error in (re)assigning switch" +
+                                 " mastership" )
 
     def CASE3( self, main ):
         """
@@ -484,15 +498,15 @@
         main.case( description )
         PingResult = main.TRUE
         for i in range( 8, 18 ):
-            ping = main.Mininet1.pingHost(
-                src="h" + str( i ), target="h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost( src="h" + str( i ),
+                                           target="h" + str( i + 10 ) )
             PingResult = PingResult and ping
             if ping == main.FALSE:
                 main.log.warn( "Ping failed between h" + str( i ) +
                                " and h" + str( i + 10 ) )
             elif ping == main.TRUE:
                 main.log.info( "Ping test passed!" )
-                PingResult = main.TRUE
+                # Don't set PingResult or you'd override failures
         if PingResult == main.FALSE:
             main.log.report(
                 "Intents have not been installed correctly, pings failed." )
@@ -1109,8 +1123,9 @@
         cliResult3 = main.ONOScli3.startOnosCli( ONOS3Ip )
         cliResults = cliResult1 and cliResult2 and cliResult3
 
-        main.log.info( "Install leadership election app on restarted node" )
-
+        # Grab the time of restart so we chan check how long the gossip
+        # protocol has had time to work
+        main.restartTime = time.time()
         caseResults = main.TRUE and onosIsupResult and cliResults
         utilities.assert_equals( expect=main.TRUE, actual=caseResults,
                                 onpass="ONOS restart successful",
@@ -1149,8 +1164,6 @@
         ONOS5Mastership = main.ONOScli5.roles()
         ONOS6Mastership = main.ONOScli6.roles()
         ONOS7Mastership = main.ONOScli7.roles()
-        # print json.dumps( json.loads( ONOS1Mastership ), sort_keys=True,
-        # indent=4, separators=( ',', ': ' ) )
         if "Error" in ONOS1Mastership or not ONOS1Mastership\
                 or "Error" in ONOS2Mastership or not ONOS2Mastership\
                 or "Error" in ONOS3Mastership or not ONOS3Mastership\
@@ -1243,133 +1256,147 @@
         # NOTE: we expect mastership to change on controller failure
         mastershipCheck = consistentMastership
 
-        main.step( "Get the intents and compare across all nodes" )
-        ONOS1Intents = main.ONOScli1.intents( jsonFormat=True )
-        ONOS2Intents = main.ONOScli2.intents( jsonFormat=True )
-        ONOS3Intents = main.ONOScli3.intents( jsonFormat=True )
-        ONOS4Intents = main.ONOScli4.intents( jsonFormat=True )
-        ONOS5Intents = main.ONOScli5.intents( jsonFormat=True )
-        ONOS6Intents = main.ONOScli6.intents( jsonFormat=True )
-        ONOS7Intents = main.ONOScli7.intents( jsonFormat=True )
-        intentCheck = main.FALSE
-        if "Error" in ONOS1Intents or not ONOS1Intents\
-                or "Error" in ONOS2Intents or not ONOS2Intents\
-                or "Error" in ONOS3Intents or not ONOS3Intents\
-                or "Error" in ONOS4Intents or not ONOS4Intents\
-                or "Error" in ONOS5Intents or not ONOS5Intents\
-                or "Error" in ONOS6Intents or not ONOS6Intents\
-                or "Error" in ONOS7Intents or not ONOS7Intents:
-            main.log.report( "Error in getting ONOS intents" )
-            main.log.warn( "ONOS1 intents response: " + repr( ONOS1Intents ) )
-            main.log.warn( "ONOS2 intents response: " + repr( ONOS2Intents ) )
-            main.log.warn( "ONOS3 intents response: " + repr( ONOS3Intents ) )
-            main.log.warn( "ONOS4 intents response: " + repr( ONOS4Intents ) )
-            main.log.warn( "ONOS5 intents response: " + repr( ONOS5Intents ) )
-            main.log.warn( "ONOS6 intents response: " + repr( ONOS6Intents ) )
-            main.log.warn( "ONOS7 intents response: " + repr( ONOS7Intents ) )
-        elif ONOS1Intents == ONOS2Intents\
-                and ONOS1Intents == ONOS3Intents\
-                and ONOS1Intents == ONOS4Intents\
-                and ONOS1Intents == ONOS5Intents\
-                and ONOS1Intents == ONOS6Intents\
-                and ONOS1Intents == ONOS7Intents:
-            intentCheck = main.TRUE
-            main.log.report( "Intents are consistent across all ONOS nodes" )
-        else:
-            main.log.warn( "ONOS1 intents: " )
-            print json.dumps( json.loads( ONOS1Intents ), sort_keys=True,
-                              indent=4, separators=( ',', ': ' ) )
-            main.log.warn( "ONOS2 intents: " )
-            print json.dumps( json.loads( ONOS2Intents ), sort_keys=True,
-                              indent=4, separators=( ',', ': ' ) )
-            main.log.warn( "ONOS3 intents: " )
-            print json.dumps( json.loads( ONOS3Intents ), sort_keys=True,
-                              indent=4, separators=( ',', ': ' ) )
-            main.log.warn( "ONOS4 intents: " )
-            print json.dumps( json.loads( ONOS4Intents ), sort_keys=True,
-                              indent=4, separators=( ',', ': ' ) )
-            main.log.warn( "ONOS5 intents: " )
-            print json.dumps( json.loads( ONOS5Intents ), sort_keys=True,
-                              indent=4, separators=( ',', ': ' ) )
-            main.log.warn( "ONOS6 intents: " )
-            print json.dumps( json.loads( ONOS6Intents ), sort_keys=True,
-                              indent=4, separators=( ',', ': ' ) )
-            main.log.warn( "ONOS7 intents: " )
-            print json.dumps( json.loads( ONOS7Intents ), sort_keys=True,
-                              indent=4, separators=( ',', ': ' ) )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=intentCheck,
-            onpass="Intents are consistent across all ONOS nodes",
-            onfail="ONOS nodes have different views of intents" )
-        # Print the intent states
-        intents = []
-        intents.append( ONOS1Intents )
-        intents.append( ONOS2Intents )
-        intents.append( ONOS3Intents )
-        intents.append( ONOS4Intents )
-        intents.append( ONOS5Intents )
-        intents.append( ONOS6Intents )
-        intents.append( ONOS7Intents )
-        intentStates = []
-        for node in intents:  # Iter through ONOS nodes
-            nodeStates = []
-            for intent in json.loads( node ):  # Iter through intents of a node
-                nodeStates.append( intent[ 'state' ] )
-            intentStates.append( nodeStates )
-            out = [ (i, nodeStates.count( i ) ) for i in set( nodeStates ) ]
-            main.log.info( dict( out ) )
-
-
-        # NOTE: Hazelcast has no durability, so intents are lost across system
-        # restarts
-        main.step( "Compare current intents with intents before the failure" )
-        # NOTE: this requires case 5 to pass for intentState to be set.
-        #      maybe we should stop the test if that fails?
-        sameIntents = main.TRUE
-        if intentState and intentState == ONOS1Intents:
-            sameIntents = main.TRUE
-            main.log.report( "Intents are consistent with before failure" )
-        # TODO: possibly the states have changed? we may need to figure out
-        # what the aceptable states are
-        else:
-            try:
+        while True:
+            whileTime = time.time() - main.restartTime
+            # Gossip store
+            main.step( "Get the intents and compare across all nodes" )
+            ONOS1Intents = main.ONOScli1.intents( jsonFormat=True )
+            ONOS2Intents = main.ONOScli2.intents( jsonFormat=True )
+            ONOS3Intents = main.ONOScli3.intents( jsonFormat=True )
+            ONOS4Intents = main.ONOScli4.intents( jsonFormat=True )
+            ONOS5Intents = main.ONOScli5.intents( jsonFormat=True )
+            ONOS6Intents = main.ONOScli6.intents( jsonFormat=True )
+            ONOS7Intents = main.ONOScli7.intents( jsonFormat=True )
+            intentCheck = main.FALSE
+            if "Error" in ONOS1Intents or not ONOS1Intents\
+                    or "Error" in ONOS2Intents or not ONOS2Intents\
+                    or "Error" in ONOS3Intents or not ONOS3Intents\
+                    or "Error" in ONOS4Intents or not ONOS4Intents\
+                    or "Error" in ONOS5Intents or not ONOS5Intents\
+                    or "Error" in ONOS6Intents or not ONOS6Intents\
+                    or "Error" in ONOS7Intents or not ONOS7Intents:
+                main.log.report( "Error in getting ONOS intents" )
+                main.log.warn( "ONOS1 intents response: " +
+                               repr( ONOS1Intents ) )
+                main.log.warn( "ONOS2 intents response: " +
+                               repr( ONOS2Intents ) )
+                main.log.warn( "ONOS3 intents response: " +
+                               repr( ONOS3Intents ) )
+                main.log.warn( "ONOS4 intents response: " +
+                               repr( ONOS4Intents ) )
+                main.log.warn( "ONOS5 intents response: " +
+                               repr( ONOS5Intents ) )
+                main.log.warn( "ONOS6 intents response: " +
+                               repr( ONOS6Intents ) )
+                main.log.warn( "ONOS7 intents response: " +
+                               repr( ONOS7Intents ) )
+            elif ONOS1Intents == ONOS2Intents\
+                    and ONOS1Intents == ONOS3Intents\
+                    and ONOS1Intents == ONOS4Intents\
+                    and ONOS1Intents == ONOS5Intents\
+                    and ONOS1Intents == ONOS6Intents\
+                    and ONOS1Intents == ONOS7Intents:
+                intentCheck = main.TRUE
+                main.log.report( "Intents are consistent across all" +
+                                 " ONOS nodes" )
+            else:
                 main.log.warn( "ONOS1 intents: " )
-                print json.dumps( json.loads( ONOS1Intents ),
-                                  sort_keys=True, indent=4,
-                                  separators=( ',', ': ' ) )
-            except:
-                pass
-            sameIntents = main.FALSE
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=sameIntents,
-            onpass="Intents are consistent with before failure",
-            onfail="The Intents changed during failure" )
-        intentCheck = intentCheck and sameIntents
+                print json.dumps( json.loads( ONOS1Intents ), sort_keys=True,
+                                  indent=4, separators=( ',', ': ' ) )
+                main.log.warn( "ONOS2 intents: " )
+                print json.dumps( json.loads( ONOS2Intents ), sort_keys=True,
+                                  indent=4, separators=( ',', ': ' ) )
+                main.log.warn( "ONOS3 intents: " )
+                print json.dumps( json.loads( ONOS3Intents ), sort_keys=True,
+                                  indent=4, separators=( ',', ': ' ) )
+                main.log.warn( "ONOS4 intents: " )
+                print json.dumps( json.loads( ONOS4Intents ), sort_keys=True,
+                                  indent=4, separators=( ',', ': ' ) )
+                main.log.warn( "ONOS5 intents: " )
+                print json.dumps( json.loads( ONOS5Intents ), sort_keys=True,
+                                  indent=4, separators=( ',', ': ' ) )
+                main.log.warn( "ONOS6 intents: " )
+                print json.dumps( json.loads( ONOS6Intents ), sort_keys=True,
+                                  indent=4, separators=( ',', ': ' ) )
+                main.log.warn( "ONOS7 intents: " )
+                print json.dumps( json.loads( ONOS7Intents ), sort_keys=True,
+                                  indent=4, separators=( ',', ': ' ) )
+            utilities.assert_equals(
+                expect=main.TRUE,
+                actual=intentCheck,
+                onpass="Intents are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of intents" )
+            # Print the intent states
+            intents = []
+            intents.append( ONOS1Intents )
+            intents.append( ONOS2Intents )
+            intents.append( ONOS3Intents )
+            intents.append( ONOS4Intents )
+            intents.append( ONOS5Intents )
+            intents.append( ONOS6Intents )
+            intents.append( ONOS7Intents )
+            intentStates = []
+            for node in intents:  # Iter through ONOS nodes
+                nodeStates = []
+                # Iter through intents of a node
+                for intent in json.loads( node ):
+                    nodeStates.append( intent[ 'state' ] )
+                intentStates.append( nodeStates )
+                out = [ (i, nodeStates.count( i ) ) for i in set( nodeStates ) ]
+                main.log.info( dict( out ) )
 
-        main.step( "Get the OF Table entries and compare to before " +
-                   "component failure" )
-        FlowTables = main.TRUE
-        flows2 = []
-        for i in range( 28 ):
-            main.log.info( "Checking flow table on s" + str( i + 1 ) )
-            tmpFlows = main.Mininet2.getFlowTable( 1.3, "s" + str( i + 1 ) )
-            flows2.append( tmpFlows )
-            tempResult = main.Mininet2.flowComp(
-                flow1=flows[ i ],
-                flow2=tmpFlows )
-            FlowTables = FlowTables and tempResult
-            if FlowTables == main.FALSE:
-                main.log.info( "Differences in flow table for switch: s" +
-                               str( i + 1 ) )
-        if FlowTables == main.TRUE:
-            main.log.report( "No changes were found in the flow tables" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=FlowTables,
-            onpass="No changes were found in the flow tables",
-            onfail="Changes were found in the flow tables" )
+
+            # NOTE: Store has no durability, so intents are lost across system
+            # restarts
+            main.step( "Compare current intents with intents before the failure" )
+            # NOTE: this requires case 5 to pass for intentState to be set.
+            #      maybe we should stop the test if that fails?
+            sameIntents = main.TRUE
+            if intentState and intentState == ONOS1Intents:
+                sameIntents = main.TRUE
+                main.log.report( "Intents are consistent with before failure" )
+            # TODO: possibly the states have changed? we may need to figure out
+            # what the aceptable states are
+            else:
+                try:
+                    main.log.warn( "ONOS1 intents: " )
+                    print json.dumps( json.loads( ONOS1Intents ),
+                                      sort_keys=True, indent=4,
+                                      separators=( ',', ': ' ) )
+                except:
+                    pass
+                sameIntents = main.FALSE
+            utilities.assert_equals(
+                expect=main.TRUE,
+                actual=sameIntents,
+                onpass="Intents are consistent with before failure",
+                onfail="The Intents changed during failure" )
+            intentCheck = intentCheck and sameIntents
+
+            main.step( "Get the OF Table entries and compare to before " +
+                       "component failure" )
+            FlowTables = main.TRUE
+            flows2 = []
+            for i in range( 28 ):
+                main.log.info( "Checking flow table on s" + str( i + 1 ) )
+                tmpFlows = main.Mininet2.getFlowTable( 1.3, "s" + str( i + 1 ) )
+                flows2.append( tmpFlows )
+                tempResult = main.Mininet2.flowComp(
+                    flow1=flows[ i ],
+                    flow2=tmpFlows )
+                FlowTables = FlowTables and tempResult
+                if FlowTables == main.FALSE:
+                    main.log.info( "Differences in flow table for switch: s" +
+                                   str( i + 1 ) )
+            if FlowTables == main.TRUE:
+                main.log.report( "No changes were found in the flow tables" )
+            utilities.assert_equals(
+                expect=main.TRUE,
+                actual=FlowTables,
+                onpass="No changes were found in the flow tables",
+                onfail="Changes were found in the flow tables" )
+            if topoResult == main.TRUE or ( whileTime  > 10 ) :
+                break
 
         main.step( "Check the continuous pings to ensure that no packets " +
                    "were dropped during component failure" )
@@ -1494,6 +1521,7 @@
         count = 0
         main.step( "Collecting topology information from ONOS" )
         startTime = time.time()
+        # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
             count = count + 1
             if count > 1:
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo
index 4d4156c..9305025 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo
@@ -151,7 +151,7 @@
                 <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
                 <arg2> --topo mytopo </arg2>
                 <arg3> </arg3>
-                <controller> remote </controller>
+                <controller> none </controller>
             </COMPONENTS>
         </Mininet1>
 
@@ -162,11 +162,7 @@
             <type>RemoteMininetDriver</type>
             <connect_order>17</connect_order>
             <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
+            </COMPONENTS>
         </Mininet2>
 
     </COMPONENT>
diff --git a/TestON/tests/HATestSanity/HATestSanity.py b/TestON/tests/HATestSanity/HATestSanity.py
index 58f9954..590ff56 100644
--- a/TestON/tests/HATestSanity/HATestSanity.py
+++ b/TestON/tests/HATestSanity/HATestSanity.py
@@ -150,24 +150,38 @@
             onos1Isup = main.ONOSbench.isup( ONOS1Ip )
             if not onos1Isup:
                 main.log.report( "ONOS1 didn't start!" )
+                main.ONOSbench.onosStop( ONOS1Ip )
+                main.ONOSbench.onosStart( ONOS1Ip )
             onos2Isup = main.ONOSbench.isup( ONOS2Ip )
             if not onos2Isup:
                 main.log.report( "ONOS2 didn't start!" )
+                main.ONOSbench.onosStop( ONOS2Ip )
+                main.ONOSbench.onosStart( ONOS2Ip )
             onos3Isup = main.ONOSbench.isup( ONOS3Ip )
             if not onos3Isup:
                 main.log.report( "ONOS3 didn't start!" )
+                main.ONOSbench.onosStop( ONOS3Ip )
+                main.ONOSbench.onosStart( ONOS3Ip )
             onos4Isup = main.ONOSbench.isup( ONOS4Ip )
             if not onos4Isup:
                 main.log.report( "ONOS4 didn't start!" )
+                main.ONOSbench.onosStop( ONOS4Ip )
+                main.ONOSbench.onosStart( ONOS4Ip )
             onos5Isup = main.ONOSbench.isup( ONOS5Ip )
             if not onos5Isup:
                 main.log.report( "ONOS5 didn't start!" )
+                main.ONOSbench.onosStop( ONOS5Ip )
+                main.ONOSbench.onosStart( ONOS5Ip )
             onos6Isup = main.ONOSbench.isup( ONOS6Ip )
             if not onos6Isup:
                 main.log.report( "ONOS6 didn't start!" )
+                main.ONOSbench.onosStop( ONOS6Ip )
+                main.ONOSbench.onosStart( ONOS6Ip )
             onos7Isup = main.ONOSbench.isup( ONOS7Ip )
             if not onos7Isup:
                 main.log.report( "ONOS7 didn't start!" )
+                main.ONOSbench.onosStop( ONOS7Ip )
+                main.ONOSbench.onosStart( ONOS7Ip )
             onosIsupResult = onos1Isup and onos2Isup and onos3Isup\
                 and onos4Isup and onos5Isup and onos6Isup and onos7Isup
             if onosIsupResult == main.TRUE:
@@ -446,6 +460,7 @@
                 host1Id = host1Dict.get( 'id', None )
                 host2Id = host2Dict.get( 'id', None )
             if host1Id and host2Id:
+                # TODO: distribute the intents across onos nodes
                 tmpResult = main.ONOScli1.addHostIntent(
                     host1Id,
                     host2Id )
@@ -491,7 +506,7 @@
                                " and h" + str( i + 10 ) )
             elif ping == main.TRUE:
                 main.log.info( "Ping test passed!" )
-                PingResult = main.TRUE
+                # Don't set PingResult or you'd override failures
         if PingResult == main.FALSE:
             main.log.report(
                 "Intents have not been installed correctly, pings failed." )
@@ -553,8 +568,6 @@
         ONOS5Mastership = main.ONOScli5.roles()
         ONOS6Mastership = main.ONOScli6.roles()
         ONOS7Mastership = main.ONOScli7.roles()
-        # print json.dumps( json.loads( ONOS1Mastership ), sort_keys=True,
-        # indent=4, separators=( ',', ': ' ) )
         if "Error" in ONOS1Mastership or not ONOS1Mastership\
                 or "Error" in ONOS2Mastership or not ONOS2Mastership\
                 or "Error" in ONOS3Mastership or not ONOS3Mastership\
@@ -1126,8 +1139,6 @@
         ONOS5Mastership = main.ONOScli5.roles()
         ONOS6Mastership = main.ONOScli6.roles()
         ONOS7Mastership = main.ONOScli7.roles()
-        # print json.dumps( json.loads( ONOS1Mastership ), sort_keys=True,
-        # indent=4, separators=( ',', ': ' ) )
         if "Error" in ONOS1Mastership or not ONOS1Mastership\
                 or "Error" in ONOS2Mastership or not ONOS2Mastership\
                 or "Error" in ONOS3Mastership or not ONOS3Mastership\
@@ -1466,6 +1477,7 @@
         count = 0
         main.step( "Collecting topology information from ONOS" )
         startTime = time.time()
+        # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
             count = count + 1
             if count > 1:
@@ -1526,140 +1538,134 @@
             cliTime = time.time() - cliStart
             print "CLI time: " + str( cliTime )
 
-            try: 
-                for controller in range( numControllers ):
-                    controllerStr = str( controller + 1 )
-                    if devices[ controller ] or "Error" not in devices[
-                            controller ]:
-                        currentDevicesResult = main.Mininet1.compareSwitches(
-                            MNTopo,
-                            json.loads(
-                                devices[ controller ] ) )
-                    else:
-                        currentDevicesResult = main.FALSE
-                    utilities.assert_equals( expect=main.TRUE,
-                                            actual=currentDevicesResult,
-                                            onpass="ONOS" + controllerStr +
-                                            " Switches view is correct",
-                                            onfail="ONOS" + controllerStr +
-                                            " Switches view is incorrect" )
+            for controller in range( numControllers ):
+                controllerStr = str( controller + 1 )
+                if devices[ controller ] or "Error" not in devices[
+                        controller ]:
+                    currentDevicesResult = main.Mininet1.compareSwitches(
+                        MNTopo,
+                        json.loads(
+                            devices[ controller ] ) )
+                else:
+                    currentDevicesResult = main.FALSE
+                utilities.assert_equals( expect=main.TRUE,
+                                        actual=currentDevicesResult,
+                                        onpass="ONOS" + controllerStr +
+                                        " Switches view is correct",
+                                        onfail="ONOS" + controllerStr +
+                                        " Switches view is incorrect" )
 
-                    if ports[ controller ] or "Error" not in ports[ controller ]:
-                        currentPortsResult = main.Mininet1.comparePorts(
-                            MNTopo,
-                            json.loads(
-                                ports[ controller ] ) )
-                    else:
-                        currentPortsResult = main.FALSE
-                    utilities.assert_equals( expect=main.TRUE,
-                                            actual=currentPortsResult,
-                                            onpass="ONOS" + controllerStr +
-                                            " ports view is correct",
-                                            onfail="ONOS" + controllerStr +
-                                            " ports view is incorrect" )
+                if ports[ controller ] or "Error" not in ports[ controller ]:
+                    currentPortsResult = main.Mininet1.comparePorts(
+                        MNTopo,
+                        json.loads(
+                            ports[ controller ] ) )
+                else:
+                    currentPortsResult = main.FALSE
+                utilities.assert_equals( expect=main.TRUE,
+                                        actual=currentPortsResult,
+                                        onpass="ONOS" + controllerStr +
+                                        " ports view is correct",
+                                        onfail="ONOS" + controllerStr +
+                                        " ports view is incorrect" )
 
-                    if links[ controller ] or "Error" not in links[ controller ]:
-                        currentLinksResult = main.Mininet1.compareLinks(
-                            MNTopo,
-                            json.loads(
-                                links[ controller ] ) )
-                    else:
-                        currentLinksResult = main.FALSE
-                    utilities.assert_equals( expect=main.TRUE,
-                                            actual=currentLinksResult,
-                                            onpass="ONOS" + controllerStr +
-                                            " links view is correct",
-                                            onfail="ONOS" + controllerStr +
-                                            " links view is incorrect" )
-                devicesResults = devicesResults and currentDevicesResult
-                portsResults = portsResults and currentPortsResult
-                linksResults = linksResults and currentLinksResult
+                if links[ controller ] or "Error" not in links[ controller ]:
+                    currentLinksResult = main.Mininet1.compareLinks(
+                        MNTopo,
+                        json.loads(
+                            links[ controller ] ) )
+                else:
+                    currentLinksResult = main.FALSE
+                utilities.assert_equals( expect=main.TRUE,
+                                        actual=currentLinksResult,
+                                        onpass="ONOS" + controllerStr +
+                                        " links view is correct",
+                                        onfail="ONOS" + controllerStr +
+                                        " links view is incorrect" )
+            devicesResults = devicesResults and currentDevicesResult
+            portsResults = portsResults and currentPortsResult
+            linksResults = linksResults and currentLinksResult
 
-                # Compare json objects for hosts and dataplane clusters
+            # Compare json objects for hosts and dataplane clusters
 
-                # hosts
-                consistentHostsResult = main.TRUE
-                for controller in range( len( hosts ) ):
-                    controllerStr = str( controller + 1 )
-                    if "Error" not in hosts[ controller ]:
-                        if hosts[ controller ] == hosts[ 0 ]:
-                            continue
-                        else:  # hosts not consistent
-                            main.log.report( "hosts from ONOS" + controllerStr +
-                                             " is inconsistent with ONOS1" )
-                            main.log.warn( repr( hosts[ controller ] ) )
-                            consistentHostsResult = main.FALSE
-
-                    else:
-                        main.log.report( "Error in getting ONOS hosts from ONOS" +
-                                         controllerStr )
+            # hosts
+            consistentHostsResult = main.TRUE
+            for controller in range( len( hosts ) ):
+                controllerStr = str( controller + 1 )
+                if "Error" not in hosts[ controller ]:
+                    if hosts[ controller ] == hosts[ 0 ]:
+                        continue
+                    else:  # hosts not consistent
+                        main.log.report( "hosts from ONOS" + controllerStr +
+                                         " is inconsistent with ONOS1" )
+                        main.log.warn( repr( hosts[ controller ] ) )
                         consistentHostsResult = main.FALSE
-                        main.log.warn( "ONOS" + controllerStr +
-                                       " hosts response: " +
-                                       repr( hosts[ controller ] ) )
-                utilities.assert_equals(
-                    expect=main.TRUE,
-                    actual=consistentHostsResult,
-                    onpass="Hosts view is consistent across all ONOS nodes",
-                    onfail="ONOS nodes have different views of hosts" )
 
-                # Strongly connected clusters of devices
-                consistentClustersResult = main.TRUE
-                for controller in range( len( clusters ) ):
-                    controllerStr = str( controller + 1 )
-                    if "Error" not in clusters[ controller ]:
-                        if clusters[ controller ] == clusters[ 0 ]:
-                            continue
-                        else:  # clusters not consistent
-                            main.log.report( "clusters from ONOS" +
-                                             controllerStr +
-                                             " is inconsistent with ONOS1" )
-                            consistentClustersResult = main.FALSE
+                else:
+                    main.log.report( "Error in getting ONOS hosts from ONOS" +
+                                     controllerStr )
+                    consistentHostsResult = main.FALSE
+                    main.log.warn( "ONOS" + controllerStr +
+                                   " hosts response: " +
+                                   repr( hosts[ controller ] ) )
+            utilities.assert_equals(
+                expect=main.TRUE,
+                actual=consistentHostsResult,
+                onpass="Hosts view is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of hosts" )
 
-                    else:
-                        main.log.report( "Error in getting dataplane clusters " +
-                                         "from ONOS" + controllerStr )
+            # Strongly connected clusters of devices
+            consistentClustersResult = main.TRUE
+            for controller in range( len( clusters ) ):
+                controllerStr = str( controller + 1 )
+                if "Error" not in clusters[ controller ]:
+                    if clusters[ controller ] == clusters[ 0 ]:
+                        continue
+                    else:  # clusters not consistent
+                        main.log.report( "clusters from ONOS" +
+                                         controllerStr +
+                                         " is inconsistent with ONOS1" )
                         consistentClustersResult = main.FALSE
-                        main.log.warn( "ONOS" + controllerStr +
-                                       " clusters response: " +
-                                       repr( clusters[ controller ] ) )
-                utilities.assert_equals(
-                    expect=main.TRUE,
-                    actual=consistentClustersResult,
-                    onpass="Clusters view is consistent across all ONOS nodes",
-                    onfail="ONOS nodes have different views of clusters" )
-                # there should always only be one cluster
-                numClusters = len( json.loads( clusters[ 0 ] ) )
-                utilities.assert_equals(
-                    expect=1,
-                    actual=numClusters,
-                    onpass="ONOS shows 1 SCC",
-                    onfail="ONOS shows " +
-                    str( numClusters ) +
-                    " SCCs" )
 
-                topoResult = ( devicesResults and portsResults and linksResults
-                               and consistentHostsResult
-                               and consistentClustersResult )
+                else:
+                    main.log.report( "Error in getting dataplane clusters " +
+                                     "from ONOS" + controllerStr )
+                    consistentClustersResult = main.FALSE
+                    main.log.warn( "ONOS" + controllerStr +
+                                   " clusters response: " +
+                                   repr( clusters[ controller ] ) )
+            utilities.assert_equals(
+                expect=main.TRUE,
+                actual=consistentClustersResult,
+                onpass="Clusters view is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of clusters" )
+            # there should always only be one cluster
+            numClusters = len( json.loads( clusters[ 0 ] ) )
+            utilities.assert_equals(
+                expect=1,
+                actual=numClusters,
+                onpass="ONOS shows 1 SCC",
+                onfail="ONOS shows " +
+                str( numClusters ) +
+                " SCCs" )
 
-                topoResult = topoResult and int( count <= 2 )
-                note = "note it takes about " + str( int( cliTime ) ) + \
-                    " seconds for the test to make all the cli calls to fetch " +\
-                    "the topology from each ONOS instance"
-                main.log.info(
-                    "Very crass estimate for topology discovery/convergence( " +
-                    str( note ) + " ): " + str( elapsed ) + " seconds, " +
-                    str( count ) + " tries" )
-                utilities.assert_equals( expect=main.TRUE, actual=topoResult,
-                                        onpass="Topology Check Test successful",
-                                        onfail="Topology Check Test NOT successful" )
-                if topoResult == main.TRUE:
-                    main.log.report( "ONOS topology view matches Mininet topology" )
-            except:
-                main.log.info( self.name + " ::::::" )
-                main.log.error( traceback.print_exc() )
-                main.log.info( self.name + " ::::::" )
+            topoResult = ( devicesResults and portsResults and linksResults
+                           and consistentHostsResult
+                           and consistentClustersResult )
 
+        topoResult = topoResult and int( count <= 2 )
+        note = "note it takes about " + str( int( cliTime ) ) + \
+            " seconds for the test to make all the cli calls to fetch " +\
+            "the topology from each ONOS instance"
+        main.log.info(
+            "Very crass estimate for topology discovery/convergence( " +
+            str( note ) + " ): " + str( elapsed ) + " seconds, " +
+            str( count ) + " tries" )
+        utilities.assert_equals( expect=main.TRUE, actual=topoResult,
+                                onpass="Topology Check Test successful",
+                                onfail="Topology Check Test NOT successful" )
+        if topoResult == main.TRUE:
+            main.log.report( "ONOS topology view matches Mininet topology" )
 
     def CASE9( self, main ):
         """
diff --git a/TestON/tests/HATestSanity/HATestSanity.topo b/TestON/tests/HATestSanity/HATestSanity.topo
index c24d546..9305025 100644
--- a/TestON/tests/HATestSanity/HATestSanity.topo
+++ b/TestON/tests/HATestSanity/HATestSanity.topo
@@ -151,7 +151,7 @@
                 <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
                 <arg2> --topo mytopo </arg2>
                 <arg3> </arg3>
-                <controller> remote </controller>
+                <controller> none </controller>
             </COMPONENTS>
         </Mininet1>
 
@@ -162,7 +162,7 @@
             <type>RemoteMininetDriver</type>
             <connect_order>17</connect_order>
             <COMPONENTS>
-             </COMPONENTS>
+            </COMPONENTS>
         </Mininet2>
 
     </COMPONENT>
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params
index 7f5cf4e..80de267 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params
@@ -1,7 +1,7 @@
 <PARAMS>
     <testcases>1,2,8,3,4,5,14,[6],8,3,7,4,15,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
     <ENV>
-    <cellName>HA</cellName>
+        <cellName>HA</cellName>
     </ENV>
     <Git>False</Git>
     <branch> master </branch>
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
index 4b9b287..44ce741 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
@@ -293,7 +293,7 @@
                                " and h" + str( i + 10 ) )
             elif ping == main.TRUE:
                 main.log.info( "Ping test passed!" )
-                PingResult = main.TRUE
+                # Don't set PingResult or you'd override failures
         if PingResult == main.FALSE:
             main.log.report(
                 "Intents have not been installed correctly, pings failed." )
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo
index 4d4156c..9305025 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo
@@ -151,7 +151,7 @@
                 <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
                 <arg2> --topo mytopo </arg2>
                 <arg3> </arg3>
-                <controller> remote </controller>
+                <controller> none </controller>
             </COMPONENTS>
         </Mininet1>
 
@@ -162,11 +162,7 @@
             <type>RemoteMininetDriver</type>
             <connect_order>17</connect_order>
             <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo --arp</arg2>
-                <controller> remote </controller>
-             </COMPONENTS>
+            </COMPONENTS>
         </Mininet2>
 
     </COMPONENT>
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
index c0325a9..af23c70 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -1,5 +1,5 @@
 <PARAMS>
-    #CHO sequence : 1,2,3,[4,5,6,5,7,8,5,10,5,9,5,7,8,5,10,5]*2
+    #CHO sequence : 1,2,3,[4,5,6,5,70,80,5,10,5,9,5,71,81,5,10,5]*100
     # 1. ONOS brinup Test case
     # 2. Assign and Balance all Mininet switches across controllers
     # 3. Collect reference toplogy for topo compare
@@ -10,17 +10,38 @@
     # 8. Bring core links Up that were down and verify pingall
     # 9. Install 114 point intents and verify ping all
     # 10. Remove all intents on ONOS
-    # 1,2,3,[4,5,6,5,7,8,5,10,5,9,5,7,8,5,10,5]*2
+    # 1,2,3,[4,5,6,5,70,80,5,10,5,9,5,71,81,5,10,5]*100
 
-    <testcases>1,2,3,[4,5,6,5,70,80,5,10,5,9,5,71,81,5,10,5]*100</testcases>
+    <testcases>1,2,3,4,5,12,3,4,5,13,3,4,5</testcases>
     <ENV>
         <cellName>choTest5</cellName>
     </ENV>
     <GIT>
         #autoPull 'on' or 'off'
-        <autoPull>on</autoPull>
+        <autoPull>off</autoPull>
         <branch>master</branch>
     </GIT>
+    <TOPO1>
+	<topo>~/mininet/custom/topoAtt.py</topo>
+	<numSwitches>25</numSwitches>
+	<numHosts>25</numHosts>
+	<numLinks>114</numLinks>
+	<numPaths>1</numPaths>
+    </TOPO1>
+    <TOPO2>
+	<topo>~/mininet/custom/topoChordal.py</topo>
+	<numSwitches>25</numSwitches>
+	<numHosts>25</numHosts>
+	<numLinks>600</numLinks>
+	<numPaths>1</numPaths>
+    </TOPO2>
+    <TOPO3>
+	<topo>~/mininet/custom/topoSpine.py</topo>
+	<numSwitches>78</numSwitches>
+	<numHosts>68</numHosts>
+	<numLinks>284</numLinks>
+	<numPaths>1</numPaths>
+    </TOPO3>
     <CTRL>
 	<numCtrl>5</numCtrl>
         <ip1>10.128.40.41</ip1>
@@ -38,13 +59,6 @@
 	<startMAC>00:00:00:00:00:01</startMAC>
 	<endMAC>00:00:00:00:00:19</endMAC>
     </HOSTS>
-    <ONOSTOPO>
-	<numDevices>25</numDevices>
-	<numLinks>114</numLinks>
-	<numHosts>25</numHosts>
-	<numIntents>300</numIntents>
-	<numPaths>1360</numPaths>
-    </ONOSTOPO>
     <CORELINKS>
         <toggleLinks>3</toggleLinks>
 	
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index 3be5cbb..eb71518 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -11,13 +11,6 @@
 
     def __init__( self ):
         self.default = ''
-        global deviceDPIDs
-        global hostMACs
-        global deviceLinks
-        global deviceActiveLinksCount
-        global devicePortsEnabledCount
-        global installedIntents
-        global randomLink1, randomLink2, randomLink3, numSwitches, numLinks
 
     def CASE1( self, main ):
         """
@@ -31,9 +24,20 @@
         onos-wait-for-start
         """
         import time
+
+        main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
+        main.ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        main.ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+        main.ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+        main.ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
+        main.ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
+        main.ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
+        main.ONOS2_port = main.params[ 'CTRL' ][ 'port2' ]
+        main.ONOS3_port = main.params[ 'CTRL' ][ 'port3' ]
+        main.ONOS4_port = main.params[ 'CTRL' ][ 'port4' ]
+        main.ONOS5_port = main.params[ 'CTRL' ][ 'port5' ]
         cell_name = main.params[ 'ENV' ][ 'cellName' ]
         git_pull = main.params[ 'GIT' ][ 'autoPull' ]
-        numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
         git_branch = main.params[ 'GIT' ][ 'branch' ]
 
         main.case( "Set up test environment" )
@@ -42,8 +46,8 @@
 
         main.step( "Git checkout and pull " + git_branch )
         if git_pull == 'on':
-            checkout_result = main.ONOSbench.git_checkout( git_branch )
-            pull_result = main.ONOSbench.git_pull()
+            checkout_result = main.ONOSbench.gitCheckout( git_branch )
+            pull_result = main.ONOSbench.gitPull()
             cp_result = ( checkout_result and pull_result )
         else:
             checkout_result = main.TRUE
@@ -55,45 +59,49 @@
                                  onfail="Test step FAIL" )
 
         main.step( "mvn clean & install" )
-        mvn_result = main.ONOSbench.clean_install()
-        utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
+        if git_pull == 'on':
+            mvn_result = main.ONOSbench.cleanInstall()
+            utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
+        else:
+            mvn_result = main.TRUE
+            main.log.info("Skipped mvn clean install as git pull is disabled in params file")
 
-        main.ONOSbench.get_version( report=True )
+        main.ONOSbench.getVersion( report=True )
 
         main.step( "Apply Cell environment for ONOS" )
-        cell_result = main.ONOSbench.set_cell( cell_name )
+        cell_result = main.ONOSbench.setCell( cell_name )
         utilities.assert_equals( expect=main.TRUE, actual=cell_result,
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
         main.step( "Create ONOS package" )
-        packageResult = main.ONOSbench.onos_package()
+        packageResult = main.ONOSbench.onosPackage()
         utilities.assert_equals( expect=main.TRUE, actual=packageResult,
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
 
         main.step( "Uninstall ONOS package on all Nodes" )
         uninstallResult = main.TRUE
-        for i in range( 1, int( numCtrls ) + 1 ):
+        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 )
-            u_result = main.ONOSbench.onos_uninstall( ONOS_ip )
+            u_result = main.ONOSbench.onosUninstall( ONOS_ip )
             utilities.assert_equals( expect=main.TRUE, actual=u_result,
                                      onpass="Test step PASS",
                                      onfail="Test step FAIL" )
             uninstallResult = ( uninstallResult and u_result )
 
         main.step( "Removing copy-cat logs from ONOS nodes" )
-        main.ONOSbench.onos_remove_raft_logs()
+        main.ONOSbench.onosRemoveRaftLogs()
 
         main.step( "Install ONOS package on all Nodes" )
         installResult = main.TRUE
-        for i in range( 1, int( numCtrls ) + 1 ):
+        for i in range( 1, int( main.numCtrls ) + 1 ):
             ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
             main.log.info( "Intsalling package on ONOS Node IP: " + ONOS_ip )
-            i_result = main.ONOSbench.onos_install( node=ONOS_ip )
+            i_result = main.ONOSbench.onosInstall( node=ONOS_ip )
             utilities.assert_equals( expect=main.TRUE, actual=i_result,
                                      onpass="Test step PASS",
                                      onfail="Test step FAIL" )
@@ -101,10 +109,10 @@
 
         main.step( "Verify ONOS nodes UP status" )
         statusResult = main.TRUE
-        for i in range( 1, int( numCtrls ) + 1 ):
+        for i in range( 1, int( main.numCtrls ) + 1 ):
             ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
             main.log.info( "ONOS Node " + ONOS_ip + " status:" )
-            onos_status = main.ONOSbench.onos_status( node=ONOS_ip )
+            onos_status = main.ONOSbench.onosStatus( node=ONOS_ip )
             utilities.assert_equals( expect=main.TRUE, actual=onos_status,
                                      onpass="Test step PASS",
                                      onfail="Test step FAIL" )
@@ -115,13 +123,13 @@
         karafTimeout = "3600000"
         # need to wait here for sometime. This will be removed once ONOS is
         # stable enough
-        time.sleep( 15 )
-        for i in range( 1, int( numCtrls ) + 1 ):
+        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 + \
-                ".start_onos_cli(ONOS_ip, karafTimeout=karafTimeout)"
+                ".startOnosCli(ONOS_ip, karafTimeout=karafTimeout)"
             utilities.assert_equals( expect=main.TRUE, actual=startcli,
                                      onpass="Test step PASS",
                                      onfail="Test step FAIL" )
@@ -135,24 +143,15 @@
 
     def CASE2( self, main ):
         """
-        This test script still needs more refactoring
+        This test loads a Topology (ATT) on Mininet and balances all switches.
         """
         import re
         import time
         import copy
-        numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
-        ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
-        ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
-        ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
-        ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
-        ONOS2_port = main.params[ 'CTRL' ][ 'port2' ]
-        ONOS3_port = main.params[ 'CTRL' ][ 'port3' ]
-        ONOS4_port = main.params[ 'CTRL' ][ 'port4' ]
-        ONOS5_port = main.params[ 'CTRL' ][ 'port5' ]
+        main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
+        main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
+        main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
 
-        numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
         main.log.report(
             "Assign and Balance all Mininet switches across controllers" )
         main.log.report(
@@ -163,26 +162,27 @@
         main.case(
             "Assign and Balance all Mininet switches across controllers" )
         main.step( "Assign switches to controllers" )
-        for i in range( 1, 26 ):  # 1 to ( num of switches +1 )
-            main.Mininet1.assign_sw_controller(
+        netStatus = main.Mininet1.startNet()
+        for i in range( 1, ( main.numMNswitches + 1 ) ):  # 1 to ( num of switches +1 )
+            main.Mininet1.assignSwController(
                 sw=str( i ),
-                count=int( numCtrls ),
-                ip1=ONOS1_ip,
-                port1=ONOS1_port,
-                ip2=ONOS2_ip,
-                port2=ONOS2_port,
-                ip3=ONOS3_ip,
-                port3=ONOS3_port,
-                ip4=ONOS4_ip,
-                port4=ONOS4_port,
-                ip5=ONOS5_ip,
-                port5=ONOS5_port )
+                count=int( main.numCtrls ),
+                ip1=main.ONOS1_ip,
+                port1=main.ONOS1_port,
+                ip2=main.ONOS2_ip,
+                port2=main.ONOS2_port,
+                ip3=main.ONOS3_ip,
+                port3=main.ONOS3_port,
+                ip4=main.ONOS4_ip,
+                port4=main.ONOS4_port,
+                ip5=main.ONOS5_ip,
+                port5=main.ONOS5_port )
 
         switch_mastership = main.TRUE
-        for i in range( 1, 26 ):
-            response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+        for i in range( 1, ( main.numMNswitches + 1 ) ):
+            response = main.Mininet1.getSwController( "s" + str( i ) )
             print( "Response is " + str( response ) )
-            if re.search( "tcp:" + ONOS1_ip, response ):
+            if re.search( "tcp:" + main.ONOS1_ip, response ):
                 switch_mastership = switch_mastership and main.TRUE
             else:
                 switch_mastership = main.FALSE
@@ -191,19 +191,19 @@
             main.log.report( "Controller assignment successfull" )
         else:
             main.log.report( "Controller assignment failed" )
-        time.sleep( 5 )
+        time.sleep( 15 )
 
-        main.step( "Balance devices across controllers" )
-        for i in range( int( numCtrls ) ):
-            balanceResult = main.ONOScli1.balance_masters()
+        #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 )
+        #    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" )
+        #utilities.assert_equals(
+         #   expect=main.TRUE,
+          #  actual=balanceResult,
+           # onpass="Assign and Balance devices test PASS",
+            #onfail="Assign and Balance devices test FAIL" )
 
     def CASE3( self, main ):
         """
@@ -212,11 +212,11 @@
         """
         import re
         import copy
-        deviceDPIDs = []
-        hostMACs = []
-        deviceLinks = []
-        deviceActiveLinksCount = []
-        devicePortsEnabledCount = []
+        main.deviceDPIDs = []
+        main.hostMACs = []
+        main.deviceLinks = []
+        main.deviceActiveLinksCount = []
+        main.devicePortsEnabledCount = []
 
         main.log.report(
             "Collect and Store topology details from ONOS before running any Tests" )
@@ -226,63 +226,65 @@
 
         main.step( "Collect and store current number of switches and links" )
         topology_output = main.ONOScli1.topology()
-        topology_result = main.ONOSbench.get_topology( topology_output )
-        numSwitches = topology_result[ 'devices' ]
-        numLinks = topology_result[ 'links' ]
-        main.log.info(
-            "Currently there are %s switches and %s links" %
-            ( str( numSwitches ), str( numLinks ) ) )
+        topology_result = main.ONOSbench.getTopology( topology_output )
+        numOnosDevices = topology_result[ 'devices' ]
+        numOnosLinks = topology_result[ 'links' ]
 
-        main.step( "Store Device DPIDs" )
-        for i in range( 1, 26 ):
-            deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
-        print "Device DPIDs in Store: \n", str( deviceDPIDs )
+        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' ) )
+            print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
 
-        main.step( "Store Host MACs" )
-        for i in range( 1, 26 ):
-            hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
-        print "Host MACs in Store: \n", str( hostMACs )
+            main.step( "Store Host MACs" )
+            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.step( "Collect and store all Devices Links" )
-        linksResult = main.ONOScli1.links( json_format=False )
-        ansi_escape = re.compile( r'\x1b[^m]*m' )
-        linksResult = ansi_escape.sub( '', linksResult )
-        linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
-        linksResult = linksResult.splitlines()
-        linksResult = linksResult[ 1: ]
-        deviceLinks = copy.copy( linksResult )
-        print "Device Links Stored: \n", str( deviceLinks )
-        # this will be asserted to check with the params provided count of
-        # links
-        print "Length of Links Store", len( deviceLinks )
+            main.step( "Collect and store all Devices Links" )
+            linksResult = main.ONOScli1.links( jsonFormat=False )
+            ansi_escape = re.compile( r'\x1b[^m]*m' )
+            linksResult = ansi_escape.sub( '', linksResult )
+            linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
+            linksResult = linksResult.splitlines()
+            linksResult = linksResult[ 1: ]
+            main.deviceLinks = copy.copy( linksResult )
+            print "Device Links Stored: \n", str( main.deviceLinks )
+            # this will be asserted to check with the params provided count of
+            # links
+            print "Length of Links Store", len( main.deviceLinks )
 
-        main.step( "Collect and store each Device ports enabled Count" )
-        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", "" )
-            devicePortsEnabledCount.append( portCount )
-        print "Device Enabled Port Counts Stored: \n", str( devicePortsEnabledCount )
+            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 )
+            print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
 
-        main.step( "Collect and store each Device active links Count" )
-        for i in range( 1, 26 ):
-            linkCountResult = main.ONOScli1.getDeviceLinksActiveCount(
-                "of:00000000000000" +
-                format(
-                    i,
-                    '02x' ) )
-            linkCountTemp = re.split( r'\t+', linkCountResult )
-            linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
-            deviceActiveLinksCount.append( linkCount )
-        print "Device Active Links Count Stored: \n", str( deviceActiveLinksCount )
+            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 )
+
+        else:
+            main.log.info("Devices (expected): %s, Links (expected): %s" % 
+                    ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
+            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()
 
         # just returning TRUE for now as this one just collects data
-        caseResult = main.TRUE
-        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+        case3Result = main.TRUE
+        utilities.assert_equals( expect=main.TRUE, actual=case3Result,
                                  onpass="Saving ONOS topology data test PASS",
                                  onfail="Saving ONOS topology data test FAIL" )
 
@@ -293,18 +295,18 @@
         import re
         import copy
         import time
-        numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
+
         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( numCtrls ) + 1 ):
+        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 + ".feature_install(onosFeature)"
+            exec "inResult=main." + ONOScli + ".featureInstall(onosFeature)"
             time.sleep( 3 )
             installResult = inResult and installResult
 
@@ -328,12 +330,12 @@
 
         main.step( "Disable Reactive forwarding" )
         uninstallResult = main.TRUE
-        for i in range( 1, int( numCtrls ) + 1 ):
+        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 + ".feature_uninstall(onosFeature)"
+            exec "unResult=main." + ONOScli + ".featureUninstall(onosFeature)"
             uninstallResult = unResult and uninstallResult
 
         # Waiting for reative flows to be cleared.
@@ -349,11 +351,11 @@
         Compare current ONOS topology with reference data
         """
         import re
-        devicesDPID_tmp = []
-        hostMACs_tmp = []
-        deviceLinks_tmp = []
-        deviceActiveLinksCount_tmp = []
-        devicePortsEnabledCount_tmp = []
+        devicesDPIDTemp = []
+        hostMACsTemp = []
+        deviceLinksTemp = []
+        deviceActiveLinksCountTemp = []
+        devicePortsEnabledCountTemp = []
 
         main.log.report(
             "Compare ONOS topology with reference data in Stores" )
@@ -369,16 +371,16 @@
                     '02x' ) )
             portTemp = re.split( r'\t+', portResult )
             portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
-            devicePortsEnabledCount_tmp.append( portCount )
+            devicePortsEnabledCountTemp.append( portCount )
             time.sleep( 2 )
-        print (
-            "Device Enabled ports EXPECTED: \n" +
-            str( devicePortsEnabledCount ) )
-        print (
-            "Device Enabled ports ACTUAL: \n" +
-            str( devicePortsEnabledCount_tmp ) )
-        if ( cmp( devicePortsEnabledCount,
-                  devicePortsEnabledCount_tmp ) == 0 ):
+        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
         else:
             stepResult1 = main.FALSE
@@ -392,29 +394,26 @@
                     '02x' ) )
             linkTemp = re.split( r'\t+', linkResult )
             linkCount = linkTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
-            deviceActiveLinksCount_tmp.append( linkCount )
+            deviceActiveLinksCountTemp.append( linkCount )
             time.sleep( 3 )
-        print (
-            "Device Active links EXPECTED: \n" +
-            str( deviceActiveLinksCount ) )
-        print (
-            "Device Active links ACTUAL: \n" +
-            str( deviceActiveLinksCount_tmp ) )
-        if ( cmp( deviceActiveLinksCount, deviceActiveLinksCount_tmp ) == 0 ):
+        main.log.info (
+            "Device Active links EXPECTED: %s" %
+              str( main.deviceActiveLinksCount ) )
+        main.log.info (
+            "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
+        if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
             stepResult2 = main.TRUE
         else:
             stepResult2 = main.FALSE
 
         """
-        place holder for comparing devices, hosts and paths if required.
+        place holder for comparing devices, hosts, paths and intents if required.
         Links and ports data would be incorrect with out devices anyways.
         """
-        caseResult = ( stepResult1 and stepResult2 )
-        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+        case5Result = ( stepResult1 and stepResult2 )
+        utilities.assert_equals( expect=main.TRUE, actual=case5Result,
                                  onpass="Compare Topology test PASS",
                                  onfail="Compare Topology test FAIL" )
-        if caseResult == main.TRUE:
-            main.log.report( "Compare Topology test Pass" )
 
     def CASE6( self ):
         """
@@ -423,12 +422,13 @@
         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( hostMACs, 2 ) )
+        hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
         for i in range( len( hostCombos ) ):
-            iResult = main.ONOScli1.add_host_intent(
+            iResult = main.ONOScli1.addHostIntent(
                 hostCombos[ i ][ 0 ],
                 hostCombos[ i ][ 1 ] )
             intentResult = ( intentResult and iResult )
@@ -448,6 +448,7 @@
                                  onfail="PING ALL FAIL" )
 
         case4Result = ( intentResult and pingResult )
+        #case4Result = pingResult
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case4Result,
@@ -459,7 +460,9 @@
         Randomly bring some core links down and verify ping all ( Host Intents Scenario )
         """
         import random
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        main.randomLink1 = []
+        main.randomLink2 = []
+        main.randomLink3 = []
         link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
         link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' )
         link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
@@ -469,47 +472,41 @@
         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.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" )
+        main.log.report( "Host intents - Randomly bring some core links down and verify ping all" )
+        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 you PARAMS file. Valid range for number of switch links to toggle is between 1 to 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()
         else:
-            main.log.info(
-                "User provided Core switch links range to toggle is correct, proceeding to run the test" )
+            main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
 
         main.step( "Cut links on Core devices using user provided range" )
-        randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
-        randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
-        randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
+        main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
+        main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
+        main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
         for i in range( int( switchLinksToToggle ) ):
             main.Mininet1.link(
                 END1=link1End1,
-                END2=randomLink1[ i ],
+                END2=main.randomLink1[ i ],
                 OPTION="down" )
             main.Mininet1.link(
                 END1=link2End1,
-                END2=randomLink2[ i ],
+                END2=main.randomLink2[ i ],
                 OPTION="down" )
             main.Mininet1.link(
                 END1=link3End1,
-                END2=randomLink3[ i ],
+                END2=main.randomLink3[ i ],
                 OPTION="down" )
         time.sleep( link_sleep )
 
         topology_output = main.ONOScli2.topology()
-        linkDown = main.ONOSbench.check_status(
-            topology_output, numSwitches, str(
-                int( numLinks ) - int( switchLinksToToggle ) * 6 ) )
+        linkDown = main.ONOSbench.checkStatus(
+            topology_output, main.numMNswitches, str(
+                int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
         utilities.assert_equals(
             expect=main.TRUE,
             actual=linkDown,
@@ -532,8 +529,8 @@
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult7 = linkDown and pingResultLinkDown
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult7,
+        caseResult70 = linkDown and pingResultLinkDown
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
                                  onpass="Random Link cut Test PASS",
                                  onfail="Random Link cut Test FAIL" )
 
@@ -542,7 +539,6 @@
         Bring the core links up that are down and verify ping all ( Host Intents Scenario )
         """
         import random
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
         link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
         link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
         link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
@@ -572,10 +568,10 @@
         time.sleep( link_sleep )
 
         topology_output = main.ONOScli2.topology()
-        linkUp = main.ONOSbench.check_status(
+        linkUp = main.ONOSbench.checkStatus(
             topology_output,
-            numSwitches,
-            str( numLinks ) )
+            main.numMNswitches,
+            str( main.numMNlinks ) )
         utilities.assert_equals(
             expect=main.TRUE,
             actual=linkUp,
@@ -598,8 +594,8 @@
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult8 = linkUp and pingResultLinkUp
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult8,
+        caseResult80 = linkUp and pingResultLinkUp
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
                                  onpass="Link Up Test PASS",
                                  onfail="Link Up Test FAIL" )
 
@@ -608,7 +604,9 @@
         Randomly bring some core links down and verify ping all ( Point Intents Scenario )
         """
         import random
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        main.randomLink1 = []
+        main.randomLink2 = []
+        main.randomLink3 = []
         link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
         link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' )
         link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
@@ -618,14 +616,10 @@
         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(
-            "__________________________________________________________________" )
-        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" )
+        main.log.report( "Point Intents - Randomly bring some core links down and verify ping all" )
+        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" )
         if ( int( switchLinksToToggle ) ==
              0 or int( switchLinksToToggle ) > 5 ):
             main.log.info(
@@ -643,22 +637,22 @@
         for i in range( int( switchLinksToToggle ) ):
             main.Mininet1.link(
                 END1=link1End1,
-                END2=randomLink1[ i ],
+                END2=main.randomLink1[ i ],
                 OPTION="down" )
             main.Mininet1.link(
                 END1=link2End1,
-                END2=randomLink2[ i ],
+                END2=main.randomLink2[ i ],
                 OPTION="down" )
             main.Mininet1.link(
                 END1=link3End1,
-                END2=randomLink3[ i ],
+                END2=main.randomLink3[ i ],
                 OPTION="down" )
         time.sleep( link_sleep )
 
         topology_output = main.ONOScli2.topology()
-        linkDown = main.ONOSbench.check_status(
-            topology_output, numSwitches, str(
-                int( numLinks ) - int( switchLinksToToggle ) * 6 ) )
+        linkDown = main.ONOSbench.checkStatus(
+            topology_output, main.numSwitches, str(
+                int( main.numLinks ) - int( switchLinksToToggle ) * 6 ) )
         utilities.assert_equals(
             expect=main.TRUE,
             actual=linkDown,
@@ -691,7 +685,6 @@
         Bring the core links up that are down and verify ping all ( Point Intents Scenario )
         """
         import random
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
         link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
         link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
         link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
@@ -708,23 +701,23 @@
         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 )
 
         topology_output = main.ONOScli2.topology()
-        linkUp = main.ONOSbench.check_status(
+        linkUp = main.ONOSbench.checkStatus(
             topology_output,
-            numSwitches,
-            str( numLinks ) )
+            main.numMNswitches,
+            str( main.numMNlinks ) )
         utilities.assert_equals(
             expect=main.TRUE,
             actual=linkUp,
@@ -747,8 +740,8 @@
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult8 = linkUp and pingResultLinkUp
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult8,
+        caseResult81 = linkUp and pingResultLinkUp
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult81,
                                  onpass="Link Up Test PASS",
                                  onfail="Link Up Test FAIL" )
 
@@ -760,18 +753,18 @@
         main.log.report( "Install 114 point intents and verify Ping all" )
         main.log.report( "___________________________________________" )
         main.case( "Install 114 point intents and Ping all" )
-        deviceLinks_copy = copy.copy( deviceLinks )
+        deviceLinksCopy = copy.copy( main.deviceLinks )
         main.step( "Install 114 point intents" )
-        for i in range( len( deviceLinks_copy ) ):
+        for i in range( len( deviceLinksCopy ) ):
             pointLink = str(
-                deviceLinks_copy[ i ] ).replace(
+                deviceLinksCopy[ i ] ).replace(
                 "src=",
                 "" ).replace(
                 "dst=",
                 "" ).split( ',' )
             point1 = pointLink[ 0 ].split( '/' )
             point2 = pointLink[ 1 ].split( '/' )
-            installResult = main.ONOScli1.add_point_intent(
+            installResult = main.ONOScli1.addPointIntent(
                 point1[ 0 ], point2[ 0 ], int(
                     point1[ 1 ] ), int(
                     point2[ 1 ] ) )
@@ -849,8 +842,8 @@
             print "Intent IDs: ", intentIdList
             for id in range( len( intentIdList ) ):
                 print "Removing intent id (round 1) :", intentIdList[ id ]
-                main.ONOScli1.remove_intent( intent_id=intentIdList[ id ] )
-                time.sleep( 1 )
+                main.ONOScli1.removeIntent( intentId=intentIdList[ id ] )
+                #time.sleep( 1 )
 
             main.log.info(
                 "Verify all intents are removed and if any leftovers try remove one more time" )
@@ -875,9 +868,9 @@
                 print "Leftover Intent IDs: ", intentIdList1
                 for id in range( len( intentIdList1 ) ):
                     print "Removing intent id (round 2):", intentIdList1[ id ]
-                    main.ONOScli1.remove_intent(
-                        intent_id=intentIdList1[ id ] )
-                    time.sleep( 2 )
+                    main.ONOScli1.removeIntent(
+                        intentId=intentIdList1[ id ] )
+                    #time.sleep( 2 )
             else:
                 print "There are no more intents that need to be removed"
                 step1Result = main.TRUE
@@ -889,3 +882,281 @@
         utilities.assert_equals( expect=main.TRUE, actual=caseResult7,
                                  onpass="Intent removal test successful",
                                  onfail="Intent removal test failed" )
+
+    def CASE11( self, main ):
+        """
+        Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
+        """
+        import re
+        import copy
+        import time
+
+        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 )
+
+        main.step( "Verify Pingall" )
+        ping_result = main.FALSE
+        time1 = time.time()
+        ping_result = main.Mininet1.pingall()
+        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
+
+        # Waiting for reative flows to be cleared.
+        time.sleep( 10 )
+
+        case11Result = installResult and ping_result and uninstallResult
+        utilities.assert_equals( expect=main.TRUE, actual=case11Result,
+                                 onpass="Intent based Reactive forwarding Pingall test PASS",
+                                 onfail="Intent based Reactive forwarding Pingall test FAIL" )
+
+    def CASE12( self, main ):
+        """
+        This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
+        """
+        import re
+        import time
+        import copy
+
+        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.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 )
+
+        main.step( "Start Mininet with Chordal topology" )
+        startStatus = main.Mininet1.startNet(topoFile = newTopo)
+
+        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 ),
+                ip1=main.ONOS1_ip,
+                port1=main.ONOS1_port,
+                ip2=main.ONOS2_ip,
+                port2=main.ONOS2_port,
+                ip3=main.ONOS3_ip,
+                port3=main.ONOS3_port,
+                ip4=main.ONOS4_ip,
+                port4=main.ONOS4_port,
+                ip5=main.ONOS5_ip,
+                port5=main.ONOS5_port )
+
+        switch_mastership = main.TRUE
+        for i in range( 1, ( main.numMNswitches + 1 ) ):
+            response = main.Mininet1.getSwController( "s" + str( i ) )
+            print( "Response is " + str( response ) )
+            if re.search( "tcp:" + main.ONOS1_ip, response ):
+                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 )
+        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.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 )
+        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
+        """
+        import re
+        import time
+        import copy
+
+        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.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 )
+
+        main.step( "Start Mininet with Spine topology" )
+        startStatus = main.Mininet1.startNet(topoFile = newTopo)
+
+        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 ),
+                ip1=main.ONOS1_ip,
+                port1=main.ONOS1_port,
+                ip2=main.ONOS2_ip,
+                port2=main.ONOS2_port,
+                ip3=main.ONOS3_ip,
+                port3=main.ONOS3_port,
+                ip4=main.ONOS4_ip,
+                port4=main.ONOS4_port,
+                ip5=main.ONOS5_ip,
+                port5=main.ONOS5_port )
+
+        switch_mastership = main.TRUE
+        for i in range( 1, ( main.numMNswitches + 1 ) ):
+            response = main.Mininet1.getSwController( "s" + str( i ) )
+            print( "Response is " + str( response ) )
+            if re.search( "tcp:" + main.ONOS1_ip, response ):
+                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 )
+        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.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 )
+
+        case13Result = ( startResult and cliResult )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case13Result,
+            onpass="Starting new Spine topology test PASS",
+            onfail="Starting new Spine topology test FAIL" )
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/OnosCHO/OnosCHO.topo
index 2a79611..b36c789 100644
--- a/TestON/tests/OnosCHO/OnosCHO.topo
+++ b/TestON/tests/OnosCHO/OnosCHO.topo
@@ -101,7 +101,7 @@
         </ONOS5>
 	
         <Mininet1>
-            <host>10.128.40.40</host>
+            <host>10.128.40.50</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>MininetCliDriver</type>
@@ -116,7 +116,7 @@
         </Mininet1>
 
         <Mininet2>
-            <host>10.128.40.40</host>
+            <host>10.128.40.50</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>RemoteMininetDriver</type>
diff --git a/TestON/tests/PingallExample/PingallExample.params b/TestON/tests/PingallExample/PingallExample.params
index aecaab6..8d0d10b 100644
--- a/TestON/tests/PingallExample/PingallExample.params
+++ b/TestON/tests/PingallExample/PingallExample.params
@@ -1,12 +1,12 @@
 <PARAMS>
     <testcases>1,2,3</testcases>
     <ENV>
-        <cellName>HA</cellName>
+        <cellName>kelvin</cellName>
     </ENV>
     <Git>True</Git>
 
     <CTRL>
-        <ip1>10.128.30.11</ip1>
+        <ip1>10.128.10.21</ip1>
         <port1>6633</port1>
     </CTRL>
 </PARAMS>
diff --git a/TestON/tests/PingallExample/PingallExample.topo b/TestON/tests/PingallExample/PingallExample.topo
index 1712756..dba7a5d 100644
--- a/TestON/tests/PingallExample/PingallExample.topo
+++ b/TestON/tests/PingallExample/PingallExample.topo
@@ -2,7 +2,7 @@
     <COMPONENT>
 
         <ONOSbench>
-            <host>10.128.30.10</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password></password>
             <type>OnosDriver</type>
@@ -11,7 +11,7 @@
         </ONOSbench>
 
         <ONOScli1>
-            <host>10.128.30.10</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password></password>
             <type>OnosCliDriver</type>
@@ -20,16 +20,16 @@
         </ONOScli1>
 
         <ONOS1>
-            <host>10.128.30.11</host>
-            <user>sdn</user>
-            <password>rocks</password>
+            <host>10.128.10.21</host>
+            <user>admin</user>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>3</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS1>
 
         <Mininet1>
-            <host>10.128.30.9</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
             <password></password>
             <type>MininetCliDriver</type>
diff --git a/TestON/tests/ProdFunc/ProdFunc.py.fixed b/TestON/tests/ProdFunc/ProdFunc.py.fixed
deleted file mode 100644
index 6f4b72b..0000000
--- a/TestON/tests/ProdFunc/ProdFunc.py.fixed
+++ /dev/null
@@ -1,1395 +0,0 @@
-
-# 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 ):
-        """
-        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 pull master and get version" )
-        main.ONOSbench.gitCheckout( "master" )
-        gitPullResult = main.ONOSbench.gitPull()
-        main.log.info( "git_pull_result = " + 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' ] )
-
-        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 CASE11( 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()
-
-        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:-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 \
-                    correctly detected" % roadmCount
-            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 and \
-                    is correctly detected" % packetLayerSWCount
-            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 \
-                    is wrong" % packetLayerSWCount
-            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 hists 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
-        while 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" )
-        # 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 )
-
-        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.testonTopology 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.testonTopology 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 ):
-        """
-        Host intents removal
-        """
-        main.log.report( "This testcase removes any previously added intents \
-                         before adding the same intents or point intents" )
-        main.log.report( "__________________________________" )
-        main.log.info( "Host intents removal" )
-        main.case( "Removing host 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( "Host intents have not been withdrawn correctly" )
-            # main.cleanup()
-            # main.exit()
-        if PingResult == main.FALSE:
-            main.log.report( "Host 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 failed",
-                                onfail="Intent removal test passed" )
-
-    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 mininet hosts h8 and h18 or \
-                  ONOS hosts h8 and h12" )
-        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 )
-
-        main.step(
-            "Add point intents for mininet hosts h9 and h19 or \
-                  ONOS hosts h9 and h13" )
-        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 )
-
-        main.step(
-            "Add point intents for mininet hosts h10 and h20 or \
-                  ONOS hosts hA and h14" )
-        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 )
-
-        main.step(
-            "Add point intents for mininet hosts h11 and h21 or \
-                  ONOS hosts hB and h15" )
-        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 )
-
-        main.step(
-            "Add point intents for mininet hosts h12 and h22 \
-                  ONOS hosts hC and h16" )
-        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 )
-
-        main.step(
-            "Add point intents for mininet hosts h13 and h23 or \
-                  ONOS hosts hD and h17" )
-        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 )
-
-        main.step(
-            "Add point intents for mininet hosts h14 and h24 or \
-                  ONOS hosts hE and h18" )
-        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 )
-
-        main.step(
-            "Add point intents for mininet hosts h15 and h25 or \
-                  ONOS hosts hF and h19" )
-        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 )
-
-        main.step(
-            "Add intents for mininet hosts h16 and h26 or \
-                  ONOS hosts h10 and h1A" )
-        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 )
-
-        main.step(
-            "Add point intents for mininet hosts h17 and h27 or \
-                  ONOS hosts h11 and h1B" )
-        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()
-        # print "flowHandle = ", flowHandle
-        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" )
