Merge pull request #129 from opennetworkinglab/devl/newFunctionality

Devl/new functionality
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 57d8c9b..aa36725 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
@@ -38,6 +39,7 @@
 import pexpect
 import re
 import sys
+import types
 sys.path.append( "../" )
 from math import pow
 from drivers.common.cli.emulatordriver import Emulator
@@ -95,12 +97,20 @@
             main.cleanup()
             main.exit()
 
-    def startNet( self, topoFile='', args='', timeout=120 ):
+    def startNet( self, topoFile='', args='', mnCmd='', timeout=120 ):
         """
-        Starts Mininet accepts a topology(.py) file and/or an optional
-        argument ,to start the mininet, as a parameter.
-        Returns main.TRUE if the mininet starts successfully and
-                main.FALSE otherwise
+        Description:
+            Starts Mininet accepts a topology(.py) file and/or an optional
+            argument, to start the mininet, as a parameter.
+            Can also send regular mininet command to load up desired topology.
+            Eg. Pass in a string 'sudo mn --topo=tree,3,3' to mnCmd
+        Options:
+            topoFile = file path for topology file (.py)
+            args = extra option added when starting the topology from the file
+            mnCmd = Mininet command use to start topology
+        Returns:
+                main.TRUE if the mininet starts successfully, main.FALSE
+                otherwise
         """
         if self.handle:
             # make sure old networks are cleaned up
@@ -130,26 +140,31 @@
                                 "Mininet took too long... " )
             # Craft the string to start mininet
             cmdString = "sudo "
-            if topoFile is None or topoFile == '':  # If no file is given
-                main.log.info( self.name + ": building fresh Mininet" )
-                cmdString += "mn "
-                if args is None or args == '':
-                    # If no args given, use args from .topo file
-                    args = self.options[ 'arg1' ] +\
-                                 " " + self.options[ 'arg2' ] +\
-                                 " --mac --controller " +\
-                                 self.options[ 'controller' ] + " " +\
-                                 self.options[ 'arg3' ]
-                else:  # else only use given args
-                    pass
-                    # TODO: allow use of topo args and method args?
-            else:  # Use given topology file
-                main.log.info( "Starting Mininet from topo file " + topoFile )
-                cmdString += topoFile + " "
-                if args is None:
-                    args = ''
-                    # TODO: allow use of args from .topo file?
-            cmdString += args
+            if not mnCmd:
+                if topoFile is None or topoFile == '':  # If no file is given
+                    main.log.info( self.name + ": building fresh Mininet" )
+                    cmdString += "mn "
+                    if args is None or args == '':
+                        # If no args given, use args from .topo file
+                        args = self.options[ 'arg1' ] +\
+                                     " " + self.options[ 'arg2' ] +\
+                                     " --mac --controller " +\
+                                     self.options[ 'controller' ] + " " +\
+                                     self.options[ 'arg3' ]
+                    else:  # else only use given args
+                        pass
+                        # TODO: allow use of topo args and method args?
+                else:  # Use given topology file
+                    main.log.info( "Starting Mininet from topo file " + topoFile )
+                    cmdString += topoFile + " "
+                    if args is None:
+                        args = ''
+                        # TODO: allow use of args from .topo file?
+                cmdString += args
+            else:
+                main.log.info( "Starting Mininet topology using '" + mnCmd +
+                               "' command" )
+                cmdString += mnCmd
             # Send the command and check if network started
             self.handle.sendline( "" )
             self.handle.expect( '\$' )
@@ -369,23 +384,23 @@
 
     def pingallHosts( self, hostList, pingType='ipv4' ):
         """
-            Ping all specified hosts with a specific ping type 
-            
-            Acceptable pingTypes: 
-                - 'ipv4' 
+            Ping all specified hosts with a specific ping type
+
+            Acceptable pingTypes:
+                - 'ipv4'
                 - 'ipv6'
-        
+
             Acceptable hostList:
                 - ['h1','h2','h3','h4']
-                
-            Returns main.TRUE if all hosts specified can reach 
+
+            Returns main.TRUE if all hosts specified can reach
             each other
-            
+
             Returns main.FALSE if one or more of hosts specified
             cannot reach each other"""
-            
+
         if pingType == "ipv4":
-            cmd = " ping -c 1 -i 1 -W 8 " 
+            cmd = " ping -c 1 -i 1 -W 8 "
         elif pingType == "ipv6":
             cmd = " ping6 -c 1 -i 1 -W 8 "
         else:
@@ -394,17 +409,17 @@
 
         try:
             main.log.info( "Testing reachability between specified hosts" )
-           
+
             isReachable = main.TRUE
 
             for host in hostList:
                 listIndex = hostList.index(host)
                 # List of hosts to ping other than itself
                 pingList = hostList[:listIndex] + hostList[(listIndex+1):]
-                
+
                 for temp in pingList:
                     # Current host pings all other hosts specified
-                    pingCmd = str(host) + cmd + str(temp) 
+                    pingCmd = str(host) + cmd + str(temp)
                     self.handle.sendline( pingCmd )
                     i = self.handle.expect( [ pingCmd, pexpect.TIMEOUT ] )
                     j = self.handle.expect( [ "mininet>", pexpect.TIMEOUT ] )
@@ -413,11 +428,11 @@
                         main.log.info( str(host) + " -> " + str(temp) )
                     else:
                         main.log.info( str(host) + " -> X ("+str(temp)+") "
-                                       " Destination Unreachable" ) 
+                                       " Destination Unreachable" )
                         # One of the host to host pair is unreachable
                         isReachable = main.FALSE
 
-            return isReachable 
+            return isReachable
 
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1092,49 +1107,133 @@
             main.cleanup()
             main.exit()
 
-    def assignSwController( self, **kwargs ):
+    def assignSwController( self, sw, ip, port="6633", ptcp="" ):
         """
-           count is only needed if there is more than 1 controller"""
-        args = utilities.parse_args( [ "COUNT" ], **kwargs )
-        count = args[ "COUNT" ] if args != {} else 1
+        Description:
+            Assign switches to the controllers ( for ovs use only )
+        Required:
+            sw - Name of the switch. This can be a list or a string.
+            ip - Ip addresses of controllers. This can be a list or a string.
+        Optional:
+            port - ONOS use port 6633, if no list of ports is passed, then
+                   the all the controller will use 6633 as their port number
+            ptcp - ptcp number, This can be a string or a list that has
+                   the same length as switch. This is optional and not required
+                   when using ovs switches.
+        NOTE: If switches and ptcp are given in a list type they should have the
+              same length and should be in the same order, Eg. sw=[ 's1' ... n ]
+              ptcp=[ '6637' ... n ], s1 has ptcp number 6637 and so on.
 
-        argstring = "SW"
-        for j in range( count ):
-            argstring = argstring + ",IP" + \
-                str( j + 1 ) + ",PORT" + str( j + 1 )
-        args = utilities.parse_args( argstring.split( "," ), **kwargs )
-
-        sw = args[ "SW" ] if args[ "SW" ] is not None else ""
-        ptcpA = int( args[ "PORT1" ] ) + \
-            int( sw ) if args[ "PORT1" ] is not None else ""
-        ptcpB = "ptcp:" + str( ptcpA ) if ptcpA != "" else ""
-
-        command = "sh ovs-vsctl set-controller s" + \
-            str( sw ) + " " + ptcpB + " "
-        for j in range( count ):
-            i = j + 1
-            args = utilities.parse_args(
-                [ "IP" + str( i ), "PORT" + str( i ) ], **kwargs )
-            ip = args[
-                "IP" +
-                str( i ) ] if args[
-                "IP" +
-                str( i ) ] is not None else ""
-            port = args[
-                "PORT" +
-                str( i ) ] if args[
-                "PORT" +
-                str( i ) ] is not None else ""
-            tcp = "tcp:" + str( ip ) + ":" + str( port ) + \
-                " " if ip != "" else ""
-            command = command + tcp
+        Return:
+            Returns main.TRUE if mininet correctly assigned switches to
+            controllers, otherwise it will return main.FALSE or an appropriate
+            exception(s)
+        """
+        assignResult = main.TRUE
+        # Initial ovs command
+        commandList = []
+        command = "sh ovs-vsctl set-controller "
+        onosIp = ""
         try:
-            self.execute( cmd=command, prompt="mininet>", timeout=5 )
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":     " + self.handle.before )
-            main.cleanup()
-            main.exit()
+            if isinstance( ip, types.StringType ):
+                onosIp = "tcp:" + str( ip ) + ":"
+                if isinstance( port, types.StringType ) or \
+                   isinstance( port, types.IntType ):
+                    onosIp += str( port )
+                elif isinstance( port, types.ListType ):
+                    main.log.error( self.name + ": Only one controller " +
+                                    "assigned and a list of ports has" +
+                                    " been passed" )
+                    return main.FALSE
+                else:
+                    main.log.error( self.name + ": Invalid controller port " +
+                                    "number. Please specify correct " +
+                                    "controller port" )
+                    return main.FALSE
+
+            elif isinstance( ip, types.ListType ):
+                if isinstance( port, types.StringType ) or \
+                   isinstance( port, types.IntType ):
+                    for ipAddress in ip:
+                        onosIp += "tcp:" + str( ipAddress ) + ":" + \
+                                  str( port ) + " "
+                elif isinstance( port, types.ListType ):
+                    if ( len( ip ) != len( port ) ):
+                        main.log.error( self.name + ": Port list = " +
+                                        str( len( port ) ) +
+                                        "should be the same as controller" +
+                                        " ip list = " + str( len( ip ) ) )
+                        return main.FALSE
+                    else:
+                        onosIp = ""
+                        for ipAddress, portNum in zip( ip, port ):
+                            onosIp += "tcp:" + str( ipAddress ) + ":" + \
+                                      str( portNum ) + " "
+                else:
+                    main.log.error( self.name + ": Invalid controller port " +
+                                    "number. Please specify correct " +
+                                    "controller port" )
+                    return main.FALSE
+            else:
+                main.log.error( self.name + ": Invalid ip address" )
+                return main.FALSE
+
+            if isinstance( sw, types.StringType ):
+                command += sw + " "
+                if ptcp:
+                    if isinstance( ptcp, types.StringType ):
+                        command += "ptcp:" + str( ptcp ) + " "
+                    elif isinstance( ptcp, types.ListType ):
+                        main.log.error( self.name + ": Only one switch is " +
+                                        "being set and multiple PTCP is " +
+                                        "being passed " )
+                    else:
+                        main.log.error( self.name + ": Invalid PTCP" )
+                        ptcp = ""
+                command += onosIp
+                commandList.append( command )
+
+            elif isinstance( sw, types.ListType ):
+                if ptcp:
+                    if isinstance( ptcp, types.ListType ):
+                        if len( ptcp ) != len( sw ):
+                            main.log.error( self.name + ": PTCP length = " +
+                                            str( len( ptcp ) ) +
+                                            " is not the same as switch" +
+                                            " length = " +
+                                            str( len( sw ) ) )
+                            return main.FALSE
+                        else:
+                            for switch, ptcpNum in zip( sw, ptcp ):
+                                tempCmd = "sh ovs-vsctl set-controller "
+                                tempCmd += switch + " ptcp:" + \
+                                           str( ptcpNum ) + " "
+                                tempCmd += onosIp
+                                commandList.append( tempCmd )
+                    else:
+                        main.log.error( self.name + ": Invalid PTCP" )
+                        return main.FALSE
+                else:
+                    for switch in sw:
+                        tempCmd = "sh ovs-vsctl set-controller "
+                        tempCmd += switch + " " + onosIp
+                        commandList.append( tempCmd )
+            else:
+                main.log.error( self.name + ": Invalid switch type " )
+                return main.FALSE
+
+            for cmd in commandList:
+                try:
+                    self.execute( cmd=cmd, prompt="mininet>", timeout=5 )
+                except pexpect.TIMEOUT:
+                    main.log.error( self.name + ": pexpect.TIMEOUT found" )
+                    return main.FALSE
+                except pexpect.EOF:
+                    main.log.error( self.name + ": EOF exception found" )
+                    main.log.error( self.name + ":     " + self.handle.before )
+                    main.cleanup()
+                    main.exit()
+            return main.TRUE
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
@@ -1189,7 +1288,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()
 
@@ -1986,6 +2085,72 @@
 
         return hostList
 
+    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( "[", "" )
+        hostStr = hostStr.replace( " ", "" )
+        hostList = hostStr.split( "," )
+
+        return hostList
+
+    def getSwitch( self ):
+        """
+            Returns a list of all switches
+            Again, don't ask question just use it...
+        """
+        # get host list...
+        hostList = self.getHosts()
+        # Make host set
+        hostSet = set( hostList )
+
+        # Getting all the nodes in mininet
+        self.handle.sendline( "" )
+        self.handle.expect( "mininet>" )
+
+        self.handle.sendline( "py [ node.name for node in net.values() ]" )
+        self.handle.expect( "mininet>" )
+
+        handlePy = self.handle.before
+        handlePy = handlePy.split( "]\r\n", 1 )[ 1 ]
+        handlePy = handlePy.rstrip()
+
+        self.handle.sendline( "" )
+        self.handle.expect( "mininet>" )
+
+        nodesStr = handlePy.replace( "]", "" )
+        nodesStr = nodesStr.replace( "'", "" )
+        nodesStr = nodesStr.replace( "[", "" )
+        nodesStr = nodesStr.replace( " ", "" )
+        nodesList = nodesStr.split( "," )
+
+        nodesSet = set( nodesList )
+        # discarding default controller(s) node
+        nodesSet.discard( 'c0' )
+        nodesSet.discard( 'c1' )
+        nodesSet.discard( 'c2' )
+
+        switchSet = nodesSet - hostSet
+        switchList = list( switchSet )
+
+        return switchList
+
     def update( self ):
         """
            updates the port address and status information for
@@ -2010,6 +2175,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/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 5da4a71..7256294 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1762,39 +1762,60 @@
             main.cleanup()
             main.exit()
 
-    def checkIntentState( self, intentsId, expectedState = 'INSTALLED' ):
+    def checkIntentState( self, intentsId, expectedState='INSTALLED' ):
         """
         Description:
             Check intents state
         Required:
             intentsId - List of intents ID to be checked
         Optional:
-            expectedState - Check this expected state of each intents state
-                            in the list. Defaults to INSTALLED
+            expectedState - Check the expected state(s) of each intents
+                            state in the list.
+                            *NOTE: You can pass in a list of expected state,
+                            Eg: expectedState = [ 'INSTALLED' , 'INSTALLING' ]
         Return:
-            Returns main.TRUE only if all intent are the same as expectedState,
-            , otherwise,returns main.FALSE.
+            Returns main.TRUE only if all intent are the same as expected states
+            , otherwise, returns main.FALSE.
         """
         try:
             # Generating a dictionary: intent id as a key and state as value
+            returnValue = main.TRUE
             intentsDict = self.getIntentState( intentsId )
+
             #print "len of intentsDict ", str( len( intentsDict ) )
             if len( intentsId ) != len( intentsDict ):
                 main.log.info( self.name + "There is something wrong " +
                                "getting intents state" )
                 return main.FALSE
-            returnValue = main.TRUE
-            for intents in intentsDict:
-                if intents.get( 'state' ) != expectedState:
-                    main.log.info( self.name + " : " + intents.get( 'id' ) +
-                                   " actual state = " + intents.get( 'state' )
-                                   + " does not equal expected state = "
-                                   + expectedState )
-                    returnValue = main.FALSE
+
+            if isinstance( expectedState, types.StringType ):
+                for intents in intentsDict:
+                    if intents.get( 'state' ) != expectedState:
+                        main.log.debug( self.name + " : Intent ID - " +
+                                        intents.get( 'id' ) +
+                                        " actual state = " +
+                                        intents.get( 'state' )
+                                        + " does not equal expected state = "
+                                        + expectedState )
+                        returnValue = main.FALSE
+
+            elif isinstance( expectedState, types.ListType ):
+                for intents in intentsDict:
+                    if not any( state == intents.get( 'state' ) for state in
+                                expectedState ):
+                        main.log.debug( self.name + " : Intent ID - " +
+                                        intents.get( 'id' ) +
+                                        " actual state = " +
+                                        intents.get( 'state' ) +
+                                        " does not equal expected states = "
+                                        + str( expectedState ) )
+                        returnValue = main.FALSE
+
             if returnValue == main.TRUE:
                 main.log.info( self.name + ": All " +
                                str( len( intentsDict ) ) +
-                               " intents are in " + expectedState + " state")
+                               " intents are in " + str( expectedState ) +
+                               " state" )
             return returnValue
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
@@ -1822,7 +1843,7 @@
                 cmdStr += " -j"
             handle = self.sendline( cmdStr )
             if re.search( "Error:", handle ):
-                main.log.error( self.name + ".flows() response: " +
+                main.log.error( self.name + ": flows() response: " +
                                 str( handle ) )
             return handle
         except TypeError:
@@ -1857,9 +1878,11 @@
                 for flow in device.get( 'flows' ):
                     if flow.get( 'state' ) != 'ADDED' and flow.get( 'state' ) != \
                             'PENDING_ADD':
+
                         main.log.info( self.name + ": flow Id: " +
-                                       flow.get( 'groupId' ) +
-                                       " | state:" + flow.get( 'state' ) )
+                                       str( flow.get( 'groupId' ) ) +
+                                       " | state:" +
+                                       str( flow.get( 'state' ) ) )
                         returnValue = main.FALSE
 
             return returnValue
@@ -3576,3 +3599,36 @@
             main.cleanup()
             main.exit()
 
+    def summary( self, jsonFormat=True ):
+        """
+        Description: Execute summary command in onos
+        Returns: json object ( summary -j ), returns main.FALSE if there is
+        no output
+
+        """
+        try:
+            cmdStr = "summary"
+            if jsonFormat:
+                cmdStr += " -j"
+            handle = self.sendline( cmdStr )
+
+            if re.search( "Error:", handle ):
+                main.log.error( self.name + ": summary() response: " +
+                                str( handle ) )
+            if not handle:
+                main.log.error( self.name + ": There is no output in " +
+                                "summary command" )
+                return main.FALSE
+            return handle
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
diff --git a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
index 3f41180..75e586f 100644
--- a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
@@ -10,6 +10,7 @@
                 name,
                 host1,
                 host2,
+                onosNode=0,
                 host1Id="",
                 host2Id="",
                 mac1="",
@@ -80,6 +81,7 @@
     topoResult = main.TRUE
     linkDownResult = main.TRUE
     linkUpResult = main.TRUE
+    onosNode = int( onosNode )
 
     if main.hostsData:
         if not h1Mac:
@@ -101,15 +103,29 @@
         return main.FALSE
 
     # Discover hosts using arping
-    main.log.info( itemName + ": Discover host using arping" )
-    main.Mininet1.arping( host=host1 )
-    main.Mininet1.arping( host=host2 )
-    host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
-    host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
+    if not main.hostsData:
+        main.log.info( itemName + ": Discover host using arping" )
+        main.Mininet1.arping( host=host1 )
+        main.Mininet1.arping( host=host2 )
+        host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
+        host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
+
+    # Check flows count in each node
+    checkFlowsCount( main )
+
+    # Checking connectivity before installing intents
+    main.log.info( itemName + ": Check hosts connection before adding intents" )
+    checkPing = pingallHosts( main, hostNames )
+    if not checkPing:
+        main.log.info( itemName + ": Ping did not go through " +
+                       "before adding intents" )
+    else:
+        main.log.debug( itemName + ": Pinged successful before adding " +
+                        "intents,please check fwd app if it is activated" )
 
     # Adding host intents
     main.log.info( itemName + ": Adding host intents" )
-    intent1 = main.CLIs[ 0 ].addHostIntent( hostIdOne=h1Id,
+    intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=h1Id,
                                            hostIdTwo=h2Id )
     intentsId.append( intent1 )
     time.sleep( 5 )
@@ -117,11 +133,14 @@
     # Check intents state
     time.sleep( 30 )
     intentResult = checkIntentState( main, intentsId )
+    checkFlowsCount( main )
 
     # Check intents state again if first check fails...
     if not intentResult:
         intentResult = checkIntentState( main, intentsId )
 
+    # Check flows count in each node
+    checkFlowsCount( main )
     # Verify flows
     checkFlowsState( main )
 
@@ -141,6 +160,8 @@
         linkDownResult = link( main, sw1, sw2, "down" )
         intentResult = intentResult and checkIntentState( main, intentsId )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -162,6 +183,8 @@
         linkUpResult = link( main, sw1, sw2, "up" )
         time.sleep( 5 )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -191,6 +214,7 @@
                  name,
                  host1,
                  host2,
+                 onosNode=0,
                  deviceId1="",
                  deviceId2="",
                  port1="",
@@ -275,10 +299,21 @@
     topoResult = main.TRUE
     linkDownResult = main.TRUE
     linkUpResult = main.TRUE
+    onosNode = int( onosNode )
+
+    # Checking connectivity before installing intents
+    main.log.info( itemName + ": Check hosts connection before adding intents" )
+    checkPing = pingallHosts( main, hostNames )
+    if not checkPing:
+        main.log.info( itemName + ": Ping did not go through " +
+                       "before adding intents" )
+    else:
+        main.log.debug( itemName + ": Pinged successful before adding " +
+                        "intents,please check fwd app if it is activated" )
 
     # Adding bidirectional point  intents
     main.log.info( itemName + ": Adding point intents" )
-    intent1 = main.CLIs[ 0 ].addPointIntent( ingressDevice=deviceId1,
+    intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
                                              egressDevice=deviceId2,
                                              portIngress=port1,
                                              portEgress=port2,
@@ -295,7 +330,7 @@
 
     intentsId.append( intent1 )
     time.sleep( 5 )
-    intent2 = main.CLIs[ 0 ].addPointIntent( ingressDevice=deviceId2,
+    intent2 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
                                              egressDevice=deviceId1,
                                              portIngress=port2,
                                              portEgress=port1,
@@ -314,11 +349,15 @@
     # Check intents state
     time.sleep( 30 )
     intentResult = checkIntentState( main, intentsId )
+    # Check flows count in each node
+    checkFlowsCount( main )
 
     # Check intents state again if first check fails...
     if not intentResult:
         intentResult = checkIntentState( main, intentsId )
 
+    # Check flows count in each node
+    checkFlowsCount( main )
     # Verify flows
     checkFlowsState( main )
 
@@ -338,6 +377,8 @@
         linkDownResult = link( main, sw1, sw2, "down" )
         intentResult = intentResult and checkIntentState( main, intentsId )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -359,6 +400,8 @@
         linkUpResult = link( main, sw1, sw2, "up" )
         time.sleep( 5 )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -387,6 +430,7 @@
 def singleToMultiIntent( main,
                          name,
                          hostNames,
+                         onosNode=0,
                          devices="",
                          ports=None,
                          ethType="",
@@ -461,6 +505,7 @@
     itemName = name
     tempHostsData = {}
     intentsId = []
+    onosNode = int( onosNode )
 
     macsDict = {}
     ipDict = {}
@@ -477,10 +522,12 @@
                 #print "len devices = ", len( devices )
                 #print "len ports = ", len( ports )
                 return main.FALSE
-        for i in range( len( devices ) ):
-            macsDict[ devices[ i ] ] = macs[ i ]
         else:
             main.log.info( "Device Ports are not specified" )
+        if macs:
+            for i in range( len( devices ) ):
+                macsDict[ devices[ i ] ] = macs[ i ]
+
     elif hostNames and not devices and main.hostsData:
         devices = []
         main.log.info( "singleToMultiIntent function is using main.hostsData" ) 
@@ -508,6 +555,20 @@
     if ports:
         portsCopy = copy.copy( ports )
     main.log.info( itemName + ": Adding single point to multi point intents" )
+
+    # Check flows count in each node
+    checkFlowsCount( main )
+
+    # Checking connectivity before installing intents
+    main.log.info( itemName + ": Check hosts connection before adding intents" )
+    checkPing = pingallHosts( main, hostNames )
+    if not checkPing:
+        main.log.info( itemName + ": Ping did not go through " +
+                       "before adding intents" )
+    else:
+        main.log.debug( itemName + ": Pinged successful before adding " +
+                        "intents,please check fwd app if it is activated" )
+
     # Adding bidirectional point  intents
     for i in range( len( devices ) ):
         ingressDevice = devicesCopy[ i ]
@@ -528,7 +589,8 @@
                 main.log.debug( "There is no MAC in device - " + ingressDevice )
                 srcMac = ""
 
-        intentsId.append( main.CLIs[ 0 ].addSinglepointToMultipointIntent(
+        intentsId.append(
+                        main.CLIs[ onosNode ].addSinglepointToMultipointIntent(
                                             ingressDevice=ingressDevice,
                                             egressDeviceList=egressDeviceList,
                                             portIngress=portIngress,
@@ -543,6 +605,8 @@
                                             tcpSrc="",
                                             tcpDst="" ) )
 
+    # Wait some time for the flow to go through when using multi instance
+    time.sleep( 10 )
     pingResult = pingallHosts( main, hostNames )
 
     # Check intents state
@@ -553,6 +617,8 @@
     if not intentResult:
         intentResult = checkIntentState( main, intentsId )
 
+    # Check flows count in each node
+    checkFlowsCount( main )
     # Verify flows
     checkFlowsState( main )
 
@@ -568,6 +634,8 @@
         linkDownResult = link( main, sw1, sw2, "down" )
         intentResult = intentResult and checkIntentState( main, intentsId )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -589,6 +657,8 @@
         linkUpResult = link( main, sw1, sw2, "up" )
         time.sleep( 5 )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -617,6 +687,7 @@
 def multiToSingleIntent( main,
                          name,
                          hostNames,
+                         onosNode=0,
                          devices="",
                          ports=None,
                          ethType="",
@@ -642,7 +713,7 @@
             Verify add-multi-to-single-intent
         Steps:
             - Get device ids | ports
-            - Add single to multi point intents
+            - Add multi to single point intents
             - Check intents
             - Verify flows
             - Ping hosts
@@ -690,6 +761,7 @@
     itemName = name
     tempHostsData = {}
     intentsId = []
+    onosNode = int( onosNode )
 
     macsDict = {}
     ipDict = {}
@@ -706,13 +778,14 @@
                 #print "len devices = ", len( devices )
                 #print "len ports = ", len( ports )
                 return main.FALSE
-        for i in range( len( devices ) ):
-            macsDict[ devices[ i ] ] = macs[ i ]
         else:
             main.log.info( "Device Ports are not specified" )
+        if macs:
+            for i in range( len( devices ) ):
+                macsDict[ devices[ i ] ] = macs[ i ]
     elif hostNames and not devices and main.hostsData:
         devices = []
-        main.log.info( "singleToMultiIntent function is using main.hostsData" ) 
+        main.log.info( "multiToSingleIntent function is using main.hostsData" ) 
         for host in hostNames:
                devices.append( main.hostsData.get( host ).get( 'location' ) )
                macsDict[ main.hostsData.get( host ).get( 'location' ) ] = \
@@ -736,7 +809,21 @@
     devicesCopy = copy.copy( devices )
     if ports:
         portsCopy = copy.copy( ports )
-    main.log.info( itemName + ": Adding single point to multi point intents" )
+    main.log.info( itemName + ": Adding multi point to single point intents" )
+
+    # Check flows count in each node
+    checkFlowsCount( main )
+
+    # Checking connectivity before installing intents
+    main.log.info( itemName + ": Check hosts connection before adding intents" )
+    checkPing = pingallHosts( main, hostNames )
+    if not checkPing:
+        main.log.info( itemName + ": Ping did not go through " +
+                       "before adding intents" )
+    else:
+        main.log.debug( itemName + ": Pinged successful before adding " +
+                        "intents,please check fwd app if it is activated" )
+
     # Adding bidirectional point  intents
     for i in range( len( devices ) ):
         egressDevice = devicesCopy[ i ]
@@ -757,7 +844,8 @@
                 main.log.debug( "There is no MAC in device - " + egressDevice )
                 dstMac = ""
 
-        intentsId.append( main.CLIs[ 0 ].addMultipointToSinglepointIntent(
+        intentsId.append(
+                        main.CLIs[ onosNode ].addMultipointToSinglepointIntent(
                                             ingressDeviceList=ingressDeviceList,
                                             egressDevice=egressDevice,
                                             portIngressList=portIngressList,
@@ -782,6 +870,8 @@
     if not intentResult:
         intentResult = checkIntentState( main, intentsId )
 
+    # Check flows count in each node
+    checkFlowsCount( main )
     # Verify flows
     checkFlowsState( main )
 
@@ -797,6 +887,8 @@
         linkDownResult = link( main, sw1, sw2, "down" )
         intentResult = intentResult and checkIntentState( main, intentsId )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -818,6 +910,8 @@
         linkUpResult = link( main, sw1, sw2, "up" )
         time.sleep( 5 )
 
+        # Check flows count in each node
+        checkFlowsCount( main )
         # Verify flows
         checkFlowsState( main )
 
@@ -914,13 +1008,39 @@
     return statusResult
 
 def checkIntentState( main, intentsId ):
+    """
+        This function will check intent state to make sure all the intents
+        are in INSTALLED state
+    """
 
     intentResult = main.TRUE
+    results = []
 
     main.log.info( itemName + ": Checking intents state" )
+    # First check of intents
     for i in range( main.numCtrls ):
-        intentResult = intentResult and \
-                main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+        tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+        results.append( tempResult )
+
+    expectedState = [ 'INSTALLED', 'INSTALLING' ]
+
+    if all( result == main.TRUE for result in results ):
+        main.log.info( itemName + ": Intents are installed correctly" )
+    else:
+        # Wait for at least 5 second before checking the intents again
+        time.sleep( 5 )
+        results = []
+        # Second check of intents since some of the intents may be in
+        # INSTALLING state, they should be in INSTALLED at this time
+        for i in range( main.numCtrls ):
+            tempResult = main.CLIs[ i ].checkIntentState(
+                                                        intentsId=intentsId )
+            results.append( tempResult )
+        if all( result == main.TRUE for result in results ):
+            main.log.info( itemName + ": Intents are installed correctly" )
+        else:
+            main.log.error( itemName + ": Intents are NOT installed correctly" )
+            intentResult = main.FALSE
 
     return intentResult
 
@@ -965,3 +1085,36 @@
                        "successfully removed all the intents." )
         removeIntentResult = main.TRUE
     return removeIntentResult
+
+def checkFlowsCount( main ):
+    """
+        Check flows count in each node
+    """
+    import json
+
+    flowsCount = []
+    main.log.info( itemName + ": Checking flows count in each ONOS node" )
+    for i in range( main.numCtrls ):
+        summaryResult = main.CLIs[ i ].summary()
+        if not summaryResult:
+            main.log.error( itemName + ": There is something wrong with " +
+                            "summary command" )
+            return main.FALSE
+        else:
+            summaryJson = json.loads( summaryResult )
+            flowsCount.append( summaryJson.get( 'flows' ) )
+
+    if flowsCount:
+        if all( flows==flowsCount[ 0 ] for flows in flowsCount ):
+            main.log.info( itemName + ": There are " + str( flowsCount[ 0 ] ) +
+                           " flows in all ONOS node" )
+        else:
+            for i in range( main.numCtrls ):
+                main.log.debug( itemName + ": ONOS node " + str( i ) + " has " +
+                                flowsCount[ i ] + " flows" )
+    else:
+        main.log.error( "Checking flows count failed, check summary command" )
+        return main.FALSE
+
+    return main.TRUE
+
diff --git a/TestON/tests/FuncIntent/FuncIntent.params b/TestON/tests/FuncIntent/FuncIntent.params
new file mode 100644
index 0000000..e7c8b40
--- /dev/null
+++ b/TestON/tests/FuncIntent/FuncIntent.params
@@ -0,0 +1,34 @@
+<PARAMS>
+
+    <testcases>10,11,12,13,1003</testcases>
+
+    <SCALE>1,3</SCALE>
+    <availableNodes>3</availableNodes>
+    <ENV>
+        <cellName>functionality</cellName>
+        <cellApps>drivers,openflow,proxyarp,mobility</cellApps>
+    </ENV>
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+    <CTRL>
+        <num>3</num>
+        <ip1>OC1</ip1>
+        <port1>6633</port1>
+        <ip2>OC2</ip2>
+        <port2>6633</port2>
+        <ip3>OC3</ip3>
+        <port3>6633</port3>
+    </CTRL>
+    <BENCH>
+        <user>admin</user>
+        <ip1>OCN</ip1>
+    </BENCH>
+    <MININET>
+        <switch>7</switch>
+        <links>20</links>
+        <topo>~/mininet/custom/newFuncTopo.py</topo>
+    </MININET>
+
+</PARAMS>
diff --git a/TestON/tests/FuncIntent/FuncIntent.py b/TestON/tests/FuncIntent/FuncIntent.py
index d5dc2a7..3a716ee 100644
--- a/TestON/tests/FuncIntent/FuncIntent.py
+++ b/TestON/tests/FuncIntent/FuncIntent.py
@@ -223,11 +223,19 @@
         main.case( "Assign switches to controllers" )
         main.step( "Assigning switches to controllers" )
         assignResult = main.TRUE
+        switchList = []
+
+        # Creates a list switch name, use getSwitch() function later...
         for i in range( 1, ( main.numSwitch + 1 ) ):
-            main.Mininet1.assignSwController( sw=str( i ),
-                                              count=1,
-                                              ip1=main.ONOSip[ 0 ],
-                                              port1=main.ONOSport[ 0 ] )
+            switchList.append( 's' + str( i ) )
+
+        assignResult = main.Mininet1.assignSwController( sw=switchList,
+                                                         ip=main.ONOSip,
+                                                         port=main.ONOSport )
+        if not assignResult:
+            main.cleanup()
+            main.exit()
+
         for i in range( 1, ( main.numSwitch + 1 ) ):
             response = main.Mininet1.getSwController( "s" + str( i ) )
             print( "Response is " + str( response ) )
@@ -256,6 +264,25 @@
                                  onpass="Successfully discovered hosts",
                                  onfail="Failed to discover hosts" )
 
+    def CASE14( self, main ):
+        """
+            Stop mininet
+        """
+        main.log.report( "Stop Mininet topology" )
+        main.log.case( "Stop Mininet topology" )
+
+        main.step( "Stopping Mininet Topology" )
+        topoResult = main.Mininet1.stopNet( )
+        stepResult = topoResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully stop mininet",
+                                 onfail="Failed to stop mininet" )
+        # Exit if topology did not load properly
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
     def CASE1001( self, main ):
         """
             Add host intents between 2 host:
@@ -292,6 +319,7 @@
         stepResult = main.TRUE
         main.step( "IPV4: Add host intents between h1 and h9" )
         stepResult = main.wrapper.hostIntent( main,
+                                              onosNode='0',
                                               name='IPV4',
                                               host1='h1',
                                               host2='h9',
@@ -305,8 +333,8 @@
                                  actual=stepResult,
                                  onpass="IPV4: Add host intent successful",
                                  onfail="IPV4: Add host intent failed" )
-        stepResult = main.TRUE
 
+        stepResult = main.TRUE
         main.step( "DUALSTACK1: Add host intents between h3 and h11" )
         stepResult = main.wrapper.hostIntent( main,
                                               name='DUALSTACK',
@@ -325,7 +353,7 @@
                                  onfail="DUALSTACK1: Add host intent failed" )
 
         stepResult = main.TRUE
-        main.step( "DUALSTACK2: Add host intents between h1 and h9" )
+        main.step( "DUALSTACK2: Add host intents between h1 and h11" )
         stepResult = main.wrapper.hostIntent( main,
                                               name='DUALSTACK2',
                                               host1='h1',
@@ -340,6 +368,51 @@
                                         " successful",
                                  onfail="DUALSTACK2: Add host intent failed" )
 
+        stepResult = main.TRUE
+        main.step( "1HOP: Add host intents between h1 and h3" )
+        stepResult = main.wrapper.hostIntent( main,
+                                              name='1HOP',
+                                              host1='h1',
+                                              host2='h3' )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="1HOP: Add host intent" +
+                                        " successful",
+                                 onfail="1HOP: Add host intent failed" )
+
+        stepResult = main.TRUE
+        main.step( "VLAN1: Add vlan host intents between h4 and h12" )
+        stepResult = main.wrapper.hostIntent( main,
+                                              name='VLAN1',
+                                              host1='h4',
+                                              host2='h12',
+                                              host1Id='00:00:00:00:00:04/100',
+                                              host2Id='00:00:00:00:00:0C/100',
+                                              sw1='s5',
+                                              sw2='s2',
+                                              expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="VLAN1: Add vlan host" +
+                                        " intent successful",
+                                 onfail="VLAN1: Add vlan host intent failed" )
+
+        stepResult = main.TRUE
+        main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
+        stepResult = main.wrapper.hostIntent( main,
+                                              name='VLAN2',
+                                              host1='h13',
+                                              host2='h20' )
+
+        utilities.assert_equals( expect=main.FALSE,
+                                 actual=stepResult,
+                                 onpass="VLAN2: Add inter vlan host" +
+                                        " intent successful",
+                                 onfail="VLAN2: Add inter vlan host" +
+                                        " intent failed" )
+
     def CASE1002( self, main ):
         """
             Add point intents between 2 hosts:
@@ -374,7 +447,26 @@
         main.case( "Add point intents between 2 devices" )
 
         stepResult = main.TRUE
-        main.step( "IPV4: Add point intents between h1 and h9" )
+        # No option point intents
+        main.step( "NOOPTION: Add point intents between h1 and h9" )
+        stepResult = main.wrapper.pointIntent(
+                                       main,
+                                       name="NOOPTION",
+                                       host1="h1",
+                                       host2="h9",
+                                       deviceId1="of:0000000000000005/1",
+                                       deviceId2="of:0000000000000006/1",
+                                       sw1="s5",
+                                       sw2="s2",
+                                       expectedLink=18 )
+
+        stepResult = main.TRUE
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="NOOPTION: Add point intent successful",
+                                 onfail="NOOPTION: Add point intent failed" )
+
+        stepResult = main.TRUE
         stepResult = main.wrapper.pointIntent(
                                        main,
                                        name="IPV4",
@@ -404,6 +496,28 @@
                                  onfail="IPV4: Add point intent failed" )
 
         stepResult = main.TRUE
+        stepResult = main.wrapper.pointIntent(
+                                       main,
+                                       name="IPV4_2",
+                                       host1="h1",
+                                       host2="h9",
+                                       deviceId1="of:0000000000000005/1",
+                                       deviceId2="of:0000000000000006/1",
+                                       ipProto=1,
+                                       ip1="",
+                                       ip2="",
+                                       tcp1="",
+                                       tcp2="",
+                                       sw1="s5",
+                                       sw2="s2",
+                                       expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="IPV4_2: Add point intent successful",
+                                 onfail="IPV4_2: Add point intent failed" )
+
+        stepResult = main.TRUE
         main.step( "DUALSTACK1: Add point intents between h1 and h9" )
         stepResult = main.wrapper.pointIntent(
                                        main,
@@ -432,7 +546,49 @@
                                  actual=stepResult,
                                  onpass="DUALSTACK1: Add point intent" +
                                         " successful",
-                                 onfail="DUALSTACK1: Add point intent failed" )
+                                 onfail="DUALSTACK1: Add point intent failed" ) 
+        stepResult = main.TRUE
+        main.step( "VLAN: Add point intents between h5 and h21" )
+        stepResult = main.wrapper.pointIntent(
+                                       main,
+                                       name="VLAN",
+                                       host1="h5",
+                                       host2="h21",
+                                       deviceId1="of:0000000000000005/5",
+                                       deviceId2="of:0000000000000007/5",
+                                       port1="",
+                                       port2="",
+                                       ethType="IPV4",
+                                       mac1="00:00:00:00:00:05",
+                                       mac2="00:00:00:00:00:15",
+                                       bandwidth="",
+                                       lambdaAlloc=False,
+                                       ipProto="",
+                                       ip1="",
+                                       ip2="",
+                                       tcp1="",
+                                       tcp2="",
+                                       sw1="s5",
+                                       sw2="s2",
+                                       expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="VLAN: Add point intent successful",
+                                 onfail="VLAN: Add point intent failed" )
+
+        stepResult = main.TRUE
+        main.step( "1HOP: Add point intents between h1 and h3" )
+        stepResult = main.wrapper.hostIntent( main,
+                                              name='1HOP',
+                                              host1='h1',
+                                              host2='h3' )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="1HOP: Add point intent" +
+                                        " successful",
+                                 onfail="1HOP: Add point intent failed" )
 
     def CASE1003( self, main ):
         """
@@ -462,11 +618,30 @@
         main.case( "Add single point to multi point intents between devices" )
 
         stepResult = main.TRUE
-        main.step( "IPV4: Add single point to multi point intents" )
         hostNames = [ 'h8', 'h16', 'h24' ]
         devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
                     'of:0000000000000007/8' ]
         macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
+
+        main.step( "NOOPTION: Add single point to multi point intents" )
+        stepResult = main.wrapper.singleToMultiIntent(
+                                         main,
+                                         name="NOOPTION",
+                                         hostNames=hostNames,
+                                         devices=devices,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="NOOPTION: Successfully added single "
+                                        + " point to multi point intents",
+                                 onfail="NOOPTION: Failed to add single point" +
+                                        " to multi point intents" )
+
+        stepResult = main.TRUE
+        main.step( "IPV4: Add single point to multi point intents" )
         stepResult = main.wrapper.singleToMultiIntent(
                                          main,
                                          name="IPV4",
@@ -491,6 +666,7 @@
                                  onfail="IPV4: Failed to add single point" +
                                         " to multi point intents" )
 
+        stepResult = main.TRUE
         main.step( "IPV4_2: Add single point to multi point intents" )
         hostNames = [ 'h8', 'h16', 'h24' ]
         stepResult = main.wrapper.singleToMultiIntent(
@@ -502,10 +678,40 @@
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
-                                 onpass="IPV4_2: Successfully added single point"
-                                        + " to multi point intents",
+                                 onpass="IPV4_2: Successfully added single "
+                                        + " point to multi point intents",
                                  onfail="IPV4_2: Failed to add single point" +
                                         " to multi point intents" )
+        stepResult = main.TRUE
+        main.step( "VLAN: Add single point to multi point intents" )
+        hostNames = [ 'h4', 'h12', 'h20' ]
+        devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
+                    'of:0000000000000007/4' ]
+        macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ]
+        stepResult = main.wrapper.singleToMultiIntent(
+                                         main,
+                                         name="VLAN",
+                                         hostNames=hostNames,
+                                         devices=devices,
+                                         ports=None,
+                                         ethType="IPV4",
+                                         macs=macs,
+                                         bandwidth="",
+                                         lambdaAlloc=False,
+                                         ipProto="",
+                                         ipAddresses="",
+                                         tcp="",
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="VLAN: Successfully added single point"
+                                        + " to multi point intents",
+                                 onfail="VLAN: Failed to add single point" +
+                                        " to multi point intents" ) 
+
     def CASE1004( self, main ):
         """
             Add multi point to single point intents
@@ -523,7 +729,7 @@
                     - Verify flows
                     - Check topology
                     - Ping hosts
-                - Remove intents
+             - Remove intents
         """
         assert main, "There is no main"
         assert main.CLIs, "There is no main.CLIs"
@@ -534,11 +740,30 @@
         main.case( "Add multi point to single point intents between devices" )
 
         stepResult = main.TRUE
-        main.step( "IPV4: Add multi point to single point intents" )
         hostNames = [ 'h8', 'h16', 'h24' ]
         devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
                     'of:0000000000000007/8' ]
         macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
+
+        main.step( "NOOPTION: Add multi point to single point intents" )
+        stepResult = main.wrapper.multiToSingleIntent(
+                                         main,
+                                         name="NOOPTION",
+                                         hostNames=hostNames,
+                                         devices=devices,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="NOOPTION: Successfully added multi "
+                                        + " point to single point intents",
+                                 onfail="NOOPTION: Failed to add multi point" +
+                                        " to single point intents" )
+
+        stepResult = main.TRUE
+        main.step( "IPV4: Add multi point to single point intents" )
         stepResult = main.wrapper.multiToSingleIntent(
                                          main,
                                          name="IPV4",
@@ -563,6 +788,7 @@
                                  onfail="IPV4: Failed to add multi point" +
                                         " to single point intents" )
 
+        stepResult = main.TRUE
         main.step( "IPV4_2: Add multi point to single point intents" )
         hostNames = [ 'h8', 'h16', 'h24' ]
         stepResult = main.wrapper.multiToSingleIntent(
@@ -578,3 +804,33 @@
                                         + " to single point intents",
                                  onfail="IPV4_2: Failed to add multi point" +
                                         " to single point intents" )
+
+        stepResult = main.TRUE
+        main.step( "VLAN: Add multi point to single point intents" )
+        hostNames = [ 'h5', 'h13', 'h21' ]
+        devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
+                    'of:0000000000000007/5' ]
+        macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ]
+        stepResult = main.wrapper.multiToSingleIntent(
+                                         main,
+                                         name="VLAN",
+                                         hostNames=hostNames,
+                                         devices=devices,
+                                         ports=None,
+                                         ethType="IPV4",
+                                         macs=macs,
+                                         bandwidth="",
+                                         lambdaAlloc=False,
+                                         ipProto="",
+                                         ipAddresses="",
+                                         tcp="",
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="VLAN: Successfully added multi point"
+                                        + " to single point intents",
+                                 onfail="VLAN: Failed to add multi point" +
+                                        " to single point intents" )
diff --git a/TestON/tests/FuncStartTemplate/FuncStartTemplate.params b/TestON/tests/FuncStartTemplate/FuncStartTemplate.params
index 310e5f8..04f6110 100755
--- a/TestON/tests/FuncStartTemplate/FuncStartTemplate.params
+++ b/TestON/tests/FuncStartTemplate/FuncStartTemplate.params
@@ -1,11 +1,10 @@
 <PARAMS>
-
     <testcases>10,9,10,9</testcases>
 
-    <SCALE>3,1</SCALE>
+    <SCALE>1,3</SCALE>
     <availableNodes>3</availableNodes>
     <ENV>
-        <cellName>single_func</cellName>
+        <cellName>functionality</cellName>
         <cellApps>drivers,openflow,proxyarp,mobility</cellApps>
     </ENV>
     <GIT>
diff --git a/TestON/tests/FuncStartTemplate/FuncStartTemplate.py b/TestON/tests/FuncStartTemplate/FuncStartTemplate.py
index 4beefae..59c242c 100644
--- a/TestON/tests/FuncStartTemplate/FuncStartTemplate.py
+++ b/TestON/tests/FuncStartTemplate/FuncStartTemplate.py
@@ -15,12 +15,13 @@
     def CASE10( self, main ):
         import time
         import os
+        import imp
         """
         Startup sequence:
+        git pull
         cell <name>
         onos-verify-cell
         onos-remove-raft-log
-        git pull
         mvn clean install
         onos-package
         onos-install -f
@@ -44,6 +45,8 @@
         main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
         main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
         main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
+        main.ONOSport = []
+        main.hostsData = {}
         PULLCODE = False
         if main.params[ 'GIT' ][ 'pull' ] == 'True':
             PULLCODE = True
@@ -51,12 +54,12 @@
         main.CLIs = []
         for i in range( 1, int( main.numCtrls ) + 1 ):
             main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+            main.ONOSport.append( main.params[ 'CTRL' ][ 'port' + str( i ) ] )
 
         # -- INIT SECTION, ONLY RUNS ONCE -- #
         if init == False:
             init = True
 
-            main.ONOSport = []
             main.scale = ( main.params[ 'SCALE' ] ).split( "," )
             main.numCtrls = int( main.scale[ 0 ] )
 
@@ -80,43 +83,21 @@
                                "clean install" )
 
             globalONOSip = main.ONOSbench.getOnosIps()
-        
-        maxNodes = ( len(globalONOSip) - 2 )
+
+        maxNodes = ( len( globalONOSip ) - 2 )
 
         main.numCtrls = int( main.scale[ 0 ] )
         main.scale.remove( main.scale[ 0 ] )
 
         main.ONOSip = []
-        for i in range( maxNodes ): 
-            main.ONOSip.append( globalONOSip[i] )
+        for i in range( maxNodes ):
+            main.ONOSip.append( globalONOSip[ i ] )
 
-
-        
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
                        " before initiating enviornment setup" )
-        for i in range(maxNodes):
+        for i in range( maxNodes ):
             main.ONOSbench.onosDie( globalONOSip[ i ] )
-        
-        """
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " + \
-                                        "environment",
-                                 onfail="Failed to apply cell to environment " )
-        """
-        """main.step( "Removing raft logs" )
-        removeRaftResult = main.ONOSbench.onosRemoveRaftLogs()
-        stepResult = removeRaftResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully removed raft logs",
-                                 onfail="Failed to remove raft logs" )
-        """
 
         print "NODE COUNT = ", main.numCtrls
         main.log.info( "Creating cell file" )
@@ -190,24 +171,31 @@
                                  actual=stepResult,
                                  onpass="ONOS service is ready",
                                  onfail="ONOS service did not start properly" )
-        
+
         main.step( "Start ONOS cli" )
         cliResult = main.TRUE
         for i in range( main.numCtrls ):
             cliResult = cliResult and \
-                        main.CLIs[i].startOnosCli( main.ONOSip[ i ] )
+                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
         stepResult = cliResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully start ONOS cli",
                                  onfail="Failed to start ONOS cli" )
-    
-    def CASE9( self, main ): 
+
+    def CASE9( self, main ):
         '''
-            Report errors/warnings/exceptions 
+            Report errors/warnings/exceptions
         '''
-        main.log.info("Error report: \n") 
-        main.ONOSbench.logReport( globalONOSip[0], [ "INFO","FOLLOWER","WARN","flow","ERROR","Except" ], "s" )  
+        main.log.info("Error report: \n" )
+        main.ONOSbench.logReport( globalONOSip[ 0 ],
+                                  [ "INFO",
+                                    "FOLLOWER",
+                                    "WARN",
+                                    "flow",
+                                    "ERROR",
+                                    "Except" ],
+                                  "s" )
         #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
 
     def CASE11( self, main ):
diff --git a/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo b/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo
index 2321da0..e6613de 100755
--- a/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo
+++ b/TestON/tests/FuncStartTemplate/FuncStartTemplate.topo
@@ -8,7 +8,7 @@
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
             <COMPONENTS>
-                <home>~/onos</home>
+                <home>~/ONOS</home>
             </COMPONENTS>
         </ONOSbench>
 
diff --git a/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
new file mode 100644
index 0000000..41b3258
--- /dev/null
+++ b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
@@ -0,0 +1,344 @@
+"""
+    Wrapper function for FuncTopo
+    Includes onosclidriver and mininetclidriver functions
+"""
+import time
+import json
+import re
+
+def __init__( self ):
+    self.default = ''
+
+def testTopology( main, topoFile='', args='', mnCmd='', clean=True ):
+    """
+    Description:
+        This function combines different wrapper functions in this module
+        to simulate a topology test
+    Test Steps:
+        - Load topology
+        - Discover topology
+        - Compare topology
+        - pingall
+        - Bring links down
+        - Compare topology
+        - pingall
+        - Bring links up
+        - Compare topology
+        - pingall
+    Options:
+        clean: Does sudo mn -c to clean mininet residue
+        Please read mininetclidriver.py >> startNet( .. ) function for details
+    Returns:
+        Returns main.TRUE if the test is successful, main.FALSE otherwise
+    """
+    testTopoResult = main.TRUE
+    compareTopoResult = main.TRUE
+    topoObjectResult = main.TRUE
+    stopResult = main.TRUE
+
+    if clean:
+        # Cleans minient
+        stopResult = stopMininet( main )
+
+    # Restart ONOS to clear hosts test new mininet topology
+    restartONOSResult = restartONOS( main )
+
+    # Starts topology
+    startResult = startNewTopology( main, topoFile, args, mnCmd )
+
+    # Gets list of switches in mininet
+    assignSwitch( main )
+
+    # This function activates fwd app then does pingall as well as store
+    # hosts data in a variable main.hostsData
+    getHostsResult = getHostsData( main )
+
+    # Create topology object using sts
+    topoObjectResult = createTopoObject( main )
+
+    # Compare Topology
+    compareTopoResult = compareTopo( main )
+
+    testTopoResult = startResult and topoObjectResult and \
+                     compareTopoResult and getHostsResult
+
+
+    return testTopoResult
+
+def startNewTopology( main, topoFile='', args='', mnCmd='' ):
+    """
+    Description:
+        This wrapper function starts new topology
+    Options:
+        Please read mininetclidriver.py >> startNet( .. ) function for details
+    Return:
+        Returns main.TRUE if topology is successfully created by mininet,
+        main.FALSE otherwise
+    NOTE:
+        Assumes Mininet1 is the name of the handler
+    """
+    assert main, "There is no main variable"
+    assert main.Mininet1, "Mininet 1 is not created"
+    result = main.TRUE
+
+    main.log.info( main.topoName + ": Starting new Mininet topology" )
+
+    # log which method is being used
+    if topoFile:
+        main.log.info( main.topoName + ": Starting topology with " +
+                       topoFile + "topology file" )
+    elif not topoFile and not mnCmd:
+        main.log.info( main.topoName + ": Starting topology using" +
+                       " the topo file" )
+    elif topoFile and mnCmd:
+        main.log.error( main.topoName + ": You can only use one " +
+                        "method to start a topology" )
+    elif mnCmd:
+        main.log.info( main.topoName + ": Starting topology with '" +
+                       mnCmd + "' Mininet command" )
+
+
+    result = main.Mininet1.startNet( topoFile=topoFile,
+                                     args=args,
+                                     mnCmd=mnCmd )
+
+    return result
+
+def stopMininet( main ):
+    """
+        Stops current topology and execute mn -c basically triggers
+        stopNet in mininetclidrivers
+
+        NOTE: Mininet should be running when issuing this command other wise
+        the this function will cause the test to stop
+    """
+    stopResult = main.TRUE
+    stopResult = main.Mininet1.stopNet()
+    time.sleep( 30 )
+    if not stopResult:
+        main.log.info(  main.topoName + ": Did not stop Mininet topology" )
+    return stopResult
+
+def createTopoObject( main ):
+    """
+        Creates topology object using sts module
+    """
+    from sts.topology.teston_topology import TestONTopology
+    global MNTopo
+    try:
+        ctrls = []
+        main.log.info(  main.topoName + ": Creating topology object" +
+                        " from mininet" )
+        for node in main.nodes:
+            temp = ( node, node.name, node.ip_address, 6633 )
+            ctrls.append( temp )
+        MNTopo = TestONTopology( main.Mininet1, ctrls )
+    except Exception:
+        objResult = main.FALSE
+    else:
+        objResult = main.TRUE
+
+    return objResult
+
+def compareTopo( main ):
+    """
+        Compare topology( devices, links, ports, hosts ) between ONOS and
+        mininet using sts
+    """
+    assert MNTopo, "There is no MNTopo object"
+    devices = []
+    links = []
+    ports = []
+    hosts = []
+    switchResult = []
+    linksResult = []
+    portsResult = []
+    hostsResult = []
+    compareTopoResult = main.TRUE
+
+    for i in range( main.numCtrls ):
+        devices.append( json.loads( main.CLIs[ i ].devices() ) )
+        links.append( json.loads( main.CLIs[ i ].links() ) )
+        ports.append( json.loads(  main.CLIs[ i ].ports() ) )
+        hosts.append( json.loads( main.CLIs[ i ].hosts() ) )
+
+    # Comparing switches
+    main.log.info( main.topoName + ": Comparing switches in each ONOS nodes" +
+                   " with Mininet" )
+    for i in range( main.numCtrls ):
+        tempResult = main.Mininet1.compareSwitches( MNTopo, devices[ i ] )
+        switchResult.append( tempResult )
+        if tempResult == main.FALSE:
+            main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+                            " switch view is incorrect " )
+
+    if all( result == main.TRUE for result in switchResult ):
+        main.log.info( main.topoName + ": Switch view in all ONOS nodes "+
+                       "are correct " )
+    else:
+        compareTopoResult = main.FALSE
+
+    # Comparing ports
+    main.log.info( main.topoName + ": Comparing ports in each ONOS nodes" +
+                   " with Mininet" )
+    for i in range( main.numCtrls ):
+        tempResult = main.Mininet1.comparePorts( MNTopo, ports[ i ] )
+        portsResult.append( tempResult )
+        if tempResult == main.FALSE:
+            main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+                            " ports view are incorrect " )
+
+    if all( result == main.TRUE for result in portsResult ):
+        main.log.info( main.topoName + ": Ports view in all ONOS nodes "+
+                       "are correct " )
+    else:
+        compareTopoResult = main.FALSE
+
+    # Comparing links
+    main.log.info( main.topoName + ": Comparing links in each ONOS nodes" +
+                   " with Mininet" )
+    for i in range( main.numCtrls ):
+        tempResult = main.Mininet1.compareLinks( MNTopo, links[ i ] )
+        linksResult.append( tempResult )
+        if tempResult == main.FALSE:
+            main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+                            " links view are incorrect " )
+
+    if all( result == main.TRUE for result in linksResult ):
+        main.log.info( main.topoName + ": Links view in all ONOS nodes "+
+                       "are correct " )
+    else:
+        compareTopoResult = main.FALSE
+
+    # Comparing hosts
+    main.log.info( main.topoName + ": Comparing hosts in each ONOS nodes" +
+                   " with Mininet" )
+    for i in range( main.numCtrls ):
+        tempResult = main.Mininet1.compareHosts( MNTopo, hosts[ i ] )
+        hostsResult.append( tempResult )
+        if tempResult == main.FALSE:
+            main.log.error( main.topoName + ": ONOS-" + str( i + 1 ) +
+                            " hosts view are incorrect " )
+
+    if all( result == main.TRUE for result in hostsResult ):
+        main.log.info( main.topoName + ": Hosts view in all ONOS nodes "+
+                       "are correct " )
+    else:
+        compareTopoResult = main.FALSE
+
+    return compareTopoResult
+
+def assignSwitch( main ):
+    """
+        Returns switch list using getSwitch in Mininet driver
+    """
+    switchList = []
+    assignResult = main.TRUE
+    switchList =  main.Mininet1.getSwitch()
+    assignResult = main.Mininet1.assignSwController( sw=switchList,
+                                                     ip=main.ONOSip[ 0 ],
+                                                     port=6633 )
+
+    for sw in switchList:
+        response = main.Mininet1.getSwController( sw )
+        if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
+            assignResult = assignResult and main.TRUE
+        else:
+            assignResult = main.FALSE
+
+    return switchList
+
+def getHostsData( main ):
+    """
+        Use fwd app and pingall to discover all the hosts
+    """
+    activateResult = main.TRUE
+    appCheck = main.TRUE
+    getDataResult = main.TRUE
+    main.log.info( main.topoName + ": Activating reactive forwarding app " )
+    activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
+    if main.hostsData:
+        main.hostsData = {}
+    for i in range( main.numCtrls ):
+        appCheck = appCheck and main.CLIs[ i ].appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.CLIs[ i ].apps() )
+            main.log.warn( main.CLIs[ i ].appIDs() )
+
+    pingResult = main.Mininet1.pingall( timeout=900 )
+    hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
+    hosts = main.Mininet1.getHosts()
+    for host in hosts:
+        main.hostsData[ host ] = {}
+        main.hostsData[ host ][ 'mac' ] =  \
+            main.Mininet1.getMacAddress( host ).upper()
+        for hostj in hostsJson:
+            if main.hostsData[ host ][ 'mac' ] == hostj[ 'mac' ]:
+                main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
+                main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
+                main.hostsData[ host ][ 'location' ] = \
+                            hostj[ 'location' ][ 'elementId' ] + '/' + \
+                            hostj[ 'location' ][ 'port' ]
+                main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
+
+    if activateResult and main.hostsData:
+        main.log.info( main.topoName + ": Successfully used fwd app" +
+                       " to discover hosts " )
+        getDataResult = main.TRUE
+    else:
+        main.log.info( main.topoName + ": Failed to use fwd app" +
+                       " to discover hosts " )
+        getDataResult = main.FALSE
+
+    # This data can be use later for intents
+    print main.hostsData
+
+    return getDataResult
+
+def restartONOS( main ):
+    """
+    Description:
+        Stop and start ONOS that clears hosts,devices etc. in order to test
+        new mininet topology
+    Return:
+        Retruns main.TRUE for a successful restart, main.FALSE otherwise.
+    """
+    stopResult = []
+    startResult = []
+    restartResult = main.TRUE
+
+    main.log.info( main.topoName + ": Stopping ONOS cluster" )
+    for node in main.nodes:
+        startResult.append( main.ONOSbench.onosStop( nodeIp=node.ip_address ) )
+
+    if all( result == main.TRUE for result in stopResult ):
+        main.log.info( main.topoName + ": Successfully stopped ONOS cluster" )
+    else:
+        restartResult = main.FALSE
+        main.log.error( main.topoName + ": Failed to stop ONOS cluster" )
+
+    time.sleep( 15 )
+
+    main.log.info( main.topoName + ": Starting ONOS cluster" )
+    for node in main.nodes:
+        startResult.append( main.ONOSbench.onosStart( nodeIp=node.ip_address ) )
+
+    if all( result == main.TRUE for result in startResult ):
+        main.log.info( main.topoName + ": Successfully start ONOS cluster" )
+    else:
+        restartResult = main.FALSE
+        main.log.error( main.topoName + ": Failed to start ONOS cluster" )
+
+    # Start ONOS CLIs again
+    main.log.info( main.topoName + ": Starting ONOS CLI" )
+    cliResult = main.TRUE
+    for i in range( main.numCtrls ):
+        cliResult = cliResult and \
+                    main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
+
+    time.sleep( 15 )
+
+    return restartResult
+
+
+
diff --git a/TestON/tests/FuncTopo/FuncTopo.py b/TestON/tests/FuncTopo/FuncTopo.py
new file mode 100644
index 0000000..b2e2a6a
--- /dev/null
+++ b/TestON/tests/FuncTopo/FuncTopo.py
@@ -0,0 +1,218 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import json
+
+class FuncTopo:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE10( self, main ):
+        import time
+        import os
+        import imp
+        """
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-log
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        """
+        global init
+        global globalONOSip
+        try:
+            if type(init) is not bool:
+                init = False
+        except NameError:
+            init = False
+
+        main.wrapper = imp.load_source( 'FuncTopoFunction', '/home/admin/' +
+                                        'TestON/tests/FuncTopo/Dependency/' +
+                                        'FuncTopoFunction.py')
+
+        #Local variables
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        apps = main.params[ 'ENV' ][ 'cellApps' ]
+        gitBranch = main.params[ 'GIT' ][ 'branch' ]
+        benchIp = os.environ[ 'OCN' ]
+        benchUser = main.params[ 'BENCH' ][ 'user' ]
+        topology = main.params[ 'MININET' ][ 'topo' ]
+        main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
+        main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
+        main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
+        main.ONOSport = []
+        main.hostsData = {}
+        main.topoName = " "
+        PULLCODE = False
+        if main.params[ 'GIT' ][ 'pull' ] == 'True':
+            PULLCODE = True
+        main.case( "Setting up test environment" )
+        main.CLIs = []
+        main.nodes = []
+        for i in range( 1, int( main.numCtrls ) + 1 ):
+            main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+            main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+            main.ONOSport.append( main.params[ 'CTRL' ][ 'port' + str( i ) ] )
+
+        # -- INIT SECTION, ONLY RUNS ONCE -- #
+        if init == False:
+            init = True
+
+            main.scale = ( main.params[ 'SCALE' ] ).split( "," )
+            main.numCtrls = int( main.scale[ 0 ] )
+
+            if PULLCODE:
+                main.step( "Git checkout and pull " + gitBranch )
+                main.ONOSbench.gitCheckout( gitBranch )
+                gitPullResult = main.ONOSbench.gitPull()
+                if gitPullResult == main.ERROR:
+                    main.log.error( "Error pulling git branch" )
+                main.step( "Using mvn clean & install" )
+                cleanInstallResult = main.ONOSbench.cleanInstall()
+                stepResult = cleanInstallResult
+                utilities.assert_equals( expect=main.TRUE,
+                                         actual=stepResult,
+                                         onpass="Successfully compiled " +
+                                                "latest ONOS",
+                                         onfail="Failed to compile " +
+                                                "latest ONOS" )
+            else:
+                main.log.warn( "Did not pull new code so skipping mvn " +
+                               "clean install" )
+
+            globalONOSip = main.ONOSbench.getOnosIps()
+        maxNodes = ( len(globalONOSip) - 2 )
+
+        main.numCtrls = int( main.scale[ 0 ] )
+        main.scale.remove( main.scale[ 0 ] )
+
+        main.ONOSip = []
+        for i in range( maxNodes ):
+            main.ONOSip.append( globalONOSip[i] )
+
+        #kill off all onos processes
+        main.log.info( "Safety check, killing all ONOS processes" +
+                       " before initiating enviornment setup" )
+        for i in range(maxNodes):
+            main.ONOSbench.onosDie( globalONOSip[ i ] )
+
+        print "NODE COUNT = ", main.numCtrls
+        main.log.info( "Creating cell file" )
+        cellIp = []
+        for i in range( main.numCtrls ):
+            cellIp.append( str( main.ONOSip[ i ] ) )
+        print cellIp
+        main.ONOSbench.createCellFile( benchIp, cellName, "",
+                                       str( apps ), *cellIp )
+
+        main.step( "Apply cell to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+        stepResult = cellResult and verifyResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully applied cell to " + \
+                                        "environment",
+                                 onfail="Failed to apply cell to environment " )
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+        stepResult = packageResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully created ONOS package",
+                                 onfail="Failed to create ONOS package" )
+
+        main.step( "Uninstalling ONOS package" )
+        onosUninstallResult = main.TRUE
+        for i in range( main.numCtrls ):
+            onosUninstallResult = onosUninstallResult and \
+                    main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
+        stepResult = onosUninstallResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully uninstalled ONOS package",
+                                 onfail="Failed to uninstall ONOS package" )
+        time.sleep( 5 )
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.TRUE
+        for i in range( main.numCtrls ):
+            onosInstallResult = onosInstallResult and \
+                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
+        stepResult = onosInstallResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully installed ONOS package",
+                                 onfail="Failed to install ONOS package" )
+
+        time.sleep( 10 )
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+        for i in range( main.numCtrls ):
+            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up, stop and " +
+                             "start ONOS again " )
+            for i in range( main.numCtrls ):
+                stopResult = stopResult and \
+                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
+            for i in range( main.numCtrls ):
+                startResult = startResult and \
+                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
+        stepResult = onosIsUp and stopResult and startResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS service is ready",
+                                 onfail="ONOS service did not start properly" )
+
+    def CASE9( self, main ):
+        '''
+            Report errors/warnings/exceptions
+        '''
+        main.log.info("Error report: \n")
+        main.ONOSbench.logReport( globalONOSip[0],
+                                  [ "INFO","FOLLOWER","WARN",
+                                    "flow","ERROR","Except" ],
+                                  "s" )
+        #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
+
+    def CASE1001( self, main ):
+        """
+            Test topology discovery
+        """
+        main.case( "Topology discovery test" )
+
+
+        main.step( "Torus 5-5 topology" )
+        main.topoName = "TORUS5-5"
+        mnCmd = "mn --topo=torus,5,5 --mac"
+        stepResult = main.wrapper.testTopology( main,
+                                                mnCmd=mnCmd,
+                                                clean=False )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Torus 5-5 topology successful",
+                                 onfail="Torus 5-5 topology failed" )
+
+        main.topoName = "TREE3-3"
+        stepResult = main.TRUE
+        main.step( "Tree 3-3 topology" )
+        mnCmd = "mn --topo=tree,3,3 --mac"
+        stepResult = main.wrapper.testTopology( main,
+                                                mnCmd=mnCmd,
+                                                clean=True )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Tree 3-3 topology successful",
+                                 onfail="Tree 3-3 topology failed" )
diff --git a/TestON/tests/PingallExample/__init__.py b/TestON/tests/FuncTopo/__init__.py
similarity index 100%
rename from TestON/tests/PingallExample/__init__.py
rename to TestON/tests/FuncTopo/__init__.py
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.py b/TestON/tests/IntentEventTP/IntentEventTP.py
index 9682507..44178b2 100644
--- a/TestON/tests/IntentEventTP/IntentEventTP.py
+++ b/TestON/tests/IntentEventTP/IntentEventTP.py
@@ -87,7 +87,10 @@
          
         clusterCount = int(scale[0])
         scale.remove(scale[0])       
-        
+       
+        MN1Ip = ONOSIp[len(ONOSIp) -1]
+        BENCHIp = ONOSIp[len(ONOSIp) -2]
+ 
         #kill off all onos processes 
         main.log.step("Safety check, killing all ONOS processes")
         main.log.step("before initiating enviornment setup")
@@ -108,7 +111,7 @@
         cellIp = []
         for node in range (1, clusterCount + 1):
             cellIp.append(ONOSIp[node])
-
+         
         main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
 
         main.step( "Set Cell" )