diff --git a/README.md b/README.md
index ef2c912..f84882a 100644
--- a/README.md
+++ b/README.md
@@ -51,11 +51,7 @@
 
     $ sudo pip install numpy
 
-4. STS  - This can be installed by:
-
-    $ git clone https://github.com/jhall11/sts.git
-
-5. Linc-OE - Some testcases use this to emulate optical devices
+4. Linc-OE - Some testcases use this to emulate optical devices
 
     Requirements:
 
diff --git a/TestON/bin/cleanup.sh b/TestON/bin/cleanup.sh
new file mode 100755
index 0000000..d921147
--- /dev/null
+++ b/TestON/bin/cleanup.sh
@@ -0,0 +1,5 @@
+#!/bin/bash 
+# This script will kill any TestON, ssh, and Mininet sessions that are running.
+sudo kill -9 `ps -ef | grep "./cli.py" | grep -v grep | awk '{print $2}'`
+sudo kill -9 `ps -ef | grep "ssh -X" | grep -v grep | awk '{print $2}'`
+sudo mn -c
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 2661715..7e99ffd 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -32,7 +32,7 @@
 import new
 import xmldict
 import importlib
-import os
+import threading
 module = new.module("test")
 import openspeak
 global path, drivers_path, core_path, tests_path,logs_path
@@ -91,6 +91,8 @@
         self.logs_path = logs_path
         self.driver = ''
         self.Thread = Thread
+        self.cleanupFlag = False
+        self.cleanupLock = threading.Lock()
 
         self.configparser()
         verifyOptions(options)
@@ -298,7 +300,7 @@
                     else:
                         self.stepCache += "No Result\n"
                     self.stepResults.append(self.STEPRESULT)
-            except StandardError as e:
+            except StandardError:
                 self.log.exception( "\nException in the following section of" +
                                     " code: " + str(testCaseNumber) + "." +
                                     str(step) + ": " + self.stepName )
@@ -351,33 +353,51 @@
 
     def cleanup(self):
         '''
-           Release all the component handles and the close opened file handles.
-           This will return TRUE if all the component handles and log handles closed properly,
-           else return FALSE
+        Print a summary of the current test's results then attempt to release
+        all the component handles and the close opened file handles.
 
+        This function shouldbe threadsafe such that cleanup will only be
+        executed once per test.
+
+        This will return TRUE if all the component handles and log handles
+        closed properly, else return FALSE.
         '''
         result = self.TRUE
-        self.logger.testSummary(self)
-
-        #self.reportFile.close()
-
-        #utilities.send_mail()
-        for component in self.componentDictionary.keys():
-            try :
-                tempObject  = vars(self)[component]
-                print "Disconnecting from " + str(tempObject.name) + ": " + \
-                      str(tempObject)
-                tempObject.disconnect()
-            #tempObject.execute(cmd="exit",prompt="(.*)",timeout=120)
-
-            except (Exception):
-                self.log.exception( "Exception while disconnecting from " +
-                                     str( component ) )
-                result = self.FALSE
-        # Closing all the driver's session files
-        for driver in self.componentDictionary.keys():
-           vars(self)[driver].close_log_handles()
-
+        lock = self.cleanupLock
+        if lock.acquire( False ):
+            try:
+                if self.cleanupFlag is False:  # First thread to run this
+                    self.cleanupFlag = True
+                    self.logger.testSummary(self)
+                    for component in self.componentDictionary.keys():
+                        try :
+                            tempObject  = vars(self)[component]
+                            print "Disconnecting from " + str(tempObject.name) + ": " + \
+                                  str(tempObject)
+                            tempObject.disconnect()
+                        except Exception:
+                            self.log.exception( "Exception while disconnecting from " +
+                                                 str( component ) )
+                            result = self.FALSE
+                    # Closing all the driver's session files
+                    for driver in self.componentDictionary.keys():
+                        try:
+                            vars(self)[driver].close_log_handles()
+                        except Exception:
+                            self.log.exception( "Exception while closing log files for " +
+                                                 str( driver ) )
+                            result = self.FALSE
+                else:
+                    pass  # Someone else already ran through this function
+            finally:
+                lock.release()
+        else:  # Someone already has a lock
+            # NOTE: This could cause problems if we don't release the lock
+            #       correctly
+            lock.acquire()  # Wait for the other thread to finish
+            # NOTE: If we don't wait, exit could be called while the thread
+            #       with the lock is still cleaning up
+            lock.release()
         return result
 
     def pause(self):
@@ -585,6 +605,12 @@
 
     def exit(self):
         __builtin__.testthread = None
+        for thread in threading.enumerate():
+            if thread.isAlive():
+                try:
+                    thread._Thread__stop()
+                except:
+                    print(str(thread.getName()) + ' could not be terminated' )
         sys.exit()
 
 def verifyOptions(options):
@@ -614,7 +640,7 @@
         main.classPath = "examples."+main.TEST+"."+main.TEST
     else :
         print "Test or Example not specified please specify the --test <test name > or --example <example name>"
-        self.exit()
+        main.exit()
 
 def verifyExample(options):
     if options.example:
@@ -806,21 +832,5 @@
         print sys.exc_info()[1]
         main.exit()
 
-def load_defaultlogger():
-    '''
-    It will load the default parser which is xml parser to parse the params and topology file.
-    '''
-    moduleList = main.loggerPath.split("/")
-    newModule = ".".join([moduleList[len(moduleList) - 2],moduleList[len(moduleList) - 1]])
-    try :
-        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()
-
 def _echo(self):
     print "THIS IS ECHO"
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 57d8c9b..bdc9307 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -18,12 +18,8 @@
 You should have received a copy of the GNU General Public License
 along with TestON.  If not, see <http://www.gnu.org/licenses/>.
 
-
 MininetCliDriver is the basic driver which will handle the Mininet functions
 
-Some functions rely on STS module. To install this,
-    git clone https://github.com/jhall11/sts.git
-
 Some functions rely on a modified version of Mininet. These functions
 should all be noted in the comments. To get this MN version run these commands
 from within your Mininet folder:
@@ -38,6 +34,7 @@
 import pexpect
 import re
 import sys
+import types
 sys.path.append( "../" )
 from math import pow
 from drivers.common.cli.emulatordriver import Emulator
@@ -95,12 +92,20 @@
             main.cleanup()
             main.exit()
 
-    def startNet( self, topoFile='', args='', timeout=120 ):
+    def startNet( self, topoFile='', args='', mnCmd='', timeout=120 ):
         """
-        Starts Mininet accepts a topology(.py) file and/or an optional
-        argument ,to start the mininet, as a parameter.
-        Returns main.TRUE if the mininet starts successfully and
-                main.FALSE otherwise
+        Description:
+            Starts Mininet accepts a topology(.py) file and/or an optional
+            argument, to start the mininet, as a parameter.
+            Can also send regular mininet command to load up desired topology.
+            Eg. Pass in a string 'sudo mn --topo=tree,3,3' to mnCmd
+        Options:
+            topoFile = file path for topology file (.py)
+            args = extra option added when starting the topology from the file
+            mnCmd = Mininet command use to start topology
+        Returns:
+                main.TRUE if the mininet starts successfully, main.FALSE
+                otherwise
         """
         if self.handle:
             # make sure old networks are cleaned up
@@ -130,26 +135,33 @@
                                 "Mininet took too long... " )
             # Craft the string to start mininet
             cmdString = "sudo "
-            if topoFile is None or topoFile == '':  # If no file is given
-                main.log.info( self.name + ": building fresh Mininet" )
-                cmdString += "mn "
-                if args is None or args == '':
-                    # If no args given, use args from .topo file
-                    args = self.options[ 'arg1' ] +\
-                                 " " + self.options[ 'arg2' ] +\
-                                 " --mac --controller " +\
-                                 self.options[ 'controller' ] + " " +\
-                                 self.options[ 'arg3' ]
-                else:  # else only use given args
-                    pass
-                    # TODO: allow use of topo args and method args?
-            else:  # Use given topology file
-                main.log.info( "Starting Mininet from topo file " + topoFile )
-                cmdString += topoFile + " "
-                if args is None:
-                    args = ''
-                    # TODO: allow use of args from .topo file?
-            cmdString += args
+            if not mnCmd:
+                if topoFile is None or topoFile == '':  # If no file is given
+                    main.log.info( self.name + ": building fresh Mininet" )
+                    cmdString += "mn "
+                    if args is None or args == '':
+                        # If no args given, use args from .topo file
+                        args = self.options[ 'arg1' ] +\
+                                " " + self.options[ 'arg2' ] +\
+                                " --mac --controller " +\
+                                self.options[ 'controller' ] + " " +\
+                                self.options[ 'arg3' ]
+                    else:  # else only use given args
+                        pass
+                        # TODO: allow use of topo args and method args?
+                else:  # Use given topology file
+                    main.log.info(
+                        "Starting Mininet from topo file " +
+                        topoFile )
+                    cmdString += topoFile + " "
+                    if args is None:
+                        args = ''
+                        # TODO: allow use of args from .topo file?
+                cmdString += args
+            else:
+                main.log.info( "Starting Mininet topology using '" + mnCmd +
+                               "' command" )
+                cmdString += mnCmd
             # Send the command and check if network started
             self.handle.sendline( "" )
             self.handle.expect( '\$' )
@@ -170,7 +182,7 @@
                                     self.handle.after )
                     self.handle.expect( '\$' )
                     response += str( self.handle.before +
-                                    self.handle.after )
+                                     self.handle.after )
                     main.log.error(
                         self.name +
                         ": Launching Mininet failed: " + response )
@@ -246,13 +258,13 @@
         topoDict = self.numSwitchesNlinks( *topoArgList )
         return topoDict
 
-    def pingall( self, timeout=300, shortCircuit=False, acceptableFailed=0):
+    def pingall( self, timeout=300, shortCircuit=False, acceptableFailed=0 ):
         """
            Verifies the reachability of the hosts using pingall command.
            Optional parameter timeout allows you to specify how long to
            wait for pingall to complete
            Optional:
-           timeout(seconds) - How long to wait before breaking the pingall
+           timeout( seconds ) - How long to wait before breaking the pingall
            shortCircuit - Break the pingall based on the number of failed hosts
                           ping
            acceptableFailed - Set the number of acceptable failed pings for the
@@ -274,12 +286,12 @@
                 self.handle.sendline( "pingall" )
                 startTime = time.time()
                 while True:
-                    i = self.handle.expect( [ "mininet>","X",
+                    i = self.handle.expect( [ "mininet>", "X",
                                               pexpect.EOF,
                                               pexpect.TIMEOUT ],
-                                              timeout )
+                                            timeout )
                     if i == 0:
-                        main.log.info( self.name + ": pingall finished")
+                        main.log.info( self.name + ": pingall finished" )
                         response += self.handle.before
                         break
                     elif i == 1:
@@ -369,23 +381,22 @@
 
     def pingallHosts( self, hostList, pingType='ipv4' ):
         """
-            Ping all specified hosts with a specific ping type 
-            
-            Acceptable pingTypes: 
-                - 'ipv4' 
+            Ping all specified hosts with a specific ping type
+
+            Acceptable pingTypes:
+                - 'ipv4'
                 - 'ipv6'
-        
+
             Acceptable hostList:
-                - ['h1','h2','h3','h4']
-                
-            Returns main.TRUE if all hosts specified can reach 
+                - [ 'h1','h2','h3','h4' ]
+
+            Returns main.TRUE if all hosts specified can reach
             each other
-            
+
             Returns main.FALSE if one or more of hosts specified
             cannot reach each other"""
-            
         if pingType == "ipv4":
-            cmd = " ping -c 1 -i 1 -W 8 " 
+            cmd = " ping -c 1 -i 1 -W 8 "
         elif pingType == "ipv6":
             cmd = " ping6 -c 1 -i 1 -W 8 "
         else:
@@ -394,30 +405,32 @@
 
         try:
             main.log.info( "Testing reachability between specified hosts" )
-           
+
             isReachable = main.TRUE
 
             for host in hostList:
-                listIndex = hostList.index(host)
+                listIndex = hostList.index( host )
                 # List of hosts to ping other than itself
-                pingList = hostList[:listIndex] + hostList[(listIndex+1):]
-                
+                pingList = hostList[ :listIndex ] + \
+                    hostList[ ( listIndex + 1 ): ]
+
                 for temp in pingList:
                     # Current host pings all other hosts specified
-                    pingCmd = str(host) + cmd + str(temp) 
+                    pingCmd = str( host ) + cmd + str( temp )
                     self.handle.sendline( pingCmd )
                     i = self.handle.expect( [ pingCmd, pexpect.TIMEOUT ] )
                     j = self.handle.expect( [ "mininet>", pexpect.TIMEOUT ] )
                     response = self.handle.before
                     if re.search( ',\s0\%\spacket\sloss', response ):
-                        main.log.info( str(host) + " -> " + str(temp) )
+                        main.log.info( str( host ) + " -> " + str( temp ) )
                     else:
-                        main.log.info( str(host) + " -> X ("+str(temp)+") "
-                                       " Destination Unreachable" ) 
+                        main.log.info(
+                            str( host ) + " -> X (" + str( temp ) + ") "
+                            " Destination Unreachable" )
                         # One of the host to host pair is unreachable
                         isReachable = main.FALSE
 
-            return isReachable 
+            return isReachable
 
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -533,19 +546,19 @@
            Note: The intf between host and oldSw when detached
                 using detach(), will still show up in the 'net'
                 cmd, because switch.detach() doesn't affect switch.intfs[]
-                (which is correct behavior since the interfaces 
-                haven't moved).
+                ( which is correct behavior since the interfaces
+                haven't moved ).
         """
         if self.handle:
             try:
                 # Bring link between oldSw-host down
-                cmd = "py net.configLinkStatus('" + oldSw + "'," + "'"+ host +\
+                cmd = "py net.configLinkStatus('" + oldSw + "'," + "'" + host +\
                       "'," + "'down')"
                 print "cmd1= ", cmd
                 response = self.execute( cmd=cmd,
                                          prompt="mininet>",
                                          timeout=10 )
-     
+
                 # Determine hostintf and Oldswitchintf
                 cmd = "px hintf,sintf = " + host + ".connectionsTo(" + oldSw +\
                       ")[0]"
@@ -563,7 +576,7 @@
                 print "cmd3= ", cmd
                 self.handle.sendline( cmd )
                 self.handle.expect( "mininet>" )
-                
+
                 # Detach interface between oldSw-host
                 cmd = "px " + oldSw + ".detach( sintf )"
                 print "cmd4= ", cmd
@@ -575,20 +588,20 @@
                 print "cmd5= ", cmd
                 self.handle.sendline( cmd )
                 self.handle.expect( "mininet>" )
- 
+
                 # Determine hostintf and Newswitchintf
                 cmd = "px hintf,sintf = " + host + ".connectionsTo(" + newSw +\
                       ")[0]"
                 print "cmd6= ", cmd
                 self.handle.sendline( cmd )
-                self.handle.expect( "mininet>" )                 
+                self.handle.expect( "mininet>" )
 
                 # Attach interface between newSw-host
                 cmd = "px " + newSw + ".attach( sintf )"
                 print "cmd3= ", cmd
                 self.handle.sendline( cmd )
                 self.handle.expect( "mininet>" )
-                
+
                 # Set ipaddress of the host-newSw interface
                 cmd = "px " + host + ".setIP( ip = ipaddr, intf = hintf)"
                 print "cmd7 = ", cmd
@@ -600,7 +613,7 @@
                 print "cmd8 = ", cmd
                 self.handle.sendline( cmd )
                 self.handle.expect( "mininet>" )
-                
+
                 cmd = "net"
                 print "cmd9 = ", cmd
                 self.handle.sendline( cmd )
@@ -613,7 +626,7 @@
                 self.handle.sendline( cmd )
                 self.handle.expect( "mininet>" )
                 print "ifconfig o/p = ", self.handle.before
-                
+
                 return main.TRUE
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
@@ -896,6 +909,18 @@
             main.exit()
         return response
 
+    def links( self ):
+        main.log.info( self.name + ": List network links" )
+        try:
+            response = self.execute( cmd='links', prompt='mininet>',
+                                     timeout=10 )
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        return response
+
     def iperf( self, host1, host2 ):
         main.log.info(
             self.name +
@@ -1058,7 +1083,7 @@
         return main.TRUE
 
     def getVersion( self ):
-        #FIXME: What uses this? This should be refactored to get
+        # FIXME: What uses this? This should be refactored to get
         #       version from MN and not some other file
         fileInput = path + '/lib/Mininet/INSTALL'
         version = super( Mininet, self ).getVersion()
@@ -1092,49 +1117,133 @@
             main.cleanup()
             main.exit()
 
-    def assignSwController( self, **kwargs ):
+    def assignSwController( self, sw, ip, port="6633", ptcp="" ):
         """
-           count is only needed if there is more than 1 controller"""
-        args = utilities.parse_args( [ "COUNT" ], **kwargs )
-        count = args[ "COUNT" ] if args != {} else 1
+        Description:
+            Assign switches to the controllers ( for ovs use only )
+        Required:
+            sw - Name of the switch. This can be a list or a string.
+            ip - Ip addresses of controllers. This can be a list or a string.
+        Optional:
+            port - ONOS use port 6633, if no list of ports is passed, then
+                   the all the controller will use 6633 as their port number
+            ptcp - ptcp number, This can be a string or a list that has
+                   the same length as switch. This is optional and not required
+                   when using ovs switches.
+        NOTE: If switches and ptcp are given in a list type they should have the
+              same length and should be in the same order, Eg. sw=[ 's1' ... n ]
+              ptcp=[ '6637' ... n ], s1 has ptcp number 6637 and so on.
 
-        argstring = "SW"
-        for j in range( count ):
-            argstring = argstring + ",IP" + \
-                str( j + 1 ) + ",PORT" + str( j + 1 )
-        args = utilities.parse_args( argstring.split( "," ), **kwargs )
-
-        sw = args[ "SW" ] if args[ "SW" ] is not None else ""
-        ptcpA = int( args[ "PORT1" ] ) + \
-            int( sw ) if args[ "PORT1" ] is not None else ""
-        ptcpB = "ptcp:" + str( ptcpA ) if ptcpA != "" else ""
-
-        command = "sh ovs-vsctl set-controller s" + \
-            str( sw ) + " " + ptcpB + " "
-        for j in range( count ):
-            i = j + 1
-            args = utilities.parse_args(
-                [ "IP" + str( i ), "PORT" + str( i ) ], **kwargs )
-            ip = args[
-                "IP" +
-                str( i ) ] if args[
-                "IP" +
-                str( i ) ] is not None else ""
-            port = args[
-                "PORT" +
-                str( i ) ] if args[
-                "PORT" +
-                str( i ) ] is not None else ""
-            tcp = "tcp:" + str( ip ) + ":" + str( port ) + \
-                " " if ip != "" else ""
-            command = command + tcp
+        Return:
+            Returns main.TRUE if mininet correctly assigned switches to
+            controllers, otherwise it will return main.FALSE or an appropriate
+            exception(s)
+        """
+        assignResult = main.TRUE
+        # Initial ovs command
+        commandList = []
+        command = "sh ovs-vsctl set-controller "
+        onosIp = ""
         try:
-            self.execute( cmd=command, prompt="mininet>", timeout=5 )
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":     " + self.handle.before )
-            main.cleanup()
-            main.exit()
+            if isinstance( ip, types.StringType ):
+                onosIp = "tcp:" + str( ip ) + ":"
+                if isinstance( port, types.StringType ) or \
+                   isinstance( port, types.IntType ):
+                    onosIp += str( port )
+                elif isinstance( port, types.ListType ):
+                    main.log.error( self.name + ": Only one controller " +
+                                    "assigned and a list of ports has" +
+                                    " been passed" )
+                    return main.FALSE
+                else:
+                    main.log.error( self.name + ": Invalid controller port " +
+                                    "number. Please specify correct " +
+                                    "controller port" )
+                    return main.FALSE
+
+            elif isinstance( ip, types.ListType ):
+                if isinstance( port, types.StringType ) or \
+                   isinstance( port, types.IntType ):
+                    for ipAddress in ip:
+                        onosIp += "tcp:" + str( ipAddress ) + ":" + \
+                                  str( port ) + " "
+                elif isinstance( port, types.ListType ):
+                    if ( len( ip ) != len( port ) ):
+                        main.log.error( self.name + ": Port list = " +
+                                        str( len( port ) ) +
+                                        "should be the same as controller" +
+                                        " ip list = " + str( len( ip ) ) )
+                        return main.FALSE
+                    else:
+                        onosIp = ""
+                        for ipAddress, portNum in zip( ip, port ):
+                            onosIp += "tcp:" + str( ipAddress ) + ":" + \
+                                      str( portNum ) + " "
+                else:
+                    main.log.error( self.name + ": Invalid controller port " +
+                                    "number. Please specify correct " +
+                                    "controller port" )
+                    return main.FALSE
+            else:
+                main.log.error( self.name + ": Invalid ip address" )
+                return main.FALSE
+
+            if isinstance( sw, types.StringType ):
+                command += sw + " "
+                if ptcp:
+                    if isinstance( ptcp, types.StringType ):
+                        command += "ptcp:" + str( ptcp ) + " "
+                    elif isinstance( ptcp, types.ListType ):
+                        main.log.error( self.name + ": Only one switch is " +
+                                        "being set and multiple PTCP is " +
+                                        "being passed " )
+                    else:
+                        main.log.error( self.name + ": Invalid PTCP" )
+                        ptcp = ""
+                command += onosIp
+                commandList.append( command )
+
+            elif isinstance( sw, types.ListType ):
+                if ptcp:
+                    if isinstance( ptcp, types.ListType ):
+                        if len( ptcp ) != len( sw ):
+                            main.log.error( self.name + ": PTCP length = " +
+                                            str( len( ptcp ) ) +
+                                            " is not the same as switch" +
+                                            " length = " +
+                                            str( len( sw ) ) )
+                            return main.FALSE
+                        else:
+                            for switch, ptcpNum in zip( sw, ptcp ):
+                                tempCmd = "sh ovs-vsctl set-controller "
+                                tempCmd += switch + " ptcp:" + \
+                                    str( ptcpNum ) + " "
+                                tempCmd += onosIp
+                                commandList.append( tempCmd )
+                    else:
+                        main.log.error( self.name + ": Invalid PTCP" )
+                        return main.FALSE
+                else:
+                    for switch in sw:
+                        tempCmd = "sh ovs-vsctl set-controller "
+                        tempCmd += switch + " " + onosIp
+                        commandList.append( tempCmd )
+            else:
+                main.log.error( self.name + ": Invalid switch type " )
+                return main.FALSE
+
+            for cmd in commandList:
+                try:
+                    self.execute( cmd=cmd, prompt="mininet>", timeout=5 )
+                except pexpect.TIMEOUT:
+                    main.log.error( self.name + ": pexpect.TIMEOUT found" )
+                    return main.FALSE
+                except pexpect.EOF:
+                    main.log.error( self.name + ": EOF exception found" )
+                    main.log.error( self.name + ":     " + self.handle.before )
+                    main.cleanup()
+                    main.exit()
+            return main.TRUE
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
@@ -1365,9 +1474,9 @@
         Called at the end of the test to stop the mininet and
         disconnect the handle.
         """
-        self.handle.sendline('')
+        self.handle.sendline( '' )
         i = self.handle.expect( [ 'mininet>', pexpect.EOF, pexpect.TIMEOUT ],
-                                timeout=2)
+                                timeout=2 )
         response = main.TRUE
         if i == 0:
             response = self.stopNet()
@@ -1382,7 +1491,7 @@
             main.log.error( "Connection failed to the host" )
         return response
 
-    def stopNet( self, fileName = "", timeout=5):
+    def stopNet( self, fileName="", timeout=5 ):
         """
         Stops mininet.
         Returns main.TRUE if the mininet successfully stops and
@@ -1390,12 +1499,11 @@
 
         Will cleanup and exit the test if mininet fails to stop
         """
-
         main.log.info( self.name + ": Stopping mininet..." )
         response = ''
         if self.handle:
             try:
-                self.handle.sendline("")
+                self.handle.sendline( "" )
                 i = self.handle.expect( [ 'mininet>',
                                           '\$',
                                           pexpect.EOF,
@@ -1403,15 +1511,14 @@
                                         timeout )
                 if i == 0:
                     main.log.info( "Exiting mininet..." )
-               
                 response = self.execute(
                     cmd="exit",
                     prompt="(.*)",
                     timeout=120 )
-                main.log.info( self.name + ": Stopped")
+                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" )
@@ -1420,11 +1527,14 @@
                 elif i == 3:  # timeout
                     main.log.error( "Something went wrong exiting mininet " +
                                     "TIMEOUT" )
-                
+
                 if fileName:
-                    self.handle.sendline("")
-                    self.handle.expect('\$')
-                    self.handle.sendline("sudo kill -9 \`ps -ef | grep \""+ fileName +"\" | grep -v grep | awk '{print $2}'\`")
+                    self.handle.sendline( "" )
+                    self.handle.expect( '\$' )
+                    self.handle.sendline(
+                        "sudo kill -9 \`ps -ef | grep \"" +
+                        fileName +
+                        "\" | grep -v grep | awk '{print $2}'\`" )
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
@@ -1447,7 +1557,7 @@
         """
         if ethDevice:
             ethDevice = '-I ' + ethDevice + ' '
-        cmd = " py " + host  + ".cmd(\"arping -c 1 " + ethDevice + ip + "\")"
+        cmd = " py " + host + ".cmd(\"arping -c 1 " + ethDevice + ip + "\")"
         try:
             main.log.warn( "Sending: " + cmd )
             self.handle.sendline( cmd )
@@ -1584,46 +1694,191 @@
             main.cleanup()
             main.exit()
 
-    def compareSwitches( self, topo, switchesJson ):
+    def getPorts( self, nodeName, verbose=False ):
+        """
+        Read ports from a Mininet switch.
+
+        Returns a json structure containing information about the
+        ports of the given switch.
+        """
+        response = self.getInterfaces( nodeName )
+        # TODO: Sanity check on response. log if no such switch exists
+        ports = []
+        for line in response.split( "\n" ):
+            if not line.startswith( "name=" ):
+                continue
+            portVars = {}
+            for var in line.split( "," ):
+                key, value = var.split( "=" )
+                portVars[ key ] = value
+            isUp = portVars.pop( 'enabled', "True" )
+            isUp = "True" in isUp
+            if verbose:
+                main.log.info( "Reading switch port %s(%s)" %
+                               ( portVars[ 'name' ], portVars[ 'mac' ] ) )
+            mac = portVars[ 'mac' ]
+            if mac == 'None':
+                mac = None
+            ips = []
+            ip = portVars[ 'ip' ]
+            if ip == 'None':
+                ip = None
+            ips.append( ip )
+            name = portVars[ 'name' ]
+            if name == 'None':
+                name = None
+            portRe = r'[^\-]\d\-eth(?P<port>\d+)'
+            if name == 'lo':
+                portNo = 0xfffe  # TODO: 1.0 value - Should we just return lo?
+            else:
+                portNo = re.search( portRe, name ).group( 'port' )
+            ports.append( { 'of_port': portNo,
+                            'mac': str( mac ).replace( '\'', '' ),
+                            'name': name,
+                            'ips': ips,
+                            'enabled': isUp } )
+        return ports
+
+    def getSwitches( self, verbose=False ):
+        """
+        Read switches from Mininet.
+
+        Returns a dictionary whose keys are the switch names and the value is
+        a dictionary containing information about the switch.
+        """
+        # FIXME: This currently only works with OVS Switches
+
+        # Regex patterns to parse dump output
+        # Example Switch:
+        # <OVSSwitch s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None,s1-eth3:None pid=5238>
+        # <OVSSwitch{ 'protocols': 'OpenFlow10' } s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None pid=25974>
+        swRE = r"<OVSSwitch(\{.*\})?\s(?P<name>[^:]+)\:\s" +\
+               "(?P<ports>([^,]+,)*[^,\s]+)"
+        # Update mn port info
+        self.update()
+        output = {}
+        dump = self.dump().split( "\n" )
+        for line in dump:
+            if line.startswith( "<OVSSwitch" ):
+                result = re.search( swRE, line, re.I )
+                name = result.group( 'name' )
+                dpid = str( self.getSwitchDPID( name ) ).zfill( 16 )
+                if verbose:
+                    main.log.info( "Reading switch %s(%s)" % ( name, dpid ) )
+                ports = self.getPorts( name )
+                output[ name ] = { "dpid": dpid, "ports": ports }
+        return output
+
+    def getHosts( self, verbose=False ):
+        """
+        Read hosts from Mininet.
+
+        Returns a dictionary whose keys are the host names and the value is
+        a dictionary containing information about the host.
+        """
+        # Regex patterns to parse dump output
+        # Example host: <Host h1: h1-eth0:10.0.0.1 pid=5227>
+        #            or <Host h1:  pid=12725>
+        # NOTE: Does not correctly match hosts with multi-links
+        #       <Host h2: h2-eth0:10.0.0.2,h2-eth1:10.0.1.2 pid=14386>
+        # FIXME: Fix that
+        hostRE = r"<Host\s(?P<name>[^:]+)\:((\s(?P<ifname>[^:]+)\:" +\
+            "(?P<ip>[^\s]+))|(\s)\spid=(?P<pid>[^>]+))"
+        # update mn port info
+        self.update()
+        # Get mininet dump
+        dump = self.dump().split( "\n" )
+        hosts = {}
+        for line in dump:
+            if line.startswith( "<Host" ):
+                result = re.search( hostRE, line )
+                name = result.group( 'name' )
+                interfaces = []
+                response = self.getInterfaces( name )
+                # Populate interface info
+                for line in response.split( "\n" ):
+                    if line.startswith( "name=" ):
+                        portVars = {}
+                        for var in line.split( "," ):
+                            key, value = var.split( "=" )
+                            portVars[ key ] = value
+                        isUp = portVars.pop( 'enabled', "True" )
+                        isUp = "True" in isUp
+                        if verbose:
+                            main.log.info( "Reading host port %s(%s)" %
+                                           ( portVars[ 'name' ],
+                                             portVars[ 'mac' ] ) )
+                        mac = portVars[ 'mac' ]
+                        if mac == 'None':
+                            mac = None
+                        ips = []
+                        ip = portVars[ 'ip' ]
+                        if ip == 'None':
+                            ip = None
+                        ips.append( ip )
+                        intfName = portVars[ 'name' ]
+                        if name == 'None':
+                            name = None
+                        interfaces.append( {
+                            "name": intfName,
+                            "ips": ips,
+                            "mac": str( mac ),
+                            "isUp": isUp } )
+                hosts[ name ] = { "interfaces": interfaces }
+        return hosts
+
+    def getLinks( self ):
+        """
+        Gathers information about current Mininet links. These links may not
+        be up if one of the ports is down.
+
+        Returns a list of dictionaries with link endpoints.
+
+        The dictionary structure is:
+            { 'node1': str( node1 name )
+              'node2': str( node2 name )
+              'port1': str( port1 of_port )
+              'port2': str( port2 of_port ) }
+        Note: The port number returned is the eth#, not necessarily the of_port
+              number. In Mininet, for OVS switch, these should be the same. For
+              hosts, this is just the eth#.
+        """
+        self.update()
+        response = self.links().split( '\n' )
+
+        # Examples:
+        # s1-eth3<->s2-eth1 (OK OK)
+        # s13-eth3<->h27-eth0 (OK OK)
+        linkRE = "(?P<node1>[\w]+)\-eth(?P<port1>[\d]+)\<\-\>" +\
+                 "(?P<node2>[\w]+)\-eth(?P<port2>[\d]+)"
+        links = []
+        for line in response:
+            match = re.search( linkRE, line )
+            if match:
+                node1 = match.group( 'node1' )
+                node2 = match.group( 'node2' )
+                port1 = match.group( 'port1' )
+                port2 = match.group( 'port2' )
+                links.append( { 'node1': node1,
+                                'node2': node2,
+                                'port1': port1,
+                                'port2': port2 } )
+        return links
+
+    def compareSwitches( self, switches, switchesJson, portsJson ):
         """
            Compare mn and onos switches
-           topo: sts TestONTopology object
-            switchesJson: parsed json object from the onos devices api
+           switchesJson: parsed json object from the onos devices api
 
-           This uses the sts TestONTopology object"""
-        # main.log.debug( "Switches_json string: ", switchesJson )
-        output = { "switches": [] }
-        # iterate through the MN topology and pull out switches and and port
-        # info
-        for switch in topo.graph.switches:
-            ports = []
-            for port in switch.ports.values():
-                ports.append( { 'of_port': port.port_no,
-                                'mac': str( port.hw_addr ).replace( '\'', '' ),
-                                'name': port.name } )
-            output[ 'switches' ].append( {
-                "name": switch.name,
-                "dpid": str( switch.dpid ).zfill( 16 ),
-                "ports": ports } )
-
-        # print "mn"
-        # print json.dumps( output,
-        #                   sort_keys=True,
-        #                   indent=4,
-        #                   separators=( ',', ': ' ) )
-        # print "onos"
-        # print json.dumps( switchesJson,
-        #                   sort_keys=True,
-        #                   indent=4,
-        #                   separators=( ',', ': ' ) )
-
+        Dependencies:
+            1. numpy - "sudo pip install numpy"
+        """
+        from numpy import uint64
         # created sorted list of dpid's in MN and ONOS for comparison
         mnDPIDs = []
-        for switch in output[ 'switches' ]:
+        for swName, switch in switches.iteritems():
             mnDPIDs.append( switch[ 'dpid' ].lower() )
         mnDPIDs.sort()
-        # print "List of Mininet switch DPID's"
-        # print mnDPIDs
         if switchesJson == "":  # if rest call fails
             main.log.error(
                 self.name +
@@ -1639,70 +1894,33 @@
                         '' ).replace(
                         "of",
                         '' ).lower() )
-            # else:
-                # print "Switch is unavailable:"
-                # print switch
         onosDPIDs.sort()
-        # print "List of ONOS switch DPID's"
-        # print onosDPIDs
 
         if mnDPIDs != onosDPIDs:
             switchResults = main.FALSE
-            main.log.report( "Switches in MN but not in ONOS:" )
+            main.log.error( "Switches in MN but not in ONOS:" )
             list1 = [ switch for switch in mnDPIDs if switch not in onosDPIDs ]
-            main.log.report( str( list1 ) )
-            main.log.report( "Switches in ONOS but not in MN:" )
+            main.log.error( str( list1 ) )
+            main.log.error( "Switches in ONOS but not in MN:" )
             list2 = [ switch for switch in onosDPIDs if switch not in mnDPIDs ]
-            main.log.report( str( list2 ) )
+            main.log.error( str( list2 ) )
         else:  # list of dpid's match in onos and mn
             switchResults = main.TRUE
-        return switchResults
+        finalResults = switchResults
 
-    def comparePorts( self, topo, portsJson ):
-        """
-        Compare mn and onos ports
-        topo: sts TestONTopology object
-        portsJson: parsed json object from the onos ports api
-
-        Dependencies:
-            1. This uses the sts TestONTopology object
-            2. numpy - "sudo pip install numpy"
-
-        """
         # FIXME: this does not look for extra ports in ONOS, only checks that
         # ONOS has what is in MN
-        from numpy import uint64
         portsResults = main.TRUE
-        output = { "switches": [] }
-        # iterate through the MN topology and pull out switches and and port
-        # info
-        for switch in topo.graph.switches:
-            ports = []
-            for port in switch.ports.values():
-                # print port.hw_addr.toStr( separator='' )
-                tmpPort = { 'of_port': port.port_no,
-                            'mac': str( port.hw_addr ).replace( '\'', '' ),
-                            'name': port.name,
-                            'enabled': port.enabled }
-
-                ports.append( tmpPort )
-            tmpSwitch = { 'name': switch.name,
-                          'dpid': str( switch.dpid ).zfill( 16 ),
-                          'ports': ports }
-
-            output[ 'switches' ].append( tmpSwitch )
 
         # PORTS
-        for mnSwitch in output[ 'switches' ]:
+        for name, mnSwitch in switches.iteritems():
             mnPorts = []
             onosPorts = []
             switchResult = main.TRUE
             for port in mnSwitch[ 'ports' ]:
                 if port[ 'enabled' ]:
-                    mnPorts.append( port[ 'of_port' ] )
+                    mnPorts.append( int( port[ 'of_port' ] ) )
             for onosSwitch in portsJson:
-                # print "Iterating through a new switch as seen by ONOS"
-                # print onosSwitch
                 if onosSwitch[ 'device' ][ 'available' ]:
                     if onosSwitch[ 'device' ][ 'id' ].replace(
                             ':',
@@ -1719,9 +1937,7 @@
                         break
             mnPorts.sort( key=float )
             onosPorts.sort( key=float )
-            # print "\nPorts for Switch %s:" % ( mnSwitch[ 'name' ] )
-            # print "\tmn_ports[] = ", mnPorts
-            # print "\tonos_ports[] = ", onosPorts
+
             mnPortsLog = mnPorts
             onosPortsLog = onosPorts
             mnPorts = [ x for x in mnPorts ]
@@ -1737,6 +1953,7 @@
                     # many checks and it might override a failure
                     mnPorts.remove( mnPort )
                     onosPorts.remove( mnPort )
+
                 # NOTE: OVS reports this as down since there is no link
                 #      So ignoring these for now
                 # TODO: Come up with a better way of handling these
@@ -1753,62 +1970,53 @@
                     "Ports in ONOS but not MN: " +
                     str( onosPorts ) )
             if switchResult == main.FALSE:
-                main.log.report(
+                main.log.error(
                     "The list of ports for switch %s(%s) does not match:" %
-                    ( mnSwitch[ 'name' ], mnSwitch[ 'dpid' ] ) )
+                    ( name, mnSwitch[ 'dpid' ] ) )
                 main.log.warn( "mn_ports[]  =  " + str( mnPortsLog ) )
                 main.log.warn( "onos_ports[] = " + str( onosPortsLog ) )
             portsResults = portsResults and switchResult
-        return portsResults
+        finalResults = finalResults and portsResults
+        return finalResults
 
-    def compareLinks( self, topo, linksJson ):
+    def compareLinks( self, switches, links, linksJson ):
         """
            Compare mn and onos links
-           topo: sts TestONTopology object
            linksJson: parsed json object from the onos links api
 
-           This uses the sts TestONTopology object"""
+        """
         # FIXME: this does not look for extra links in ONOS, only checks that
         #        ONOS has what is in MN
-        output = { "switches": [] }
         onos = linksJson
-        # iterate through the MN topology and pull out switches and and port
-        # info
-        for switch in topo.graph.switches:
-            # print "Iterating though switches as seen by Mininet"
-            # print switch
-            ports = []
-            for port in switch.ports.values():
-                # print port.hw_addr.toStr( separator='' )
-                ports.append( { 'of_port': port.port_no,
-                                'mac': str( port.hw_addr ).replace( '\'', '' ),
-                                'name': port.name } )
-            output[ 'switches' ].append( {
-                "name": switch.name,
-                "dpid": str( switch.dpid ).zfill( 16 ),
-                "ports": ports } )
-        # LINKS
 
-        mnLinks = [
-            link for link in topo.patch_panel.network_links if (
-                link.port1.enabled and link.port2.enabled ) ]
+        mnLinks = []
+        for l in links:
+            try:
+                node1 = switches[ l[ 'node1' ] ]
+                node2 = switches[ l[ 'node2' ] ]
+                enabled = True
+                for port in node1[ 'ports' ]:
+                    if port[ 'of_port' ] == l[ 'port1' ]:
+                        enabled = enabled and port[ 'enabled' ]
+                for port in node2[ 'ports' ]:
+                    if port[ 'of_port' ] == l[ 'port2' ]:
+                        enabled = enabled and port[ 'enabled' ]
+                if enabled:
+                    mnLinks.append( l )
+            except KeyError:
+                pass
         if 2 * len( mnLinks ) == len( onos ):
             linkResults = main.TRUE
         else:
             linkResults = main.FALSE
-            main.log.report(
+            main.log.error(
                 "Mininet has " + str( len( mnLinks ) ) +
                 " bidirectional links and ONOS has " +
                 str( len( onos ) ) + " unidirectional links" )
 
         # iterate through MN links and check if an ONOS link exists in
         # both directions
-        # NOTE: Will currently only show mn links as down if they are
-        #       cut through STS. We can either do everything through STS or
-        #       wait for upNetworkLinks and downNetworkLinks to be
-        #       fully implemented.
         for link in mnLinks:
-            # print "Link: %s" % link
             # TODO: Find a more efficient search method
             node1 = None
             port1 = None
@@ -1816,34 +2024,27 @@
             port2 = None
             firstDir = main.FALSE
             secondDir = main.FALSE
-            for switch in output[ 'switches' ]:
-                # print "Switch: %s" % switch[ 'name' ]
-                if switch[ 'name' ] == link.node1.name:
+            for swName, switch in switches.iteritems():
+                if swName == link[ 'node1' ]:
                     node1 = switch[ 'dpid' ]
                     for port in switch[ 'ports' ]:
-                        if str( port[ 'name' ] ) == str( link.port1 ):
+                        if str( port[ 'of_port' ] ) == str( link[ 'port1' ] ):
                             port1 = port[ 'of_port' ]
                     if node1 is not None and node2 is not None:
                         break
-                if switch[ 'name' ] == link.node2.name:
+                if swName == link[ 'node2' ]:
                     node2 = switch[ 'dpid' ]
                     for port in switch[ 'ports' ]:
-                        if str( port[ 'name' ] ) == str( link.port2 ):
+                        if str( port[ 'of_port' ] ) == str( link[ 'port2' ] ):
                             port2 = port[ 'of_port' ]
                     if node1 is not None and node2 is not None:
                         break
 
             for onosLink in onos:
                 onosNode1 = onosLink[ 'src' ][ 'device' ].replace(
-                    ":",
-                    '' ).replace(
-                    "of",
-                    '' )
+                    ":", '' ).replace( "of", '' )
                 onosNode2 = onosLink[ 'dst' ][ 'device' ].replace(
-                    ":",
-                    '' ).replace(
-                    "of",
-                    '' )
+                    ":", '' ).replace( "of", '' )
                 onosPort1 = onosLink[ 'src' ][ 'port' ]
                 onosPort2 = onosLink[ 'dst' ][ 'port' ]
 
@@ -1859,15 +2060,9 @@
                             str( link ) +
                             ' between ONOS and MN. When checking ONOS for ' +
                             'link %s/%s -> %s/%s' %
-                            ( node1,
-                              port1,
-                              node2,
-                              port2 ) +
+                            ( node1, port1, node2, port2 ) +
                             ' ONOS has the values %s/%s -> %s/%s' %
-                            ( onosNode1,
-                              onosPort1,
-                              onosNode2,
-                              onosPort2 ) )
+                            ( onosNode1, onosPort1, onosNode2, onosPort2 ) )
 
                 # check onos link from node2 to node1
                 elif ( str( onosNode1 ) == str( node2 ) and
@@ -1881,73 +2076,59 @@
                             str( link ) +
                             ' between ONOS and MN. When checking ONOS for ' +
                             'link %s/%s -> %s/%s' %
-                            ( node2,
-                              port2,
-                              node1,
-                              port1 ) +
+                            ( node1, port1, node2, port2 ) +
                             ' ONOS has the values %s/%s -> %s/%s' %
-                            ( onosNode2,
-                              onosPort2,
-                              onosNode1,
-                              onosPort1 ) )
+                            ( onosNode2, onosPort2, onosNode1, onosPort1 ) )
                 else:  # this is not the link you're looking for
                     pass
             if not firstDir:
-                main.log.report(
+                main.log.error(
                     'ONOS does not have the link %s/%s -> %s/%s' %
                     ( node1, port1, node2, port2 ) )
             if not secondDir:
-                main.log.report(
+                main.log.error(
                     'ONOS does not have the link %s/%s -> %s/%s' %
                     ( node2, port2, node1, port1 ) )
             linkResults = linkResults and firstDir and secondDir
         return linkResults
 
-    def compareHosts( self, topo, hostsJson ):
+    def compareHosts( self, hosts, hostsJson ):
         """
-           Compare mn and onos Hosts.
-           Since Mininet hosts are quiet, ONOS will only know of them when they
-           speak. For this reason, we will only check that the hosts in ONOS
-           stores are in Mininet, and not vice versa.
-           topo: sts TestONTopology object
-           hostsJson: parsed json object from the onos hosts api
+        Compare mn and onos Hosts.
+        Since Mininet hosts are quiet, ONOS will only know of them when they
+        speak. For this reason, we will only check that the hosts in ONOS
+        stores are in Mininet, and not vice versa.
 
-           This uses the sts TestONTopology object"""
+        Arguments:
+            hostsJson: parsed json object from the onos hosts api
+        Returns:
+        """
         import json
         hostResults = main.TRUE
-        hosts = []
-        # iterate through the MN topology and pull out hosts
-        for mnHost in topo.graph.hosts:
-            interfaces = []
-            for intf in mnHost.interfaces:
-                interfaces.append( {
-                    "name": intf.name,  # str
-                    "ips": [ str( ip ) for ip in intf.ips ],  # list of IPAddrs
-                    # hw_addr is of type EthAddr, Not JSON serializable
-                    "hw_addr": str( intf.hw_addr ) } )
-            hosts.append( {
-                "name": mnHost.name,  # str
-                "interfaces": interfaces  } )  # list
         for onosHost in hostsJson:
             onosMAC = onosHost[ 'mac' ].lower()
             match = False
-            for mnHost in hosts:
-                for mnIntf in mnHost[ 'interfaces' ]:
-                    if onosMAC == mnIntf[ 'hw_addr' ].lower() :
+            for mnHost, info in hosts.iteritems():
+                for mnIntf in info[ 'interfaces' ]:
+                    if onosMAC == mnIntf[ 'mac' ].lower():
                         match = True
                         for ip in mnIntf[ 'ips' ]:
                             if ip in onosHost[ 'ipAddresses' ]:
                                 pass  # all is well
                             else:
                                 # misssing ip
-                                main.log.error( "ONOS host " + onosHost[ 'id' ]
-                                                + " has a different IP than " +
-                                                "the Mininet host." )
+                                main.log.error( "ONOS host " +
+                                                onosHost[ 'id' ] +
+                                                " has a different IP(" +
+                                                str( onosHost[ 'ipAddresses' ] ) +
+                                                ") than the Mininet host(" +
+                                                str( ip ) +
+                                                ")." )
                                 output = json.dumps(
-                                                    onosHost,
-                                                    sort_keys=True,
-                                                    indent=4,
-                                                    separators=( ',', ': ' ) )
+                                    onosHost,
+                                    sort_keys=True,
+                                    indent=4,
+                                    separators=( ',', ': ' ) )
                                 main.log.info( output )
                                 hostResults = main.FALSE
             if not match:
@@ -1961,7 +2142,7 @@
                 main.log.info( output )
         return hostResults
 
-    def getHosts( self ):
+    def getHostsOld( self ):
         """
            Returns a list of all hosts
            Don't ask questions just use it"""
@@ -1986,6 +2167,47 @@
 
         return hostList
 
+    def getSwitch( self ):
+        """
+            Returns a list of all switches
+            Again, don't ask question just use it...
+        """
+        # get host list...
+        hostList = self.getHosts()
+        # Make host set
+        hostSet = set( hostList )
+
+        # Getting all the nodes in mininet
+        self.handle.sendline( "" )
+        self.handle.expect( "mininet>" )
+
+        self.handle.sendline( "py [ node.name for node in net.values() ]" )
+        self.handle.expect( "mininet>" )
+
+        handlePy = self.handle.before
+        handlePy = handlePy.split( "]\r\n", 1 )[ 1 ]
+        handlePy = handlePy.rstrip()
+
+        self.handle.sendline( "" )
+        self.handle.expect( "mininet>" )
+
+        nodesStr = handlePy.replace( "]", "" )
+        nodesStr = nodesStr.replace( "'", "" )
+        nodesStr = nodesStr.replace( "[", "" )
+        nodesStr = nodesStr.replace( " ", "" )
+        nodesList = nodesStr.split( "," )
+
+        nodesSet = set( nodesList )
+        # discarding default controller(s) node
+        nodesSet.discard( 'c0' )
+        nodesSet.discard( 'c1' )
+        nodesSet.discard( 'c2' )
+
+        switchSet = nodesSet - hostSet
+        switchList = list( switchSet )
+
+        return switchList
+
     def update( self ):
         """
            updates the port address and status information for
@@ -2010,6 +2232,60 @@
             main.cleanup()
             main.exit()
 
+    def assignVLAN( self, host, intf, vlan ):
+        """
+           Add vlan tag to a host.
+           Dependencies:
+               This class depends on the "vlan" package
+               $ sudo apt-get install vlan
+           Configuration:
+               Load the 8021q module into the kernel
+               $sudo modprobe 8021q
+
+               To make this setup permanent:
+               $ sudo su -c 'echo "8021q" >> /etc/modules'
+           """
+        if self.handle:
+            try:
+                # get the ip address of the host
+                main.log.info( "Get the ip address of the host" )
+                ipaddr = self.getIPAddress( host )
+                print repr( ipaddr )
+
+                # remove IP from interface intf
+                # Ex: h1 ifconfig h1-eth0 inet 0
+                main.log.info( "Remove IP from interface " )
+                cmd2 = host + " ifconfig " + intf + " " + " inet 0 "
+                self.handle.sendline( cmd2 )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( "====> %s ", response )
+
+                # create VLAN interface
+                # Ex: h1 vconfig add h1-eth0 100
+                main.log.info( "Create Vlan" )
+                cmd3 = host + " vconfig add " + intf + " " + vlan
+                self.handle.sendline( cmd3 )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( "====> %s ", response )
+
+                # assign the host's IP to the VLAN interface
+                # Ex: h1 ifconfig h1-eth0.100 inet 10.0.0.1
+                main.log.info( "Assign the host IP to the vlan interface" )
+                vintf = intf + "." + vlan
+                cmd4 = host + " ifconfig " + vintf + " " + " inet " + ipaddr
+                self.handle.sendline( cmd4 )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( "====> %s ", response )
+
+                return main.TRUE
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                return main.FALSE
+
 if __name__ != "__main__":
     import sys
     sys.modules[ __name__ ] = MininetCliDriver()
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 5da4a71..fca8f22 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1624,7 +1624,7 @@
             main.cleanup()
             main.exit()
 
-    def purgeIntents( self ):
+    def purgeWithdrawnIntents( self ):
         """
         Purges all WITHDRAWN Intents
         """
@@ -1762,39 +1762,60 @@
             main.cleanup()
             main.exit()
 
-    def checkIntentState( self, intentsId, expectedState = 'INSTALLED' ):
+    def checkIntentState( self, intentsId, expectedState='INSTALLED' ):
         """
         Description:
             Check intents state
         Required:
             intentsId - List of intents ID to be checked
         Optional:
-            expectedState - Check this expected state of each intents state
-                            in the list. Defaults to INSTALLED
+            expectedState - Check the expected state(s) of each intents
+                            state in the list.
+                            *NOTE: You can pass in a list of expected state,
+                            Eg: expectedState = [ 'INSTALLED' , 'INSTALLING' ]
         Return:
-            Returns main.TRUE only if all intent are the same as expectedState,
-            , otherwise,returns main.FALSE.
+            Returns main.TRUE only if all intent are the same as expected states
+            , otherwise, returns main.FALSE.
         """
         try:
             # Generating a dictionary: intent id as a key and state as value
+            returnValue = main.TRUE
             intentsDict = self.getIntentState( intentsId )
+
             #print "len of intentsDict ", str( len( intentsDict ) )
             if len( intentsId ) != len( intentsDict ):
                 main.log.info( self.name + "There is something wrong " +
                                "getting intents state" )
                 return main.FALSE
-            returnValue = main.TRUE
-            for intents in intentsDict:
-                if intents.get( 'state' ) != expectedState:
-                    main.log.info( self.name + " : " + intents.get( 'id' ) +
-                                   " actual state = " + intents.get( 'state' )
-                                   + " does not equal expected state = "
-                                   + expectedState )
-                    returnValue = main.FALSE
+
+            if isinstance( expectedState, types.StringType ):
+                for intents in intentsDict:
+                    if intents.get( 'state' ) != expectedState:
+                        main.log.debug( self.name + " : Intent ID - " +
+                                        intents.get( 'id' ) +
+                                        " actual state = " +
+                                        intents.get( 'state' )
+                                        + " does not equal expected state = "
+                                        + expectedState )
+                        returnValue = main.FALSE
+
+            elif isinstance( expectedState, types.ListType ):
+                for intents in intentsDict:
+                    if not any( state == intents.get( 'state' ) for state in
+                                expectedState ):
+                        main.log.debug( self.name + " : Intent ID - " +
+                                        intents.get( 'id' ) +
+                                        " actual state = " +
+                                        intents.get( 'state' ) +
+                                        " does not equal expected states = "
+                                        + str( expectedState ) )
+                        returnValue = main.FALSE
+
             if returnValue == main.TRUE:
                 main.log.info( self.name + ": All " +
                                str( len( intentsDict ) ) +
-                               " intents are in " + expectedState + " state")
+                               " intents are in " + str( expectedState ) +
+                               " state" )
             return returnValue
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
@@ -1822,7 +1843,7 @@
                 cmdStr += " -j"
             handle = self.sendline( cmdStr )
             if re.search( "Error:", handle ):
-                main.log.error( self.name + ".flows() response: " +
+                main.log.error( self.name + ": flows() response: " +
                                 str( handle ) )
             return handle
         except TypeError:
@@ -1857,9 +1878,11 @@
                 for flow in device.get( 'flows' ):
                     if flow.get( 'state' ) != 'ADDED' and flow.get( 'state' ) != \
                             'PENDING_ADD':
+
                         main.log.info( self.name + ": flow Id: " +
-                                       flow.get( 'groupId' ) +
-                                       " | state:" + flow.get( 'state' ) )
+                                       str( flow.get( 'groupId' ) ) +
+                                       " | state:" +
+                                       str( flow.get( 'state' ) ) )
                         returnValue = main.FALSE
 
             return returnValue
@@ -3576,3 +3599,36 @@
             main.cleanup()
             main.exit()
 
+    def summary( self, jsonFormat=True ):
+        """
+        Description: Execute summary command in onos
+        Returns: json object ( summary -j ), returns main.FALSE if there is
+        no output
+
+        """
+        try:
+            cmdStr = "summary"
+            if jsonFormat:
+                cmdStr += " -j"
+            handle = self.sendline( cmdStr )
+
+            if re.search( "Error:", handle ):
+                main.log.error( self.name + ": summary() response: " +
+                                str( handle ) )
+            if not handle:
+                main.log.error( self.name + ": There is no output in " +
+                                "summary command" )
+                return main.FALSE
+            return handle
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 7abbcc6..5de8e2e 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -2258,3 +2258,46 @@
         if len(exceptions) > 0: 
             main.log.info(msg3)
         main.log.info("===============================================================\n")
+
+    def getOnosIPfromCell(self):
+        '''
+            Returns the ONOS node names and their IP addresses as defined in the cell and applied to shell environment
+			Example output return: [['OC1', '10.128.40.41'], ['OC2', '10.128.40.42'], ['OC3', '10.128.40.43']]
+        ''' 
+        import re
+        try:
+            # Clean handle by sending empty and expecting $
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            self.handle.sendline( "cell" )
+            self.handle.expect( "\$" )
+            handleBefore = self.handle.before
+            handleAfter = self.handle.after
+            # Get the rest of the handle
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            handleMore = self.handle.before
+            ipList = []
+            cellOutput = handleBefore + handleAfter + handleMore
+            cellOutput = cellOutput.replace("\r\r","")
+            cellOutput = cellOutput.splitlines()
+            for i in range( len(cellOutput) ):
+                if( re.match( "OC", cellOutput[i] ) ):
+                    if( re.match( "OCI", cellOutput[i] ) or re.match( "OCN", cellOutput[i] ) ):
+                        continue
+                    else:
+                        onosIP = cellOutput[i].split("=")
+						# below step could be changed to return only IP if node name is not needed.
+                        ipList.append(onosIP)
+            return ipList
+        except pexpect.ExceptionPexpect as e:
+            main.log.error( self.name + ": Pexpect exception found of type " +
+                            str( type( e ) ) )
+            main.log.error ( e.get_trace() )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 3b94ef7..f75df5f 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -80,7 +80,7 @@
         i = 5
         while i == 5:
             i = self.handle.expect( [
-				    ssh_newkey,
+                                    ssh_newkey,
                                     'password:|Password:',
                                     pexpect.EOF,
                                     pexpect.TIMEOUT,
@@ -88,11 +88,11 @@
                                     'teston>',
                                     '>|#|\$' ],
                 		    120 )
-            if i == 0:
+            if i == 0:  # Accept key, then expect either a password prompt or access
                 main.log.info( "ssh key confirmation received, send yes" )
                 self.handle.sendline( 'yes' )
-                i = self.handle.expect(
-                    [ ssh_newkey, 'password:', pexpect.EOF ] )
+                i = 5  # Run the loop again
+                continue 
             if i == 1:
                 if self.pwd:
                     main.log.info(
diff --git a/TestON/tests/ClassTest/ClassTest.params b/TestON/tests/ClassTest/ClassTest.params
deleted file mode 100644
index 456881b..0000000
--- a/TestON/tests/ClassTest/ClassTest.params
+++ /dev/null
@@ -1,4 +0,0 @@
-<PARAMS>
-    <testcases>1,2</testcases>
-
-</PARAMS>
diff --git a/TestON/tests/ClassTest/ClassTest.py b/TestON/tests/ClassTest/ClassTest.py
deleted file mode 100644
index 0fd8ccc..0000000
--- a/TestON/tests/ClassTest/ClassTest.py
+++ /dev/null
@@ -1,27 +0,0 @@
-
-import time
-import os
-import re
-
-
-class ClassTest:
-
-    def __init__( self ):
-        self.default = ''
-
-    def CASE1( self, main ):
-        import time
-        import imp
-
-        init = imp.load_source(
-            'ClassInit',
-            '/home/admin/ONLabTest/TestON/tests/ClassTest/Dependency/ClassInit.py' )
-
-        ip1_from_class = init.getIp1()
-        init.printMain( main )
-
-        main.log.info( ip1_from_class )
-
-    def CASE2( self, main ):
-
-        main.log.info( "Case 2" )
diff --git a/TestON/tests/ClassTest/ClassTest.topo b/TestON/tests/ClassTest/ClassTest.topo
deleted file mode 100644
index 1c8bc4f..0000000
--- a/TestON/tests/ClassTest/ClassTest.topo
+++ /dev/null
@@ -1,26 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-        <ONOSbench>
-            <host>10.128.10.20</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOSbench>
-        
-        <Mininet1>
-            <host>10.128.10.24</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-                <arg1> --custom topo-perf-2sw.py </arg1>
-                <arg2> --arp --mac --topo mytopo </arg2>
-                <arg3> </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/ClassTest/Dependency/ClassInit.py b/TestON/tests/ClassTest/Dependency/ClassInit.py
deleted file mode 100644
index 74ff627..0000000
--- a/TestON/tests/ClassTest/Dependency/ClassInit.py
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-def __init__(self):
-    self._ip1 = '1'
-    self._ip2 = '2'
-
-def getIp1():
-    print 'some ip' 
-
-def printMain(main):
-    print main.log.info("Main from classinit") 
diff --git a/TestON/tests/ClassTest/Dependency/__init__.py b/TestON/tests/ClassTest/Dependency/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/ClassTest/Dependency/__init__.py
+++ /dev/null
diff --git a/TestON/tests/ClassTest/Dependencyc b/TestON/tests/ClassTest/Dependencyc
deleted file mode 100644
index bafe4c9..0000000
--- a/TestON/tests/ClassTest/Dependencyc
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/ClassTest/__init__.py b/TestON/tests/ClassTest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/ClassTest/__init__.py
+++ /dev/null
diff --git a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
index 3f41180..b8598e4 100644
--- a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
@@ -10,6 +10,7 @@
                 name,
                 host1,
                 host2,
+                onosNode=0,
                 host1Id="",
                 host2Id="",
                 mac1="",
@@ -80,6 +81,7 @@
     topoResult = main.TRUE
     linkDownResult = main.TRUE
     linkUpResult = main.TRUE
+    onosNode = int( onosNode )
 
     if main.hostsData:
         if not h1Mac:
@@ -101,15 +103,29 @@
         return main.FALSE
 
     # Discover hosts using arping
-    main.log.info( itemName + ": Discover host using arping" )
-    main.Mininet1.arping( host=host1 )
-    main.Mininet1.arping( host=host2 )
-    host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
-    host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
+    if not main.hostsData:
+        main.log.info( itemName + ": Discover host using arping" )
+        main.Mininet1.arping( host=host1 )
+        main.Mininet1.arping( host=host2 )
+        host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
+        host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
+
+    # Check flows count in each node
+    checkFlowsCount( main )
+
+    # Checking connectivity before installing intents
+    main.log.info( itemName + ": Check hosts connection before adding intents" )
+    checkPing = pingallHosts( main, hostNames )
+    if not checkPing:
+        main.log.info( itemName + ": Ping did not go through " +
+                       "before adding intents" )
+    else:
+        main.log.debug( itemName + ": Pinged successful before adding " +
+                        "intents,please check fwd app if it is activated" )
 
     # Adding host intents
     main.log.info( itemName + ": Adding host intents" )
-    intent1 = main.CLIs[ 0 ].addHostIntent( hostIdOne=h1Id,
+    intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=h1Id,
                                            hostIdTwo=h2Id )
     intentsId.append( intent1 )
     time.sleep( 5 )
@@ -117,11 +133,14 @@
     # Check intents state
     time.sleep( 30 )
     intentResult = checkIntentState( main, intentsId )
+    checkFlowsCount( main )
 
     # Check intents state again if first check fails...
     if not intentResult:
         intentResult = checkIntentState( main, intentsId )
 
+    # Check flows count in each node
+    checkFlowsCount( main )
     # Verify flows
     checkFlowsState( main )
 
@@ -141,6 +160,8 @@
         linkDownResult = link( main, sw1, sw2, "down" )
         intentResult = intentResult and checkIntentState( main, intentsId )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -162,6 +183,8 @@
         linkUpResult = link( main, sw1, sw2, "up" )
         time.sleep( 5 )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -191,6 +214,7 @@
                  name,
                  host1,
                  host2,
+                 onosNode=0,
                  deviceId1="",
                  deviceId2="",
                  port1="",
@@ -275,10 +299,21 @@
     topoResult = main.TRUE
     linkDownResult = main.TRUE
     linkUpResult = main.TRUE
+    onosNode = int( onosNode )
+
+    # Checking connectivity before installing intents
+    main.log.info( itemName + ": Check hosts connection before adding intents" )
+    checkPing = pingallHosts( main, hostNames )
+    if not checkPing:
+        main.log.info( itemName + ": Ping did not go through " +
+                       "before adding intents" )
+    else:
+        main.log.debug( itemName + ": Pinged successful before adding " +
+                        "intents,please check fwd app if it is activated" )
 
     # Adding bidirectional point  intents
     main.log.info( itemName + ": Adding point intents" )
-    intent1 = main.CLIs[ 0 ].addPointIntent( ingressDevice=deviceId1,
+    intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
                                              egressDevice=deviceId2,
                                              portIngress=port1,
                                              portEgress=port2,
@@ -295,7 +330,7 @@
 
     intentsId.append( intent1 )
     time.sleep( 5 )
-    intent2 = main.CLIs[ 0 ].addPointIntent( ingressDevice=deviceId2,
+    intent2 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
                                              egressDevice=deviceId1,
                                              portIngress=port2,
                                              portEgress=port1,
@@ -314,11 +349,15 @@
     # Check intents state
     time.sleep( 30 )
     intentResult = checkIntentState( main, intentsId )
+    # Check flows count in each node
+    checkFlowsCount( main )
 
     # Check intents state again if first check fails...
     if not intentResult:
         intentResult = checkIntentState( main, intentsId )
 
+    # Check flows count in each node
+    checkFlowsCount( main )
     # Verify flows
     checkFlowsState( main )
 
@@ -338,6 +377,8 @@
         linkDownResult = link( main, sw1, sw2, "down" )
         intentResult = intentResult and checkIntentState( main, intentsId )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -359,6 +400,8 @@
         linkUpResult = link( main, sw1, sw2, "up" )
         time.sleep( 5 )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -387,6 +430,7 @@
 def singleToMultiIntent( main,
                          name,
                          hostNames,
+                         onosNode=0,
                          devices="",
                          ports=None,
                          ethType="",
@@ -461,6 +505,7 @@
     itemName = name
     tempHostsData = {}
     intentsId = []
+    onosNode = int( onosNode )
 
     macsDict = {}
     ipDict = {}
@@ -477,10 +522,12 @@
                 #print "len devices = ", len( devices )
                 #print "len ports = ", len( ports )
                 return main.FALSE
-        for i in range( len( devices ) ):
-            macsDict[ devices[ i ] ] = macs[ i ]
         else:
             main.log.info( "Device Ports are not specified" )
+        if macs:
+            for i in range( len( devices ) ):
+                macsDict[ devices[ i ] ] = macs[ i ]
+
     elif hostNames and not devices and main.hostsData:
         devices = []
         main.log.info( "singleToMultiIntent function is using main.hostsData" ) 
@@ -508,6 +555,20 @@
     if ports:
         portsCopy = copy.copy( ports )
     main.log.info( itemName + ": Adding single point to multi point intents" )
+
+    # Check flows count in each node
+    checkFlowsCount( main )
+
+    # Checking connectivity before installing intents
+    main.log.info( itemName + ": Check hosts connection before adding intents" )
+    checkPing = pingallHosts( main, hostNames )
+    if not checkPing:
+        main.log.info( itemName + ": Ping did not go through " +
+                       "before adding intents" )
+    else:
+        main.log.debug( itemName + ": Pinged successful before adding " +
+                        "intents,please check fwd app if it is activated" )
+
     # Adding bidirectional point  intents
     for i in range( len( devices ) ):
         ingressDevice = devicesCopy[ i ]
@@ -528,7 +589,8 @@
                 main.log.debug( "There is no MAC in device - " + ingressDevice )
                 srcMac = ""
 
-        intentsId.append( main.CLIs[ 0 ].addSinglepointToMultipointIntent(
+        intentsId.append(
+                        main.CLIs[ onosNode ].addSinglepointToMultipointIntent(
                                             ingressDevice=ingressDevice,
                                             egressDeviceList=egressDeviceList,
                                             portIngress=portIngress,
@@ -543,6 +605,8 @@
                                             tcpSrc="",
                                             tcpDst="" ) )
 
+    # Wait some time for the flow to go through when using multi instance
+    time.sleep( 10 )
     pingResult = pingallHosts( main, hostNames )
 
     # Check intents state
@@ -553,6 +617,8 @@
     if not intentResult:
         intentResult = checkIntentState( main, intentsId )
 
+    # Check flows count in each node
+    checkFlowsCount( main )
     # Verify flows
     checkFlowsState( main )
 
@@ -568,6 +634,8 @@
         linkDownResult = link( main, sw1, sw2, "down" )
         intentResult = intentResult and checkIntentState( main, intentsId )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -589,6 +657,8 @@
         linkUpResult = link( main, sw1, sw2, "up" )
         time.sleep( 5 )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -617,6 +687,7 @@
 def multiToSingleIntent( main,
                          name,
                          hostNames,
+                         onosNode=0,
                          devices="",
                          ports=None,
                          ethType="",
@@ -642,7 +713,7 @@
             Verify add-multi-to-single-intent
         Steps:
             - Get device ids | ports
-            - Add single to multi point intents
+            - Add multi to single point intents
             - Check intents
             - Verify flows
             - Ping hosts
@@ -690,6 +761,7 @@
     itemName = name
     tempHostsData = {}
     intentsId = []
+    onosNode = int( onosNode )
 
     macsDict = {}
     ipDict = {}
@@ -706,13 +778,14 @@
                 #print "len devices = ", len( devices )
                 #print "len ports = ", len( ports )
                 return main.FALSE
-        for i in range( len( devices ) ):
-            macsDict[ devices[ i ] ] = macs[ i ]
         else:
             main.log.info( "Device Ports are not specified" )
+        if macs:
+            for i in range( len( devices ) ):
+                macsDict[ devices[ i ] ] = macs[ i ]
     elif hostNames and not devices and main.hostsData:
         devices = []
-        main.log.info( "singleToMultiIntent function is using main.hostsData" ) 
+        main.log.info( "multiToSingleIntent function is using main.hostsData" ) 
         for host in hostNames:
                devices.append( main.hostsData.get( host ).get( 'location' ) )
                macsDict[ main.hostsData.get( host ).get( 'location' ) ] = \
@@ -736,7 +809,21 @@
     devicesCopy = copy.copy( devices )
     if ports:
         portsCopy = copy.copy( ports )
-    main.log.info( itemName + ": Adding single point to multi point intents" )
+    main.log.info( itemName + ": Adding multi point to single point intents" )
+
+    # Check flows count in each node
+    checkFlowsCount( main )
+
+    # Checking connectivity before installing intents
+    main.log.info( itemName + ": Check hosts connection before adding intents" )
+    checkPing = pingallHosts( main, hostNames )
+    if not checkPing:
+        main.log.info( itemName + ": Ping did not go through " +
+                       "before adding intents" )
+    else:
+        main.log.debug( itemName + ": Pinged successful before adding " +
+                        "intents,please check fwd app if it is activated" )
+
     # Adding bidirectional point  intents
     for i in range( len( devices ) ):
         egressDevice = devicesCopy[ i ]
@@ -757,7 +844,8 @@
                 main.log.debug( "There is no MAC in device - " + egressDevice )
                 dstMac = ""
 
-        intentsId.append( main.CLIs[ 0 ].addMultipointToSinglepointIntent(
+        intentsId.append(
+                        main.CLIs[ onosNode ].addMultipointToSinglepointIntent(
                                             ingressDeviceList=ingressDeviceList,
                                             egressDevice=egressDevice,
                                             portIngressList=portIngressList,
@@ -782,6 +870,8 @@
     if not intentResult:
         intentResult = checkIntentState( main, intentsId )
 
+    # Check flows count in each node
+    checkFlowsCount( main )
     # Verify flows
     checkFlowsState( main )
 
@@ -797,6 +887,8 @@
         linkDownResult = link( main, sw1, sw2, "down" )
         intentResult = intentResult and checkIntentState( main, intentsId )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -818,6 +910,8 @@
         linkUpResult = link( main, sw1, sw2, "up" )
         time.sleep( 5 )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -869,7 +963,8 @@
 
     pingResult = main.Mininet1.pingall()
     hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
-    hosts = main.Mininet1.getHosts()
+    hosts = main.Mininet1.getHosts().keys()
+    # TODO: Make better use of new getHosts function
     for host in hosts:
         main.hostsData[ host ] = {}
         main.hostsData[ host ][ 'mac' ] =  \
@@ -914,13 +1009,39 @@
     return statusResult
 
 def checkIntentState( main, intentsId ):
+    """
+        This function will check intent state to make sure all the intents
+        are in INSTALLED state
+    """
 
     intentResult = main.TRUE
+    results = []
 
     main.log.info( itemName + ": Checking intents state" )
+    # First check of intents
     for i in range( main.numCtrls ):
-        intentResult = intentResult and \
-                main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+        tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+        results.append( tempResult )
+
+    expectedState = [ 'INSTALLED', 'INSTALLING' ]
+
+    if all( result == main.TRUE for result in results ):
+        main.log.info( itemName + ": Intents are installed correctly" )
+    else:
+        # Wait for at least 5 second before checking the intents again
+        time.sleep( 5 )
+        results = []
+        # Second check of intents since some of the intents may be in
+        # INSTALLING state, they should be in INSTALLED at this time
+        for i in range( main.numCtrls ):
+            tempResult = main.CLIs[ i ].checkIntentState(
+                                                        intentsId=intentsId )
+            results.append( tempResult )
+        if all( result == main.TRUE for result in results ):
+            main.log.info( itemName + ": Intents are installed correctly" )
+        else:
+            main.log.error( itemName + ": Intents are NOT installed correctly" )
+            intentResult = main.FALSE
 
     return intentResult
 
@@ -965,3 +1086,36 @@
                        "successfully removed all the intents." )
         removeIntentResult = main.TRUE
     return removeIntentResult
+
+def checkFlowsCount( main ):
+    """
+        Check flows count in each node
+    """
+    import json
+
+    flowsCount = []
+    main.log.info( itemName + ": Checking flows count in each ONOS node" )
+    for i in range( main.numCtrls ):
+        summaryResult = main.CLIs[ i ].summary()
+        if not summaryResult:
+            main.log.error( itemName + ": There is something wrong with " +
+                            "summary command" )
+            return main.FALSE
+        else:
+            summaryJson = json.loads( summaryResult )
+            flowsCount.append( summaryJson.get( 'flows' ) )
+
+    if flowsCount:
+        if all( flows==flowsCount[ 0 ] for flows in flowsCount ):
+            main.log.info( itemName + ": There are " + str( flowsCount[ 0 ] ) +
+                           " flows in all ONOS node" )
+        else:
+            for i in range( main.numCtrls ):
+                main.log.debug( itemName + ": ONOS node " + str( i ) + " has " +
+                                flowsCount[ i ] + " flows" )
+    else:
+        main.log.error( "Checking flows count failed, check summary command" )
+        return main.FALSE
+
+    return main.TRUE
+
diff --git a/TestON/tests/FuncIntent/FuncIntent.params b/TestON/tests/FuncIntent/FuncIntent.params
new file mode 100644
index 0000000..e7c8b40
--- /dev/null
+++ b/TestON/tests/FuncIntent/FuncIntent.params
@@ -0,0 +1,34 @@
+<PARAMS>
+
+    <testcases>10,11,12,13,1003</testcases>
+
+    <SCALE>1,3</SCALE>
+    <availableNodes>3</availableNodes>
+    <ENV>
+        <cellName>functionality</cellName>
+        <cellApps>drivers,openflow,proxyarp,mobility</cellApps>
+    </ENV>
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+    <CTRL>
+        <num>3</num>
+        <ip1>OC1</ip1>
+        <port1>6633</port1>
+        <ip2>OC2</ip2>
+        <port2>6633</port2>
+        <ip3>OC3</ip3>
+        <port3>6633</port3>
+    </CTRL>
+    <BENCH>
+        <user>admin</user>
+        <ip1>OCN</ip1>
+    </BENCH>
+    <MININET>
+        <switch>7</switch>
+        <links>20</links>
+        <topo>~/mininet/custom/newFuncTopo.py</topo>
+    </MININET>
+
+</PARAMS>
diff --git a/TestON/tests/FuncIntent/FuncIntent.py b/TestON/tests/FuncIntent/FuncIntent.py
index d5dc2a7..3a716ee 100644
--- a/TestON/tests/FuncIntent/FuncIntent.py
+++ b/TestON/tests/FuncIntent/FuncIntent.py
@@ -223,11 +223,19 @@
         main.case( "Assign switches to controllers" )
         main.step( "Assigning switches to controllers" )
         assignResult = main.TRUE
+        switchList = []
+
+        # Creates a list switch name, use getSwitch() function later...
         for i in range( 1, ( main.numSwitch + 1 ) ):
-            main.Mininet1.assignSwController( sw=str( i ),
-                                              count=1,
-                                              ip1=main.ONOSip[ 0 ],
-                                              port1=main.ONOSport[ 0 ] )
+            switchList.append( 's' + str( i ) )
+
+        assignResult = main.Mininet1.assignSwController( sw=switchList,
+                                                         ip=main.ONOSip,
+                                                         port=main.ONOSport )
+        if not assignResult:
+            main.cleanup()
+            main.exit()
+
         for i in range( 1, ( main.numSwitch + 1 ) ):
             response = main.Mininet1.getSwController( "s" + str( i ) )
             print( "Response is " + str( response ) )
@@ -256,6 +264,25 @@
                                  onpass="Successfully discovered hosts",
                                  onfail="Failed to discover hosts" )
 
+    def CASE14( self, main ):
+        """
+            Stop mininet
+        """
+        main.log.report( "Stop Mininet topology" )
+        main.log.case( "Stop Mininet topology" )
+
+        main.step( "Stopping Mininet Topology" )
+        topoResult = main.Mininet1.stopNet( )
+        stepResult = topoResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully stop mininet",
+                                 onfail="Failed to stop mininet" )
+        # Exit if topology did not load properly
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
     def CASE1001( self, main ):
         """
             Add host intents between 2 host:
@@ -292,6 +319,7 @@
         stepResult = main.TRUE
         main.step( "IPV4: Add host intents between h1 and h9" )
         stepResult = main.wrapper.hostIntent( main,
+                                              onosNode='0',
                                               name='IPV4',
                                               host1='h1',
                                               host2='h9',
@@ -305,8 +333,8 @@
                                  actual=stepResult,
                                  onpass="IPV4: Add host intent successful",
                                  onfail="IPV4: Add host intent failed" )
-        stepResult = main.TRUE
 
+        stepResult = main.TRUE
         main.step( "DUALSTACK1: Add host intents between h3 and h11" )
         stepResult = main.wrapper.hostIntent( main,
                                               name='DUALSTACK',
@@ -325,7 +353,7 @@
                                  onfail="DUALSTACK1: Add host intent failed" )
 
         stepResult = main.TRUE
-        main.step( "DUALSTACK2: Add host intents between h1 and h9" )
+        main.step( "DUALSTACK2: Add host intents between h1 and h11" )
         stepResult = main.wrapper.hostIntent( main,
                                               name='DUALSTACK2',
                                               host1='h1',
@@ -340,6 +368,51 @@
                                         " successful",
                                  onfail="DUALSTACK2: Add host intent failed" )
 
+        stepResult = main.TRUE
+        main.step( "1HOP: Add host intents between h1 and h3" )
+        stepResult = main.wrapper.hostIntent( main,
+                                              name='1HOP',
+                                              host1='h1',
+                                              host2='h3' )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="1HOP: Add host intent" +
+                                        " successful",
+                                 onfail="1HOP: Add host intent failed" )
+
+        stepResult = main.TRUE
+        main.step( "VLAN1: Add vlan host intents between h4 and h12" )
+        stepResult = main.wrapper.hostIntent( main,
+                                              name='VLAN1',
+                                              host1='h4',
+                                              host2='h12',
+                                              host1Id='00:00:00:00:00:04/100',
+                                              host2Id='00:00:00:00:00:0C/100',
+                                              sw1='s5',
+                                              sw2='s2',
+                                              expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="VLAN1: Add vlan host" +
+                                        " intent successful",
+                                 onfail="VLAN1: Add vlan host intent failed" )
+
+        stepResult = main.TRUE
+        main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
+        stepResult = main.wrapper.hostIntent( main,
+                                              name='VLAN2',
+                                              host1='h13',
+                                              host2='h20' )
+
+        utilities.assert_equals( expect=main.FALSE,
+                                 actual=stepResult,
+                                 onpass="VLAN2: Add inter vlan host" +
+                                        " intent successful",
+                                 onfail="VLAN2: Add inter vlan host" +
+                                        " intent failed" )
+
     def CASE1002( self, main ):
         """
             Add point intents between 2 hosts:
@@ -374,7 +447,26 @@
         main.case( "Add point intents between 2 devices" )
 
         stepResult = main.TRUE
-        main.step( "IPV4: Add point intents between h1 and h9" )
+        # No option point intents
+        main.step( "NOOPTION: Add point intents between h1 and h9" )
+        stepResult = main.wrapper.pointIntent(
+                                       main,
+                                       name="NOOPTION",
+                                       host1="h1",
+                                       host2="h9",
+                                       deviceId1="of:0000000000000005/1",
+                                       deviceId2="of:0000000000000006/1",
+                                       sw1="s5",
+                                       sw2="s2",
+                                       expectedLink=18 )
+
+        stepResult = main.TRUE
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="NOOPTION: Add point intent successful",
+                                 onfail="NOOPTION: Add point intent failed" )
+
+        stepResult = main.TRUE
         stepResult = main.wrapper.pointIntent(
                                        main,
                                        name="IPV4",
@@ -404,6 +496,28 @@
                                  onfail="IPV4: Add point intent failed" )
 
         stepResult = main.TRUE
+        stepResult = main.wrapper.pointIntent(
+                                       main,
+                                       name="IPV4_2",
+                                       host1="h1",
+                                       host2="h9",
+                                       deviceId1="of:0000000000000005/1",
+                                       deviceId2="of:0000000000000006/1",
+                                       ipProto=1,
+                                       ip1="",
+                                       ip2="",
+                                       tcp1="",
+                                       tcp2="",
+                                       sw1="s5",
+                                       sw2="s2",
+                                       expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="IPV4_2: Add point intent successful",
+                                 onfail="IPV4_2: Add point intent failed" )
+
+        stepResult = main.TRUE
         main.step( "DUALSTACK1: Add point intents between h1 and h9" )
         stepResult = main.wrapper.pointIntent(
                                        main,
@@ -432,7 +546,49 @@
                                  actual=stepResult,
                                  onpass="DUALSTACK1: Add point intent" +
                                         " successful",
-                                 onfail="DUALSTACK1: Add point intent failed" )
+                                 onfail="DUALSTACK1: Add point intent failed" ) 
+        stepResult = main.TRUE
+        main.step( "VLAN: Add point intents between h5 and h21" )
+        stepResult = main.wrapper.pointIntent(
+                                       main,
+                                       name="VLAN",
+                                       host1="h5",
+                                       host2="h21",
+                                       deviceId1="of:0000000000000005/5",
+                                       deviceId2="of:0000000000000007/5",
+                                       port1="",
+                                       port2="",
+                                       ethType="IPV4",
+                                       mac1="00:00:00:00:00:05",
+                                       mac2="00:00:00:00:00:15",
+                                       bandwidth="",
+                                       lambdaAlloc=False,
+                                       ipProto="",
+                                       ip1="",
+                                       ip2="",
+                                       tcp1="",
+                                       tcp2="",
+                                       sw1="s5",
+                                       sw2="s2",
+                                       expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="VLAN: Add point intent successful",
+                                 onfail="VLAN: Add point intent failed" )
+
+        stepResult = main.TRUE
+        main.step( "1HOP: Add point intents between h1 and h3" )
+        stepResult = main.wrapper.hostIntent( main,
+                                              name='1HOP',
+                                              host1='h1',
+                                              host2='h3' )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="1HOP: Add point intent" +
+                                        " successful",
+                                 onfail="1HOP: Add point intent failed" )
 
     def CASE1003( self, main ):
         """
@@ -462,11 +618,30 @@
         main.case( "Add single point to multi point intents between devices" )
 
         stepResult = main.TRUE
-        main.step( "IPV4: Add single point to multi point intents" )
         hostNames = [ 'h8', 'h16', 'h24' ]
         devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
                     'of:0000000000000007/8' ]
         macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
+
+        main.step( "NOOPTION: Add single point to multi point intents" )
+        stepResult = main.wrapper.singleToMultiIntent(
+                                         main,
+                                         name="NOOPTION",
+                                         hostNames=hostNames,
+                                         devices=devices,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="NOOPTION: Successfully added single "
+                                        + " point to multi point intents",
+                                 onfail="NOOPTION: Failed to add single point" +
+                                        " to multi point intents" )
+
+        stepResult = main.TRUE
+        main.step( "IPV4: Add single point to multi point intents" )
         stepResult = main.wrapper.singleToMultiIntent(
                                          main,
                                          name="IPV4",
@@ -491,6 +666,7 @@
                                  onfail="IPV4: Failed to add single point" +
                                         " to multi point intents" )
 
+        stepResult = main.TRUE
         main.step( "IPV4_2: Add single point to multi point intents" )
         hostNames = [ 'h8', 'h16', 'h24' ]
         stepResult = main.wrapper.singleToMultiIntent(
@@ -502,10 +678,40 @@
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
-                                 onpass="IPV4_2: Successfully added single point"
-                                        + " to multi point intents",
+                                 onpass="IPV4_2: Successfully added single "
+                                        + " point to multi point intents",
                                  onfail="IPV4_2: Failed to add single point" +
                                         " to multi point intents" )
+        stepResult = main.TRUE
+        main.step( "VLAN: Add single point to multi point intents" )
+        hostNames = [ 'h4', 'h12', 'h20' ]
+        devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
+                    'of:0000000000000007/4' ]
+        macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ]
+        stepResult = main.wrapper.singleToMultiIntent(
+                                         main,
+                                         name="VLAN",
+                                         hostNames=hostNames,
+                                         devices=devices,
+                                         ports=None,
+                                         ethType="IPV4",
+                                         macs=macs,
+                                         bandwidth="",
+                                         lambdaAlloc=False,
+                                         ipProto="",
+                                         ipAddresses="",
+                                         tcp="",
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="VLAN: Successfully added single point"
+                                        + " to multi point intents",
+                                 onfail="VLAN: Failed to add single point" +
+                                        " to multi point intents" ) 
+
     def CASE1004( self, main ):
         """
             Add multi point to single point intents
@@ -523,7 +729,7 @@
                     - Verify flows
                     - Check topology
                     - Ping hosts
-                - Remove intents
+             - Remove intents
         """
         assert main, "There is no main"
         assert main.CLIs, "There is no main.CLIs"
@@ -534,11 +740,30 @@
         main.case( "Add multi point to single point intents between devices" )
 
         stepResult = main.TRUE
-        main.step( "IPV4: Add multi point to single point intents" )
         hostNames = [ 'h8', 'h16', 'h24' ]
         devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
                     'of:0000000000000007/8' ]
         macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
+
+        main.step( "NOOPTION: Add multi point to single point intents" )
+        stepResult = main.wrapper.multiToSingleIntent(
+                                         main,
+                                         name="NOOPTION",
+                                         hostNames=hostNames,
+                                         devices=devices,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="NOOPTION: Successfully added multi "
+                                        + " point to single point intents",
+                                 onfail="NOOPTION: Failed to add multi point" +
+                                        " to single point intents" )
+
+        stepResult = main.TRUE
+        main.step( "IPV4: Add multi point to single point intents" )
         stepResult = main.wrapper.multiToSingleIntent(
                                          main,
                                          name="IPV4",
@@ -563,6 +788,7 @@
                                  onfail="IPV4: Failed to add multi point" +
                                         " to single point intents" )
 
+        stepResult = main.TRUE
         main.step( "IPV4_2: Add multi point to single point intents" )
         hostNames = [ 'h8', 'h16', 'h24' ]
         stepResult = main.wrapper.multiToSingleIntent(
@@ -578,3 +804,33 @@
                                         + " to single point intents",
                                  onfail="IPV4_2: Failed to add multi point" +
                                         " to single point intents" )
+
+        stepResult = main.TRUE
+        main.step( "VLAN: Add multi point to single point intents" )
+        hostNames = [ 'h5', 'h13', 'h21' ]
+        devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
+                    'of:0000000000000007/5' ]
+        macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ]
+        stepResult = main.wrapper.multiToSingleIntent(
+                                         main,
+                                         name="VLAN",
+                                         hostNames=hostNames,
+                                         devices=devices,
+                                         ports=None,
+                                         ethType="IPV4",
+                                         macs=macs,
+                                         bandwidth="",
+                                         lambdaAlloc=False,
+                                         ipProto="",
+                                         ipAddresses="",
+                                         tcp="",
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="VLAN: Successfully added multi point"
+                                        + " to single point intents",
+                                 onfail="VLAN: Failed to add multi point" +
+                                        " to single point intents" )
diff --git a/TestON/tests/FuncNext13/FuncNext13.params b/TestON/tests/FuncNext13/FuncNext13.params
deleted file mode 100755
index 13a4691..0000000
--- a/TestON/tests/FuncNext13/FuncNext13.params
+++ /dev/null
@@ -1,37 +0,0 @@
-<PARAMS>
-    
-    <testcases>1,4,5,3</testcases>
-
-    #Environment variables
-    <ENV>
-        <cellName>driver_test</cellName>
-    </ENV>
-
-    <CTRL>
-        <ip1>10.128.20.11</ip1>
-        <port1>6633</port1>
-    </CTRL>
-
-    <PING>
-        <source1>h8</source1>
-        <source2>h9</source2>
-        <source3>h10</source3>
-        <source4>h11</source4>
-        <source5>h12</source5>
-        <source6>h13</source6>
-        <source7>h14</source7>
-        <source8>h15</source8>
-        <source9>h16</source9>
-        <source10>h17</source10>
-        <target1>10.0.0.18</target1>
-        <target2>10.0.0.19</target2>
-        <target3>10.0.0.20</target3>
-        <target4>10.0.0.21</target4>
-        <target5>10.0.0.22</target5>
-        <target6>10.0.0.23</target6>
-        <target7>10.0.0.24</target7>
-        <target8>10.0.0.25</target8>
-        <target9>10.0.0.26</target9>
-        <target10>10.0.0.27</target10>
-    </PING>
-</PARAMS>
diff --git a/TestON/tests/FuncNext13/FuncNext13.py b/TestON/tests/FuncNext13/FuncNext13.py
deleted file mode 100755
index 6b24695..0000000
--- a/TestON/tests/FuncNext13/FuncNext13.py
+++ /dev/null
@@ -1,608 +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 time
-import json
-
-time.sleep(1)
-class FuncNext13:
-    def __init__(self):
-        self.default = ''
-
-    def CASE1(self, main):
-        '''
-        Startup sequence:
-        git pull
-        mvn clean install
-        onos-package
-        cell <name>
-        onos-verify-cell
-        onos-install -f
-        onos-wait-for-start
-        '''
-        
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS1_port = main.params['CTRL']['port1']
-        
-        main.case("Setting up test environment")
-        
-        main.step("Git checkout and pull master and get version")
-        main.ONOSbench.git_checkout("master")
-        git_pull_result = main.ONOSbench.git_pull()
-        print "git_pull_result = ", git_pull_result
-        version_result = main.ONOSbench.get_version()
-
-        if git_pull_result == 1:
-            main.step("Using mvn clean & install")
-            clean_install_result = main.ONOSbench.clean_install()
-            #clean_install_result = main.TRUE
-
-        main.step("Applying cell variable to environment")
-        cell_result1 = main.ONOSbench.set_cell(cell_name)
-        verify_result = main.ONOSbench.verify_cell()
-        cell_result2 = main.ONOS2.set_cell(cell_name)
-        #verify_result = main.ONOS2.verify_cell()
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-        
-        cell_result = cell_result1 and cell_result2
-
-        main.step("Creating ONOS package")
-        package_result = main.ONOSbench.onos_package()
-
-        #main.step("Creating a cell")
-        #cell_create_result = main.ONOSbench.create_cell_file(**************)
-
-        main.step("Installing ONOS package")
-        onos_install_result = main.ONOSbench.onos_install()
-        onos1_isup = main.ONOSbench.isup()
-   
-        main.step("Starting ONOS service")
-        start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
-        case1_result = (package_result and\
-                cell_result and verify_result and onos_install_result and\
-                onos1_isup and start_result )
-        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
-                onpass="Test startup successful",
-                onfail="Test startup NOT successful")
-
-    def CASE11(self, main):
-        '''
-        Cleanup sequence:
-        onos-service <node_ip> stop
-        onos-uninstall
-
-        TODO: Define rest of cleanup
-        
-        '''
-
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Cleaning up test environment")
-
-        main.step("Testing ONOS kill function")
-        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
-
-        main.step("Stopping ONOS service")
-        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
-
-        main.step("Uninstalling ONOS service") 
-        uninstall_result = main.ONOSbench.onos_uninstall()
-
-    def CASE3(self, main):
-        '''
-        Test 'onos' command and its functionality in driver
-        '''
-        
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Testing 'onos' command")
-
-        main.step("Sending command 'onos -w <onos-ip> system:name'")
-        cmdstr1 = "system:name"
-        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
-        main.log.info("onos command returned: "+cmd_result1)
-
-        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
-        cmdstr2 = "onos:topology"
-        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
-        main.log.info("onos command returned: "+cmd_result2)
-
-
-
-    def CASE4(self, main):
-        import re
-        import time
-        main.case("Pingall Test")
-        main.step("Assigning switches to controllers")
-        for i in range(1,29):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-        Switch_Mastership = main.TRUE
-        for i in range (1,29):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-
-        if Switch_Mastership == main.TRUE:
-            main.log.report("MasterControllers assigned correctly")
-        utilities.assert_equals(expect = main.TRUE,actual=Switch_Mastership,
-                onpass="MasterControllers assigned correctly")
-        '''
-        for i in range (1,29):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=5,
-                    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)
-        '''
-        #REACTIVE FWD test
-
-        main.step("Get list of hosts from Mininet")
-        host_list = main.Mininet1.get_hosts()
-        main.log.info(host_list)
-
-        main.step("Get host list in ONOS format")
-        host_onos_list = main.ONOS2.get_hosts_id(host_list)
-        main.log.info(host_onos_list)
-        #time.sleep(5)
-
-        #We must use ping from hosts we want to add intents from 
-        #to make the hosts talk
-        #main.Mininet2.handle.sendline("\r")
-        #main.Mininet2.handle.sendline("h4 ping 10.1.1.1 -c 1 -W 1")
-        #time.sleep(3)
-        #main.Mininet2.handle.sendline("h5 ping 10.1.1.1 -c 1 -W 1")
-        #time.sleep(5)
-        
-        main.step("Pingall")
-        ping_result = main.FALSE
-        while ping_result == main.FALSE:
-            time1 = time.time()
-            ping_result = 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.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-
-        main.step("Get hosts")
-        main.ONOS2.handle.sendline("hosts")
-        main.ONOS2.handle.expect("onos>")
-        hosts = main.ONOS2.handle.before
-        main.log.info(hosts)
-
-        main.step("Get all devices id")
-        devices_id_list = main.ONOS2.get_all_devices_id()
-        main.log.info(devices_id_list)
-        
-        #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")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1") 
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
-
- 
-        
-        print "_____________________________________________________________________________________"
-        ''' 
-        main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008", 1, "of:0000000000006018", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018", 1, "of:0000000000003008", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009", 1, "of:0000000000006019", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019", 1, "of:0000000000003009", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-        
-        main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010", 1, "of:0000000000006020", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020", 1, "of:0000000000003010", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011", 1, "of:0000000000006021", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021", 1, "of:0000000000003011", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012", 1, "of:0000000000006022", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022", 1, "of:0000000000003012", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013", 1, "of:0000000000006023", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023", 1, "of:0000000000003013", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014", 1, "of:0000000000006024", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024", 1, "of:0000000000003014", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015", 1, "of:0000000000006025", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025", 1, "of:0000000000003015", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016", 1, "of:0000000000006026", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026", 1, "of:0000000000003016", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-        
-        main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017", 1, "of:0000000000006027", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027", 1, "of:0000000000003017", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-
-        print("_______________________________________________________________________________________")
-        '''
-
-        #Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstall_result = main.ONOS2.feature_uninstall("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)
-        
-        flowHandle = main.ONOS2.flows()
-        print "flowHandle = ", flowHandle
-
-        count = 1
-        i = 8
-        Ping_Result = 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
-                Ping_Result = 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 have failed")
-                i=19
-                Ping_Result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping test passed!")
-                i+=1
-                Ping_Result = main.TRUE
-            else:
-                main.log.info("Unknown error")
-                Ping_Result = main.ERROR
-        if Ping_Result==main.FALSE:
-            main.log.report("Intents have not ben installed correctly. Cleaning up")
-            #main.cleanup()
-            #main.exit()
-        if Ping_Result==main.TRUE:
-            main.log.report("Intents have been installed correctly")
-            
-        case4_result = Switch_Mastership and Ping_Result
-        utilities.assert_equals(expect=main.TRUE, actual=case4_result,
-                onpass="Pingall Test successful",
-                onfail="Pingall Test NOT successful")
-
-    def CASE5(self,main) :
-        import json
-        from subprocess import Popen, PIPE
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        #main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-        deviceResult = main.ONOS2.devices()
-        linksResult = main.ONOS2.links()
-        portsResult = main.ONOS2.ports()
-        print "**************"
-        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
-
-        Topology_Check = main.TRUE
-        main.step("Compare ONOS Topology to MN Topology")
-        devices_json = main.ONOS2.devices()
-        links_json = main.ONOS2.links()
-        ports_json = main.ONOS2.ports()
-        print "devices_json= ", devices_json
-        
-        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
-        print "***********************"
-        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
-        print "***********************"
-        result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
-            
-        result = result1 and result2 and result3
-        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")
-        Topology_Check = Topology_Check and result
-        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
-            onpass="Topology checks passed", onfail="Topology checks failed")
-    
-
-    def CASE7 (self,main):
-       
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        link_sleep = int(main.params['timers']['LinkDiscovery'])
-
-        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")
-        topology_output = main.ONOS2.topology()
-        topology_result = main.ONOS1.get_topology(topology_output)
-        activeSwitches = topology_result['devices']
-        links = topology_result['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(link_sleep)
-        topology_output = main.ONOS2.topology()
-        Link_Down = main.ONOS1.check_status(topology_output,activeSwitches,str(int(links)-2))
-        if Link_Down == main.TRUE:
-            main.log.report("Link Down discovered properly")
-        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
-                onpass="Link Down discovered properly",
-                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
-        
-        main.step("Bring link between s3 and s28 back up")
-        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
-        time.sleep(link_sleep)
-        topology_output = main.ONOS2.topology()
-        Link_Up = main.ONOS1.check_status(topology_output,activeSwitches,str(links))
-        if Link_Up == main.TRUE:
-            main.log.report("Link up discovered properly")
-        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
-                onpass="Link up discovered properly",
-                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
-
-
-
-
-        main.step("Compare ONOS Topology to MN Topology")
-        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-        MNTopo = Topo
-        Topology_Check = main.TRUE
-        devices_json = main.ONOS2.devices()
-        links_json = main.ONOS2.links()
-        ports_json = main.ONOS2.ports()
-        print "devices_json= ", devices_json
-        
-        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
-        print "***********************"
-        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
-        print "***********************"
-        result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
-            
-        result = result1 and result2 and result3
-        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")
-        Topology_Check = Topology_Check and result
-        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
-            onpass="Topology checks passed", onfail="Topology checks failed")
-    
-        result = Link_Down and Link_Up and Topology_Check
-        utilities.assert_equals(expect=main.TRUE,actual=result,
-                onpass="Link failure is discovered correctly",
-                onfail="Link Discovery failed")
-
-
-
diff --git a/TestON/tests/FuncNext13/FuncNext13.topo b/TestON/tests/FuncNext13/FuncNext13.topo
deleted file mode 100755
index 85b6cab..0000000
--- a/TestON/tests/FuncNext13/FuncNext13.topo
+++ /dev/null
@@ -1,61 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOSbench>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOSbench>
-
-        <ONOS1>
-            <host>10.128.10.11</host>
-            <user>sdn</user>
-            <password>sdn</password>
-            <type>OnosDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2>
-
-        <Mininet1>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-                #Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <arg3> --switch ovs,protocols=OpenFlow13</arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-                #Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet2>
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/FuncStartTemplate/FuncStartTemplate.params b/TestON/tests/FuncStartTemplate/FuncStartTemplate.params
index 310e5f8..04f6110 100755
--- a/TestON/tests/FuncStartTemplate/FuncStartTemplate.params
+++ b/TestON/tests/FuncStartTemplate/FuncStartTemplate.params
@@ -1,11 +1,10 @@
 <PARAMS>
-
     <testcases>10,9,10,9</testcases>
 
-    <SCALE>3,1</SCALE>
+    <SCALE>1,3</SCALE>
     <availableNodes>3</availableNodes>
     <ENV>
-        <cellName>single_func</cellName>
+        <cellName>functionality</cellName>
         <cellApps>drivers,openflow,proxyarp,mobility</cellApps>
     </ENV>
     <GIT>
diff --git a/TestON/tests/FuncStartTemplate/FuncStartTemplate.py b/TestON/tests/FuncStartTemplate/FuncStartTemplate.py
index 4beefae..59c242c 100644
--- a/TestON/tests/FuncStartTemplate/FuncStartTemplate.py
+++ b/TestON/tests/FuncStartTemplate/FuncStartTemplate.py
@@ -15,12 +15,13 @@
     def CASE10( self, main ):
         import time
         import os
+        import imp
         """
         Startup sequence:
+        git pull
         cell <name>
         onos-verify-cell
         onos-remove-raft-log
-        git pull
         mvn clean install
         onos-package
         onos-install -f
@@ -44,6 +45,8 @@
         main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
         main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
         main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
+        main.ONOSport = []
+        main.hostsData = {}
         PULLCODE = False
         if main.params[ 'GIT' ][ 'pull' ] == 'True':
             PULLCODE = True
@@ -51,12 +54,12 @@
         main.CLIs = []
         for i in range( 1, int( main.numCtrls ) + 1 ):
             main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+            main.ONOSport.append( main.params[ 'CTRL' ][ 'port' + str( i ) ] )
 
         # -- INIT SECTION, ONLY RUNS ONCE -- #
         if init == False:
             init = True
 
-            main.ONOSport = []
             main.scale = ( main.params[ 'SCALE' ] ).split( "," )
             main.numCtrls = int( main.scale[ 0 ] )
 
@@ -80,43 +83,21 @@
                                "clean install" )
 
             globalONOSip = main.ONOSbench.getOnosIps()
-        
-        maxNodes = ( len(globalONOSip) - 2 )
+
+        maxNodes = ( len( globalONOSip ) - 2 )
 
         main.numCtrls = int( main.scale[ 0 ] )
         main.scale.remove( main.scale[ 0 ] )
 
         main.ONOSip = []
-        for i in range( maxNodes ): 
-            main.ONOSip.append( globalONOSip[i] )
+        for i in range( maxNodes ):
+            main.ONOSip.append( globalONOSip[ i ] )
 
-
-        
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
                        " before initiating enviornment setup" )
-        for i in range(maxNodes):
+        for i in range( maxNodes ):
             main.ONOSbench.onosDie( globalONOSip[ i ] )
-        
-        """
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " + \
-                                        "environment",
-                                 onfail="Failed to apply cell to environment " )
-        """
-        """main.step( "Removing raft logs" )
-        removeRaftResult = main.ONOSbench.onosRemoveRaftLogs()
-        stepResult = removeRaftResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully removed raft logs",
-                                 onfail="Failed to remove raft logs" )
-        """
 
         print "NODE COUNT = ", main.numCtrls
         main.log.info( "Creating cell file" )
@@ -190,24 +171,31 @@
                                  actual=stepResult,
                                  onpass="ONOS service is ready",
                                  onfail="ONOS service did not start properly" )
-        
+
         main.step( "Start ONOS cli" )
         cliResult = main.TRUE
         for i in range( main.numCtrls ):
             cliResult = cliResult and \
-                        main.CLIs[i].startOnosCli( main.ONOSip[ i ] )
+                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
         stepResult = cliResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully start ONOS cli",
                                  onfail="Failed to start ONOS cli" )
-    
-    def CASE9( self, main ): 
+
+    def CASE9( self, main ):
         '''
-            Report errors/warnings/exceptions 
+            Report errors/warnings/exceptions
         '''
-        main.log.info("Error report: \n") 
-        main.ONOSbench.logReport( globalONOSip[0], [ "INFO","FOLLOWER","WARN","flow","ERROR","Except" ], "s" )  
+        main.log.info("Error report: \n" )
+        main.ONOSbench.logReport( globalONOSip[ 0 ],
+                                  [ "INFO",
+                                    "FOLLOWER",
+                                    "WARN",
+                                    "flow",
+                                    "ERROR",
+                                    "Except" ],
+                                  "s" )
         #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
 
     def CASE11( self, main ):
diff --git a/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo b/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo
index 2321da0..e6613de 100755
--- a/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo
+++ b/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo
@@ -8,7 +8,7 @@
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
             <COMPONENTS>
-                <home>~/onos</home>
+                <home>~/ONOS</home>
             </COMPONENTS>
         </ONOSbench>
 
diff --git a/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
new file mode 100644
index 0000000..41b3258
--- /dev/null
+++ b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
@@ -0,0 +1,344 @@
+"""
+    Wrapper function for FuncTopo
+    Includes onosclidriver and mininetclidriver functions
+"""
+import time
+import json
+import re
+
+def __init__( self ):
+    self.default = ''
+
+def testTopology( main, topoFile='', args='', mnCmd='', clean=True ):
+    """
+    Description:
+        This function combines different wrapper functions in this module
+        to simulate a topology test
+    Test Steps:
+        - Load topology
+        - Discover topology
+        - Compare topology
+        - pingall
+        - Bring links down
+        - Compare topology
+        - pingall
+        - Bring links up
+        - Compare topology
+        - pingall
+    Options:
+        clean: Does sudo mn -c to clean mininet residue
+        Please read mininetclidriver.py >> startNet( .. ) function for details
+    Returns:
+        Returns main.TRUE if the test is successful, main.FALSE otherwise
+    """
+    testTopoResult = main.TRUE
+    compareTopoResult = main.TRUE
+    topoObjectResult = main.TRUE
+    stopResult = main.TRUE
+
+    if clean:
+        # Cleans minient
+        stopResult = stopMininet( main )
+
+    # Restart ONOS to clear hosts test new mininet topology
+    restartONOSResult = restartONOS( main )
+
+    # Starts topology
+    startResult = startNewTopology( main, topoFile, args, mnCmd )
+
+    # Gets list of switches in mininet
+    assignSwitch( main )
+
+    # This function activates fwd app then does pingall as well as store
+    # hosts data in a variable main.hostsData
+    getHostsResult = getHostsData( main )
+
+    # Create topology object using sts
+    topoObjectResult = createTopoObject( main )
+
+    # Compare Topology
+    compareTopoResult = compareTopo( main )
+
+    testTopoResult = startResult and topoObjectResult and \
+                     compareTopoResult and getHostsResult
+
+
+    return testTopoResult
+
+def startNewTopology( main, topoFile='', args='', mnCmd='' ):
+    """
+    Description:
+        This wrapper function starts new topology
+    Options:
+        Please read mininetclidriver.py >> startNet( .. ) function for details
+    Return:
+        Returns main.TRUE if topology is successfully created by mininet,
+        main.FALSE otherwise
+    NOTE:
+        Assumes Mininet1 is the name of the handler
+    """
+    assert main, "There is no main variable"
+    assert main.Mininet1, "Mininet 1 is not created"
+    result = main.TRUE
+
+    main.log.info( main.topoName + ": Starting new Mininet topology" )
+
+    # log which method is being used
+    if topoFile:
+        main.log.info( main.topoName + ": Starting topology with " +
+                       topoFile + "topology file" )
+    elif not topoFile and not mnCmd:
+        main.log.info( main.topoName + ": Starting topology using" +
+                       " the topo file" )
+    elif topoFile and mnCmd:
+        main.log.error( main.topoName + ": You can only use one " +
+                        "method to start a topology" )
+    elif mnCmd:
+        main.log.info( main.topoName + ": Starting topology with '" +
+                       mnCmd + "' Mininet command" )
+
+
+    result = main.Mininet1.startNet( topoFile=topoFile,
+                                     args=args,
+                                     mnCmd=mnCmd )
+
+    return result
+
+def stopMininet( main ):
+    """
+        Stops current topology and execute mn -c basically triggers
+        stopNet in mininetclidrivers
+
+        NOTE: Mininet should be running when issuing this command other wise
+        the this function will cause the test to stop
+    """
+    stopResult = main.TRUE
+    stopResult = main.Mininet1.stopNet()
+    time.sleep( 30 )
+    if not stopResult:
+        main.log.info(  main.topoName + ": Did not stop Mininet topology" )
+    return stopResult
+
+def createTopoObject( main ):
+    """
+        Creates topology object using sts module
+    """
+    from sts.topology.teston_topology import TestONTopology
+    global MNTopo
+    try:
+        ctrls = []
+        main.log.info(  main.topoName + ": Creating topology object" +
+                        " from mininet" )
+        for node in main.nodes:
+            temp = ( node, node.name, node.ip_address, 6633 )
+            ctrls.append( temp )
+        MNTopo = TestONTopology( main.Mininet1, ctrls )
+    except Exception:
+        objResult = main.FALSE
+    else:
+        objResult = main.TRUE
+
+    return objResult
+
+def compareTopo( main ):
+    """
+        Compare topology( devices, links, ports, hosts ) between ONOS and
+        mininet using sts
+    """
+    assert MNTopo, "There is no MNTopo object"
+    devices = []
+    links = []
+    ports = []
+    hosts = []
+    switchResult = []
+    linksResult = []
+    portsResult = []
+    hostsResult = []
+    compareTopoResult = main.TRUE
+
+    for i in range( main.numCtrls ):
+        devices.append( json.loads( main.CLIs[ i ].devices() ) )
+        links.append( json.loads( main.CLIs[ i ].links() ) )
+        ports.append( json.loads(  main.CLIs[ i ].ports() ) )
+        hosts.append( json.loads( main.CLIs[ i ].hosts() ) )
+
+    # Comparing switches
+    main.log.info( main.topoName + ": Comparing switches in each ONOS nodes" +
+                   " with Mininet" )
+    for i in range( main.numCtrls ):
+        tempResult = main.Mininet1.compareSwitches( MNTopo, devices[ i ] )
+        switchResult.append( tempResult )
+        if tempResult == main.FALSE:
+            main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+                            " switch view is incorrect " )
+
+    if all( result == main.TRUE for result in switchResult ):
+        main.log.info( main.topoName + ": Switch view in all ONOS nodes "+
+                       "are correct " )
+    else:
+        compareTopoResult = main.FALSE
+
+    # Comparing ports
+    main.log.info( main.topoName + ": Comparing ports in each ONOS nodes" +
+                   " with Mininet" )
+    for i in range( main.numCtrls ):
+        tempResult = main.Mininet1.comparePorts( MNTopo, ports[ i ] )
+        portsResult.append( tempResult )
+        if tempResult == main.FALSE:
+            main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+                            " ports view are incorrect " )
+
+    if all( result == main.TRUE for result in portsResult ):
+        main.log.info( main.topoName + ": Ports view in all ONOS nodes "+
+                       "are correct " )
+    else:
+        compareTopoResult = main.FALSE
+
+    # Comparing links
+    main.log.info( main.topoName + ": Comparing links in each ONOS nodes" +
+                   " with Mininet" )
+    for i in range( main.numCtrls ):
+        tempResult = main.Mininet1.compareLinks( MNTopo, links[ i ] )
+        linksResult.append( tempResult )
+        if tempResult == main.FALSE:
+            main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+                            " links view are incorrect " )
+
+    if all( result == main.TRUE for result in linksResult ):
+        main.log.info( main.topoName + ": Links view in all ONOS nodes "+
+                       "are correct " )
+    else:
+        compareTopoResult = main.FALSE
+
+    # Comparing hosts
+    main.log.info( main.topoName + ": Comparing hosts in each ONOS nodes" +
+                   " with Mininet" )
+    for i in range( main.numCtrls ):
+        tempResult = main.Mininet1.compareHosts( MNTopo, hosts[ i ] )
+        hostsResult.append( tempResult )
+        if tempResult == main.FALSE:
+            main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+                            " hosts view are incorrect " )
+
+    if all( result == main.TRUE for result in hostsResult ):
+        main.log.info( main.topoName + ": Hosts view in all ONOS nodes "+
+                       "are correct " )
+    else:
+        compareTopoResult = main.FALSE
+
+    return compareTopoResult
+
+def assignSwitch( main ):
+    """
+        Returns switch list using getSwitch in Mininet driver
+    """
+    switchList = []
+    assignResult = main.TRUE
+    switchList =  main.Mininet1.getSwitch()
+    assignResult = main.Mininet1.assignSwController( sw=switchList,
+                                                     ip=main.ONOSip[ 0 ],
+                                                     port=6633 )
+
+    for sw in switchList:
+        response = main.Mininet1.getSwController( sw )
+        if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
+            assignResult = assignResult and main.TRUE
+        else:
+            assignResult = main.FALSE
+
+    return switchList
+
+def getHostsData( main ):
+    """
+        Use fwd app and pingall to discover all the hosts
+    """
+    activateResult = main.TRUE
+    appCheck = main.TRUE
+    getDataResult = main.TRUE
+    main.log.info( main.topoName + ": Activating reactive forwarding app " )
+    activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
+    if main.hostsData:
+        main.hostsData = {}
+    for i in range( main.numCtrls ):
+        appCheck = appCheck and main.CLIs[ i ].appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.CLIs[ i ].apps() )
+            main.log.warn( main.CLIs[ i ].appIDs() )
+
+    pingResult = main.Mininet1.pingall( timeout=900 )
+    hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
+    hosts = main.Mininet1.getHosts()
+    for host in hosts:
+        main.hostsData[ host ] = {}
+        main.hostsData[ host ][ 'mac' ] =  \
+            main.Mininet1.getMacAddress( host ).upper()
+        for hostj in hostsJson:
+            if main.hostsData[ host ][ 'mac' ] == hostj[ 'mac' ]:
+                main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
+                main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
+                main.hostsData[ host ][ 'location' ] = \
+                            hostj[ 'location' ][ 'elementId' ] + '/' + \
+                            hostj[ 'location' ][ 'port' ]
+                main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
+
+    if activateResult and main.hostsData:
+        main.log.info( main.topoName + ": Successfully used fwd app" +
+                       " to discover hosts " )
+        getDataResult = main.TRUE
+    else:
+        main.log.info( main.topoName + ": Failed to use fwd app" +
+                       " to discover hosts " )
+        getDataResult = main.FALSE
+
+    # This data can be use later for intents
+    print main.hostsData
+
+    return getDataResult
+
+def restartONOS( main ):
+    """
+    Description:
+        Stop and start ONOS that clears hosts,devices etc. in order to test
+        new mininet topology
+    Return:
+        Retruns main.TRUE for a successful restart, main.FALSE otherwise.
+    """
+    stopResult = []
+    startResult = []
+    restartResult = main.TRUE
+
+    main.log.info( main.topoName + ": Stopping ONOS cluster" )
+    for node in main.nodes:
+        startResult.append( main.ONOSbench.onosStop( nodeIp=node.ip_address ) )
+
+    if all( result == main.TRUE for result in stopResult ):
+        main.log.info( main.topoName + ": Successfully stopped ONOS cluster" )
+    else:
+        restartResult = main.FALSE
+        main.log.error( main.topoName + ": Failed to stop ONOS cluster" )
+
+    time.sleep( 15 )
+
+    main.log.info( main.topoName + ": Starting ONOS cluster" )
+    for node in main.nodes:
+        startResult.append( main.ONOSbench.onosStart( nodeIp=node.ip_address ) )
+
+    if all( result == main.TRUE for result in startResult ):
+        main.log.info( main.topoName + ": Successfully start ONOS cluster" )
+    else:
+        restartResult = main.FALSE
+        main.log.error( main.topoName + ": Failed to start ONOS cluster" )
+
+    # Start ONOS CLIs again
+    main.log.info( main.topoName + ": Starting ONOS CLI" )
+    cliResult = main.TRUE
+    for i in range( main.numCtrls ):
+        cliResult = cliResult and \
+                    main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
+
+    time.sleep( 15 )
+
+    return restartResult
+
+
+
diff --git a/TestON/tests/FuncTopo/FuncTopo.py b/TestON/tests/FuncTopo/FuncTopo.py
new file mode 100644
index 0000000..b2e2a6a
--- /dev/null
+++ b/TestON/tests/FuncTopo/FuncTopo.py
@@ -0,0 +1,218 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import json
+
+class FuncTopo:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE10( self, main ):
+        import time
+        import os
+        import imp
+        """
+        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
+        """
+        global init
+        global globalONOSip
+        try:
+            if type(init) is not bool:
+                init = False
+        except NameError:
+            init = False
+
+        main.wrapper = imp.load_source( 'FuncTopoFunction', '/home/admin/' +
+                                        'TestON/tests/FuncTopo/Dependency/' +
+                                        'FuncTopoFunction.py')
+
+        #Local variables
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        apps = main.params[ 'ENV' ][ 'cellApps' ]
+        gitBranch = main.params[ 'GIT' ][ 'branch' ]
+        benchIp = os.environ[ 'OCN' ]
+        benchUser = main.params[ 'BENCH' ][ 'user' ]
+        topology = main.params[ 'MININET' ][ 'topo' ]
+        main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
+        main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
+        main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
+        main.ONOSport = []
+        main.hostsData = {}
+        main.topoName = " "
+        PULLCODE = False
+        if main.params[ 'GIT' ][ 'pull' ] == 'True':
+            PULLCODE = True
+        main.case( "Setting up test environment" )
+        main.CLIs = []
+        main.nodes = []
+        for i in range( 1, int( main.numCtrls ) + 1 ):
+            main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+            main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+            main.ONOSport.append( main.params[ 'CTRL' ][ 'port' + str( i ) ] )
+
+        # -- INIT SECTION, ONLY RUNS ONCE -- #
+        if init == False:
+            init = True
+
+            main.scale = ( main.params[ 'SCALE' ] ).split( "," )
+            main.numCtrls = int( main.scale[ 0 ] )
+
+            if PULLCODE:
+                main.step( "Git checkout and pull " + gitBranch )
+                main.ONOSbench.gitCheckout( gitBranch )
+                gitPullResult = main.ONOSbench.gitPull()
+                if gitPullResult == main.ERROR:
+                    main.log.error( "Error pulling git branch" )
+                main.step( "Using mvn clean & install" )
+                cleanInstallResult = main.ONOSbench.cleanInstall()
+                stepResult = cleanInstallResult
+                utilities.assert_equals( expect=main.TRUE,
+                                         actual=stepResult,
+                                         onpass="Successfully compiled " +
+                                                "latest ONOS",
+                                         onfail="Failed to compile " +
+                                                "latest ONOS" )
+            else:
+                main.log.warn( "Did not pull new code so skipping mvn " +
+                               "clean install" )
+
+            globalONOSip = main.ONOSbench.getOnosIps()
+        maxNodes = ( len(globalONOSip) - 2 )
+
+        main.numCtrls = int( main.scale[ 0 ] )
+        main.scale.remove( main.scale[ 0 ] )
+
+        main.ONOSip = []
+        for i in range( maxNodes ):
+            main.ONOSip.append( globalONOSip[i] )
+
+        #kill off all onos processes
+        main.log.info( "Safety check, killing all ONOS processes" +
+                       " before initiating enviornment setup" )
+        for i in range(maxNodes):
+            main.ONOSbench.onosDie( globalONOSip[ i ] )
+
+        print "NODE COUNT = ", main.numCtrls
+        main.log.info( "Creating cell file" )
+        cellIp = []
+        for i in range( main.numCtrls ):
+            cellIp.append( str( main.ONOSip[ i ] ) )
+        print cellIp
+        main.ONOSbench.createCellFile( benchIp, cellName, "",
+                                       str( apps ), *cellIp )
+
+        main.step( "Apply cell to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+        stepResult = cellResult and verifyResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully applied cell to " + \
+                                        "environment",
+                                 onfail="Failed to apply cell to environment " )
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+        stepResult = packageResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully created ONOS package",
+                                 onfail="Failed to create ONOS package" )
+
+        main.step( "Uninstalling ONOS package" )
+        onosUninstallResult = main.TRUE
+        for i in range( main.numCtrls ):
+            onosUninstallResult = onosUninstallResult and \
+                    main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
+        stepResult = onosUninstallResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully uninstalled ONOS package",
+                                 onfail="Failed to uninstall ONOS package" )
+        time.sleep( 5 )
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.TRUE
+        for i in range( main.numCtrls ):
+            onosInstallResult = onosInstallResult and \
+                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
+        stepResult = onosInstallResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully installed ONOS package",
+                                 onfail="Failed to install ONOS package" )
+
+        time.sleep( 10 )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
+    def CASE9( self, main ):
+        '''
+            Report errors/warnings/exceptions
+        '''
+        main.log.info("Error report: \n")
+        main.ONOSbench.logReport( globalONOSip[0],
+                                  [ "INFO","FOLLOWER","WARN",
+                                    "flow","ERROR","Except" ],
+                                  "s" )
+        #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
+
+    def CASE1001( self, main ):
+        """
+            Test topology discovery
+        """
+        main.case( "Topology discovery test" )
+
+
+        main.step( "Torus 5-5 topology" )
+        main.topoName = "TORUS5-5"
+        mnCmd = "mn --topo=torus,5,5 --mac"
+        stepResult = main.wrapper.testTopology( main,
+                                                mnCmd=mnCmd,
+                                                clean=False )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Torus 5-5 topology successful",
+                                 onfail="Torus 5-5 topology failed" )
+
+        main.topoName = "TREE3-3"
+        stepResult = main.TRUE
+        main.step( "Tree 3-3 topology" )
+        mnCmd = "mn --topo=tree,3,3 --mac"
+        stepResult = main.wrapper.testTopology( main,
+                                                mnCmd=mnCmd,
+                                                clean=True )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Tree 3-3 topology successful",
+                                 onfail="Tree 3-3 topology failed" )
diff --git a/TestON/tests/FuncNext13/__init__.py b/TestON/tests/FuncTopo/__init__.py
similarity index 100%
rename from TestON/tests/FuncNext13/__init__.py
rename to TestON/tests/FuncTopo/__init__.py
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
index c1bd2f0..4ecc271 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
@@ -270,19 +270,13 @@
                                 "master of the device."
         main.step( "Assign switches to controllers" )
 
-        # TODO: rewrite this function to take lists of ips and ports?
-        #       or list of tuples?
+        ipList = []
+        for i in range( numControllers ):
+            ipList.append( nodes[ i ].ip_address )
+        swList = []
         for i in range( 1, 29 ):
-            main.Mininet1.assignSwController(
-                sw=str( i ),
-                count=numControllers,
-                ip1=nodes[ 0 ].ip_address, port1=ONOS1Port,
-                ip2=nodes[ 1 ].ip_address, port2=ONOS2Port,
-                ip3=nodes[ 2 ].ip_address, port3=ONOS3Port,
-                ip4=nodes[ 3 ].ip_address, port4=ONOS4Port,
-                ip5=nodes[ 4 ].ip_address, port5=ONOS5Port,
-                ip6=nodes[ 5 ].ip_address, port6=ONOS6Port,
-                ip7=nodes[ 6 ].ip_address, port7=ONOS7Port )
+            swList.append( "s" + str( i ) )
+        main.Mininet1.assignSwController( sw=swList, ip=ipList )
 
         mastershipCheck = main.TRUE
         for i in range( 1, 29 ):
@@ -479,12 +473,13 @@
         for i in range(2):  # Retry if pingall fails first time
             time1 = time.time()
             pingResult = main.Mininet1.pingall()
-            utilities.assert_equals(
-                expect=main.TRUE,
-                actual=pingResult,
-                onpass="Reactive Pingall test passed",
-                onfail="Reactive Pingall failed, " +
-                       "one or more ping pairs failed" )
+            if i == 0:
+                utilities.assert_equals(
+                    expect=main.TRUE,
+                    actual=pingResult,
+                    onpass="Reactive Pingall test passed",
+                    onfail="Reactive Pingall failed, " +
+                           "one or more ping pairs failed" )
             time2 = time.time()
             main.log.info( "Time for pingall: %2f seconds" %
                            ( time2 - time1 ) )
@@ -682,7 +677,7 @@
                 main.log.debug( "Intents in " + cli.name + ": " +
                                 str( sorted( onosIds ) ) )
                 if sorted( ids ) != sorted( intentIds ):
-                    main.log.debug( "Set of intent IDs doesn't match" )
+                    main.log.warn( "Set of intent IDs doesn't match" )
                     correct = False
                     break
                 else:
@@ -1109,8 +1104,6 @@
         assert utilities.assert_equals, "utilities.assert_equals not defined"
         assert CLIs, "CLIs not defined"
         assert nodes, "nodes not defined"
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
 
         main.case( "Setting up and gathering data for current state" )
         # The general idea for this test case is to pull the state of
@@ -1422,13 +1415,6 @@
             target=main.params[ 'PING' ][ 'target10' ],
             pingTime=500 )
 
-        main.step( "Create TestONTopology object" )
-        ctrls = []
-        for node in nodes:
-            temp = ( node, node.name, node.ip_address, 6633 )
-            ctrls.append( temp )
-        MNTopo = TestONTopology( main.Mininet1, ctrls )
-
         main.step( "Collecting topology information from ONOS" )
         devices = []
         threads = []
@@ -1586,14 +1572,21 @@
 
         main.step( "Comparing ONOS topology to MN" )
         devicesResults = main.TRUE
-        portsResults = main.TRUE
         linksResults = main.TRUE
+        hostsResults = main.TRUE
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
+        mnHosts = main.Mininet1.getHosts()
         for controller in range( numControllers ):
             controllerStr = str( controller + 1 )
-            if devices[ controller ] or "Error" not in devices[ controller ]:
+            if devices[ controller ] and ports[ controller ] and\
+                "Error" not in devices[ controller ] and\
+                "Error" not in ports[ controller ]:
+
                 currentDevicesResult = main.Mininet1.compareSwitches(
-                    MNTopo,
-                    json.loads( devices[ controller ] ) )
+                        mnSwitches,
+                        json.loads( devices[ controller ] ),
+                        json.loads( ports[ controller ] ) )
             else:
                 currentDevicesResult = main.FALSE
             utilities.assert_equals( expect=main.TRUE,
@@ -1602,24 +1595,10 @@
                                      " 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 links[ controller ] or "Error" not in links[ controller ]:
+            if links[ controller ] and "Error" not in links[ controller ]:
                 currentLinksResult = main.Mininet1.compareLinks(
-                    MNTopo,
-                    json.loads( links[ controller ] ) )
+                        mnSwitches, mnLinks,
+                        json.loads( links[ controller ] ) )
             else:
                 currentLinksResult = main.FALSE
             utilities.assert_equals( expect=main.TRUE,
@@ -1629,16 +1608,43 @@
                                      onfail="ONOS" + controllerStr +
                                      " links view is incorrect" )
 
-            devicesResults = devicesResults and currentDevicesResult
-            portsResults = portsResults and currentPortsResult
-            linksResults = linksResults and currentLinksResult
+            if hosts[ controller ] or "Error" not in hosts[ controller ]:
+                currentHostsResult = main.Mininet1.compareHosts(
+                        mnHosts,
+                        hosts[ controller ] )
+            else:
+                currentHostsResult = main.FALSE
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=currentHostsResult,
+                                     onpass="ONOS" + controllerStr +
+                                     " hosts exist in Mininet",
+                                     onfail="ONOS" + controllerStr +
+                                     " hosts don't match Mininet" )
 
-        topoResult = ( devicesResults and portsResults and linksResults
-                       and consistentHostsResult and consistentClustersResult
-                       and clusterResults and ipResult )
-        utilities.assert_equals( expect=main.TRUE, actual=topoResult,
-                                 onpass="Topology Check Test successful",
-                                 onfail="Topology Check Test NOT successful" )
+            devicesResults = devicesResults and currentDevicesResult
+            linksResults = linksResults and currentLinksResult
+            hostsResults = hostsResults and currentHostsResult
+
+        main.step( "Device information is correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=devicesResults,
+            onpass="Device information is correct",
+            onfail="Device information is incorrect" )
+
+        main.step( "Links are correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linksResults,
+            onpass="Link are correct",
+            onfail="Links are incorrect" )
+
+        main.step( "Hosts are correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=hostsResults,
+            onpass="Hosts are correct",
+            onfail="Hosts are incorrect" )
 
     def CASE6( self, main ):
         """
@@ -2084,11 +2090,6 @@
         """
         Compare topo
         """
-        import sys
-        # FIXME add this path to params
-        sys.path.append( "/home/admin/sts" )
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
         import json
         import time
         assert numControllers, "numControllers not defined"
@@ -2100,25 +2101,9 @@
         main.case( "Compare ONOS Topology view to Mininet topology" )
         main.caseExplaination = "Compare topology objects between Mininet" +\
                                 " and ONOS"
-        main.step( "Create TestONTopology object" )
-        try:
-            ctrls = []
-            for node in nodes:
-                temp = ( node, node.name, node.ip_address, 6633 )
-                ctrls.append( temp )
-            MNTopo = TestONTopology( main.Mininet1, ctrls )
-        except Exception:
-            objResult = main.FALSE
-        else:
-            objResult = main.TRUE
-        utilities.assert_equals( expect=main.TRUE, actual=objResult,
-                                 onpass="Created TestONTopology object",
-                                 onfail="Exception while creating " +
-                                        "TestONTopology object" )
 
         main.step( "Comparing ONOS topology to MN" )
         devicesResults = main.TRUE
-        portsResults = main.TRUE
         linksResults = main.TRUE
         hostsResults = main.TRUE
         hostAttachmentResults = True
@@ -2130,9 +2115,6 @@
         # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
             count += 1
-            if count > 1:
-                # TODO: Deprecate STS usage
-                MNTopo = TestONTopology( main.Mininet1, ctrls )
             cliStart = time.time()
             devices = []
             threads = []
@@ -2213,13 +2195,19 @@
             print "Elapsed time: " + str( elapsed )
             print "CLI time: " + str( cliTime )
 
+            mnSwitches = main.Mininet1.getSwitches()
+            mnLinks = main.Mininet1.getLinks()
+            mnHosts = main.Mininet1.getHosts()
             for controller in range( numControllers ):
                 controllerStr = str( controller + 1 )
-                if devices[ controller ] or "Error" not in devices[
-                        controller ]:
+                if devices[ controller ] and ports[ controller ] and\
+                    "Error" not in devices[ controller ] and\
+                    "Error" not in ports[ controller ]:
+
                     currentDevicesResult = main.Mininet1.compareSwitches(
-                        MNTopo,
-                        json.loads( devices[ controller ] ) )
+                            mnSwitches,
+                            json.loads( devices[ controller ] ),
+                            json.loads( ports[ controller ] ) )
                 else:
                     currentDevicesResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -2229,23 +2217,10 @@
                                          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 links[ controller ] or "Error" not in links[ controller ]:
+                if links[ controller ] and "Error" not in links[ controller ]:
                     currentLinksResult = main.Mininet1.compareLinks(
-                        MNTopo,
-                        json.loads( links[ controller ] ) )
+                            mnSwitches, mnLinks,
+                            json.loads( links[ controller ] ) )
                 else:
                     currentLinksResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -2257,7 +2232,8 @@
 
                 if hosts[ controller ] or "Error" not in hosts[ controller ]:
                     currentHostsResult = main.Mininet1.compareHosts(
-                        MNTopo, hosts[ controller ] )
+                            mnHosts,
+                            hosts[ controller ] )
                 else:
                     currentHostsResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -2268,7 +2244,7 @@
                                          " hosts don't match Mininet" )
                 # CHECKING HOST ATTACHMENT POINTS
                 hostAttachment = True
-                zeroHosts = False
+                noHosts = False
                 # FIXME: topo-HA/obelisk specific mappings:
                 # key is mac and value is dpid
                 mappings = {}
@@ -2301,7 +2277,7 @@
                 if hosts[ controller ] or "Error" not in hosts[ controller ]:
                     if hosts[ controller ] == []:
                         main.log.warn( "There are no hosts discovered" )
-                        zeroHosts = True
+                        noHosts = True
                     else:
                         for host in hosts[ controller ]:
                             mac = None
@@ -2345,17 +2321,20 @@
                     main.log.error( "No hosts json output or \"Error\"" +
                                     " in output. hosts = " +
                                     repr( hosts[ controller ] ) )
-                if zeroHosts:
+                if noHosts is False:
                     # TODO: Find a way to know if there should be hosts in a
                     #       given point of the test
                     hostAttachment = True
 
                 # END CHECKING HOST ATTACHMENT POINTS
                 devicesResults = devicesResults and currentDevicesResult
-                portsResults = portsResults and currentPortsResult
                 linksResults = linksResults and currentLinksResult
                 hostsResults = hostsResults and currentHostsResult
-                hostAttachmentResults = hostAttachmentResults and hostAttachment
+                hostAttachmentResults = hostAttachmentResults and\
+                                        hostAttachment
+                topoResult = ( devicesResults and linksResults
+                               and hostsResults and ipResult and
+                               hostAttachmentResults )
 
         # Compare json objects for hosts and dataplane clusters
 
@@ -2444,7 +2423,7 @@
             onpass="ONOS shows 1 SCC",
             onfail="ONOS shows " + str( numClusters ) + " SCCs" )
 
-        topoResult = ( devicesResults and portsResults and linksResults
+        topoResult = ( devicesResults and linksResults
                        and hostsResults and consistentHostsResult
                        and consistentClustersResult and clusterResults
                        and ipResult and hostAttachmentResults )
@@ -2465,13 +2444,6 @@
             onpass="Device information is correct",
             onfail="Device information is incorrect" )
 
-        main.step( "Port information is correct" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=portsResults,
-            onpass="Port information is correct",
-            onfail="Port information is incorrect" )
-
         main.step( "Links are correct" )
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2641,22 +2613,10 @@
         main.Mininet1.addSwitch( switch, dpid=switchDPID )
         for peer in links:
             main.Mininet1.addLink( switch, peer )
-        main.Mininet1.assignSwController( sw=switch.split( 's' )[ 1 ],
-                                          count=numControllers,
-                                          ip1=nodes[ 0 ].ip_address,
-                                          port1=ONOS1Port,
-                                          ip2=nodes[ 1 ].ip_address,
-                                          port2=ONOS2Port,
-                                          ip3=nodes[ 2 ].ip_address,
-                                          port3=ONOS3Port,
-                                          ip4=nodes[ 3 ].ip_address,
-                                          port4=ONOS4Port,
-                                          ip5=nodes[ 4 ].ip_address,
-                                          port5=ONOS5Port,
-                                          ip6=nodes[ 5 ].ip_address,
-                                          port6=ONOS6Port,
-                                          ip7=nodes[ 6 ].ip_address,
-                                          port7=ONOS7Port )
+        ipList = []
+        for i in range( numControllers ):
+            ipList.append( nodes[ i ].ip_address )
+        main.Mininet1.assignSwController( sw=switch, ip=ipList )
         main.log.info( "Waiting " + str( switchSleep ) +
                        " seconds for switch up to be discovered" )
         time.sleep( switchSleep )
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
index 08d81c2..a81845f 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
@@ -265,19 +265,13 @@
                                 "master of the device."
         main.step( "Assign switches to controllers" )
 
-        # TODO: rewrite this function to take lists of ips and ports?
-        #       or list of tuples?
+        ipList = []
+        for i in range( numControllers ):
+            ipList.append( nodes[ i ].ip_address )
+        swList = []
         for i in range( 1, 29 ):
-            main.Mininet1.assignSwController(
-                sw=str( i ),
-                count=numControllers,
-                ip1=nodes[ 0 ].ip_address, port1=ONOS1Port,
-                ip2=nodes[ 1 ].ip_address, port2=ONOS2Port,
-                ip3=nodes[ 2 ].ip_address, port3=ONOS3Port,
-                ip4=nodes[ 3 ].ip_address, port4=ONOS4Port,
-                ip5=nodes[ 4 ].ip_address, port5=ONOS5Port,
-                ip6=nodes[ 5 ].ip_address, port6=ONOS6Port,
-                ip7=nodes[ 6 ].ip_address, port7=ONOS7Port )
+            swList.append( "s" + str( i ) )
+        main.Mininet1.assignSwController( sw=swList, ip=ipList )
 
         mastershipCheck = main.TRUE
         for i in range( 1, 29 ):
@@ -462,12 +456,13 @@
         for i in range(2):  # Retry if pingall fails first time
             time1 = time.time()
             pingResult = main.Mininet1.pingall()
-            utilities.assert_equals(
-                expect=main.TRUE,
-                actual=pingResult,
-                onpass="Reactive Pingall test passed",
-                onfail="Reactive Pingall failed, " +
-                       "one or more ping pairs failed" )
+            if i == 0:
+                utilities.assert_equals(
+                    expect=main.TRUE,
+                    actual=pingResult,
+                    onpass="Reactive Pingall test passed",
+                    onfail="Reactive Pingall failed, " +
+                           "one or more ping pairs failed" )
             time2 = time.time()
             main.log.info( "Time for pingall: %2f seconds" %
                            ( time2 - time1 ) )
@@ -665,7 +660,7 @@
                 main.log.debug( "Intents in " + cli.name + ": " +
                                 str( sorted( onosIds ) ) )
                 if sorted( ids ) != sorted( intentIds ):
-                    main.log.debug( "Set of intent IDs doesn't match" )
+                    main.log.warn( "Set of intent IDs doesn't match" )
                     correct = False
                     break
                 else:
@@ -1082,8 +1077,6 @@
         assert utilities.assert_equals, "utilities.assert_equals not defined"
         assert CLIs, "CLIs not defined"
         assert nodes, "nodes not defined"
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
 
         main.case( "Setting up and gathering data for current state" )
         # The general idea for this test case is to pull the state of
@@ -1395,13 +1388,6 @@
             target=main.params[ 'PING' ][ 'target10' ],
             pingTime=500 )
 
-        main.step( "Create TestONTopology object" )
-        ctrls = []
-        for node in nodes:
-            temp = ( node, node.name, node.ip_address, 6633 )
-            ctrls.append( temp )
-        MNTopo = TestONTopology( main.Mininet1, ctrls )
-
         main.step( "Collecting topology information from ONOS" )
         devices = []
         threads = []
@@ -1559,14 +1545,21 @@
 
         main.step( "Comparing ONOS topology to MN" )
         devicesResults = main.TRUE
-        portsResults = main.TRUE
         linksResults = main.TRUE
+        hostsResults = main.TRUE
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
+        mnHosts = main.Mininet1.getHosts()
         for controller in range( numControllers ):
             controllerStr = str( controller + 1 )
-            if devices[ controller ] or "Error" not in devices[ controller ]:
+            if devices[ controller ] and ports[ controller ] and\
+                "Error" not in devices[ controller ] and\
+                "Error" not in ports[ controller ]:
+
                 currentDevicesResult = main.Mininet1.compareSwitches(
-                    MNTopo,
-                    json.loads( devices[ controller ] ) )
+                        mnSwitches,
+                        json.loads( devices[ controller ] ),
+                        json.loads( ports[ controller ] ) )
             else:
                 currentDevicesResult = main.FALSE
             utilities.assert_equals( expect=main.TRUE,
@@ -1575,24 +1568,10 @@
                                      " 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 links[ controller ] or "Error" not in links[ controller ]:
+            if links[ controller ] and "Error" not in links[ controller ]:
                 currentLinksResult = main.Mininet1.compareLinks(
-                    MNTopo,
-                    json.loads( links[ controller ] ) )
+                        mnSwitches, mnLinks,
+                        json.loads( links[ controller ] ) )
             else:
                 currentLinksResult = main.FALSE
             utilities.assert_equals( expect=main.TRUE,
@@ -1602,16 +1581,43 @@
                                      onfail="ONOS" + controllerStr +
                                      " links view is incorrect" )
 
-            devicesResults = devicesResults and currentDevicesResult
-            portsResults = portsResults and currentPortsResult
-            linksResults = linksResults and currentLinksResult
+            if hosts[ controller ] or "Error" not in hosts[ controller ]:
+                currentHostsResult = main.Mininet1.compareHosts(
+                        mnHosts,
+                        hosts[ controller ] )
+            else:
+                currentHostsResult = main.FALSE
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=currentHostsResult,
+                                     onpass="ONOS" + controllerStr +
+                                     " hosts exist in Mininet",
+                                     onfail="ONOS" + controllerStr +
+                                     " hosts don't match Mininet" )
 
-        topoResult = ( devicesResults and portsResults and linksResults
-                       and consistentHostsResult and consistentClustersResult
-                       and clusterResults and ipResult )
-        utilities.assert_equals( expect=main.TRUE, actual=topoResult,
-                                 onpass="Topology Check Test successful",
-                                 onfail="Topology Check Test NOT successful" )
+            devicesResults = devicesResults and currentDevicesResult
+            linksResults = linksResults and currentLinksResult
+            hostsResults = hostsResults and currentHostsResult
+
+        main.step( "Device information is correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=devicesResults,
+            onpass="Device information is correct",
+            onfail="Device information is incorrect" )
+
+        main.step( "Links are correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linksResults,
+            onpass="Link are correct",
+            onfail="Links are incorrect" )
+
+        main.step( "Hosts are correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=hostsResults,
+            onpass="Hosts are correct",
+            onfail="Hosts are incorrect" )
 
     def CASE6( self, main ):
         """
@@ -2032,11 +2038,6 @@
         """
         Compare topo
         """
-        import sys
-        # FIXME add this path to params
-        sys.path.append( "/home/admin/sts" )
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
         import json
         import time
         assert numControllers, "numControllers not defined"
@@ -2048,25 +2049,9 @@
         main.case( "Compare ONOS Topology view to Mininet topology" )
         main.caseExplaination = "Compare topology objects between Mininet" +\
                                 " and ONOS"
-        main.step( "Create TestONTopology object" )
-        try:
-            ctrls = []
-            for node in nodes:
-                temp = ( node, node.name, node.ip_address, 6633 )
-                ctrls.append( temp )
-            MNTopo = TestONTopology( main.Mininet1, ctrls )
-        except Exception:
-            objResult = main.FALSE
-        else:
-            objResult = main.TRUE
-        utilities.assert_equals( expect=main.TRUE, actual=objResult,
-                                 onpass="Created TestONTopology object",
-                                 onfail="Exception while creating " +
-                                        "TestONTopology object" )
 
         main.step( "Comparing ONOS topology to MN" )
         devicesResults = main.TRUE
-        portsResults = main.TRUE
         linksResults = main.TRUE
         hostsResults = main.TRUE
         hostAttachmentResults = True
@@ -2078,9 +2063,6 @@
         # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
             count += 1
-            if count > 1:
-                # TODO: Deprecate STS usage
-                MNTopo = TestONTopology( main.Mininet1, ctrls )
             cliStart = time.time()
             devices = []
             threads = []
@@ -2161,13 +2143,19 @@
             print "Elapsed time: " + str( elapsed )
             print "CLI time: " + str( cliTime )
 
+            mnSwitches = main.Mininet1.getSwitches()
+            mnLinks = main.Mininet1.getLinks()
+            mnHosts = main.Mininet1.getHosts()
             for controller in range( numControllers ):
                 controllerStr = str( controller + 1 )
-                if devices[ controller ] or "Error" not in devices[
-                        controller ]:
+                if devices[ controller ] and ports[ controller ] and\
+                    "Error" not in devices[ controller ] and\
+                    "Error" not in ports[ controller ]:
+
                     currentDevicesResult = main.Mininet1.compareSwitches(
-                        MNTopo,
-                        json.loads( devices[ controller ] ) )
+                            mnSwitches,
+                            json.loads( devices[ controller ] ),
+                            json.loads( ports[ controller ] ) )
                 else:
                     currentDevicesResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -2177,23 +2165,10 @@
                                          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 links[ controller ] or "Error" not in links[ controller ]:
+                if links[ controller ] and "Error" not in links[ controller ]:
                     currentLinksResult = main.Mininet1.compareLinks(
-                        MNTopo,
-                        json.loads( links[ controller ] ) )
+                            mnSwitches, mnLinks,
+                            json.loads( links[ controller ] ) )
                 else:
                     currentLinksResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -2205,7 +2180,8 @@
 
                 if hosts[ controller ] or "Error" not in hosts[ controller ]:
                     currentHostsResult = main.Mininet1.compareHosts(
-                        MNTopo, hosts[ controller ] )
+                            mnHosts,
+                            hosts[ controller ] )
                 else:
                     currentHostsResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -2216,7 +2192,7 @@
                                          " hosts don't match Mininet" )
                 # CHECKING HOST ATTACHMENT POINTS
                 hostAttachment = True
-                noHosts = False
+                zeroHosts = False
                 # FIXME: topo-HA/obelisk specific mappings:
                 # key is mac and value is dpid
                 mappings = {}
@@ -2249,7 +2225,7 @@
                 if hosts[ controller ] or "Error" not in hosts[ controller ]:
                     if hosts[ controller ] == []:
                         main.log.warn( "There are no hosts discovered" )
-                        noHosts = True
+                        zeroHosts = True
                     else:
                         for host in hosts[ controller ]:
                             mac = None
@@ -2293,15 +2269,15 @@
                     main.log.error( "No hosts json output or \"Error\"" +
                                     " in output. hosts = " +
                                     repr( hosts[ controller ] ) )
-                if noHosts is False:
+                if zeroHosts is False:
                     hostAttachment = True
 
                 # END CHECKING HOST ATTACHMENT POINTS
                 devicesResults = devicesResults and currentDevicesResult
-                portsResults = portsResults and currentPortsResult
                 linksResults = linksResults and currentLinksResult
                 hostsResults = hostsResults and currentHostsResult
-                hostAttachmentResults = hostAttachmentResults and hostAttachment
+                hostAttachmentResults = hostAttachmentResults and\
+                                        hostAttachment
 
         # Compare json objects for hosts and dataplane clusters
 
@@ -2390,7 +2366,7 @@
             onpass="ONOS shows 1 SCC",
             onfail="ONOS shows " + str( numClusters ) + " SCCs" )
 
-        topoResult = ( devicesResults and portsResults and linksResults
+        topoResult = ( devicesResults and linksResults
                        and hostsResults and consistentHostsResult
                        and consistentClustersResult and clusterResults
                        and ipResult and hostAttachmentResults )
@@ -2411,13 +2387,6 @@
             onpass="Device information is correct",
             onfail="Device information is incorrect" )
 
-        main.step( "Port information is correct" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=portsResults,
-            onpass="Port information is correct",
-            onfail="Port information is incorrect" )
-
         main.step( "Links are correct" )
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2587,22 +2556,10 @@
         main.Mininet1.addSwitch( switch, dpid=switchDPID )
         for peer in links:
             main.Mininet1.addLink( switch, peer )
-        main.Mininet1.assignSwController( sw=switch.split( 's' )[ 1 ],
-                                          count=numControllers,
-                                          ip1=nodes[ 0 ].ip_address,
-                                          port1=ONOS1Port,
-                                          ip2=nodes[ 1 ].ip_address,
-                                          port2=ONOS2Port,
-                                          ip3=nodes[ 2 ].ip_address,
-                                          port3=ONOS3Port,
-                                          ip4=nodes[ 3 ].ip_address,
-                                          port4=ONOS4Port,
-                                          ip5=nodes[ 4 ].ip_address,
-                                          port5=ONOS5Port,
-                                          ip6=nodes[ 5 ].ip_address,
-                                          port6=ONOS6Port,
-                                          ip7=nodes[ 6 ].ip_address,
-                                          port7=ONOS7Port )
+        ipList = []
+        for i in range( numControllers ):
+            ipList.append( nodes[ i ].ip_address )
+        main.Mininet1.assignSwController( sw=switch, ip=ipList )
         main.log.info( "Waiting " + str( switchSleep ) +
                        " seconds for switch up to be discovered" )
         time.sleep( switchSleep )
diff --git a/TestON/tests/HATestSanity/HATestSanity.py b/TestON/tests/HATestSanity/HATestSanity.py
index 306e547..8d952c7 100644
--- a/TestON/tests/HATestSanity/HATestSanity.py
+++ b/TestON/tests/HATestSanity/HATestSanity.py
@@ -265,19 +265,13 @@
                                 "master of the device."
         main.step( "Assign switches to controllers" )
 
-        # TODO: rewrite this function to take lists of ips and ports?
-        #       or list of tuples?
+        ipList = []
+        for i in range( numControllers ):
+            ipList.append( nodes[ i ].ip_address )
+        swList = []
         for i in range( 1, 29 ):
-            main.Mininet1.assignSwController(
-                sw=str( i ),
-                count=numControllers,
-                ip1=nodes[ 0 ].ip_address, port1=ONOS1Port,
-                ip2=nodes[ 1 ].ip_address, port2=ONOS2Port,
-                ip3=nodes[ 2 ].ip_address, port3=ONOS3Port,
-                ip4=nodes[ 3 ].ip_address, port4=ONOS4Port,
-                ip5=nodes[ 4 ].ip_address, port5=ONOS5Port,
-                ip6=nodes[ 5 ].ip_address, port6=ONOS6Port,
-                ip7=nodes[ 6 ].ip_address, port7=ONOS7Port )
+            swList.append( "s" + str( i ) )
+        main.Mininet1.assignSwController( sw=swList, ip=ipList )
 
         mastershipCheck = main.TRUE
         for i in range( 1, 29 ):
@@ -462,12 +456,13 @@
         for i in range(2):  # Retry if pingall fails first time
             time1 = time.time()
             pingResult = main.Mininet1.pingall()
-            utilities.assert_equals(
-                expect=main.TRUE,
-                actual=pingResult,
-                onpass="Reactive Pingall test passed",
-                onfail="Reactive Pingall failed, " +
-                       "one or more ping pairs failed" )
+            if i == 0:
+                utilities.assert_equals(
+                    expect=main.TRUE,
+                    actual=pingResult,
+                    onpass="Reactive Pingall test passed",
+                    onfail="Reactive Pingall failed, " +
+                           "one or more ping pairs failed" )
             time2 = time.time()
             main.log.info( "Time for pingall: %2f seconds" %
                            ( time2 - time1 ) )
@@ -670,7 +665,7 @@
                 main.log.debug( "Intents in " + cli.name + ": " +
                                 str( sorted( onosIds ) ) )
                 if sorted( ids ) != sorted( intentIds ):
-                    main.log.debug( "Set of intent IDs doesn't match" )
+                    main.log.warn( "Set of intent IDs doesn't match" )
                     correct = False
                     break
                 else:
@@ -854,6 +849,7 @@
             intents = main.ONOScli1.intents()
             intentStates = []
             main.log.info( "%-6s%-15s%-15s" % ( 'Count', 'ID', 'State' ) )
+            count = 0
             # Iter through intents of a node
             try:
                 for intent in json.loads( intents ):
@@ -1086,8 +1082,6 @@
         assert utilities.assert_equals, "utilities.assert_equals not defined"
         assert CLIs, "CLIs not defined"
         assert nodes, "nodes not defined"
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
 
         main.case( "Setting up and gathering data for current state" )
         # The general idea for this test case is to pull the state of
@@ -1404,13 +1398,6 @@
             target=main.params[ 'PING' ][ 'target10' ],
             pingTime=500 )
 
-        main.step( "Create TestONTopology object" )
-        ctrls = []
-        for node in nodes:
-            temp = ( node, node.name, node.ip_address, 6633 )
-            ctrls.append( temp )
-        MNTopo = TestONTopology( main.Mininet1, ctrls )
-
         main.step( "Collecting topology information from ONOS" )
         devices = []
         threads = []
@@ -1568,14 +1555,21 @@
 
         main.step( "Comparing ONOS topology to MN" )
         devicesResults = main.TRUE
-        portsResults = main.TRUE
         linksResults = main.TRUE
+        hostsResults = main.TRUE
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
+        mnHosts = main.Mininet1.getHosts()
         for controller in range( numControllers ):
             controllerStr = str( controller + 1 )
-            if devices[ controller ] or "Error" not in devices[ controller ]:
+            if devices[ controller ] and ports[ controller ] and\
+                "Error" not in devices[ controller ] and\
+                "Error" not in ports[ controller ]:
+
                 currentDevicesResult = main.Mininet1.compareSwitches(
-                    MNTopo,
-                    json.loads( devices[ controller ] ) )
+                        mnSwitches,
+                        json.loads( devices[ controller ] ),
+                        json.loads( ports[ controller ] ) )
             else:
                 currentDevicesResult = main.FALSE
             utilities.assert_equals( expect=main.TRUE,
@@ -1584,24 +1578,10 @@
                                      " 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 links[ controller ] or "Error" not in links[ controller ]:
+            if links[ controller ] and "Error" not in links[ controller ]:
                 currentLinksResult = main.Mininet1.compareLinks(
-                    MNTopo,
-                    json.loads( links[ controller ] ) )
+                        mnSwitches, mnLinks,
+                        json.loads( links[ controller ] ) )
             else:
                 currentLinksResult = main.FALSE
             utilities.assert_equals( expect=main.TRUE,
@@ -1611,16 +1591,43 @@
                                      onfail="ONOS" + controllerStr +
                                      " links view is incorrect" )
 
-            devicesResults = devicesResults and currentDevicesResult
-            portsResults = portsResults and currentPortsResult
-            linksResults = linksResults and currentLinksResult
+            if hosts[ controller ] or "Error" not in hosts[ controller ]:
+                currentHostsResult = main.Mininet1.compareHosts(
+                        mnHosts,
+                        hosts[ controller ] )
+            else:
+                currentHostsResult = main.FALSE
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=currentHostsResult,
+                                     onpass="ONOS" + controllerStr +
+                                     " hosts exist in Mininet",
+                                     onfail="ONOS" + controllerStr +
+                                     " hosts don't match Mininet" )
 
-        topoResult = ( devicesResults and portsResults and linksResults
-                       and consistentHostsResult and consistentClustersResult
-                       and clusterResults and ipResult )
-        utilities.assert_equals( expect=main.TRUE, actual=topoResult,
-                                 onpass="Topology Check Test successful",
-                                 onfail="Topology Check Test NOT successful" )
+            devicesResults = devicesResults and currentDevicesResult
+            linksResults = linksResults and currentLinksResult
+            hostsResults = hostsResults and currentHostsResult
+
+        main.step( "Device information is correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=devicesResults,
+            onpass="Device information is correct",
+            onfail="Device information is incorrect" )
+
+        main.step( "Links are correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linksResults,
+            onpass="Link are correct",
+            onfail="Links are incorrect" )
+
+        main.step( "Hosts are correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=hostsResults,
+            onpass="Hosts are correct",
+            onfail="Hosts are incorrect" )
 
     def CASE6( self, main ):
         """
@@ -1983,11 +1990,6 @@
         """
         Compare topo
         """
-        import sys
-        # FIXME add this path to params
-        sys.path.append( "/home/admin/sts" )
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
         import json
         import time
         assert numControllers, "numControllers not defined"
@@ -1999,25 +2001,9 @@
         main.case( "Compare ONOS Topology view to Mininet topology" )
         main.caseExplaination = "Compare topology objects between Mininet" +\
                                 " and ONOS"
-        main.step( "Create TestONTopology object" )
-        try:
-            ctrls = []
-            for node in nodes:
-                temp = ( node, node.name, node.ip_address, 6633 )
-                ctrls.append( temp )
-            MNTopo = TestONTopology( main.Mininet1, ctrls )
-        except Exception:
-            objResult = main.FALSE
-        else:
-            objResult = main.TRUE
-        utilities.assert_equals( expect=main.TRUE, actual=objResult,
-                                 onpass="Created TestONTopology object",
-                                 onfail="Exception while creating " +
-                                        "TestONTopology object" )
 
         main.step( "Comparing ONOS topology to MN" )
         devicesResults = main.TRUE
-        portsResults = main.TRUE
         linksResults = main.TRUE
         hostsResults = main.TRUE
         hostAttachmentResults = True
@@ -2029,9 +2015,6 @@
         # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
             count += 1
-            if count > 1:
-                # TODO: Deprecate STS usage
-                MNTopo = TestONTopology( main.Mininet1, ctrls )
             cliStart = time.time()
             devices = []
             threads = []
@@ -2112,13 +2095,19 @@
             print "Elapsed time: " + str( elapsed )
             print "CLI time: " + str( cliTime )
 
+            mnSwitches = main.Mininet1.getSwitches()
+            mnLinks = main.Mininet1.getLinks()
+            mnHosts = main.Mininet1.getHosts()
             for controller in range( numControllers ):
                 controllerStr = str( controller + 1 )
-                if devices[ controller ] or "Error" not in devices[
-                        controller ]:
+                if devices[ controller ] and ports[ controller ] and\
+                    "Error" not in devices[ controller ] and\
+                    "Error" not in ports[ controller ]:
+
                     currentDevicesResult = main.Mininet1.compareSwitches(
-                        MNTopo,
-                        json.loads( devices[ controller ] ) )
+                            mnSwitches,
+                            json.loads( devices[ controller ] ),
+                            json.loads( ports[ controller ] ) )
                 else:
                     currentDevicesResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -2128,23 +2117,10 @@
                                          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 links[ controller ] or "Error" not in links[ controller ]:
+                if links[ controller ] and "Error" not in links[ controller ]:
                     currentLinksResult = main.Mininet1.compareLinks(
-                        MNTopo,
-                        json.loads( links[ controller ] ) )
+                            mnSwitches, mnLinks,
+                            json.loads( links[ controller ] ) )
                 else:
                     currentLinksResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -2156,7 +2132,8 @@
 
                 if hosts[ controller ] or "Error" not in hosts[ controller ]:
                     currentHostsResult = main.Mininet1.compareHosts(
-                        MNTopo, hosts[ controller ] )
+                            mnHosts,
+                            hosts[ controller ] )
                 else:
                     currentHostsResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -2167,7 +2144,7 @@
                                          " hosts don't match Mininet" )
                 # CHECKING HOST ATTACHMENT POINTS
                 hostAttachment = True
-                noHosts = False
+                zeroHosts = False
                 # FIXME: topo-HA/obelisk specific mappings:
                 # key is mac and value is dpid
                 mappings = {}
@@ -2200,7 +2177,7 @@
                 if hosts[ controller ] or "Error" not in hosts[ controller ]:
                     if hosts[ controller ] == []:
                         main.log.warn( "There are no hosts discovered" )
-                        noHosts = True
+                        zeroHosts = True
                     else:
                         for host in hosts[ controller ]:
                             mac = None
@@ -2244,15 +2221,18 @@
                     main.log.error( "No hosts json output or \"Error\"" +
                                     " in output. hosts = " +
                                     repr( hosts[ controller ] ) )
-                if noHosts is False:
+                if zeroHosts is False:
                     hostAttachment = True
 
                 # END CHECKING HOST ATTACHMENT POINTS
                 devicesResults = devicesResults and currentDevicesResult
-                portsResults = portsResults and currentPortsResult
                 linksResults = linksResults and currentLinksResult
                 hostsResults = hostsResults and currentHostsResult
-                hostAttachmentResults = hostAttachmentResults and hostAttachment
+                hostAttachmentResults = hostAttachmentResults and\
+                                        hostAttachment
+                topoResult = ( devicesResults and linksResults
+                               and hostsResults and ipResult and
+                               hostAttachmentResults )
 
         # Compare json objects for hosts and dataplane clusters
 
@@ -2341,7 +2321,7 @@
             onpass="ONOS shows 1 SCC",
             onfail="ONOS shows " + str( numClusters ) + " SCCs" )
 
-        topoResult = ( devicesResults and portsResults and linksResults
+        topoResult = ( devicesResults and linksResults
                        and hostsResults and consistentHostsResult
                        and consistentClustersResult and clusterResults
                        and ipResult and hostAttachmentResults )
@@ -2362,13 +2342,6 @@
             onpass="Device information is correct",
             onfail="Device information is incorrect" )
 
-        main.step( "Port information is correct" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=portsResults,
-            onpass="Port information is correct",
-            onfail="Port information is incorrect" )
-
         main.step( "Links are correct" )
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2376,6 +2349,13 @@
             onpass="Link are correct",
             onfail="Links are incorrect" )
 
+        main.step( "Hosts are correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=hostsResults,
+            onpass="Hosts are correct",
+            onfail="Hosts are incorrect" )
+
         # FIXME: move this to an ONOS state case
         main.step( "Checking ONOS nodes" )
         nodesOutput = []
@@ -2538,22 +2518,10 @@
         main.Mininet1.addSwitch( switch, dpid=switchDPID )
         for peer in links:
             main.Mininet1.addLink( switch, peer )
-        main.Mininet1.assignSwController( sw=switch.split( 's' )[ 1 ],
-                                          count=numControllers,
-                                          ip1=nodes[ 0 ].ip_address,
-                                          port1=ONOS1Port,
-                                          ip2=nodes[ 1 ].ip_address,
-                                          port2=ONOS2Port,
-                                          ip3=nodes[ 2 ].ip_address,
-                                          port3=ONOS3Port,
-                                          ip4=nodes[ 3 ].ip_address,
-                                          port4=ONOS4Port,
-                                          ip5=nodes[ 4 ].ip_address,
-                                          port5=ONOS5Port,
-                                          ip6=nodes[ 5 ].ip_address,
-                                          port6=ONOS6Port,
-                                          ip7=nodes[ 6 ].ip_address,
-                                          port7=ONOS7Port )
+        ipList = []
+        for i in range( numControllers ):
+            ipList.append( nodes[ i ].ip_address )
+        main.Mininet1.assignSwController( sw=switch, ip=ipList )
         main.log.info( "Waiting " + str( switchSleep ) +
                        " seconds for switch up to be discovered" )
         time.sleep( switchSleep )
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
index f77ca3d..4dcf0dd 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
@@ -233,10 +233,13 @@
                                 "master of the device."
         main.step( "Assign switches to controllers" )
 
+        ipList = []
+        for i in range( numControllers ):
+            ipList.append( nodes[ i ].ip_address )
+        swList = []
         for i in range( 1, 29 ):
-            main.Mininet1.assignSwController(
-                sw=str( i ),
-                ip1=ONOS1Ip, port1=ONOS1Port )
+            swList.append( "s" + str( i ) )
+        main.Mininet1.assignSwController( sw=swList, ip=ipList )
 
         mastershipCheck = main.TRUE
         for i in range( 1, 29 ):
@@ -386,12 +389,13 @@
         for i in range(2):  # Retry if pingall fails first time
             time1 = time.time()
             pingResult = main.Mininet1.pingall()
-            utilities.assert_equals(
-                expect=main.TRUE,
-                actual=pingResult,
-                onpass="Reactive Pingall test passed",
-                onfail="Reactive Pingall failed, " +
-                       "one or more ping pairs failed" )
+            if i == 0:
+                utilities.assert_equals(
+                    expect=main.TRUE,
+                    actual=pingResult,
+                    onpass="Reactive Pingall test passed",
+                    onfail="Reactive Pingall failed, " +
+                           "one or more ping pairs failed" )
             time2 = time.time()
             main.log.info( "Time for pingall: %2f seconds" %
                            ( time2 - time1 ) )
@@ -468,7 +472,6 @@
                 pass  # intent submitted is in onos
             else:
                 intentAddResult = False
-        # FIXME: DEBUG
         if intentAddResult:
             intentStop = time.time()
         else:
@@ -502,6 +505,7 @@
                            ( str( count ), str( i ), str( s ) ) )
         leaders = main.ONOScli1.leaders()
         try:
+            missing = False
             if leaders:
                 parsedLeaders = json.loads( leaders )
                 main.log.warn( json.dumps( parsedLeaders,
@@ -518,11 +522,18 @@
                     if topic not in ONOStopics:
                         main.log.error( "Error: " + topic +
                                         " not in leaders" )
+                        missing = True
             else:
                 main.log.error( "leaders() returned None" )
         except ( ValueError, TypeError ):
             main.log.exception( "Error parsing leaders" )
             main.log.error( repr( leaders ) )
+        # Check all nodes
+        if missing:
+            response = main.ONOScli1.leaders( jsonFormat=False)
+            main.log.warn( "ONOS1 leaders output: \n" +
+                           str( response ) )
+
         partitions = main.ONOScli1.partitions()
         try:
             if partitions :
@@ -569,7 +580,17 @@
                 main.log.debug( "Intents in " + cli.name + ": " +
                                 str( sorted( onosIds ) ) )
                 if sorted( ids ) != sorted( intentIds ):
+                    main.log.warn( "Set of intent IDs doesn't match" )
                     correct = False
+                    break
+                else:
+                    intents = json.loads( cli.intents() )
+                    for intent in intents:
+                        if intent[ 'state' ] != "INSTALLED":
+                            main.log.warn( "Intent " + intent[ 'id' ] +
+                                           " is " + intent[ 'state' ] )
+                            correct = False
+                            break
             if correct:
                 break
             else:
@@ -625,6 +646,7 @@
                                ( str( count ), str( i ), str( s ) ) )
             leaders = main.ONOScli1.leaders()
             try:
+                missing = False
                 if leaders:
                     parsedLeaders = json.loads( leaders )
                     main.log.warn( json.dumps( parsedLeaders,
@@ -644,11 +666,17 @@
                         if topic not in ONOStopics:
                             main.log.error( "Error: " + topic +
                                             " not in leaders" )
+                            missing = True
                 else:
                     main.log.error( "leaders() returned None" )
             except ( ValueError, TypeError ):
                 main.log.exception( "Error parsing leaders" )
                 main.log.error( repr( leaders ) )
+            # Check all nodes
+            if missing:
+                response = main.ONOScli1.leaders( jsonFormat=False)
+                main.log.warn( "ONOS1 leaders output: \n" +
+                               str( response ) )
             partitions = main.ONOScli1.partitions()
             try:
                 if partitions :
@@ -846,6 +874,7 @@
                                ( str( count ), str( i ), str( s ) ) )
             leaders = main.ONOScli1.leaders()
             try:
+                missing = False
                 if leaders:
                     parsedLeaders = json.loads( leaders )
                     main.log.warn( json.dumps( parsedLeaders,
@@ -865,11 +894,16 @@
                         if topic not in ONOStopics:
                             main.log.error( "Error: " + topic +
                                             " not in leaders" )
+                            missing = True
                 else:
                     main.log.error( "leaders() returned None" )
             except ( ValueError, TypeError ):
                 main.log.exception( "Error parsing leaders" )
                 main.log.error( repr( leaders ) )
+            if missing:
+                response = main.ONOScli1.leaders( jsonFormat=False)
+                main.log.warn( "ONOS1 leaders output: \n" +
+                               str( response ) )
             partitions = main.ONOScli1.partitions()
             try:
                 if partitions :
@@ -941,8 +975,6 @@
         assert numControllers, "numControllers not defined"
         assert main, "main not defined"
         assert utilities.assert_equals, "utilities.assert_equals not defined"
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
 
         main.case( "Setting up and gathering data for current state" )
         # The general idea for this test case is to pull the state of
@@ -1008,12 +1040,6 @@
                 main.log.warn( table )
         # TODO: Compare switch flow tables with ONOS flow tables
 
-        main.step( "Create TestONTopology object" )
-        ctrls = []
-        temp = ( nodes[0], nodes[0].name, nodes[0].ip_address, 6633 )
-        ctrls.append( temp )
-        MNTopo = TestONTopology( main.Mininet1, ctrls )
-
         main.step( "Collecting topology information from ONOS" )
         devices = []
         devices.append( main.ONOScli1.devices() )
@@ -1060,15 +1086,21 @@
 
         main.step( "Comparing ONOS topology to MN" )
         devicesResults = main.TRUE
-        portsResults = main.TRUE
         linksResults = main.TRUE
         hostsResults = main.TRUE
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
+        mnHosts = main.Mininet1.getHosts()
         for controller in range( numControllers ):
             controllerStr = str( controller + 1 )
-            if devices[ controller ] or "Error" not in devices[ controller ]:
+            if devices[ controller ] and ports[ controller ] and\
+                "Error" not in devices[ controller ] and\
+                "Error" not in ports[ controller ]:
+
                 currentDevicesResult = main.Mininet1.compareSwitches(
-                    MNTopo,
-                    json.loads( devices[ controller ] ) )
+                        mnSwitches,
+                        json.loads( devices[ controller ] ),
+                        json.loads( ports[ controller ] ) )
             else:
                 currentDevicesResult = main.FALSE
             utilities.assert_equals( expect=main.TRUE,
@@ -1077,24 +1109,10 @@
                                      " 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 links[ controller ] or "Error" not in links[ controller ]:
+            if links[ controller ] and "Error" not in links[ controller ]:
                 currentLinksResult = main.Mininet1.compareLinks(
-                    MNTopo,
-                    json.loads( links[ controller ] ) )
+                        mnSwitches, mnLinks,
+                        json.loads( links[ controller ] ) )
             else:
                 currentLinksResult = main.FALSE
             utilities.assert_equals( expect=main.TRUE,
@@ -1106,7 +1124,8 @@
 
             if hosts[ controller ] or "Error" not in hosts[ controller ]:
                 currentHostsResult = main.Mininet1.compareHosts(
-                    MNTopo, hosts[ controller ] )
+                        mnHosts,
+                        hosts[ controller ] )
             else:
                 currentHostsResult = main.FALSE
             utilities.assert_equals( expect=main.TRUE,
@@ -1117,15 +1136,29 @@
                                      " hosts don't match Mininet" )
 
             devicesResults = devicesResults and currentDevicesResult
-            portsResults = portsResults and currentPortsResult
             linksResults = linksResults and currentLinksResult
             hostsResults = hostsResults and currentHostsResult
 
-        topoResult = devicesResults and portsResults and linksResults\
-                     and clusterResults and ipResult and hostsResults
-        utilities.assert_equals( expect=main.TRUE, actual=topoResult,
-                                 onpass="Topology Check Test successful",
-                                 onfail="Topology Check Test NOT successful" )
+        main.step( "Device information is correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=devicesResults,
+            onpass="Device information is correct",
+            onfail="Device information is incorrect" )
+
+        main.step( "Links are correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linksResults,
+            onpass="Link are correct",
+            onfail="Links are incorrect" )
+
+        main.step( "Hosts are correct" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=hostsResults,
+            onpass="Hosts are correct",
+            onfail="Hosts are incorrect" )
 
     def CASE6( self, main ):
         """
@@ -1250,7 +1283,6 @@
             main.log.warn( "ONOS1 intents response: " + repr( ONOS1Intents ) )
         else:
             intentCheck = main.TRUE
-            main.log.error( "Intents are consistent across all ONOS nodes" )
         utilities.assert_equals(
             expect=main.TRUE,
             actual=intentCheck,
@@ -1375,11 +1407,6 @@
         """
         Compare topo
         """
-        import sys
-        # FIXME add this path to params
-        sys.path.append( "/home/admin/sts" )
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
         import json
         import time
         assert numControllers, "numControllers not defined"
@@ -1389,27 +1416,12 @@
         main.case( "Compare ONOS Topology view to Mininet topology" )
         main.caseExplaination = "Compare topology objects between Mininet" +\
                                 " and ONOS"
-        main.step( "Create TestONTopology object" )
-        try:
-            ctrls = []
-            node = main.ONOS1
-            temp = ( node, node.name, node.ip_address, 6633 )
-            ctrls.append( temp )
-            MNTopo = TestONTopology( main.Mininet1, ctrls )
-        except Exception:
-            objResult = main.FALSE
-        else:
-            objResult = main.TRUE
-        utilities.assert_equals( expect=main.TRUE, actual=objResult,
-                                 onpass="Created TestONTopology object",
-                                 onfail="Exception while creating " +
-                                        "TestONTopology object" )
 
         main.step( "Comparing ONOS topology to MN" )
         devicesResults = main.TRUE
-        portsResults = main.TRUE
         linksResults = main.TRUE
         hostsResults = main.TRUE
+        hostAttachmentResults = True
         topoResult = main.FALSE
         elapsed = 0
         count = 0
@@ -1418,9 +1430,6 @@
         # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
             count += 1
-            if count > 1:
-                # TODO: Deprecate STS usage
-                MNTopo = TestONTopology( main.Mininet1, ctrls )
             cliStart = time.time()
             devices = []
             devices.append( main.ONOScli1.devices() )
@@ -1446,13 +1455,19 @@
             cliTime = time.time() - cliStart
             print "CLI time: " + str( cliTime )
 
+            mnSwitches = main.Mininet1.getSwitches()
+            mnLinks = main.Mininet1.getLinks()
+            mnHosts = main.Mininet1.getHosts()
             for controller in range( numControllers ):
                 controllerStr = str( controller + 1 )
-                if devices[ controller ] or "Error" not in devices[
-                        controller ]:
+                if devices[ controller ] and ports[ controller ] and\
+                    "Error" not in devices[ controller ] and\
+                    "Error" not in ports[ controller ]:
+
                     currentDevicesResult = main.Mininet1.compareSwitches(
-                        MNTopo,
-                        json.loads( devices[ controller ] ) )
+                            mnSwitches,
+                            json.loads( devices[ controller ] ),
+                            json.loads( ports[ controller ] ) )
                 else:
                     currentDevicesResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -1462,23 +1477,10 @@
                                          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 links[ controller ] or "Error" not in links[ controller ]:
+                if links[ controller ] and "Error" not in links[ controller ]:
                     currentLinksResult = main.Mininet1.compareLinks(
-                        MNTopo,
-                        json.loads( links[ controller ] ) )
+                            mnSwitches, mnLinks,
+                            json.loads( links[ controller ] ) )
                 else:
                     currentLinksResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -1490,7 +1492,8 @@
 
                 if hosts[ controller ] or "Error" not in hosts[ controller ]:
                     currentHostsResult = main.Mininet1.compareHosts(
-                        MNTopo, hosts[ controller ] )
+                            mnHosts,
+                            hosts[ controller ] )
                 else:
                     currentHostsResult = main.FALSE
                 utilities.assert_equals( expect=main.TRUE,
@@ -1499,11 +1502,94 @@
                                          " hosts exist in Mininet",
                                          onfail="ONOS" + controllerStr +
                                          " hosts don't match Mininet" )
+                # CHECKING HOST ATTACHMENT POINTS
+                hostAttachment = True
+                zeroHosts = False
+                # FIXME: topo-HA/obelisk specific mappings:
+                # key is mac and value is dpid
+                mappings = {}
+                for i in range( 1, 29 ):  # hosts 1 through 28
+                    # set up correct variables:
+                    macId = "00:" * 5 + hex( i ).split( "0x" )[1].upper().zfill(2)
+                    if i == 1:
+                        deviceId = "1000".zfill(16)
+                    elif i == 2:
+                        deviceId = "2000".zfill(16)
+                    elif i == 3:
+                        deviceId = "3000".zfill(16)
+                    elif i == 4:
+                        deviceId = "3004".zfill(16)
+                    elif i == 5:
+                        deviceId = "5000".zfill(16)
+                    elif i == 6:
+                        deviceId = "6000".zfill(16)
+                    elif i == 7:
+                        deviceId = "6007".zfill(16)
+                    elif i >= 8 and i <= 17:
+                        dpid = '3' + str( i ).zfill( 3 )
+                        deviceId = dpid.zfill(16)
+                    elif i >= 18 and i <= 27:
+                        dpid = '6' + str( i ).zfill( 3 )
+                        deviceId = dpid.zfill(16)
+                    elif i == 28:
+                        deviceId = "2800".zfill(16)
+                    mappings[ macId ] = deviceId
+                if hosts[ controller ] or "Error" not in hosts[ controller ]:
+                    if hosts[ controller ] == []:
+                        main.log.warn( "There are no hosts discovered" )
+                        zeroHosts = True
+                    else:
+                        for host in hosts[ controller ]:
+                            mac = None
+                            location = None
+                            device = None
+                            port = None
+                            try:
+                                mac = host.get( 'mac' )
+                                assert mac, "mac field could not be found for this host object"
+
+                                location = host.get( 'location' )
+                                assert location, "location field could not be found for this host object"
+
+                                # Trim the protocol identifier off deviceId
+                                device = str( location.get( 'elementId' ) ).split(':')[1]
+                                assert device, "elementId field could not be found for this host location object"
+
+                                port = location.get( 'port' )
+                                assert port, "port field could not be found for this host location object"
+
+                                # Now check if this matches where they should be
+                                if mac and device and port:
+                                    if str( port ) != "1":
+                                        main.log.error( "The attachment port is incorrect for " +
+                                                        "host " + str( mac ) +
+                                                        ". Expected: 1 Actual: " + str( port) )
+                                        hostAttachment = False
+                                    if device != mappings[ str( mac ) ]:
+                                        main.log.error( "The attachment device is incorrect for " +
+                                                        "host " + str( mac ) +
+                                                        ". Expected: " + mappings[ str( mac ) ] +
+                                                        " Actual: " + device )
+                                        hostAttachment = False
+                                else:
+                                    hostAttachment = False
+                            except AssertionError:
+                                main.log.exception( "Json object not as expected" )
+                                main.log.error( repr( host ) )
+                                hostAttachment = False
+                else:
+                    main.log.error( "No hosts json output or \"Error\"" +
+                                    " in output. hosts = " +
+                                    repr( hosts[ controller ] ) )
+                if zeroHosts is False:
+                    hostAttachment = True
+
 
                 devicesResults = devicesResults and currentDevicesResult
-                portsResults = portsResults and currentPortsResult
                 linksResults = linksResults and currentLinksResult
                 hostsResults = hostsResults and currentHostsResult
+                hostAttachmentResults = hostAttachmentResults and\
+                                        hostAttachment
 
                 # "consistent" results don't make sense for single instance
             # there should always only be one cluster
@@ -1517,8 +1603,9 @@
                 onpass="ONOS shows 1 SCC",
                 onfail="ONOS shows " + str( numClusters ) + " SCCs" )
 
-            topoResult = ( devicesResults and portsResults and linksResults
-                           and hostsResults and ipResult and clusterResults )
+            topoResult = ( devicesResults and linksResults
+                           and hostsResults and ipResult and clusterResults and
+                           hostAttachmentResults )
 
         topoResult = topoResult and int( count <= 2 )
         note = "note it takes about " + str( int( cliTime ) ) + \
@@ -1646,9 +1733,10 @@
         main.Mininet1.addSwitch( switch, dpid=switchDPID )
         for peer in links:
             main.Mininet1.addLink( switch, peer )
-        main.Mininet1.assignSwController( sw=switch.split( 's' )[ 1 ],
-                                          ip1=ONOS1Ip,
-                                          port1=ONOS1Port )
+        ipList = []
+        for i in range( numControllers ):
+            ipList.append( nodes[ i ].ip_address )
+        main.Mininet1.assignSwController( sw=switch, ip=ipList )
         main.log.info( "Waiting " + str( switchSleep ) +
                        " seconds for switch up to be discovered" )
         time.sleep( switchSleep )
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.py b/TestON/tests/IntentEventTP/IntentEventTP.py
index 9682507..44178b2 100644
--- a/TestON/tests/IntentEventTP/IntentEventTP.py
+++ b/TestON/tests/IntentEventTP/IntentEventTP.py
@@ -87,7 +87,10 @@
          
         clusterCount = int(scale[0])
         scale.remove(scale[0])       
-        
+       
+        MN1Ip = ONOSIp[len(ONOSIp) -1]
+        BENCHIp = ONOSIp[len(ONOSIp) -2]
+ 
         #kill off all onos processes 
         main.log.step("Safety check, killing all ONOS processes")
         main.log.step("before initiating enviornment setup")
@@ -108,7 +111,7 @@
         cellIp = []
         for node in range (1, clusterCount + 1):
             cellIp.append(ONOSIp[node])
-
+         
         main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
 
         main.step( "Set Cell" )
diff --git a/TestON/tests/IntentPerfNext/Dependency/IntentClass.py b/TestON/tests/IntentPerfNext/Dependency/IntentClass.py
deleted file mode 100644
index f5b17c2..0000000
--- a/TestON/tests/IntentPerfNext/Dependency/IntentClass.py
+++ /dev/null
@@ -1,56 +0,0 @@
-
-def __init__(self):
-    self_ = self
-
-def printLog(main):
-    main.log.info("Print log success")
-
-def iptablesDropAllNodes(main, MN_ip, sw_port):
-    #INPUT RULES 
-    main.ONOS1.handle.sendline(
-        "sudo iptables -A INPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS2.handle.sendline(
-        "sudo iptables -A INPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS3.handle.sendline(
-        "sudo iptables -A INPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS4.handle.sendline(
-        "sudo iptables -A INPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS5.handle.sendline(
-        "sudo iptables -A INPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS6.handle.sendline(
-        "sudo iptables -A INPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS7.handle.sendline(
-        "sudo iptables -A INPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-
-    main.ONOS1.handle.sendline(
-        "sudo iptables -A OUTPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS2.handle.sendline(
-        "sudo iptables -A OUTPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS3.handle.sendline(
-        "sudo iptables -A OUTPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS4.handle.sendline(
-        "sudo iptables -A OUTPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS5.handle.sendline(
-        "sudo iptables -A OUTPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS6.handle.sendline(
-        "sudo iptables -A OUTPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-    main.ONOS7.handle.sendline(
-        "sudo iptables -A OUTPUT -p tcp -s "+
-        MN_ip+" --dport "+sw_port+" -j DROP")
-
-def uninstallAllNodes(main, node_ip_list):
-    for node in node_ip_list:
-        main.ONOSbench.onos_uninstall(node_ip = node)
diff --git a/TestON/tests/IntentPerfNext/Dependency/__init__.py b/TestON/tests/IntentPerfNext/Dependency/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/IntentPerfNext/Dependency/__init__.py
+++ /dev/null
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.params b/TestON/tests/IntentPerfNext/IntentPerfNext.params
deleted file mode 100644
index 90ef160..0000000
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.params
+++ /dev/null
@@ -1,62 +0,0 @@
-<PARAMS>
-    <testcases>1,4,5,4,5,4,5,4</testcases>
-
-    <ENV>
-        <cellName>intent_perf_test</cellName>
-    </ENV>
-
-    <GIT>
-        #autoPull 'on' or 'off'
-        <autoPull>off</autoPull>
-        <checkout>master</checkout>
-    </GIT>
-
-    <CTRL>
-        <user>admin</user>
-        <ip1>10.128.174.1</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.174.2</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.174.3</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.174.4</ip4>
-        <ip5>10.128.174.5</ip5>
-        <ip6>10.128.174.6</ip6>
-        <ip7>10.128.174.7</ip7>
-    </CTRL>
-
-    <MN>
-        <ip1>10.128.10.90</ip1>
-        <ip2>10.128.10.91</ip2>
-    </MN>
-
-    <BENCH>
-        <ip>10.128.174.10</ip>
-    </BENCH>
-
-    <TEST>
-        #Number of times to iterate each case
-        <numIter>8</numIter>
-        <numIgnore>2</numIgnore>
-        <numSwitch>8</numSwitch>
-        <batchThresholdMin>0</batchThresholdMin>
-        <batchThresholdMax>1000</batchThresholdMax>
-        <batchIntentSize>1</batchIntentSize>
-        <numMult>1</numMult>
-        #Interface to bring down for intent reroute case
-        <intfs>s3-eth2</intfs>
-    </TEST>
-
-    <DB>
-        <intentFilePath>
-        /home/admin/ONLabTest/TestON/tests/IntentPerfNext/intentLatencyResultDb.log
-        </intentFilePath>
-    </DB>
-
-    <JSON>
-        <submittedTime>intentSubmittedTimestamp</submittedTime>
-        <installedTime>intentInstalledTimestamp</installedTime>
-        <wdRequestTime>intentWithdrawRequestedTimestamp</wdRequestTime>
-        <withdrawnTime>intentWithdrawnTimestamp</withdrawnTime>
-    </JSON>
-</PARAMS>
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.py b/TestON/tests/IntentPerfNext/IntentPerfNext.py
deleted file mode 100644
index cb226e7..0000000
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.py
+++ /dev/null
@@ -1,1284 +0,0 @@
-# Intent Performance Test for ONOS-next
-#
-# andrew@onlab.us
-#
-# November 5, 2014
-
-
-class IntentPerfNext:
-
-    def __init__( self ):
-        self.default = ""
-
-    def CASE1( self, main ):
-        """
-        ONOS startup sequence
-        """
-        import time
-        global clusterCount
-        global timeToPost
-        global runNum
-
-        clusterCount = 1
-        timeToPost = time.strftime("%Y-%m-%d %H:%M:%S")
-        runNum = time.strftime("%d%H%M%S")
-
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-
-        gitPull = main.params[ 'GIT' ][ 'autoPull' ]
-        checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
-        intentFilePath = main.params[ 'DB' ][ 'intentFilePath' ]
-
-        ONOSIp = []
-        for i in range(1, 8):
-            ONOSIp.append(main.params[ 'CTRL' ][ 'ip'+str(i) ]) 
-            main.ONOSbench.onosUninstall( nodeIp = ONOSIp[i-1] )
-
-        MN1Ip = main.params[ 'MN' ][ 'ip1' ]
-        BENCHIp = main.params[ 'BENCH' ][ 'ip' ]
-
-        main.case( "Setting up test environment" )
-
-        main.step( "Clearing previous DB log file" )
-        fIntentLog = open(intentFilePath, 'w')
-        # Overwrite with empty line and close 
-        fIntentLog.write('')
-        fIntentLog.close()
-
-        main.step( "Starting mininet topology" )
-        main.Mininet1.startNet()
-
-        main.step( "Creating cell file" )
-        cellFileResult = main.ONOSbench.createCellFile(
-            BENCHIp, cellName, MN1Ip,
-            ("onos-core,webconsole,onos-api,onos-app-metrics,onos-gui,"
-            "onos-cli,onos-openflow"),
-            ONOSIp[0] )
-
-        main.step( "Applying cell file to environment" )
-        cellApplyResult = main.ONOSbench.setCell( cellName )
-        verifyCellResult = main.ONOSbench.verifyCell()
-
-        main.step( "Removing raft logs" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
-        main.step( "Git checkout and pull " + checkoutBranch )
-        if gitPull == 'on':
-            checkoutResult = \
-                main.ONOSbench.gitCheckout( checkoutBranch )
-            pullResult = main.ONOSbench.gitPull()
-
-            # If you used git pull, auto compile
-            main.step( "Using onos-build to compile ONOS" )
-            buildResult = main.ONOSbench.onosBuild()
-        else:
-            checkoutResult = main.TRUE
-            pullResult = main.TRUE
-            buildResult = main.TRUE
-            main.log.info( "Git pull skipped by configuration" )
-
-        main.log.report( "Commit information - " )
-        main.ONOSbench.getVersion( report=True )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()
-
-        main.step( "Installing ONOS package" )
-        install1Result = main.ONOSbench.onosInstall( node=ONOSIp[0] )
-
-        main.step( "Set cell for ONOScli env" )
-        main.ONOS1cli.setCell( cellName )
-
-        time.sleep( 5 )
-
-        main.step( "Start onos cli" )
-        cli1 = main.ONOS1cli.startOnosCli( ONOSIp[0] )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                actual=cellFileResult and cellApplyResult and
-                                verifyCellResult and checkoutResult and
-                                pullResult and buildResult and
-                                install1Result,  # and install2Result and
-                                # install3Result,
-                                onpass="ONOS started successfully",
-                                onfail="Failed to start ONOS" )
-
-    def CASE2( self, main ):
-        """
-        Single intent add latency
-
-        """
-        import time
-        import json
-        import requests
-        import os
-        import numpy
-        global clusterCount
-
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
-        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
-        ONOSIpList = []
-        for i in range( 1, 8 ):
-            ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
-
-        ONOSUser = main.params[ 'CTRL' ][ 'user' ]
-
-        defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
-        # number of iterations of case
-        numIter = main.params[ 'TEST' ][ 'numIter' ]
-        numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
-
-        # Timestamp keys for json metrics output
-        submitTime = main.params[ 'JSON' ][ 'submittedTime' ]
-        installTime = main.params[ 'JSON' ][ 'installedTime' ]
-        wdRequestTime = main.params[ 'JSON' ][ 'wdRequestTime' ]
-        withdrawnTime = main.params[ 'JSON' ][ 'withdrawnTime' ]
-
-        assertion = main.TRUE
-
-        intentAddLatList = []
-
-        # Distribute switches according to cluster count
-        for i in range( 1, 9 ):
-            if clusterCount == 1:
-                main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ 0 ],
-                    port1=defaultSwPort
-                )
-            elif clusterCount == 3:
-                if i < 3:
-                    index = 0
-                elif i < 6 and i >= 3:
-                    index = 1
-                else:
-                    index = 2
-                main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
-                )
-            elif clusterCount == 5:
-                if i < 3:
-                    index = 0
-                elif i < 5 and i >= 3:
-                    index = 1
-                elif i < 7 and i >= 5:
-                    index = 2
-                elif i == 7:
-                    index = 3
-                else:
-                    index = 4
-                main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
-                )
-            elif clusterCount == 7:
-                if i < 6:
-                    index = i
-                else:
-                    index = 6
-                main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
-                )
-
-        time.sleep( 10 )
-
-        main.log.report( "Single intent add latency test" )
-
-        devicesJsonStr = main.ONOS1cli.devices()
-        devicesJsonObj = json.loads( devicesJsonStr )
-
-        if not devicesJsonObj:
-            main.log.report( "Devices not discovered" )
-            main.log.report( "Aborting test" )
-            main.exit()
-        else:
-            main.log.info( "Devices discovered successfully" )
-
-        deviceIdList = []
-
-        # Obtain device id list in ONOS format.
-        # They should already be in order ( 1,2,3,10,11,12,13, etc )
-        for device in devicesJsonObj:
-            deviceIdList.append( device[ 'id' ] )
-
-        for i in range( 0, int( numIter ) ):
-            # addPointIntent( ingrDevice,  egrDevice,
-            #                 ingrPort,    egrPort )
-            main.ONOS1cli.addPointIntent(
-                deviceIdList[ 0 ] + "/2", deviceIdList[ 7 ] + "/2" )
-
-            # Allow some time for intents to propagate
-            time.sleep( 5 )
-
-            intentsStr = main.ONOS1cli.intents( jsonFormat=True )
-            intentsObj = json.loads( intentsStr )
-            for intent in intentsObj:
-                if intent[ 'state' ] == "INSTALLED":
-                    main.log.info( "Intent installed successfully" )
-                    intentId = intent[ 'id' ]
-                    main.log.info( "Intent id: " + str( intentId ) )
-                else:
-                    # TODO: Add error handling
-                    main.log.info( "Intent installation failed" )
-                    intentId = ""
-
-            # Obtain metrics from ONOS 1, 2, 3
-            intentsJsonStr1 = main.ONOS1cli.intentsEventsMetrics()
-            intentsJsonObj1 = json.loads( intentsJsonStr1 )
-            # Parse values from the json object
-            intentSubmit1 = \
-                intentsJsonObj1[ submitTime ][ 'value' ]
-            intentInstall1 = \
-                intentsJsonObj1[ installTime ][ 'value' ]
-            intentInstallLat1 = \
-                int( intentInstall1 ) - int( intentSubmit1 )
-
-            if clusterCount == 3:
-                intentsJsonStr2 = main.ONOS2cli.intentsEventsMetrics()
-                intentsJsonStr3 = main.ONOS3cli.intentsEventsMetrics()
-                intentsJsonObj2 = json.loads( intentsJsonStr2 )
-                intentsJsonObj3 = json.loads( intentsJsonStr3 )
-                intentSubmit2 = \
-                    intentsJsonObj2[ submitTime ][ 'value' ]
-                intentSubmit3 = \
-                    intentsJsonObj3[ submitTime ][ 'value' ]
-                intentInstall2 = \
-                    intentsJsonObj2[ installTime ][ 'value' ]
-                intentInstall3 = \
-                    intentsJsonObj3[ installTime ][ 'value' ]
-                intentInstallLat2 = \
-                    int( intentInstall2 ) - int( intentSubmit2 )
-                intentInstallLat3 = \
-                    int( intentInstall3 ) - int( intentSubmit3 )
-            else:
-                intentInstallLat2 = 0
-                intentInstallLat3 = 0
-
-            if clusterCount == 5:
-                intentsJsonStr4 = main.ONOS4cli.intentsEventsMetrics()
-                intentsJsonStr5 = main.ONOS5cli.intentsEventsMetrics()
-                intentsJsonObj4 = json.loads( intentsJsonStr4 )
-                intentsJsonObj5 = json.loads( intentsJsonStr5 )
-                intentSubmit4 = \
-                    intentsJsonObj4[ submitTime ][ 'value' ]
-                intentSubmit5 = \
-                    intentsJsonObj5[ submitTime ][ 'value' ]
-                intentInstall4 = \
-                    intentsJsonObj5[ installTime ][ 'value' ]
-                intentInstall5 = \
-                    intentsJsonObj5[ installTime ][ 'value' ]
-                intentInstallLat4 = \
-                    int( intentInstall4 ) - int( intentSubmit4 )
-                intentInstallLat5 = \
-                    int( intentInstall5 ) - int( intentSubmit5 )
-            else:
-                intentInstallLat4 = 0
-                intentInstallLat5 = 0
-
-            if clusterCount == 7:
-                intentsJsonStr6 = main.ONOS6cli.intentsEventsMetrics()
-                intentsJsonStr7 = main.ONOS7cli.intentsEventsMetrics()
-                intentsJsonObj6 = json.loads( intentsJsonStr6 )
-                intentsJsonObj7 = json.loads( intentsJsonStr7 )
-                intentSubmit6 = \
-                    intentsJsonObj6[ submitTime ][ 'value' ]
-                intentSubmit7 = \
-                    intentsJsonObj6[ submitTime ][ 'value' ]
-                intentInstall6 = \
-                    intentsJsonObj6[ installTime ][ 'value' ]
-                intentInstall7 = \
-                    intentsJsonObj7[ installTime ][ 'value' ]
-                intentInstallLat6 = \
-                    int( intentInstall6 ) - int( intentSubmit6 )
-                intentInstallLat7 = \
-                    int( intentInstall7 ) - int( intentSubmit7 )
-            else:
-                intentInstallLat6 = 0
-                intentInstallLat7 = 0
-
-            intentInstallLatAvg = \
-                ( intentInstallLat1 +
-                  intentInstallLat2 +
-                  intentInstallLat3 +
-                  intentInstallLat4 +
-                  intentInstallLat5 +
-                  intentInstallLat6 +
-                  intentInstallLat7 ) / clusterCount
-
-            main.log.info( "Intent add latency avg for iteration " + str( i ) +
-                           ": " + str( intentInstallLatAvg ) + " ms" )
-
-            if intentInstallLatAvg > 0.0 and \
-               intentInstallLatAvg < 1000 and i > numIgnore:
-                intentAddLatList.append( intentInstallLatAvg )
-            else:
-                main.log.info( "Intent add latency exceeded " +
-                               "threshold. Skipping iteration " + str( i ) )
-
-            time.sleep( 3 )
-
-            # TODO: Only remove intents that were installed
-            #      in this case... Otherwise many other intents
-            #      may show up distorting the results
-            main.log.info( "Removing intents for next iteration" )
-            jsonTemp = \
-                main.ONOS1cli.intents( jsonFormat=True )
-            jsonObjIntents = json.loads( jsonTemp )
-            if jsonObjIntents:
-                for intents in jsonObjIntents:
-                    tempId = intents[ 'id' ]
-                    # main.ONOS1cli.removeIntent( tempId )
-                    main.log.info( "Removing intent id: " +
-                                   str( tempId ) )
-                    main.ONOS1cli.removeIntent( tempId )
-            else:
-                main.log.info( "Intents were not installed correctly" )
-
-            time.sleep( 5 )
-
-        if intentAddLatList:
-            intentAddLatAvg = sum( intentAddLatList ) /\
-                len( intentAddLatList )
-        else:
-            main.log.report( "Intent installation latency test failed" )
-            intentAddLatAvg = "NA"
-            assertion = main.FALSE
-
-        intentAddLatStd = \
-            round( numpy.std( intentAddLatList ), 1 )
-        # END ITERATION FOR LOOP
-        main.log.report( "Single intent add latency - " )
-        main.log.report( "Avg: " + str( intentAddLatAvg ) + " ms" )
-        main.log.report( "Std Deviation: " + str( intentAddLatStd ) + " ms" )
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=assertion,
-            onpass="Single intent install latency test successful",
-            onfail="Single intent install latency test failed" )
-
-    def CASE3( self, main ):
-        """
-        Intent Reroute latency
-        """
-        import time
-        import json
-        import requests
-        import os
-        import numpy
-        global clusterCount
-
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
-        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
-        ONOSUser = main.params[ 'CTRL' ][ 'user' ]
-       
-        ONOSIpList = []
-        for i in range( 1, 8 ):
-            ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
-
-        defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
-        # number of iterations of case
-        numIter = main.params[ 'TEST' ][ 'numIter' ]
-        numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
-        assertion = main.TRUE
-
-        # Timestamp keys for json metrics output
-        submitTime = main.params[ 'JSON' ][ 'submittedTime' ]
-        installTime = main.params[ 'JSON' ][ 'installedTime' ]
-        wdRequestTime = main.params[ 'JSON' ][ 'wdRequestTime' ]
-        withdrawnTime = main.params[ 'JSON' ][ 'withdrawnTime' ]
-
-        # NOTE: May need to configure interface depending on topology
-        intfs = main.params[ 'TEST' ][ 'intfs' ]
-        
-        # Distribute switches according to cluster count
-        for i in range( 1, 9 ):
-            if clusterCount == 1:
-                main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ 0 ],
-                    port1=defaultSwPort
-                )
-            elif clusterCount == 3:
-                if i < 3:
-                    index = 0
-                elif i < 6 and i >= 3:
-                    index = 1
-                else:
-                    index = 2
-                main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
-                )
-            elif clusterCount == 5:
-                if i < 3:
-                    index = 0
-                elif i < 5 and i >= 3:
-                    index = 1
-                elif i < 7 and i >= 5:
-                    index = 2
-                elif i == 7:
-                    index = 3
-                else:
-                    index = 4
-                main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
-                )
-            elif clusterCount == 7:
-                if i < 6:
-                    index = i
-                else:
-                    index = 6
-                main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
-                )
-
-        time.sleep(10)
-
-        devicesJsonStr = main.ONOS1cli.devices()
-        devicesJsonObj = json.loads( devicesJsonStr )
-
-        deviceIdList = []
-
-        # Obtain device id list in ONOS format.
-        # They should already be in order ( 1,2,3,10,11,12,13, etc )
-        for device in devicesJsonObj:
-            deviceIdList.append( device[ 'id' ] )
-
-        intentRerouteLatList = []
-
-        for i in range( 0, int( numIter ) ):
-            # addPointIntent( ingrDevice, ingrPort,
-            #                 egrDevice, egrPort )
-            if len( deviceIdList ) > 0:
-                main.ONOS1cli.addPointIntent(
-                    deviceIdList[ 0 ] + "/2", deviceIdList[ 7 ] + "/2" )
-            else:
-                main.log.info( "Failed to fetch devices from ONOS" )
-
-            time.sleep( 5 )
-
-            intentsStr = main.ONOS1cli.intents( jsonFormat=True )
-            intentsObj = json.loads( intentsStr )
-            for intent in intentsObj:
-                main.log.info(intent)
-                if intent[ 'state' ] == "INSTALLED":
-                    main.log.info( "Intent installed successfully" )
-                    intentId = intent[ 'id' ]
-                    main.log.info( "Intent id: " + str( intentId ) )
-                #else:
-                    #TODO: Add error handling
-                    #main.log.info( "Intent installation failed" )
-                    #intentId = ""
-
-            main.log.info( "Disabling interface " + intfs )
-            t0System = time.time() * 1000
-            main.Mininet1.handle.sendline(
-                "sh ifconfig " + intfs + " down" )
-            main.Mininet1.handle.expect( "mininet>" )
-
-            # TODO: Check for correct intent reroute
-            time.sleep( 1 )
-
-            # Obtain metrics from ONOS 1, 2, 3
-            intentsJsonStr1 = main.ONOS1cli.intentsEventsMetrics()
-            intentsJsonObj1 = json.loads( intentsJsonStr1 )
-            # Parse values from the json object
-            intentInstall1 = \
-                intentsJsonObj1[ installTime ][ 'value' ]
-            intentRerouteLat1 = \
-                int( intentInstall1 ) - int( t0System )
-
-            if clusterCount == 3:
-                intentsJsonStr2 = main.ONOS2cli.intentsEventsMetrics()
-                intentsJsonStr3 = main.ONOS3cli.intentsEventsMetrics()
-
-                intentsJsonObj2 = json.loads( intentsJsonStr2 )
-                intentsJsonObj3 = json.loads( intentsJsonStr3 )
-                intentInstall2 = \
-                    intentsJsonObj2[ installTime ][ 'value' ]
-                intentInstall3 = \
-                    intentsJsonObj3[ installTime ][ 'value' ]
-                intentRerouteLat2 = \
-                    int( intentInstall2 ) - int( t0System )
-                intentRerouteLat3 = \
-                    int( intentInstall3 ) - int( t0System )
-            else:
-                intentRerouteLat2 = 0
-                intentRerouteLat3 = 0
-
-            if clusterCount == 5:
-                intentsJsonStr4 = main.ONOS4cli.intentsEventsMetrics()
-                intentsJsonStr5 = main.ONOS5cli.intentsEventsMetrics()
-
-                intentsJsonObj4 = json.loads( intentsJsonStr4 )
-                intentsJsonObj5 = json.loads( intentsJsonStr5 )
-                intentInstall4 = \
-                    intentsJsonObj4[ installTime ][ 'value' ]
-                intentInstall5 = \
-                    intentsJsonObj5[ installTime ][ 'value' ]
-                intentRerouteLat4 = \
-                    int( intentInstall4 ) - int( t0System )
-                intentRerouteLat5 = \
-                    int( intentInstall5 ) - int( t0System )
-            else:
-                intentRerouteLat4 = 0
-                intentRerouteLat5 = 0
-
-            if clusterCount == 7:
-                intentsJsonStr6 = main.ONOS6cli.intentsEventsMetrics()
-                intentsJsonStr7 = main.ONOS7cli.intentsEventsMetrics()
-
-                intentsJsonObj6 = json.loads( intentsJsonStr6 )
-                intentsJsonObj7 = json.loads( intentsJsonStr7 )
-                intentInstall6 = \
-                    intentsJsonObj6[ installTime ][ 'value' ]
-                intentInstall7 = \
-                    intentsJsonObj7[ installTime ][ 'value' ]
-                intentRerouteLat6 = \
-                    int( intentInstall6 ) - int( t0System )
-                intentRerouteLat7 = \
-                    int( intentInstall7 ) - int( t0System )
-            else:
-                intentRerouteLat6 = 0
-                intentRerouteLat7 = 0
-
-            intentRerouteLatAvg = \
-                ( intentRerouteLat1 +
-                  intentRerouteLat2 +
-                  intentRerouteLat3 +
-                  intentRerouteLat4 +
-                  intentRerouteLat5 +
-                  intentRerouteLat6 +
-                  intentRerouteLat7 ) / clusterCount
-
-            main.log.info( "Intent reroute latency avg for iteration " +
-                           str( i ) + ": " + str( intentRerouteLatAvg )+ " ms")
-
-            if intentRerouteLatAvg > 0.0 and \
-               intentRerouteLatAvg < 1000 and i > numIgnore:
-                intentRerouteLatList.append( intentRerouteLatAvg )
-            else:
-                main.log.info( "Intent reroute latency exceeded " +
-                               "threshold. Skipping iteration " + str( i ) )
-
-            main.log.info( "Removing intents for next iteration" )
-            main.ONOS1cli.removeIntent( intentId )
-
-            main.log.info( "Bringing Mininet interface up for next " +
-                           "iteration" )
-            main.Mininet1.handle.sendline(
-                "sh ifconfig " + intfs + " up" )
-            main.Mininet1.handle.expect( "mininet>" )
-
-        if intentRerouteLatList:
-            intentRerouteLatAvg = sum( intentRerouteLatList ) /\
-                len( intentRerouteLatList )
-        else:
-            main.log.report( "Intent reroute test failed. Results NA" )
-            intentRerouteLatAvg = "NA"
-            # NOTE: fails test when list is empty
-            assertion = main.FALSE
-
-        intentRerouteLatStd = \
-            round( numpy.std( intentRerouteLatList ), 1 )
-        # END ITERATION FOR LOOP
-        main.log.report( "Single intent reroute latency - " )
-        main.log.report( "Avg: " + str( intentRerouteLatAvg ) + " ms" )
-        main.log.report(
-            "Std Deviation: " +
-            str( intentRerouteLatStd ) +
-            " ms" )
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=assertion,
-            onpass="Single intent reroute latency test successful",
-            onfail="Single intent reroute latency test failed" )
-
-    def CASE4( self, main ):
-        """
-        Batch intent install
-        
-        Supports scale-out scenarios and increasing
-        number of intents within each iteration
-        """
-        import time
-        import json
-        import requests
-        import os
-        import numpy
-        global clusterCount
-        global timeToPost
-
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
-        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
-        ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ]
-        ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ]
-        ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ]
-        ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ]
-
-        assertion = main.TRUE
-
-        ONOSIpList = []
-        for i in range( 1, 8 ):
-            ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
-
-        ONOSUser = main.params[ 'CTRL' ][ 'user' ]
-
-        defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
-        batchIntentSize = int( main.params[ 'TEST' ][ 'batchIntentSize' ] )
-        batchThreshMin = int( main.params[ 'TEST' ][ 'batchThresholdMin' ] )
-        batchThreshMax = int( main.params[ 'TEST' ][ 'batchThresholdMax' ] )
-
-        # number of iterations of case
-        numIter = main.params[ 'TEST' ][ 'numIter' ]
-        numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
-        numSwitch = int( main.params[ 'TEST' ][ 'numSwitch' ] )
-        nThread = main.params[ 'TEST' ][ 'numMult' ]
-        #nThread = 105
-
-        # DB operation variables
-        intentFilePath = main.params[ 'DB' ][ 'intentFilePath' ]
-
-        # Switch assignment NOTE: hardcoded
-        if clusterCount == 1:
-            for i in range( 1, numSwitch + 1 ):
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=defaultSwPort )
-        if clusterCount == 3:
-            for i in range( 1, 3 ):
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=defaultSwPort )
-            for i in range( 3, 6 ):
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS2Ip,
-                    port1=defaultSwPort )
-            for i in range( 6, 9 ):
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS3Ip,
-                    port1=defaultSwPort )
-        if clusterCount == 5:
-            main.Mininet1.assignSwController(
-                sw="1",
-                ip1=ONOS1Ip,
-                port1=defaultSwPort )
-            main.Mininet1.assignSwController(
-                sw="2",
-                ip1=ONOS2Ip,
-                port1=defaultSwPort )
-            for i in range( 3, 6 ):
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS3Ip,
-                    port1=defaultSwPort )
-            main.Mininet1.assignSwController(
-                sw="6",
-                ip1=ONOS4Ip,
-                port1=defaultSwPort )
-            main.Mininet1.assignSwController(
-                sw="7",
-                ip1=ONOS5Ip,
-                port1=defaultSwPort )
-            main.Mininet1.assignSwController(
-                sw="8",
-                ip1=ONOS5Ip,
-                port1=defaultSwPort )
-
-        if clusterCount == 7:
-            for i in range( 1, 9 ):
-                if i < 8:
-                    main.Mininet1.assignSwController(
-                        sw=str( i ),
-                        ip1=ONOSIpList[ i - 1 ],
-                        port1=defaultSwPort )
-                elif i >= 8:
-                    main.Mininet1.assignSwController(
-                        sw=str( i ),
-                        ip1=ONOSIpList[ 6 ],
-                        port1=defaultSwPort )
-
-        time.sleep( 20 )
-
-        main.log.report( "Batch intent installation test of " +
-                         str( batchIntentSize ) + " intent(s)" )
-
-        batchResultList = []
-
-        main.log.info( "Getting list of available devices" )
-        deviceIdList = []
-        jsonStr = main.ONOS1cli.devices()
-        jsonObj = json.loads( jsonStr )
-        for device in jsonObj:
-            deviceIdList.append( device[ 'id' ] )
-
-        # List of install / witdhraw latencies for each batch
-        batchInstallLat = []
-        batchWithdrawLat = []
-
-        sleepTime = 10
-
-        baseDir = "/tmp/"
-
-        # Batch size increase loop
-        for batch in range( 0, 5 ):
-            # Max intent install measurement of all nodes
-            # Resets after each batch calculation
-            maxInstallLat = []
-            maxWithdrawLat = []
-            # Max single intent install measurement of all nodes
-            # For example, if batch size is 1000, result latency
-            # will be divided by 1000
-            maxSingleInstallLat = []
-            maxSingleWithdrawLat = []
-            # Statistical gathering loop over number of iterations
-            for i in range( 0, int( numIter ) ):
-                main.log.info( "Pushing " +
-                               str( int( batchIntentSize ) * int( nThread ) ) +
-                               " intents. Iteration " + str( i ) )
-
-                for node in range( 1, clusterCount + 1 ):
-                    saveDir = baseDir + "batch_intent_" + str( node ) + ".txt"
-                    main.ONOSbench.pushTestIntentsShell(
-                        deviceIdList[ 0 ] + "/2",
-                        deviceIdList[ 7 ] + "/2",
-                        batchIntentSize,
-                        saveDir, ONOSIpList[ node - 1 ],
-                        numMult=nThread )
-
-                # Wait sufficient time for intents to start
-                # installing
-                time.sleep( sleepTime )
-
-                intent = ""
-                counter = 300
-                while len( intent ) > 0 and counter > 0:
-                    main.ONOS1cli.handle.sendline(
-                        "intents | wc -l" )
-                    main.ONOS1cli.handle.expect(
-                        "intents | wc -l" )
-                    main.ONOS1cli.handle.expect(
-                        "onos>" )
-                    intentTemp = main.ONOS1cli.handle.before()
-                    intent = main.ONOS1cli.intents()
-                    intent = json.loads( intent )
-                    counter = counter - 1
-                    time.sleep( 1 )
-
-                time.sleep( 5 )
-
-                for node in range( 1, clusterCount + 1 ):
-                    saveDir = baseDir + "batch_intent_" + str( node ) + ".txt"
-                    with open( saveDir ) as fOnos:
-                        lineCount = 0
-                        for line in fOnos:
-                            line_temp = ""
-                            main.log.info( "Line read: " + str( line ) )
-                            line_temp = line[ 1: ]
-                            line_temp = line_temp.split( ": " )
-                            #Prevent split method if line doesn't have
-                            #space
-                            if " " in str(line_temp):
-                                result = line_temp[ 1 ].split( " " )[ 0 ]
-                            else:
-                                main.log.warn( "Empty line read" )
-                                result = 0
-                            # TODO: add parameters before appending latency
-                            if lineCount == 0:
-                                if "Failure" in str(line):
-                                    main.log.warn("Intent installation failed")
-                                    result = 'NA' 
-                                else:
-                                    main.log.info("Install result: "+result)
-                                    batchInstallLat.append( int( result ) )
-                                installResult = result
-                            elif lineCount == 1:
-                                if "Failure" in str(line):
-                                    main.log.warn("Intent withdraw failed")
-                                    result = 'NA'
-                                else:
-                                    main.log.info("Withdraw result: "+result)
-                                    batchWithdrawLat.append( int( result ) )
-                                withdrawResult = result
-                            else:
-                                main.log.warn("Invalid results: excess lines")
-                                installResult = 'NA'
-                                withdrawResult = 'NA'
-                            lineCount += 1
-                    main.log.info( "Batch install latency for ONOS" +
-                                   str( node ) + " with " +
-                                   str( batchIntentSize ) + "intents: " +
-                                   str( installResult ) + " ms" )
-                    main.log.info( "Batch withdraw latency for ONOS" +
-                                   str( node ) + " with " +
-                                   str( batchIntentSize ) + "intents: " +
-                                   str( withdrawResult ) + " ms" )
-
-                    main.log.info( "Single intent install latency ONOS" +
-                                    str( node ) + " with " +
-                                    str( batchIntentSize ) + "intents: " +
-                                    str( float(installResult) /\
-                                         int(batchIntentSize) ) + " ms" )
-                    main.log.info( "Single intent withdraw latency ONOS" +
-                                    str( node ) + " with " +
-                                    str( batchIntentSize ) + "intents: " +
-                                    str( float(withdrawResult) /\
-                                         int(batchIntentSize) ) + " ms" )
-
-                #NOTE: END node loop
-
-                if len( batchInstallLat ) > 0 and int( i ) > numIgnore:
-                    maxInstallLat.append( max( batchInstallLat ) )
-                    maxSingleInstallLat.append( 
-                            max( batchInstallLat ) / int( batchIntentSize ) 
-                    )
-                elif len( batchInstallLat ) == 0:
-                    # If I failed to read anything from the file,
-                    # increase the wait time before checking intents
-                    sleepTime += 30
-                if len( batchWithdrawLat ) > 0 and int( i ) > numIgnore:
-                    maxWithdrawLat.append( max( batchWithdrawLat ) )
-                    maxSingleWithdrawLat.append( 
-                            max( batchWithdrawLat ) / int( batchIntentSize ) 
-                    )
-                batchInstallLat = []
-                batchWithdrawLat = []
-
-                # Sleep in between iterations
-                time.sleep( 5 )
-
-            #NOTE: END iteration loop
-
-            if maxInstallLat:
-                avgInstallLat = str( round( numpy.average(maxInstallLat)
-                                          , 2 ))
-                stdInstallLat = str( round(
-                                    numpy.std(maxInstallLat), 2))
-                avgSingleInstallLat = str( round( 
-                                            numpy.average(maxSingleInstallLat)
-                                           , 3 ))
-                stdSingleInstallLat = str( round(
-                                            numpy.std(maxSingleInstallLat),
-                                            3 ))
-            else:
-                avgInstallLat = "NA"
-                stdInstallLat = "NA"
-                main.log.report( "Batch installation failed" )
-                assertion = main.FALSE
-
-            if maxWithdrawLat:
-                avgWithdrawLat = str( round( numpy.average(maxWithdrawLat)
-                                            , 2 ))
-                stdWithdrawLat = str( round(
-                                    numpy.std(maxWithdrawLat), 2))
-                avgSingleWithdrawLat = str( round( 
-                                            numpy.average(maxSingleWithdrawLat)
-                                           , 3 ))
-                stdSingleWithdrawLat = str( round(
-                                            numpy.std(maxSingleWithdrawLat),
-                                            3 ))
-            else:
-                avgWithdrawLat = "NA"
-                stdWithdrawLat = "NA"
-                main.log.report( "Batch withdraw failed" )
-                assertion = main.FALSE
-
-            main.log.report( "Avg of batch installation latency " +
-                             "of size " + str( batchIntentSize ) + ": " +
-                             str( avgInstallLat ) + " ms" )
-            main.log.report( "Std Deviation of batch installation latency " +
-                             ": " +
-                             str( stdInstallLat ) + " ms" )
-            main.log.report( "Avg of single installation latency " +
-                             "of size " + str( batchIntentSize ) + ": " +
-                             str( avgSingleInstallLat ) + " ms" )
-            main.log.report( "Std Deviation of single installation latency " +
-                             ": " +
-                             str( stdSingleInstallLat ) + " ms" )
-
-            main.log.report( "Avg of batch withdraw latency " +
-                             "of size " + str( batchIntentSize ) + ": " +
-                             str( avgWithdrawLat ) + " ms" )
-            main.log.report( "Std Deviation of batch withdraw latency " +
-                             ": " +
-                             str( stdWithdrawLat ) + " ms" )
-            main.log.report( "Avg of single withdraw latency " +
-                             "of size " + str( batchIntentSize ) + ": " +
-                             str( avgSingleWithdrawLat ) + " ms" )
-            main.log.report( "Std Deviation of single withdraw latency " +
-                             ": " +
-                             str( stdSingleWithdrawLat ) + " ms" )
-
-            dbCmd = (
-                "INSERT INTO intents_latency_tests VALUES("
-                "'"+timeToPost+"','intents_latency_results',"
-                ""+runNum+","+str(clusterCount)+","+str(batchIntentSize)+","
-                ""+str(avgInstallLat)+","+str(stdInstallLat)+","
-                ""+str(avgWithdrawLat)+","+str(stdWithdrawLat)+");"
-            )
-
-            # Write result to file (which is posted to DB by jenkins)
-            fResult = open(intentFilePath, 'a')
-            if dbCmd:        
-                fResult.write(dbCmd+"\n")
-            fResult.close()
-
-            if batch == 0:
-                batchIntentSize = 10
-            elif batch == 1:
-                batchIntentSize = 100
-            elif batch == 2:
-                batchIntentSize = 1000
-            elif batch == 3:
-                batchIntentSize = 2000
-            if batch < 4:
-                main.log.report( "Increasing batch intent size to " +
-                             str(batchIntentSize) )
-
-        #NOTE: END batch loop
-
-        #main.log.info( "Removing all intents for next test case" )
-        #jsonTemp = main.ONOS1cli.intents( jsonFormat=True )
-        #jsonObjIntents = json.loads( jsonTemp )
-        # if jsonObjIntents:
-        #    for intents in jsonObjIntents:
-        #        tempId = intents[ 'id' ]
-            # main.ONOS1cli.removeIntent( tempId )
-        #        main.ONOS1cli.removeIntent( tempId )
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=assertion,
-            onpass="Batch intent install/withdraw test successful",
-            onfail="Batch intent install/withdraw test failed" )
-
-    def CASE5( self, main ):
-        """
-        Increase number of nodes and initiate CLI
-        """
-        import time
-        import json
-
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
-        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
-        ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ]
-        ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ]
-        ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ]
-        ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ]
-
-        global clusterCount
-        clusterCount += 2
-        main.log.report( "Increasing cluster size to " +
-                         str( clusterCount ) )
-
-        installResult = main.FALSE
-
-        if clusterCount == 3:
-            installResult1 = \
-                main.ONOSbench.onosInstall( node=ONOS2Ip )
-            installResult2 = \
-                main.ONOSbench.onosInstall( node=ONOS3Ip )
-            time.sleep( 5 )
-
-            main.log.info( "Starting ONOS CLI" )
-            main.ONOS2cli.startOnosCli( ONOS2Ip )
-            main.ONOS3cli.startOnosCli( ONOS3Ip )
-
-            installResult = installResult1 and installResult2
-
-        if clusterCount == 5:
-            main.log.info( "Installing ONOS on node 4 and 5" )
-            installResult1 = \
-                main.ONOSbench.onosInstall( node=ONOS4Ip )
-            installResult2 = \
-                main.ONOSbench.onosInstall( node=ONOS5Ip )
-
-            main.log.info( "Starting ONOS CLI" )
-            main.ONOS4cli.startOnosCli( ONOS4Ip )
-            main.ONOS5cli.startOnosCli( ONOS5Ip )
-
-            installResult = installResult1 and installResult2
-
-        if clusterCount == 7:
-            main.log.info( "Installing ONOS on node 6 and 7" )
-            installResult1 = \
-                main.ONOSbench.onosInstall( node=ONOS6Ip )
-            installResult2 = \
-                main.ONOSbench.onosInstall( node=ONOS7Ip )
-
-            main.log.info( "Starting ONOS CLI" )
-            main.ONOS6cli.startOnosCli( ONOS6Ip )
-            main.ONOS7cli.startOnosCli( ONOS7Ip )
-
-            installResult = installResult1 and installResult2
-
-        time.sleep( 5 )
-
-        if installResult == main.TRUE:
-            assertion = main.TRUE
-        else:
-            assertion = main.FALSE
-
-        utilities.assert_equals( expect=main.TRUE, actual=assertion,
-                                onpass="Scale out to " + str( clusterCount ) +
-                                " nodes successful",
-                                onfail="Scale out to " + str( clusterCount ) +
-                                " nodes failed" )
-
-    def CASE7( self, main ):
-        # TODO: Fix for scale-out scenario
-        """
-        Batch intent reroute latency
-        """
-        import time
-        import json
-        import requests
-        import os
-        import numpy
-        global clusterCount
-
-        ONOSIpList = []
-        for i in range( 1, 8 ):
-            ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
-
-        ONOSUser = main.params[ 'CTRL' ][ 'user' ]
-        defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
-        batchIntentSize = main.params[ 'TEST' ][ 'batchIntentSize' ]
-        batchThreshMin = int( main.params[ 'TEST' ][ 'batchThresholdMin' ] )
-        batchThreshMax = int( main.params[ 'TEST' ][ 'batchThresholdMax' ] )
-        intfs = main.params[ 'TEST' ][ 'intfs' ]
-        installTime = main.params[ 'JSON' ][ 'installedTime' ]
-
-        # number of iterations of case
-        numIter = main.params[ 'TEST' ][ 'numIter' ]
-        numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
-        numSwitch = int( main.params[ 'TEST' ][ 'numSwitch' ] )
-        nThread = main.params[ 'TEST' ][ 'numMult' ]
-
-        main.log.report( "Batch intent installation test of " +
-                         batchIntentSize + " intents" )
-
-        batchResultList = []
-
-        time.sleep( 10 )
-
-        main.log.info( "Getting list of available devices" )
-        deviceIdList = []
-        jsonStr = main.ONOS1cli.devices()
-        jsonObj = json.loads( jsonStr )
-        for device in jsonObj:
-            deviceIdList.append( device[ 'id' ] )
-
-        batchInstallLat = []
-        batchWithdrawLat = []
-        sleepTime = 10
-
-        baseDir = "/tmp/"
-        maxInstallLat = []
-
-        for i in range( 0, int( numIter ) ):
-            main.log.info( "Pushing " +
-                           str( int( batchIntentSize ) * int( nThread ) ) +
-                           " intents. Iteration " + str( i ) )
-
-            main.ONOSbench.pushTestIntentsShell(
-                deviceIdList[ 0 ] + "/2",
-                deviceIdList[ 7 ] + "/2",
-                batchIntentSize, "/tmp/batch_install.txt",
-                ONOSIpList[ 0 ], numMult="1", appId="1",
-                report=False, options="--install" )
-            # main.ONOSbench.pushTestIntentsShell(
-            #    "of:0000000000001002/1",
-            #    "of:0000000000002002/1",
-            #    133, "/tmp/temp2.txt", "10.128.174.2",
-            #    numMult="6", appId="2",report=False )
-
-            # TODO: Check for installation success then proceed
-            time.sleep( 30 )
-
-            # NOTE: this interface is specific to
-            #      topo-intentFlower.py topology
-            #      reroute case.
-            main.log.info( "Disabling interface " + intfs )
-            main.Mininet1.handle.sendline(
-                "sh ifconfig " + intfs + " down" )
-            t0System = time.time() * 1000
-
-            # TODO: Wait sufficient time for intents to install
-            time.sleep( 10 )
-
-            # TODO: get intent installation time
-
-            # Obtain metrics from ONOS 1, 2, 3
-            intentsJsonStr1 = main.ONOS1cli.intentsEventsMetrics()
-            intentsJsonObj1 = json.loads( intentsJsonStr1 )
-            # Parse values from the json object
-            intentInstall1 = \
-                intentsJsonObj1[ installTime ][ 'value' ]
-            intentRerouteLat1 = \
-                int( intentInstall1 ) - int( t0System )
-
-            if clusterCount == 3:
-                intentsJsonStr2 =\
-                    main.ONOS2cli.intentsEventsMetrics()
-                intentsJsonStr3 =\
-                    main.ONOS3cli.intentsEventsMetrics()
-                intentsJsonObj2 = json.loads( intentsJsonStr2 )
-                intentsJsonObj3 = json.loads( intentsJsonStr3 )
-                intentInstall2 = \
-                    intentsJsonObj2[ installTime ][ 'value' ]
-                intentInstall3 = \
-                    intentsJsonObj3[ installTime ][ 'value' ]
-                intentRerouteLat2 = \
-                    int( intentInstall2 ) - int( t0System )
-                intentRerouteLat3 = \
-                    int( intentInstall3 ) - int( t0System )
-            else:
-                intentRerouteLat2 = 0
-                intentRerouteLat3 = 0
-
-            if clusterCount == 5:
-                intentsJsonStr4 =\
-                    main.ONOS4cli.intentsEventsMetrics()
-                intentsJsonStr5 =\
-                    main.ONOS5cli.intentsEventsMetrics()
-                intentsJsonObj4 = json.loads( intentsJsonStr4 )
-                intentsJsonObj5 = json.loads( intentsJsonStr5 )
-                intentInstall4 = \
-                    intentsJsonObj4[ installTime ][ 'value' ]
-                intentInstall5 = \
-                    intentsJsonObj5[ installTime ][ 'value' ]
-                intentRerouteLat4 = \
-                    int( intentInstall4 ) - int( t0System )
-                intentRerouteLat5 = \
-                    int( intentInstall5 ) - int( t0System )
-            else:
-                intentRerouteLat4 = 0
-                intentRerouteLat5 = 0
-
-            if clusterCount == 7:
-                intentsJsonStr6 =\
-                    main.ONOS6cli.intentsEventsMetrics()
-                intentsJsonStr7 =\
-                    main.ONOS7cli.intentsEventsMetrics()
-                intentsJsonObj6 = json.loads( intentsJsonStr6 )
-                intentsJsonObj7 = json.loads( intentsJsonStr7 )
-                intentInstall6 = \
-                    intentsJsonObj6[ installTime ][ 'value' ]
-                intentInstall7 = \
-                    intentsJsonObj7[ installTime ][ 'value' ]
-                intentRerouteLat6 = \
-                    int( intentInstall6 ) - int( t0System )
-                intentRerouteLat7 = \
-                    int( intentInstall7 ) - int( t0System )
-            else:
-                intentRerouteLat6 = 0
-                intentRerouteLat7 = 0
-
-            intentRerouteLatAvg = \
-                ( intentRerouteLat1 +
-                  intentRerouteLat2 +
-                  intentRerouteLat3 +
-                  intentRerouteLat4 +
-                  intentRerouteLat5 +
-                  intentRerouteLat6 +
-                  intentRerouteLat7 ) / clusterCount
-
-            main.log.info( "Intent reroute latency avg for iteration " +
-                           str( i ) + ": " + str( intentRerouteLatAvg ) )
-            # TODO: Remove intents for next iteration
-
-            time.sleep( 5 )
-
-            intentsStr = main.ONOS1cli.intents()
-            intentsJson = json.loads( intentsStr )
-            for intents in intentsJson:
-                intentId = intents[ 'id' ]
-                # TODO: make sure this removes all intents
-                # print intentId
-                if intentId:
-                    main.ONOS1cli.removeIntent( intentId )
-
-            main.Mininet1.handle.sendline(
-                "sh ifconfig " + intfs + " up" )
-
-            main.log.info( "Intents removed and port back up" )
-
-    def CASE9( self, main ):
-        count = 0
-        swNum1 = 1
-        swNum2 = 1
-        appid = 0
-        portNum1 = 1
-        portNum2 = 1
-
-        time.sleep( 30 )
-
-        while True:
-            # main.ONOS1cli.pushTestIntents(
-                    #"of:0000000000001001/1",
-                #"of:0000000000002001/1",
-                #    100, numMult="10", appId="1" )
-            # main.ONOS2cli.pushTestIntents(
-            #    "of:0000000000001002/1",
-            #    "of:0000000000002002/1",
-            #    100, numMult="10", appId="2" )
-            # main.ONOS2cli.pushTestIntents(
-            #    "of:0000000000001003/1",
-            #    "of:0000000000002003/1",
-            #    100, numMult="10", appId="3" )
-            count += 1
-
-            if count >= 100:
-                main.ONOSbench.handle.sendline(
-                    "onos 10.128.174.1 intents-events-metrics >>" +
-                    " /tmp/metrics_intents_temp.txt &" )
-                count = 0
-
-            arg1 = "of:000000000000100" + str( swNum1 ) + "/" + str( portNum1 )
-            arg2 = "of:000000000000200" + str( swNum2 ) + "/" + str( portNum2 )
-
-            swNum1 += 1
-
-            if swNum1 > 7:
-                swNum1 = 1
-                swNum2 += 1
-                if swNum2 > 7:
-                    appid += 1
-
-            if swNum2 > 7:
-                swNum2 = 1
-
-            main.ONOSbench.pushTestIntentsShell(
-                arg1,
-                arg2,
-                100, "/tmp/temp.txt", "10.128.174.1",
-                numMult="10", appId=appid, report=False )
-            # main.ONOSbench.pushTestIntentsShell(
-            #    "of:0000000000001002/1",
-            #    "of:0000000000002002/1",
-            #    133, "/tmp/temp2.txt", "10.128.174.2",
-            #    numMult="6", appId="2",report=False )
-            # main.ONOSbench.pushTestIntentsShell(
-            #    "of:0000000000001003/1",
-            #    "of:0000000000002003/1",
-            #    133, "/tmp/temp3.txt", "10.128.174.3",
-            #    numMult="6", appId="3",report=False )
-
-            time.sleep( 0.2 )
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.topo b/TestON/tests/IntentPerfNext/IntentPerfNext.topo
deleted file mode 100644
index 5575237..0000000
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.topo
+++ /dev/null
@@ -1,109 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-        
-        <ONOSbench>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOSbench>
-
-        <ONOS1cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1cli>
-
-        <ONOS2cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2cli>
-        
-        <ONOS3cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS3cli>
-        
-        <ONOS4cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS4cli>
-        
-        <ONOS5cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS5cli>
-        
-        <ONOS6cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS6cli>
-        
-        <ONOS7cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS7cli>
-
-        <ONOS1>
-            <host>10.128.174.1</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <Mininet1>
-            <host>10.128.10.90</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-                <arg1> --custom topo-intent-8sw.py </arg1>
-                <arg2> --arp --mac --topo mytopo </arg2>
-                <arg3> </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.10.90</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/IntentPerfNext/__init__.py b/TestON/tests/IntentPerfNext/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/IntentPerfNext/__init__.py
+++ /dev/null
diff --git a/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py b/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
index 32477a6..7ddc70f 100644
--- a/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
+++ b/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
@@ -116,40 +116,40 @@
         
         if clusterCount == 1:
             for i in range(1, numSwitch + 1):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS1Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS1Ip, port=defaultSwPort)
         if clusterCount == 3:
             for i in range(1, 3):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS1Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS1Ip, port=defaultSwPort)
             for i in range(3, 6):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS2Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS2Ip, port=defaultSwPort)
             for i in range(6, 9):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS3Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS3Ip, port=defaultSwPort)
         if clusterCount == 5:
-            main.Mininet1.assignSwController(sw='1',
-                    ip1=ONOS1Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='2',
-                    ip1=ONOS2Ip, port1=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s1',
+                    ip=ONOS1Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s2',
+                    ip=ONOS2Ip, port=defaultSwPort)
             for i in range(3, 6):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS3Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='6',
-                    ip1=ONOS4Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='7', 
-                    ip1=ONOS5Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='8',
-                    ip1=ONOS5Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS3Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s6',
+                    ip=ONOS4Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s7', 
+                    ip=ONOS5Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s8',
+                    ip=ONOS5Ip, port=defaultSwPort)
         if clusterCount == 7:
             for i in range(1, 9):
                 if i < 8:
-                    main.Mininet1.assignSwController(sw=str(i),
-                            ip1=ONOSIpList[i - 1], port1=defaultSwPort)
+                    main.Mininet1.assignSwController(sw="s" + str(i),
+                            ip=ONOSIpList[i - 1], port=defaultSwPort)
                 elif i >= 8:
-                    main.Mininet1.assignSwController(sw=str(i),
-                            ip1=ONOSIpList[6], port1=defaultSwPort)
+                    main.Mininet1.assignSwController(sw="s" + str(i),
+                            ip=ONOSIpList[6], port=defaultSwPort)
 
         time.sleep(20)
         
@@ -376,40 +376,40 @@
         
         if clusterCount == 1:
             for i in range(1, numSwitch + 1):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS1Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS1Ip, port=defaultSwPort)
         if clusterCount == 3:
             for i in range(1, 3):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS1Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS1Ip, port=defaultSwPort)
             for i in range(3, 6):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS2Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS2Ip, port=defaultSwPort)
             for i in range(6, 9):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS3Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS3Ip, port=defaultSwPort)
         if clusterCount == 5:
-            main.Mininet1.assignSwController(sw='1',
-                    ip1=ONOS1Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='2',
-                    ip1=ONOS2Ip, port1=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s1',
+                    ip=ONOS1Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s2',
+                    ip=ONOS2Ip, port=defaultSwPort)
             for i in range(3, 6):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS3Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='6', 
-                    ip1=ONOS4Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='7',
-                    ip1=ONOS5Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='8',
-                    ip1=ONOS5Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS3Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s6', 
+                    ip=ONOS4Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s7',
+                    ip=ONOS5Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s8',
+                    ip=ONOS5Ip, port=defaultSwPort)
         if clusterCount == 7:
             for i in range(1, 9):
                 if i < 8:
-                    main.Mininet1.assignSwController(sw=str(i),
-                            ip1=ONOSIpList[i - 1], port1=defaultSwPort)
+                    main.Mininet1.assignSwController(sw="s" + str(i),
+                            ip=ONOSIpList[i - 1], port=defaultSwPort)
                 elif i >= 8:
-                    main.Mininet1.assignSwController(sw=str(i),
-                            ip1=ONOSIpList[6], port1=defaultSwPort)
+                    main.Mininet1.assignSwController(sw="s" + str(i),
+                            ip=ONOSIpList[6], port=defaultSwPort)
 
         main.log.report('Batch intent reroute test ')
 
diff --git a/TestON/tests/LincOETest/LincOETest.params b/TestON/tests/LincOETest/LincOETest.params
deleted file mode 100755
index 46e4f19..0000000
--- a/TestON/tests/LincOETest/LincOETest.params
+++ /dev/null
@@ -1,20 +0,0 @@
-<PARAMS>
-    
-    <testcases>1,2</testcases>
-
-    #Environment variables
-    <ENV>
-        <cellName>linc_oe_test</cellName>
-    </ENV>
-
-    <CTRL>
-        <ip1>10.128.174.1</ip1>
-        <port1>6633</port1>
-    </CTRL>
-
-    <GIT>
-        <autoPull>off</autoPull>
-        <checkout>master</checkout>
-    </GIT>
-
-</PARAMS>
diff --git a/TestON/tests/LincOETest/LincOETest.py b/TestON/tests/LincOETest/LincOETest.py
deleted file mode 100644
index b693138..0000000
--- a/TestON/tests/LincOETest/LincOETest.py
+++ /dev/null
@@ -1,118 +0,0 @@
-# LincOETest
-#
-# Packet-Optical Intent Testing
-#
-# andrew@onlab.us
-
-
-import time
-import sys
-import os
-import re
-
-
-class LincOETest:
-
-    def __init__( self ):
-        self.default = ''
-
-    def CASE1( self, main ):
-        """
-        Startup sequence:
-        git pull
-        mvn clean install
-        onos-package
-        cell <name>
-        onos-verify-cell
-        onos-install -f
-        onos-wait-for-start
-        """
-        import time
-
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
-
-        gitPullTrigger = main.params[ 'GIT' ][ 'autoPull' ]
-        gitCheckoutBranch = main.params[ 'GIT' ][ 'checkout' ]
-
-        main.case( "Setting up test environment" )
-
-        main.step( "Creating cell file" )
-        # params: ( bench ip, cell name, mininet ip, *onos ips )
-        cellFileResult = main.ONOSbench.createCellFile(
-            "10.128.20.10", cellName, "10.128.10.90",
-            "onos-core-trivial,onos-app-fwd",
-            "10.128.174.1" )
-
-        main.step( "Applying cell variable to environment" )
-        # cellResult = main.ONOSbench.setCell( cellName )
-        cellResult = main.ONOSbench.setCell( "temp_cell_2" )
-        verifyResult = main.ONOSbench.verifyCell()
-
-        if gitPullTrigger == 'on':
-            main.step( "Git checkout and pull master" )
-            main.ONOSbench.gitCheckout( gitCheckoutBranch )
-            gitPullResult = main.ONOSbench.gitPull()
-        else:
-            main.log.info( "Git checkout and pull skipped by config" )
-            gitPullResult = main.TRUE
-
-        main.step( "Using mvn clean & install" )
-        # cleanInstallResult = main.ONOSbench.cleanInstall()
-        cleanInstallResult = main.TRUE
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()
-
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.ONOSbench.onosInstall()
-        onos1Isup = main.ONOSbench.isup()
-
-        main.step( "Starting ONOS service" )
-        startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
-        main.step( "Setting cell for ONOScli" )
-        main.ONOScli.setCell( cellName )
-
-        main.step( "Starting ONOScli" )
-        main.ONOScli.startOnosCli( ONOS1Ip )
-
-        case1Result = ( cleanInstallResult and packageResult and
-                        cellResult and verifyResult and onosInstallResult and
-                        onos1Isup and startResult )
-        utilities.assertEquals( expect=main.TRUE, actual=case1Result,
-                                onpass="Test startup successful",
-                                onfail="Test startup NOT successful" )
-
-        time.sleep( 10 )
-
-    def CASE2( self, main ):
-        """
-        Configure topology
-        """
-        import time
-
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
-
-        # Assign packet level switches to controller
-        main.Mininet1.assignSwController(
-            sw="1",
-            ip1=ONOS1Ip,
-            port1=defaultSwPort )
-        main.Mininet1.assignSwController(
-            sw="2",
-            ip1=ONOS1Ip,
-            port1=defaultSwPort )
-
-        # Check devices in controller
-        # This should include Linc-OE devices as well
-        devices = main.ONOScli.devices()
-        main.log.info( devices )
-
-    def CASE3( self, main ):
-        """
-        Install multi-layer intents
-        """
diff --git a/TestON/tests/LincOETest/LincOETest.topo b/TestON/tests/LincOETest/LincOETest.topo
deleted file mode 100755
index 5d572ca..0000000
--- a/TestON/tests/LincOETest/LincOETest.topo
+++ /dev/null
@@ -1,55 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOSbench>
-            <host>10.128.20.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOSbench>
-
-        <ONOScli>
-            <host>10.128.20.10<</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOScli>
-
-        <ONOS1>
-            <host>10.128.174.1</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <LincOE>
-            <host>10.128.10.90</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>LincOEDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </LincOE>
-
-        <Mininet1>
-            <host>10.128.10.90</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS> 
-                <arg1> --custom optical.py </arg1>
-                <arg2> --arp --mac</arg2>
-                <arg3> --topo optical</arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/LincOETest/__init__.py b/TestON/tests/LincOETest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/LincOETest/__init__.py
+++ /dev/null
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.params b/TestON/tests/LinkEventTP/LinkEventTP.params
deleted file mode 100644
index 7a47a51..0000000
--- a/TestON/tests/LinkEventTP/LinkEventTP.params
+++ /dev/null
@@ -1,62 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3</testcases>
-    
-    <ENV>
-        <cellName>network_tp_test</cellName>
-        <cellFeatures>"webconsole,onos-core,onos-api,onos-cli,onos-null,onos-rest,onos-app-metrics,onos-app-metrics-intent,onos-app-metrics-topology"</cellFeatures>
-        <onBaremetal>true</onBaremetal>   "true"
-    </ENV>
-        
-    <SCALE>6</SCALE>
-    
-    <availableNodes>7</availableNodes>
-
-    <GIT>
-        <autopull>off</autopull>
-        <checkout>master</checkout>
-    </GIT>
-
-    <CTRL>
-        <USER>admin</USER>
-        <ip1>10.254.1.201</ip1>
-        <port1>6633</port1>
-        <ip2>10.254.1.202</ip2>
-        <port2>6633</port2>
-        <ip3>10.254.1.203</ip3>
-        <port3>6633</port3>
-        <ip4>10.254.1.204</ip4>
-        <port4>6633</port4>
-        <ip5>10.254.1.205</ip5>
-        <port5>6633</port5>
-	<ip6>10.254.1.206</ip6>
-        <port6>6633</port6>
-        <ip7>10.254.1.207</ip7>
-        <port7>6633</port7>
-    </CTRL>
-
-    <BENCH>
-        <user>admin</user>
-        <ip1>localhost</ip1>
-    </BENCH>
-
-    <TEST>          #   duration =      time the test loop runs
-                    #   log_interval =  how often the data is reported 
-                    #   wait =          time between tests, used to let the averages run down 
-        <configFile>/onos/tools/package/etc/org.onosproject.net.topology.impl.DefaultTopologyProvider.cfg</configFile>       
-        <flickerRates>20000,20000,20000,20000,20000,20000,20000</flickerRates>
-        <devicesPerNode>40,40,40,40,40,40,40</devicesPerNode>
-        <flickerRate>1000</flickerRate>
-        <linkgraphdif>.03</linkgraphdif>          # 0-1 indicated link/graph rate dif tolerance
-        <duration>1800</duration>
-        <log_interval>15</log_interval>
-        <wait>60</wait>
-        <skipCleanInstall>yes</skipCleanInstall>
-        <MN>localhost</MN>
-        <logFile>link_event_tp_results_LOG</logFile>
-    </TEST>
-
-    <JSON>
-        <intents_rate>intentInstalledRate</intents_rate>
-    </JSON> 
-
-</PARAMS>
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.py b/TestON/tests/LinkEventTP/LinkEventTP.py
deleted file mode 100644
index a4bc0aa..0000000
--- a/TestON/tests/LinkEventTP/LinkEventTP.py
+++ /dev/null
@@ -1,336 +0,0 @@
-# ScaleOutTemplate --> LinkEventTP
-#
-# CASE1 starts number of nodes specified in param file
-#
-# cameron@onlab.us
-
-import sys
-import os
-
-
-class LinkEventTP:
-
-    def __init__( self ):
-        self.default = ''
-
-    def CASE1( self, main ):            #This is the initialization case
-        import os.path                  #this case will clean up all nodes 
-                                        #but only node 1 isnodestarted in this case
-        
-        global clusterCount             #number of nodes running
-        global ONOSIp                   #list of ONOS IP addresses 
-
-        clusterCount = 1
-        ONOSIp = [ 0 ]
-
-        #Load values from params file
-        checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
-        gitPull = main.params[ 'GIT' ][ 'autopull' ]
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        Features= main.params[ 'ENV' ][ 'cellFeatures' ]
-        BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
-        BENCHUser = main.params[ 'BENCH' ][ 'user' ]
-        maxNodes = int(main.params[ 'availableNodes' ])
-        Features = main.params[ 'ENV' ][ 'cellFeatures' ]
-        skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
-        flickerRate = main.params[ 'TEST' ][ 'flickerRate']
-        deviceDistribution = (main.params[ 'TEST' ][ 'devicesPerNode']).split(",")    
-        MNip = main.params[ 'TEST' ][ 'MN' ]
-        logFileName = main.params[ 'TEST' ][ 'logFile' ]
-        onBaremetal = main.params[ 'ENV' ][ 'onBaremetal' ]
-
-        main.ONOSbench.handle.sendline("export TERM=vt100")
-        main.ONOSbench.handle.expect(":~") 	    
-        homeDir = os.path.expanduser('~')
-
-        #Populate ONOSIp with ips from params 
-        for i in range(1, maxNodes + 1): 
- 	    ipString = 'ip' + str(i) 
-     	    ONOSIp.append(main.params[ 'CTRL' ][ ipString ]) 
-        
-	    #kill off all onos processes 
-        main.log.step("Safety check, killing all ONOS processes")
-        main.log.step("before initiating enviornment setup")
-        for node in range(1, maxNodes + 1):
-            main.ONOSbench.onosDie(ONOSIp[node])
-
-        #construct the cell file
-        main.log.step("Creating cell file")
-        cellIp = []
-        for node in range (1, clusterCount + 1):
-            	cellIp.append(ONOSIp[node]) 
-        main.ONOSbench.createCellFile(BENCHIp,cellName,MNip,str(Features), *cellIp)
-
-        main.step( "Set Cell" )
-        main.ONOSbench.setCell(cellName)
-
-        #Uninstall everywhere
-        main.log.step( "Cleaning Enviornment..." )
-        for i in range(1, maxNodes + 1):
-            main.log.info(" Uninstalling ONOS " + str(i) )
-            main.ONOSbench.onosUninstall( ONOSIp[i] )
-
-        myDistribution = []
-        for node in range (1, clusterCount + 1): 
-            myDistribution.append(deviceDistribution[node-1]) 
-
-        main.ONOSbench.createLinkGraphFile( BENCHIp,cellIp,myDistribution) 
-        main.ONOSbench.createNullDevProviderFile( BENCHIp, cellIp, myDistribution) 
-        main.ONOSbench.createNullLinkProviderFile(BENCHIp)
-        
-        #git step - skipable 
-        main.step( "Git checkout and pull " + checkoutBranch )
-        if gitPull == 'on':
-            checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
-            pullResult = main.ONOSbench.gitPull()
-
-        else:
-            checkoutResult = main.TRUE
-            pullResult = main.TRUE
-            main.log.info( "Skipped git checkout and pull" )
-        
-        #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
-        if skipMvn != "yes":
-            mvnResult = main.ONOSbench.cleanInstall()
-
-        ### configure event rate file ###
-        main.log.step("Writing Default Topology Provider config file")
-        localPath = main.params[ 'TEST' ][ 'configFile' ]
-        filePath = homeDir + localPath
-        main.log.info(filePath)
-        configFile = open(filePath, 'w+')
-        main.log.info("File Opened")
-        configFile.write("maxEvents = 1\n")
-        configFile.write("maxIdleMs = 0\n")
-        configFile.write("maxBatchMs = 0\n")
-        main.log.info("File written and closed")
-        configFile.close()
-
-        logFile = open(logFileName, 'w+')
-        main.log.info("Created log File")
-        logFile.close()
-
-        if onBaremetal == "true":
-            filename = "/onos/tools/package/bin/onos-service"
-            serviceConfig = open(homeDir + filename, 'w+')
-            serviceConfig.write("#!/bin/bash\n ")
-            serviceConfig.write("#------------------------------------- \n ")
-            serviceConfig.write("# Starts ONOS Apache Karaf container\n ")
-            serviceConfig.write("#------------------------------------- \n ")
-            serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ")
-            serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms256m -Xmx8G}" \n """)
-            serviceConfig.write("")
-            serviceConfig.write("ONOS_HOME=/opt/onos \n ")
-            serviceConfig.write("")
-            serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n")
-            serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """)
-            serviceConfig.close() 
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()  
-
-        main.step( "Installing ONOS package" )
-        install1Result = main.ONOSbench.onosInstall( node=ONOSIp[1] )
-
-        main.step( "Verify cells" )
-        verifyCellResult = main.ONOSbench.verifyCell()
-
-        main.step( "Enviornment setup and verification complete." )
-        main.ONOS1cli.startOnosCli( ONOSIp[1] )
-        main.step( "ONOS 1 is up and running." )
-        main.ONOSbench.handle.expect(":~") #there is a dangling sendline somewhere...	
-    
-    def CASE2( self, main ):
-        # This case increases the cluster size by whatever scale is
-        # Note: 'scale' is the size of the step
-        # if scaling is not a part of your test, simply run this case
-        # once after CASE1 to set up your enviornment for your desired 
-        # cluster size. If scaling is a part of you test call this case each time 
-        # you want to increase cluster size
-
-        ''                                                         
-        'Increase number of nodes and initiate CLI'
-        ''
-        import time
-        global clusterCount
-    
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        Features= main.params[ 'ENV' ][ 'cellFeatures' ]
-        BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
-        MNip = main.params[ 'TEST' ][ 'MN' ]        
-        deviceDistribution = (main.params[ 'TEST' ][ 'devicesPerNode']).split(",")
-
-        scale = int( main.params[ 'SCALE' ] )
-        clusterCount += scale
-
-        main.log.step( "Cleaning Enviornment..." )
-        for i in range(1, maxNodes + 1):
-            main.ONOSbench.onosDie(ONOSIp[i])
-            main.log.info(" Uninstalling ONOS " + str(i) )
-            main.ONOSbench.onosUninstall( ONOSIp[i] )
-
-        myDistribution = []
-        for node in range (1, clusterCount + 1):
-            myDistribution.append(deviceDistribution[node-1])
-
-        main.log.step("Creating cell file")
-        cellIp = []
-        for node in range (1, clusterCount + 1):
-                cellIp.append(ONOSIp[node])
-        main.ONOSbench.createCellFile(BENCHIp,cellName,MNip,str(Features), *cellIp)
-
-        main.ONOSbench.createLinkGraphFile( BENCHIp,cellIp,myDistribution)
-        main.ONOSbench.createNullDevProviderFile( BENCHIp, cellIp, myDistribution)
-        main.ONOSbench.createNullLinkProviderFile(BENCHIp)
-
-        main.step( "Set Cell" )
-        main.ONOSbench.setCell(cellName)
-
-        main.step( "Packaging" ) 
-        main.ONOSbench.onosPackage()
-
-        main.log.report( "Increasing cluster size to " + str( clusterCount ) )
-        for node in range(1, clusterCount + 1):
-            time.sleep(10)
-            main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
-            main.ONOSbench.onosInstall( node=ONOSIp[node] )
-            exec "a = main.ONOS%scli.startOnosCli" %str(node)
-            a(ONOSIp[node])
-        
-        for node in range(1, clusterCount + 1):
-            for i in range( 2 ):
-                isup = main.ONOSbench.isup( ONOSIp[node] )
-                if isup:
-                    main.log.info("ONOS " + str(node) + " is up\n")
-                    break
-            if not isup:
-                main.log.report( "ONOS " + str(node) + " didn't start!" )
-    
-    def CASE3( self, main ):   
-        import time
-        import json
-        import string 
-        import csv
-        import os.path
-        import requests
-        import numpy
-
-        sustainability = float(main.params[ 'TEST' ][ 'linkgraphdif' ])
-        flickerRates = (main.params[ 'TEST' ][ 'flickerRates']).split(",")        
-        homeDir = os.path.expanduser('~')     
-
-        linkResult = main.FALSE
-        scale = int( main.params[ 'SCALE' ] )
-
-        testDelay = main.params[ 'TEST' ][ 'wait' ]
-                
-        for node in range(1, clusterCount + 1): 
-            main.log.info("Writing flicker file to node " + str(node))
-            main.ONOSbench.createNullLinkProviderFile( ONOSIp[node], eventRate=flickerRates[node-1], onNode=True  )     
-
-        testDuration = main.params[ 'TEST' ][ 'duration' ]
-        stop = time.time() + float( testDuration )
-
-        msg = ( "Starting test loop for " + str(testDuration) + " seconds on a " + str(clusterCount) + " node cluster" )
-        main.log.info( msg )
-        logInterval = main.params[ 'TEST' ][ 'log_interval' ]
-
-        linkResults = [0,0,0,0,0,0,0,0]
-        graphResults = [0,0,0,0,0,0,0,0]
-        JsonStr = [ 0,0,0,0,0,0,0,0 ]
-        JsonObj = [ 0,0,0,0,0,0,0,0 ]
-        
-        while time.time() < stop:
-            time.sleep( float( logInterval ) )
-            for node in range(1, clusterCount+1):         
-                main.ONOSbench.handle.sendline("""onos $OC1 topology-events-metrics|grep "Topology Link Events"|cut -d ' ' -f7 """)
-                main.ONOSbench.handle.expect(":~") 
-                raw = (main.ONOSbench.handle.before).splitlines() 
-                myresult = "--"
-                for word in raw: 
-                    if "m1" in word: 
-                        myresult = word 
-                        myresult = myresult.replace("m1=","")
-                        break 
-                if myresult == "--": 
-                    main.log.error("Parse error or no data error") 
-                msg = ( "Node " + str(node)  +  " Link Event TP: " + str(myresult) )
-                main.log.info( msg )
-                linkResults[node] = round(float(myresult),2)
-                myLinkRate = round(float(myresult),2)
-
-                main.ONOSbench.handle.sendline("""onos $OC1 topology-events-metrics|grep "Topology Graph Events"|cut -d ' ' -f7 """)
-                main.ONOSbench.handle.expect(":~")
-                raw = (main.ONOSbench.handle.before).splitlines()
-                myresult = "--"
-                for word in raw:
-                    if "m1" in word:
-                        myresult = word
-                        myresult = myresult.replace("m1=","")
-                        break
-                if myresult == "--":
-                    main.log.error("Parse error or no data error")
-                msg = ( "Node " + str(node) + " Graph Event TP: " + str(myresult) )
-                main.log.info( msg )
-                graphResults[node] = round(float(myresult),2)
-                myGraphRate = round(float(myresult),2)
-                
-                difLinkGraph = float(myLinkRate - myGraphRate)
-                difLinkGraph = numpy.absolute(difLinkGraph)
-                main.log.info("Node " + str(node) + " abs(Link event - Graph event) = " + str(difLinkGraph)) 
-                tempx = numpy.divide(difLinkGraph,float(myLinkRate)) 
-                if tempx > sustainability:
-                    main.log.error("Difference in link event rate and graph event rate above " + str(sustainability) + " tolerance") 
-                print("")
-
-        print("")
-        print("")
-
-        main.log.report("Final Link Event TP Results on " + str(clusterCount) + " node cluster")
-        main.log.report("_______________________________________________")
-        for node in range(1, clusterCount+1):
-            main.log.report("Node " + str(node) + ": " + str(linkResults[node])) 
-
-        print("")
-        print("")
-
-        main.log.report("Final Graph Event TP Results on " + str(clusterCount) + " node cluster")
-        main.log.report("_______________________________________________")
-        for node in range(1, clusterCount+1):
-            main.log.report("Node " + str(node) + ": " + str(graphResults[node]))           
-          
-        ################################################################################# 
-				# 	Data Logging
-
-        logFileName = main.params[ 'TEST' ][ 'logFile' ]
-        logFile = open(logFileName, 'a')
-        main.log.info("Log file opened")
-        flickerRate = main.params[ 'TEST' ][ 'flickerRate']
-
-        for node in range (1, clusterCount + 1):
-            # replare ->  logFile.write( str(clusterCount) + "," + flickerNodes + "," )
-            logFile.write("'" + "baremetal" + str(node)  + "'," )
-            logFile.write( testDuration + "," )
-            logFile.write( flickerRate + "," )
-            logFile.write( str(linkResults[node]) + "," )
-            logFile.write( str(graphResults[node]) + "\n" )
-
-        logFile.close()
-        main.log.info("Log file closed")        
-        
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.pyc b/TestON/tests/LinkEventTP/LinkEventTP.pyc
deleted file mode 100644
index 644df6d..0000000
--- a/TestON/tests/LinkEventTP/LinkEventTP.pyc
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.topo b/TestON/tests/LinkEventTP/LinkEventTP.topo
deleted file mode 100644
index 3c24161..0000000
--- a/TestON/tests/LinkEventTP/LinkEventTP.topo
+++ /dev/null
@@ -1,146 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-
-        <ONOSbench>
-            <host>10.254.1.200</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS>
-		<home>~/onos</home>
-	    </COMPONENTS>
-
-        </ONOSbench>
-
-        <ONOS1cli>
-            <host>10.254.1.200</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1cli>
-
-        <ONOS2cli>
-            <host>10.254.1.200</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2cli>
-
-        <ONOS3cli>
-            <host>10.254.1.200</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS3cli>
-
-        <ONOS4cli>
-            <host>10.254.1.200</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS4cli>
-
-        <ONOS5cli>
-            <host>10.254.1.200</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS5cli>
-
-	<ONOS6cli>
-            <host>10.254.1.200</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS6cli>
-
-        <ONOS7cli>
-            <host>10.254.1.200</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS7cli>
-
-        <ONOS1>
-            <host>10.254.1.201</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.254.1.202</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.254.1.203</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS3>
-
-        <ONOS4>
-            <host>10.254.1.204</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS4>
-
-	
-        <ONOS5>
-            <host>10.254.1.205</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS5>
-
-        <ONOS6>
-            <host>10.254.1.206</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS6>
-
-        <ONOS7>
-            <host>10.254.1.207</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS7>
-
-    </COMPONENT>
-
-</TOPOLOGY>
diff --git a/TestON/tests/LinkEventTP/__init__.py b/TestON/tests/LinkEventTP/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/LinkEventTP/__init__.py
+++ /dev/null
diff --git a/TestON/tests/LinkEventTP/__init__.pyc b/TestON/tests/LinkEventTP/__init__.pyc
deleted file mode 100644
index 62abfab..0000000
--- a/TestON/tests/LinkEventTP/__init__.pyc
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/MultiProd/MultiProd.py b/TestON/tests/MultiProd/MultiProd.py
index 6bf405b..682b6f1 100644
--- a/TestON/tests/MultiProd/MultiProd.py
+++ b/TestON/tests/MultiProd/MultiProd.py
@@ -255,9 +255,6 @@
 
     def CASE5( self, main ):
         import json
-        from subprocess import Popen, PIPE
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
         ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
         ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
         ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
@@ -294,6 +291,8 @@
         # print "links1 = ", links1
         # print "links2 = ", links2
         # print "links3 = ", links3
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
 
         print "**************"
 
@@ -339,97 +338,46 @@
             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" )
 
         switchesResults1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices1 ) )
+            mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
         print "switches_Result1 = ", switchesResults1
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults1,
                                 onpass="ONOS1 Switches view is correct",
                                 onfail="ONOS1 Switches view is incorrect" )
 
         switchesResults2 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices2 ) )
+            mnSwitches, json.loads( devices2 ), json.loads( ports2 ) )
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults2,
                                 onpass="ONOS2 Switches view is correct",
                                 onfail="ONOS2 Switches view is incorrect" )
 
         switchesResults3 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices3 ) )
+            mnSwitches, json.loads( devices3 ), json.loads( ports3 ) )
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults3,
                                 onpass="ONOS3 Switches view is correct",
                                 onfail="ONOS3 Switches view is incorrect" )
 
-        portsResults1 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports1 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
-                onpass="ONOS1 Ports view is correct",
-                onfail="ONOS1 Ports view is incorrect" )
-
-        portsResults2 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports2 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults2,
-                onpass="ONOS2 Ports view is correct",
-                onfail="ONOS2 Ports view is incorrect" )
-
-        portsResults3 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports3 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
-                onpass="ONOS3 Ports view is correct",
-                onfail="ONOS3 Ports view is incorrect" )
-
         linksResults1 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links1 ) )
+            mnSwitches, mnLinks, json.loads( links1 ) )
         utilities.assertEquals( expect=main.TRUE, actual=linksResults1,
                                 onpass="ONOS1 Links view is correct",
                                 onfail="ONOS1 Links view is incorrect" )
 
         linksResults2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links2 ) )
+            mnSwitches, mnLinks, json.loads( links2 ) )
         utilities.assertEquals( expect=main.TRUE, actual=linksResults2,
                                 onpass="ONOS2 Links view is correct",
                                 onfail="ONOS2 Links view is incorrect" )
 
         linksResults3 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links3 ) )
+            mnSwitches, mnLinks, json.loads( links3 ) )
         utilities.assertEquals( expect=main.TRUE, actual=linksResults3,
                                 onpass="ONOS2 Links view is correct",
                                 onfail="ONOS2 Links view is incorrect" )
 
-        # topoResult = switchesResults1 and switchesResults2
-        # and switchesResults3\
-        # and portsResults1 and portsResults2 and portsResults3\
-        # and linksResults1 and linksResults2 and linksResults3
-
         topoResult = switchesResults1 and switchesResults2 and\
                      switchesResults3 and linksResults1 and linksResults2 and\
                      linksResults3
@@ -730,6 +678,8 @@
         # print "links1 = ", links1
         # print "links2 = ", links2
         # print "links3 = ", links3
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
 
         print "**************"
 
@@ -775,98 +725,47 @@
             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" )
 
         switchesResults1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices1 ) )
+            mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
         print "switches_Result1 = ", switchesResults1
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults1,
                                 onpass="ONOS1 Switches view is correct",
                                 onfail="ONOS1 Switches view is incorrect" )
 
         switchesResults2 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices2 ) )
+            mnSwitches, json.loads( devices2 ), json.loads( ports2 ) )
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults2,
                                 onpass="ONOS2 Switches view is correct",
                                 onfail="ONOS2 Switches view is incorrect" )
 
         switchesResults3 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices3 ) )
+            mnSwitches, json.loads( devices3 ), json.loads( ports3 ) )
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults3,
                                 onpass="ONOS3 Switches view is correct",
                                 onfail="ONOS3 Switches view is incorrect" )
 
-        """
-        portsResults1 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports1 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
-                onpass="ONOS1 Ports view is correct",
-                onfail="ONOS1 Ports view is incorrect" )
-
-        portsResults2 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports2 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults2,
-                onpass="ONOS2 Ports view is correct",
-                onfail="ONOS2 Ports view is incorrect" )
-
-        portsResults3 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports3 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
-                onpass="ONOS3 Ports view is correct",
-                onfail="ONOS3 Ports view is incorrect" )
-        """
         linksResults1 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links1 ) )
+            mnSwitches, mnLinks, json.loads( links1 ) )
         utilities.assertEquals( expect=main.TRUE, actual=linksResults1,
                                 onpass="ONOS1 Links view is correct",
                                 onfail="ONOS1 Links view is incorrect" )
 
         linksResults2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links2 ) )
+            mnSwitches, mnLinks, json.loads( links2 ) )
+
         utilities.assertEquals( expect=main.TRUE, actual=linksResults2,
                                 onpass="ONOS2 Links view is correct",
                                 onfail="ONOS2 Links view is incorrect" )
 
         linksResults3 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links3 ) )
+            mnSwitches, mnLinks, json.loads( links3 ) )
+
         utilities.assertEquals( expect=main.TRUE, actual=linksResults3,
                                 onpass="ONOS2 Links view is correct",
                                 onfail="ONOS2 Links view is incorrect" )
 
-        # topoResult = switchesResults1 and switchesResults2
-        # and switchesResults3\
-        # and portsResults1 and portsResults2 and portsResults3\
-        # and linksResults1 and linksResults2 and linksResults3
-
         topoResult = switchesResults1 and switchesResults2\
                 and switchesResults3 and linksResults1 and\
                 linksResults2 and linksResults3
diff --git a/TestON/tests/MultiProd13/MultiProd13.py b/TestON/tests/MultiProd13/MultiProd13.py
index ee62ce7..a458dec 100644
--- a/TestON/tests/MultiProd13/MultiProd13.py
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -255,9 +255,6 @@
 
     def CASE5( self, main ):
         import json
-        from subprocess import Popen, PIPE
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
         ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
         ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
         ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
@@ -339,97 +336,46 @@
             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" )
-
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
         switchesResults1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices1 ) )
+            mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
         print "switches_Result1 = ", switchesResults1
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults1,
                                 onpass="ONOS1 Switches view is correct",
                                 onfail="ONOS1 Switches view is incorrect" )
 
         switchesResults2 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices2 ) )
+            mnSwitches, json.loads( devices2 ), json.loads( ports2 ) )
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults2,
                                 onpass="ONOS2 Switches view is correct",
                                 onfail="ONOS2 Switches view is incorrect" )
 
         switchesResults3 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices3 ) )
+            mnSwitches, json.loads( devices3 ), json.loads( ports3 ) )
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults3,
                                 onpass="ONOS3 Switches view is correct",
                                 onfail="ONOS3 Switches view is incorrect" )
 
-        portsResults1 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports1 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
-                onpass="ONOS1 Ports view is correct",
-                onfail="ONOS1 Ports view is incorrect" )
-
-        portsResults2 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports2 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults2,
-                onpass="ONOS2 Ports view is correct",
-                onfail="ONOS2 Ports view is incorrect" )
-
-        portsResults3 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports3 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
-                onpass="ONOS3 Ports view is correct",
-                onfail="ONOS3 Ports view is incorrect" )
-
         linksResults1 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links1 ) )
+            mnSwitches, mnLinks, json.loads( links1 ) )
         utilities.assertEquals( expect=main.TRUE, actual=linksResults1,
                                 onpass="ONOS1 Links view is correct",
                                 onfail="ONOS1 Links view is incorrect" )
 
         linksResults2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links2 ) )
+            mnSwitches, mnLinks, json.loads( links2 ) )
         utilities.assertEquals( expect=main.TRUE, actual=linksResults2,
                                 onpass="ONOS2 Links view is correct",
                                 onfail="ONOS2 Links view is incorrect" )
 
         linksResults3 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links3 ) )
+            mnSwitches, mnLinks, json.loads( links3 ) )
         utilities.assertEquals( expect=main.TRUE, actual=linksResults3,
                                 onpass="ONOS2 Links view is correct",
                                 onfail="ONOS2 Links view is incorrect" )
 
-        # topoResult = switchesResults1 and switchesResults2
-        # and switchesResults3\
-        # and portsResults1 and portsResults2 and portsResults3\
-        # and linksResults1 and linksResults2 and linksResults3
-
         topoResult = switchesResults1 and switchesResults2 and\
                      switchesResults3 and linksResults1 and linksResults2 and\
                      linksResults3
@@ -775,98 +721,47 @@
             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" )
 
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
         switchesResults1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices1 ) )
+            mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
         print "switches_Result1 = ", switchesResults1
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults1,
                                 onpass="ONOS1 Switches view is correct",
                                 onfail="ONOS1 Switches view is incorrect" )
 
         switchesResults2 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices2 ) )
+            mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults2,
                                 onpass="ONOS2 Switches view is correct",
                                 onfail="ONOS2 Switches view is incorrect" )
 
         switchesResults3 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devices3 ) )
+            mnSwitches, json.loads( devices1 ), json.loads( ports1 ) )
         utilities.assertEquals( expect=main.TRUE, actual=switchesResults3,
                                 onpass="ONOS3 Switches view is correct",
                                 onfail="ONOS3 Switches view is incorrect" )
 
-        """
-        portsResults1 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports1 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
-                onpass="ONOS1 Ports view is correct",
-                onfail="ONOS1 Ports view is incorrect" )
-
-        portsResults2 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports2 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults2,
-                onpass="ONOS2 Ports view is correct",
-                onfail="ONOS2 Ports view is incorrect" )
-
-        portsResults3 =  main.Mininet1.comparePorts( MNTopo,
-        json.loads( ports3 ) )
-        utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
-                onpass="ONOS3 Ports view is correct",
-                onfail="ONOS3 Ports view is incorrect" )
-        """
         linksResults1 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links1 ) )
+            mnSwitches, mnLinks, json.loads( links1 ) )
         utilities.assertEquals( expect=main.TRUE, actual=linksResults1,
                                 onpass="ONOS1 Links view is correct",
                                 onfail="ONOS1 Links view is incorrect" )
 
         linksResults2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links2 ) )
+            mnSwitches, mnLinks, json.loads( links2 ) )
         utilities.assertEquals( expect=main.TRUE, actual=linksResults2,
                                 onpass="ONOS2 Links view is correct",
                                 onfail="ONOS2 Links view is incorrect" )
 
         linksResults3 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( links3 ) )
+            mnSwitches, mnLinks, json.loads( links3 ) )
         utilities.assertEquals( expect=main.TRUE, actual=linksResults3,
                                 onpass="ONOS2 Links view is correct",
                                 onfail="ONOS2 Links view is incorrect" )
 
-        # topoResult = switchesResults1 and switchesResults2
-        # and switchesResults3\
-        # and portsResults1 and portsResults2 and portsResults3\
-        # and linksResults1 and linksResults2 and linksResults3
-
         topoResult = switchesResults1 and switchesResults2\
                 and switchesResults3 and linksResults1 and\
                 linksResults2 and linksResults3
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
index 398ee96..6240fdb 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -18,7 +18,7 @@
     </ENV>
     <GIT>         
         #autoPull 'on' or 'off'
-        <autoPull>off</autoPull>
+        <autoPull>on</autoPull>
         <branch>master</branch>
     </GIT>
     <TOPO1>
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index 1bd0696..27aa450 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -192,16 +192,21 @@
         startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
         time.sleep(45)
         main.step( "Assign switches to controllers" )
+        onosIps = []
+        onosPort = []
+        onosIps.append( ONOS1_ip )
+        onosIps.append( ONOS2_ip )
+        onosIps.append( ONOS3_ip )
+        onosPort.append( ONOS1_port )
+        onosPort.append( ONOS2_port )
+        onosPort.append( ONOS3_port )
+
         for i in range( 1, ( main.numMNswitches + 1 ) ):  # 1 to ( num of switches +1 )
             main.Mininet1.assignSwController(
-                sw=str( i ),
+                sw="s" + 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 )
+                ip=onosIps,
+                port=onosPort )
 
         switch_mastership = main.TRUE
         for i in range( 1, ( main.numMNswitches + 1 ) ):
@@ -278,16 +283,21 @@
         startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
         time.sleep(15)
         main.step( "Assign switches to controllers" )
+        onosIps = []
+        onosPort = []
+        onosIps.append( ONOS1_ip )
+        onosIps.append( ONOS2_ip )
+        onosIps.append( ONOS3_ip )
+        onosPort.append( ONOS1_port )
+        onosPort.append( ONOS2_port )
+        onosPort.append( ONOS3_port )
+
         for i in range( 1, ( main.numMNswitches + 1 ) ):  # 1 to ( num of switches +1 )
             main.Mininet1.assignSwController(
-                sw=str( i ),
+                sw="s" + 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 )
+                ip=onosIps,
+                port=onosPort )
 
         switch_mastership = main.TRUE
         for i in range( 1, ( main.numMNswitches + 1 ) ):
@@ -345,16 +355,21 @@
         startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
         time.sleep(60)
         main.step( "Assign switches to controllers" )
+        onosIps = []
+        onosPort = []
+        onosIps.append( ONOS1_ip )
+        onosIps.append( ONOS2_ip )
+        onosIps.append( ONOS3_ip )
+        onosPort.append( ONOS1_port )
+        onosPort.append( ONOS2_port )
+        onosPort.append( ONOS3_port )
+
         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 )
+                sw="s" + str( i ),
+                count=int( main.numCtrls ),
+                ip=onosIps,
+                port=onosPort )
 
         switch_mastership = main.TRUE
         for i in range( 1, ( main.numMNswitches + 1 ) ):
@@ -494,10 +509,9 @@
                     ( numOnosDevices , numOnosLinks ) )
             main.log.info("Topology does not match, exiting CHO test...")
             topoResult = main.FALSE
-            
-            #time.sleep(300)
-            #main.cleanup()
-            #main.exit()
+            # It's better exit here from running the test            
+            main.cleanup()
+            main.exit()
 
         # just returning TRUE for now as this one just collects data
         case3Result = topoResult
@@ -2257,18 +2271,7 @@
                     main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
                     time.sleep(10)
                     main.log.info("Purging WITHDRAWN Intents")
-                    purgeResult  = main.TRUE
-                    for i in range( int( main.numCtrls) ):
-                        t = main.Thread( target=main.CLIs[i].purgeIntents,
-                             threadID=main.threadID,
-                             name="purgeIntents",
-                             args=[ ] )
-                        pool.append(t)
-                        t.start()
-                        main.threadID = main.threadID + 1
-                    for t in pool:
-                        t.join()
-                        purgeResult = purgeResult and t.result        
+                    purgeResult  = main.ONOScli2.purgeIntents()
                 else:
                     time.sleep(10)
                     if len( main.ONOScli1.intents()):
diff --git a/TestON/tests/OpticalFunc13/OpticalFunc13.params b/TestON/tests/OpticalFunc13/OpticalFunc13.params
deleted file mode 100755
index 173d48b..0000000
--- a/TestON/tests/OpticalFunc13/OpticalFunc13.params
+++ /dev/null
@@ -1,47 +0,0 @@
-<PARAMS>
-    
-    <testcases>1,21,22,23</testcases>
-
-    #Environment variables
-    <ENV>
-        <cellName>driver_test</cellName>
-    </ENV>
-
-    <CTRL>
-        <ip1>10.128.20.11</ip1>
-        <port1>6633</port1>
-    </CTRL>
-
-    <PING>
-        <source1>h8</source1>
-        <source2>h9</source2>
-        <source3>h10</source3>
-        <source4>h11</source4>
-        <source5>h12</source5>
-        <source6>h13</source6>
-        <source7>h14</source7>
-        <source8>h15</source8>
-        <source9>h16</source9>
-        <source10>h17</source10>
-        <target1>10.0.0.18</target1>
-        <target2>10.0.0.19</target2>
-        <target3>10.0.0.20</target3>
-        <target4>10.0.0.21</target4>
-        <target5>10.0.0.22</target5>
-        <target6>10.0.0.23</target6>
-        <target7>10.0.0.24</target7>
-        <target8>10.0.0.25</target8>
-        <target9>10.0.0.26</target9>
-        <target10>10.0.0.27</target10>
-    </PING>
-
-    <timers>
-        <LinkDiscovery>5</LinkDiscovery>
-        <SwitchDiscovery>31</SwitchDiscovery>
-    </timers>
-
-    <OPTICAL>
-        <jsonfile> /home/admin/ONOS/tools/test/topos/oe-nonlinear-4.json </jsonfile>
-    </OPTICAL>    
-
-</PARAMS>
diff --git a/TestON/tests/OpticalFunc13/OpticalFunc13.py b/TestON/tests/OpticalFunc13/OpticalFunc13.py
deleted file mode 100755
index 7ddd532..0000000
--- a/TestON/tests/OpticalFunc13/OpticalFunc13.py
+++ /dev/null
@@ -1,248 +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 time
-import json
-
-time.sleep(1)
-class OpticalFunc13:
-    def __init__(self):
-        self.default = ''
-
-    def CASE1(self, main):
-        '''
-        Startup sequence:
-        git pull
-        mvn clean install
-        onos-package
-        cell <name>
-        onos-verify-cell
-        onos-install -f
-        onos-wait-for-start
-        '''
-        
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS1_port = main.params['CTRL']['port1']
-        
-        main.case("Setting up test environment")
-        
-        main.step("Git checkout and pull master and get version")
-        main.ONOSbench.git_checkout("master")
-        git_pull_result = main.ONOSbench.git_pull()
-        print "git_pull_result = ", git_pull_result
-        version_result = main.ONOSbench.get_version()
-        main.log.report(main.ONOSbench.get_version())
-        if git_pull_result == 1:
-            main.step("Using mvn clean & install")
-            clean_install_result = main.ONOSbench.clean_install()
-            #clean_install_result = main.TRUE
-
-        main.step("Applying cell variable to environment")
-        cell_result1 = main.ONOSbench.set_cell(cell_name)
-        verify_result = main.ONOSbench.verify_cell()
-        cell_result2 = main.ONOS2.set_cell(cell_name)
-        #verify_result = main.ONOS2.verify_cell()
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-        
-        cell_result = cell_result1 and cell_result2
-
-        main.step("Creating ONOS package")
-        package_result = main.ONOSbench.onos_package()
-
-        #main.step("Creating a cell")
-        #cell_create_result = main.ONOSbench.create_cell_file(**************)
-
-        main.step("Installing ONOS package")
-        onos_install_result = main.ONOSbench.onos_install()
-        onos1_isup = main.ONOSbench.isup()
-   
-        main.step("Starting ONOS service")
-        start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
-        case1_result = (package_result and\
-                cell_result and verify_result and onos_install_result and\
-                onos1_isup and start_result )
-        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
-                onpass="Test startup successful",
-                onfail="Test startup NOT successful")
-
-    def CASE11(self, main):
-        '''
-        Cleanup sequence:
-        onos-service <node_ip> stop
-        onos-uninstall
-
-        TODO: Define rest of cleanup
-        
-        '''
-
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Cleaning up test environment")
-
-        main.step("Testing ONOS kill function")
-        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
-
-        main.step("Stopping ONOS service")
-        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
-
-        main.step("Uninstalling ONOS service") 
-        uninstall_result = main.ONOSbench.onos_uninstall()
-
-
-    def CASE21(self, main):
-        import time
-        '''
-            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("_____________________________________________")
-        sart_console_result = main.LincOE1.start_console()
-        optical_mn_script = main.LincOE2.run_optical_mn_script()
-        onos_topo_cfg_result = main.ONOSbench.run_onos_topo_cfg(instance_name = main.params['CTRL']['ip1'], json_file = main.params['OPTICAL']['jsonfile'])
-         
-
-
-    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, 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.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-        devices_result = main.ONOS2.devices(json_format = False)
-
-        print "devices_result = ", devices_result
-        devices_linewise = devices_result.split("\n")
-        devices_linewise = devices_linewise[1:-1]
-        roadmCount = 0
-        packetLayerSWCount = 0
-        for line in devices_linewise:
-            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")
-            opticalSW_result = main.TRUE
-        else:
-            print "Number of Optical Switches = %d and is wrong" %roadCount
-            main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is wrong")
-            opticalSW_result = 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")
-            packetSW_result = 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")
-            packetSW_result = main.FALSE
-        print "_________________________________"
-        
-        links_result = main.ONOS2.links(json_format = False)
-        print "links_result = ", links_result
-        print "_________________________________"
-        
-
-
-        #Discover hosts using pingall
-        pingall_result = main.LincOE2.pingall()    
-    
-        hosts_result = main.ONOS2.hosts(json_format = False)
-        print "hosts_result = ", hosts_result   
-        print "_________________________________"
-        hosts_linewise = hosts_result.split("\n")
-        hosts_linewise = hosts_linewise[1:-1]
-        hostCount = 0
-        for line in hosts_linewise:
-            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
-        
-        case22_result = opticalSW_result and packetSW_result and hostDiscovery
-        utilities.assert_equals(expect=main.TRUE, actual=case22_result,
-                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")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000ffffffff0001", 1, "of:0000ffffffff0002", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000ffffffff0002", 1, "of:0000ffffffff0001", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-
-        time.sleep(10)
-        flowHandle = main.ONOS2.flows()
-        #print "flowHandle = ", flowHandle
-        main.log.info("flows :" + flowHandle)
-        intentHandle = main.ONOS2.intents()        
-        main.log.info("intents :" + intentHandle)        
- 
-        Ping_Result = 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
-            Ping_Result = main.FALSE
-            main.log.report("Ping between h1 and h2  failed. Making attempt number "+str(count) + " in 2 seconds")
-            time.sleep(2)
-            ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
-            #ping = main.LincOE2.pinghost()
-        elif ping==main.FALSE:
-            main.log.report("All ping attempts between h1 and h2 have failed")
-            Ping_Result = main.FALSE
-        elif ping==main.TRUE:
-            main.log.info("Ping test between h1 and h2 passed!")
-            Ping_Result = main.TRUE
-        else:
-            main.log.info("Unknown error")
-            Ping_Result = main.ERROR
-        
-        if Ping_Result==main.FALSE:
-            main.log.report("Point intents for packet optical have not ben installed correctly. Cleaning up")
-        if Ping_Result==main.TRUE:
-            main.log.report("Point Intents for packet optical have been installed correctly")
-
-        case23_result = Ping_Result
-        utilities.assert_equals(expect=main.TRUE, actual=case23_result,
-                onpass="Point intents addition for packet optical and Pingall Test successful",
-                onfail="Point intents addition for packet optical and Pingall Test NOT successful")
-
-
diff --git a/TestON/tests/OpticalFunc13/OpticalFunc13.topo b/TestON/tests/OpticalFunc13/OpticalFunc13.topo
deleted file mode 100755
index a3d6cfd..0000000
--- a/TestON/tests/OpticalFunc13/OpticalFunc13.topo
+++ /dev/null
@@ -1,94 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOSbench>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOSbench>
-
-        <ONOS1>
-            <host>10.128.10.11</host>
-            <user>sdn</user>
-            <password>sdn</password>
-            <type>OnosDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2>
-
-        <Mininet1>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-                #Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-                #Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet2>
-
-         <LincOE1>
-            <host>10.128.20.30</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>LincOEDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-                <arg1> </arg1>
-            </COMPONENTS>
-        </LincOE1>
-
-         <LincOE2>
-            <host>10.128.20.30</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-                <arg1> sudo python /home/admin/optical.py </arg1>
-                <arg2> </arg2>
-            </COMPONENTS>
-        </LincOE2>
-
-        <LincOE3>
-            <host>10.128.20.30</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>8</connect_order>
-        </LincOE3>
- 
-    
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OpticalFunc13/__init__.py b/TestON/tests/OpticalFunc13/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/OpticalFunc13/__init__.py
+++ /dev/null
diff --git a/TestON/tests/PingallExample/PingallExample.py b/TestON/tests/PingallExample/PingallExample.py
index c03b0f1..914f48e 100644
--- a/TestON/tests/PingallExample/PingallExample.py
+++ b/TestON/tests/PingallExample/PingallExample.py
@@ -118,9 +118,9 @@
 
         for i in range( 1, 14 ):
             main.Mininet1.assignSwController(
-                sw=str( i ),
-                ip1=ONOS1Ip,
-                port1=ONOS1Port )
+                sw="s" + str( i ),
+                ip=ONOS1Ip,
+                port=ONOS1Port )
 
         mastershipCheck = main.TRUE
         for i in range( 1, 14 ):
diff --git a/TestON/tests/PingallExample/__init__.py b/TestON/tests/PingallExample/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/PingallExample/__init__.py
+++ /dev/null
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
index adbdb24..5673173 100644
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -839,7 +839,7 @@
         time.sleep( 10 )
 
         main.step( "Get list of hosts from Mininet" )
-        hostList = main.Mininet1.getHosts()
+        hostList = main.Mininet1.getHosts().keys()
         main.log.info( hostList )
 
         main.step( "Get host list in ONOS format" )
@@ -1122,9 +1122,6 @@
             Check ONOS topology matches with mininet
         """
         import json
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
-        # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
         main.log.report( "This testcase is testing if all ONOS nodes" +
                          " are in topology sync with mininet" )
         main.log.report( "__________________________________" )
@@ -1171,43 +1168,19 @@
             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()
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
 
         result1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devicesJson ) )
+            mnSwitches, json.loads( devicesJson ), json.loads( portsJson ) )
         result2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( linksJson ) )
+            mnSwitches, mnLinks, json.loads( linksJson ) )
 
-        result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
-        # result = result1 and result2 and result3
         result = result1 and result2
 
         print "***********************"
@@ -1237,8 +1210,6 @@
             down or up properly.
         """
 
-        from sts.topology.teston_topology import TestONTopology
-
         linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
 
         main.log.report( "This testscase is killing a link to ensure that" +
@@ -1333,25 +1304,18 @@
         # 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()
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
 
         result1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devicesJson ) )
+            mnSwitches, json.loads( devicesJson ), json.loads( portsJson ) )
         result2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( linksJson ) )
-        result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
+            mnSwitches, mnLinks, json.loads( linksJson ) )
 
-        # result = result1 and result2 and result3
         result = result1 and result2
         print "***********************"
 
@@ -1381,7 +1345,6 @@
         """
         Intent removal
         """
-        import time
         main.log.report( "This testcase removes any previously added intents" +
                          " before adding any new set of intents" )
         main.log.report( "__________________________________" )
diff --git a/TestON/tests/ProdFunc/ProdFunc.py.save b/TestON/tests/ProdFunc/ProdFunc.py.save
deleted file mode 100644
index 00b895c..0000000
--- a/TestON/tests/ProdFunc/ProdFunc.py.save
+++ /dev/null
@@ -1,1518 +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 ):
-        import time
-        """
-        Startup sequence:
-        cell <name>
-        onos-verify-cell
-        onos-remove-raft-log
-        git pull
-        mvn clean install
-        onos-package
-        onos-install -f
-        onos-wait-for-start
-        """
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
-        main.case( "Setting up test environment" )
-        main.log.report(
-            "This testcase is testing setting up test environment" )
-        main.log.report( "__________________________________" )
-
-        main.step( "Applying cell variable to environment" )
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
-
-        main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
-        main.step( "Git checkout and get version" )
-        #main.ONOSbench.gitCheckout( "master" )
-        gitPullResult = main.ONOSbench.gitPull()
-        main.log.info( "git_pull_result = " + str( gitPullResult ))
-        main.ONOSbench.getVersion( report=True )
-
-        if gitPullResult == 1:
-            main.step( "Using mvn clean & install" )
-            main.ONOSbench.cleanInstall()
-        elif gitPullResult == 0:
-            main.log.report(
-                "Git Pull Failed, look into logs for detailed reason" )
-            main.cleanup()
-            main.exit()
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()
-
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.ONOSbench.onosInstall()
-        if onosInstallResult == main.TRUE:
-            main.log.report( "Installing ONOS package successful" )
-        else:
-            main.log.report( "Installing ONOS package failed" )
-
-        onos1Isup = main.ONOSbench.isup()
-        if onos1Isup == main.TRUE:
-            main.log.report( "ONOS instance is up and ready" )
-        else:
-            main.log.report( "ONOS instance may not be up" )
-
-        main.step( "Starting ONOS service" )
-        startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
-        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        main.step( "Starting Mininet CLI..." )
-        
-        # Starting the mininet using the old way
-        main.step( "Starting Mininet ..." )
-        netIsUp = main.Mininet1.startNet()
-        if netIsUp:
-            main.log.info("Mininet CLI is up")
-        
-        case1Result = ( packageResult and
-                        cellResult and verifyResult
-                        and onosInstallResult and
-                        onos1Isup and startResult )
-        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
-                                 onpass="Test startup successful",
-                                 onfail="Test startup NOT successful" )
-
-    def CASE2( self, main ):
-        """
-        Switch Down
-        """
-        # NOTE: You should probably run a topology check after this
-        import time
-
-        main.case( "Switch down discovery" )
-        main.log.report( "This testcase is testing a switch down discovery" )
-        main.log.report( "__________________________________" )
-
-        switchSleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
-
-        description = "Killing a switch to ensure it is discovered correctly"
-        main.log.report( description )
-        main.case( description )
-
-        # TODO: Make this switch parameterizable
-        main.step( "Kill s28 " )
-        main.log.report( "Deleting s28" )
-        # FIXME: use new dynamic topo functions
-        main.Mininet1.delSwitch( "s28" )
-        main.log.info(
-            "Waiting " +
-            str( switchSleep ) +
-            " seconds for switch down to be discovered" )
-        time.sleep( switchSleep )
-        # Peek at the deleted switch
-        device = main.ONOS2.getDevice( dpid="0028" )
-        print "device = ", device
-        if device[ u'available' ] == 'False':
-            case2Result = main.FALSE
-        else:
-            case2Result = main.TRUE
-        utilities.assert_equals( expect=main.TRUE, actual=case2Result,
-                                 onpass="Switch down discovery successful",
-                                 onfail="Switch down discovery failed" )
-
-    def CASE101( self, main ):
-        """
-        Cleanup sequence:
-        onos-service <nodeIp> stop
-        onos-uninstall
-
-        TODO: Define rest of cleanup
-
-        """
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
-        main.case( "Cleaning up test environment" )
-
-        main.step( "Testing ONOS kill function" )
-        killResult = main.ONOSbench.onosKill( ONOS1Ip )
-
-        main.step( "Stopping ONOS service" )
-        stopResult = main.ONOSbench.onosStop( ONOS1Ip )
-
-        main.step( "Uninstalling ONOS service" )
-        uninstallResult = main.ONOSbench.onosUninstall()
-
-        case11Result = killResult and stopResult and uninstallResult
-        utilities.assert_equals( expect=main.TRUE, actual=case11Result,
-                                 onpass="Cleanup successful",
-                                 onfail="Cleanup failed" )
-
-    def CASE3( self, main ):
-        """
-        Test 'onos' command and its functionality in driver
-        """
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
-        main.case( "Testing 'onos' command" )
-
-        main.step( "Sending command 'onos -w <onos-ip> system:name'" )
-        cmdstr1 = "system:name"
-        cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 )
-        main.log.info( "onos command returned: " + cmdResult1 )
-
-        main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
-        cmdstr2 = "onos:topology"
-        cmdResult2 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 )
-        main.log.info( "onos command returned: " + cmdResult2 )
-
-    def CASE20( self ):
-        """
-            Exit from mininet cli
-            reinstall ONOS
-        """
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
-        main.log.report( "This testcase exits the mininet cli and reinstalls" +
-                         "ONOS to switch over to Packet Optical topology" )
-        main.log.report( "_____________________________________________" )
-        main.case( "Disconnecting mininet and restarting ONOS" )
-        main.step( "Disconnecting mininet and restarting ONOS" )
-        mininetDisconnect = main.Mininet1.disconnect()
-        print "mininetDisconnect = ", mininetDisconnect        
-
-        main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
-        main.step( "Applying cell variable to environment" )
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
-
-        onosInstallResult = main.ONOSbench.onosInstall()
-        if onosInstallResult == main.TRUE:
-            main.log.report( "Installing ONOS package successful" )
-        else:
-            main.log.report( "Installing ONOS package failed" )
-
-        onos1Isup = main.ONOSbench.isup()
-        if onos1Isup == main.TRUE:
-            main.log.report( "ONOS instance is up and ready" )
-        else:
-            main.log.report( "ONOS instance may not be up" )
-
-        main.step( "Starting ONOS service" )
-        startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
-        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        case20Result = mininetDisconnect and cellResult and verifyResult \
-            and onosInstallResult and onos1Isup and \
-            startResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case20Result,
-            onpass= "Exiting functionality mininet topology and reinstalling" +
-                    " ONOS successful",
-            onfail= "Exiting functionality mininet topology and reinstalling" +
-                    " ONOS failed" )
-
-    def CASE21( self, main ):
-        """
-            On ONOS bench, run this command:
-             ./~/ONOS/tools/test/bin/onos-topo-cfg
-            which starts the rest and copies the links
-            json file to the onos instance.
-            Note that in case of Packet Optical, the links are not learnt
-            from the topology, instead the links are learnt
-            from the json config file
-        """
-        main.log.report(
-            "This testcase starts the packet layer topology and REST" )
-        main.log.report( "_____________________________________________" )
-        main.case( "Starting LINC-OE and other components" )
-        main.step( "Starting LINC-OE and other components" )
-        startConsoleResult = main.LincOE1.startConsole()
-        opticalMnScript = main.LincOE2.runOpticalMnScript()
-        onosTopoCfgResult = main.ONOSbench.runOnosTopoCfg(
-            instanceName=main.params[ 'CTRL' ][ 'ip1' ],
-            jsonFile=main.params[ 'OPTICAL' ][ 'jsonfile' ] )
-
-        print "start_console_result =", startConsoleResult
-        print "optical_mn_script = ", opticalMnScript
-        print "onos_topo_cfg_result =", onosTopoCfgResult
-
-        case21Result = startConsoleResult and opticalMnScript and \
-            onosTopoCfgResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case21Result,
-            onpass="Packet optical topology spawned successsfully",
-            onfail="Packet optical topology spawning failed" )
-
-    def CASE22( self, main ):
-        """
-            Curretly we use, 4 linear switch optical topology and
-            2 packet layer mininet switches each with one host.
-            Therefore, the roadmCount variable = 4,
-            packetLayerSWCount variable = 2 and hostCount = 2
-            and this is hardcoded in the testcase. If the topology changes,
-            these hardcoded values need to be changed
-        """
-        main.log.report(
-            "This testcase compares the optical+packet topology against what" +
-            " is expected" )
-        main.case( "Topology comparision" )
-        main.step( "Topology comparision" )
-        main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        devicesResult = main.ONOS3.devices( jsonFormat=False )
-
-        print "devices_result = ", devicesResult
-        devicesLinewise = devicesResult.split( "\n" )
-        devicesLinewise = devicesLinewise[ 1: ]
-        roadmCount = 0
-        packetLayerSWCount = 0
-        for line in devicesLinewise:
-            components = line.split( "," )
-            availability = components[ 1 ].split( "=" )[ 1 ]
-            type = components[ 3 ].split( "=" )[ 1 ]
-            if availability == 'true' and type == 'ROADM':
-                roadmCount += 1
-            elif availability == 'true' and type == 'SWITCH':
-                packetLayerSWCount += 1
-        if roadmCount == 4:
-            print "Number of Optical Switches = %d and is" % roadmCount +\
-                  " correctly detected"
-            main.log.info(
-                "Number of Optical Switches = " +
-                str( roadmCount ) +
-                " and is correctly detected" )
-            opticalSWResult = main.TRUE
-        else:
-            print "Number of Optical Switches = %d and is wrong" % roadmCount
-            main.log.info(
-                "Number of Optical Switches = " +
-                str( roadmCount ) +
-                " and is wrong" )
-            opticalSWResult = main.FALSE
-
-        if packetLayerSWCount == 2:
-            print "Number of Packet layer or mininet Switches = %d "\
-                    % packetLayerSWCount + "and is correctly detected"
-            main.log.info(
-                "Number of Packet layer or mininet Switches = " +
-                str( packetLayerSWCount ) +
-                " and is correctly detected" )
-            packetSWResult = main.TRUE
-        else:
-            print "Number of Packet layer or mininet Switches = %d and"\
-                    % packetLayerSWCount + " is wrong"
-            main.log.info(
-                "Number of Packet layer or mininet Switches = " +
-                str( packetLayerSWCount ) +
-                " and is wrong" )
-            packetSWResult = main.FALSE
-        print "_________________________________"
-
-        linksResult = main.ONOS3.links( jsonFormat=False )
-        print "links_result = ", linksResult
-        print "_________________________________"
-
-        # NOTE:Since only point intents are added, there is no
-        # requirement to discover the hosts
-        # Therfore, the below portion of the code is commented.
-        """
-        #Discover hosts using pingall
-        pingallResult = main.LincOE2.pingall()
-
-        hostsResult = main.ONOS3.hosts( jsonFormat=False )
-        main.log.info( "hosts_result = "+hostsResult )
-        main.log.info( "_________________________________" )
-        hostsLinewise = hostsResult.split( "\n" )
-        hostsLinewise = hostsLinewise[ 1:-1 ]
-        hostCount = 0
-        for line in hostsLinewise:
-            hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
-            hostCount +=1
-        if hostCount ==2:
-            print "Number of hosts = %d and is correctly detected" %hostCount
-            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
-                            is correctly detected" )
-            hostDiscovery = main.TRUE
-        else:
-            print "Number of hosts = %d and is wrong" %hostCount
-            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
-                            is wrong" )
-            hostDiscovery = main.FALSE
-        """
-        case22Result = opticalSWResult and packetSWResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case22Result,
-            onpass="Packet optical topology discovery successful",
-            onfail="Packet optical topology discovery failed" )
-
-    def CASE23( self, main ):
-        import time
-        """
-            Add bidirectional point intents between 2 packet layer( mininet )
-            devices and
-            ping mininet hosts
-        """
-        main.log.report(
-            "This testcase adds bidirectional point intents between 2 " +
-            "packet layer( mininet ) devices and ping mininet hosts" )
-        main.case( "Topology comparision" )
-        main.step( "Adding point intents" )
-        ptpIntentResult = main.ONOS3.addPointIntent(
-            "of:0000ffffffff0001/1",
-            "of:0000ffffffff0002/1" )
-        if ptpIntentResult == main.TRUE:
-            main.ONOS3.intents( jsonFormat=False )
-            main.log.info( "Point to point intent install successful" )
-
-        ptpIntentResult = main.ONOS3.addPointIntent(
-            "of:0000ffffffff0002/1",
-            "of:0000ffffffff0001/1" )
-        if ptpIntentResult == main.TRUE:
-            main.ONOS3.intents( jsonFormat=False )
-            main.log.info( "Point to point intent install successful" )
-
-        time.sleep( 10 )
-        flowHandle = main.ONOS3.flows()
-        main.log.info( "flows :" + flowHandle )
-
-        # Sleep for 30 seconds to provide time for the intent state to change
-        time.sleep( 30 )
-        intentHandle = main.ONOS3.intents( jsonFormat=False )
-        main.log.info( "intents :" + intentHandle )
-
-        PingResult = main.TRUE
-        count = 1
-        main.log.info( "\n\nh1 is Pinging h2" )
-        ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
-        # ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count < 5:
-            count += 1
-            PingResult = main.FALSE
-            main.log.info(
-                "Ping between h1 and h2  failed. Making attempt number " +
-                str( count ) +
-                " in 2 seconds" )
-            time.sleep( 2 )
-        elif ping == main.FALSE:
-            main.log.info( "All ping attempts between h1 and h2 have failed" )
-            PingResult = main.FALSE
-        elif ping == main.TRUE:
-            main.log.info( "Ping test between h1 and h2 passed!" )
-            PingResult = main.TRUE
-        else:
-            main.log.info( "Unknown error" )
-            PingResult = main.ERROR
-
-        if PingResult == main.FALSE:
-            main.log.report(
-                "Point intents for packet optical have not ben installed" +
-                " correctly. Cleaning up" )
-        if PingResult == main.TRUE:
-            main.log.report(
-                "Point Intents for packet optical have been " +
-                "installed correctly" )
-
-        case23Result = PingResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case23Result,
-            onpass= "Point intents addition for packet optical and" +
-                    "Pingall Test successful",
-            onfail= "Point intents addition for packet optical and" +
-                    "Pingall Test NOT successful" )
-
-    def CASE24( self, main ):
-        import time
-        import json
-        """
-            Test Rerouting of Packet Optical by bringing a port down
-            ( port 22 ) of a switch( switchID=1 ), so that link
-            ( between switch1 port22 - switch4-port30 ) is inactive
-            and do a ping test. If rerouting is successful,
-            ping should pass. also check the flows
-        """
-        main.log.report(
-            "This testcase tests rerouting and pings mininet hosts" )
-        main.case( "Test rerouting and pings mininet hosts" )
-        main.step( "Bring a port down and verify the link state" )
-        main.LincOE1.portDown( swId="1", ptId="22" )
-        linksNonjson = main.ONOS3.links( jsonFormat=False )
-        main.log.info( "links = " + linksNonjson )
-
-        links = main.ONOS3.links()
-        main.log.info( "links = " + links )
-
-        linksResult = json.loads( links )
-        linksStateResult = main.FALSE
-        for item in linksResult:
-            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
-                    'src' ][ 'port' ] == "22":
-                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff04" and item[
-                        'dst' ][ 'port' ] == "30":
-                    linksState = item[ 'state' ]
-                    if linksState == "INACTIVE":
-                        main.log.info(
-                            "Links state is inactive as expected due to one" +
-                            " of the ports being down" )
-                        main.log.report(
-                            "Links state is inactive as expected due to one" +
-                            " of the ports being down" )
-                        linksStateResult = main.TRUE
-                        break
-                    else:
-                        main.log.info(
-                            "Links state is not inactive as expected" )
-                        main.log.report(
-                            "Links state is not inactive as expected" )
-                        linksStateResult = main.FALSE
-
-        print "links_state_result = ", linksStateResult
-        time.sleep( 10 )
-        flowHandle = main.ONOS3.flows()
-        main.log.info( "flows :" + flowHandle )
-
-        main.step( "Verify Rerouting by a ping test" )
-        PingResult = main.TRUE
-        count = 1
-        main.log.info( "\n\nh1 is Pinging h2" )
-        ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
-        # ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count < 5:
-            count += 1
-            PingResult = main.FALSE
-            main.log.info(
-                "Ping between h1 and h2  failed. Making attempt number " +
-                str( count ) +
-                " in 2 seconds" )
-            time.sleep( 2 )
-        elif ping == main.FALSE:
-            main.log.info( "All ping attempts between h1 and h2 have failed" )
-            PingResult = main.FALSE
-        elif ping == main.TRUE:
-            main.log.info( "Ping test between h1 and h2 passed!" )
-            PingResult = main.TRUE
-        else:
-            main.log.info( "Unknown error" )
-            PingResult = main.ERROR
-
-        if PingResult == main.TRUE:
-            main.log.report( "Ping test successful " )
-        if PingResult == main.FALSE:
-            main.log.report( "Ping test failed" )
-
-        case24Result = PingResult and linksStateResult
-        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
-                                 onpass="Packet optical rerouting successful",
-                                 onfail="Packet optical rerouting failed" )
-
-    def CASE4( self, main ):
-        import re
-        import time
-        main.log.report( "This testcase is testing the assignment of" +
-                         " all the switches to all the controllers and" +
-                         " discovering the hosts in reactive mode" )
-        main.log.report( "__________________________________" )
-        main.case( "Pingall Test" )
-        main.step( "Assigning switches to controllers" )
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
-        for i in range( 1, 29 ):
-            if i == 1:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-            elif i >= 2 and i < 5:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-            elif i >= 5 and i < 8:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-            elif i >= 8 and i < 18:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-            elif i >= 18 and i < 28:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-            else:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-        SwitchMastership = main.TRUE
-        for i in range( 1, 29 ):
-            if i == 1:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-            elif i >= 2 and i < 5:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-            elif i >= 5 and i < 8:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-            elif i >= 8 and i < 18:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-            elif i >= 18 and i < 28:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-            else:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is" + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-
-        if SwitchMastership == main.TRUE:
-            main.log.report( "Controller assignmnet successful" )
-        else:
-            main.log.report( "Controller assignmnet failed" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=SwitchMastership,
-            onpass="MasterControllers assigned correctly" )
-        """
-        for i in range ( 1,29 ):
-            main.Mininet1.assignSwController( sw=str( i ),count=5,
-                    ip1=ONOS1Ip,port1=ONOS1Port,
-                    ip2=ONOS2Ip,port2=ONOS2Port,
-                    ip3=ONOS3Ip,port3=ONOS3Port,
-                    ip4=ONOS4Ip,port4=ONOS4Port,
-                    ip5=ONOS5Ip,port5=ONOS5Port )
-        """
-        # REACTIVE FWD test
-
-        main.step( "Get list of hosts from Mininet" )
-        hostList = main.Mininet1.getHosts()
-        main.log.info( hostList )
-
-        main.step( "Get host list in ONOS format" )
-        hostOnosList = main.ONOS2.getHostsId( hostList )
-        main.log.info( hostOnosList )
-        # time.sleep( 5 )
-
-        main.step( "Pingall" )
-        pingResult = main.FALSE
-        time1 = time.time()
-        pingResult = main.Mininet1.pingall()
-        time2 = time.time()
-        print "Time for pingall: %2f seconds" % ( time2 - time1 )
-
-        # Start onos cli again because u might have dropped out of
-        # onos prompt to the shell prompt
-        # if there was no activity
-        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-
-        case4Result = SwitchMastership and pingResult
-        if pingResult == main.TRUE:
-            main.log.report( "Pingall Test in reactive mode to" +
-                             " discover the hosts successful" )
-        else:
-            main.log.report( "Pingall Test in reactive mode to" +
-                             " discover the hosts failed" )
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case4Result,
-            onpass="Controller assignment and Pingall Test successful",
-            onfail="Controller assignment and Pingall Test NOT successful" )
-
-    def CASE10( self ):
-        main.log.report(
-            "This testcase uninstalls the reactive forwarding app" )
-        main.log.report( "__________________________________" )
-        main.case( "Uninstalling reactive forwarding app" )
-        # 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 CASE11( self ):
-        # NOTE: This testcase require reactive forwarding mode enabled
-        # NOTE: in the beginning and then uninstall it before adding 
-        # NOTE: point intents. Again the app is installed so that 
-        # NOTE: testcase 10 can be ran successively
-        import time
-        main.log.report(
-            "This testcase moves a host from one switch to another to add" +
-            "point intents between them and then perform ping" )
-        main.log.report( "__________________________________" )
-        main.log.info( "Moving host from one switch to another" )
-        main.case( "Moving host from a device and attach it to another device" )
-        main.step( "Moving host h9 from device s9 and attach it to s8" )
-        main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
-
-        time.sleep(15) #Time delay to have all the flows ready
-        main.step( "Pingall" )
-        pingResult = main.FALSE
-        time1 = time.time()
-        pingResult = main.Mininet1.pingall()
-        time2 = time.time()
-        print "Time for pingall: %2f seconds" % ( time2 - time1 )
-
-        hosts = main.ONOS2.hosts( jsonFormat = False )
-        main.log.info( hosts )
-        
-        main.case( "Uninstalling reactive forwarding app" )
-        # Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
-        main.log.info( "onos-app-fwd uninstalled" )
-
-        main.step( "Add point intents between hosts on the same device")
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003008/1",
-            "of:0000000000003008/3" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003008/3",
-            "of:0000000000003008/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        main.case( "Ping hosts on the same devices" )
-        ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
-
-        '''
-        main.case( "Installing reactive forwarding app" )
-        # Install onos-app-fwd app to enable reactive forwarding
-        appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
-        main.log.info( "onos-app-fwd installed" )
-        '''
-
-        if ping == main.FALSE:
-            main.log.report(
-                "Point intents for hosts on same devices haven't" +
-                " been installed correctly. Cleaning up" )
-        if ping == main.TRUE:
-            main.log.report(
-                "Point intents for hosts on same devices" +
-                "installed correctly. Cleaning up" )
-
-        case11Result = ping and pingResult
-        utilities.assert_equals(
-            expect = main.TRUE,
-            actual = case11Result,
-            onpass = "Point intents for hosts on same devices" +
-                    "Ping Test successful",
-            onfail = "Point intents for hosts on same devices" +
-                    "Ping Test NOT successful" )
-
-
-    def CASE12( self ):
-        """
-        Verify the default flows on each switch in proactive mode
-        """
-        main.log.report( "This testcase is verifying num of default" +
-                         " flows on each switch" )
-        main.log.report( "__________________________________" )
-        main.case( "Verify num of default flows on each switch" )
-        main.step( "Obtaining the device id's and flowrule count on them" )
-
-        case12Result = main.TRUE
-        idList = main.ONOS2.getAllDevicesId()
-        for id in idList:
-            count = main.ONOS2.FlowAddedCount( id )
-            main.log.info("count = " +count)
-            if int(count) != 3:
-                case12Result = main.FALSE
-                break
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case12Result,
-            onpass = "Expected default num of flows exist",
-            onfail = "Expected default num of flows do not exist")
-    
-    
-        
-
-    def CASE6( self ):
-        import time
-        main.log.report( "This testcase is testing the addition of" +
-                         " host intents and then does pingall" )
-        main.log.report( "__________________________________" )
-        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 )
-        flows = main.ONOS2.flows()
-        main.log.info( "flows:" + flows )     
-
-        count = 1
-        i = 8
-        PingResult = main.TRUE
-        # while i<10:
-        while i < 18:
-            main.log.info(
-                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
-            ping = main.Mininet1.pingHost(
-                src="h" + str( i ), target="h" + str( i + 10 ) )
-            if ping == main.FALSE and count < 5:
-                count += 1
-                # i = 8
-                PingResult = main.FALSE
-                main.log.report( "Ping between h" +
-                                 str( i ) +
-                                 " and h" +
-                                 str( i +
-                                      10 ) +
-                                 " failed. Making attempt number " +
-                                 str( count ) +
-                                 " in 2 seconds" )
-                time.sleep( 2 )
-            elif ping == main.FALSE:
-                main.log.report( "All ping attempts between h" +
-                                 str( i ) +
-                                 " and h" +
-                                 str( i +
-                                      10 ) +
-                                 "have failed" )
-                i = 19
-                PingResult = main.FALSE
-            elif ping == main.TRUE:
-                main.log.info( "Ping test between h" +
-                               str( i ) +
-                               " and h" +
-                               str( i +
-                                    10 ) +
-                               "passed!" )
-                i += 1
-                PingResult = main.TRUE
-            else:
-                main.log.info( "Unknown error" )
-                PingResult = main.ERROR
-        if PingResult == main.FALSE:
-            main.log.report(
-                "Ping all test after Host intent addition failed.Cleaning up" )
-            # main.cleanup()
-            # main.exit()
-        if PingResult == main.TRUE:
-            main.log.report(
-                "Ping all test after Host intent addition successful" )
-
-        case6Result = PingResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case6Result,
-            onpass="Pingall Test after Host intents addition successful",
-            onfail="Pingall Test after Host intents addition failed" )
-
-    def CASE5( self, main ):
-        import json
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
-        # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        main.log.report( "This testcase is testing if all ONOS nodes" +
-                         " are in topology sync with mininet" )
-        main.log.report( "__________________________________" )
-        main.case( "Comparing Mininet topology with the topology of ONOS" )
-        main.step( "Start continuous pings" )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source1' ],
-            target=main.params[ 'PING' ][ 'target1' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source2' ],
-            target=main.params[ 'PING' ][ 'target2' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source3' ],
-            target=main.params[ 'PING' ][ 'target3' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source4' ],
-            target=main.params[ 'PING' ][ 'target4' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source5' ],
-            target=main.params[ 'PING' ][ 'target5' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source6' ],
-            target=main.params[ 'PING' ][ 'target6' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source7' ],
-            target=main.params[ 'PING' ][ 'target7' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source8' ],
-            target=main.params[ 'PING' ][ 'target8' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source9' ],
-            target=main.params[ 'PING' ][ 'target9' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source10' ],
-            target=main.params[ 'PING' ][ 'target10' ],
-            pingTime=500 )
-
-        main.step( "Create TestONTopology object" )
-        global ctrls
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
-                temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
-                temp = temp + ( "ONOS" + str( count ), )
-                temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
-                temp = temp + \
-                    ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
-                ctrls.append( temp )
-                count = count + 1
-            else:
-                break
-        global MNTopo
-        Topo = TestONTopology(
-            main.Mininet1,
-            ctrls )  # can also add Intent API info for intent operations
-        MNTopo = Topo
-
-        TopologyCheck = main.TRUE
-        main.step( "Compare ONOS Topology to MN Topology" )
-        devicesJson = main.ONOS2.devices()
-        linksJson = main.ONOS2.links()
-        # portsJson = main.ONOS2.ports()
-
-        result1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devicesJson ) )
-        result2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( linksJson ) )
-        # result3 = main.Mininet1.comparePorts(
-        # MNTopo, json.loads( portsJson ) )
-
-        # result = result1 and result2 and result3
-        result = result1 and result2
-
-        print "***********************"
-pr        if result == main.TRUE:
-            main.log.report( "ONOS" + " Topology matches MN Topology" )
-        else:
-            main.log.report( "ONOS" + " Topology does not match MN Topology" )
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=result,
-            onpass="ONOS" +
-            " Topology matches MN Topology",
-            onfail="ONOS" +
-            " Topology does not match MN Topology" )
-
-        TopologyCheck = TopologyCheck and result
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=TopologyCheck,
-            onpass="Topology checks passed",
-            onfail="Topology checks failed" )
-
-    def CASE7( self, main ):
-        from sts.topology.teston_topology import TestONTopology
-
-        linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
-
-        main.log.report( "This testscase is killing a link to ensure that" +
-                         " link discovery is consistent" )
-        main.log.report( "__________________________________" )
-        main.log.report( "Killing a link to ensure that link discovery" +
-                         " is consistent" )
-        main.case( "Killing a link to Ensure that Link Discovery" +
-                   "is Working Properly" )
-        """
-        main.step( "Start continuous pings" )
-
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
-                               target=main.params[ 'PING' ][ 'target1' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
-                               target=main.params[ 'PING' ][ 'target2' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
-                               target=main.params[ 'PING' ][ 'target3' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
-                               target=main.params[ 'PING' ][ 'target4' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
-                               target=main.params[ 'PING' ][ 'target5' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
-                               target=main.params[ 'PING' ][ 'target6' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
-                               target=main.params[ 'PING' ][ 'target7' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
-                               target=main.params[ 'PING' ][ 'target8' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
-                               target=main.params[ 'PING' ][ 'target9' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
-                               target=main.params[ 'PING' ][ 'target10' ],
-                               pingTime=500 )
-        """
-        main.step( "Determine the current number of switches and links" )
-        topologyOutput = main.ONOS2.topology()
-        topologyResult = main.ONOS1.getTopology( topologyOutput )
-        activeSwitches = topologyResult[ 'deviceCount' ]
-        links = topologyResult[ 'linkCount' ]
-        print "activeSwitches = ", type( activeSwitches )
-        print "links = ", type( links )
-        main.log.info(
-            "Currently there are %s switches and %s links" %
-            ( str( activeSwitches ), str( links ) ) )
-
-        main.step( "Kill Link between s3 and s28" )
-        main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
-        time.sleep( linkSleep )
-        topologyOutput = main.ONOS2.topology()
-        LinkDown = main.ONOS1.checkStatus(
-            topologyOutput, activeSwitches, str(
-                int( links ) - 2 ) )
-        if LinkDown == main.TRUE:
-            main.log.report( "Link Down discovered properly" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=LinkDown,
-            onpass="Link Down discovered properly",
-            onfail="Link down was not discovered in " +
-            str( linkSleep ) +
-            " seconds" )
-
-        # Check ping result here..add code for it
-
-        main.step( "Bring link between s3 and s28 back up" )
-        LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
-        time.sleep( linkSleep )
-        topologyOutput = main.ONOS2.topology()
-        LinkUp = main.ONOS1.checkStatus(
-            topologyOutput,
-            activeSwitches,
-            str( links ) )
-        if LinkUp == main.TRUE:
-            main.log.report( "Link up discovered properly" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=LinkUp,
-            onpass="Link up discovered properly",
-            onfail="Link up was not discovered in " +
-            str( linkSleep ) +
-            " seconds" )
-
-        # NOTE Check ping result here..add code for it
-
-        main.step( "Compare ONOS Topology to MN Topology" )
-        Topo = TestONTopology(
-            main.Mininet1,
-            ctrls )  # can also add Intent API info for intent operations
-        MNTopo = Topo
-        TopologyCheck = main.TRUE
-
-        devicesJson = main.ONOS2.devices()
-        linksJson = main.ONOS2.links()
-        portsJson = main.ONOS2.ports()
-
-        result1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devicesJson ) )
-        result2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( linksJson ) )
-        # result3 = main.Mininet1.comparePorts(
-        # MNTopo, json.loads( portsJson ) )
-
-        # result = result1 and result2 and result3
-        result = result1 and result2
-        print "***********************"
-
-        if result == main.TRUE:
-            main.log.report( "ONOS" + " Topology matches MN Topology" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=result,
-            onpass="ONOS" +
-            " Topology matches MN Topology",
-            onfail="ONOS" +
-            " Topology does not match MN Topology" )
-
-        TopologyCheck = TopologyCheck and result
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=TopologyCheck,
-            onpass="Topology checks passed",
-            onfail="Topology checks failed" )
-
-        result = LinkDown and LinkUp and TopologyCheck
-        utilities.assert_equals( expect=main.TRUE, actual=result,
-                                 onpass="Link failure is discovered correctly",
-                                 onfail="Link Discovery failed" )
-
-    def CASE8( self ):
-        """
-        Intent removal
-        """
-        import time
-        main.log.report( "This testcase removes any previously added intents" +
-                         " before adding any new set of intents" )
-        main.log.report( "__________________________________" )
-        main.log.info( "intent removal" )
-        main.case( "Removing installed intents" )
-        main.step( "Obtain the intent id's" )
-        intentResult = main.ONOS2.intents( jsonFormat=False )
-        main.log.info( "intent_result = " + intentResult )
-        intentLinewise = intentResult.split( "\n" )
-
-        intentList = [line for line in intentLinewise \
-            if line.startswith( "id=")]
-        intentids = [line.split( "," )[ 0 ].split( "=" )[ 1 ] for line in \
-            intentList]
-        for id in intentids:
-            print "id = ", id
-
-        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 )
-        
-        intentList = [line for line in intentResult.split( "\n" ) \
-            if line.startswith( "id=")]
-        intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
-            intentList]
-        for state in intentState:
-            print state
-        
-        case8Result = main.TRUE        
-        for state in intentState:
-            if state != 'WITHDRAWN':
-                case8Result = main.FALSE
-                break
-                
-        if case8Result == main.TRUE:
-            main.log.report( "Intent removal successful" )
-        else:
-            main.log.report( "Intent removal failed" )
-
-        PingResult = main.TRUE
-        if case8Result == main.TRUE:
-            i = 8
-            while i < 18:
-                main.log.info(
-                    "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
-                ping = main.Mininet1.pingHost(
-                    src="h" + str( i ), target="h" + str( i + 10 ) )
-                if ping == main.TRUE:
-                    i = 19
-                    PingResult = PingResult and main.TRUE
-                elif ping == main.FALSE:
-                    i += 1
-                    PingResult = PingResult and main.FALSE
-                else:
-                    main.log.info( "Unknown error" )
-                    PingResult = main.ERROR
-
-            # Note: If the ping result failed, that means the intents have been
-            # withdrawn correctly.
-        if PingResult == main.TRUE:
-            main.log.report( "Installed intents have not been withdrawn correctly" )
-            # main.cleanup()
-            # main.exit()
-        if PingResult == main.FALSE:
-            main.log.report( "Installed intents have been withdrawn correctly" )
-
-        case8Result = case8Result and PingResult
-
-        if case8Result == main.FALSE:
-            main.log.report( "Intent removal successful" )
-        else:
-            main.log.report( "Intent removal failed" )
-
-        utilities.assert_equals( expect=main.FALSE, actual=case8Result,
-                                 onpass="Intent removal test passed",
-                                 onfail="Intent removal test failed" )
-
-    def CASE9( self ):
-        main.log.report(
-            "This testcase adds point intents and then does pingall" )
-        main.log.report( "__________________________________" )
-        main.log.info( "Adding point intents" )
-        main.case(
-            "Adding bidirectional point for mn hosts" +
-            "( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22, " +
-            "h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )" )
-
-        main.step( "Add point intents for mn hosts h8 and h18 or" +
-                   "ONOS hosts h8 and h12" )
-        # main.step(var1)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003008/1",
-            "of:0000000000006018/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006018/1",
-            "of:0000000000003008/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
-        main.step(var2)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003009/1",
-            "of:0000000000006019/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006019/1",
-            "of:0000000000003009/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
-        main.step(var3)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003010/1",
-            "of:0000000000006020/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006020/1",
-            "of:0000000000003010/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var4 = "Add point intents for mininet hosts h11 and h21 or" +\
-               " ONOS hosts hB and h15"
-        main.case(var4)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003011/1",
-            "of:0000000000006021/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006021/1",
-            "of:0000000000003011/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var5 = "Add point intents for mininet hosts h12 and h22 " +\
-               "ONOS hosts hC and h16"
-        main.case(var5)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003012/1",
-            "of:0000000000006022/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006022/1",
-            "of:0000000000003012/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var6 = "Add point intents for mininet hosts h13 and h23 or" +\
-               " ONOS hosts hD and h17"
-        main.case(var6)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003013/1",
-            "of:0000000000006023/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006023/1",
-            "of:0000000000003013/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var7 = "Add point intents for mininet hosts h14 and h24 or" +\
-               " ONOS hosts hE and h18"
-        main.case(var7)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003014/1",
-            "of:0000000000006024/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006024/1",
-            "of:0000000000003014/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var8 = "Add point intents for mininet hosts h15 and h25 or" +\
-               " ONOS hosts hF and h19"
-        main.case(var8)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003015/1",
-            "of:0000000000006025/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006025/1",
-            "of:0000000000003015/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var9 = "Add intents for mininet hosts h16 and h26 or" +\
-               " ONOS hosts h10 and h1A"
-        main.case(var9)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003016/1",
-            "of:0000000000006026/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006026/1",
-            "of:0000000000003016/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var10 = "Add point intents for mininet hosts h17 and h27 or" +\
-                " ONOS hosts h11 and h1B"
-        main.case(var10)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003017/1",
-            "of:0000000000006027/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            #main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006027/1",
-            "of:0000000000003017/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            #main.log.info( getIntentResult )
-
-        print(
-            "___________________________________________________________" )
-
-        flowHandle = main.ONOS2.flows()
-        #main.log.info( "flows :" + flowHandle )
-
-        count = 1
-        i = 8
-        PingResult = main.TRUE
-        while i < 18:
-            main.log.info(
-                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
-            ping = main.Mininet1.pingHost(
-                src="h" + str( i ), target="h" + str( i + 10 ) )
-            if ping == main.FALSE and count < 5:
-                count += 1
-                # i = 8
-                PingResult = main.FALSE
-                main.log.report( "Ping between h" +
-                                 str( i ) +
-                                 " and h" +
-                                 str( i +
-                                      10 ) +
-                                 " failed. Making attempt number " +
-                                 str( count ) +
-                                 " in 2 seconds" )
-                time.sleep( 2 )
-            elif ping == main.FALSE:
-                main.log.report( "All ping attempts between h" +
-                                 str( i ) +
-                                 " and h" +
-                                 str( i +
-                                      10 ) +
-                                 "have failed" )
-                i = 19
-                PingResult = main.FALSE
-            elif ping == main.TRUE:
-                main.log.info( "Ping test between h" +
-                               str( i ) +
-                               " and h" +
-                               str( i +
-                                    10 ) +
-                               "passed!" )
-                i += 1
-                PingResult = main.TRUE
-            else:
-                main.log.info( "Unknown error" )
-                PingResult = main.ERROR
-
-        if PingResult == main.FALSE:
-            main.log.report(
-                "Point intents have not ben installed correctly. Cleaning up" )
-            # main.cleanup()
-            # main.exit()
-        if PingResult == main.TRUE:
-            main.log.report( "Point Intents have been installed correctly" )
-
-        case9Result = PingResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case9Result,
-            onpass="Point intents addition and Pingall Test successful",
-            onfail="Point intents addition and Pingall Test NOT successful" )
diff --git a/TestON/tests/ProdFunc/ProdFunc2.py b/TestON/tests/ProdFunc/ProdFunc2.py
deleted file mode 100644
index 2cd04c1..0000000
--- a/TestON/tests/ProdFunc/ProdFunc2.py
+++ /dev/null
@@ -1,1542 +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 ):
-        import time
-        """
-        Startup sequence:
-        cell <name>
-        onos-verify-cell
-        onos-remove-raft-log
-        git pull
-        mvn clean install
-        onos-package
-        onos-install -f
-        onos-wait-for-start
-        """
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
-        main.case( "Setting up test environment" )
-        main.log.report(
-            "This testcase is testing setting up test environment" )
-        main.log.report( "__________________________________" )
-
-        main.step( "Applying cell variable to environment" )
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
-
-        main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
-        main.step( "Git checkout and get version" )
-        #main.ONOSbench.gitCheckout( "master" )
-        gitPullResult = main.ONOSbench.gitPull()
-        main.log.info( "git_pull_result = " + str( gitPullResult ))
-        main.ONOSbench.getVersion( report=True )
-
-        if gitPullResult == 1:
-            main.step( "Using mvn clean & install" )
-            main.ONOSbench.cleanInstall()
-        elif gitPullResult == 0:
-            main.log.report(
-                "Git Pull Failed, look into logs for detailed reason" )
-            main.cleanup()
-            main.exit()
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()
-
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.ONOSbench.onosInstall()
-        if onosInstallResult == main.TRUE:
-            main.log.report( "Installing ONOS package successful" )
-        else:
-            main.log.report( "Installing ONOS package failed" )
-
-        onos1Isup = main.ONOSbench.isup()
-        if onos1Isup == main.TRUE:
-            main.log.report( "ONOS instance is up and ready" )
-        else:
-            main.log.report( "ONOS instance may not be up" )
-
-        main.step( "Starting ONOS service" )
-        startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
-        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        main.step( "Starting Mininet CLI..." )
-        
-        # Starting the mininet using the old way
-        main.step( "Starting Mininet ..." )
-        netIsUp = main.Mininet1.startNet()
-        if netIsUp:
-            main.log.info("Mininet CLI is up")
-        
-        case1Result = ( packageResult and
-                        cellResult and verifyResult
-                        and onosInstallResult and
-                        onos1Isup and startResult )
-        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
-                                 onpass="Test startup successful",
-                                 onfail="Test startup NOT successful" )
-
-    def CASE2( self, main ):
-        """
-        Switch Down
-        """
-        # NOTE: You should probably run a topology check after this
-        import time
-
-        main.case( "Switch down discovery" )
-        main.log.report( "This testcase is testing a switch down discovery" )
-        main.log.report( "__________________________________" )
-
-        switchSleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
-
-        description = "Killing a switch to ensure it is discovered correctly"
-        main.log.report( description )
-        main.case( description )
-
-        # TODO: Make this switch parameterizable
-        main.step( "Kill s28 " )
-        main.log.report( "Deleting s28" )
-        # FIXME: use new dynamic topo functions
-        main.Mininet1.delSwitch( "s28" )
-        main.log.info(
-            "Waiting " +
-            str( switchSleep ) +
-            " seconds for switch down to be discovered" )
-        time.sleep( switchSleep )
-        # Peek at the deleted switch
-        device = main.ONOS2.getDevice( dpid="0028" )
-        print "device = ", device
-        if device[ u'available' ] == 'False':
-            case2Result = main.FALSE
-        else:
-            case2Result = main.TRUE
-        utilities.assert_equals( expect=main.TRUE, actual=case2Result,
-                                 onpass="Switch down discovery successful",
-                                 onfail="Switch down discovery failed" )
-
-    def CASE101( self, main ):
-        """
-        Cleanup sequence:
-        onos-service <nodeIp> stop
-        onos-uninstall
-
-        TODO: Define rest of cleanup
-
-        """
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
-        main.case( "Cleaning up test environment" )
-
-        main.step( "Testing ONOS kill function" )
-        killResult = main.ONOSbench.onosKill( ONOS1Ip )
-
-        main.step( "Stopping ONOS service" )
-        stopResult = main.ONOSbench.onosStop( ONOS1Ip )
-
-        main.step( "Uninstalling ONOS service" )
-        uninstallResult = main.ONOSbench.onosUninstall()
-
-        case11Result = killResult and stopResult and uninstallResult
-        utilities.assert_equals( expect=main.TRUE, actual=case11Result,
-                                 onpass="Cleanup successful",
-                                 onfail="Cleanup failed" )
-
-    def CASE3( self, main ):
-        """
-        Test 'onos' command and its functionality in driver
-        """
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
-        main.case( "Testing 'onos' command" )
-
-        main.step( "Sending command 'onos -w <onos-ip> system:name'" )
-        cmdstr1 = "system:name"
-        cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 )
-        main.log.info( "onos command returned: " + cmdResult1 )
-
-        main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
-        cmdstr2 = "onos:topology"
-        cmdResult2 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 )
-        main.log.info( "onos command returned: " + cmdResult2 )
-
-    def CASE20( self ):
-        """
-            Exit from mininet cli
-            reinstall ONOS
-        """
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
-        main.log.report( "This testcase exits the mininet cli and reinstalls" +
-                         "ONOS to switch over to Packet Optical topology" )
-        main.log.report( "_____________________________________________" )
-        main.case( "Disconnecting mininet and restarting ONOS" )
-        main.step( "Disconnecting mininet and restarting ONOS" )
-        mininetDisconnect = main.Mininet1.disconnect()
-        print "mininetDisconnect = ", mininetDisconnect        
-
-        main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
-        main.step( "Applying cell variable to environment" )
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
-
-        onosInstallResult = main.ONOSbench.onosInstall()
-        if onosInstallResult == main.TRUE:
-            main.log.report( "Installing ONOS package successful" )
-        else:
-            main.log.report( "Installing ONOS package failed" )
-
-        onos1Isup = main.ONOSbench.isup()
-        if onos1Isup == main.TRUE:
-            main.log.report( "ONOS instance is up and ready" )
-        else:
-            main.log.report( "ONOS instance may not be up" )
-
-        main.step( "Starting ONOS service" )
-        startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
-        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        case20Result = mininetDisconnect and cellResult and verifyResult \
-            and onosInstallResult and onos1Isup and \
-            startResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case20Result,
-            onpass= "Exiting functionality mininet topology and reinstalling" +
-                    " ONOS successful",
-            onfail= "Exiting functionality mininet topology and reinstalling" +
-                    " ONOS failed" )
-
-    def CASE21( self, main ):
-        """
-            On ONOS bench, run this command:
-            sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1
-            which spawns packet optical topology 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" )
-        appInstallResult = main.ONOS2.featureInstall( "onos-app-optical" )
-        opticalMnScript = main.LincOE2.runOpticalMnScript()
-
-        case21Result = opticalMnScript and appInstallResult
-        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, 10 optical switches(ROADM's) and
-            6 packet layer mininet switches each with one host.
-            Therefore, the roadmCount variable = 10,
-            packetLayerSWCount variable = 6, hostCount=6 and
-            links=42.
-            All this is hardcoded in the testcase. If the topology changes,
-            these hardcoded values need to be changed
-        """
-        main.log.report(
-            "This testcase compares the optical+packet topology against what" +
-            " is expected" )
-        main.case( "Topology comparision" )
-        main.step( "Topology comparision" )
-        main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        devicesResult = main.ONOS3.devices( jsonFormat=False )
-
-        print "devices_result = ", devicesResult
-        devicesLinewise = devicesResult.split( "\n" )
-        devicesLinewise = devicesLinewise[ 1: ]
-        roadmCount = 0
-        packetLayerSWCount = 0
-        for line in devicesLinewise:
-            components = line.split( "," )
-            availability = components[ 1 ].split( "=" )[ 1 ]
-            type = components[ 3 ].split( "=" )[ 1 ]
-            if availability == 'true' and type == 'ROADM':
-                roadmCount += 1
-            elif availability == 'true' and type == 'SWITCH':
-                packetLayerSWCount += 1
-        if roadmCount == 10:
-            print "Number of Optical Switches = %d and is" % roadmCount +\
-                  " correctly detected"
-            main.log.info(
-                "Number of Optical Switches = " +
-                str( roadmCount ) +
-                " and is correctly detected" )
-            opticalSWResult = main.TRUE
-        else:
-            print "Number of Optical Switches = %d and is wrong" % roadmCount
-            main.log.info(
-                "Number of Optical Switches = " +
-                str( roadmCount ) +
-                " and is wrong" )
-            opticalSWResult = main.FALSE
-
-        if packetLayerSWCount == 6:
-            print "Number of Packet layer or mininet Switches = %d "\
-                    % packetLayerSWCount + "and is correctly detected"
-            main.log.info(
-                "Number of Packet layer or mininet Switches = " +
-                str( packetLayerSWCount ) +
-                " and is correctly detected" )
-            packetSWResult = main.TRUE
-        else:
-            print "Number of Packet layer or mininet Switches = %d and"\
-                    % packetLayerSWCount + " is wrong"
-            main.log.info(
-                "Number of Packet layer or mininet Switches = " +
-                str( packetLayerSWCount ) +
-                " and is wrong" )
-            packetSWResult = main.FALSE
-        print "_________________________________"
-
-        linksResult = main.ONOS3.links( jsonFormat=False )
-        print "links_result = ", linksResult
-        print "_________________________________"
-        linkActiveCount = linksResult.count("state=ACTIVE") 
-        main.log.info( "linkActiveCount = " + str( linkActiveCount ))
-        if linkActiveCount == 42:
-            linkActiveResult = main.TRUE
-            main.log.info(
-                "Number of links in ACTIVE state are correct")
-        else:
-            linkActiveResult = main.FALSE
-            main.log.info(
-                "Number of links in ACTIVE state are wrong")
-
-        # 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 and \
-                        linkActiveResult
-        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:0000ffffffff0005/1" )
-        if ptpIntentResult == main.TRUE:
-            main.ONOS3.intents( jsonFormat=False )
-            main.log.info( "Point to point intent install successful" )
-
-        ptpIntentResult = main.ONOS3.addPointIntent(
-            "of:0000ffffffff0005/1",
-            "of:0000ffffffff0001/1" )
-        if ptpIntentResult == main.TRUE:
-            main.ONOS3.intents( jsonFormat=False )
-            main.log.info( "Point to point intent install successful" )
-
-        time.sleep( 30 )
-        flowHandle = main.ONOS3.flows()
-        main.log.info( "flows :" + flowHandle )
-
-        # Sleep for 30 seconds to provide time for the intent state to change
-        time.sleep( 60 )
-        intentHandle = main.ONOS3.intents( jsonFormat=False )
-        main.log.info( "intents :" + intentHandle )
-
-        PingResult = main.TRUE
-        count = 1
-        main.log.info( "\n\nh1 is Pinging h5" )
-        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
-        # ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count < 5:
-            count += 1
-            PingResult = main.FALSE
-            main.log.info(
-                "Ping between h1 and h5  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 h5 have failed" )
-            PingResult = main.FALSE
-        elif ping == main.TRUE:
-            main.log.info( "Ping test between h1 and h5 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
-        """
-            LINC uses its own switch IDs. You can use the following
-            command on the LINC console to find the mapping between 
-            DPIDs and LINC IDs.
-            rp(application:get_all_key(linc)).
-            
-            Test Rerouting of Packet Optical by bringing a port down
-            ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ), 
-            so that link
-            ( between switch1 port20 - switch5 port50 ) 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( "Attach to the Linc-OE session" )
-        attachConsole = main.LincOE1.attachLincOESession() 
-        print "attachConsole = ", attachConsole
-
-        main.step( "Bring a port down and verify the link state" )
-        main.LincOE1.portDown( swId="9", ptId="20" )
-        linksNonjson = main.ONOS3.links( jsonFormat=False )
-        main.log.info( "links = " + linksNonjson )
-
-        linkInactiveCount = linksNonjson.count("state=INACTIVE")
-        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
-        if linkInactiveCount == 2:
-            main.log.info(
-                "Number of links in INACTIVE state are correct")
-        else:
-            main.log.info(
-                "Number of links in INACTIVE state are wrong")
-        
-        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' ] == "20":
-                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
-                        'dst' ][ 'port' ] == "50":
-                    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 h5" )
-        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
-        # ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count < 5:
-            count += 1
-            PingResult = main.FALSE
-            main.log.info(
-                "Ping between h1 and h5  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 h5 have failed" )
-            PingResult = main.FALSE
-        elif ping == main.TRUE:
-            main.log.info( "Ping test between h1 and h5 passed!" )
-            PingResult = main.TRUE
-        else:
-            main.log.info( "Unknown error" )
-            PingResult = main.ERROR
-
-        if PingResult == main.TRUE:
-            main.log.report( "Ping test successful " )
-        if PingResult == main.FALSE:
-            main.log.report( "Ping test failed" )
-
-        case24Result = PingResult and linksStateResult
-        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
-                                 onpass="Packet optical rerouting successful",
-                                 onfail="Packet optical rerouting failed" )
-
-    def CASE4( self, main ):
-        import re
-        import time
-        main.log.report( "This testcase is testing the assignment of" +
-                         " all the switches to all the controllers and" +
-                         " discovering the hosts in reactive mode" )
-        main.log.report( "__________________________________" )
-        main.case( "Pingall Test" )
-        main.step( "Assigning switches to controllers" )
-        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
-        for i in range( 1, 29 ):
-            if i == 1:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-            elif i >= 2 and i < 5:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-            elif i >= 5 and i < 8:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-            elif i >= 8 and i < 18:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-            elif i >= 18 and i < 28:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-            else:
-                main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=ONOS1Port )
-        SwitchMastership = main.TRUE
-        for i in range( 1, 29 ):
-            if i == 1:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-            elif i >= 2 and i < 5:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-            elif i >= 5 and i < 8:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-            elif i >= 8 and i < 18:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-            elif i >= 18 and i < 28:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-            else:
-                response = main.Mininet1.getSwController( "s" + str( i ) )
-                print( "Response is" + str( response ) )
-                if re.search( "tcp:" + ONOS1Ip, response ):
-                    SwitchMastership = SwitchMastership and main.TRUE
-                else:
-                    SwitchMastership = main.FALSE
-
-        if SwitchMastership == main.TRUE:
-            main.log.report( "Controller assignmnet successful" )
-        else:
-            main.log.report( "Controller assignmnet failed" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=SwitchMastership,
-            onpass="MasterControllers assigned correctly" )
-        """
-        for i in range ( 1,29 ):
-            main.Mininet1.assignSwController( sw=str( i ),count=5,
-                    ip1=ONOS1Ip,port1=ONOS1Port,
-                    ip2=ONOS2Ip,port2=ONOS2Port,
-                    ip3=ONOS3Ip,port3=ONOS3Port,
-                    ip4=ONOS4Ip,port4=ONOS4Port,
-                    ip5=ONOS5Ip,port5=ONOS5Port )
-        """
-        # REACTIVE FWD test
-
-        main.step( "Get list of hosts from Mininet" )
-        hostList = main.Mininet1.getHosts()
-        main.log.info( hostList )
-
-        main.step( "Get host list in ONOS format" )
-        hostOnosList = main.ONOS2.getHostsId( hostList )
-        main.log.info( hostOnosList )
-        # time.sleep( 5 )
-
-        main.step( "Pingall" )
-        pingResult = main.FALSE
-        time1 = time.time()
-        pingResult = main.Mininet1.pingall()
-        time2 = time.time()
-        print "Time for pingall: %2f seconds" % ( time2 - time1 )
-
-        # Start onos cli again because u might have dropped out of
-        # onos prompt to the shell prompt
-        # if there was no activity
-        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-
-        case4Result = SwitchMastership and pingResult
-        if pingResult == main.TRUE:
-            main.log.report( "Pingall Test in reactive mode to" +
-                             " discover the hosts successful" )
-        else:
-            main.log.report( "Pingall Test in reactive mode to" +
-                             " discover the hosts failed" )
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case4Result,
-            onpass="Controller assignment and Pingall Test successful",
-            onfail="Controller assignment and Pingall Test NOT successful" )
-
-    def CASE10( self ):
-        main.log.report(
-            "This testcase uninstalls the reactive forwarding app" )
-        main.log.report( "__________________________________" )
-        main.case( "Uninstalling reactive forwarding app" )
-        # 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 CASE11( self ):
-        # NOTE: This testcase require reactive forwarding mode enabled
-        # NOTE: in the beginning and then uninstall it before adding 
-        # NOTE: point intents. Again the app is installed so that 
-        # NOTE: testcase 10 can be ran successively
-        import time
-        main.log.report(
-            "This testcase moves a host from one switch to another to add" +
-            "point intents between them and then perform ping" )
-        main.log.report( "__________________________________" )
-        main.log.info( "Moving host from one switch to another" )
-        main.case( "Moving host from a device and attach it to another device" )
-        main.step( "Moving host h9 from device s9 and attach it to s8" )
-        main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
-
-        time.sleep(15) #Time delay to have all the flows ready
-        main.step( "Pingall" )
-        pingResult = main.FALSE
-        time1 = time.time()
-        pingResult = main.Mininet1.pingall()
-        time2 = time.time()
-        print "Time for pingall: %2f seconds" % ( time2 - time1 )
-
-        hosts = main.ONOS2.hosts( jsonFormat = False )
-        main.log.info( hosts )
-        
-        main.case( "Uninstalling reactive forwarding app" )
-        # Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
-        main.log.info( "onos-app-fwd uninstalled" )
-
-        main.step( "Add point intents between hosts on the same device")
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003008/1",
-            "of:0000000000003008/3" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003008/3",
-            "of:0000000000003008/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        main.case( "Ping hosts on the same devices" )
-        ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
-
-        '''
-        main.case( "Installing reactive forwarding app" )
-        # Install onos-app-fwd app to enable reactive forwarding
-        appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
-        main.log.info( "onos-app-fwd installed" )
-        '''
-
-        if ping == main.FALSE:
-            main.log.report(
-                "Point intents for hosts on same devices haven't" +
-                " been installed correctly. Cleaning up" )
-        if ping == main.TRUE:
-            main.log.report(
-                "Point intents for hosts on same devices" +
-                "installed correctly. Cleaning up" )
-
-        case11Result = ping and pingResult
-        utilities.assert_equals(
-            expect = main.TRUE,
-            actual = case11Result,
-            onpass = "Point intents for hosts on same devices" +
-                    "Ping Test successful",
-            onfail = "Point intents for hosts on same devices" +
-                    "Ping Test NOT successful" )
-
-
-    def CASE12( self ):
-        """
-        Verify the default flows on each switch in proactive mode
-        """
-        main.log.report( "This testcase is verifying num of default" +
-                         " flows on each switch" )
-        main.log.report( "__________________________________" )
-        main.case( "Verify num of default flows on each switch" )
-        main.step( "Obtaining the device id's and flowrule count on them" )
-
-        case12Result = main.TRUE
-        idList = main.ONOS2.getAllDevicesId()
-        for id in idList:
-            count = main.ONOS2.FlowAddedCount( id )
-            main.log.info("count = " +count)
-            if int(count) != 3:
-                case12Result = main.FALSE
-                break
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case12Result,
-            onpass = "Expected default num of flows exist",
-            onfail = "Expected default num of flows do not exist")
-    
-    
-        
-
-    def CASE6( self ):
-        import time
-        main.log.report( "This testcase is testing the addition of" +
-                         " host intents and then does pingall" )
-        main.log.report( "__________________________________" )
-        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
-            if host1:
-                host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
-            if host2:
-                host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
-            if host1Id and host2Id:
-                main.ONOS2.addHostIntent( host1Id, host2Id )
-
-        time.sleep( 10 )
-        hIntents = main.ONOS2.intents( jsonFormat=False )
-        main.log.info( "intents:" + hIntents )
-        flows = main.ONOS2.flows()
-        main.log.info( "flows:" + flows )     
-
-        count = 1
-        i = 8
-        PingResult = main.TRUE
-        # while i<10:
-        while i < 18:
-            main.log.info(
-                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
-            ping = main.Mininet1.pingHost(
-                src="h" + str( i ), target="h" + str( i + 10 ) )
-            if ping == main.FALSE and count < 5:
-                count += 1
-                # i = 8
-                PingResult = main.FALSE
-                main.log.report( "Ping between h" +
-                                 str( i ) +
-                                 " and h" +
-                                 str( i +
-                                      10 ) +
-                                 " failed. Making attempt number " +
-                                 str( count ) +
-                                 " in 2 seconds" )
-                time.sleep( 2 )
-            elif ping == main.FALSE:
-                main.log.report( "All ping attempts between h" +
-                                 str( i ) +
-                                 " and h" +
-                                 str( i +
-                                      10 ) +
-                                 "have failed" )
-                i = 19
-                PingResult = main.FALSE
-            elif ping == main.TRUE:
-                main.log.info( "Ping test between h" +
-                               str( i ) +
-                               " and h" +
-                               str( i +
-                                    10 ) +
-                               "passed!" )
-                i += 1
-                PingResult = main.TRUE
-            else:
-                main.log.info( "Unknown error" )
-                PingResult = main.ERROR
-        if PingResult == main.FALSE:
-            main.log.report(
-                "Ping all test after Host intent addition failed.Cleaning up" )
-            # main.cleanup()
-            # main.exit()
-        if PingResult == main.TRUE:
-            main.log.report(
-                "Ping all test after Host intent addition successful" )
-
-        case6Result = PingResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case6Result,
-            onpass="Pingall Test after Host intents addition successful",
-            onfail="Pingall Test after Host intents addition failed" )
-
-    def CASE5( self, main ):
-        import json
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
-        # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        main.log.report( "This testcase is testing if all ONOS nodes" +
-                         " are in topology sync with mininet" )
-        main.log.report( "__________________________________" )
-        main.case( "Comparing Mininet topology with the topology of ONOS" )
-        main.step( "Start continuous pings" )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source1' ],
-            target=main.params[ 'PING' ][ 'target1' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source2' ],
-            target=main.params[ 'PING' ][ 'target2' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source3' ],
-            target=main.params[ 'PING' ][ 'target3' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source4' ],
-            target=main.params[ 'PING' ][ 'target4' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source5' ],
-            target=main.params[ 'PING' ][ 'target5' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source6' ],
-            target=main.params[ 'PING' ][ 'target6' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source7' ],
-            target=main.params[ 'PING' ][ 'target7' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source8' ],
-            target=main.params[ 'PING' ][ 'target8' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source9' ],
-            target=main.params[ 'PING' ][ 'target9' ],
-            pingTime=500 )
-        main.Mininet2.pingLong(
-            src=main.params[ 'PING' ][ 'source10' ],
-            target=main.params[ 'PING' ][ 'target10' ],
-            pingTime=500 )
-
-        main.step( "Create TestONTopology object" )
-        global ctrls
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
-                temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
-                temp = temp + ( "ONOS" + str( count ), )
-                temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
-                temp = temp + \
-                    ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
-                ctrls.append( temp )
-                count = count + 1
-            else:
-                break
-        global MNTopo
-        Topo = TestONTopology(
-            main.Mininet1,
-            ctrls )  # can also add Intent API info for intent operations
-        MNTopo = Topo
-
-        TopologyCheck = main.TRUE
-        main.step( "Compare ONOS Topology to MN Topology" )
-        devicesJson = main.ONOS2.devices()
-        linksJson = main.ONOS2.links()
-        # portsJson = main.ONOS2.ports()
-
-        result1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devicesJson ) )
-        result2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( linksJson ) )
-        # result3 = main.Mininet1.comparePorts(
-        # MNTopo, json.loads( portsJson ) )
-
-        # result = result1 and result2 and result3
-        result = result1 and result2
-
-        print "***********************"
-        if result == main.TRUE:
-            main.log.report( "ONOS" + " Topology matches MN Topology" )
-        else:
-            main.log.report( "ONOS" + " Topology does not match MN Topology" )
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=result,
-            onpass="ONOS" +
-            " Topology matches MN Topology",
-            onfail="ONOS" +
-            " Topology does not match MN Topology" )
-
-        TopologyCheck = TopologyCheck and result
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=TopologyCheck,
-            onpass="Topology checks passed",
-            onfail="Topology checks failed" )
-
-    def CASE7( self, main ):
-        from sts.topology.teston_topology import TestONTopology
-
-        linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
-
-        main.log.report( "This testscase is killing a link to ensure that" +
-                         " link discovery is consistent" )
-        main.log.report( "__________________________________" )
-        main.log.report( "Killing a link to ensure that link discovery" +
-                         " is consistent" )
-        main.case( "Killing a link to Ensure that Link Discovery" +
-                   "is Working Properly" )
-        """
-        main.step( "Start continuous pings" )
-
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
-                               target=main.params[ 'PING' ][ 'target1' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
-                               target=main.params[ 'PING' ][ 'target2' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
-                               target=main.params[ 'PING' ][ 'target3' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
-                               target=main.params[ 'PING' ][ 'target4' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
-                               target=main.params[ 'PING' ][ 'target5' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
-                               target=main.params[ 'PING' ][ 'target6' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
-                               target=main.params[ 'PING' ][ 'target7' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
-                               target=main.params[ 'PING' ][ 'target8' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
-                               target=main.params[ 'PING' ][ 'target9' ],
-                               pingTime=500 )
-        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
-                               target=main.params[ 'PING' ][ 'target10' ],
-                               pingTime=500 )
-        """
-        main.step( "Determine the current number of switches and links" )
-        topologyOutput = main.ONOS2.topology()
-        topologyResult = main.ONOS1.getTopology( topologyOutput )
-        activeSwitches = topologyResult[ 'deviceCount' ]
-        links = topologyResult[ 'linkCount' ]
-        print "activeSwitches = ", type( activeSwitches )
-        print "links = ", type( links )
-        main.log.info(
-            "Currently there are %s switches and %s links" %
-            ( str( activeSwitches ), str( links ) ) )
-
-        main.step( "Kill Link between s3 and s28" )
-        main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
-        time.sleep( linkSleep )
-        topologyOutput = main.ONOS2.topology()
-        LinkDown = main.ONOS1.checkStatus(
-            topologyOutput, activeSwitches, str(
-                int( links ) - 2 ) )
-        if LinkDown == main.TRUE:
-            main.log.report( "Link Down discovered properly" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=LinkDown,
-            onpass="Link Down discovered properly",
-            onfail="Link down was not discovered in " +
-            str( linkSleep ) +
-            " seconds" )
-
-        # Check ping result here..add code for it
-
-        main.step( "Bring link between s3 and s28 back up" )
-        LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
-        time.sleep( linkSleep )
-        topologyOutput = main.ONOS2.topology()
-        LinkUp = main.ONOS1.checkStatus(
-            topologyOutput,
-            activeSwitches,
-            str( links ) )
-        if LinkUp == main.TRUE:
-            main.log.report( "Link up discovered properly" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=LinkUp,
-            onpass="Link up discovered properly",
-            onfail="Link up was not discovered in " +
-            str( linkSleep ) +
-            " seconds" )
-
-        # NOTE Check ping result here..add code for it
-
-        main.step( "Compare ONOS Topology to MN Topology" )
-        Topo = TestONTopology(
-            main.Mininet1,
-            ctrls )  # can also add Intent API info for intent operations
-        MNTopo = Topo
-        TopologyCheck = main.TRUE
-
-        devicesJson = main.ONOS2.devices()
-        linksJson = main.ONOS2.links()
-        portsJson = main.ONOS2.ports()
-
-        result1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devicesJson ) )
-        result2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( linksJson ) )
-        # result3 = main.Mininet1.comparePorts(
-        # MNTopo, json.loads( portsJson ) )
-
-        # result = result1 and result2 and result3
-        result = result1 and result2
-        print "***********************"
-
-        if result == main.TRUE:
-            main.log.report( "ONOS" + " Topology matches MN Topology" )
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=result,
-            onpass="ONOS" +
-            " Topology matches MN Topology",
-            onfail="ONOS" +
-            " Topology does not match MN Topology" )
-
-        TopologyCheck = TopologyCheck and result
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=TopologyCheck,
-            onpass="Topology checks passed",
-            onfail="Topology checks failed" )
-
-        result = LinkDown and LinkUp and TopologyCheck
-        utilities.assert_equals( expect=main.TRUE, actual=result,
-                                 onpass="Link failure is discovered correctly",
-                                 onfail="Link Discovery failed" )
-
-    def CASE8( self ):
-        """
-        Intent removal
-        """
-        import time
-        main.log.report( "This testcase removes any previously added intents" +
-                         " before adding any new set of intents" )
-        main.log.report( "__________________________________" )
-        main.log.info( "intent removal" )
-        main.case( "Removing installed intents" )
-        main.step( "Obtain the intent id's" )
-        intentResult = main.ONOS2.intents( jsonFormat=False )
-        main.log.info( "intent_result = " + intentResult )
-        intentLinewise = intentResult.split( "\n" )
-
-        intentList = [line for line in intentLinewise \
-            if line.startswith( "id=")]
-        intentids = [line.split( "," )[ 0 ].split( "=" )[ 1 ] for line in \
-            intentList]
-        for id in intentids:
-            print "id = ", id
-
-        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 )
-        
-        intentList = [line for line in intentResult.split( "\n" ) \
-            if line.startswith( "id=")]
-        intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
-            intentList]
-        for state in intentState:
-            print state
-        
-        case8Result = main.TRUE        
-        for state in intentState:
-            if state != 'WITHDRAWN':
-                case8Result = main.FALSE
-                break
-                
-        if case8Result == main.TRUE:
-            main.log.report( "Intent removal successful" )
-        else:
-            main.log.report( "Intent removal failed" )
-
-        PingResult = main.TRUE
-        if case8Result == main.TRUE:
-            i = 8
-            while i < 18:
-                main.log.info(
-                    "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
-                ping = main.Mininet1.pingHost(
-                    src="h" + str( i ), target="h" + str( i + 10 ) )
-                if ping == main.TRUE:
-                    i = 19
-                    PingResult = PingResult and main.TRUE
-                elif ping == main.FALSE:
-                    i += 1
-                    PingResult = PingResult and main.FALSE
-                else:
-                    main.log.info( "Unknown error" )
-                    PingResult = main.ERROR
-
-            # Note: If the ping result failed, that means the intents have been
-            # withdrawn correctly.
-        if PingResult == main.TRUE:
-            main.log.report( "Installed intents have not been withdrawn correctly" )
-            # main.cleanup()
-            # main.exit()
-        if PingResult == main.FALSE:
-            main.log.report( "Installed intents have been withdrawn correctly" )
-
-        case8Result = case8Result and PingResult
-
-        if case8Result == main.FALSE:
-            main.log.report( "Intent removal successful" )
-        else:
-            main.log.report( "Intent removal failed" )
-
-        utilities.assert_equals( expect=main.FALSE, actual=case8Result,
-                                 onpass="Intent removal test passed",
-                                 onfail="Intent removal test failed" )
-
-    def CASE9( self ):
-        main.log.report(
-            "This testcase adds point intents and then does pingall" )
-        main.log.report( "__________________________________" )
-        main.log.info( "Adding point intents" )
-        main.case(
-            "Adding bidirectional point for mn hosts" +
-            "( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22, " +
-            "h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )" )
-
-        main.step( "Add point intents for mn hosts h8 and h18 or" +
-                   "ONOS hosts h8 and h12" )
-        # main.step(var1)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003008/1",
-            "of:0000000000006018/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006018/1",
-            "of:0000000000003008/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
-        main.step(var2)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003009/1",
-            "of:0000000000006019/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006019/1",
-            "of:0000000000003009/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
-        main.step(var3)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003010/1",
-            "of:0000000000006020/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006020/1",
-            "of:0000000000003010/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var4 = "Add point intents for mininet hosts h11 and h21 or" +\
-               " ONOS hosts hB and h15"
-        main.case(var4)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003011/1",
-            "of:0000000000006021/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006021/1",
-            "of:0000000000003011/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var5 = "Add point intents for mininet hosts h12 and h22 " +\
-               "ONOS hosts hC and h16"
-        main.case(var5)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003012/1",
-            "of:0000000000006022/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006022/1",
-            "of:0000000000003012/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var6 = "Add point intents for mininet hosts h13 and h23 or" +\
-               " ONOS hosts hD and h17"
-        main.case(var6)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003013/1",
-            "of:0000000000006023/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006023/1",
-            "of:0000000000003013/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var7 = "Add point intents for mininet hosts h14 and h24 or" +\
-               " ONOS hosts hE and h18"
-        main.case(var7)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003014/1",
-            "of:0000000000006024/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006024/1",
-            "of:0000000000003014/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var8 = "Add point intents for mininet hosts h15 and h25 or" +\
-               " ONOS hosts hF and h19"
-        main.case(var8)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003015/1",
-            "of:0000000000006025/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006025/1",
-            "of:0000000000003015/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var9 = "Add intents for mininet hosts h16 and h26 or" +\
-               " ONOS hosts h10 and h1A"
-        main.case(var9)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003016/1",
-            "of:0000000000006026/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006026/1",
-            "of:0000000000003016/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
-
-        var10 = "Add point intents for mininet hosts h17 and h27 or" +\
-                " ONOS hosts h11 and h1B"
-        main.case(var10)
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003017/1",
-            "of:0000000000006027/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            #main.log.info( getIntentResult )
-
-        ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006027/1",
-            "of:0000000000003017/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOS2.intents()
-            main.log.info( "Point to point intent install successful" )
-            #main.log.info( getIntentResult )
-
-        print(
-            "___________________________________________________________" )
-
-        flowHandle = main.ONOS2.flows()
-        #main.log.info( "flows :" + flowHandle )
-
-        count = 1
-        i = 8
-        PingResult = main.TRUE
-        while i < 18:
-            main.log.info(
-                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
-            ping = main.Mininet1.pingHost(
-                src="h" + str( i ), target="h" + str( i + 10 ) )
-            if ping == main.FALSE and count < 5:
-                count += 1
-                # i = 8
-                PingResult = main.FALSE
-                main.log.report( "Ping between h" +
-                                 str( i ) +
-                                 " and h" +
-                                 str( i +
-                                      10 ) +
-                                 " failed. Making attempt number " +
-                                 str( count ) +
-                                 " in 2 seconds" )
-                time.sleep( 2 )
-            elif ping == main.FALSE:
-                main.log.report( "All ping attempts between h" +
-                                 str( i ) +
-                                 " and h" +
-                                 str( i +
-                                      10 ) +
-                                 "have failed" )
-                i = 19
-                PingResult = main.FALSE
-            elif ping == main.TRUE:
-                main.log.info( "Ping test between h" +
-                               str( i ) +
-                               " and h" +
-                               str( i +
-                                    10 ) +
-                               "passed!" )
-                i += 1
-                PingResult = main.TRUE
-            else:
-                main.log.info( "Unknown error" )
-                PingResult = main.ERROR
-
-        if PingResult == main.FALSE:
-            main.log.report(
-                "Point intents have not ben installed correctly. Cleaning up" )
-            # main.cleanup()
-            # main.exit()
-        if PingResult == main.TRUE:
-            main.log.report( "Point Intents have been installed correctly" )
-
-        case9Result = PingResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case9Result,
-            onpass="Point intents addition and Pingall Test successful",
-            onfail="Point intents addition and Pingall Test NOT successful" )
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
index ade6d07..a274c07 100644
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -839,7 +839,7 @@
         time.sleep( 10 )
 
         main.step( "Get list of hosts from Mininet" )
-        hostList = main.Mininet1.getHosts()
+        hostList = main.Mininet1.getHosts().keys()
         main.log.info( hostList )
 
         main.step( "Get host list in ONOS format" )
@@ -1122,9 +1122,6 @@
             Check ONOS topology matches with mininet
         """
         import json
-        # assumes that sts is already in you PYTHONPATH
-        from sts.topology.teston_topology import TestONTopology
-        # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
         main.log.report( "This testcase is testing if all ONOS nodes" +
                          " are in topology sync with mininet" )
         main.log.report( "__________________________________" )
@@ -1171,43 +1168,19 @@
             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()
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
 
         result1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devicesJson ) )
+            mnSwitches, json.loads( devicesJson ), json.loads( portsJson ) )
         result2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( linksJson ) )
+            mnSwitches, mnLinks, json.loads( linksJson ) )
 
-        result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
-        # result = result1 and result2 and result3
         result = result1 and result2
 
         print "***********************"
@@ -1236,9 +1209,6 @@
             Link discovery test case. Checks if ONOS can discover a link
             down or up properly.
         """
-
-        from sts.topology.teston_topology import TestONTopology
-
         linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
 
         main.log.report( "This testscase is killing a link to ensure that" +
@@ -1333,25 +1303,19 @@
         # 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()
+        mnSwitches = main.Mininet1.getSwitches()
+        mnLinks = main.Mininet1.getLinks()
 
         result1 = main.Mininet1.compareSwitches(
-            MNTopo,
-            json.loads( devicesJson ) )
+            mnSwitches, json.loads( devicesJson ), json.loads( portsJson ) )
         result2 = main.Mininet1.compareLinks(
-            MNTopo,
-            json.loads( linksJson ) )
-        result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
+            mnSwitches, mnLinks, json.loads( linksJson ) )
 
-        # result = result1 and result2 and result3
         result = result1 and result2
         print "***********************"
 
diff --git a/TestON/tests/ScaleOutTemplate/README b/TestON/tests/ScaleOutTemplate/README
deleted file mode 100644
index 2d5ae1c..0000000
--- a/TestON/tests/ScaleOutTemplate/README
+++ /dev/null
@@ -1,22 +0,0 @@
--------------------
-----Setup Guide----
--------------------
-
-CASE 1: init case; cleans and sets up enviornment, starts up node 1
-
-CASE 2: Increments scale case; starts up additional nodes, determined by 'SCALE' in params 
-        Ex: cluster size = 1 and scale = 2 ==> call CASE2 ==> cluster size = 3 
-
-Params file:
-    SCALE = cluster scale step size 
-    availableNodes = number of nodes you have provided data for in .topo file 
-
-    ENV:
-        cellName = desired name of cell file to be created at runtime
-        cellFeatures = list of features desired                        
-            NOTE: webconsole, onos-api, onos-cli and onos-openflow are loaded automatically.
-            adjust your test and feature list accordingly 
-    TEST: 
-        skipCleanInstall = set yes if you want to skip for the sake of test debugging, otherwise set no
-
-    
diff --git a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.params b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.params
deleted file mode 100644
index 4e3ffdb..0000000
--- a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.params
+++ /dev/null
@@ -1,60 +0,0 @@
-<PARAMS>
-
-    <testcases>1,2,1,2,1,2,1,2</testcases>
-
-    <SCALE>1,3,5,7</SCALE>
-    <availableNodes>7</availableNodes>
- 
-    <ENV>
-        <cellName>defaultCell</cellName>
-        <cellApps></cellApps>
-    </ENV>
-
-    <TEST>
-        <skipCleanInstall>yes</skipCleanInstall>
-    </TEST>
-
-    <GIT>
-        <autopull>off</autopull>
-        <checkout>master</checkout>
-    </GIT>
-
-    <CTRL>
-        <USER>admin</USER>
-        
-        <ip1>OC1</ip1>
-        <port1>6633</port1>
-        
-        <ip2>OC2</ip2>
-        <port2>6633</port2>
-        
-        <ip3>OC3</ip3>
-        <port3>6633</port3>
-        
-        <ip4>OC4</ip4>
-        <port4>6633</port4>
-        
-        <ip5>OC5</ip5>
-        <port5>6633</port5>
-        
-        <ip6>OC6</ip6>
-        <port6>6633</port6> 
-       
-         <ip7>OC7</ip7>
-        <port7>6633</port7>
-
-    </CTRL>
-
-    <MN>
-        <ip1>OCN</ip1>
-    </MN>
-
-    <BENCH>
-        <user>admin</user>
-        <ip1>OCN</ip1>
-    </BENCH>
-
-    <JSON>
-    </JSON>
-
-</PARAMS>
diff --git a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.py b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.py
deleted file mode 100644
index a8d21d2..0000000
--- a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.py
+++ /dev/null
@@ -1,121 +0,0 @@
-# ScaleOutTemplate
-#
-# CASE1 starts number of nodes specified in param file
-#
-# cameron@onlab.us
-
-import sys
-import os.path
-
-
-class ScaleOutTemplate:
-
-    def __init__( self ):
-        self.default = ''
-
-    def CASE1( self, main ):           
-                                        
-        import time                     
-        global init       
-        
-        try: 
-            if type(init) is not bool: 
-                init = False  
-        except NameError: 
-            init = False 
-       
-        #Load values from params file
-        checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
-        gitPull = main.params[ 'GIT' ][ 'autopull' ]
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        Apps = main.params[ 'ENV' ][ 'cellApps' ]
-        BENCHUser = main.params[ 'BENCH' ][ 'user' ]
-        maxNodes = int(main.params[ 'availableNodes' ])
-        skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
-        cellName = main.params[ 'ENV' ][ 'cellName' ]        
-
-        # -- INIT SECTION, ONLY RUNS ONCE -- # 
-        if init == False: 
-            init = True
-            global clusterCount             #number of nodes running
-            global ONOSIp                   #list of ONOS IP addresses
-            global scale 
-            
-            clusterCount = 0
-            ONOSIp = [ 0 ]
-            scale = (main.params[ 'SCALE' ]).split(",")            
-            clusterCount = int(scale[0])
-
-            #Populate ONOSIp with ips from params 
-            ONOSIp = [0]
-            ONOSIp.extend(main.ONOSbench.getOnosIps())
-            MN1Ip = ONOSIp[len(ONOSIp) -1] 
-            BENCHIp = ONOSIp[len(ONOSIp) -2]
-
-            #git
-            main.step( "Git checkout and pull " + checkoutBranch )
-            if gitPull == 'on':
-                checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
-                pullResult = main.ONOSbench.gitPull()
-            else:
-                main.log.info( "Skipped git checkout and pull" )
-        
-            if skipMvn != "yes":
-                mvnResult = main.ONOSbench.cleanInstall()
-
-        # -- END OF INIT SECTION --#
-         
-        clusterCount = int(scale[0])
-        scale.remove(scale[0])       
-       
-        #kill off all onos processes 
-        main.log.step("Safety check, killing all ONOS processes")
-        main.log.step("before initiating enviornment setup")
-        for node in range(1, maxNodes + 1):
-            main.ONOSbench.onosDie(ONOSIp[node])
-        
-        #Uninstall everywhere
-        main.log.step( "Cleaning Enviornment..." )
-        for i in range(1, maxNodes + 1):
-            main.log.info(" Uninstalling ONOS " + str(i) )
-            main.ONOSbench.onosUninstall( ONOSIp[i] )
-       
-        #construct the cell file
-        main.log.info("Creating cell file")
-        cellIp = []
-        for node in range (1, clusterCount + 1):
-            cellIp.append(ONOSIp[node])
-
-        main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
-
-        main.step( "Set Cell" )
-        main.ONOSbench.setCell(cellName)
-        
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()  
-
-        main.step( "verify cells" )
-        verifyCellResult = main.ONOSbench.verifyCell()
-      
-        main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
-        for node in range(1, clusterCount + 1):
-            main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
-            main.ONOSbench.onosInstall( ONOSIp[node])
-
-        for node in range(1, clusterCount + 1):
-            for i in range( 2 ):
-                isup = main.ONOSbench.isup( ONOSIp[node] )
-                if isup:
-                    main.log.info("ONOS " + str(node) + " is up\n")
-                    break
-                if not isup:
-                    main.log.report( "ONOS " + str(node) + " didn't start!" )
-        main.log.info("Startup sequence complete")
-
-    def CASE2( self, main ):
-         
-        print ("clusterCount: " + str(clusterCount)) 
-        print ("scale: " + str(scale)) 
-        print ("ONOSIp: " + str(ONOSIp)) 
-        print ("INIT: " + str(init)) 
-        
diff --git a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.topo b/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.topo
deleted file mode 100644
index d82f3fd..0000000
--- a/TestON/tests/ScaleOutTemplate/ScaleOutTemplate.topo
+++ /dev/null
@@ -1,144 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-
-        <ONOSbench>
-            <host>OCN</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS><home>~/onos</home></COMPONENTS>
-        </ONOSbench>
-
-        <ONOS1cli>
-            <host>OCN</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1cli>
-
-        <ONOS2cli>
-            <host>OCN</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2cli>
-
-        <ONOS3cli>
-            <host>OCN</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS3cli>
-
-        <ONOS4cli>
-            <host>OCN</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS4cli>
-
-        <ONOS5cli>
-            <host>OCN</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS5cli>
-
-        <ONOS6cli>
-            <host>OCN</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS6cli>
-
-        <ONOS7cli>
-            <host>OCN</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS7cli>
-
-        <ONOS1>
-            <host>OC1</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>OC2</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>OC3</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS3>
-
-        <ONOS4>
-            <host>OC4</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS4>
-
-    
-        <ONOS5>
-            <host>OC5</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS5>
-
-        <ONOS6>
-            <host>OC6</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS6>
-
-        <ONOS7>
-            <host>OC7</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS7>
-
-    </COMPONENT>
-
-</TOPOLOGY>
- 
diff --git a/TestON/tests/ScaleOutTemplate/__init__.py b/TestON/tests/ScaleOutTemplate/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/ScaleOutTemplate/__init__.py
+++ /dev/null
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.params b/TestON/tests/TopoConvNext/TopoConvNext.params
deleted file mode 100644
index 198befb..0000000
--- a/TestON/tests/TopoConvNext/TopoConvNext.params
+++ /dev/null
@@ -1,69 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,2,3,2,3,2,4,2,3,2,3,2,3,2</testcases>
-
-    <ENV>
-        <cellName>topo_conv_test</cellName>
-    </ENV>
-
-    <GIT>
-        #autoPull 'on' or 'off'
-        <autoPull>off</autoPull>
-        <checkout>master</checkout>
-    </GIT>
-
-    <CTRL>
-        <user>admin</user>
-        <ip1>10.128.174.1</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.174.2</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.174.3</ip3>
-        <port3>6633</port3>
-        <ip4>10.128.174.4</ip4>
-        <port4>6633</port4>
-        <ip5>10.128.174.5</ip5>
-        <port5>6633</port5>
-        <ip6>10.128.174.6</ip6>
-        <port6>6633</port6>
-        <ip7>10.128.174.7</ip7>
-        <port7>6633</port7>
-    </CTRL>
-
-    <MN>
-        <ip1>10.128.10.90</ip1>
-        <ip2>10.128.10.91</ip2>
-    </MN>
-
-    <BENCH>
-        <ip>10.128.174.10</ip>
-    </BENCH>
-
-    <TEST>
-        <onosLogFile>/opt/onos/log/karaf*</onosLogFile>
-
-        #Number of times to iterate each case
-        <numIter>3</numIter>
-        <numSwitch1>500</numSwitch1>
-        <numSwitch2>400</numSwitch2>
-        <numSwitch3>200</numSwitch3>
-        <numSwitch4>300</numSwitch4>
-        #Number of iterations to ignore initially
-        <iterIgnore>1</iterIgnore>
-
-        <topo_accumulator_config>
-        large_topo_event_accumulator.cfg
-        </topo_accumulator_config>
-        <topo_config_name>
-        org.onlab.onos.net.topology.impl.DefaultTopologyProvider.cfg
-        </topo_config_name>
-
-        <swDisc100Threshold>0,100000</swDisc100Threshold>
-    </TEST>
-
-    <JSON>
-        <deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
-        <hostTimestamp>topologyHostEventTimestamp</hostTimestamp>
-        <linkTimestamp>topologyLinkEventTimestamp</linkTimestamp>
-        <graphTimestamp>topologyGraphEventTimestamp</graphTimestamp>
-    </JSON>
-</PARAMS>
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.py b/TestON/tests/TopoConvNext/TopoConvNext.py
deleted file mode 100644
index c114e48..0000000
--- a/TestON/tests/TopoConvNext/TopoConvNext.py
+++ /dev/null
@@ -1,1379 +0,0 @@
-# TopoPerfNext
-#
-# Topology Convergence scale-out test for ONOS-next
-# NOTE: This test supports up to 7 nodes scale-out scenario
-#
-# NOTE: Ensure that you have 'tablet.json' file
-#      in the onos/tools/package/config directory
-# NOTE: You must start this test initially with 3 nodes
-#
-# andrew@onlab.us
-
-import time
-import sys
-import os
-import re
-
-
-class TopoConvNext:
-
-    def __init__( self ):
-        self.default = ''
-
-    def CASE1( self, main ):
-        """
-        ONOS startup sequence
-        """
-        import time
-
-        #******
-        # Global cluster count for scale-out purposes
-        global cluster_count
-        global topo_iteration
-        topo_iteration = 1
-        cluster_count = 1
-        #******
-        cell_name = main.params[ 'ENV' ][ 'cellName' ]
-
-        git_pull = main.params[ 'GIT' ][ 'autoPull' ]
-        checkout_branch = main.params[ 'GIT' ][ 'checkout' ]
-
-        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' ]
-        ONOS6_ip = main.params[ 'CTRL' ][ 'ip6' ]
-        ONOS7_ip = main.params[ 'CTRL' ][ 'ip7' ]
-        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
-        BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
-
-        main.case( "Setting up test environment" )
-        main.log.info( "copying topology event accumulator config file" +
-                       " to ONOS package/etc/ directory" )
-        topo_config_name = main.params[ 'TEST' ][ 'topo_config_name' ]
-        topo_config =\
-            main.params[ 'TEST' ][ 'topo_accumulator_config' ]
-        main.ONOSbench.handle.sendline( "cp ~/" + topo_config +
-                                        " ~/ONOS/tools/package/etc/" +
-                                        topo_config_name )
-        main.ONOSbench.handle.expect( "\$" )
-
-        main.log.info( "Uninstalling previous instances" )
-        #main.ONOSbench.onos_uninstall( node_ip=ONOS1_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS2_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS3_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS4_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS5_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS6_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS7_ip )
-
-        main.log.report( "Setting up test environment" )
-
-        main.step( "Creating cell file" )
-        cell_file_result = main.ONOSbench.create_cell_file(
-            BENCH_ip, cell_name, MN1_ip,
-            "onos-core,onos-app-metrics",
-            # ONOS1_ip, ONOS2_ip, ONOS3_ip )
-            ONOS1_ip )
-
-        main.step( "Applying cell file to environment" )
-        cell_apply_result = main.ONOSbench.set_cell( cell_name )
-        verify_cell_result = main.ONOSbench.verify_cell()
-
-        main.step( "Removing raft logs" )
-        main.ONOSbench.onos_remove_raft_logs()
-        time.sleep( 10 )
-
-        main.step( "Git checkout and pull " + checkout_branch )
-        if git_pull == 'on':
-            checkout_result = \
-                main.ONOSbench.git_checkout( checkout_branch )
-            pull_result = main.ONOSbench.git_pull()
-        else:
-            checkout_result = main.TRUE
-            pull_result = main.TRUE
-            main.log.info( "Skipped git checkout and pull" )
-
-        main.log.report( "Commit information - " )
-        main.ONOSbench.get_version()
-
-        main.step( "Using mvn clean & install" )
-        #mvn_result = main.ONOSbench.clean_install()
-        mvn_result = main.TRUE
-
-        main.step( "Set cell for ONOS cli env" )
-        main.ONOS1cli.set_cell( cell_name )
-        # main.ONOS2cli.set_cell( cell_name )
-        # main.ONOS3cli.set_cell( cell_name )
-
-        main.step( "Creating ONOS package" )
-        package_result = main.ONOSbench.onos_package()
-
-        # Start test with single node only
-        main.step( "Installing ONOS package" )
-        install1_result = main.ONOSbench.onos_install( node=ONOS1_ip )
-        #install2_result = main.ONOSbench.onos_install( node=ONOS2_ip )
-        #install3_result = main.ONOSbench.onos_install( node=ONOS3_ip )
-
-        time.sleep( 10 )
-
-        main.step( "Start onos cli" )
-        cli1 = main.ONOS1cli.start_onos_cli( ONOS1_ip )
-        #cli2 = main.ONOS2cli.start_onos_cli( ONOS2_ip )
-        #cli3 = main.ONOS3cli.start_onos_cli( ONOS3_ip )
-
-        main.step( "Enable metrics feature" )
-        # main.ONOS1cli.feature_install( "onos-app-metrics" )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=cell_file_result and cell_apply_result and
-                                 verify_cell_result and checkout_result and
-                                 pull_result and mvn_result and
-                                 install1_result,  # and install2_result and
-                                 # install3_result,
-                                 onpass="Test Environment setup successful",
-                                 onfail="Failed to setup test environment" )
-
-    def CASE2( self, main ):
-        """
-        100 Switch discovery latency
-
-        Important:
-            This test case can be potentially dangerous if
-            your machine has previously set iptables rules.
-            One of the steps of the test case will flush
-            all existing iptables rules.
-        Note:
-            You can specify the number of switches in the
-            params file to adjust the switch discovery size
-            ( and specify the corresponding topology in Mininet1
-            .topo file )
-        """
-        import time
-        import subprocess
-        import os
-        import requests
-        import json
-        import numpy
-
-        ONOS_ip_list = []
-        ONOS_ip_list.append( '0' )
-        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip1' ] )
-        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip2' ] )
-        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip3' ] )
-        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip4' ] )
-        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip5' ] )
-        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip6' ] )
-        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip7' ] )
-        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
-        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
-
-        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
-
-        # Number of iterations of case
-        num_iter = main.params[ 'TEST' ][ 'numIter' ]
-        iter_ignore = int( main.params[ 'TEST' ][ 'iterIgnore' ] )
-
-        #***********
-        # Global number of switches that change
-        # throughout the test
-        global num_sw
-        global topo_iteration
-        global cluster_count
-        if topo_iteration == 1:
-            num_sw = main.params[ 'TEST' ][ 'numSwitch1' ]
-        elif topo_iteration == 2:
-            num_sw = main.params[ 'TEST' ][ 'numSwitch2' ]
-        elif topo_iteration == 3:
-            num_sw = main.params[ 'TEST' ][ 'numSwitch3' ]
-        elif topo_iteration == 4:
-            num_sw = main.params[ 'TEST' ][ 'numSwitch4' ]
-        #***********
-
-        # Timestamp 'keys' for json metrics output.
-        # These are subject to change, hence moved into params
-        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
-        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
-
-        # Threshold for this test case
-        sw_disc_threshold_str = main.params[ 'TEST' ][ 'swDisc100Threshold' ]
-        sw_disc_threshold_obj = sw_disc_threshold_str.split( "," )
-        sw_disc_threshold_min = int( sw_disc_threshold_obj[ 0 ] )
-        sw_disc_threshold_max = int( sw_disc_threshold_obj[ 1 ] )
-
-        assertion = main.TRUE
-        sw_discovery_lat_list = []
-        syn_ack_delta_list = []
-
-        main.case( str( num_sw ) + " switches distributed across " +
-                   str( cluster_count ) + " nodes convergence latency" )
-
-        main.log.report( "Large topology convergence and scale-out test" )
-        main.log.report( "Currently active ONOS node(s): " )
-        report_str = "Node "
-        for node in range( 1, cluster_count + 1 ):
-            report_str += ( str( node ) + " " )
-        main.log.report( report_str )
-        main.log.report( "Topology size: " + str( num_sw ) + " switches" )
-
-        main.step( "Distributing " + num_sw + " switches to each ONOS" )
-        index = 1
-        for node in range( 1, cluster_count + 1 ):
-            for i in range( index, ( int( num_sw ) / cluster_count ) + index ):
-                main.Mininet1.assign_sw_controller(
-                    sw=str( i ),
-                    ip1=ONOS_ip_list[ node ],
-                    port1=default_sw_port )
-            index = i + 1
-        # for i in range( 1, int( num_sw )+1 ):
-            # main.Mininet1.assign_sw_controller(
-            # sw=str( i ),
-            # ip1="10.128.174.1",
-            #            port1="6633" )
-
-        main.log.info( "Please check ptpd configuration to ensure " +
-                       "all nodes' system times are in sync" )
-
-        time.sleep( 10 )
-
-        for i in range( 0, int( num_iter ) ):
-            main.step( "Set iptables rule to block sw connections" )
-
-            # INPUT rules
-            main.ONOS1.handle.sendline(
-                "sudo iptables -A INPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS2.handle.sendline(
-                "sudo iptables -A INPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS3.handle.sendline(
-                "sudo iptables -A INPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS4.handle.sendline(
-                "sudo iptables -A INPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS5.handle.sendline(
-                "sudo iptables -A INPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS6.handle.sendline(
-                "sudo iptables -A INPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS7.handle.sendline(
-                "sudo iptables -A INPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-
-            # OUTPUT rules
-            main.ONOS1.handle.sendline(
-                "sudo iptables -A OUTPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS2.handle.sendline(
-                "sudo iptables -A OUTPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS3.handle.sendline(
-                "sudo iptables -A OUTPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS4.handle.sendline(
-                "sudo iptables -A OUTPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS5.handle.sendline(
-                "sudo iptables -A OUTPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS6.handle.sendline(
-                "sudo iptables -A OUTPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS7.handle.sendline(
-                "sudo iptables -A OUTPUT -p tcp -s " +
-                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
-
-            main.log.info( "Please wait for switch connection to timeout" )
-
-            # time.sleep( 60 )
-            # if cluster_count >= 3:
-            #    time.sleep( 60 )
-            # if cluster_count >= 5:
-            #    time.sleep( 30 )
-            # if cluster_count >= 6:
-            #    time.sleep( 30 )
-
-            if cluster_count >= 3:
-                main.ONOS1.handle.sendline(
-                    "tshark -i eth0 -t e | " +
-                    "grep 'SYN, ACK' | grep '6633' >" +
-                    "/tmp/syn_ack_onos1_iter" +
-                    str( i ) +
-                    ".txt &" )
-                main.ONOS2.handle.sendline(
-                    "tshark -i eth0 -t e | " +
-                    "grep 'SYN, ACK' | grep '6633' >" +
-                    "/tmp/syn_ack_onos2_iter" +
-                    str( i ) +
-                    ".txt &" )
-                main.ONOS3.handle.sendline(
-                    "tshark -i eth0 -t e | " +
-                    "grep 'SYN, ACK' | grep '6633' >" +
-                    "/tmp/syn_ack_onos3_iter" +
-                    str( i ) +
-                    ".txt &" )
-            if cluster_count >= 4:
-                main.ONOS4.handle.sendline(
-                    "tshark -i eth0 -t e | " +
-                    "grep 'SYN, ACK' | grep '6633' >" +
-                    "/tmp/syn_ack_onos4_iter" +
-                    str( i ) +
-                    ".txt &" )
-            if cluster_count >= 5:
-                main.ONOS5.handle.sendline(
-                    "tshark -i eth0 -t e | " +
-                    "grep 'SYN, ACK' | grep '6633' >" +
-                    "/tmp/syn_ack_onos5_iter" +
-                    str( i ) +
-                    ".txt &" )
-            if cluster_count >= 6:
-                main.ONOS6.handle.sendline(
-                    "tshark -i eth0 -t e | " +
-                    "grep 'SYN, ACK' | grep '6633' >" +
-                    "/tmp/syn_ack_onos6_iter" +
-                    str( i ) +
-                    ".txt &" )
-            if cluster_count == 7:
-                main.ONOS7.handle.sendline(
-                    "tshark -i eth0 -t e | " +
-                    "grep 'SYN, ACK' | grep '6633' >" +
-                    "/tmp/syn_ack_onos6_iter" +
-                    str( i ) +
-                    ".txt &" )
-
-            # NOTE:
-            #       Delay before checking devices to
-            #       help prevent timing out from CLI
-            #       due to multiple command issuing
-            time.sleep( 20 )
-
-            loop = True
-            loop_count = 0
-            device_count = 0
-            while loop_count < 60 and loop:
-                main.log.info( "Checking devices for device down" )
-
-                temp_len = 0
-                device_str1 = main.ONOS1cli.devices(
-                    node_ip=ONOS_ip_list[ 1 ] )
-                device_json1 = json.loads( device_str1 )
-                json_len = len( device_json1 )
-
-                # NOTE: May want to check the rest of
-                #      the ONOS instances for device down as well
-
-                for device1 in device_json1:
-                    temp_len = temp_len + 1
-                    if device1[ 'available' ]:
-                        loop = True
-                        break
-                    # if I'm on the last json object and I still haven't
-                    # broken out of the loop, it means there were
-                    # no available devices
-                    elif temp_len == json_len - 1:
-                        main.log.info( "Temp length: " + str( temp_len ) )
-                        main.step( "Flushing iptables and obtaining t0" )
-                        t0_system = time.time() * 1000
-
-                        main.ONOS1.handle.sendline( "sudo iptables -F" )
-                        main.ONOS2.handle.sendline( "sudo iptables -F" )
-                        main.ONOS3.handle.sendline( "sudo iptables -F" )
-                        main.ONOS4.handle.sendline( "sudo iptables -F" )
-                        main.ONOS5.handle.sendline( "sudo iptables -F" )
-                        main.ONOS6.handle.sendline( "sudo iptables -F" )
-                        main.ONOS7.handle.sendline( "sudo iptables -F" )
-
-                        loop = False
-                        break
-
-                loop_count += 1
-                time.sleep( 1 )
-
-            main.log.info( "System time t0: " + str( t0_system ) )
-
-            counter_loop = 0
-            counter_avail1 = 0
-            counter_avail2 = 0
-            counter_avail3 = 0
-            counter_avail4 = 0
-            counter_avail5 = 0
-            counter_avail6 = 0
-            counter_avail7 = 0
-            onos1_dev = False
-            onos2_dev = False
-            onos3_dev = False
-            onos4_dev = False
-            onos5_dev = False
-            onos6_dev = False
-            onos7_dev = False
-
-            # TODO: Think of a more elegant way to check all
-            #      switches across all nodes
-            # Goodluck debugging this loop
-            while counter_loop < 60:
-                for node in range( 1, cluster_count + 1 ):
-                    if node == 1 and not onos1_dev:
-                        main.log.info( "Checking node 1 for device " +
-                                       "discovery" )
-                        device_str_obj1 = main.ONOS1cli.devices(
-                            node_ip=ONOS_ip_list[ 1 ] )
-                        device_json1 = json.loads( device_str_obj1 )
-                        for device1 in device_json1:
-                            if device1[ 'available' ]:
-                                counter_avail1 += 1
-                                if counter_avail1 == int( num_sw ):
-                                    onos1_dev = True
-                                    main.log.info( "All devices have been" +
-                                                   " discovered on ONOS1" )
-                            else:
-                                counter_avail1 = 0
-                    if node == 2 and not onos2_dev:
-                        main.log.info( "Checking node 2 for device " +
-                                       "discovery" )
-                        device_str_obj2 = main.ONOS2cli.devices(
-                            node_ip=ONOS_ip_list[ 2 ] )
-                        device_json2 = json.loads( device_str_obj2 )
-                        for device2 in device_json2:
-                            if device2[ 'available' ]:
-                                counter_avail2 += 1
-                                if counter_avail2 == int( num_sw ):
-                                    onos2_dev = True
-                                    main.log.info( "All devices have been" +
-                                                   " discovered on ONOS2" )
-                            else:
-                                counter_avail2 = 0
-                    if node == 3 and not onos3_dev:
-                        main.log.info( "Checking node 3 for device " +
-                                       "discovery" )
-                        device_str_obj3 = main.ONOS3cli.devices(
-                            node_ip=ONOS_ip_list[ 3 ] )
-                        device_json3 = json.loads( device_str_obj3 )
-                        for device3 in device_json3:
-                            if device3[ 'available' ]:
-                                counter_avail3 += 1
-                                if counter_avail3 == int( num_sw ):
-                                    onos3_dev = True
-                                    main.log.info( "All devices have been" +
-                                                   " discovered on ONOS3" )
-                            else:
-                                counter_avail3 = 0
-                    if node == 4 and not onos4_dev:
-                        main.log.info( "Checking node 4 for device " +
-                                       "discovery" )
-                        device_str_obj4 = main.ONOS4cli.devices(
-                            node_ip=ONOS_ip_list[ 4 ] )
-                        device_json4 = json.loads( device_str_obj4 )
-                        for device4 in device_json4:
-                            if device4[ 'available' ]:
-                                counter_avail4 += 1
-                                if counter_avail4 == int( num_sw ):
-                                    onos4_dev = True
-                                    main.log.info( "All devices have been" +
-                                                   " discovered on ONOS4" )
-                            else:
-                                counter_avail4 = 0
-                    if node == 5 and not onos5_dev:
-                        main.log.info( "Checking node 5 for device " +
-                                       "discovery" )
-                        device_str_obj5 = main.ONOS5cli.devices(
-                            node_ip=ONOS_ip_list[ 5 ] )
-                        device_json5 = json.loads( device_str_obj5 )
-                        for device5 in device_json5:
-                            if device5[ 'available' ]:
-                                counter_avail5 += 1
-                                if counter_avail5 == int( num_sw ):
-                                    onos5_dev = True
-                                    main.log.info( "All devices have been" +
-                                                   " discovered on ONOS5" )
-                            else:
-                                counter_avail5 = 0
-                    if node == 6 and not onos6_dev:
-                        main.log.info( "Checking node 6 for device " +
-                                       "discovery" )
-                        device_str_obj6 = main.ONOS6cli.devices(
-                            node_ip=ONOS_ip_list[ 6 ] )
-                        device_json6 = json.loads( device_str_obj6 )
-                        for device6 in device_json6:
-                            if device6[ 'available' ]:
-                                counter_avail6 += 1
-                                if counter_avail6 == int( num_sw ):
-                                    onos6_dev = True
-                                    main.log.info( "All devices have been" +
-                                                   " discovered on ONOS6" )
-                            else:
-                                counter_avail6 = 0
-                    if node == 7 and not onos7_dev:
-                        main.log.info( "Checking node 7 for device " +
-                                       "discovery" )
-                        device_str_obj7 = main.ONOS7cli.devices(
-                            node_ip=ONOS_ip_list[ 7 ] )
-                        device_json7 = json.loads( device_str_obj7 )
-                        for device7 in device_json7:
-                            if device7[ 'available' ]:
-                                counter_avail7 += 1
-                                if counter_avail7 == int( num_sw ):
-                                    onos7_dev = True
-                                    main.log.info( "All devices have been" +
-                                                   " discovered on ONOS7" )
-                            else:
-                                counter_avail7 = 0
-                    # END node loop
-
-                # TODO: clean up this mess of an if statements if possible
-                # Treat each if as a separate test case with the given
-                #     cluster count. Hence when the cluster count changes
-                #     the desired calculations will be made
-                if cluster_count == 1:
-                    if onos1_dev:
-                        main.log.info( "All devices have been discovered" +
-                                       " on all ONOS instances" )
-                        time.sleep( 5 )
-                        json_str_metrics_1 =\
-                            main.ONOS1cli.topology_events_metrics()
-                        json_obj_1 = json.loads( json_str_metrics_1 )
-                        graph_timestamp_1 =\
-                            json_obj_1[ graphTimestamp ][ 'value' ]
-
-                        graph_lat_1 = \
-                            int( graph_timestamp_1 ) - int( t0_system )
-
-                        main.log.info( "Graph Timestamp ONOS1: " +
-                                       str( graph_timestamp_1 ) )
-
-                        if graph_lat_1 > sw_disc_threshold_min\
-                                and graph_lat_1 < sw_disc_threshold_max\
-                                and int( i ) > iter_ignore:
-                            sw_discovery_lat_list.append(
-                                graph_lat_1 )
-                            main.log.info(
-                                "Sw discovery latency of " +
-                                str( cluster_count ) +
-                                " node(s): " +
-                                str( graph_lat_1 ) +
-                                " ms" )
-                        else:
-                            main.log.info( "Switch discovery latency " +
-                                           "exceeded the threshold." )
-                            main.log.info( str( graph_lat_1 ) + " ms" )
-                        # Break while loop
-                        break
-                if cluster_count == 2:
-                    if onos1_dev and onos2_dev:
-                        main.log.info( "All devices have been discovered" +
-                                       " on all " + str( cluster_count ) +
-                                       " ONOS instances" )
-                        time.sleep( 5 )
-
-                        json_str_metrics_1 =\
-                            main.ONOS1cli.topology_events_metrics()
-                        json_str_metrics_2 =\
-                            main.ONOS2cli.topology_events_metrics()
-                        json_obj_1 = json.loads( json_str_metrics_1 )
-                        json_obj_2 = json.loads( json_str_metrics_2 )
-                        graph_timestamp_1 =\
-                            json_obj_1[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_2 =\
-                            json_obj_2[ graphTimestamp ][ 'value' ]
-
-                        graph_lat_1 = \
-                            int( graph_timestamp_1 ) - int( t0_system )
-                        graph_lat_2 = \
-                            int( graph_timestamp_2 ) - int( t0_system )
-
-                        main.log.info( "Graph Timestamp ONOS1: " +
-                                       str( graph_timestamp_1 ) )
-                        main.log.info( "Graph Timestamp ONOS2: " +
-                                       str( graph_timestamp_2 ) )
-
-                        max_graph_lat = max( graph_lat_1,
-                                             graph_lat_2, graph_lat_3 )
-
-                        if max_graph_lat > sw_disc_threshold_min\
-                                and max_graph_lat < sw_disc_threshold_max\
-                                and int( i ) > iter_ignore:
-                            sw_discovery_lat_list.append(
-                                max_graph_lat )
-                            main.log.info(
-                                "Sw discovery latency of " +
-                                str( cluster_count ) +
-                                " node(s): " +
-                                str( max_graph_lat ) +
-                                " ms" )
-                        else:
-                            main.log.info( "Switch discovery latency " +
-                                           "exceeded the threshold." )
-                            main.log.info( str( max_graph_lat ) + " ms" )
-                        break
-                if cluster_count == 3:
-                    if onos1_dev and onos2_dev and onos3_dev:
-                        main.log.info( "All devices have been discovered" +
-                                       " on all " + str( cluster_count ) +
-                                       " ONOS instances" )
-
-                        # TODO: Investigate this sleep
-                        #      added to 'pad' the results with
-                        #      plenty of time to 'catch up'
-                        time.sleep( 5 )
-
-                        json_str_metrics_1 =\
-                            main.ONOS1cli.topology_events_metrics()
-                        json_str_metrics_2 =\
-                            main.ONOS2cli.topology_events_metrics()
-                        json_str_metrics_3 =\
-                            main.ONOS3cli.topology_events_metrics()
-                        json_obj_1 = json.loads( json_str_metrics_1 )
-                        json_obj_2 = json.loads( json_str_metrics_2 )
-                        json_obj_3 = json.loads( json_str_metrics_3 )
-                        graph_timestamp_1 =\
-                            json_obj_1[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_2 =\
-                            json_obj_2[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_3 =\
-                            json_obj_3[ graphTimestamp ][ 'value' ]
-
-                        graph_lat_1 = \
-                            int( graph_timestamp_1 ) - int( t0_system )
-                        graph_lat_2 = \
-                            int( graph_timestamp_2 ) - int( t0_system )
-                        graph_lat_3 = \
-                            int( graph_timestamp_3 ) - int( t0_system )
-
-                        main.log.info( "Graph Timestamp ONOS1: " +
-                                       str( graph_timestamp_1 ) )
-                        main.log.info( "Graph Timestamp ONOS2: " +
-                                       str( graph_timestamp_2 ) )
-                        main.log.info( "Graph Timestamp ONOS3: " +
-                                       str( graph_timestamp_3 ) )
-
-                        max_graph_lat = max( graph_lat_1,
-                                             graph_lat_2,
-                                             graph_lat_3 )
-
-                        if max_graph_lat > sw_disc_threshold_min\
-                                and max_graph_lat < sw_disc_threshold_max\
-                                and int( i ) > iter_ignore:
-                            sw_discovery_lat_list.append(
-                                max_graph_lat )
-                            main.log.info(
-                                "Sw discovery latency of " +
-                                str( cluster_count ) +
-                                " node(s): " +
-                                str( max_graph_lat ) +
-                                " ms" )
-                        else:
-                            main.log.info( "Switch discovery latency " +
-                                           "exceeded the threshold." )
-                            main.log.info( str( max_graph_lat ) + " ms" )
-
-                        break
-                if cluster_count == 4:
-                    if onos1_dev and onos2_dev and onos3_dev and\
-                       onos4_dev:
-                        main.log.info( "All devices have been discovered" +
-                                       " on all ONOS instances" )
-                        json_str_metrics_1 =\
-                            main.ONOS1cli.topology_events_metrics()
-                        json_str_metrics_2 =\
-                            main.ONOS2cli.topology_events_metrics()
-                        json_str_metrics_3 =\
-                            main.ONOS3cli.topology_events_metrics()
-                        json_str_metrics_4 =\
-                            main.ONOS4cli.topology_events_metrics()
-                        json_obj_1 = json.loads( json_str_metrics_1 )
-                        json_obj_2 = json.loads( json_str_metrics_2 )
-                        json_obj_3 = json.loads( json_str_metrics_3 )
-                        json_obj_4 = json.loads( json_str_metrics_4 )
-                        graph_timestamp_1 =\
-                            json_obj_1[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_2 =\
-                            json_obj_2[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_3 =\
-                            json_obj_3[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_4 =\
-                            json_obj_4[ graphTimestamp ][ 'value' ]
-
-                        graph_lat_1 = \
-                            int( graph_timestamp_1 ) - int( t0_system )
-                        graph_lat_2 = \
-                            int( graph_timestamp_2 ) - int( t0_system )
-                        graph_lat_3 = \
-                            int( graph_timestamp_3 ) - int( t0_system )
-                        graph_lat_4 = \
-                            int( graph_timestamp_4 ) - int( t0_system )
-
-                        main.log.info( "Graph Timestamp ONOS1: " +
-                                       str( graph_timestamp_1 ) )
-                        main.log.info( "Graph Timestamp ONOS2: " +
-                                       str( graph_timestamp_2 ) )
-                        main.log.info( "Graph Timestamp ONOS3: " +
-                                       str( graph_timestamp_3 ) )
-                        main.log.info( "Graph Timestamp ONOS4: " +
-                                       str( graph_timestamp_4 ) )
-
-                        max_graph_lat = max( graph_lat_1,
-                                             graph_lat_2,
-                                             graph_lat_3,
-                                             graph_lat_4 )
-
-                        if max_graph_lat > sw_disc_threshold_min\
-                                and max_graph_lat < sw_disc_threshold_max\
-                                and int( i ) > iter_ignore:
-                            sw_discovery_lat_list.append(
-                                max_graph_lat )
-                            main.log.info(
-                                "Sw discovery latency of " +
-                                str( cluster_count ) +
-                                " node(s): " +
-                                str( max_graph_lat ) +
-                                " ms" )
-                        else:
-                            main.log.info( "Switch discovery latency " +
-                                           "exceeded the threshold." )
-                            main.log.info( str( max_graph_lat ) + " ms" )
-
-                        break
-                if cluster_count == 5:
-                    if onos1_dev and onos2_dev and onos3_dev and\
-                       onos4_dev and onos5_dev:
-                        main.log.info( "All devices have been discovered" +
-                                       " on all ONOS instances" )
-
-                        # TODO: Investigate this sleep
-                        #      added to 'pad' the results with
-                        #      plenty of time to 'catch up'
-                        time.sleep( 5 )
-
-                        json_str_metrics_1 =\
-                            main.ONOS1cli.topology_events_metrics()
-                        json_str_metrics_2 =\
-                            main.ONOS2cli.topology_events_metrics()
-                        json_str_metrics_3 =\
-                            main.ONOS3cli.topology_events_metrics()
-                        json_str_metrics_4 =\
-                            main.ONOS4cli.topology_events_metrics()
-                        json_str_metrics_5 =\
-                            main.ONOS5cli.topology_events_metrics()
-                        json_obj_1 = json.loads( json_str_metrics_1 )
-                        json_obj_2 = json.loads( json_str_metrics_2 )
-                        json_obj_3 = json.loads( json_str_metrics_3 )
-                        json_obj_4 = json.loads( json_str_metrics_4 )
-                        json_obj_5 = json.loads( json_str_metrics_5 )
-                        graph_timestamp_1 =\
-                            json_obj_1[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_2 =\
-                            json_obj_2[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_3 =\
-                            json_obj_3[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_4 =\
-                            json_obj_4[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_5 =\
-                            json_obj_5[ graphTimestamp ][ 'value' ]
-
-                        graph_lat_1 = \
-                            int( graph_timestamp_1 ) - int( t0_system )
-                        graph_lat_2 = \
-                            int( graph_timestamp_2 ) - int( t0_system )
-                        graph_lat_3 = \
-                            int( graph_timestamp_3 ) - int( t0_system )
-                        graph_lat_4 = \
-                            int( graph_timestamp_4 ) - int( t0_system )
-                        graph_lat_5 = \
-                            int( graph_timestamp_5 ) - int( t0_system )
-
-                        main.log.info( "Graph Timestamp ONOS1: " +
-                                       str( graph_timestamp_1 ) )
-                        main.log.info( "Graph Timestamp ONOS2: " +
-                                       str( graph_timestamp_2 ) )
-                        main.log.info( "Graph Timestamp ONOS3: " +
-                                       str( graph_timestamp_3 ) )
-                        main.log.info( "Graph Timestamp ONOS4: " +
-                                       str( graph_timestamp_4 ) )
-                        main.log.info( "Graph Timestamp ONOS5: " +
-                                       str( graph_timestamp_5 ) )
-
-                        max_graph_lat = max( graph_lat_1,
-                                             graph_lat_2,
-                                             graph_lat_3,
-                                             graph_lat_4,
-                                             graph_lat_5 )
-
-                        if max_graph_lat > sw_disc_threshold_min\
-                                and max_graph_lat < sw_disc_threshold_max\
-                                and int( i ) > iter_ignore:
-                            sw_discovery_lat_list.append(
-                                max_graph_lat )
-                            main.log.info(
-                                "Sw discovery latency of " +
-                                str( cluster_count ) +
-                                " node(s): " +
-                                str( max_graph_lat ) +
-                                " ms" )
-                        else:
-                            main.log.info( "Switch discovery latency " +
-                                           "exceeded the threshold." )
-                            main.log.info( str( max_graph_lat ) + " ms" )
-
-                        break
-                if cluster_count == 6:
-                    if onos1_dev and onos2_dev and onos3_dev and\
-                       onos4_dev and onos5_dev and onos6_dev:
-                        main.log.info( "All devices have been discovered" +
-                                       " on all ONOS instances" )
-                        json_str_metrics_1 =\
-                            main.ONOS1cli.topology_events_metrics()
-                        json_str_metrics_2 =\
-                            main.ONOS2cli.topology_events_metrics()
-                        json_str_metrics_3 =\
-                            main.ONOS3cli.topology_events_metrics()
-                        json_str_metrics_4 =\
-                            main.ONOS4cli.topology_events_metrics()
-                        json_str_metrics_5 =\
-                            main.ONOS5cli.topology_events_metrics()
-                        json_str_metrics_6 =\
-                            main.ONOS6cli.topology_events_metrics()
-                        json_obj_1 = json.loads( json_str_metrics_1 )
-                        json_obj_2 = json.loads( json_str_metrics_2 )
-                        json_obj_3 = json.loads( json_str_metrics_3 )
-                        json_obj_4 = json.loads( json_str_metrics_4 )
-                        json_obj_5 = json.loads( json_str_metrics_5 )
-                        json_obj_6 = json.loads( json_str_metrics_6 )
-                        graph_timestamp_1 =\
-                            json_obj_1[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_2 =\
-                            json_obj_2[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_3 =\
-                            json_obj_3[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_4 =\
-                            json_obj_4[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_5 =\
-                            json_obj_5[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_6 =\
-                            json_obj_6[ graphTimestamp ][ 'value' ]
-
-                        graph_lat_1 = \
-                            int( graph_timestamp_1 ) - int( t0_system )
-                        graph_lat_2 = \
-                            int( graph_timestamp_2 ) - int( t0_system )
-                        graph_lat_3 = \
-                            int( graph_timestamp_3 ) - int( t0_system )
-                        graph_lat_4 = \
-                            int( graph_timestamp_4 ) - int( t0_system )
-                        graph_lat_5 = \
-                            int( graph_timestamp_5 ) - int( t0_system )
-                        graph_lat_6 = \
-                            int( graph_timestamp_6 ) - int( t0_system )
-
-                        main.log.info( "Graph Timestamp ONOS1: " +
-                                       str( graph_timestamp_1 ) )
-                        main.log.info( "Graph Timestamp ONOS2: " +
-                                       str( graph_timestamp_2 ) )
-                        main.log.info( "Graph Timestamp ONOS3: " +
-                                       str( graph_timestamp_3 ) )
-                        main.log.info( "Graph Timestamp ONOS4: " +
-                                       str( graph_timestamp_4 ) )
-                        main.log.info( "Graph Timestamp ONOS5: " +
-                                       str( graph_timestamp_5 ) )
-                        main.log.info( "Graph Timestamp ONOS6: " +
-                                       str( graph_timestamp_6 ) )
-
-                        max_graph_lat = max( graph_lat_1,
-                                             graph_lat_2,
-                                             graph_lat_3,
-                                             graph_lat_4,
-                                             graph_lat_5,
-                                             graph_lat_6 )
-
-                        if max_graph_lat > sw_disc_threshold_min\
-                                and max_graph_lat < sw_disc_threshold_max\
-                                and int( i ) > iter_ignore:
-                            sw_discovery_lat_list.append(
-                                max_graph_lat )
-                            main.log.info(
-                                "Sw discovery latency of " +
-                                str( cluster_count ) +
-                                " node(s): " +
-                                str( max_graph_lat ) +
-                                " ms" )
-                        else:
-                            main.log.info( "Switch discovery latency " +
-                                           "exceeded the threshold." )
-                            main.log.info( str( max_graph_lat ) + " ms" )
-
-                        break
-                if cluster_count == 7:
-                    if onos1_dev and onos2_dev and onos3_dev and\
-                       onos4_dev and onos5_dev and onos6_dev and\
-                       onos7_dev:
-                        main.log.info( "All devices have been discovered" +
-                                       " on all ONOS instances" )
-
-                        # TODO: Investigate this sleep
-                        #      added to 'pad' the results with
-                        #      plenty of time to 'catch up'
-                        time.sleep( 5 )
-
-                        json_str_metrics_1 =\
-                            main.ONOS1cli.topology_events_metrics()
-                        json_str_metrics_2 =\
-                            main.ONOS2cli.topology_events_metrics()
-                        json_str_metrics_3 =\
-                            main.ONOS3cli.topology_events_metrics()
-                        json_str_metrics_4 =\
-                            main.ONOS4cli.topology_events_metrics()
-                        json_str_metrics_5 =\
-                            main.ONOS5cli.topology_events_metrics()
-                        json_str_metrics_6 =\
-                            main.ONOS6cli.topology_events_metrics()
-                        json_str_metrics_7 =\
-                            main.ONOS7cli.topology_events_metrics()
-                        json_obj_1 = json.loads( json_str_metrics_1 )
-                        json_obj_2 = json.loads( json_str_metrics_2 )
-                        json_obj_3 = json.loads( json_str_metrics_3 )
-                        json_obj_4 = json.loads( json_str_metrics_4 )
-                        json_obj_5 = json.loads( json_str_metrics_5 )
-                        json_obj_6 = json.loads( json_str_metrics_6 )
-                        json_obj_7 = json.loads( json_str_metrics_7 )
-                        graph_timestamp_1 =\
-                            json_obj_1[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_2 =\
-                            json_obj_2[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_3 =\
-                            json_obj_3[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_4 =\
-                            json_obj_4[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_5 =\
-                            json_obj_5[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_6 =\
-                            json_obj_6[ graphTimestamp ][ 'value' ]
-                        graph_timestamp_7 =\
-                            json_obj_7[ graphTimestamp ][ 'value' ]
-
-                        graph_lat_1 = \
-                            int( graph_timestamp_1 ) - int( t0_system )
-                        graph_lat_2 = \
-                            int( graph_timestamp_2 ) - int( t0_system )
-                        graph_lat_3 = \
-                            int( graph_timestamp_3 ) - int( t0_system )
-                        graph_lat_4 = \
-                            int( graph_timestamp_4 ) - int( t0_system )
-                        graph_lat_5 = \
-                            int( graph_timestamp_5 ) - int( t0_system )
-                        graph_lat_6 = \
-                            int( graph_timestamp_6 ) - int( t0_system )
-                        graph_lat_7 = \
-                            int( graph_timestamp_7 ) - int( t0_system )
-
-                        main.log.info( "Graph Timestamp ONOS1: " +
-                                       str( graph_timestamp_1 ) )
-                        main.log.info( "Graph Timestamp ONOS2: " +
-                                       str( graph_timestamp_2 ) )
-                        main.log.info( "Graph Timestamp ONOS3: " +
-                                       str( graph_timestamp_3 ) )
-                        main.log.info( "Graph Timestamp ONOS4: " +
-                                       str( graph_timestamp_4 ) )
-                        main.log.info( "Graph Timestamp ONOS5: " +
-                                       str( graph_timestamp_5 ) )
-                        main.log.info( "Graph Timestamp ONOS6: " +
-                                       str( graph_timestamp_6 ) )
-                        main.log.info( "Graph Timestamp ONOS7: " +
-                                       str( graph_timestamp_7 ) )
-
-                        max_graph_lat = max( graph_lat_1,
-                                             graph_lat_2,
-                                             graph_lat_3,
-                                             graph_lat_4,
-                                             graph_lat_5,
-                                             graph_lat_6,
-                                             graph_lat_7 )
-
-                        if max_graph_lat > sw_disc_threshold_min\
-                                and max_graph_lat < sw_disc_threshold_max\
-                                and int( i ) > iter_ignore:
-                            sw_discovery_lat_list.append(
-                                max_graph_lat )
-                            main.log.info(
-                                "Sw discovery latency of " +
-                                str( cluster_count ) +
-                                " node(s): " +
-                                str( max_graph_lat ) +
-                                " ms" )
-                        else:
-                            main.log.info( "Switch discovery latency " +
-                                           "exceeded the threshold." )
-                            main.log.info( str( max_graph_lat ) + " ms" )
-
-                        break
-
-                counter_loop += 1
-                time.sleep( 3 )
-                # END WHILE LOOP
-
-            # Below is used for reporting SYN / ACK timing
-            # of all switches
-            main.ONOS1.tshark_stop()
-            syn_ack_timestamp_list = []
-            if cluster_count < 3:
-                # TODO: capture synack on nodes less than 3
-                syn_ack_timestamp_list.append( 0 )
-
-            if cluster_count >= 3:
-                main.ONOS2.tshark_stop()
-                main.ONOS3.tshark_stop()
-                time.sleep( 5 )
-                os.system(
-                    "scp " +
-                    ONOS_user +
-                    "@" +
-                    ONOS1_ip +
-                    ":" +
-                    "/tmp/syn_ack_onos1_iter" +
-                    str( i ) +
-                    ".txt /tmp/" )
-                os.system(
-                    "scp " +
-                    ONOS_user +
-                    "@" +
-                    ONOS2_ip +
-                    ":" +
-                    "/tmp/syn_ack_onos2_iter" +
-                    str( i ) +
-                    ".txt /tmp/" )
-                os.system(
-                    "scp " +
-                    ONOS_user +
-                    "@" +
-                    ONOS3_ip +
-                    ":" +
-                    "/tmp/syn_ack_onos3_iter" +
-                    str( i ) +
-                    ".txt /tmp/" )
-                time.sleep( 5 )
-                # Read each of the files and append all
-                # SYN / ACK timestamps to the list
-                with open( "/tmp/syn_ack_onos1_iter" + str( i ) + ".txt" ) as\
-                        f_onos1:
-                    for line in f_onos1:
-                        line = line.split( " " )
-                        try:
-                            float( line[ 1 ] )
-                            syn_ack_timestamp_list.append( line[ 1 ] )
-                        except ValueError:
-                            main.log.info( "String cannot be converted" )
-                with open( "/tmp/syn_ack_onos2_iter" + str( i ) + ".txt" ) as\
-                        f_onos2:
-                    for line in f_onos2:
-                        line = line.split( " " )
-                        try:
-                            float( line[ 1 ] )
-                            syn_ack_timestamp_list.append( line[ 1 ] )
-                        except ValueError:
-                            main.log.info( "String cannot be converted" )
-                with open( "/tmp/syn_ack_onos3_iter" + str( i ) + ".txt" ) as\
-                        f_onos3:
-                    for line in f_onos3:
-                        line = line.split( " " )
-                        try:
-                            float( line[ 1 ] )
-                            syn_ack_timestamp_list.append( line[ 1 ] )
-                        except ValueError:
-                            main.log.info( "String cannot be converted" )
-            if cluster_count >= 4:
-                main.ONOS4.tshark_stop()
-                time.sleep( 5 )
-                os.system(
-                    "scp " +
-                    ONOS_user +
-                    "@" +
-                    ONOS4_ip +
-                    ":" +
-                    "/tmp/syn_ack_onos4_iter" +
-                    str( i ) +
-                    ".txt /tmp/" )
-                time.sleep( 5 )
-                with open( "/tmp/syn_ack_onos4_iter" + str( i ) + ".txt" ) as\
-                        f_onos4:
-                    for line in f_onos4:
-                        line = line.split( " " )
-                        try:
-                            float( line[ 1 ] )
-                            syn_ack_timestamp_list.append( line[ 1 ] )
-                        except ValueError:
-                            main.log.info( "String cannot be converted" )
-            if cluster_count >= 5:
-                main.ONOS5.tshark_stop()
-                time.sleep( 5 )
-                os.system(
-                    "scp " +
-                    ONOS_user +
-                    "@" +
-                    ONOS5_ip +
-                    ":" +
-                    "/tmp/syn_ack_onos5_iter" +
-                    str( i ) +
-                    ".txt /tmp/" )
-                time.sleep( 5 )
-                with open( "/tmp/syn_ack_onos5_iter" + str( i ) + ".txt" ) as\
-                        f_onos5:
-                    for line in f_onos5:
-                        line = line.split( " " )
-                        try:
-                            float( line[ 1 ] )
-                            syn_ack_timestamp_list.append( line[ 1 ] )
-                        except ValueError:
-                            main.log.info( "String cannot be converted" )
-            if cluster_count >= 6:
-                main.ONOS6.tshark_stop()
-                time.sleep( 5 )
-                os.system(
-                    "scp " +
-                    ONOS_user +
-                    "@" +
-                    ONOS6_ip +
-                    ":" +
-                    "/tmp/syn_ack_onos6_iter" +
-                    str( i ) +
-                    ".txt /tmp/" )
-                time.sleep( 5 )
-                with open( "/tmp/syn_ack_onos6_iter" + str( i ) + ".txt" ) as\
-                        f_onos6:
-                    for line in f_onos6:
-                        line = line.split( " " )
-                        try:
-                            float( line[ 1 ] )
-                            syn_ack_timestamp_list.append( line[ 1 ] )
-                        except ValueError:
-                            main.log.info( "String cannot be converted" )
-            if cluster_count == 7:
-                main.ONOS7.tshark_stop()
-                time.sleep( 5 )
-                os.system(
-                    "scp " +
-                    ONOS_user +
-                    "@" +
-                    ONOS7_ip +
-                    ":" +
-                    "/tmp/syn_ack_onos7_iter" +
-                    str( i ) +
-                    ".txt /tmp/" )
-                time.sleep( 5 )
-                with open( "/tmp/syn_ack_onos7_iter" + str( i ) + ".txt" ) as\
-                        f_onos7:
-                    for line in f_onos7:
-                        line = line.split( " " )
-                        try:
-                            float( line[ 1 ] )
-                            syn_ack_timestamp_list.append( line[ 1 ] )
-                        except ValueError:
-                            main.log.info( "String cannot be converted" )
-
-            # Sort the list by timestamp
-            syn_ack_timestamp_list = sorted( syn_ack_timestamp_list )
-            print "syn_ack_-1  " + str( syn_ack_timestamp_list )
-
-            syn_ack_delta =\
-                int( float( syn_ack_timestamp_list[ -1 ] ) * 1000 ) -\
-                int( float( syn_ack_timestamp_list[ 0 ] ) * 1000 )
-
-            main.log.info( "Switch connection attempt delta iteration " +
-                           str( i ) + ": " + str( syn_ack_delta ) )
-            syn_ack_delta_list.append( syn_ack_delta )
-            # END ITERATION LOOP
-        # REPORT HERE
-
-        if len( sw_discovery_lat_list ) > 0:
-            sw_lat_avg = sum( sw_discovery_lat_list ) / \
-                len( sw_discovery_lat_list )
-            sw_lat_dev = numpy.std( sw_discovery_lat_list )
-        else:
-            sw_lat_avg = 0
-            sw_lat_dev = 0
-            assertion = main.FALSE
-
-        main.log.report( "Switch connection attempt time avg " +
-                         "(last sw SYN/ACK time - first sw SYN/ACK time) " +
-                         str( sum( syn_ack_delta_list ) /
-                              len( syn_ack_delta_list ) ) +
-                         " ms" )
-        main.log.report( str( num_sw ) + " Switch discovery lat for " +
-                         str( cluster_count ) + " instance(s): " )
-        main.log.report( "Avg: " +
-                         str( sw_lat_avg ) +
-                         " ms  " +
-                         "Std Deviation: " +
-                         str( round( sw_lat_dev, 1 ) ) +
-                         " ms" )
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=assertion,
-            onpass="Switch discovery convergence latency" +
-            " for " +
-            str( cluster_count ) +
-            " nodes successful",
-            onfail="Switch discovery convergence latency" +
-            " test failed" )
-
-    def CASE3( self, main ):
-        """
-        Increase number of nodes and initiate CLI
-        """
-        import time
-        import subprocess
-        import os
-        import requests
-        import json
-
-        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' ]
-        ONOS6_ip = main.params[ 'CTRL' ][ 'ip6' ]
-        ONOS7_ip = main.params[ 'CTRL' ][ 'ip7' ]
-
-        cell_name = main.params[ 'ENV' ][ 'cellName' ]
-
-        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
-        BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
-
-        # NOTE:We start with cluster_count at 3. The first
-        # case already initialized ONOS1. Increase the
-        # cluster count and start from 3.
-        # You can optionally change the increment to
-        # test steps of node sizes, such as 3,5,7
-
-        global cluster_count
-        cluster_count += 2
-        main.log.report( "Increasing cluster size to " +
-                         str( cluster_count ) )
-
-        install_result = main.FALSE
-        # Supports up to 7 node configuration
-        # TODO: Cleanup this ridiculous repetitive code
-        if cluster_count == 3:
-            install_result = \
-                main.ONOSbench.onos_install( node=ONOS2_ip )
-            install_result = \
-                main.ONOSbench.onos_install( node=ONOS3_ip )
-            time.sleep( 5 )
-            main.log.info( "Starting CLI" )
-            main.ONOS2cli.start_onos_cli( ONOS2_ip )
-            main.ONOS3cli.start_onos_cli( ONOS3_ip )
-            main.ONOS1cli.add_node( ONOS2_ip, ONOS2_ip )
-            main.ONOS1cli.add_node( ONOS3_ip, ONOS3_ip )
-
-        if cluster_count == 4:
-            main.log.info( "Installing ONOS on node 4" )
-            install_result = \
-                main.ONOSbench.onos_install( node=ONOS4_ip )
-            time.sleep( 5 )
-            main.log.info( "Starting CLI" )
-            main.ONOS4cli.start_onos_cli( ONOS4_ip )
-            main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
-
-        elif cluster_count == 5:
-            main.log.info( "Installing ONOS on nodes 4 and 5" )
-            install_result2 = \
-                main.ONOSbench.onos_install( options="", node=ONOS4_ip )
-            install_result3 = \
-                main.ONOSbench.onos_install( options="", node=ONOS5_ip )
-            time.sleep( 5 )
-            main.log.info( "Starting CLI" )
-            main.ONOS4cli.start_onos_cli( ONOS4_ip )
-            main.ONOS5cli.start_onos_cli( ONOS5_ip )
-            main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
-            main.ONOS1cli.add_node( ONOS5_ip, ONOS5_ip )
-            install_result = install_result2 and install_result3
-
-        elif cluster_count == 6:
-            main.log.info( "Installing ONOS on nodes 4, 5,and 6" )
-            install_result1 = \
-                main.ONOSbench.onos_install( options="", node=ONOS4_ip )
-            install_result2 = \
-                main.ONOSbench.onos_install( options="", node=ONOS5_ip )
-            install_result3 = \
-                main.ONOSbench.onos_install( node=ONOS6_ip )
-            time.sleep( 5 )
-            main.log.info( "Starting CLI" )
-            main.ONOS4cli.start_onos_cli( ONOS4_ip )
-            main.ONOS5cli.start_onos_cli( ONOS5_ip )
-            main.ONOS6cli.start_onos_cli( ONOS6_ip )
-            main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
-            main.ONOS1cli.add_node( ONOS5_ip, ONOS5_ip )
-            main.ONOS1cli.add_node( ONOS6_ip, ONOS6_ip )
-            install_result = install_result1 and install_result2 and\
-                install_result3
-
-        elif cluster_count == 7:
-            main.log.info( "Installing ONOS on nodes 4, 5, 6,and 7" )
-            install_result3 = \
-                main.ONOSbench.onos_install( node=ONOS6_ip )
-            install_result4 = \
-                main.ONOSbench.onos_install( node=ONOS7_ip )
-            main.log.info( "Starting CLI" )
-            main.ONOS4cli.start_onos_cli( ONOS4_ip )
-            main.ONOS5cli.start_onos_cli( ONOS5_ip )
-            main.ONOS6cli.start_onos_cli( ONOS6_ip )
-            main.ONOS7cli.start_onos_cli( ONOS7_ip )
-            main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
-            main.ONOS1cli.add_node( ONOS5_ip, ONOS5_ip )
-            main.ONOS1cli.add_node( ONOS6_ip, ONOS6_ip )
-            main.ONOS1cli.add_node( ONOS7_ip, ONOS7_ip )
-
-            install_result = \
-                install_result3 and install_result4
-
-        time.sleep( 5 )
-
-        if install_result == main.TRUE:
-            assertion = main.TRUE
-        else:
-            assertion = main.FALSE
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=assertion,
-            onpass="Scale out to " +
-            str( cluster_count ) +
-            " nodes successful",
-            onfail="Scale out to " +
-            str( cluster_count ) +
-            " nodes failed" )
-
-    def CASE4( self, main ):
-        """
-        Cleanup ONOS nodes and Increase topology size
-        """
-        # TODO: use meaningful assertion
-        assertion = main.TRUE
-
-        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' ]
-        ONOS6_ip = main.params[ 'CTRL' ][ 'ip6' ]
-        ONOS7_ip = main.params[ 'CTRL' ][ 'ip7' ]
-        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
-        BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
-
-        main.log.info( "Uninstalling previous instances" )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS2_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS3_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS4_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS5_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS6_ip )
-        main.ONOSbench.onos_uninstall( node_ip=ONOS7_ip )
-
-        global topo_iteration
-        global cluster_count
-        cluster_count = 1
-        topo_iteration += 1
-
-        main.log.report( "Increasing topology size" )
-        utilities.assert_equals( expect=main.TRUE, actual=assertion,
-                                 onpass="Topology size increased successfully",
-                                 onfail="Topology size was not increased" )
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.topo b/TestON/tests/TopoConvNext/TopoConvNext.topo
deleted file mode 100644
index b7e9e96..0000000
--- a/TestON/tests/TopoConvNext/TopoConvNext.topo
+++ /dev/null
@@ -1,163 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-        
-        <ONOSbench>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOSbench>
-
-        <ONOS1cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1cli>
-
-        <ONOS2cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2cli>
-        
-        <ONOS3cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS3cli>
-        
-        <ONOS4cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS4cli>
-        
-        <ONOS5cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS5cli>
-        
-        <ONOS6cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS6cli>
-        
-        <ONOS7cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS7cli>
-
-        <ONOS1>
-            <host>10.128.174.1</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.174.2</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>10.128.174.3</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS3>
-        
-        <ONOS4>
-            <host>10.128.174.4</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS4>
-
-        <ONOS5>
-            <host>10.128.174.5</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS5>
-    
-        <ONOS6>
-            <host>10.128.174.6</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS6>
-        
-        <ONOS7>
-            <host>10.128.174.7</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS7>
-
-        <Mininet1>
-            <host>10.128.10.90</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>16</connect_order>
-            <COMPONENTS>
-                <arg1> --custom topo-500sw.py </arg1>
-                <arg2> --arp --mac --topo mytopo</arg2>
-                <arg3> </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.10.90</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>17</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/TopoConvNext/__init__.py b/TestON/tests/TopoConvNext/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/TopoConvNext/__init__.py
+++ /dev/null
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params
deleted file mode 100644
index f797706..0000000
--- a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params
+++ /dev/null
@@ -1,45 +0,0 @@
-<PARAMS>
-    <testcases>1,2,3,4,5</testcases>
-
-    <ENV>
-        <cellName>topo_perf_test</cellName>
-    </ENV>
-
-    <GIT>
-        #autoPull 'on' or 'off'
-        <autoPull>off</autoPull>
-        <checkout>master</checkout>
-    </GIT>
-
-    <CTRL>
-        <user>admin</user>
-        <ip1>10.128.174.1</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.174.2</ip2>
-        <port2>6633</port2>
-        <ip3>10.128.174.3</ip3>
-        <port3>6633</port3>
-    </CTRL>
-
-    <MN>
-        <ip1>10.128.10.90</ip1>
-        <ip2>10.128.10.91</ip2>
-    </MN>
-
-    <BENCH>
-        <ip>10.128.174.10</ip>
-    </BENCH>
-
-    <TEST>
-        #Number of times to iterate each case
-        <numIter>5</numIter>
-        <numSwitch>100</numSwitch>         
-    </TEST>
-
-    <JSON>
-        <deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
-        <hostTimestamp>topologyHostEventTimestamp</hostTimestamp>
-        <linkTimestamp>topologyLinkEventTimestamp</linkTimestamp>
-        <graphTimestamp>topologyGraphEventTimestamp</graphTimestamp>
-    </JSON>
-</PARAMS>
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py
deleted file mode 100644
index e81d905..0000000
--- a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py
+++ /dev/null
@@ -1,1113 +0,0 @@
-# TopoPerfNext
-#
-# Topology Performance test for ONOS-next
-#*** Revised for single node operation ***
-#
-# andrew@onlab.us
-
-import time
-import sys
-import os
-import re
-
-
-class TopoPerfNextSingleNode:
-
-    def __init__( self ):
-        self.default = ''
-
-    def CASE1( self, main ):
-        """
-        ONOS startup sequence
-        """
-        import time
-
-        cell_name = main.params[ 'ENV' ][ 'cellName' ]
-
-        git_pull = main.params[ 'GIT' ][ 'autoPull' ]
-        checkout_branch = main.params[ 'GIT' ][ 'checkout' ]
-
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
-        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
-        BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
-
-        main.case( "Setting up test environment" )
-
-        main.step( "Creating cell file" )
-        cell_file_result = main.ONOSbench.create_cell_file(
-            BENCH_ip, cell_name, MN1_ip, "onos-core",
-            ONOS1_ip )
-
-        main.step( "Applying cell file to environment" )
-        cell_apply_result = main.ONOSbench.set_cell( cell_name )
-        verify_cell_result = main.ONOSbench.verify_cell()
-
-        main.step( "Git checkout and pull " + checkout_branch )
-        if git_pull == 'on':
-            checkout_result = \
-                main.ONOSbench.git_checkout( checkout_branch )
-            pull_result = main.ONOSbench.git_pull()
-        else:
-            checkout_result = main.TRUE
-            pull_result = main.TRUE
-            main.log.info( "Skipped git checkout and pull" )
-
-        main.step( "Using mvn clean & install" )
-        #mvn_result = main.ONOSbench.clean_install()
-        mvn_result = main.TRUE
-
-        main.step( "Creating ONOS package" )
-        package_result = main.ONOSbench.onos_package()
-
-        main.step( "Installing ONOS package" )
-        install1_result = main.ONOSbench.onos_install( node=ONOS1_ip )
-
-        # NOTE: This step may be unnecessary
-        #main.step( "Starting ONOS service" )
-        #start_result = main.ONOSbench.onos_start( ONOS1_ip )
-
-        main.step( "Set cell for ONOS cli env" )
-        main.ONOS1cli.set_cell( cell_name )
-
-        time.sleep( 10 )
-
-        main.step( "Start onos cli" )
-        cli1 = main.ONOS1cli.start_onos_cli( ONOS1_ip )
-
-        main.step( "Enable metrics feature" )
-        main.ONOS1cli.feature_install( "onos-app-metrics" )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=cell_file_result and cell_apply_result and
-                                 verify_cell_result and checkout_result and
-                                 pull_result and mvn_result and
-                                 install1_result,
-                                 onpass="ONOS started successfully",
-                                 onfail="Failed to start ONOS" )
-
-    def CASE2( self, main ):
-        """
-        Assign s1 to ONOS1 and measure latency
-
-        There are 4 levels of latency measurements to this test:
-        1 ) End-to-end measurement: Complete end-to-end measurement
-           from TCP ( SYN/ACK ) handshake to Graph change
-        2 ) OFP-to-graph measurement: 'ONOS processing' snippet of
-           measurement from OFP Vendor message to Graph change
-        3 ) OFP-to-device measurement: 'ONOS processing without
-           graph change' snippet of measurement from OFP vendor
-           message to Device change timestamp
-        4 ) T0-to-device measurement: Measurement that includes
-           the switch handshake to devices timestamp without
-           the graph view change. ( TCP handshake -> Device
-           change )
-        """
-        import time
-        import subprocess
-        import json
-        import requests
-        import os
-
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
-
-        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
-
-        # Number of iterations of case
-        num_iter = main.params[ 'TEST' ][ 'numIter' ]
-
-        # Timestamp 'keys' for json metrics output.
-        # These are subject to change, hence moved into params
-        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
-        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
-
-        # List of switch add latency collected from
-        # all iterations
-        latency_end_to_end_list = []
-        latency_ofp_to_graph_list = []
-        latency_ofp_to_device_list = []
-        latency_t0_to_device_list = []
-
-        # Directory/file to store tshark results
-        tshark_of_output = "/tmp/tshark_of_topo.txt"
-        tshark_tcp_output = "/tmp/tshark_tcp_topo.txt"
-
-        # String to grep in tshark output
-        tshark_tcp_string = "TCP 74 " + default_sw_port
-        tshark_of_string = "OFP 86 Vendor"
-
-        # Initialize assertion to TRUE
-        assertion = main.TRUE
-
-        main.log.report( "Latency of adding one switch" )
-
-        for i in range( 0, int( num_iter ) ):
-            main.log.info( "Starting tshark capture" )
-
-            #* TCP [ ACK, SYN ] is used as t0_a, the
-            #  very first "exchange" between ONOS and
-            #  the switch for end-to-end measurement
-            #* OFP [ Stats Reply ] is used for t0_b
-            #  the very last OFP message between ONOS
-            #  and the switch for ONOS measurement
-            main.ONOS1.tshark_grep( tshark_tcp_string,
-                                    tshark_tcp_output )
-            main.ONOS1.tshark_grep( tshark_of_string,
-                                    tshark_of_output )
-
-            # Wait and ensure tshark is started and
-            # capturing
-            time.sleep( 10 )
-
-            main.log.info( "Assigning s1 to controller" )
-
-            main.Mininet1.assign_sw_controller(
-                sw="1",
-                ip1=ONOS1_ip,
-                port1=default_sw_port )
-
-            # Wait and ensure switch is assigned
-            # before stopping tshark
-            time.sleep( 30 )
-
-            main.log.info( "Stopping all Tshark processes" )
-            main.ONOS1.stop_tshark()
-
-            # tshark output is saved in ONOS. Use subprocess
-            # to copy over files to TestON for parsing
-            main.log.info( "Copying over tshark files" )
-
-            # TCP CAPTURE ****
-            # Copy the tshark output from ONOS machine to
-            # TestON machine in tshark_tcp_output directory>file
-            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
-                       tshark_tcp_output + " /tmp/" )
-            tcp_file = open( tshark_tcp_output, 'r' )
-            temp_text = tcp_file.readline()
-            temp_text = temp_text.split( " " )
-
-            main.log.info( "Object read in from TCP capture: " +
-                           str( temp_text ) )
-            if len( temp_text ) > 1:
-                t0_tcp = float( temp_text[ 1 ] ) * 1000.0
-            else:
-                main.log.error( "Tshark output file for TCP" +
-                                " returned unexpected results" )
-                t0_tcp = 0
-                assertion = main.FALSE
-
-            tcp_file.close()
-            #****************
-
-            # OF CAPTURE ****
-            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
-                       tshark_of_output + " /tmp/" )
-            of_file = open( tshark_of_output, 'r' )
-
-            line_ofp = ""
-            # Read until last line of file
-            while True:
-                temp_text = of_file.readline()
-                if temp_text != '':
-                    line_ofp = temp_text
-                else:
-                    break
-            obj = line_ofp.split( " " )
-
-            main.log.info( "Object read in from OFP capture: " +
-                           str( line_ofp ) )
-
-            if len( line_ofp ) > 1:
-                t0_ofp = float( obj[ 1 ] ) * 1000.0
-            else:
-                main.log.error( "Tshark output file for OFP" +
-                                " returned unexpected results" )
-                t0_ofp = 0
-                assertion = main.FALSE
-
-            of_file.close()
-            #****************
-
-            json_str_1 = main.ONOS1cli.topology_events_metrics()
-
-            json_obj_1 = json.loads( json_str_1 )
-
-            # Obtain graph timestamp. This timestsamp captures
-            # the epoch time at which the topology graph was updated.
-            graph_timestamp_1 = \
-                json_obj_1[ graphTimestamp ][ 'value' ]
-
-            # Obtain device timestamp. This timestamp captures
-            # the epoch time at which the device event happened
-            device_timestamp_1 = \
-                json_obj_1[ deviceTimestamp ][ 'value' ]
-
-            # t0 to device processing latency
-            delta_device_1 = int( device_timestamp_1 ) - int( t0_tcp )
-
-            # Get average of delta from all instances
-            avg_delta_device = ( int( delta_device_1 ) )
-
-            # Ensure avg delta meets the threshold before appending
-            if avg_delta_device > 0.0 and avg_delta_device < 10000:
-                latency_t0_to_device_list.append( avg_delta_device )
-            else:
-                main.log.info( "Results for t0-to-device ignored" +
-                               "due to excess in threshold" )
-
-            # t0 to graph processing latency ( end-to-end )
-            delta_graph_1 = int( graph_timestamp_1 ) - int( t0_tcp )
-
-            # Get average of delta from all instances
-            avg_delta_graph = int( delta_graph_1 )
-
-            # Ensure avg delta meets the threshold before appending
-            if avg_delta_graph > 0.0 and avg_delta_graph < 10000:
-                latency_end_to_end_list.append( avg_delta_graph )
-            else:
-                main.log.info( "Results for end-to-end ignored" +
-                               "due to excess in threshold" )
-
-            # ofp to graph processing latency ( ONOS processing )
-            delta_ofp_graph_1 = int( graph_timestamp_1 ) - int( t0_ofp )
-
-            avg_delta_ofp_graph = int( delta_ofp_graph_1 )
-
-            if avg_delta_ofp_graph > 0.0 and avg_delta_ofp_graph < 10000:
-                latency_ofp_to_graph_list.append( avg_delta_ofp_graph )
-            else:
-                main.log.info( "Results for ofp-to-graph " +
-                               "ignored due to excess in threshold" )
-
-            # ofp to device processing latency ( ONOS processing )
-            delta_ofp_device_1 = float( device_timestamp_1 ) - float( t0_ofp )
-
-            avg_delta_ofp_device = float( delta_ofp_device_1 )
-
-            # NOTE: ofp - delta measurements are occasionally negative
-            #      due to system time misalignment.
-            latency_ofp_to_device_list.append( avg_delta_ofp_device )
-
-            # TODO:
-            # Fetch logs upon threshold excess
-
-            main.log.info( "ONOS1 delta end-to-end: " +
-                           str( delta_graph_1 ) + " ms" )
-
-            main.log.info( "ONOS1 delta OFP - graph: " +
-                           str( delta_ofp_graph_1 ) + " ms" )
-
-            main.log.info( "ONOS1 delta device - t0: " +
-                           str( delta_device_1 ) + " ms" )
-
-            main.step( "Remove switch from controller" )
-            main.Mininet1.delete_sw_controller( "s1" )
-
-            time.sleep( 5 )
-
-        # END of for loop iteration
-
-        # If there is at least 1 element in each list,
-        # pass the test case
-        if len( latency_end_to_end_list ) > 0 and\
-           len( latency_ofp_to_graph_list ) > 0 and\
-           len( latency_ofp_to_device_list ) > 0 and\
-           len( latency_t0_to_device_list ) > 0:
-            assertion = main.TRUE
-        elif len( latency_end_to_end_list ) == 0:
-            # The appending of 0 here is to prevent
-            # the min,max,sum functions from failing
-            # below
-            latency_end_to_end_list.append( 0 )
-            assertion = main.FALSE
-        elif len( latency_ofp_to_graph_list ) == 0:
-            latency_ofp_to_graph_list.append( 0 )
-            assertion = main.FALSE
-        elif len( latency_ofp_to_device_list ) == 0:
-            latency_ofp_to_device_list.append( 0 )
-            assertion = main.FALSE
-        elif len( latency_t0_to_device_list ) == 0:
-            latency_t0_to_device_list.append( 0 )
-            assertion = main.FALSE
-
-        # Calculate min, max, avg of latency lists
-        latency_end_to_end_max = \
-            int( max( latency_end_to_end_list ) )
-        latency_end_to_end_min = \
-            int( min( latency_end_to_end_list ) )
-        latency_end_to_end_avg = \
-            ( int( sum( latency_end_to_end_list ) ) /
-              len( latency_end_to_end_list ) )
-
-        latency_ofp_to_graph_max = \
-            int( max( latency_ofp_to_graph_list ) )
-        latency_ofp_to_graph_min = \
-            int( min( latency_ofp_to_graph_list ) )
-        latency_ofp_to_graph_avg = \
-            ( int( sum( latency_ofp_to_graph_list ) ) /
-              len( latency_ofp_to_graph_list ) )
-
-        latency_ofp_to_device_max = \
-            int( max( latency_ofp_to_device_list ) )
-        latency_ofp_to_device_min = \
-            int( min( latency_ofp_to_device_list ) )
-        latency_ofp_to_device_avg = \
-            ( int( sum( latency_ofp_to_device_list ) ) /
-              len( latency_ofp_to_device_list ) )
-
-        latency_t0_to_device_max = \
-            float( max( latency_t0_to_device_list ) )
-        latency_t0_to_device_min = \
-            float( min( latency_t0_to_device_list ) )
-        latency_t0_to_device_avg = \
-            ( float( sum( latency_t0_to_device_list ) ) /
-              len( latency_ofp_to_device_list ) )
-
-        main.log.report( "Switch add - End-to-end latency: \n" +
-                         "Min: " + str( latency_end_to_end_min ) + "\n" +
-                         "Max: " + str( latency_end_to_end_max ) + "\n" +
-                         "Avg: " + str( latency_end_to_end_avg ) )
-        main.log.report( "Switch add - OFP-to-Graph latency: \n" +
-                         "Min: " + str( latency_ofp_to_graph_min ) + "\n" +
-                         "Max: " + str( latency_ofp_to_graph_max ) + "\n" +
-                         "Avg: " + str( latency_ofp_to_graph_avg ) )
-        main.log.report( "Switch add - t0-to-Device latency: \n" +
-                         "Min: " + str( latency_t0_to_device_min ) + "\n" +
-                         "Max: " + str( latency_t0_to_device_max ) + "\n" +
-                         "Avg: " + str( latency_t0_to_device_avg ) )
-
-        utilities.assert_equals( expect=main.TRUE, actual=assertion,
-                                 onpass="Switch latency test successful",
-                                 onfail="Switch latency test failed" )
-
-    def CASE3( self, main ):
-        """
-        Bring port up / down and measure latency.
-        Port enable / disable is simulated by ifconfig up / down
-
-        In ONOS-next, we must ensure that the port we are
-        manipulating is connected to another switch with a valid
-        connection. Otherwise, graph view will not be updated.
-        """
-        import time
-        import subprocess
-        import os
-        import requests
-        import json
-
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
-
-        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
-
-        assertion = main.TRUE
-        # Number of iterations of case
-        num_iter = main.params[ 'TEST' ][ 'numIter' ]
-
-        # Timestamp 'keys' for json metrics output.
-        # These are subject to change, hence moved into params
-        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
-        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
-
-        # NOTE: Some hardcoded variables you may need to configure
-        #      besides the params
-
-        tshark_port_status = "OFP 130 Port Status"
-
-        tshark_port_up = "/tmp/tshark_port_up.txt"
-        tshark_port_down = "/tmp/tshark_port_down.txt"
-        interface_config = "s1-eth1"
-
-        main.log.report( "Port enable / disable latency" )
-
-        main.step( "Assign switches s1 and s2 to controller 1" )
-        main.Mininet1.assign_sw_controller( sw="1", ip1=ONOS1_ip,
-                                            port1=default_sw_port )
-        main.Mininet1.assign_sw_controller( sw="2", ip1=ONOS1_ip,
-                                            port1=default_sw_port )
-
-        # Give enough time for metrics to propagate the
-        # assign controller event. Otherwise, these events may
-        # carry over to our measurements
-        time.sleep( 10 )
-
-        main.step( "Verify switch is assigned correctly" )
-        result_s1 = main.Mininet1.get_sw_controller( sw="s1" )
-        result_s2 = main.Mininet1.get_sw_controller( sw="s2" )
-        if result_s1 == main.FALSE or result_s2 == main.FALSE:
-            main.log.info( "Switch s1 was not assigned correctly" )
-            assertion = main.FALSE
-        else:
-            main.log.info( "Switch s1 was assigned correctly" )
-
-        port_up_device_to_ofp_list = []
-        port_up_graph_to_ofp_list = []
-        port_down_device_to_ofp_list = []
-        port_down_graph_to_ofp_list = []
-
-        for i in range( 0, int( num_iter ) ):
-            main.step( "Starting wireshark capture for port status down" )
-            main.ONOS1.tshark_grep( tshark_port_status,
-                                    tshark_port_down )
-
-            time.sleep( 10 )
-
-            # Disable interface that is connected to switch 2
-            main.step( "Disable port: " + interface_config )
-            main.Mininet2.handle.sendline( "sudo ifconfig " +
-                                           interface_config + " down" )
-            main.Mininet2.handle.expect( "\$" )
-            time.sleep( 10 )
-
-            main.ONOS1.tshark_stop()
-            time.sleep( 5 )
-
-            # Copy tshark output file from ONOS to TestON instance
-            #/tmp directory
-            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
-                       tshark_port_down + " /tmp/" )
-
-            f_port_down = open( tshark_port_down, 'r' )
-            # Get first line of port down event from tshark
-            f_line = f_port_down.readline()
-            obj_down = f_line.split( " " )
-            if len( f_line ) > 0:
-                timestamp_begin_pt_down = int( float( obj_down[ 1 ] ) ) * 1000
-                main.log.info( "Port down begin timestamp: " +
-                               str( timestamp_begin_pt_down ) )
-            else:
-                main.log.info( "Tshark output file returned unexpected" +
-                               " results: " + str( obj_down ) )
-                timestamp_begin_pt_down = 0
-
-            f_port_down.close()
-
-            main.log.info( "TEST tshark obj: " + str( obj_down ) )
-
-            main.step( "Obtain t1 by REST call" )
-            json_str_1 = main.ONOS1cli.topology_events_metrics()
-
-            main.log.info( "TEST json_str 1: " + str( json_str_1 ) )
-
-            json_obj_1 = json.loads( json_str_1 )
-
-            time.sleep( 5 )
-
-            # Obtain graph timestamp. This timestsamp captures
-            # the epoch time at which the topology graph was updated.
-            graph_timestamp_1 = \
-                json_obj_1[ graphTimestamp ][ 'value' ]
-
-            # Obtain device timestamp. This timestamp captures
-            # the epoch time at which the device event happened
-            device_timestamp_1 = \
-                json_obj_1[ deviceTimestamp ][ 'value' ]
-
-            # Get delta between graph event and OFP
-            pt_down_graph_to_ofp_1 = int( graph_timestamp_1 ) -\
-                int( timestamp_begin_pt_down )
-
-            # Get delta between device event and OFP
-            pt_down_device_to_ofp_1 = int( device_timestamp_1 ) -\
-                int( timestamp_begin_pt_down )
-
-            # Caluclate average across clusters
-            pt_down_graph_to_ofp_avg = int( pt_down_graph_to_ofp_1 )
-            pt_down_device_to_ofp_avg = int( pt_down_device_to_ofp_1 )
-
-            if pt_down_graph_to_ofp_avg > 0.0 and \
-                    pt_down_graph_to_ofp_avg < 1000:
-                port_down_graph_to_ofp_list.append(
-                    pt_down_graph_to_ofp_avg )
-                main.log.info( "Port down: graph to ofp avg: " +
-                               str( pt_down_graph_to_ofp_avg ) + " ms" )
-            else:
-                main.log.info( "Average port down graph-to-ofp result" +
-                               " exceeded the threshold: " +
-                               str( pt_down_graph_to_ofp_avg ) )
-
-            if pt_down_device_to_ofp_avg > 0 and \
-                    pt_down_device_to_ofp_avg < 1000:
-                port_down_device_to_ofp_list.append(
-                    pt_down_device_to_ofp_avg )
-                main.log.info( "Port down: device to ofp avg: " +
-                               str( pt_down_device_to_ofp_avg ) + " ms" )
-            else:
-                main.log.info( "Average port down device-to-ofp result" +
-                               " exceeded the threshold: " +
-                               str( pt_down_device_to_ofp_avg ) )
-
-            # Port up events
-            main.step( "Enable port and obtain timestamp" )
-            main.step( "Starting wireshark capture for port status up" )
-            main.ONOS1.tshark_grep( "OFP 130 Port Status", tshark_port_up )
-            time.sleep( 5 )
-
-            main.Mininet2.handle.sendline( "sudo ifconfig " +
-                                           interface_config + " up" )
-            main.Mininet2.handle.expect( "\$" )
-            time.sleep( 10 )
-
-            main.ONOS1.tshark_stop()
-
-            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
-                       tshark_port_up + " /tmp/" )
-
-            f_port_up = open( tshark_port_up, 'r' )
-            f_line = f_port_up.readline()
-            obj_up = f_line.split( " " )
-            if len( f_line ) > 0:
-                timestamp_begin_pt_up = int( float( obj_up[ 1 ] ) ) * 1000
-                main.log.info( "Port up begin timestamp: " +
-                               str( timestamp_begin_pt_up ) )
-            else:
-                main.log.info( "Tshark output file returned unexpected" +
-                               " results." )
-                timestamp_begin_pt_up = 0
-
-            f_port_up.close()
-
-            main.step( "Obtain t1 by REST call" )
-            json_str_1 = main.ONOS1cli.topology_events_metrics()
-
-            json_obj_1 = json.loads( json_str_1 )
-
-            # Obtain graph timestamp. This timestsamp captures
-            # the epoch time at which the topology graph was updated.
-            graph_timestamp_1 = \
-                json_obj_1[ graphTimestamp ][ 'value' ]
-
-            # Obtain device timestamp. This timestamp captures
-            # the epoch time at which the device event happened
-            device_timestamp_1 = \
-                json_obj_1[ deviceTimestamp ][ 'value' ]
-
-            # Get delta between graph event and OFP
-            pt_up_graph_to_ofp_1 = int( graph_timestamp_1 ) -\
-                int( timestamp_begin_pt_up )
-
-            # Get delta between device event and OFP
-            pt_up_device_to_ofp_1 = int( device_timestamp_1 ) -\
-                int( timestamp_begin_pt_up )
-
-            pt_up_graph_to_ofp_avg = float( pt_up_graph_to_ofp_1 )
-
-            pt_up_device_to_ofp_avg = float( pt_up_device_to_ofp_1 )
-
-            if pt_up_graph_to_ofp_avg > 0 and \
-                    pt_up_graph_to_ofp_avg < 1000:
-                port_up_graph_to_ofp_list.append(
-                    pt_up_graph_to_ofp_avg )
-                main.log.info( "Port down: graph to ofp avg: " +
-                               str( pt_up_graph_to_ofp_avg ) + " ms" )
-            else:
-                main.log.info( "Average port up graph-to-ofp result" +
-                               " exceeded the threshold: " +
-                               str( pt_up_graph_to_ofp_avg ) )
-
-            if pt_up_device_to_ofp_avg > 0 and \
-                    pt_up_device_to_ofp_avg < 1000:
-                port_up_device_to_ofp_list.append(
-                    pt_up_device_to_ofp_avg )
-                main.log.info( "Port up: device to ofp avg: " +
-                               str( pt_up_device_to_ofp_avg ) + " ms" )
-            else:
-                main.log.info( "Average port up device-to-ofp result" +
-                               " exceeded the threshold: " +
-                               str( pt_up_device_to_ofp_avg ) )
-
-            # END ITERATION FOR LOOP
-
-        # Check all list for latency existence and set assertion
-        if ( port_down_graph_to_ofp_list and port_down_device_to_ofp_list
-                and port_up_graph_to_ofp_list and port_up_device_to_ofp_list ):
-            assertion = main.TRUE
-
-        # Calculate and report latency measurements
-        port_down_graph_to_ofp_min = min( port_down_graph_to_ofp_list )
-        port_down_graph_to_ofp_max = max( port_down_graph_to_ofp_list )
-        port_down_graph_to_ofp_avg = \
-            ( sum( port_down_graph_to_ofp_list ) /
-              len( port_down_graph_to_ofp_list ) )
-
-        main.log.report( "Port down graph-to-ofp Min: " +
-                         str( port_down_graph_to_ofp_min ) + " ms  Max: " +
-                         str( port_down_graph_to_ofp_max ) + " ms  Avg: " +
-                         str( port_down_graph_to_ofp_avg ) )
-
-        port_down_device_to_ofp_min = min( port_down_device_to_ofp_list )
-        port_down_device_to_ofp_max = max( port_down_device_to_ofp_list )
-        port_down_device_to_ofp_avg = \
-            ( sum( port_down_device_to_ofp_list ) /
-              len( port_down_device_to_ofp_list ) )
-
-        main.log.report( "Port down device-to-ofp Min: " +
-                         str( port_down_device_to_ofp_min ) + " ms  Max: " +
-                         str( port_down_device_to_ofp_max ) + " ms  Avg: " +
-                         str( port_down_device_to_ofp_avg ) )
-
-        port_up_graph_to_ofp_min = min( port_up_graph_to_ofp_list )
-        port_up_graph_to_ofp_max = max( port_up_graph_to_ofp_list )
-        port_up_graph_to_ofp_avg = \
-            ( sum( port_up_graph_to_ofp_list ) /
-              len( port_up_graph_to_ofp_list ) )
-
-        main.log.report( "Port up graph-to-ofp Min: " +
-                         str( port_up_graph_to_ofp_min ) + " ms  Max: " +
-                         str( port_up_graph_to_ofp_max ) + " ms  Avg: " +
-                         str( port_up_graph_to_ofp_avg ) )
-
-        port_up_device_to_ofp_min = min( port_up_device_to_ofp_list )
-        port_up_device_to_ofp_max = max( port_up_device_to_ofp_list )
-        port_up_device_to_ofp_avg = \
-            ( sum( port_up_device_to_ofp_list ) /
-              len( port_up_device_to_ofp_list ) )
-
-        main.log.report( "Port up device-to-ofp Min: " +
-                         str( port_up_device_to_ofp_min ) + " ms  Max: " +
-                         str( port_up_device_to_ofp_max ) + " ms  Avg: " +
-                         str( port_up_device_to_ofp_avg ) )
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=assertion,
-            onpass="Port discovery latency calculation successful",
-            onfail="Port discovery test failed" )
-
-    def CASE4( self, main ):
-        """
-        Link down event using loss rate 100%
-
-        Important:
-            Use a simple 2 switch topology with 1 link between
-            the two switches. Ensure that mac addresses of the
-            switches are 1 / 2 respectively
-        """
-        import time
-        import subprocess
-        import os
-        import requests
-        import json
-
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
-
-        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
-
-        # Number of iterations of case
-        num_iter = main.params[ 'TEST' ][ 'numIter' ]
-
-        # Timestamp 'keys' for json metrics output.
-        # These are subject to change, hence moved into params
-        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
-        linkTimestamp = main.params[ 'JSON' ][ 'linkTimestamp' ]
-        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
-
-        assertion = main.TRUE
-        # Link event timestamp to system time list
-        link_down_link_to_system_list = []
-        link_up_link_to_system_list = []
-        # Graph event timestamp to system time list
-        link_down_graph_to_system_list = []
-        link_up_graph_to_system_list = []
-
-        main.log.report( "Add / remove link latency between " +
-                         "two switches" )
-
-        main.step( "Assign all switches" )
-        main.Mininet1.assign_sw_controller(
-            sw="1",
-            ip1=ONOS1_ip,
-            port1=default_sw_port )
-        main.Mininet1.assign_sw_controller(
-            sw="2",
-            ip1=ONOS1_ip,
-            port1=default_sw_port )
-
-        main.step( "Verifying switch assignment" )
-        result_s1 = main.Mininet1.get_sw_controller( sw="s1" )
-        result_s2 = main.Mininet1.get_sw_controller( sw="s2" )
-
-        # Allow time for events to finish before taking measurements
-        time.sleep( 10 )
-
-        link_down = False
-        # Start iteration of link event test
-        for i in range( 0, int( num_iter ) ):
-            main.step( "Getting initial system time as t0" )
-
-            timestamp_link_down_t0 = time.time() * 1000
-            # Link down is simulated by 100% loss rate using traffic
-            # control command
-            main.Mininet1.handle.sendline(
-                "sh tc qdisc add dev s1-eth1 root netem loss 100%" )
-
-            # TODO: Iterate through 'links' command to verify that
-            #      link s1 -> s2 went down ( loop timeout 30 seconds )
-            #      on all 3 ONOS instances
-            main.log.info( "Checking ONOS for link update" )
-            loop_count = 0
-            while( not link_down and loop_count < 30 ):
-                json_str = main.ONOS1cli.links()
-
-                if not json_str:
-                    main.log.error( "CLI command returned error " )
-                    break
-                else:
-                    json_obj = json.loads( json_str )
-                for obj in json_obj:
-                    if '01' not in obj[ 'src' ][ 'device' ]:
-                        link_down = True
-                        main.log.report( "Link down from " +
-                                         "s1 -> s2 on ONOS1 detected" )
-                loop_count += 1
-                # If CLI doesn't like the continuous requests
-                # and exits in this loop, increase the sleep here.
-                # Consequently, while loop timeout will increase
-                time.sleep( 1 )
-
-            # Give time for metrics measurement to catch up
-            # NOTE: May need to be configured more accurately
-            time.sleep( 10 )
-            # If we exited the while loop and link down 1,2,3 are still
-            # false, then ONOS has failed to discover link down event
-            if not link_down:
-                main.log.info( "Link down discovery failed" )
-
-                link_down_lat_graph1 = 0
-                link_down_lat_device1 = 0
-                assertion = main.FALSE
-            else:
-                json_topo_metrics_1 =\
-                    main.ONOS1cli.topology_events_metrics()
-                json_topo_metrics_1 = json.loads( json_topo_metrics_1 )
-
-                main.log.info( "Obtaining graph and device timestamp" )
-                graph_timestamp_1 = \
-                    json_topo_metrics_1[ graphTimestamp ][ 'value' ]
-
-                link_timestamp_1 = \
-                    json_topo_metrics_1[ linkTimestamp ][ 'value' ]
-
-                if graph_timestamp_1 and link_timestamp_1:
-                    link_down_lat_graph1 = int( graph_timestamp_1 ) -\
-                        timestamp_link_down_t0
-
-                    link_down_lat_link1 = int( link_timestamp_1 ) -\
-                        timestamp_link_down_t0
-                else:
-                    main.log.error( "There was an error calculating" +
-                                    " the delta for link down event" )
-                    link_down_lat_graph1 = 0
-
-                    link_down_lat_device1 = 0
-
-            main.log.report( "Link down latency ONOS1 iteration " +
-                             str( i ) + " (end-to-end): " +
-                             str( link_down_lat_graph1 ) + " ms" )
-
-            main.log.report( "Link down latency ONOS1 iteration " +
-                             str( i ) + " (link-event-to-system-timestamp): " +
-                             str( link_down_lat_link1 ) + " ms" )
-
-            # Calculate avg of node calculations
-            link_down_lat_graph_avg = link_down_lat_graph1
-            link_down_lat_link_avg = link_down_lat_link1
-
-            # Set threshold and append latency to list
-            if link_down_lat_graph_avg > 0.0 and\
-               link_down_lat_graph_avg < 30000:
-                link_down_graph_to_system_list.append(
-                    link_down_lat_graph_avg )
-            else:
-                main.log.info( "Link down latency exceeded threshold" )
-                main.log.info( "Results for iteration " + str( i ) +
-                               "have been omitted" )
-            if link_down_lat_link_avg > 0.0 and\
-               link_down_lat_link_avg < 30000:
-                link_down_link_to_system_list.append(
-                    link_down_lat_link_avg )
-            else:
-                main.log.info( "Link down latency exceeded threshold" )
-                main.log.info( "Results for iteration " + str( i ) +
-                               "have been omitted" )
-
-            # NOTE: To remove loss rate and measure latency:
-            #       'sh tc qdisc del dev s1-eth1 root'
-            timestamp_link_up_t0 = time.time() * 1000
-            main.Mininet1.handle.sendline( "sh tc qdisc del dev " +
-                                           "s1-eth1 root" )
-            main.Mininet1.handle.expect( "mininet>" )
-
-            main.log.info( "Checking ONOS for link update" )
-
-            link_down1 = True
-            loop_count = 0
-            while( link_down1 and loop_count < 30 ):
-                json_str1 = main.ONOS1cli.links()
-                if not json_str1:
-                    main.log.error( "CLI command returned error " )
-                    break
-                else:
-                    json_obj1 = json.loads( json_str1 )
-
-                for obj1 in json_obj1:
-                    if '01' in obj1[ 'src' ][ 'device' ]:
-                        link_down1 = False
-                        main.log.report( "Link up from " +
-                                         "s1 -> s2 on ONOS1 detected" )
-                loop_count += 1
-                time.sleep( 1 )
-
-            if link_down1:
-                main.log.info( "Link up discovery failed" )
-                link_up_lat_graph1 = 0
-                link_up_lat_device1 = 0
-                assertion = main.FALSE
-            else:
-                json_topo_metrics_1 =\
-                    main.ONOS1cli.topology_events_metrics()
-                json_topo_metrics_1 = json.loads( json_topo_metrics_1 )
-
-                main.log.info( "Obtaining graph and device timestamp" )
-                graph_timestamp_1 = \
-                    json_topo_metrics_1[ graphTimestamp ][ 'value' ]
-
-                link_timestamp_1 = \
-                    json_topo_metrics_1[ linkTimestamp ][ 'value' ]
-
-                if graph_timestamp_1 and link_timestamp_1:
-                    link_up_lat_graph1 = int( graph_timestamp_1 ) -\
-                        timestamp_link_up_t0
-                    link_up_lat_link1 = int( link_timestamp_1 ) -\
-                        timestamp_link_up_t0
-                else:
-                    main.log.error( "There was an error calculating" +
-                                    " the delta for link down event" )
-                    link_up_lat_graph1 = 0
-                    link_up_lat_device1 = 0
-
-            main.log.info( "Link up latency ONOS1 iteration " +
-                           str( i ) + " (end-to-end): " +
-                           str( link_up_lat_graph1 ) + " ms" )
-
-            main.log.info( "Link up latency ONOS1 iteration " +
-                           str( i ) + " (link-event-to-system-timestamp): " +
-                           str( link_up_lat_link1 ) + " ms" )
-
-            # Calculate avg of node calculations
-            link_up_lat_graph_avg = link_up_lat_graph1
-            link_up_lat_link_avg = link_up_lat_link1
-
-            # Set threshold and append latency to list
-            if link_up_lat_graph_avg > 0.0 and\
-               link_up_lat_graph_avg < 30000:
-                link_up_graph_to_system_list.append(
-                    link_up_lat_graph_avg )
-            else:
-                main.log.info( "Link up latency exceeded threshold" )
-                main.log.info( "Results for iteration " + str( i ) +
-                               "have been omitted" )
-            if link_up_lat_link_avg > 0.0 and\
-               link_up_lat_link_avg < 30000:
-                link_up_link_to_system_list.append(
-                    link_up_lat_link_avg )
-            else:
-                main.log.info( "Link up latency exceeded threshold" )
-                main.log.info( "Results for iteration " + str( i ) +
-                               "have been omitted" )
-
-        # Calculate min, max, avg of list and report
-        link_down_min = min( link_down_graph_to_system_list )
-        link_down_max = max( link_down_graph_to_system_list )
-        link_down_avg = sum( link_down_graph_to_system_list ) / \
-            len( link_down_graph_to_system_list )
-        link_up_min = min( link_up_graph_to_system_list )
-        link_up_max = max( link_up_graph_to_system_list )
-        link_up_avg = sum( link_up_graph_to_system_list ) / \
-            len( link_up_graph_to_system_list )
-
-        main.log.report( "Link down latency - Min: " +
-                         str( link_down_min ) + "ms  Max: " +
-                         str( link_down_max ) + "ms  Avg: " +
-                         str( link_down_avg ) + "ms" )
-        main.log.report( "Link up latency - Min: " +
-                         str( link_up_min ) + "ms  Max: " +
-                         str( link_up_max ) + "ms  Avg: " +
-                         str( link_up_avg ) + "ms" )
-
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=assertion,
-            onpass="Link discovery latency calculation successful",
-            onfail="Link discovery latency case failed" )
-
-    def CASE5( self, main ):
-        """
-        100 Switch discovery latency
-
-        Important:
-            This test case can be potentially dangerous if
-            your machine has previously set iptables rules.
-            One of the steps of the test case will flush
-            all existing iptables rules.
-        Note:
-            You can specify the number of switches in the
-            params file to adjust the switch discovery size
-            ( and specify the corresponding topology in Mininet1
-            .topo file )
-        """
-        import time
-        import subprocess
-        import os
-        import requests
-        import json
-
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
-        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
-        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
-
-        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
-
-        # Number of iterations of case
-        num_iter = main.params[ 'TEST' ][ 'numIter' ]
-        num_sw = main.params[ 'TEST' ][ 'numSwitch' ]
-
-        # Timestamp 'keys' for json metrics output.
-        # These are subject to change, hence moved into params
-        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
-        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
-
-        tshark_ofp_output = "/tmp/tshark_ofp_" + num_sw + "sw.txt"
-        tshark_tcp_output = "/tmp/tshark_tcp_" + num_sw + "sw.txt"
-
-        tshark_ofp_result_list = []
-        tshark_tcp_result_list = []
-
-        main.case( num_sw + " Switch discovery latency" )
-        main.step( "Assigning all switches to ONOS1" )
-        for i in range( 1, int( num_sw ) + 1 ):
-            main.Mininet1.assign_sw_controller(
-                sw=str( i ),
-                ip1=ONOS1_ip,
-                port1=default_sw_port )
-
-        # Ensure that nodes are configured with ptpd
-        # Just a warning message
-        main.log.info( "Please check ptpd configuration to ensure" +
-                       " All nodes' system times are in sync" )
-        time.sleep( 5 )
-
-        for i in range( 0, int( num_iter ) ):
-
-            main.step( "Set iptables rule to block incoming sw connections" )
-            # Set iptables rule to block incoming switch connections
-            # The rule description is as follows:
-            #   Append to INPUT rule,
-            #   behavior DROP that matches following:
-            #       * packet type: tcp
-            #       * source IP: MN1_ip
-            #       * destination PORT: 6633
-            main.ONOS1.handle.sendline(
-                "sudo iptables -A INPUT -p tcp -s " + MN1_ip +
-                " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS1.handle.expect( "\$" )
-            #   Append to OUTPUT rule,
-            #   behavior DROP that matches following:
-            #       * packet type: tcp
-            #       * source IP: MN1_ip
-            #       * destination PORT: 6633
-            main.ONOS1.handle.sendline(
-                "sudo iptables -A OUTPUT -p tcp -s " + MN1_ip +
-                " --dport " + default_sw_port + " -j DROP" )
-            main.ONOS1.handle.expect( "\$" )
-            # Give time to allow rule to take effect
-            # NOTE: Sleep period may need to be configured
-            #      based on the number of switches in the topology
-            main.log.info( "Please wait for switch connection to " +
-                           "time out" )
-            time.sleep( 60 )
-
-            # Gather vendor OFP with tshark
-            main.ONOS1.tshark_grep( "OFP 86 Vendor",
-                                    tshark_ofp_output )
-            main.ONOS1.tshark_grep( "TCP 74 ",
-                                    tshark_tcp_output )
-
-            # NOTE: Remove all iptables rule quickly ( flush )
-            #      Before removal, obtain TestON timestamp at which
-            #      removal took place
-            #      ( ensuring nodes are configured via ptp )
-            #      sudo iptables -F
-
-            t0_system = time.time() * 1000
-            main.ONOS1.handle.sendline(
-                "sudo iptables -F" )
-
-            # Counter to track loop count
-            counter_loop = 0
-            counter_avail1 = 0
-            onos1_dev = False
-            while counter_loop < 60:
-                # Continue to check devices for all device
-                # availability. When all devices in all 3
-                # ONOS instances indicate that devices are available
-                # obtain graph event timestamp for t1.
-                device_str_obj1 = main.ONOS1cli.devices()
-                device_json1 = json.loads( device_str_obj1 )
-
-                for device1 in device_json1:
-                    if device1[ 'available' ]:
-                        counter_avail1 += 1
-                        if counter_avail1 == int( num_sw ):
-                            onos1_dev = True
-                            main.log.info( "All devices have been " +
-                                           "discovered on ONOS1" )
-                    else:
-                        counter_avail1 = 0
-
-                if onos1_dev:
-                    main.log.info( "All devices have been discovered " +
-                                   "on all ONOS instances" )
-                    json_str_topology_metrics_1 =\
-                        main.ONOS1cli.topology_events_metrics()
-                    # Exit while loop if all devices discovered
-                    break
-
-                counter_loop += 1
-                # Give some time in between CLI calls
-                #( will not affect measurement )
-                time.sleep( 3 )
-
-            main.ONOS1.tshark_stop()
-
-            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
-                       tshark_ofp_output + " /tmp/" )
-            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
-                       tshark_tcp_output + " /tmp/" )
-            ofp_file = open( tshark_ofp_output, 'r' )
-
-            # The following is for information purpose only.
-            # TODO: Automate OFP output analysis
-            main.log.info( "Tshark OFP Vendor output: " )
-            for line in ofp_file:
-                tshark_ofp_result_list.append( line )
-                main.log.info( line )
-
-            ofp_file.close()
-
-            tcp_file = open( tshark_tcp_output, 'r' )
-            main.log.info( "Tshark TCP 74 output: " )
-            for line in tcp_file:
-                tshark_tcp_result_list.append( line )
-                main.log.info( line )
-
-            tcp_file.close()
-
-            json_obj_1 = json.loads( json_str_topology_metrics_1 )
-
-            graph_timestamp_1 = \
-                json_obj_1[ graphTimestamp ][ 'value' ]
-
-            main.log.info(
-                int( graph_timestamp_1 ) - int( t0_system ) )
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo
deleted file mode 100644
index 3fc7bdc..0000000
--- a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo
+++ /dev/null
@@ -1,55 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-        
-        <ONOSbench>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOSbench>
-
-        <ONOS1cli>
-            <host>10.128.174.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1cli>
-        
-        <ONOS1>
-            <host>10.128.174.1</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <Mininet1>
-            <host>10.128.10.90</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-                <arg1> --custom topo-100sw.py </arg1>
-                <arg2> --arp --mac --topo mytopo</arg2>
-                <arg3> </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.10.90</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/TopoPerfNextSingleNode/__init__.py b/TestON/tests/TopoPerfNextSingleNode/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/TopoPerfNextSingleNode/__init__.py
+++ /dev/null
diff --git a/TestON/tests/prevFuncNext/FuncNext.params b/TestON/tests/prevFuncNext/FuncNext.params
deleted file mode 100755
index 13a4691..0000000
--- a/TestON/tests/prevFuncNext/FuncNext.params
+++ /dev/null
@@ -1,37 +0,0 @@
-<PARAMS>
-    
-    <testcases>1,4,5,3</testcases>
-
-    #Environment variables
-    <ENV>
-        <cellName>driver_test</cellName>
-    </ENV>
-
-    <CTRL>
-        <ip1>10.128.20.11</ip1>
-        <port1>6633</port1>
-    </CTRL>
-
-    <PING>
-        <source1>h8</source1>
-        <source2>h9</source2>
-        <source3>h10</source3>
-        <source4>h11</source4>
-        <source5>h12</source5>
-        <source6>h13</source6>
-        <source7>h14</source7>
-        <source8>h15</source8>
-        <source9>h16</source9>
-        <source10>h17</source10>
-        <target1>10.0.0.18</target1>
-        <target2>10.0.0.19</target2>
-        <target3>10.0.0.20</target3>
-        <target4>10.0.0.21</target4>
-        <target5>10.0.0.22</target5>
-        <target6>10.0.0.23</target6>
-        <target7>10.0.0.24</target7>
-        <target8>10.0.0.25</target8>
-        <target9>10.0.0.26</target9>
-        <target10>10.0.0.27</target10>
-    </PING>
-</PARAMS>
diff --git a/TestON/tests/prevFuncNext/FuncNext.py b/TestON/tests/prevFuncNext/FuncNext.py
deleted file mode 100755
index e556fa4..0000000
--- a/TestON/tests/prevFuncNext/FuncNext.py
+++ /dev/null
@@ -1,311 +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 time
-
-time.sleep(1)
-class FuncNext:
-    def __init__(self):
-        self.default = ''
-
-    def CASE1(self, main):
-        '''
-        Startup sequence:
-        git pull
-        mvn clean install
-        onos-package
-        cell <name>
-        onos-verify-cell
-        onos-install -f
-        onos-wait-for-start
-        '''
-        
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS1_port = main.params['CTRL']['port1']
-        
-        main.case("Setting up test environment")
-        
-        main.step("Git checkout and pull master and get version")
-        main.ONOSbench.git_checkout("master")
-        git_pull_result = main.ONOSbench.git_pull()
-        version_result = main.ONOSbench.get_version()
-
-        main.step("Using mvn clean & install")
-        #clean_install_result = main.ONOSbench.clean_install()
-        #clean_install_result = main.TRUE
-
-        main.step("Applying cell variable to environment")
-        cell_result = main.ONOSbench.set_cell(cell_name)
-        verify_result = main.ONOSbench.verify_cell()
-        cell_result = main.ONOS2.set_cell(cell_name)
-        #verify_result = main.ONOS2.verify_cell()
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-        
-        main.step("Creating ONOS package")
-        package_result = main.ONOSbench.onos_package()
-
-        #main.step("Creating a cell")
-        #cell_create_result = main.ONOSbench.create_cell_file(**************)
-
-        main.step("Installing ONOS package")
-        onos_install_result = main.ONOSbench.onos_install()
-        onos1_isup = main.ONOSbench.isup()
-   
-        main.step("Starting ONOS service")
-        start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
-        case1_result = (package_result and\
-                cell_result and verify_result and onos_install_result and\
-                onos1_isup and start_result )
-        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
-                onpass="Test startup successful",
-                onfail="Test startup NOT successful")
-
-    def CASE11(self, main):
-        '''
-        Cleanup sequence:
-        onos-service <node_ip> stop
-        onos-uninstall
-
-        TODO: Define rest of cleanup
-        
-        '''
-
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Cleaning up test environment")
-
-        main.step("Testing ONOS kill function")
-        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
-
-        main.step("Stopping ONOS service")
-        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
-
-        main.step("Uninstalling ONOS service") 
-        uninstall_result = main.ONOSbench.onos_uninstall()
-
-    def CASE3(self, main):
-        '''
-        Test 'onos' command and its functionality in driver
-        '''
-        
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Testing 'onos' command")
-
-        main.step("Sending command 'onos -w <onos-ip> system:name'")
-        cmdstr1 = "system:name"
-        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
-        main.log.info("onos command returned: "+cmd_result1)
-
-        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
-        cmdstr2 = "onos:topology"
-        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
-        main.log.info("onos command returned: "+cmd_result2)
-
-
-
-    def CASE4(self, main):
-        import re
-        import time
-        main.case("Pingall Test")
-        main.step("Assigning switches to controllers")
-        for i in range(1,29):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-        Switch_Mastership = main.TRUE
-        for i in range (1,29):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-
-        if Switch_Mastership == main.TRUE:
-            main.log.report("MasterControllers assigned correctly")
-        utilities.assert_equals(expect = main.TRUE,actual=Switch_Mastership,
-                onpass="MasterControllers assigned correctly")
-        '''
-        for i in range (1,29):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=5,
-                    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)
-        '''
-        #REACTIVE FWD test
-
-        main.step("Get list of hosts from Mininet")
-        host_list = main.Mininet1.get_hosts()
-        main.log.info(host_list)
-
-        main.step("Get host list in ONOS format")
-        host_onos_list = main.ONOS2.get_hosts_id(host_list)
-        main.log.info(host_onos_list)
-        #time.sleep(5)
-
-        #We must use ping from hosts we want to add intents from 
-        #to make the hosts talk
-        #main.Mininet2.handle.sendline("\r")
-        #main.Mininet2.handle.sendline("h4 ping 10.1.1.1 -c 1 -W 1")
-        #time.sleep(3)
-        #main.Mininet2.handle.sendline("h5 ping 10.1.1.1 -c 1 -W 1")
-        #time.sleep(5)
-        
-        main.step("Pingall")
-        ping_result = main.FALSE
-        while ping_result == main.FALSE:
-            time1 = time.time()
-            ping_result = 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.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-
-        main.step("Get hosts")
-        main.ONOS2.handle.sendline("hosts")
-        main.ONOS2.handle.expect("onos>")
-        hosts = main.ONOS2.handle.before
-        main.log.info(hosts)
-
-        main.step("Get all devices id")
-        devices_id_list = main.ONOS2.get_all_devices_id()
-        main.log.info(devices_id_list)
-        '''
-        main.step("Add point-to-point intents")
-        ptp_intent_result = main.ONOS2.add_point_intent(
-            devices_id_list[0], 1, devices_id_list[1], 2)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-        '''
-
-        case4_result = Switch_Mastership and ping_result
-        utilities.assert_equals(expect=main.TRUE, actual=case4_result,
-                onpass="Pingall Test successful",
-                onfail="Pingall Test NOT successful")
-
-    def CASE5(self,main) :
-        import time
-        from subprocess import Popen, PIPE
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        #main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-        deviceResult = main.ONOS2.devices()
-        linksResult = main.ONOS2.links()
-        portsResult = main.ONOS2.ports()
-        print "**************"
-        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
-
-        Topology_Check = main.TRUE
-        main.step("Compare ONOS Topology to MN Topology")
-        '''for n in range(1,6):
-            result = main.Mininet1.compare_topo(MNTopo,
-                    main.ONOS1.get_json(main.params['CTRL']['ip'+str(n)]+":"+ \
-                        main.params['CTRL']['restPort'+str(n)]+main.params['TopoRest']))
-            if result == main.TRUE:
-                main.log.report("ONOS"+str(n) + " Topology matches MN Topology")
-            utilities.assert_equals(expect=main.TRUE,actual=result,
-                    onpass="ONOS" + str(n) + " Topology matches MN Topology",
-                    onfail="ONOS" + str(n) + " Topology does not match MN Topology")
-            Topology_Check = Topology_Check and result
-        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
-                onpass="Topology checks passed", onfail="Topology checks failed")
-        '''
-
-
diff --git a/TestON/tests/prevFuncNext/FuncNext.topo b/TestON/tests/prevFuncNext/FuncNext.topo
deleted file mode 100755
index 5d453a6..0000000
--- a/TestON/tests/prevFuncNext/FuncNext.topo
+++ /dev/null
@@ -1,61 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOSbench>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOSbench>
-
-        <ONOS1>
-            <host>10.128.10.11</host>
-            <user>sdn</user>
-            <password>sdn</password>
-            <type>OnosDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2>
-
-        <Mininet1>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-                #Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.10.11</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-                #Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet2>
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/prevFuncNext/__init__.py b/TestON/tests/prevFuncNext/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/prevFuncNext/__init__.py
+++ /dev/null
