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/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index aa36725..158fcd8 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -19,12 +19,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:
@@ -548,7 +544,7 @@
            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 
+                (which is correct behavior since the interfaces
                 haven't moved).
         """
         if self.handle:
@@ -560,7 +556,7 @@
                 response = self.execute( cmd=cmd,
                                          prompt="mininet>",
                                          timeout=10 )
-     
+
                 # Determine hostintf and Oldswitchintf
                 cmd = "px hintf,sintf = " + host + ".connectionsTo(" + oldSw +\
                       ")[0]"
@@ -578,7 +574,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
@@ -590,20 +586,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
@@ -615,7 +611,7 @@
                 print "cmd8 = ", cmd
                 self.handle.sendline( cmd )
                 self.handle.expect( "mininet>" )
-                
+
                 cmd = "net"
                 print "cmd9 = ", cmd
                 self.handle.sendline( cmd )
@@ -628,7 +624,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" )
@@ -911,6 +907,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 +
@@ -1502,7 +1510,6 @@
                                         timeout )
                 if i == 0:
                     main.log.info( "Exiting mininet..." )
-               
                 response = self.execute(
                     cmd="exit",
                     prompt="(.*)",
@@ -1510,7 +1517,7 @@
                 main.log.info( self.name + ": Stopped")
                 self.handle.sendline( "sudo mn -c" )
                 response = main.TRUE
-                
+
                 if i == 1:
                     main.log.info( " Mininet trying to exit while not " +
                                    "in the mininet prompt" )
@@ -1519,7 +1526,7 @@
                 elif i == 3:  # timeout
                     main.log.error( "Something went wrong exiting mininet " +
                                     "TIMEOUT" )
-                
+
                 if fileName:
                     self.handle.sendline("")
                     self.handle.expect('\$')
@@ -1683,46 +1690,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 +
@@ -1732,82 +1884,38 @@
         onosDPIDs = []
         for switch in onos:
             if switch[ 'available' ]:
-                onosDPIDs.append(
-                    switch[ 'id' ].replace(
-                        ":",
-                        '' ).replace(
-                        "of",
-                        '' ).lower() )
-            # else:
-                # print "Switch is unavailable:"
-                # print switch
+                onosDPIDs.append( switch[ 'id' ].replace( ":", ''
+                                  ).replace( "of", '' ).lower() )
         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(
-                            ':',
-                            '' ).replace(
-                            "of",
-                            '' ) == mnSwitch[ 'dpid' ]:
+                    if onosSwitch[ 'device' ][ 'id' ].replace( ':',''
+                            ).replace( "of", '' ) == mnSwitch[ 'dpid' ]:
                         for port in onosSwitch[ 'ports' ]:
                             if port[ 'isEnabled' ]:
                                 if port[ 'port' ] == 'local':
@@ -1818,9 +1926,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 ]
@@ -1836,6 +1942,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
@@ -1852,62 +1959,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
@@ -1915,34 +2013,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' ]
 
@@ -1958,15 +2049,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
@@ -1980,59 +2065,41 @@
                             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() :
+                    if onosMAC == mnIntf[ 'mac' ].lower() :
                         match = True
                         for ip in mnIntf[ 'ips' ]:
                             if ip in onosHost[ 'ipAddresses' ]:
@@ -2040,8 +2107,10 @@
                             else:
                                 # misssing ip
                                 main.log.error( "ONOS host " + onosHost[ 'id' ]
-                                                + " has a different IP than " +
-                                                "the Mininet host." )
+                                                + " has a different IP(" +
+                                                str( onosHost[ 'ipAddresses' ] ) +
+                                                ") than the Mininet host(" +
+                                                str( ip ) + ")." )
                                 output = json.dumps(
                                                     onosHost,
                                                     sort_keys=True,
@@ -2060,7 +2129,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"""
diff --git a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
index 75e586f..b8598e4 100644
--- a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
@@ -963,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' ] =  \
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/FuncNext13/__init__.py b/TestON/tests/FuncNext13/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/FuncNext13/__init__.py
+++ /dev/null
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
index c08fc96..4ecc271 100644
--- a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
@@ -677,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:
@@ -1104,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
@@ -1417,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 = []
@@ -1581,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,
@@ -1597,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,
@@ -1624,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 ):
         """
@@ -2079,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"
@@ -2095,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
@@ -2125,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 = []
@@ -2208,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,
@@ -2224,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,
@@ -2252,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,
@@ -2347,10 +2328,13 @@
 
                 # 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
 
@@ -2439,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 )
@@ -2460,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,
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
index 7a21c01..a81845f 100644
--- a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
@@ -660,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:
@@ -1077,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
@@ -1390,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 = []
@@ -1554,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,
@@ -1570,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,
@@ -1597,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 ):
         """
@@ -2027,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"
@@ -2043,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
@@ -2073,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 = []
@@ -2156,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,
@@ -2172,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,
@@ -2200,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,
@@ -2211,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 = {}
@@ -2244,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
@@ -2288,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
 
@@ -2385,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 )
@@ -2406,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,
diff --git a/TestON/tests/HATestSanity/HATestSanity.py b/TestON/tests/HATestSanity/HATestSanity.py
index 83b4e51..8d952c7 100644
--- a/TestON/tests/HATestSanity/HATestSanity.py
+++ b/TestON/tests/HATestSanity/HATestSanity.py
@@ -665,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:
@@ -1082,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
@@ -1400,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 = []
@@ -1564,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,
@@ -1580,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,
@@ -1607,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 ):
         """
@@ -1979,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"
@@ -1995,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
@@ -2025,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 = []
@@ -2108,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,
@@ -2124,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,
@@ -2152,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,
@@ -2163,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 = {}
@@ -2196,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
@@ -2240,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
 
@@ -2337,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 )
@@ -2358,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,
@@ -2372,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 = []
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
index a3a8a66..4dcf0dd 100644
--- a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
@@ -472,7 +472,6 @@
                 pass  # intent submitted is in onos
             else:
                 intentAddResult = False
-        # FIXME: DEBUG
         if intentAddResult:
             intentStop = time.time()
         else:
@@ -506,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,
@@ -522,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 :
@@ -573,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:
@@ -629,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,
@@ -648,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 :
@@ -850,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,
@@ -869,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 :
@@ -945,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
@@ -1012,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() )
@@ -1064,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,
@@ -1081,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,
@@ -1110,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,
@@ -1121,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 ):
         """
@@ -1254,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,
@@ -1379,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"
@@ -1393,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
@@ -1422,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() )
@@ -1450,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,
@@ -1466,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,
@@ -1494,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,
@@ -1503,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
@@ -1521,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 ) ) + \
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/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/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
