diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index b4e7154..3b5a5c7 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1,3 +1,4 @@
+
 #!/usr/bin/env python
 """
 Created on 26-Oct-2012
@@ -1131,7 +1132,7 @@
                 return main.TRUE
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":     " + self.handle.before )
+            main.log.error(self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
 
@@ -1950,6 +1951,64 @@
             main.cleanup()
             main.exit()
 
+    def assignVLAN( self, host, intf, vlan):
+        """
+           Add vlan tag to a host.
+           Dependencies:
+               This class depends on the "vlan" package
+               $ sudo apt-get install vlan
+           Configuration:
+               Load the 8021q module into the kernel
+               $sudo modprobe 8021q
+
+               To make this setup permanent:
+               $ sudo su -c 'echo "8021q" >> /etc/modules'
+           """
+        if self.handle:
+            try:
+		# get the ip address of the host
+		main.log.info("Get the ip address of the host")
+		ipaddr = self.getIPAddress(host)
+		print repr(ipaddr)
+	
+		# remove IP from interface intf
+		# Ex: h1 ifconfig h1-eth0 inet 0
+		main.log.info("Remove IP from interface ")
+		cmd2 = host + " ifconfig " + intf + " " + " inet 0 "
+		self.handle.sendline( cmd2 )
+		self.handle.expect( "mininet>" ) 
+		response = self.handle.before
+		main.log.info ( "====> %s ", response)
+
+		
+		# create VLAN interface
+		# Ex: h1 vconfig add h1-eth0 100
+		main.log.info("Create Vlan")
+		cmd3 = host + " vconfig add " + intf + " " + vlan
+		self.handle.sendline( cmd3 )
+		self.handle.expect( "mininet>" ) 
+		response = self.handle.before
+		main.log.info( "====> %s ", response )
+
+		# assign the host's IP to the VLAN interface
+		# Ex: h1 ifconfig h1-eth0.100 inet 10.0.0.1
+		main.log.info("Assign the host IP to the vlan interface")
+		vintf = intf + "." + vlan
+		cmd4 = host + " ifconfig " + vintf + " " + " inet " + ipaddr
+		self.handle.sendline( cmd4 )
+		self.handle.expect( "mininet>" ) 
+		response = self.handle.before
+		main.log.info ( "====> %s ", response)
+
+
+                return main.TRUE
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                return main.FALSE
+
 if __name__ != "__main__":
     import sys
     sys.modules[ __name__ ] = MininetCliDriver()
+
+
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver_orig.py b/TestON/drivers/common/cli/emulator/mininetclidriver_orig.py
new file mode 100644
index 0000000..2d7c0a5
--- /dev/null
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver_orig.py
@@ -0,0 +1,1937 @@
+#!/usr/bin/env python
+"""
+Created on 26-Oct-2012
+
+author: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
+
+
+TestON is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+( at your option ) any later version.
+
+TestON is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+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:
+    git remote add jhall11 https://github.com/jhall11/mininet.git
+    git fetch jhall11
+    git checkout -b dynamic_topo remotes/jhall11/dynamic_topo
+    git pull
+
+
+    Note that you may need to run 'sudo make develop' if your mnexec.c file
+changed when switching branches."""
+import pexpect
+import re
+import sys
+sys.path.append( "../" )
+from math import pow
+from drivers.common.cli.emulatordriver import Emulator
+
+
+class MininetCliDriver( Emulator ):
+
+    """
+       MininetCliDriver is the basic driver which will handle
+       the Mininet functions"""
+    def __init__( self ):
+        super( Emulator, self ).__init__()
+        self.handle = self
+        self.name = None
+        self.wrapped = sys.modules[ __name__ ]
+        self.flag = 0
+
+    def connect( self, **connectargs ):
+        """
+           Here the main is the TestON instance after creating
+           all the log handles."""
+        try:
+            for key in connectargs:
+                vars( self )[ key ] = connectargs[ key ]
+
+            self.name = self.options[ 'name' ]
+            self.handle = super(
+                MininetCliDriver,
+                self ).connect(
+                user_name=self.user_name,
+                ip_address=self.ip_address,
+                port=None,
+                pwd=self.pwd )
+
+            if self.handle:
+                main.log.info( "Connection successful to the host " +
+                               self.user_name +
+                               "@" +
+                               self.ip_address )
+                return main.TRUE
+            else:
+                main.log.error( "Connection failed to the host " +
+                                self.user_name +
+                                "@" +
+                                self.ip_address )
+                main.log.error( "Failed to connect to the Mininet CLI" )
+                return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def startNet( self, topoFile='', args='', timeout=120 ):
+        """
+        Starts Mininet accepts a topology(.py) file and/or an optional
+        argument ,to start the mininet, as a parameter.
+        Returns main.TRUE if the mininet starts successfully and
+                main.FALSE otherwise
+        """
+        if self.handle:
+            # make sure old networks are cleaned up
+            main.log.info( self.name +
+                           ": Clearing any residual state or processes" )
+            self.handle.sendline( "sudo mn -c" )
+            i = self.handle.expect( [ 'password\sfor\s',
+                                      'Cleanup\scomplete',
+                                      pexpect.EOF,
+                                      pexpect.TIMEOUT ],
+                                    timeout )
+            if i == 0:
+                # Sudo asking for password
+                main.log.info( self.name + ": Sending sudo password" )
+                self.handle.sendline( self.pwd )
+                i = self.handle.expect( [ '%s:' % self.user,
+                                          '\$',
+                                          pexpect.EOF,
+                                          pexpect.TIMEOUT ],
+                                        timeout )
+            if i == 1:
+                main.log.info( self.name + ": Clean" )
+            elif i == 2:
+                main.log.error( self.name + ": Connection terminated" )
+            elif i == 3:  # timeout
+                main.log.error( self.name + ": Something while cleaning " +
+                                "Mininet took too long... " )
+            # Craft the string to start mininet
+            cmdString = "sudo "
+            if topoFile is None or topoFile == '':  # If no file is given
+                main.log.info( self.name + ": building fresh Mininet" )
+                cmdString += "mn "
+                if args is None or args == '':
+                    # If no args given, use args from .topo file
+                    args = self.options[ 'arg1' ] +\
+                                 " " + self.options[ 'arg2' ] +\
+                                 " --mac --controller " +\
+                                 self.options[ 'controller' ] + " " +\
+                                 self.options[ 'arg3' ]
+                else:  # else only use given args
+                    pass
+                    # TODO: allow use of topo args and method args?
+            else:  # Use given topology file
+                main.log.info( "Starting Mininet from topo file " + topoFile )
+                cmdString += topoFile + " "
+                if args is None:
+                    args = ''
+                    # TODO: allow use of args from .topo file?
+            cmdString += args
+            # Send the command and check if network started
+            self.handle.sendline( "" )
+            self.handle.expect( '\$' )
+            main.log.info( "Sending '" + cmdString + "' to " + self.name )
+            self.handle.sendline( cmdString )
+            while True:
+                i = self.handle.expect( [ 'mininet>',
+                                          'Exception',
+                                          '\*\*\*',
+                                          pexpect.EOF,
+                                          pexpect.TIMEOUT ],
+                                        timeout )
+                if i == 0:
+                    main.log.info( self.name + ": Mininet built" )
+                    return main.TRUE
+                elif i == 1:
+                    response = str( self.handle.before +
+                                    self.handle.after )
+                    self.handle.expect( '\$' )
+                    response += str( self.handle.before +
+                                    self.handle.after )
+                    main.log.error(
+                        self.name +
+                        ": Launching Mininet failed: " + response )
+                    return main.FALSE
+                elif i == 2:
+                    self.handle.expect( [ "\n",
+                                          pexpect.EOF,
+                                          pexpect.TIMEOUT ],
+                                        timeout )
+                    main.log.info( self.handle.before )
+                elif i == 3:
+                    main.log.error( self.name + ": Connection timeout" )
+                    return main.FALSE
+                elif i == 4:  # timeout
+                    main.log.error(
+                        self.name +
+                        ": Something took too long... " )
+                    return main.FALSE
+            # Why did we hit this part?
+            main.log.error( "startNet did not return correctly" )
+            return main.FASLE
+        else:  # if no handle
+            main.log.error( self.name + ": Connection failed to the host " +
+                            self.user_name + "@" + self.ip_address )
+            main.log.error( self.name + ": Failed to connect to the Mininet" )
+            return main.FALSE
+
+    def numSwitchesNlinks( self, topoType, depth, fanout ):
+        if topoType == 'tree':
+            # In tree topology, if fanout arg is not given, by default it is 2
+            if fanout is None:
+                fanout = 2
+            k = 0
+            count = 0
+            while( k <= depth - 1 ):
+                count = count + pow( fanout, k )
+                k = k + 1
+                numSwitches = count
+            while( k <= depth - 2 ):
+                # depth-2 gives you only core links and not considering
+                # edge links as seen by ONOS. If all the links including
+                # edge links are required, do depth-1
+                count = count + pow( fanout, k )
+                k = k + 1
+            numLinks = count * fanout
+            # print "num_switches for %s(%d,%d) = %d and links=%d" %(
+            # topoType,depth,fanout,numSwitches,numLinks )
+
+        elif topoType == 'linear':
+            # In linear topology, if fanout or numHostsPerSw is not given,
+            # by default it is 1
+            if fanout is None:
+                fanout = 1
+            numSwitches = depth
+            numHostsPerSw = fanout
+            totalNumHosts = numSwitches * numHostsPerSw
+            numLinks = totalNumHosts + ( numSwitches - 1 )
+            print "num_switches for %s(%d,%d) = %d and links=%d" %\
+                ( topoType, depth, fanout, numSwitches, numLinks )
+        topoDict = { "num_switches": int( numSwitches ),
+                     "num_corelinks": int( numLinks ) }
+        return topoDict
+
+    def calculateSwAndLinks( self ):
+        """
+            Calculate the number of switches and links in a topo."""
+        # TODO: combine this function and numSwitchesNlinks
+        argList = self.options[ 'arg1' ].split( "," )
+        topoArgList = argList[ 0 ].split( " " )
+        argList = map( int, argList[ 1: ] )
+        topoArgList = topoArgList[ 1: ] + argList
+
+        topoDict = self.numSwitchesNlinks( *topoArgList )
+        return topoDict
+
+    def pingall( self, timeout=300, shortCircuit=False, acceptableFailed=0):
+        """
+           Verifies the reachability of the hosts using pingall command.
+           Optional parameter timeout allows you to specify how long to
+           wait for pingall to complete
+           Optional:
+           timeout(seconds) - This is the pexpect timeout; The function will
+                              timeout if the amount of time between failed
+                              pings exceedes this time and pingall is still
+                              running
+           shortCircuit - Break the pingall based on the number of failed hosts
+                          ping
+           acceptableFailed - Set the number of acceptable failed pings for the
+                              function to still return main.TRUE
+           Returns:
+           main.TRUE if pingall completes with no pings dropped
+           otherwise main.FALSE"""
+        try:
+            if self.handle:
+                main.log.info(
+                    self.name +
+                    ": Checking reachabilty to the hosts using pingall" )
+                response = ""
+                failedPings = 0
+                returnValue = main.TRUE
+                self.handle.sendline( "pingall" )
+                while True:
+                    i = self.handle.expect( [ "mininet>","X",
+                                              pexpect.EOF,
+                                              pexpect.TIMEOUT ],
+                                              timeout )
+                    if i == 0:
+                        main.log.info( self.name + ": pingall finished")
+                        response += self.handle.before
+                        break
+                    elif i == 1:
+                        response += self.handle.before + self.handle.after
+                        failedPings = failedPings + 1
+                        if failedPings > acceptableFailed:
+                            returnValue = main.FALSE
+                            if shortCircuit:
+                                main.log.error( self.name +
+                                                ": Aborting pingall - "
+                                                + str( failedPings ) +
+                                                " pings failed" )
+                                break
+                    elif i == 2:
+                        main.log.error( self.name +
+                                        ": EOF exception found" )
+                        main.log.error( self.name + ":     " +
+                                        self.handle.before )
+                        main.cleanup()
+                        main.exit()
+                    elif i == 3:
+                        response += self.handle.before
+                        main.log.error( self.name +
+                                        ": TIMEOUT exception found" )
+                        main.log.error( self.name +
+                                        ":     " +
+                                        str( response ) )
+                        # NOTE: Send ctrl-c to make sure pingall is done
+                        self.handle.sendline( "\x03" )
+                        self.handle.expect( "Interrupt" )
+                        self.handle.expect( "mininet>" )
+                        break
+                pattern = "Results\:"
+                main.log.info( "Pingall output: " + str( response ) )
+                if re.search( pattern, response ):
+                    main.log.info( self.name + ": Pingall finished with "
+                                   + str( failedPings ) + " failed pings" )
+                    return returnValue
+                else:
+                    # NOTE: Send ctrl-c to make sure pingall is done
+                    self.handle.sendline( "\x03" )
+                    self.handle.expect( "Interrupt" )
+                    self.handle.expect( "mininet>" )
+                    return main.FALSE
+            else:
+                main.log.error( self.name + ": Connection failed to the host" )
+                main.cleanup()
+                main.exit()
+        except pexpect.TIMEOUT:
+            if response:
+                main.log.info( "Pingall output: " + str( response ) )
+            main.log.error( self.name + ": pexpect.TIMEOUT found" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+    def fpingHost( self, **pingParams ):
+        """
+           Uses the fping package for faster pinging...
+           *requires fping to be installed on machine running mininet"""
+        args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
+        command = args[ "SRC" ] + \
+            " fping -i 100 -t 20 -C 1 -q " + args[ "TARGET" ]
+        self.handle.sendline( command )
+        self.handle.expect(
+            [ args[ "TARGET" ], pexpect.EOF, pexpect.TIMEOUT ] )
+        self.handle.expect( [ "mininet", pexpect.EOF, pexpect.TIMEOUT ] )
+        response = self.handle.before
+        if re.search( ":\s-", response ):
+            main.log.info( self.name + ": Ping fail" )
+            return main.FALSE
+        elif re.search( ":\s\d{1,2}\.\d\d", response ):
+            main.log.info( self.name + ": Ping good!" )
+            return main.TRUE
+        main.log.info( self.name + ": Install fping on mininet machine... " )
+        main.log.info( self.name + ": \n---\n" + response )
+        return main.FALSE
+
+    def pingHost( self, **pingParams ):
+        """
+           Ping from one mininet host to another
+           Currently the only supported Params: SRC and TARGET"""
+        args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
+        command = args[ "SRC" ] + " ping " + \
+            args[ "TARGET" ] + " -c 1 -i 1 -W 8"
+        try:
+            main.log.info( "Sending: " + command )
+            self.handle.sendline( command )
+            i = self.handle.expect( [ command, pexpect.TIMEOUT ] )
+            if i == 1:
+                main.log.error(
+                    self.name +
+                    ": timeout when waiting for response from mininet" )
+                main.log.error( "response: " + str( self.handle.before ) )
+            i = self.handle.expect( [ "mininet>", pexpect.TIMEOUT ] )
+            if i == 1:
+                main.log.error(
+                    self.name +
+                    ": timeout when waiting for response from mininet" )
+                main.log.error( "response: " + str( self.handle.before ) )
+            response = self.handle.before
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        main.log.info( self.name + ": Ping Response: " + response )
+        if re.search( ',\s0\%\spacket\sloss', response ):
+            main.log.info( self.name + ": no packets lost, host is reachable" )
+            main.lastResult = main.TRUE
+            return main.TRUE
+        else:
+            main.log.error(
+                self.name +
+                ": PACKET LOST, HOST IS NOT REACHABLE" )
+            main.lastResult = main.FALSE
+            return main.FALSE
+
+    def checkIP( self, host ):
+        """
+           Verifies the host's ip configured or not."""
+        if self.handle:
+            try:
+                response = self.execute(
+                    cmd=host +
+                    " ifconfig",
+                    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()
+
+            pattern = "inet\s(addr|Mask):([0-1]{1}[0-9]{1,2}|" +\
+                "2[0-4][0-9]|25[0-5]|[0-9]{1,2}).([0-1]{1}" +\
+                "[0-9]{1,2}|2[0-4][0-9]|25[0-5]|[0-9]{1,2})." +\
+                "([0-1]{1}[0-9]{1,2}|2[0-4][0-9]|25[0-5]|" +\
+                "[0-9]{1,2}).([0-1]{1}[0-9]{1,2}|2[0-4]" +\
+                "[0-9]|25[0-5]|[0-9]{1,2})"
+            # pattern = "inet addr:10.0.0.6"
+            if re.search( pattern, response ):
+                main.log.info( self.name + ": Host Ip configured properly" )
+                return main.TRUE
+            else:
+                main.log.error( self.name + ": Host IP not found" )
+                return main.FALSE
+        else:
+            main.log.error( self.name + ": Connection failed to the host" )
+
+    def verifySSH( self, **connectargs ):
+        # FIXME: Who uses this and what is the purpose? seems very specific
+        try:
+            response = self.execute(
+                cmd="h1 /usr/sbin/sshd -D&",
+                prompt="mininet>",
+                timeout=10 )
+            response = self.execute(
+                cmd="h4 /usr/sbin/sshd -D&",
+                prompt="mininet>",
+                timeout=10 )
+            for key in connectargs:
+                vars( self )[ key ] = connectargs[ key ]
+            response = self.execute(
+                cmd="xterm h1 h4 ",
+                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()
+        import time
+        time.sleep( 20 )
+        if self.flag == 0:
+            self.flag = 1
+            return main.FALSE
+        else:
+            return main.TRUE
+
+    def moveHost( self, host, oldSw, newSw, ):
+        """
+           Moves a host from one switch to another on the fly
+           Note: The intf between host and oldSw when detached
+                using detach(), will still show up in the 'net'
+                cmd, because switch.detach() doesn't affect switch.intfs[]
+                (which is correct behavior since the interfaces 
+                haven't moved).
+        """
+        if self.handle:
+            try:
+                # Bring link between oldSw-host down
+                cmd = "py net.configLinkStatus('" + oldSw + "'," + "'"+ host +\
+                      "'," + "'down')"
+                print "cmd1= ", cmd
+                response = self.execute( cmd=cmd,
+                                         prompt="mininet>",
+                                         timeout=10 )
+     
+                # Determine hostintf and Oldswitchintf
+                cmd = "px hintf,sintf = " + host + ".connectionsTo(" + oldSw +\
+                      ")[0]"
+                print "cmd2= ", cmd
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+
+                # Determine ip and mac address of the host-oldSw interface
+                cmd = "px ipaddr = hintf.IP()"
+                print "cmd3= ", cmd
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+
+                cmd = "px macaddr = hintf.MAC()"
+                print "cmd3= ", cmd
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                
+                # Detach interface between oldSw-host
+                cmd = "px " + oldSw + ".detach( sintf )"
+                print "cmd4= ", cmd
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+
+                # Add link between host-newSw
+                cmd = "py net.addLink(" + host + "," + newSw + ")"
+                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>" )                 
+
+                # 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
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+
+                # Set macaddress of the host-newSw interface
+                cmd = "px " + host + ".setMAC( mac = macaddr, intf = hintf)"
+                print "cmd8 = ", cmd
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                
+                cmd = "net"
+                print "cmd9 = ", cmd
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                print "output = ", self.handle.before
+
+                # Determine ipaddress of the host-newSw interface
+                cmd = host + " ifconfig"
+                print "cmd10= ", cmd
+                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" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                return main.FALSE
+
+    def changeIP( self, host, intf, newIP, newNetmask ):
+        """
+           Changes the ip address of a host on the fly
+           Ex: h2 ifconfig h2-eth0 10.0.1.2 netmask 255.255.255.0"""
+        if self.handle:
+            try:
+                cmd = host + " ifconfig " + intf + " " + \
+                    newIP + " " + 'netmask' + " " + newNetmask
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( "response = " + response )
+                main.log.info(
+                    "Ip of host " +
+                    host +
+                    " changed to new IP " +
+                    newIP )
+                return main.TRUE
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                return main.FALSE
+
+    def changeDefaultGateway( self, host, newGW ):
+        """
+           Changes the default gateway of a host
+           Ex: h1 route add default gw 10.0.1.2"""
+        if self.handle:
+            try:
+                cmd = host + " route add default gw " + newGW
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( "response = " + response )
+                main.log.info(
+                    "Default gateway of host " +
+                    host +
+                    " changed to " +
+                    newGW )
+                return main.TRUE
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                return main.FALSE
+
+    def addStaticMACAddress( self, host, GW, macaddr ):
+        """
+           Changes the mac address of a gateway host"""
+        if self.handle:
+            try:
+                # h1  arp -s 10.0.1.254 00:00:00:00:11:11
+                cmd = host + " arp -s " + GW + " " + macaddr
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( "response = " + response )
+                main.log.info(
+                    "Mac address of gateway " +
+                    GW +
+                    " changed to " +
+                    macaddr )
+                return main.TRUE
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                return main.FALSE
+
+    def verifyStaticGWandMAC( self, host ):
+        """
+           Verify if the static gateway and mac address assignment"""
+        if self.handle:
+            try:
+                # h1  arp -an
+                cmd = host + " arp -an "
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( host + " arp -an = " + response )
+                return main.TRUE
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                return main.FALSE
+
+    def getMacAddress( self, host ):
+        """
+           Verifies the host's ip configured or not."""
+        if self.handle:
+            try:
+                response = self.execute(
+                    cmd=host +
+                    " ifconfig",
+                    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()
+
+            pattern = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
+            macAddressSearch = re.search( pattern, response, re.I )
+            macAddress = macAddressSearch.group().split( " " )[ 1 ]
+            main.log.info(
+                self.name +
+                ": Mac-Address of Host " +
+                host +
+                " is " +
+                macAddress )
+            return macAddress
+        else:
+            main.log.error( self.name + ": Connection failed to the host" )
+
+    def getInterfaceMACAddress( self, host, interface ):
+        """
+           Return the IP address of the interface on the given host"""
+        if self.handle:
+            try:
+                response = self.execute( cmd=host + " ifconfig " + interface,
+                                         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()
+
+            pattern = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
+            macAddressSearch = re.search( pattern, response, re.I )
+            if macAddressSearch is None:
+                main.log.info( "No mac address found in %s" % response )
+                return main.FALSE
+            macAddress = macAddressSearch.group().split( " " )[ 1 ]
+            main.log.info(
+                "Mac-Address of " +
+                host +
+                ":" +
+                interface +
+                " is " +
+                macAddress )
+            return macAddress
+        else:
+            main.log.error( "Connection failed to the host" )
+
+    def getIPAddress( self, host ):
+        """
+           Verifies the host's ip configured or not."""
+        if self.handle:
+            try:
+                response = self.execute(
+                    cmd=host +
+                    " ifconfig",
+                    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()
+
+            pattern = "inet\saddr:(\d+\.\d+\.\d+\.\d+)"
+            ipAddressSearch = re.search( pattern, response )
+            main.log.info(
+                self.name +
+                ": IP-Address of Host " +
+                host +
+                " is " +
+                ipAddressSearch.group( 1 ) )
+            return ipAddressSearch.group( 1 )
+        else:
+            main.log.error( self.name + ": Connection failed to the host" )
+
+    def getSwitchDPID( self, switch ):
+        """
+           return the datapath ID of the switch"""
+        if self.handle:
+            cmd = "py %s.dpid" % switch
+            try:
+                response = self.execute(
+                    cmd=cmd,
+                    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()
+            pattern = r'^(?P<dpid>\w)+'
+            result = re.search( pattern, response, re.MULTILINE )
+            if result is None:
+                main.log.info(
+                    "Couldn't find DPID for switch %s, found: %s" %
+                    ( switch, response ) )
+                return main.FALSE
+            return str( result.group( 0 ) ).lower()
+        else:
+            main.log.error( "Connection failed to the host" )
+
+    def getDPID( self, switch ):
+        if self.handle:
+            self.handle.sendline( "" )
+            self.expect( "mininet>" )
+            cmd = "py %s.dpid" % switch
+            try:
+                response = self.execute(
+                    cmd=cmd,
+                    prompt="mininet>",
+                    timeout=10 )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                return response
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                main.cleanup()
+                main.exit()
+
+    def getInterfaces( self, node ):
+        """
+           return information dict about interfaces connected to the node"""
+        if self.handle:
+            cmd = 'py "\\n".join(["name=%s,mac=%s,ip=%s,enabled=%s"' +\
+                ' % (i.name, i.MAC(), i.IP(), i.isUp())'
+            cmd += ' for i in %s.intfs.values()])' % node
+            try:
+                response = self.execute(
+                    cmd=cmd,
+                    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
+        else:
+            main.log.error( "Connection failed to the node" )
+
+    def dump( self ):
+        main.log.info( self.name + ": Dump node info" )
+        try:
+            response = self.execute(
+                cmd='dump',
+                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 intfs( self ):
+        main.log.info( self.name + ": List interfaces" )
+        try:
+            response = self.execute(
+                cmd='intfs',
+                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 net( self ):
+        main.log.info( self.name + ": List network connections" )
+        try:
+            response = self.execute( cmd='net', 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 +
+            ": Simple iperf TCP test between two hosts" )
+        try:
+            cmd1 = 'iperf ' + host1 + " " + host2
+            self.handle.sendline( cmd1 )
+            self.handle.expect( "mininet>" )
+            response = self.handle.before
+            if re.search( 'Results:', response ):
+                main.log.info( self.name + ": iperf test successful" )
+                return main.TRUE
+            else:
+                main.log.error( self.name + ": iperf test failed" )
+                return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+    def iperfudp( self ):
+        main.log.info(
+            self.name +
+            ": Simple iperf TCP test between two " +
+            "(optionally specified) hosts" )
+        try:
+            response = self.execute(
+                cmd='iperfudp',
+                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 nodes( self ):
+        main.log.info( self.name + ": List all nodes." )
+        try:
+            response = self.execute(
+                cmd='nodes',
+                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 pingpair( self ):
+        main.log.info( self.name + ": Ping between first two hosts" )
+        try:
+            response = self.execute(
+                cmd='pingpair',
+                prompt='mininet>',
+                timeout=20 )
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+        if re.search( ',\s0\%\spacket\sloss', response ):
+            main.log.info( self.name + ": Ping between two hosts SUCCESSFUL" )
+            main.lastResult = main.TRUE
+            return main.TRUE
+        else:
+            main.log.error( self.name + ": PACKET LOST, HOSTS NOT REACHABLE" )
+            main.lastResult = main.FALSE
+            return main.FALSE
+
+    def link( self, **linkargs ):
+        """
+           Bring link( s ) between two nodes up or down"""
+        args = utilities.parse_args( [ "END1", "END2", "OPTION" ], **linkargs )
+        end1 = args[ "END1" ] if args[ "END1" ] is not None else ""
+        end2 = args[ "END2" ] if args[ "END2" ] is not None else ""
+        option = args[ "OPTION" ] if args[ "OPTION" ] is not None else ""
+        main.log.info(
+            "Bring link between '" +
+            end1 +
+            "' and '" +
+            end2 +
+            "' '" +
+            option +
+            "'" )
+        command = "link " + \
+            str( end1 ) + " " + str( end2 ) + " " + str( option )
+        try:
+            self.handle.sendline( command )
+            self.handle.expect( "mininet>" )
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        return main.TRUE
+
+    def yank( self, **yankargs ):
+        """
+           yank a mininet switch interface to a host"""
+        main.log.info( 'Yank the switch interface attached to a host' )
+        args = utilities.parse_args( [ "SW", "INTF" ], **yankargs )
+        sw = args[ "SW" ] if args[ "SW" ] is not None else ""
+        intf = args[ "INTF" ] if args[ "INTF" ] is not None else ""
+        command = "py " + str( sw ) + '.detach("' + str(intf) + '")'
+        try:
+            response = self.execute(
+                cmd=command,
+                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 main.TRUE
+
+    def plug( self, **plugargs ):
+        """
+           plug the yanked mininet switch interface to a switch"""
+        main.log.info( 'Plug the switch interface attached to a switch' )
+        args = utilities.parse_args( [ "SW", "INTF" ], **plugargs )
+        sw = args[ "SW" ] if args[ "SW" ] is not None else ""
+        intf = args[ "INTF" ] if args[ "INTF" ] is not None else ""
+        command = "py " + str( sw ) + '.attach("' + str(intf) + '")'
+        try:
+            response = self.execute(
+                cmd=command,
+                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 main.TRUE
+
+    def dpctl( self, **dpctlargs ):
+        """
+           Run dpctl command on all switches."""
+        main.log.info( 'Run dpctl command on all switches' )
+        args = utilities.parse_args( [ "CMD", "ARGS" ], **dpctlargs )
+        cmd = args[ "CMD" ] if args[ "CMD" ] is not None else ""
+        cmdargs = args[ "ARGS" ] if args[ "ARGS" ] is not None else ""
+        command = "dpctl " + cmd + " " + str( cmdargs )
+        try:
+            response = self.execute(
+                cmd=command,
+                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 main.TRUE
+
+    def getVersion( self ):
+        #FIXME: What uses this? This should be refactored to get
+        #       version from MN and not some other file
+        fileInput = path + '/lib/Mininet/INSTALL'
+        version = super( Mininet, self ).getVersion()
+        pattern = 'Mininet\s\w\.\w\.\w\w*'
+        for line in open( fileInput, 'r' ).readlines():
+            result = re.match( pattern, line )
+            if result:
+                version = result.group( 0 )
+        return version
+
+    def getSwController( self, sw ):
+        """
+        Parameters:
+            sw: The name of an OVS switch. Example "s1"
+        Return:
+            The output of the command from the mininet cli
+            or main.FALSE on timeout"""
+        command = "sh ovs-vsctl get-controller " + str( sw )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if response:
+                return response
+            else:
+                return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+    def assignSwController( self, **kwargs ):
+        """
+           count is only needed if there is more than 1 controller"""
+        args = utilities.parse_args( [ "COUNT" ], **kwargs )
+        count = args[ "COUNT" ] if args != {} else 1
+
+        argstring = "SW"
+        for j in range( count ):
+            argstring = argstring + ",IP" + \
+                str( j + 1 ) + ",PORT" + str( j + 1 )
+        args = utilities.parse_args( argstring.split( "," ), **kwargs )
+
+        sw = args[ "SW" ] if args[ "SW" ] is not None else ""
+        ptcpA = int( args[ "PORT1" ] ) + \
+            int( sw ) if args[ "PORT1" ] is not None else ""
+        ptcpB = "ptcp:" + str( ptcpA ) if ptcpA != "" else ""
+
+        command = "sh ovs-vsctl set-controller s" + \
+            str( sw ) + " " + ptcpB + " "
+        for j in range( count ):
+            i = j + 1
+            args = utilities.parse_args(
+                [ "IP" + str( i ), "PORT" + str( i ) ], **kwargs )
+            ip = args[
+                "IP" +
+                str( i ) ] if args[
+                "IP" +
+                str( i ) ] is not None else ""
+            port = args[
+                "PORT" +
+                str( i ) ] if args[
+                "PORT" +
+                str( i ) ] is not None else ""
+            tcp = "tcp:" + str( ip ) + ":" + str( port ) + \
+                " " if ip != "" else ""
+            command = command + tcp
+        try:
+            self.execute( cmd=command, prompt="mininet>", timeout=5 )
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def deleteSwController( self, sw ):
+        """
+           Removes the controller target from sw"""
+        command = "sh ovs-vsctl del-controller " + str( sw )
+        try:
+            response = self.execute(
+                cmd=command,
+                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()
+        else:
+            main.log.info( response )
+
+    def addSwitch( self, sw, **kwargs ):
+        """
+        adds a switch to the mininet topology
+        NOTE: This uses a custom mn function. MN repo should be on
+            dynamic_topo branch
+        NOTE: cannot currently specify what type of switch
+        required params:
+            sw = name of the new switch as a string
+        optional keywords:
+            dpid = "dpid"
+        returns: main.FALSE on an error, else main.TRUE
+        """
+        dpid = kwargs.get( 'dpid', '' )
+        command = "addswitch " + str( sw ) + " " + str( dpid )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "already exists!", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                return main.TRUE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+    def delSwitch( self, sw ):
+        """
+        delete a switch from the mininet topology
+        NOTE: This uses a custom mn function. MN repo should be on
+            dynamic_topo branch
+        required params:
+            sw = name of the switch as a string
+        returns: main.FALSE on an error, else main.TRUE"""
+        command = "delswitch " + str( sw )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "no switch named", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                return main.TRUE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+    def addLink( self, node1, node2 ):
+        """
+           add a link to the mininet topology
+           NOTE: This uses a custom mn function. MN repo should be on
+                dynamic_topo branch
+           NOTE: cannot currently specify what type of link
+           required params:
+           node1 = the string node name of the first endpoint of the link
+           node2 = the string node name of the second endpoint of the link
+           returns: main.FALSE on an error, else main.TRUE"""
+        command = "addlink " + str( node1 ) + " " + str( node2 )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "doesnt exist!", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                return main.TRUE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+    def delLink( self, node1, node2 ):
+        """
+           delete a link from the mininet topology
+           NOTE: This uses a custom mn function. MN repo should be on
+                dynamic_topo branch
+           required params:
+           node1 = the string node name of the first endpoint of the link
+           node2 = the string node name of the second endpoint of the link
+           returns: main.FALSE on an error, else main.TRUE"""
+        command = "dellink " + str( node1 ) + " " + str( node2 )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "no node named", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                return main.TRUE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+    def addHost( self, hostname, **kwargs ):
+        """
+        Add a host to the mininet topology
+        NOTE: This uses a custom mn function. MN repo should be on
+            dynamic_topo branch
+        NOTE: cannot currently specify what type of host
+        required params:
+            hostname = the string hostname
+        optional key-value params
+            switch = "switch name"
+            returns: main.FALSE on an error, else main.TRUE
+        """
+        switch = kwargs.get( 'switch', '' )
+        command = "addhost " + str( hostname ) + " " + str( switch )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "already exists!", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "doesnt exists!", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                return main.TRUE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+    def delHost( self, hostname ):
+        """
+           delete a host from the mininet topology
+           NOTE: This uses a custom mn function. MN repo should be on
+               dynamic_topo branch
+           NOTE: this uses a custom mn function
+           required params:
+           hostname = the string hostname
+           returns: main.FALSE on an error, else main.TRUE"""
+        command = "delhost " + str( hostname )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "no host named", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                return main.TRUE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+    def disconnect( self ):
+        """
+        Called at the end of the test to stop the mininet and
+        disconnect the handle.
+        """
+        self.handle.sendline('')
+        i = self.handle.expect( [ 'mininet>', pexpect.EOF, pexpect.TIMEOUT ],
+                                timeout=2)
+        if i == 0:
+            self.stopNet()
+        elif i == 1:
+            return main.TRUE
+        response = main.TRUE
+        # print "Disconnecting Mininet"
+        if self.handle:
+            self.handle.sendline( "exit" )
+            self.handle.expect( "exit" )
+            self.handle.expect( "(.*)" )
+        else:
+            main.log.error( "Connection failed to the host" )
+        return response
+
+    def stopNet( self, fileName = "", timeout=5):
+        """
+        Stops mininet.
+        Returns main.TRUE if the mininet successfully stops and
+                main.FALSE if the pexpect handle does not exist.
+
+        Will cleanup and exit the test if mininet fails to stop
+        """
+
+        main.log.info( self.name + ": Stopping mininet..." )
+        response = ''
+        if self.handle:
+            try:
+                self.handle.sendline("")
+                i = self.handle.expect( [ 'mininet>',
+                                          '\$',
+                                          pexpect.EOF,
+                                          pexpect.TIMEOUT ],
+                                        timeout )
+                if i == 0:
+                    main.log.info( "Exiting mininet..." )
+               
+                response = self.execute(
+                    cmd="exit",
+                    prompt="(.*)",
+                    timeout=120 )
+                main.log.info( self.name + ": Stopped")
+                self.handle.sendline( "sudo mn -c" )
+                response = main.TRUE
+                
+                if i == 1:
+                    main.log.info( " Mininet trying to exit while not " +
+                                   "in the mininet prompt" )
+                elif i == 2:
+                    main.log.error( "Something went wrong exiting mininet" )
+                elif i == 3:  # timeout
+                    main.log.error( "Something went wrong exiting mininet " +
+                                    "TIMEOUT" )
+                
+                if fileName:
+                    self.handle.sendline("")
+                    self.handle.expect('\$')
+                    self.handle.sendline("sudo kill -9 \`ps -ef | grep \""+ fileName +"\" | grep -v grep | awk '{print $2}'\`")
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                main.cleanup()
+                main.exit()
+        else:
+            main.log.error( self.name + ": Connection failed to the host" )
+            response = main.FALSE
+        return response
+
+    def arping( self, src, dest, destmac ):
+        self.handle.sendline( '' )
+        self.handle.expect( [ "mininet", pexpect.EOF, pexpect.TIMEOUT ] )
+
+        self.handle.sendline( src + ' arping ' + dest )
+        try:
+            self.handle.expect( [ destmac, pexpect.EOF, pexpect.TIMEOUT ] )
+            main.log.info( self.name + ": ARP successful" )
+            self.handle.expect( [ "mininet", pexpect.EOF, pexpect.TIMEOUT ] )
+            return main.TRUE
+        except Exception:
+            main.log.warn( self.name + ": ARP FAILURE" )
+            self.handle.expect( [ "mininet", pexpect.EOF, pexpect.TIMEOUT ] )
+            return main.FALSE
+
+    def decToHex( self, num ):
+        return hex( num ).split( 'x' )[ 1 ]
+
+    def getSwitchFlowCount( self, switch ):
+        """
+           return the Flow Count of the switch"""
+        if self.handle:
+            cmd = "sh ovs-ofctl dump-aggregate %s" % switch
+            try:
+                response = self.execute(
+                    cmd=cmd,
+                    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()
+            pattern = "flow_count=(\d+)"
+            result = re.search( pattern, response, re.MULTILINE )
+            if result is None:
+                main.log.info(
+                    "Couldn't find flows on switch %s, found: %s" %
+                    ( switch, response ) )
+                return main.FALSE
+            return result.group( 1 )
+        else:
+            main.log.error( "Connection failed to the Mininet host" )
+
+    def checkFlows( self, sw, dumpFormat=None ):
+        if dumpFormat:
+            command = "sh ovs-ofctl -F " + \
+                dumpFormat + " dump-flows " + str( sw )
+        else:
+            command = "sh ovs-ofctl dump-flows " + str( sw )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            return response
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+    def startTcpdump( self, filename, intf="eth0", port="port 6633" ):
+        """
+           Runs tpdump on an interface and saves the file
+           intf can be specified, or the default eth0 is used"""
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
+            self.handle.sendline(
+                "sh sudo tcpdump -n -i " +
+                intf +
+                " " +
+                port +
+                " -w " +
+                filename.strip() +
+                "  &" )
+            self.handle.sendline( "" )
+            i = self.handle.expect( [ 'No\ssuch\device',
+                                      'listening\son',
+                                      pexpect.TIMEOUT,
+                                      "mininet>" ],
+                                    timeout=10 )
+            main.log.warn( self.handle.before + self.handle.after )
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
+            if i == 0:
+                main.log.error(
+                    self.name +
+                    ": tcpdump - No such device exists. " +
+                    "tcpdump attempted on: " +
+                    intf )
+                return main.FALSE
+            elif i == 1:
+                main.log.info( self.name + ": tcpdump started on " + intf )
+                return main.TRUE
+            elif i == 2:
+                main.log.error(
+                    self.name +
+                    ": tcpdump command timed out! Check interface name," +
+                    " given interface was: " +
+                    intf )
+                return main.FALSE
+            elif i == 3:
+                main.log.info( self.name + ": " + self.handle.before )
+                return main.TRUE
+            else:
+                main.log.error( self.name + ": tcpdump - unexpected response" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def stopTcpdump( self ):
+        """
+            pkills tcpdump"""
+        try:
+            self.handle.sendline( "sh sudo pkill tcpdump" )
+            self.handle.expect( "mininet>" )
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def compareSwitches( self, topo, switchesJson ):
+        """
+           Compare mn and onos switches
+           topo: sts TestONTopology object
+            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=( ',', ': ' ) )
+
+        # created sorted list of dpid's in MN and ONOS for comparison
+        mnDPIDs = []
+        for switch in output[ 'switches' ]:
+            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 +
+                ".compare_switches(): Empty JSON object given from ONOS" )
+            return main.FALSE
+        onos = switchesJson
+        onosDPIDs = []
+        for switch in onos:
+            if switch[ 'available' ]:
+                onosDPIDs.append(
+                    switch[ 'id' ].replace(
+                        ":",
+                        '' ).replace(
+                        "of",
+                        '' ).lower() )
+            # else:
+                # print "Switch is unavailable:"
+                # print switch
+        onosDPIDs.sort()
+        # print "List of ONOS switch DPID's"
+        # print onosDPIDs
+
+        if mnDPIDs != onosDPIDs:
+            switchResults = main.FALSE
+            main.log.report( "Switches in MN but not in ONOS:" )
+            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:" )
+            list2 = [ switch for switch in onosDPIDs if switch not in mnDPIDs ]
+            main.log.report( str( list2 ) )
+        else:  # list of dpid's match in onos and mn
+            switchResults = main.TRUE
+        return 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' ]:
+            mnPorts = []
+            onosPorts = []
+            switchResult = main.TRUE
+            for port in mnSwitch[ 'ports' ]:
+                if port[ 'enabled' ]:
+                    mnPorts.append( 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' ]:
+                        for port in onosSwitch[ 'ports' ]:
+                            if port[ 'isEnabled' ]:
+                                if port[ 'port' ] == 'local':
+                                    # onosPorts.append( 'local' )
+                                    onosPorts.append( long( uint64( -2 ) ) )
+                                else:
+                                    onosPorts.append( int( port[ 'port' ] ) )
+                        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 ]
+            onosPorts = [ x for x in onosPorts ]
+
+            # TODO: handle other reserved port numbers besides LOCAL
+            # NOTE: Reserved ports
+            # Local port: -2 in Openflow, ONOS shows 'local', we store as
+            # long( uint64( -2 ) )
+            for mnPort in mnPortsLog:
+                if mnPort in onosPorts:
+                    # don't set results to true here as this is just one of
+                    # 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
+                if 65534 in mnPorts:
+                    mnPorts.remove( 65534 )
+                if long( uint64( -2 ) ) in onosPorts:
+                    onosPorts.remove( long( uint64( -2 ) ) )
+            if len( mnPorts ):  # the ports of this switch don't match
+                switchResult = main.FALSE
+                main.log.warn( "Ports in MN but not ONOS: " + str( mnPorts ) )
+            if len( onosPorts ):  # the ports of this switch don't match
+                switchResult = main.FALSE
+                main.log.warn(
+                    "Ports in ONOS but not MN: " +
+                    str( onosPorts ) )
+            if switchResult == main.FALSE:
+                main.log.report(
+                    "The list of ports for switch %s(%s) does not match:" %
+                    ( mnSwitch[ 'name' ], mnSwitch[ 'dpid' ] ) )
+                main.log.warn( "mn_ports[]  =  " + str( mnPortsLog ) )
+                main.log.warn( "onos_ports[] = " + str( onosPortsLog ) )
+            portsResults = portsResults and switchResult
+        return portsResults
+
+    def compareLinks( self, topo, 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 ) ]
+        if 2 * len( mnLinks ) == len( onos ):
+            linkResults = main.TRUE
+        else:
+            linkResults = main.FALSE
+            main.log.report(
+                "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
+            node2 = None
+            port2 = None
+            firstDir = main.FALSE
+            secondDir = main.FALSE
+            for switch in output[ 'switches' ]:
+                # print "Switch: %s" % switch[ 'name' ]
+                if switch[ 'name' ] == link.node1.name:
+                    node1 = switch[ 'dpid' ]
+                    for port in switch[ 'ports' ]:
+                        if str( port[ 'name' ] ) == str( link.port1 ):
+                            port1 = port[ 'of_port' ]
+                    if node1 is not None and node2 is not None:
+                        break
+                if switch[ 'name' ] == link.node2.name:
+                    node2 = switch[ 'dpid' ]
+                    for port in switch[ 'ports' ]:
+                        if str( port[ 'name' ] ) == 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",
+                    '' )
+                onosNode2 = onosLink[ 'dst' ][ 'device' ].replace(
+                    ":",
+                    '' ).replace(
+                    "of",
+                    '' )
+                onosPort1 = onosLink[ 'src' ][ 'port' ]
+                onosPort2 = onosLink[ 'dst' ][ 'port' ]
+
+                # check onos link from node1 to node2
+                if str( onosNode1 ) == str( node1 ) and str(
+                        onosNode2 ) == str( node2 ):
+                    if int( onosPort1 ) == int( port1 ) and int(
+                            onosPort2 ) == int( port2 ):
+                        firstDir = main.TRUE
+                    else:
+                        main.log.warn(
+                            'The port numbers do not match for ' +
+                            str( link ) +
+                            ' between ONOS and MN. When checking ONOS for ' +
+                            'link %s/%s -> %s/%s' %
+                            ( node1,
+                              port1,
+                              node2,
+                              port2 ) +
+                            ' ONOS has the values %s/%s -> %s/%s' %
+                            ( onosNode1,
+                              onosPort1,
+                              onosNode2,
+                              onosPort2 ) )
+
+                # check onos link from node2 to node1
+                elif ( str( onosNode1 ) == str( node2 ) and
+                        str( onosNode2 ) == str( node1 ) ):
+                    if ( int( onosPort1 ) == int( port2 )
+                            and int( onosPort2 ) == int( port1 ) ):
+                        secondDir = main.TRUE
+                    else:
+                        main.log.warn(
+                            'The port numbers do not match for ' +
+                            str( link ) +
+                            ' between ONOS and MN. When checking ONOS for ' +
+                            'link %s/%s -> %s/%s' %
+                            ( node2,
+                              port2,
+                              node1,
+                              port1 ) +
+                            ' ONOS has the values %s/%s -> %s/%s' %
+                            ( onosNode2,
+                              onosPort2,
+                              onosNode1,
+                              onosPort1 ) )
+                else:  # this is not the link you're looking for
+                    pass
+            if not firstDir:
+                main.log.report(
+                    'ONOS does not have the link %s/%s -> %s/%s' %
+                    ( node1, port1, node2, port2 ) )
+            if not secondDir:
+                main.log.report(
+                    '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 ):
+        """
+           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
+
+           This uses the sts TestONTopology object"""
+        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() :
+                        match = True
+                        for ip in mnIntf[ 'ips' ]:
+                            if ip in onosHost[ 'ips' ]:
+                                pass  # all is well
+                            else:
+                                # misssing ip
+                                main.log.error( "ONOS host " + onosHost[ 'id' ]
+                                                + " has a different IP than " +
+                                                "the Mininet host." )
+                                output = json.dumps(
+                                                    onosHost,
+                                                    sort_keys=True,
+                                                    indent=4,
+                                                    separators=( ',', ': ' ) )
+                                main.log.info( output )
+                                hostResults = main.FALSE
+            if not match:
+                hostResults = main.FALSE
+                main.log.error( "ONOS host " + onosHost[ 'id' ] + " has no " +
+                                "corresponding Mininet host." )
+                output = json.dumps( onosHost,
+                                     sort_keys=True,
+                                     indent=4,
+                                     separators=( ',', ': ' ) )
+                main.log.info( output )
+        return hostResults
+
+    def getHosts( self ):
+        """
+           Returns a list of all hosts
+           Don't ask questions just use it"""
+        self.handle.sendline( "" )
+        self.handle.expect( "mininet>" )
+
+        self.handle.sendline( "py [ host.name for host in net.hosts ]" )
+        self.handle.expect( "mininet>" )
+
+        handlePy = self.handle.before
+        handlePy = handlePy.split( "]\r\n", 1 )[ 1 ]
+        handlePy = handlePy.rstrip()
+
+        self.handle.sendline( "" )
+        self.handle.expect( "mininet>" )
+
+        hostStr = handlePy.replace( "]", "" )
+        hostStr = hostStr.replace( "'", "" )
+        hostStr = hostStr.replace( "[", "" )
+        hostList = hostStr.split( "," )
+
+        return hostList
+
+    def update( self ):
+        """
+           updates the port address and status information for
+           each port in mn"""
+        # TODO: Add error checking. currently the mininet command has no output
+        main.log.info( "Updating MN port information" )
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
+
+            self.handle.sendline( "update" )
+            self.handle.expect( "update" )
+            self.handle.expect( "mininet>" )
+
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
+
+            return main.TRUE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+if __name__ != "__main__":
+    import sys
+    sys.modules[ __name__ ] = MininetCliDriver()
diff --git a/TestON/tests/PingallExample/PingallExample.params b/TestON/tests/PingallExample/PingallExample.params
index 1e4cfc1..6d23beb 100644
--- a/TestON/tests/PingallExample/PingallExample.params
+++ b/TestON/tests/PingallExample/PingallExample.params
@@ -1,12 +1,61 @@
 <PARAMS>
-    <testcases>1,2,3</testcases>
+    <testcases>1,2,25,26</testcases>
     <ENV>
-        <cellName>SingleHA</cellName>
+        <cellName>test1</cellName>
     </ENV>
-    <Git>xe</Git>
+    <Git>False</Git>
 
     <CTRL>
-        <ip1>10.128.30.11</ip1>
+        <ip1>10.128.40.70</ip1>
         <port1>6633</port1>
     </CTRL>
+
+    <VPING>
+        <source1V1>
+            <vhost>h1</vhost>
+            <vintf>eth0</vintf>
+        </source1V1>
+        <source1V2>
+            <vhost>h3</vhost>
+            <vintf>eth0</vintf>
+        </source1V2>
+        <source1Vnone>
+            <vhost>h4</vhost>
+            <vintf>eth0</vintf>
+        </source1Vnone>
+        <source1V1Int>
+            <vhost>h6</vhost>
+            <vintf>eth0</vintf>
+        </source1V1Int>
+
+        <target1V1>
+            <vhost>h7</vhost>
+            <vintf>eth0</vintf>
+        </target1V1>
+        <target2V1>
+            <vhost>h8</vhost>
+            <vintf>eth0</vintf>
+        </target2V1>
+        <target1V2>
+            <vhost>h9</vhost>
+            <vintf>eth0</vintf>
+        </target1V2>
+
+        <target1Vnone>
+            <vhost>h11</vhost>
+            <vintf>eth0</vintf>
+        </target1Vnone>
+        <target1V1Int>
+            <vhost>h14</vhost>
+            <vintf>eth0</vintf>
+        </target1V1Int>
+
+    </VPING>
+    <VTAGS>
+        <tag1>100</tag1>
+        <tag2>200</tag2>
+        <tag3>300</tag3>
+        <tag4>400</tag4>
+    </VTAGS>
+
 </PARAMS>
diff --git a/TestON/tests/PingallExample/PingallExample.py b/TestON/tests/PingallExample/PingallExample.py
index c03b0f1..c8d02a8 100644
--- a/TestON/tests/PingallExample/PingallExample.py
+++ b/TestON/tests/PingallExample/PingallExample.py
@@ -163,9 +163,176 @@
         main.log.info( "Time for pingall: %2f seconds" % ( time2 - time1 ) )
 
         # uninstall onos-app-fwd
-        main.step( "Deactivate reactive forwarding app" )
-        main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+        # main.step( "Deactivate reactive forwarding app" )
+        #main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
 
         utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="All hosts are reachable",
                                  onfail="Some pings failed" )
+
+    def CASE25( self, main ):
+        """
+           Activate fwd app
+           Ping selected hosts
+           Assign selected hosts vlans
+           Ping to test vlans 
+           Deactivate fwd app
+        """
+        import time
+
+        main.log.report( "This testcase creates different vlan hosts " +
+                         " and verifies that only hosts that belong " + 
+                         " to the same vlan can ping each others")
+        main.log.report( "___________________________________________________" )
+        main.case( "Creating vlans and performing ping between hosts" )
+
+        main.step( "Activate reactive forwarding app" )
+        main.ONOScli1.activateApp( "org.onosproject.fwd" )
+
+        main.step( "Activate reactive forwarding app" )
+        main.ONOScli1.activateApp( "org.onosproject.fwd" )
+
+        main.step( "Verify host pinging in Mininet before creating vlans" )
+        source1V1 = main.params[ 'VPING' ][ 'source1V1' ]['vhost']
+        source1V2 = main.params[ 'VPING' ][ 'source1V2' ]['vhost']
+        source1Vnone = main.params[ 'VPING' ][ 'source1Vnone' ]['vhost']
+        target1V1 = main.params[ 'VPING' ][ 'target1V1' ]['vhost']
+        target2V1 = main.params[ 'VPING' ][ 'target2V1' ]['vhost']
+        target1V2 = main.params[ 'VPING' ][ 'target1V2' ]['vhost']
+        target1Vnone = main.params[ 'VPING' ][ 'target1Vnone' ]['vhost']
+
+        targetIP1V1 = main.Mininet1.getIPAddress(target1V1)
+        targetIP2V1 = main.Mininet1.getIPAddress(target2V1)
+        targetIP1V2 =  main.Mininet1.getIPAddress(target1V2)
+        targetIP1Vnone =  main.Mininet1.getIPAddress(target1Vnone)
+        
+        for i in range(0,2):
+            ping1V1 = main.Mininet1.pingHost( src = source1V1, target = targetIP1V1)
+            ping2V1 = main.Mininet1.pingHost( src = source1V1, target = targetIP2V1)
+            ping1V2 = main.Mininet1.pingHost( src = source1V2, target = targetIP1V2)
+            pingV1V2 = main.Mininet1.pingHost( src = source1V1, target = targetIP1V2)
+            pingV2V1 = main.Mininet1.pingHost( src = source1V2, target = targetIP1V1)
+            pingV1Vnone = main.Mininet1.pingHost ( src = source1V1, target = targetIP1Vnone)
+            pingVnoneV2 =  main.Mininet1.pingHost ( src = source1Vnone, target = targetIP1V2)
+
+        pingResultBeforeVlan = ping1V1 and ping2V1 and ping1V2 and pingV1V2 \
+                             and pingV2V1 and pingV1Vnone and pingVnoneV2
+
+        
+        if pingResultBeforeVlan == main.TRUE:
+            main.log.report("Ping succeeded before vlans are created")
+
+            main.step( "Create vlan hosts in mininet" )
+            v1Tag = main.params[ 'VTAGS' ][ 'tag1' ]
+            v2Tag = main.params[ 'VTAGS' ][ 'tag2' ]        
+            intfSource1V1 = source1V1 + "-" + main.params[ 'VPING' ][ 'source1V1' ][ 'vintf' ]
+            intfSource1V2 = source1V2 + "-" + main.params[ 'VPING' ][ 'source1V2' ][ 'vintf' ]
+            intfTarget1V1 = target1V1 + "-" + main.params[ 'VPING' ][ 'target1V1' ][ 'vintf' ]
+            intfTarget2V1 = target2V1 + "-" + main.params[ 'VPING' ][ 'target2V1' ][ 'vintf' ]
+            intfTarget1V2 = target1V2 + "-" + main.params[ 'VPING' ][ 'target1V2' ][ 'vintf' ]
+        
+            main.Mininet1.assignVLAN(source1V1, intfSource1V1, v1Tag)
+            main.Mininet1.assignVLAN(target1V1, intfTarget1V1, v1Tag)
+            main.Mininet1.assignVLAN(target2V1, intfTarget2V1, v1Tag)
+            main.Mininet1.assignVLAN(source1V2, intfSource1V2, v2Tag)
+            main.Mininet1.assignVLAN(target1V2, intfTarget1V2, v2Tag)
+        
+            main.step( "Verify host pinging in Mininet after creating vlans" )
+        
+            ping1V1 = main.Mininet1.pingHost( src = source1V1, target = targetIP1V1)
+            ping2V1 = main.Mininet1.pingHost( src = source1V1, target = targetIP2V1)
+            ping1V2 = main.Mininet1.pingHost( src = source1V2, target = targetIP1V2)
+            pingV1V2 = main.Mininet1.pingHost( src = source1V1, target = targetIP1V2)
+            pingV2V1 = main.Mininet1.pingHost( src = source1V2, target = targetIP1V1)
+            pingV1Vnone = main.Mininet1.pingHost ( src = source1V1, target = targetIP1Vnone)
+            pingVnoneV2 =  main.Mininet1.pingHost ( src = source1Vnone, target = targetIP1V2)
+
+
+            pingExpectedTrue = ping1V1 and ping2V1 and ping1V2
+            pingResultAfterVlan = pingExpectedTrue and not pingV1V2 \
+                   and not pingV2V1 and not pingV1Vnone and not pingVnoneV2
+
+            if pingResultAfterVlan == main.TRUE:
+                main.log.report("Ping results are as expected after vlans are created")
+                testCaseResult = main.TRUE
+            if pingResultAfterVlan == main.FALSE:
+                main.log.report("Ping results are not expected after vlans are created")
+                testCaseResult = main.FALSE
+
+            case25Result = testCaseResult
+            utilities.assert_equals( expect=main.TRUE, actual=case25Result,
+                                 onpass="Vlan verification is successfull",
+                                 onfail="Vlan verification failed" )
+        if pingResultBeforeVlan == main.FALSE:
+            main.log.report("Ping failed before vlans are created")
+            case25Result = main.FALSE
+            utilities.assert_equals( expect=main.TRUE, actual=case25Result,
+                                 onpass="Test case 25 can be verified",
+                                 onfail="Test case 25 cannot be verified because " + 
+                                   "there are ping failures before assigning host vlans" )
+        
+        main.step( "Deactivate reactive forwarding app" )
+        main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+            
+    def CASE26( self, main ):
+        """
+           This test case verifies that hosts belonging to the same vlan,
+           can ping each other with proactive forwarding (after adding host intent):
+              - Deactivate app fwd
+              - Assign vlan tag to selected hosts
+              - Add host intent between the selected hosts
+              - Ping the selected hosts to verify proactive forwarding with vlan hosts
+        """
+        import time
+
+        main.log.report( "This testcase creates vlan hosts, " +
+                         " add host intent, " + 
+                         " then ping the hosts")
+        main.log.report( "___________________________________________________" )
+        main.case( "Creating vlans and performing ping between hosts" )
+
+        main.step( "Deactivate reactive forwarding app" )
+        main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+        
+        main.step( "Assign vlan hosts in mininet" )
+        
+        source1V1 = main.params[ 'VPING' ][ 'source1V1Int' ]['vhost']
+        target1V1 = main.params[ 'VPING' ][ 'target1V1Int' ]['vhost']
+ 
+        intfSource1V1 = source1V1 + "-" + main.params[ 'VPING' ][ 'source1V1Int' ][ 'vintf' ]
+        intfTarget1V1 = target1V1 + "-" + main.params[ 'VPING' ][ 'target1V1Int' ][ 'vintf' ]
+        
+        vTag = main.params[ 'VTAGS' ][ 'tag3' ]        
+
+        main.Mininet1.assignVLAN(source1V1, intfSource1V1, vTag)
+        main.Mininet1.assignVLAN(target1V1, intfTarget1V1, vTag)
+        
+        main.step( "Add host intent" )
+        mac1 = main.Mininet1.getMacAddress(source1V1)
+        mac2 = main.Mininet1.getMacAddress(target1V1)
+        id1 = mac1 + "/" + vTag
+        id2 = mac2 + "/" + vTag
+        hthIntentResult = main.ONOScli1.addHostIntent( id1 , id2 )
+        if hthIntentResult:       
+            main.step( "Ping hosts after installing host intent" )
+            #time.sleep(10)
+            targetIPV1 = main.Mininet1.getIPAddress(target1V1)
+            for i in range(0,3):
+                ping1V1 = main.Mininet1.pingHost( src = source1V1, target = targetIPV1)
+            
+            if ping1V1 == main.TRUE:
+                main.log.report(" Vlan hosts can ping each other successfully "+
+                                  " after add host intent.")
+            
+            if ping1V1 == main.FALSE:
+                main.log.report("Vlan hosts failed to ping each other "+ 
+                                 " after add host intent. ")
+              
+        else:
+            main.log.report(" add host intent failed between vlan hosts ")
+
+        case26Result = hthIntentResult and ping1V1
+        utilities.assert_equals( expect=main.TRUE, actual=case26Result,
+                                 onpass="Test case 26 is successfull",
+                                 onfail="Test case 26 has failed" )
+
diff --git a/TestON/tests/PingallExample/PingallExample.topo b/TestON/tests/PingallExample/PingallExample.topo
index 3eda540..8a9f99f 100644
--- a/TestON/tests/PingallExample/PingallExample.topo
+++ b/TestON/tests/PingallExample/PingallExample.topo
@@ -2,16 +2,18 @@
     <COMPONENT>
 
         <ONOSbench>
-            <host>10.128.30.10</host>
+            <host>10.128.40.70</host>
             <user>admin</user>
             <password></password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
+            <COMPONENTS>
+		<home>~/ONOS</home>
+	    </COMPONENTS>
         </ONOSbench>
 
         <ONOScli1>
-            <host>10.128.30.10</host>
+            <host>10.128.40.70</host>
             <user>admin</user>
             <password></password>
             <type>OnosCliDriver</type>
@@ -20,7 +22,7 @@
         </ONOScli1>
 
         <ONOS1>
-            <host>10.128.30.11</host>
+            <host>10.128.40.70</host>
             <user>admin</user>
             <password></password>
             <type>OnosDriver</type>
@@ -29,7 +31,7 @@
         </ONOS1>
 
         <Mininet1>
-            <host>10.128.30.9</host>
+            <host>10.128.40.70</host>
             <user>admin</user>
             <password></password>
             <type>MininetCliDriver</type>
diff --git a/TestON/tests/PingallExample/PingallExample_orig.py b/TestON/tests/PingallExample/PingallExample_orig.py
new file mode 100644
index 0000000..c03b0f1
--- /dev/null
+++ b/TestON/tests/PingallExample/PingallExample_orig.py
@@ -0,0 +1,171 @@
+"""
+Description: This test is an example of a simple single node ONOS test
+
+List of test cases:
+CASE1: Compile ONOS and push it to the test machine
+CASE2: Assign mastership to controller
+CASE3: Pingall
+"""
+class PingallExample:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        """
+           CASE1 is to compile ONOS and push it to the test machines
+
+           Startup sequence:
+           git pull
+           mvn clean install
+           onos-package
+           cell <name>
+           onos-verify-cell
+           onos-install -f
+           onos-wait-for-start
+        """
+        desc = "ONOS Single node cluster restart HA test - initialization"
+        main.log.report( desc )
+        main.case( "Setting up test environment" )
+
+        # load some vairables from the params file
+        PULLCODE = False
+        if main.params[ 'Git' ] == 'True':
+            PULLCODE = True
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        main.log.report( "Uninstalling ONOS" )
+        main.ONOSbench.onosUninstall( ONOS1Ip )
+
+        cleanInstallResult = main.TRUE
+        gitPullResult = main.TRUE
+
+        main.step( "Compiling the latest version of ONOS" )
+        if PULLCODE:
+            main.step( "Git checkout and pull master" )
+            main.ONOSbench.gitCheckout( "master" )
+            gitPullResult = main.ONOSbench.gitPull()
+
+            main.step( "Using mvn clean & install" )
+            cleanInstallResult = main.TRUE
+            if gitPullResult == main.TRUE:
+                cleanInstallResult = main.ONOSbench.cleanInstall()
+            else:
+                main.log.warn( "Did not pull new code so skipping mvn " +
+                               "clean install" )
+        main.ONOSbench.getVersion( report=True )
+
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+
+        main.step( "Installing ONOS package" )
+        onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
+                                                           node=ONOS1Ip )
+
+        main.step( "Checking if ONOS is up yet" )
+        for i in range( 2 ):
+            onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+            if onos1Isup:
+                break
+        if not onos1Isup:
+            main.log.report( "ONOS1 didn't start!" )
+
+        # TODO: if it becomes an issue, we can retry this step  a few times
+
+        cliResult = main.ONOScli1.startOnosCli( ONOS1Ip )
+
+        case1Result = ( cleanInstallResult and packageResult and
+                        cellResult and verifyResult and
+                        onos1InstallResult and
+                        onos1Isup and cliResult )
+
+        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+                                 onpass="Test startup successful",
+                                 onfail="Test startup NOT successful" )
+
+        if case1Result == main.FALSE:
+            main.cleanup()
+            main.exit()
+
+        # Starting the mininet using the old way
+        main.step( "Starting Mininet ..." )
+        netIsUp = main.Mininet1.startNet()
+        if netIsUp:
+            main.log.info("Mininet CLI is up")
+        else:
+            main.log.info("Mininet CLI is down")
+
+    def CASE2( self, main ):
+        """
+           Assign mastership to controller
+        """
+        import re
+
+        main.log.report( "Assigning switches to controller" )
+        main.case( "Assigning Controller" )
+        main.step( "Assign switches to controller" )
+
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+
+        for i in range( 1, 14 ):
+            main.Mininet1.assignSwController(
+                sw=str( i ),
+                ip1=ONOS1Ip,
+                port1=ONOS1Port )
+
+        mastershipCheck = main.TRUE
+        for i in range( 1, 14 ):
+            response = main.Mininet1.getSwController( "s" + str( i ) )
+            try:
+                main.log.info( str( response ) )
+            except Exception:
+                main.log.info( repr( response ) )
+            if re.search( "tcp:" + ONOS1Ip, response ):
+                mastershipCheck = mastershipCheck and main.TRUE
+            else:
+                mastershipCheck = main.FALSE
+        if mastershipCheck == main.TRUE:
+            main.log.report( "Switch mastership assigned correctly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=mastershipCheck,
+            onpass="Switch mastership assigned correctly",
+            onfail="Switches not assigned correctly to controllers" )
+
+    def CASE3( self, main ):
+        """
+           Install forwarding app, Pingall and unistall the app
+        """
+        import time
+
+        main.log.report( "Run Pingall" )
+        main.case( "Run Pingall" )
+
+        # install onos-app-fwd
+        main.step( "Activate reactive forwarding app" )
+        main.ONOScli1.activateApp( "org.onosproject.fwd" )
+
+        # REACTIVE FWD test
+        main.step( "Run the pingall command in Mininet" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        main.log.info( "Time for pingall: %2f seconds" % ( time2 - time1 ) )
+
+        # uninstall onos-app-fwd
+        main.step( "Deactivate reactive forwarding app" )
+        main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+                                 onpass="All hosts are reachable",
+                                 onfail="Some pings failed" )
diff --git a/TestON/tests/SingleFunc/MultiFunc.topo b/TestON/tests/SingleFunc/MultiFunc.topo
new file mode 100755
index 0000000..f8c2eab
--- /dev/null
+++ b/TestON/tests/SingleFunc/MultiFunc.topo
@@ -0,0 +1,57 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.10.20</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.10.21</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+        <ONOScli2>
+            <host>10.128.10.22</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+         <ONOScli3>
+            <host>10.128.10.23</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+       
+
+        <Mininet1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</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>
+        </Mininet1>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/SingleFunc/SingleFunc.params b/TestON/tests/SingleFunc/SingleFunc.params
new file mode 100755
index 0000000..58427cc
--- /dev/null
+++ b/TestON/tests/SingleFunc/SingleFunc.params
@@ -0,0 +1,20 @@
+<PARAMS>
+
+    <testcases>10,11</testcases>
+    <ENV>
+        <cellName>single_func</cellName>
+    </ENV>
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+    <CTRL>
+        <ip1>10.128.10.21</ip1>
+        <port1>6633</port1>
+    </CTRL>
+    <MININET>
+        <switch>7</switch>
+        <topo>~/mininet/custom/newFuncTopo.py</topo>
+    </MININET>
+
+</PARAMS>
diff --git a/TestON/tests/SingleFunc/SingleFunc.py b/TestON/tests/SingleFunc/SingleFunc.py
new file mode 100644
index 0000000..b971d8c
--- /dev/null
+++ b/TestON/tests/SingleFunc/SingleFunc.py
@@ -0,0 +1,166 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import json
+
+time.sleep( 1 )
+
+class SingleFunc:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE10( self, main ):
+        import time
+        import os
+        """
+        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
+        """
+        #Local variables
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        main.ONOS1ip = os.environ[ 'OC1' ]
+        main.ONOS1port = main.params[ 'CTRL' ][ 'port1' ]
+        main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
+        gitBranch = main.params[ 'GIT' ][ 'branch' ]
+        topology = main.params[ 'MININET' ][ 'topo' ]
+        PULLCODE = False
+        if main.params[ 'GIT' ][ 'pull' ] == 'True':
+            PULLCODE = True
+        main.case( "Setting up test environment" )
+
+        main.step( "Apply cell to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+        stepResult = cellResult and verifyResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully applied cell to " + \
+                                        "environment",
+                                 onfail="Failed to apply cell to environment " )
+        """main.step( "Removing raft logs" )
+        removeRaftResult = main.ONOSbench.onosRemoveRaftLogs()
+        stepResult = removeRaftResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully removed raft logs",
+                                 onfail="Failed to remove raft logs" )
+        """
+        if PULLCODE:
+            main.step( "Git checkout and pull " + gitBranch )
+            main.ONOSbench.gitCheckout( gitBranch )
+            gitPullResult = main.ONOSbench.gitPull()
+            if gitPullResult == main.ERROR:
+                main.log.error( "Error pulling git branch" )
+            main.step( "Using mvn clean & install" )
+            cleanInstallResult = main.ONOSbench.cleanInstall()
+            stepResult = cleanInstallResult
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=stepResult,
+                                     onpass="Successfully compiled latest ONOS",
+                                     onfail="Failed to compile latest ONOS" )
+        else:
+            main.log.warn( "Did not pull new code so skipping mvn " +
+                           "clean install" )
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+        stepResult = packageResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully created ONOS package",
+                                 onfail="Failed to create ONOS package" )
+
+        main.step( "Uninstalling ONOS package" )
+        onosUninstallResult = main.ONOSbench.onosUninstall(
+                                                          nodeIp=main.ONOS1ip )
+        stepResult = onosUninstallResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully uninstalled ONOS package",
+                                 onfail="Failed to uninstall ONOS package" )
+        time.sleep( 5 )
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.ONOSbench.onosInstall( node=main.ONOS1ip )
+        stepResult = onosInstallResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully installed ONOS package",
+                                 onfail="Failed to install ONOS package" )
+
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.ONOSbench.isup()
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            stopResult = main.ONOSbench.onosStop( main.ONOS1ip )
+            startResult = main.ONOSbench.onosStart( main.ONOS1ip )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
+        main.step( "Starting Mininet Topology" )
+        topoResult = main.Mininet1.startNet( topoFile=topology )
+        stepResult = topoResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully loaded topology",
+                                 onfail="Failed to load topology" )
+        # Exit if topology did not load properly
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
+        main.step( "Start ONOS cli" )
+        cliResult =  main.ONOScli1.startOnosCli( ONOSIp=main.ONOS1ip )
+        stepResult = cliResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully start ONOS cli",
+                                 onfail="Failed to start ONOS cli" )
+
+    def CASE11( self, main ):
+        """
+        Assign mastership to controllers
+        """
+        import re
+        main.log.report( "Assigning switches to controllers" )
+        main.log.case( "Assigning swithes to controllers" )
+
+        main.step( "Assigning switches to controllers" )
+        assignResult = main.TRUE
+        for i in range( 1, ( main.numSwitch + 1 ) ):
+            main.Mininet1.assignSwController( sw=str( i ),
+                                              count=1,
+                                              ip1=main.ONOS1ip,
+                                              port1=main.ONOS1port )
+        for i in range( 1, ( main.numSwitch + 1 ) ):
+            response = main.Mininet1.getSwController( "s" + str( i ) )
+            print( "Response is " + str( response ) )
+            if re.search( "tcp:" + main.ONOS1ip, response ):
+                assignResult = assignResult and main.TRUE
+            else:
+                assignResult = main.FALSE
+        stepResult = assignResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully assigned switches" +
+                                        "to controller",
+                                 onfail="Failed to assign switches to " +
+                                        "controller" )
+
diff --git a/TestON/tests/SingleFunc/SingleFunc.topo b/TestON/tests/SingleFunc/SingleFunc.topo
new file mode 100755
index 0000000..d92bb7a
--- /dev/null
+++ b/TestON/tests/SingleFunc/SingleFunc.topo
@@ -0,0 +1,52 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.10.20</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS>
+                <home>~/ONOS</home>
+            </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.10.20</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+        <ONOScli2>
+            <host>10.128.10.20</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+         <ONOScli3>
+            <host>10.128.10.20</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+        <Mininet1>
+            <host>10.128.10.20</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </Mininet1>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/SingleFunc/SingleFunc2.py b/TestON/tests/SingleFunc/SingleFunc2.py
new file mode 100644
index 0000000..af88686
--- /dev/null
+++ b/TestON/tests/SingleFunc/SingleFunc2.py
@@ -0,0 +1,661 @@
+
+# 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 IpOptical:
+
+    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( "Uninstalling ONOS package" )
+        ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+        onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+        if onosUninstallResult:
+            main.log.report( "Uninstalling ONOS package successful" )
+        else:
+            main.log.report( "Uninstalled ONOS package unsucessful" )
+        time.sleep( 5 )
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+        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..." )
+        
+        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 CASE20( self ):
+        """
+            Exit from mininet cli
+            reinstall ONOS
+        """
+        import time
+        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" )
+        step1Result = main.TRUE
+        mininetDisconnect = main.Mininet1.disconnect()
+        print "mininetDisconnect = ", mininetDisconnect
+        step1Result = mininetDisconnect
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Mininet disconnect successfully",
+            onfail="Mininet failed to disconnect")
+        """
+        main.step( "Removing raft logs before a clean installation of ONOS" )
+        step2Result = main.TRUE
+        removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+        step2Result = removeRaftLogsResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Raft logs removed successfully",
+            onfail="Failed to remove raft logs")
+        """
+        main.step( "Applying cell variable to environment" )
+        step3Result = main.TRUE
+        setCellResult = main.ONOSbench.setCell( cellName )
+        verifyCellResult = main.ONOSbench.verifyCell()
+        step3Result = setCellResult and verifyCellResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Cell applied successfully",
+            onfail="Failed to apply cell")
+
+        main.step( "Uninstalling ONOS package" )
+        step4Result = main.TRUE
+        ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+        onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+        step4Result = onosUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully uninstalled ONOS",
+            onfail="Failed to uninstall ONOS")
+
+        time.sleep( 5 )
+        main.step( "Installing ONOS package" )
+        step5Result = main.TRUE
+        onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+        step5Result = onosInstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step5Result,
+            onpass="Successfully installed ONOS",
+            onfail="Failed to install ONOS")
+
+        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" )
+        step6Result = main.TRUE
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        step6Result = startResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step6Result,
+            onpass="Successfully started ONOS",
+            onfail="Failed to start ONOS")
+
+        main.step( "Starting ONOS cli" )
+        step7Result = main.TRUE
+        cliResult = main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        step7Result = cliResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step7Result,
+            onpass="Successfully started ONOS cli",
+            onfail="Failed to start ONOS cli")
+
+        case20Result = step1Result and step3Result and\
+                       step4Result and step5Result and step6Result and\
+                       step7Result
+        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
+        """
+        import time
+        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( "Activate optical app" )
+        step1Result = main.TRUE
+        activateOpticalResult = main.ONOS2.activateApp( "org.onosproject.optical" )
+        step1Result = activateOpticalResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully activated optical app",
+            onfail="Failed to activate optical app")
+
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+
+        main.step( "Starting mininet and LINC-OE" )
+        step2Result = main.TRUE
+        time.sleep( 10 )
+        opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+        step2Result = opticalMnScript
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Started the topology successfully ",
+            onfail="Failed to start the topology")
+
+        case21Result = step1Result and step2Result
+        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
+        """
+        import time
+        main.log.report(
+            "This testcase compares the optical+packet topology against what" +
+            " is expected" )
+        main.case( "Topology comparision" )
+
+        main.step( "Starts new ONOS cli" )
+        step1Result = main.TRUE
+        cliResult = main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+                                                               [ 'ip1' ] )
+        step1Result = cliResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully starts a new cli",
+            onfail="Failed to start new cli" )
+
+        main.step( "Compare topology" )
+        step2Result = main.TRUE
+        devicesResult = main.ONOS3.devices( jsonFormat=False )
+        print "devices_result :\n", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        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
+        # sleeps for sometime so the state of the switches will be active
+        time.sleep( 30 )
+        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")
+        step2Result = opticalSWResult and packetSWResult and \
+                        linkActiveResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfully loaded packet optical topology",
+            onfail="Failed to load packet optical topology" )
+
+        case22Result = step1Result and step2Result
+
+        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( "Install point intents between 2 packet layer device and " +
+                   "ping the hosts" )
+
+        main.step( "Adding point intents" )
+        step1Result = main.TRUE
+        intentsId = []
+        pIntent1 = main.ONOS3.addPointIntent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0005/1" )
+        pIntent2 = main.ONOS3.addPointIntent(
+            "of:0000ffffffff0005/1",
+            "of:0000ffffffff0001/1" )
+        intentsId.append( pIntent1 )
+        intentsId.append( pIntent2 )
+        main.log.info( "Checking intents state")
+        checkStateResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+        time.sleep( 30 )
+        main.log.info( "Checking flows state")
+        checkFlowResult = main.ONOS3.checkFlowsState()
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep( 30 )
+        main.log.info( "Checking intents state one more time")
+        checkStateResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+        step1Result = checkStateResult and checkFlowResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully added point intents",
+            onfail="Failed to add point intents")
+
+        main.step( "Ping h1 and h5" )
+        step2Result = main.TRUE
+        main.log.info( "\n\nh1 is Pinging h5" )
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step2Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
+
+        case23Result = step1Result and step2Result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23Result,
+            onpass="Point intents are installed properly",
+            onfail="Failed to install point intents" )
+
+    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" )
+        step1Result = main.TRUE
+        attachConsole = main.LincOE1.attachLincOESession()
+        step1Result = attachConsole
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully attached Linc-OE session",
+            onfail="Failed to attached Linc-OE session")
+
+        main.step( "Bring a port down and verify the link state" )
+        step2Result = main.TRUE
+        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
+        time.sleep( 10 )
+        checkFlowsState = main.ONOS3.checkFlowsState()
+        step2Result = linksStateResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfuly brought down a link",
+            onfail="Failed to bring down a link")
+
+        main.step( "Verify Rerouting by a ping test" )
+        step3Result = main.TRUE
+        main.log.info( "\n\nh1 is Pinging h5" )
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step3Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
+
+        main.step( "Bring the downed port up and verify the link state" )
+        step4Result = main.TRUE
+        main.LincOE1.portUp( 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 == 0:
+            main.log.info(
+                "Number of links in INACTIVE state are correct")
+        else:
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+            step4Result = main.FALSE
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully brought the port up",
+            onfail="Failed to bring the port up")
+
+        case24Result = step1Result and step2Result and step3Result \
+                       and step4Result
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=case24Result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
+
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        main.step( "Uninstalling reactive forwarding app" )
+        step1Result = main.TRUE
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        main.log.info( "deactivate reactive forwarding app" )
+        appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+        step1Result = appUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully deactivate reactive forwarding app",
+            onfail="Failed to deactivate reactive forwarding app")
+        # 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 = step1Result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case10Result,
+            onpass="Reactive forwarding app uninstallation successful",
+            onfail="Reactive forwarding app uninstallation failed" )
+
+    def CASE25( self ):
+        """
+            Add host intents between 2 packet layer host
+        """
+        import time
+        import json
+        main.log.report( "Adding host intents between 2 optical layer host" )
+        main.case( "Test add host intents between optical layer host" )
+
+        main.step( "Discover host using arping" )
+        step1Result = main.TRUE
+        main.hostMACs = []
+        main.hostId = []
+        #Listing host MAC addresses
+        for i in range( 1 , 7 ):
+            main.hostMACs.append( "00:00:00:00:00:" +
+                                str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+        for macs in main.hostMACs:
+            main.hostId.append( macs + "/-1" )
+        host1 = main.hostId[ 0 ]
+        host2 = main.hostId[ 1 ]
+        # Use arping to discover the hosts
+        main.LincOE2.arping( host = "h1" )
+        main.LincOE2.arping( host = "h2" )
+        time.sleep( 5 )
+        hostsDict = main.ONOS3.hosts()
+        if not len( hostsDict ):
+            step1Result = main.FALSE
+        # Adding host intent
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Hosts discovered",
+            onfail="Failed to discover hosts")
+
+        main.step( "Adding host intents to h1 and h2" )
+        step2Result = main.TRUE
+        intentsId = []
+        intent1 = main.ONOS3.addHostIntent( hostIdOne = host1,
+                                            hostIdTwo = host2 )
+        intentsId.append( intent1 )
+        time.sleep( 5 )
+        intent2 = main.ONOS3.addHostIntent( hostIdOne = host2,
+                                            hostIdTwo = host1 )
+        intentsId.append( intent2 )
+        # Checking intents state before pinging
+        main.log.info( "Checking intents state" )
+        time.sleep( 15 )
+        intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+        #check intent state again if intents are not in installed state
+        if not intentResult:
+           intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+        step2Result = intentResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step2Result,
+                                 onpass="All intents are in INSTALLED state ",
+                                 onfail="Some of the intents are not in " +
+                                        "INSTALLED state " )
+
+        # pinging h1 to h2 and then ping h2 to h1
+        main.step( "Pinging h1 and h2" )
+        step3Result = main.TRUE
+        pingResult = main.TRUE
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+                                                                  target="h1" )
+        step3Result = pingResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step3Result,
+                                 onpass="Pinged successfully between h1 and h2",
+                                 onfail="Pinged failed between h1 and h2" )
+        # Removed all added host intents
+        main.step( "Removing host intents" )
+        step4Result = main.TRUE
+        removeResult = main.TRUE
+        # Check remaining intents
+        intentsJson = json.loads( main.ONOS3.intents() )
+        main.ONOS3.removeIntent( intentId=intent1, purge=True )
+        main.ONOS3.removeIntent( intentId=intent2, purge=True )
+        for intents in intentsJson:
+            main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+                                     app='org.onosproject.optical',
+                                     purge=True )
+        print json.loads( main.ONOS3.intents() )
+        if len( json.loads( main.ONOS3.intents() ) ):
+            removeResult = main.FALSE
+        step4Result = removeResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step4Result,
+                                 onpass="Successfully removed host intents",
+                                 onfail="Failed to remove host intents" )
+        case25Result = step1Result and step2Result and step3Result and \
+                       step4Result
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=case25Result,
+                                 onpass="Add host intent successful",
+                                 onfail="Add host intent failed" )
diff --git a/TestON/tests/SingleFunc/__init__.py b/TestON/tests/SingleFunc/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/SingleFunc/__init__.py
diff --git a/TestON/tests/SingleFunc/lala.py b/TestON/tests/SingleFunc/lala.py
new file mode 100644
index 0000000..372f8c7
--- /dev/null
+++ b/TestON/tests/SingleFunc/lala.py
@@ -0,0 +1,8 @@
+        main.log.report()
+        main.log.case()
+        main.step()
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="",
+                                 onfail="" )
