diff --git a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
index f6996bb..07944aa 100644
--- a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
@@ -5,24 +5,41 @@
 def __init__( self ):
     self.default = ''
 
-def addHostIntent( main, item ):
+def hostIntent( main,
+                name="",
+                host1="",
+                host2="",
+                host1Id="",
+                host2Id="",
+                mac1="",
+                mac2="",
+                vlan1="-1",
+                vlan2="-1",
+                sw1="",
+                sw2="",
+                expectedLink=0 ):
     """
         Add host intents
     """
     import time
-    stepResult = main.TRUE
+
+    # Assert variables
+    assert main, "There is no main variable"
+    assert name, "variable name is empty"
+    assert host1 and host2, "You must specify hosts"
+
     global itemName
-    itemName = item[ 'name' ]
-    h1Name = item[ 'host1' ][ 'name' ]
-    h2Name = item[ 'host2' ][ 'name' ]
-    h1Mac = item[ 'host1' ][ 'MAC' ]
-    h2Mac = item[ 'host2' ][ 'MAC' ]
-    h1Id = item[ 'host1' ][ 'id']
-    h2Id = item[ 'host2' ][ 'id']
-    sw1 = item[ 'link' ][ 'switch1' ]
-    sw2 = item[ 'link' ][ 'switch2' ]
-    expectLink = item[ 'link' ][ 'expect' ]
+    itemName = name
+    h1Name = host1
+    h2Name = host2
+    h1Id = host1Id
+    h2Id = host2Id
+    h1Mac = mac1
+    h2Mac = mac2
+    vlan1 = vlan1
+    vlan2 = vlan2
     intentsId = []
+    stepResult = main.TRUE
     pingResult = main.TRUE
     intentResult = main.TRUE
     flowResult = main.TRUE
@@ -30,6 +47,25 @@
     linkDownResult = main.TRUE
     linkUpResult = main.TRUE
 
+    if main.hostsData:
+        if not h1Mac:
+            h1Mac = main.hostsData[ h1Name ][ 'mac' ]
+        if not h2Mac:
+            h2Mac = main.hostsData[ h2Name ][ 'mac' ]
+        if main.hostsData[ h1Name ][ 'vlan' ] != '-1':
+            vlan1 = main.hostsData[ h1Name ][ 'vlan' ]
+        if main.hostsData[ h2Name ][ 'vlan' ] != '-1':
+            vlan2 = main.hostsData[ h2Name ][ 'vlan' ]
+        if not h1Id:
+            h1Id = main.hostsData[ h1Name ][ 'id' ]
+        if not h2Id:
+            h2Id = main.hostsData[ h2Name ][ 'id' ]
+
+    assert h1Id and h2Id, "You must specify host IDs"
+    if not ( h1Id and h2Id ):
+        main.log.info( "There are no host IDs" )
+        return main.FALSE
+
     # Discover hosts using arping
     main.log.info( itemName + ": Discover host using arping" )
     main.Mininet1.arping( host=h1Name )
@@ -60,33 +96,35 @@
     pingResult = pingHost( main, h1Name, h2Name )
     time.sleep( 5 )
 
-    # link down
-    link( main, sw1, sw2, "down" )
-    intentResult = intentResult and checkIntentState( main, intentsId )
+    # Test rerouting if these variables exist
+    if sw1 and sw2 and expectedLink:
+        # link down
+        link( main, sw1, sw2, "down" )
+        intentResult = intentResult and checkIntentState( main, intentsId )
 
-    # Verify flows
-    checkFlowsState( main )
+        # Verify flows
+        checkFlowsState( main )
 
-    # Check OnosTopology
-    topoResult = checkTopology( main, expectLink )
+        # Check OnosTopology
+        topoResult = checkTopology( main, expectedLink )
 
-    # Ping hosts
-    pingResult = pingResult and pingHost( main, h1Name, h2Name )
+        # Ping hosts
+        pingResult = pingResult and pingHost( main, h1Name, h2Name )
 
-    intentResult = checkIntentState( main, intentsId )
+        intentResult = checkIntentState( main, intentsId )
 
-    # link up
-    link( main, sw1, sw2, "up" )
-    time.sleep( 5 )
+        # link up
+        link( main, sw1, sw2, "up" )
+        time.sleep( 5 )
 
-    # Verify flows
-    checkFlowsState( main )
+        # Verify flows
+        checkFlowsState( main )
 
-    # Check OnosTopology
-    topoResult = checkTopology( main, expectLink )
+        # Check OnosTopology
+        topoResult = checkTopology( main, expectedLink )
 
-    # Ping hosts
-    pingResult = pingResult and pingHost( main, h1Name, h2Name )
+        # Ping hosts
+        pingResult = pingResult and pingHost( main, h1Name, h2Name )
 
     # Remove intents
     for intent in intentsId:
@@ -98,80 +136,40 @@
 
     return stepResult
 
-def addPointIntent( main, item ):
+def pointIntent( main,
+                 name="",
+                 host1="",
+                 host2="",
+                 deviceId1="",
+                 deviceId2="",
+                 port1="",
+                 port2="",
+                 ethType="",
+                 mac1="",
+                 mac2="",
+                 bandwidth="",
+                 lambdaAlloc=False,
+                 ipProto="",
+                 ip1="",
+                 ip2="",
+                 tcp1="",
+                 tcp2="",
+                 sw1="",
+                 sw2="",
+                 expectedLink=0 ):
     """
         Add Point intents
     """
     import time
-    stepResult = main.TRUE
+    assert main, "There is no main variable"
+    assert name, "variable name is empty"
+    assert host1 and host2, "You must specify hosts"
+
     global itemName
-    itemName = item[ 'name' ]
-    h1Name = item[ 'host1' ][ 'name' ]
-    h2Name = item[ 'host2' ][ 'name' ]
-    ingressDevice = item[ 'ingressDevice' ]
-    egressDevice = item[ 'egressDevice' ]
-    option = item[ 'option' ]
-    sw1 = item[ 'link' ][ 'switch1' ]
-    sw2 = item[ 'link' ][ 'switch2' ]
-    expectLink = item[ 'link' ][ 'expect' ]
+    itemName = name
+    h1Name = host1
+    h2Name = host2
     intentsId = []
-    
-    # Assign options to variables
-    ingressPort = item.get( 'ingressPort' )
-    egressPort = item.get( 'egressPort' )
-    ethType = option.get( 'ethType' )
-    ethSrc = option.get( 'ethSrc' )
-    ethDst = option.get( 'ethDst' )
-    bandwidth = option.get( 'bandwidth' )
-    lambdaAlloc = option.get( 'lambdaAlloc' )
-    ipProto = option.get( 'ipProto' )
-    ipSrc = option.get( 'ipSrc' )
-    ipDst = option.get( 'ipDst' )
-    tcpSrc = option.get( 'tcpSrc' )
-    tcpDst = option.get( 'tcpDst' )
-
-    if ingressPort == None:
-        ingressPort = ""
-    if egressPort == None:
-        egressPort = ""
-    if ethType == None:
-        ethType = ""
-    if ethSrc == None:
-        ethSrc = ""
-    if ethDst == None:
-        ethDst = ""
-    if bandwidth == None:
-        bandwidth = ""
-    if lambdaAlloc == None:
-        lambdaAlloc = False
-    if ipProto == None:
-        ipProto = ""
-    if ipSrc == None:
-        ipSrc = ""
-    if ipDst == None:
-        ipDst = ""
-    if tcpSrc == None:
-        tcpSrc = ""
-    if tcpDst == None:
-        tcpDst = ""
-
-    """
-    print 'ethType: ', ethType
-    print 'ethSrc: ', ethSrc
-    print 'ethDst: ', ethDst
-    print 'bandwidth', bandwidth
-    print 'lambdaAlloc: ', lambdaAlloc
-    print 'ipProto: ', ipProto
-    print 'ipSrc: ', ipSrc
-    print 'ipDst:', ipDst
-    print 'tcpSrc: ', tcpSrc
-    print 'tcpDst: ', tcpDst
-    """
-    addedOption = ""
-    for i in range( len( option ) ):
-        addedOption = addedOption + option.keys()[ i ] + " = " + \
-                      option.values()[ i ] + "\n"
-    main.log.info( itemName + ": Printing added options...\n" + addedOption )
 
     pingResult = main.TRUE
     intentResult = main.TRUE
@@ -182,37 +180,37 @@
 
     # Adding bidirectional point  intents
     main.log.info( itemName + ": Adding host intents" )
-    intent1 = main.CLIs[ 0 ].addPointIntent( ingressDevice=ingressDevice,
-                                             egressDevice=egressDevice,
-                                             portIngress=ingressPort,
-                                             portEgress=egressPort,
+    intent1 = main.CLIs[ 0 ].addPointIntent( ingressDevice=deviceId1,
+                                             egressDevice=deviceId2,
+                                             portIngress=port1,
+                                             portEgress=port2,
                                              ethType=ethType,
-                                             ethSrc=ethSrc,
-                                             ethDst=ethDst,
+                                             ethSrc=mac1,
+                                             ethDst=mac2,
                                              bandwidth=bandwidth,
                                              lambdaAlloc=lambdaAlloc,
                                              ipProto=ipProto,
-                                             ipSrc=ipSrc,
-                                             ipDst=ipDst,
-                                             tcpSrc=tcpSrc,
-                                             tcpDst=tcpDst )
+                                             ipSrc=ip1,
+                                             ipDst=ip2,
+                                             tcpSrc=tcp1,
+                                             tcpDst=tcp2 )
 
     intentsId.append( intent1 )
     time.sleep( 5 )
-    intent2 = main.CLIs[ 0 ].addPointIntent( ingressDevice=egressDevice,
-                                             egressDevice=ingressDevice,
-                                             portIngress=egressPort,
-                                             portEgress=ingressPort,
+    intent2 = main.CLIs[ 0 ].addPointIntent( ingressDevice=deviceId2,
+                                             egressDevice=deviceId1,
+                                             portIngress=port2,
+                                             portEgress=port1,
                                              ethType=ethType,
-                                             ethSrc=ethDst,
-                                             ethDst=ethSrc,
+                                             ethSrc=mac2,
+                                             ethDst=mac1,
                                              bandwidth=bandwidth,
                                              lambdaAlloc=lambdaAlloc,
                                              ipProto=ipProto,
-                                             ipSrc=ipDst,
-                                             ipDst=ipSrc,
-                                             tcpSrc=tcpDst,
-                                             tcpDst=tcpSrc )
+                                             ipSrc=ip2,
+                                             ipDst=ip1,
+                                             tcpSrc=tcp2,
+                                             tcpDst=tcp1 )
     intentsId.append( intent2 )
 
     # Check intents state
@@ -228,33 +226,34 @@
     pingResult = pingHost( main, h1Name, h2Name )
     time.sleep( 5 )
 
-    # link down
-    link( main, sw1, sw2, "down" )
-    intentResult = intentResult and checkIntentState( main, intentsId )
+    if sw1 and sw2 and expectedLink:
+        # link down
+        link( main, sw1, sw2, "down" )
+        intentResult = intentResult and checkIntentState( main, intentsId )
 
-    # Verify flows
-    checkFlowsState( main )
+        # Verify flows
+        checkFlowsState( main )
 
-    # Check OnosTopology
-    topoResult = checkTopology( main, expectLink )
+        # Check OnosTopology
+        topoResult = checkTopology( main, expectedLink )
 
-    # Ping hosts
-    pingResult = pingResult and pingHost( main, h1Name, h2Name )
+        # Ping hosts
+        pingResult = pingResult and pingHost( main, h1Name, h2Name )
 
-    intentResult = checkIntentState( main, intentsId )
+        intentResult = checkIntentState( main, intentsId )
 
-    # link up
-    link( main, sw1, sw2, "up" )
-    time.sleep( 5 )
+        # link up
+        link( main, sw1, sw2, "up" )
+        time.sleep( 5 )
 
-    # Verify flows
-    checkFlowsState( main )
+        # Verify flows
+        checkFlowsState( main )
 
-    # Check OnosTopology
-    topoResult = checkTopology( main, expectLink )
+        # Check OnosTopology
+        topoResult = checkTopology( main, expectedLink )
 
-    # Ping hosts
-    pingResult = pingResult and pingHost( main, h1Name, h2Name )
+        # Ping hosts
+        pingResult = pingResult and pingHost( main, h1Name, h2Name )
 
     # Remove intents
     for intent in intentsId:
@@ -295,10 +294,43 @@
                        "both hosts" )
     return pingResult
 
-def checkItem( item ):
+def getHostsData( main ):
     """
-        Checks the dictionary
+        Use fwd app and pingall to discover all the hosts
     """
+    """
+        hosts json format:
+    """
+    import json
+    activateResult = main.TRUE
+    appCheck = main.TRUE
+    main.log.info( "Activating reactive forwarding app " )
+    activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
+
+    for i in range( main.numCtrls ):
+        appCheck = appCheck and main.CLIs[ i ].appToIDCheck()
+
+    if appCheck != main.TRUE:
+        main.log.warn( main.CLIs[ 0 ].apps() )
+        main.log.warn( main.CLIs[ 0 ].appIDs() )
+
+    pingResult = main.Mininet1.pingall()
+    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 )
+        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' ]
+
+    print main.hostsData
+    return pingResult
 
 def checkTopology( main, expectedLink ):
     statusResult = main.TRUE
