Merge branch 'master' of https://github.com/opennetworkinglab/ONLabTest into devl/newFunctionality
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 57d8c9b..b7e96a1 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
@@ -95,7 +96,7 @@
             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.
@@ -130,26 +131,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 +375,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 +400,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 +419,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" )
@@ -1189,7 +1195,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()
 
@@ -2010,6 +2016,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 5207f1e..1d57271 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1758,11 +1758,19 @@
             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 intents.get( 'state' ) == "INSTALLING":
+                        main.log.debug( self.name + " : Intent ID - " +
+                                        intents.get( 'id' ) +
+                                        " is in INSTALLING state" )
+                        returnValue = main.TRUE
+                    else:
+                        main.log.info( self.name + " : Intent ID - " +
+                                       intents.get( 'id' ) +
+                                       " actual state = " +
+                                       intents.get( 'state' )
+                                       + " does not equal expected state = "
+                                       + expectedState )
+                        returnValue = main.FALSE
             if returnValue == main.TRUE:
                 main.log.info( self.name + ": All " +
                                str( len( intentsDict ) ) +
@@ -1794,7 +1802,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:
@@ -1829,9 +1837,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
@@ -3548,3 +3558,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..3ceb24b 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 )
 
@@ -916,11 +1010,17 @@
 def checkIntentState( main, intentsId ):
 
     intentResult = main.TRUE
+    results = []
 
     main.log.info( itemName + ": Checking intents state" )
     for i in range( main.numCtrls ):
-        intentResult = intentResult and \
-                main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+        intentResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+        results.append( intentResult )
+
+    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" )
 
     return intentResult
 
@@ -965,3 +1065,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.py b/TestON/tests/FuncIntent/FuncIntent.py
index d5dc2a7..d74f9a9 100644
--- a/TestON/tests/FuncIntent/FuncIntent.py
+++ b/TestON/tests/FuncIntent/FuncIntent.py
@@ -256,6 +256,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 +311,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 +325,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 +345,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 +360,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 +439,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 +488,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 +538,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 +610,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 +658,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 +670,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 +721,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 +732,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 +780,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 +796,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/FuncTopo/Dependency/FuncTopoFunction.py b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
new file mode 100644
index 0000000..121a6dc
--- /dev/null
+++ b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
@@ -0,0 +1,252 @@
+"""
+    Wrapper function for FuncTopo
+    Includes onosclidriver and mininetclidriver functions
+"""
+import time
+import json
+
+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
+
+        Returns:
+            Returns main.TRUE if the test is successful, main.FALSE otherwise
+    """
+    testTopoResult = main.TRUE
+    compareTopoResult = main.TRUE
+    topoObjectResult = main.TRUE
+
+    # Starts topology
+    startResult = startNewTopology( main, topoFile, args, mnCmd, clean )
+
+    # Create topology object using sts
+    topoObjectResult = createTopoObject( main )
+
+    # Compare Topology
+    compareTopoResult = compareTopo( main )
+
+    # This function activates fwd app then does pingall as well as store
+    # hosts data in a variable main.hostsData
+    getHostsResult = getHostsData( main )
+
+    testTopoResult = startResult and topoObjectResult and \
+                     compareTopoResult and getHostsResult
+
+    return testTopoResult
+
+def startNewTopology( main, topoFile='', args='', mnCmd='', clean=True ):
+    """
+    Description:
+        This wrapper function starts new topology
+    Optional:
+        clean - Stops current topology and execute mn -c basically triggers
+                stopNet in mininetclidrivers
+    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" )
+
+    if clean:
+        main.Mininet1.stopNet()
+        time.sleep( 30 )
+    else:
+        main.log.info(  main.topoName + ": Did not stop Mininet topology" )
+
+    result = main.Mininet1.startNet( topoFile=topoFile,
+                                     args=args,
+                                     mnCmd=mnCmd )
+
+    return result
+
+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 ) +
+                            " 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 ) +
+                            " 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 ) +
+                            " 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 ) +
+                            " 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 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
diff --git a/TestON/tests/FuncTopo/FuncTopo.py b/TestON/tests/FuncTopo/FuncTopo.py
new file mode 100644
index 0000000..eefdb39
--- /dev/null
+++ b/TestON/tests/FuncTopo/FuncTopo.py
@@ -0,0 +1,213 @@
+
+# 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.hostsData = {}
+        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 ) ) )
+
+        # -- INIT SECTION, ONLY RUNS ONCE -- #
+        if init == False:
+            init = True
+
+            main.ONOSport = []
+            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( 20 )
+        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" )
+
+        main.step( "Start ONOS cli" )
+        cliResult = main.TRUE
+        for i in range( main.numCtrls ):
+            cliResult = cliResult and \
+                        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 ):
+        '''
+            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 --controller=remote,ip=$OC1 --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" )
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