diff --git a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
index 0419583..fe26d5a 100644
--- a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
@@ -11,18 +11,18 @@
     self.default = ''
 
 def installHostIntent( main,
-                                name,
-                                host1,
-                                host2,
-                                onosNode=0,
-                                ethType="",
-                                bandwidth="",
-                                lambdaAlloc=False,
-                                ipProto="",
-                                ipAddresses="",
-                                tcp="",
-                                sw1="",
-                                sw2=""):
+                       name,
+                       host1,
+                       host2,
+                       onosNode=0,
+                       ethType="",
+                       bandwidth="",
+                       lambdaAlloc=False,
+                       ipProto="",
+                       ipAddresses="",
+                       tcp="",
+                       sw1="",
+                       sw2=""):
     """
     Installs a Host Intent
 
@@ -83,7 +83,7 @@
                         args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
         return intentId
     else:
-        main.log.error( "Single to Multi Intent did not install correctly" )
+        main.log.error( "Host Intent did not install correctly" )
         return main.FALSE
 
 def testHostIntent( main,
@@ -149,7 +149,7 @@
     tempHostsData = {}
     onosNode = int( onosNode )
 
-    main.log.info( itemName + ": Testing Single to Multi Point Intent" )
+    main.log.info( itemName + ": Testing Host Intent" )
 
     if not host1.get( "id" ):
         main.log.warn( "Id not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
@@ -1511,8 +1511,7 @@
         # 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 )
+            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" )
diff --git a/TestON/tests/FUNCintent/FUNCintent.params b/TestON/tests/FUNCintent/FUNCintent.params
index f061c67..d19a45d 100644
--- a/TestON/tests/FUNCintent/FUNCintent.params
+++ b/TestON/tests/FUNCintent/FUNCintent.params
@@ -16,7 +16,7 @@
     # 3000 - Test single to multi point intents
     # 4000 - Test multi to single point intents
     # 5000 - Test host mobility
-    # 6000 - Test multi to single end point failure
+    # 6000 - Test Multi Point intent End Point Failure
 
     <testcases>1,[2,10,12,13,15,1000,2000,3000,4000,5000,6000,16]*2,[2,11,12,13,15,1000,2000,3000,4000,5000,6000,16]*2</testcases>
 
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
index b4ca8af..e1660f1 100644
--- a/TestON/tests/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -538,7 +538,6 @@
                                  onpass="Successfully populated hostsData",
                                  onfail="Failed to populate hostsData" )
 
-
     def CASE16( self, main ):
         """
             Stop mininet and remove scapy host
@@ -1496,7 +1495,7 @@
         main.step( "Testing host mobility by moving h1 from s5 to s6" )
         h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
 
-        main.log.info( "Moving h1 from s5 to s6" )
+        main.log.info( "Moving h1 from s5 to s6")
         main.Mininet1.moveHost( "h1","s5","s6" )
 
         # Send discovery ping from moved host
@@ -1530,16 +1529,16 @@
                                               onosNode='0',
                                               host1=host1,
                                               host2=host2 )
-
-        testResult = main.intentFunction.testHostIntent( main,
-                                              name='Host Mobility IPV4',
-                                              intentId = installResult,
-                                              onosNode='0',
-                                              host1=host1,
-                                              host2=host2,
-                                              sw1="s6",
-                                              sw2="s2",
-                                              expectedLink=18 )
+        if installResult:
+            testResult = main.intentFunction.testHostIntent( main,
+                                                  name='Host Mobility IPV4',
+                                                  intentId = installResult,
+                                                  onosNode='0',
+                                                  host1=host1,
+                                                  host2=host2,
+                                                  sw1="s6",
+                                                  sw2="s2",
+                                                  expectedLink=18 )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1924,4 +1923,4 @@
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
 
-        main.intentFunction.report( main )
+        main.intentFunction.report( main )
\ No newline at end of file
diff --git a/TestON/tests/FUNCintentRest/Dependency/FuncIntentFunction.py b/TestON/tests/FUNCintentRest/Dependency/FuncIntentFunction.py
index 2dadea4..8448c96 100644
--- a/TestON/tests/FUNCintentRest/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FUNCintentRest/Dependency/FuncIntentFunction.py
@@ -11,412 +11,607 @@
 def __init__( self ):
     self.default = ''
 
-def hostIntent( main,
-                name,
-                host1,
-                host2,
-                onosNode=0,
-                host1Id="",
-                host2Id="",
-                mac1="",
-                mac2="",
-                vlan1="-1",
-                vlan2="-1",
-                sw1="",
-                sw2="",
-                expectedLink=0 ):
+def installHostIntent( main,
+                       name,
+                       host1,
+                       host2,
+                       onosNode=0,
+                       ethType="",
+                       bandwidth="",
+                       lambdaAlloc=False,
+                       ipProto="",
+                       ipAddresses="",
+                       tcp="",
+                       sw1="",
+                       sw2=""):
     """
-        Description:
-            Verify add-host-intent
-        Steps:
-            - Discover hosts
-            - Add host intents
-            - Check intents
-            - Verify flows
-            - Ping hosts
-            - Reroute
-                - Link down
-                - Verify flows
-                - Check topology
-                - Ping hosts
-                - Link up
-                - Verify flows
-                - Check topology
-                - Ping hosts
-            - Remove intents
-        Required:
-            name - Type of host intent to add eg. IPV4 | VLAN | Dualstack
-            host1 - Name of first host
-            host2 - Name of second host
-        Optional:
-            onosNode - ONOS node to install the intents in main.CLIs[ ]
-                       0 by default so that it will always use the first
-                       ONOS node
-            host1Id - ONOS id of the first host eg. 00:00:00:00:00:01/-1
-            host2Id - ONOS id of the second host
-            mac1 - Mac address of first host
-            mac2 - Mac address of the second host
-            vlan1 - Vlan tag of first host, defaults to -1
-            vlan2 - Vlan tag of second host, defaults to -1
-            sw1 - First switch to bring down & up for rerouting purpose
-            sw2 - Second switch to bring down & up for rerouting purpose
-            expectedLink - Expected link when the switches are down, it should
-                           be two links lower than the links before the two
-                           switches are down
+    Installs a Host Intent
+
+    Description:
+        Install a host intent using
+        add-host-intent
+
+    Steps:
+        - Fetch host data if not given
+        - Add host intent
+            - Ingress device is the first sender host
+            - Egress devices are the recipient devices
+            - Ports if defined in senders or recipients
+            - MAC address ethSrc loaded from Ingress device
+        - Check intent state with retry
+    Required:
+        name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+        host1 - Dictionary for host1
+            { "name":"h8", "id":"of:0000000000000005/8" }
+        host2 - Dictionary for host2
+            { "name":"h16", "id":"of:0000000000000006/8" }
+    Optional:
+        onosNode - ONOS node to install the intents in main.CLIs[ ]
+                   0 by default so that it will always use the first
+                   ONOS node
+        ethType - Ethernet type eg. IPV4, IPV6
+        bandwidth - Bandwidth capacity
+        lambdaAlloc - Allocate lambda, defaults to False
+        ipProto - IP protocol
+        tcp - TCP ports in the same order as the hosts in hostNames
     """
 
-    # Assert variables
     assert main, "There is no main variable"
-    assert name, "variable name is empty"
-    assert host1 and host2, "You must specify hosts"
+    assert host1, "You must specify host1"
+    assert host2, "You must specify host2"
 
-    global itemName
+    global itemName  # The name of this run. Used for logs.
     itemName = name
-    h1Id = host1Id
-    h2Id = host2Id
-    h1Mac = mac1
-    h2Mac = mac2
-    vlan1 = vlan1
-    vlan2 = vlan2
-    hostNames = [ host1 , host2 ]
-    intentsId = []
-    stepResult = main.TRUE
-    pingResult = main.TRUE
-    intentResult = main.TRUE
-    removeIntentResult = main.TRUE
-    flowResult = main.TRUE
-    topoResult = main.TRUE
-    linkDownResult = main.TRUE
-    linkUpResult = main.TRUE
     onosNode = int( onosNode )
 
-    if main.hostsData:
-        if not h1Mac:
-            h1Mac = main.hostsData[ host1 ][ 'mac' ]
-        if not h2Mac:
-            h2Mac = main.hostsData[ host2 ][ 'mac' ]
-        if main.hostsData[ host1 ][ 'vlan' ] != '-1':
-            vlan1 = main.hostsData[ host1 ][ 'vlan' ]
-        if main.hostsData[ host2 ][ 'vlan' ] != '-1':
-            vlan2 = main.hostsData[ host2 ][ 'vlan' ]
-        if not h1Id:
-            h1Id = main.hostsData[ host1 ][ 'id' ]
-        if not h2Id:
-            h2Id = main.hostsData[ host2 ][ 'id' ]
+    main.log.info( itemName + ": Adding single point to multi point intents" )
 
-    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
+    if not host1.get( "id" ):
+        main.log.warn( "ID not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
+        main.log.debug( main.hostsData.get( host1.get( "name" ) ) )
+        host1[ "id" ] = main.hostsData.get( host1.get( "name" ) ).get( "id" )
 
-    # Discover hosts using arping
-    if not main.hostsData:
-        main.log.info( itemName + ": Discover host using arping" )
-        main.Mininet1.arping( srcHost=host1, dstHost=host2 )
-        main.Mininet1.arping( srcHost=host2, dstHost=host1 )
-        h1Id = main.CLIs[ 0 ].getHost( mac=h1Mac )
-        h2Id = main.CLIs[ 0 ].getHost( mac=h2Mac )
-
-    # Check flows count in each node
-    checkFlowsCount( main )
+    if not host2.get( "id" ):
+        main.log.warn( "ID not given for host2 {0}. Loading from main.hostData".format( host2.get( "name" ) ) )
+        host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "id" )
 
     # Adding host intents
     main.log.info( itemName + ": Adding host intents" )
 
-    intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=h1Id,
-                                                   hostIdTwo=h2Id )
+    intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=host1.get( "id" ),
+                                                   hostIdTwo=host2.get( "id" ) )
 
     # Get all intents ID in the system, time delay right after intents are added
     time.sleep( main.addIntentSleep )
     intentsId = main.CLIs[ 0 ].getIntentsId()
 
-    # Check intents state
-    time.sleep( main.checkIntentSleep )
-    intentResult = checkIntentState( main, intentsId )
-    checkFlowsCount( main )
+    if utilities.retry ( f=checkIntentState, retValue=main.FALSE,
+                         args = (main, intentsId ), sleep=main.checkIntentSleep ):
+        return intentsId
+    else:
+        main.log.error( "Host Intent did not install correctly" )
+        return main.FALSE
 
-    # Check intents state again if first check fails...
-    if not intentResult:
-        intentResult = checkIntentState( main, intentsId )
+def testHostIntent( main,
+                    name,
+                    intentId,
+                    host1,
+                    host2,
+                    onosNode=0,
+                    sw1="s5",
+                    sw2="s2",
+                    expectedLink=0):
+    """
+    Test a Host Intent
 
-    # Check flows count in each node
-    checkFlowsCount( main )
-    # Verify flows
-    checkFlowsState( main )
+    Description:
+        Test a host intent of given ID between given hosts
 
-    # Ping hosts
-    firstPingResult = pingallHosts( main, hostNames )
-    if not firstPingResult:
-        main.log.debug( "First ping failed, there must be" +
-                       " something wrong with ONOS performance" )
+    Steps:
+        - Fetch host data if not given
+        - Check Intent State
+        - Check Flow State
+        - Check Connectivity
+        - Check Lack of Connectivity Between Hosts not in the Intent
+        - Reroute
+            - Take Expected Link Down
+            - Check Intent State
+            - Check Flow State
+            - Check Topology
+            - Check Connectivity
+            - Bring Expected Link Up
+            - Check Intent State
+            - Check Flow State
+            - Check Topology
+            - Check Connectivity
+        - Remove Topology
 
-    # Ping hosts again...
-    pingResult = pingResult and pingallHosts( main, hostNames )
-
-    # Test rerouting if these variables exist
-    if sw1 and sw2 and expectedLink:
-        # link down
-        linkDownResult = link( main, sw1, sw2, "down" )
-        intentResult = intentResult and checkIntentState( main, intentsId )
-
-        # Check flows count in each node
-        checkFlowsCount( main )
-        # Verify flows
-        checkFlowsState( main )
-
-        # Check OnosTopology
-        topoResult = checkTopology( main, expectedLink )
-
-        # Ping hosts
-        pingResult = pingResult and pingallHosts( main, hostNames )
-
-        intentResult = checkIntentState( main, intentsId )
-
-        # Checks ONOS state in link down
-        if linkDownResult and topoResult and pingResult and intentResult:
-            main.log.info( itemName + ": Successfully brought link down" )
-        else:
-            main.log.error( itemName + ": Failed to bring link down" )
-
-        # link up
-        linkUpResult = link( main, sw1, sw2, "up" )
-        time.sleep( main.rerouteSleep )
-
-        # Check flows count in each node
-        checkFlowsCount( main )
-        # Verify flows
-        checkFlowsState( main )
-
-        # Check OnosTopology
-        topoResult = checkTopology( main, main.numLinks )
-
-        # Ping hosts
-        pingResult = pingResult and pingallHosts( main, hostNames )
-
-        intentResult = checkIntentState( main, intentsId )
-
-        # Checks ONOS state in link up
-        if linkUpResult and topoResult and pingResult and intentResult:
-            main.log.info( itemName + ": Successfully brought link back up" )
-        else:
-            main.log.error( itemName + ": Failed to bring link back up" )
-
-    # Remove all intents
-    removeIntentResult = removeAllIntents( main )
-
-    stepResult = pingResult and linkDownResult and linkUpResult \
-                 and intentResult and removeIntentResult
-
-    return stepResult
-
-def pointIntent( main,
-                 name,
-                 host1,
-                 host2,
-                 onosNode=0,
-                 deviceId1="",
-                 deviceId2="",
-                 port1="",
-                 port2="",
-                 ethType="",
-                 mac1="",
-                 mac2="",
-                 bandwidth="",
-                 lambdaAlloc=False,
-                 ipProto="",
-                 ip1="",
-                 ip2="",
-                 tcp1="",
-                 tcp2="",
-                 sw1="",
-                 sw2="",
-                 expectedLink=0 ):
+    Required:
+        name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+        intentId - intent ID to be tested ( and removed )
+        host1 - Dictionary for host1
+            { "name":"h8", "id":"of:0000000000000005/8" }
+        host2 - Dictionary for host2
+            { "name":"h16", "id":"of:0000000000000006/8" }
+    Optional:
+        onosNode - ONOS node to install the intents in main.CLIs[ ]
+                   0 by default so that it will always use the first
+                   ONOS node
+        sw1 - First switch to bring down & up for rerouting purpose
+        sw2 - Second switch to bring down & up for rerouting purpose
+        expectedLink - Expected link when the switches are down, it should
+                       be two links lower than the links before the two
+                       switches are down
 
     """
-        Description:
-            Verify add-point-intent
-        Steps:
-            - Get device ids | ports
-            - Add point intents
-            - Check intents
-            - Verify flows
-            - Ping hosts
-            - Reroute
-                - Link down
-                - Verify flows
-                - Check topology
-                - Ping hosts
-                - Link up
-                - Verify flows
-                - Check topology
-                - Ping hosts
-            - Remove intents
-        Required:
-            name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
-            host1 - Name of first host
-            host2 - Name of second host
-        Optional:
-            onosNode - ONOS node to install the intents in main.CLIs[ ]
-                       0 by default so that it will always use the first
-                       ONOS node
-            deviceId1 - ONOS device id of the first switch, the same as the
-                        location of the first host eg. of:0000000000000001/1,
-                        located at device 1 port 1
-            deviceId2 - ONOS device id of the second switch
-            port1 - The port number where the first host is attached
-            port2 - The port number where the second host is attached
-            ethType - Ethernet type eg. IPV4, IPV6
-            mac1 - Mac address of first host
-            mac2 - Mac address of the second host
-            bandwidth - Bandwidth capacity
-            lambdaAlloc - Allocate lambda, defaults to False
-            ipProto - IP protocol
-            ip1 - IP address of first host
-            ip2 - IP address of second host
-            tcp1 - TCP port of first host
-            tcp2 - TCP port of second host
-            sw1 - First switch to bring down & up for rerouting purpose
-            sw2 - Second switch to bring down & up for rerouting purpose
-            expectedLink - Expected link when the switches are down, it should
-                           be two links lower than the links before the two
-                           switches are down
-    """
 
+    # Parameter Validity Check
     assert main, "There is no main variable"
-    assert name, "variable name is empty"
-    assert host1 and host2, "You must specify hosts"
+    assert host1, "You must specify host1"
+    assert host2, "You must specify host2"
 
     global itemName
     itemName = name
-    host1 = host1
-    host2 = host2
-    hostNames = [ host1, host2 ]
-    intentsId = []
-
-    pingResult = main.TRUE
-    intentResult = main.TRUE
-    removeIntentResult = main.TRUE
-    flowResult = main.TRUE
-    topoResult = main.TRUE
-    linkDownResult = main.TRUE
-    linkUpResult = main.TRUE
+    tempHostsData = {}
     onosNode = int( onosNode )
 
-    # Adding bidirectional point  intents
-    main.log.info( itemName + ": Adding point intents" )
-    intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
-                                                    egressDevice=deviceId2,
-                                                    ingressPort=port1,
-                                                    egressPort=port2,
-                                                    ethType=ethType,
-                                                    ethSrc=mac1,
-                                                    ethDst=mac2,
-                                                    bandwidth=bandwidth,
-                                                    lambdaAlloc=lambdaAlloc,
-                                                    ipProto=ipProto,
-                                                    ipSrc=ip1,
-                                                    ipDst=ip2,
-                                                    tcpSrc=tcp1,
-                                                    tcpDst=tcp2 )
+    main.log.info( itemName + ": Testing Host Intent" )
 
-    intent2 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
-                                                    egressDevice=deviceId1,
-                                                    ingressPort=port2,
-                                                    egressPort=port1,
-                                                    ethType=ethType,
-                                                    ethSrc=mac2,
-                                                    ethDst=mac1,
-                                                    bandwidth=bandwidth,
-                                                    lambdaAlloc=lambdaAlloc,
-                                                    ipProto=ipProto,
-                                                    ipSrc=ip2,
-                                                    ipDst=ip1,
-                                                    tcpSrc=tcp2,
-                                                    tcpDst=tcp1 )
+    if not host1.get( "id" ):
+        main.log.warn( "Id not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
+        host1[ "id" ] = main.hostsData.get( host1.get( "name" ) ).get( "location" )
 
-    # Get all intents ID in the system, time delay right after intents are added
-    time.sleep( main.addIntentSleep )
-    intentsId = main.CLIs[ 0 ].getIntentsId()
+    if not host2.get( "id" ):
+        main.log.warn( "Id not given for host2 {0}. Loading from main.hostData".format( host2.get( "name" ) ) )
+        host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "location" )
 
-    # Check intents state
-    time.sleep( main.checkIntentSleep )
-    intentResult = checkIntentState( main, intentsId )
-    # Check flows count in each node
-    checkFlowsCount( main )
+    senderNames = [ host1.get( "name" ), host2.get( "name" ) ]
+    recipientNames = [ host1.get( "name" ), host2.get( "name" ) ]
 
-    # Check intents state again if first check fails...
-    if not intentResult:
-        intentResult = checkIntentState( main, intentsId )
+    testResult = main.TRUE
+    main.log.info( itemName + ": Adding single point to multi point intents" )
+
+    # Check intent state
+    if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+        main.assertReturnString += 'Initial Intent State Passed\n'
+    else:
+        main.assertReturnString += 'Initial Intent State Failed\n'
+        testResult = main.FALSE
 
     # Check flows count in each node
-    checkFlowsCount( main )
-    # Verify flows
-    checkFlowsState( main )
+    if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20 ):
+        main.assertReturnString += 'Initial Flow State Passed\n'
+    else:
+        main.assertReturnString += 'Intial Flow State Failed\n'
+        testResult = main.FALSE
 
-    # Ping hosts
-    firstPingResult = pingallHosts( main, hostNames )
-    if not firstPingResult:
-        main.log.debug( "First ping failed, there must be" +
-                       " something wrong with ONOS performance" )
-
-    # Ping hosts again...
-    pingResult = pingResult and pingallHosts( main, hostNames )
+    # Check Connectivity
+    if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+        main.assertReturnString += 'Initial Ping Passed\n'
+    else:
+        main.assertReturnString += 'Initial Ping Failed\n'
+        testResult = main.FALSE
 
     # Test rerouting if these variables exist
     if sw1 and sw2 and expectedLink:
-        # link down
-        linkDownResult = link( main, sw1, sw2, "down" )
-        intentResult = intentResult and checkIntentState( main, intentsId )
+        # Take link down
+        if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "down" ) ):
+            main.assertReturnString += 'Link Down Passed\n'
+        else:
+            main.assertReturnString += 'Link Down Failed\n'
+            testResult = main.FALSE
+
+        # Check intent state
+        if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+            main.assertReturnString += 'Link Down Intent State Passed\n'
+        else:
+            main.assertReturnString += 'Link Down Intent State Failed\n'
+            testResult = main.FALSE
 
         # Check flows count in each node
-        checkFlowsCount( main )
-        # Verify flows
-        checkFlowsState( main )
+        if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20 ):
+            main.assertReturnString += 'Link Down Flow State Passed\n'
+        else:
+            main.assertReturnString += 'Link Down Flow State Failed\n'
+            testResult = main.FALSE
 
         # Check OnosTopology
-        topoResult = checkTopology( main, expectedLink )
-
-        # Ping hosts
-        pingResult = pingResult and pingallHosts( main, hostNames )
-
-        intentResult = checkIntentState( main, intentsId )
-
-        # Checks ONOS state in link down
-        if linkDownResult and topoResult and pingResult and intentResult:
-            main.log.info( itemName + ": Successfully brought link down" )
+        if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, expectedLink ) ):
+            main.assertReturnString += 'Link Down Topology State Passed\n'
         else:
-            main.log.error( itemName + ": Failed to bring link down" )
+            main.assertReturnString += 'Link Down Topology State Failed\n'
+            testResult = main.FALSE
 
-        # link up
-        linkUpResult = link( main, sw1, sw2, "up" )
+        # Check Connection
+        if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+            main.assertReturnString += 'Link Down Pingall Passed\n'
+        else:
+            main.assertReturnString += 'Link Down Pingall Failed\n'
+            testResult = main.FALSE
+
+        # Bring link up
+        if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "up" ) ):
+            main.assertReturnString += 'Link Up Passed\n'
+        else:
+            main.assertReturnString += 'Link Up Failed\n'
+            testResult = main.FALSE
+
+        # Wait for reroute
         time.sleep( main.rerouteSleep )
 
+        # Check Intents
+        if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+            main.assertReturnString += 'Link Up Intent State Passed\n'
+        else:
+            main.assertReturnString += 'Link Up Intent State Failed\n'
+            testResult = main.FALSE
+
         # Check flows count in each node
-        checkFlowsCount( main )
-        # Verify flows
-        checkFlowsState( main )
+        if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20 ):
+            main.assertReturnString += 'Link Up Flow State Passed\n'
+        else:
+            main.assertReturnString += 'Link Up Flow State Failed\n'
+            testResult = main.FALSE
 
         # Check OnosTopology
-        topoResult = checkTopology( main, main.numLinks )
-
-        # Ping hosts
-        pingResult = pingResult and pingallHosts( main, hostNames )
-
-        intentResult = checkIntentState( main, intentsId )
-
-        # Checks ONOS state in link up
-        if linkUpResult and topoResult and pingResult and intentResult:
-            main.log.info( itemName + ": Successfully brought link back up" )
+        if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, main.numLinks ) ):
+            main.assertReturnString += 'Link Up Topology State Passed\n'
         else:
-            main.log.error( itemName + ": Failed to bring link back up" )
+            main.assertReturnString += 'Link Up Topology State Failed\n'
+            testResult = main.FALSE
+
+        # Check Connection
+        if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+            main.assertReturnString += 'Link Up Pingall Passed\n'
+        else:
+            main.assertReturnString += 'Link Up Pingall Failed\n'
+            testResult = main.FALSE
 
     # Remove all intents
-    removeIntentResult = removeAllIntents( main )
+    if utilities.retry( f=removeAllIntents, retValue=main.FALSE, args=( main, ) ):
+        main.assertReturnString += 'Remove Intents Passed'
+    else:
+        main.assertReturnString += 'Remove Intents Failed'
+        testResult = main.FALSE
 
-    stepResult = pingResult and linkDownResult and linkUpResult \
-                 and intentResult and removeIntentResult
+    return testResult
 
-    return stepResult
+def installPointIntent( main,
+                        name,
+                        senders,
+                        recipients,
+                        onosNode=0,
+                        ethType="",
+                        bandwidth="",
+                        lambdaAlloc=False,
+                        ipProto="",
+                        ipSrc="",
+                        ipDst="",
+                        tcpSrc="",
+                        tcpDst=""):
+    """
+    Installs a Single to Single Point Intent
+
+    Description:
+        Install a single to single point intent
+
+    Steps:
+        - Fetch host data if not given
+        - Add point intent
+            - Ingress device is the first sender device
+            - Egress device is the first recipient device
+            - Ports if defined in senders or recipients
+            - MAC address ethSrc loaded from Ingress device
+        - Check intent state with retry
+    Required:
+        name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+        senders - List of host dictionaries i.e.
+            [ { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" } ]
+        recipients - List of host dictionaries i.e.
+            [ { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" } ]
+    Optional:
+        onosNode - ONOS node to install the intents in main.CLIs[ ]
+                   0 by default so that it will always use the first
+                   ONOS node
+        ethType - Ethernet type eg. IPV4, IPV6
+        bandwidth - Bandwidth capacity
+        lambdaAlloc - Allocate lambda, defaults to False
+        ipProto - IP protocol
+        tcp - TCP ports in the same order as the hosts in hostNames
+        sw1 - First switch to bring down & up for rerouting purpose
+        sw2 - Second switch to bring down & up for rerouting purpose
+        expectedLink - Expected link when the switches are down, it should
+                       be two links lower than the links before the two
+                       switches are down
+    """
+
+    assert main, "There is no main variable"
+    assert senders, "You must specify a sender"
+    assert recipients, "You must specify a recipient"
+    # Assert devices or main.hostsData, "You must specify devices"
+
+    global itemName  # The name of this run. Used for logs.
+    itemName = name
+    onosNode = int( onosNode )
+
+    main.log.info( itemName + ": Adding single to single point intents" )
+
+    for sender in senders:
+        if not sender.get( "device" ):
+            main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
+            sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
+
+    for recipient in recipients:
+        if not recipient.get( "device" ):
+            main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
+            recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
+
+
+    ingressDevice = senders[ 0 ].get( "device" )
+    egressDevice = recipients[ 0 ].get( "device" )
+
+    portIngress = senders[ 0 ].get( "port", "" )
+    portEgress = recipients[ 0 ].get( "port", "" )
+    main.log.debug( ingressDevice )
+    main.log.debug( egressDevice )
+
+    srcMac = senders[ 0 ].get( "mac" )
+    dstMac = recipients[ 0 ].get( "mac" )
+
+    ipSrc = senders[ 0 ].get( "ip" )
+    ipDst = recipients[ 0 ].get( "ip" )
+
+    intent1 = main.CLIs[ onosNode ].addPointIntent(
+                                        ingressDevice=ingressDevice,
+                                        egressDevice=egressDevice,
+                                        ingressPort=portIngress,
+                                        egressPort=portEgress,
+                                        ethType=ethType,
+                                        ethSrc=srcMac,
+                                        ethDst=dstMac,
+                                        bandwidth=bandwidth,
+                                        lambdaAlloc=lambdaAlloc,
+                                        ipProto=ipProto,
+                                        ipSrc=ipSrc,
+                                        ipDst=ipDst,
+                                        tcpSrc=tcpSrc,
+                                        tcpDst=tcpDst )
+
+    time.sleep( main.addIntentSleep )
+    intentsId = main.CLIs[ 0 ].getIntentsId()
+
+    if utilities.retry ( f=checkIntentState, retValue=main.FALSE,
+                         args = (main, intentsId ), sleep=main.checkIntentSleep ):
+        return intentsId
+    else:
+        main.log.error( "Single to Single point intent did not install correctly" )
+        return main.FALSE
+
+    # Check intents state
+    if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentsId ), sleep=main.checkIntentSleep ):
+        return intentsId
+    else:
+        main.log.error( "Point Intent did not install correctly" )
+        return main.FALSE
+
+def testPointIntent( main,
+                     name,
+                     intentId,
+                     senders,
+                     recipients,
+                     badSenders={},
+                     badRecipients={},
+                     onosNode=0,
+                     ethType="",
+                     bandwidth="",
+                     lambdaAlloc=False,
+                     ipProto="",
+                     ipAddresses="",
+                     tcp="",
+                     sw1="s5",
+                     sw2="s2",
+                     expectedLink=0):
+    """
+    Test a Point Intent
+
+    Description:
+        Test a point intent
+
+    Steps:
+        - Fetch host data if not given
+        - Check Intent State
+        - Check Flow State
+        - Check Connectivity
+        - Check Lack of Connectivity Between Hosts not in the Intent
+        - Reroute
+            - Take Expected Link Down
+            - Check Intent State
+            - Check Flow State
+            - Check Topology
+            - Check Connectivity
+            - Bring Expected Link Up
+            - Check Intent State
+            - Check Flow State
+            - Check Topology
+            - Check Connectivity
+        - Remove Topology
+
+    Required:
+        name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+
+        senders - List of host dictionaries i.e.
+            { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" }
+        recipients - List of host dictionaries i.e.
+            { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }
+    Optional:
+        onosNode - ONOS node to install the intents in main.CLIs[ ]
+                   0 by default so that it will always use the first
+                   ONOS node
+        ethType - Ethernet type eg. IPV4, IPV6
+        bandwidth - Bandwidth capacity
+        lambdaAlloc - Allocate lambda, defaults to False
+        ipProto - IP protocol
+        tcp - TCP ports in the same order as the hosts in hostNames
+        sw1 - First switch to bring down & up for rerouting purpose
+        sw2 - Second switch to bring down & up for rerouting purpose
+        expectedLink - Expected link when the switches are down, it should
+                       be two links lower than the links before the two
+                       switches are down
+
+    """
+
+    # Parameter Validity Check
+    assert main, "There is no main variable"
+    assert senders, "You must specify a sender"
+    assert recipients, "You must specify a recipient"
+
+    global itemName
+    itemName = name
+    tempHostsData = {}
+    onosNode = int( onosNode )
+
+    main.log.info( itemName + ": Testing Point Intent" )
+
+    # Names for scapy
+    senderNames = [ x.get( "name" ) for x in senders ]
+    recipientNames = [ x.get( "name" ) for x in recipients ]
+    badSenderNames = [ x.get( "name" ) for x in badSenders ]
+    badRecipientNames = [ x.get( "name" ) for x in badRecipients ]
+
+    for sender in senders:
+        if not sender.get( "device" ):
+            main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
+            sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
+
+    for recipient in recipients:
+        if not recipient.get( "device" ):
+            main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
+            recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
+
+    testResult = main.TRUE
+    main.log.info( itemName + ": Testing point intents" )
+
+    # Check intent state
+    if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+        main.assertReturnString += 'Initial Intent State Passed\n'
+    else:
+        main.assertReturnString += 'Initial Intent State Failed\n'
+        testResult = main.FALSE
+
+    # Check flows count in each node
+    if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=10 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=10 ):
+        main.assertReturnString += 'Initial Flow State Passed\n'
+    else:
+        main.assertReturnString += 'Intial Flow State Failed\n'
+        testResult = main.FALSE
+
+    # Check Connectivity
+    if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+        main.assertReturnString += 'Initial Ping Passed\n'
+    else:
+        main.assertReturnString += 'Initial Ping Failed\n'
+        testResult = main.FALSE
+
+    # Check connections that shouldn't work
+    if badSenderNames:
+        main.log.info( "Checking that packets from incorrect sender do not go through" )
+        if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, badSenderNames, recipientNames ), kwargs={ "expectFailure":True } ):
+            main.assertReturnString += 'Bad Sender Ping Passed\n'
+        else:
+            main.assertReturnString += 'Bad Sender Ping Failed\n'
+            testResult = main.FALSE
+
+    if badRecipientNames:
+        main.log.info( "Checking that packets to incorrect recipients do not go through" )
+        if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, badRecipientNames ), kwargs={ "expectFailure":True } ):
+            main.assertReturnString += 'Bad Recipient Ping Passed\n'
+        else:
+            main.assertReturnString += 'Bad Recipient Ping Failed\n'
+            testResult = main.FALSE
+
+    # Test rerouting if these variables exist
+    if sw1 and sw2 and expectedLink:
+        # Take link down
+        if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "down" ) ):
+            main.assertReturnString += 'Link Down Passed\n'
+        else:
+            main.assertReturnString += 'Link Down Failed\n'
+            testResult = main.FALSE
+
+        # Check intent state
+        if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+            main.assertReturnString += 'Link Down Intent State Passed\n'
+        else:
+            main.assertReturnString += 'Link Down Intent State Failed\n'
+            testResult = main.FALSE
+
+        # Check flows count in each node
+        if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=10 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=10 ):
+            main.assertReturnString += 'Link Down Flow State Passed\n'
+        else:
+            main.assertReturnString += 'Link Down Flow State Failed\n'
+            testResult = main.FALSE
+
+        # Check OnosTopology
+        if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, expectedLink ) ):
+            main.assertReturnString += 'Link Down Topology State Passed\n'
+        else:
+            main.assertReturnString += 'Link Down Topology State Failed\n'
+            testResult = main.FALSE
+
+        # Check Connection
+        if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+            main.assertReturnString += 'Link Down Pingall Passed\n'
+        else:
+            main.assertReturnString += 'Link Down Pingall Failed\n'
+            testResult = main.FALSE
+
+        # Bring link up
+        if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "up" ) ):
+            main.assertReturnString += 'Link Up Passed\n'
+        else:
+            main.assertReturnString += 'Link Up Failed\n'
+            testResult = main.FALSE
+
+        # Wait for reroute
+        time.sleep( main.rerouteSleep )
+
+        # Check Intents
+        if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+            main.assertReturnString += 'Link Up Intent State Passed\n'
+        else:
+            main.assertReturnString += 'Link Up Intent State Failed\n'
+            testResult = main.FALSE
+
+        # Check flows count in each node
+        if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=10 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=10 ):
+            main.assertReturnString += 'Link Up Flow State Passed\n'
+        else:
+            main.assertReturnString += 'Link Up Flow State Failed\n'
+            testResult = main.FALSE
+
+        # Check OnosTopology
+        if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, main.numLinks ) ):
+            main.assertReturnString += 'Link Up Topology State Passed\n'
+        else:
+            main.assertReturnString += 'Link Up Topology State Failed\n'
+            testResult = main.FALSE
+
+        # Check Connection
+        if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+            main.assertReturnString += 'Link Up Scapy Packet Received Passed\n'
+        else:
+            main.assertReturnString += 'Link Up Scapy Packet Recieved Failed\n'
+            testResult = main.FALSE
+
+    # Remove all intents
+    if utilities.retry( f=removeAllIntents, retValue=main.FALSE, args=( main, ) ):
+        main.assertReturnString += 'Remove Intents Passed'
+    else:
+        main.assertReturnString += 'Remove Intents Failed'
+        testResult = main.FALSE
+
+    return testResult
 
 def pointIntentTcp( main,
                     name,
@@ -1233,16 +1428,17 @@
         main.log.info( itemName + ": Intents are installed correctly" )
     else:
         # Wait for at least 5 second before checking the intents again
+        main.log.error( "Intents are not installed correctly. Waiting 5 sec" )
         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 )
+            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" )
+            intentResult = main.TRUE
         else:
             main.log.error( itemName + ": Intents are NOT installed correctly" )
             intentResult = main.FALSE
@@ -1296,10 +1492,191 @@
         else:
             for i in range( main.numCtrls ):
                 main.log.debug( itemName + ": ONOS node " + str( i + 1 ) +
-                                " has " + flowsCount[ i ] + " flows" )
+                                " has " + str( flowsCount[ i ] ) + " flows" )
     else:
         main.log.error( "Checking flows count failed, check summary command" )
         return main.FALSE
 
     return main.TRUE
 
+def sendDiscoveryArp( main, hosts=None ):
+    """
+        Sends Discovery ARP packets from each host provided
+        Defaults to each host in main.scapyHosts
+    """
+    # Send an arp ping from each host
+    if not hosts:
+        hosts = main.scapyHosts
+    for host in hosts:
+        pkt = 'Ether( src="{0}")/ARP( psrc="{1}")'.format( host.hostMac ,host.hostIp )
+        # Send from the VLAN interface if there is one so ONOS discovers the VLAN correctly
+        iface = None
+        for interface in host.getIfList():
+            if '.' in interface:
+                main.log.debug( "Detected VLAN interface {0}. Sending ARP packet from {0}".format( interface ) )
+                iface = interface
+                break
+        host.sendPacket( packet=pkt, iface=iface )
+        main.log.info( "Sending ARP packet from {0}".format( host.name ) )
+
+def confirmHostDiscovery( main ):
+    """
+        Confirms that all ONOS nodes have discovered all scapy hosts
+    """
+    import collections
+    scapyHostCount = len( main.scapyHosts )
+    hosts = main.topo.getAllHosts( main )  # Get host data from each ONOS node
+    hostFails = []  # Reset for each failed attempt
+
+    #  Check for matching hosts on each node
+    scapyHostIPs = [ x.hostIp for x in main.scapyHosts if x.hostIp != "0.0.0.0" ]
+    for controller in range( main.numCtrls ):
+        controllerStr = str( controller + 1 )  # ONOS node number
+        # Compare Hosts
+        # Load hosts data for controller node
+        if hosts[ controller ] and "Error" not in hosts[ controller ]:
+            try:
+                hostData = json.loads( hosts[ controller ] )
+            except ( TypeError, ValueError ):
+                main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
+                hostFails.append( controllerStr )
+            else:
+                onosHostIPs = [ x.get( "ipAddresses" )[ 0 ]
+                                for x in hostData
+                                if len( x.get( "ipAddresses" ) ) > 0 ]
+                if not set( collections.Counter( scapyHostIPs ) ).issubset( set ( collections.Counter( onosHostIPs ) ) ):
+                    main.log.warn( "Controller {0} only sees nodes with {1} IPs. It should see all of the following: {2}".format( controllerStr, onosHostIPs, scapyHostIPs ) )
+                    hostFails.append( controllerStr )
+        else:
+            main.log.error( "Hosts returned nothing or an error." )
+            hostFails.append( controllerStr )
+
+    if hostFails:
+        main.log.error( "List of failed ONOS Nodes:" + ', '.join(map(str, hostFails )) )
+        return main.FALSE
+    else:
+        return main.TRUE
+
+def populateHostData( main ):
+    """
+        Populates hostsData
+    """
+    import json
+    try:
+        hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
+        hosts = main.Mininet1.getHosts().keys()
+        # TODO: Make better use of new getHosts function
+        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' ]
+        return main.TRUE
+    except KeyError:
+        main.log.error( "KeyError while populating hostsData")
+        return main.FALSE
+
+def scapyCheckConnection( main, senders, recipients, packet=None, packetFilter=None, expectFailure=False ):
+    """
+        Checks the connectivity between all given sender hosts and all given recipient hosts
+        Packet may be specified. Defaults to Ether/IP packet
+        Packet Filter may be specified. Defaults to Ether/IP from current sender MAC
+            Todo: Optional packet and packet filter attributes for sender and recipients
+        Expect Failure when the sender and recipient are not supposed to have connectivity
+            Timeout of 1 second, returns main.TRUE if the filter is not triggered and kills the filter
+
+    """
+    connectionsFunctional = main.TRUE
+
+    if not packetFilter:
+        packetFilter = 'ether host {}'
+
+    if expectFailure:
+        timeout = 1
+    else:
+        timeout = 10
+
+    for sender in senders:
+        try:
+            senderComp = getattr( main, sender )
+        except AttributeError:
+            main.log.error( "main has no attribute {}".format( sender ) )
+            connectionsFunctional = main.FALSE
+            continue
+
+        for recipient in recipients:
+            # Do not send packets to self since recipient CLI will already be busy
+            if recipient == sender:
+                continue
+            try:
+                recipientComp = getattr( main, recipient )
+            except AttributeError:
+                main.log.error( "main has no attribute {}".format( recipient ) )
+                connectionsFunctional = main.FALSE
+                continue
+
+            recipientComp.startFilter( pktFilter = packetFilter.format( senderComp.hostMac ) )
+
+            if not packet:
+                pkt = 'Ether( src="{0}", dst="{2}" )/IP( src="{1}", dst="{3}" )'.format(
+                    senderComp.hostMac,
+                    senderComp.hostIp,
+                    recipientComp.hostMac,
+                    recipientComp.hostIp )
+            else:
+                pkt = packet
+            senderComp.sendPacket( packet = pkt )
+
+            if recipientComp.checkFilter( timeout ):
+                if expectFailure:
+                    main.log.error( "Packet from {0} successfully received by {1} when it should not have been".format( sender , recipient ) )
+                    connectionsFunctional = main.FALSE
+                else:
+                    main.log.info( "Packet from {0} successfully received by {1}".format( sender , recipient ) )
+            else:
+                recipientComp.killFilter()
+                if expectFailure:
+                    main.log.info( "As expected, packet from {0} was not received by {1}".format( sender , recipient ) )
+                else:
+                    main.log.error( "Packet from {0} was not received by {1}".format( sender , recipient ) )
+                    connectionsFunctional = main.FALSE
+
+        return connectionsFunctional
+
+def report( main ):
+    """
+        Report errors/warnings/exceptions
+    """
+    main.ONOSbench.logReport( main.ONOSip[ 0 ],
+                              [ "INFO",
+                                "FOLLOWER",
+                                "WARN",
+                                "flow",
+                                "ERROR",
+                                "Except" ],
+                              "s" )
+
+    main.log.info( "ERROR report: \n" )
+    for i in range( main.numCtrls ):
+        main.ONOSbench.logReport( main.ONOSip[ i ],
+                [ "ERROR" ],
+                "d" )
+
+    main.log.info( "EXCEPTIONS report: \n" )
+    for i in range( main.numCtrls ):
+        main.ONOSbench.logReport( main.ONOSip[ i ],
+                [ "Except" ],
+                "d" )
+
+    main.log.info( "WARNING report: \n" )
+    for i in range( main.numCtrls ):
+        main.ONOSbench.logReport( main.ONOSip[ i ],
+                [ "WARN" ],
+                "d" )
diff --git a/TestON/tests/FUNCintentRest/FUNCintentRest.params b/TestON/tests/FUNCintentRest/FUNCintentRest.params
index 058b57a..94339b4 100644
--- a/TestON/tests/FUNCintentRest/FUNCintentRest.params
+++ b/TestON/tests/FUNCintentRest/FUNCintentRest.params
@@ -2,22 +2,25 @@
     # CASE - Description
     # 1 - Variable initialization and optional pull and build ONOS package
     # 2 - Install ONOS
+    # 8 - Compare Topology
     # 9 - Report logs
     # 10 - Start Mininet with Openflow 1.0
     # 11 - Start Mininet with Openflow 1.3
     # 12 - Assign switch to controller
-    # 13 - Create a data of hosts information
-    # 14 - Stop Mininet
+    # 13 - Create Scapy Components
+    # 14 - Discover all hosts and Create a dictionary of hosts information
+    # 15 - Discover hosts with scapy arping ( only discovers scapy hosts )
+    # 16 - Stop Mininet
     # 1000 - Test host intents
     # 2000 - Test point intents
     # 3000 - Test single to multi point intents
     # 4000 - Test multi to single point intents
     # 5000 - Test host mobility
 
-    <testcases>1,[2,10,12,13,1000,2000,14],[2,11,12,13,1000,2000,14]</testcases>
+    <testcases>1,[2,10,12,13,15,1000,2000,5000,16]*2,[2,11,12,13,15,1000,2000,5000,16]*2</testcases>
 
     <SCALE>
-        <size>1,1</size>
+        <size>1,3,1,3</size>
     </SCALE>
 
     <DEPENDENCY>
@@ -40,8 +43,10 @@
         <startup>15</startup>
         <reroute>5</reroute>
         <checkintent>5</checkintent>
-        <fwd>5</fwd>
-        <addIntent>3</addIntent>
+        <removeintent>10</removeintent>
+        <fwd>10</fwd>
+        <addIntent>10</addIntent>
+        <topoAttempts>3</topoAttempts>
     </SLEEP>
 
     <MININET>
@@ -49,6 +54,10 @@
         <links>20</links>
     </MININET>
 
+    <SCAPY>
+        <HOSTNAMES>h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13,h14,h15,h16,h17,h18,h19,h20,h21,h22,h23,h24</HOSTNAMES>
+    </SCAPY>
+
     # Intent tests params
     <SDNIP>
         <tcpProto>6</tcpProto>
diff --git a/TestON/tests/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNCintentRest/FUNCintentRest.py
index c5f12ab..258a9c1 100644
--- a/TestON/tests/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNCintentRest/FUNCintentRest.py
@@ -1,5 +1,10 @@
 
 # Testing the basic intent functionality of ONOS
+# TODO: Replace the CLI calls with REST API equivalents as they become available.
+#           - May need to write functions in the onosrestdriver.py file to do this
+# TODO: Complete implementation of case 3000, 4000, and 6000 as REST API allows
+#           -Currently there is no support in the REST API for Multi to Single and Single to Multi point intents
+#            As such, these cases are incomplete and should not be enabled in the .params file
 
 import time
 import json
@@ -48,11 +53,12 @@
             wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
             wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
             main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
-            main.checkIntentSleep = int( main.params[ 'SLEEP' ]\
-                    [ 'checkintent' ] )
+            main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
+            main.removeIntentsleeo = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
             main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
             main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
             main.addIntentSleep = int( main.params[ 'SLEEP' ][ 'addIntent' ] )
+            main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
             gitPull = main.params[ 'GIT' ][ 'pull' ]
             main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
             main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
@@ -60,8 +66,12 @@
             main.hostsData = {}
             main.CLIs = []
             main.ONOSip = []
+            main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
+            main.scapyHosts = []  # List of scapy hosts for iterating
+            main.assertReturnString = ''  # Assembled assert return string
 
             main.ONOSip = main.ONOSbench.getOnosIps()
+            print main.ONOSip
 
             # Assigning ONOS cli handles to a list
             try:
@@ -94,7 +104,7 @@
             copyResult1 = main.ONOSbench.scp( main.Mininet1,
                                               main.dependencyPath +
                                               main.topology,
-                                              main.Mininet1.home,
+                                              main.Mininet1.home + "custom/",
                                               direction="to" )
             if main.CLIs:
                 stepResult = main.TRUE
@@ -154,6 +164,18 @@
         main.log.info( "Safety check, killing all ONOS processes" +
                        " before initiating environment setup" )
 
+        time.sleep( main.startUpSleep )
+        main.step( "Uninstalling ONOS package" )
+        onosUninstallResult = main.TRUE
+        for ip in main.ONOSip:
+            onosUninstallResult = onosUninstallResult and \
+                    main.ONOSbench.onosUninstall( nodeIp=ip )
+        stepResult = onosUninstallResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully uninstalled ONOS package",
+                                 onfail="Failed to uninstall ONOS package" )
+
         for i in range( main.maxNodes ):
             main.ONOSbench.onosDie( main.ONOSip[ i ] )
 
@@ -186,18 +208,6 @@
                                  onfail="Failed to create ONOS package" )
 
         time.sleep( main.startUpSleep )
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
-        for ip in main.ONOSip:
-            onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=ip )
-        stepResult = onosUninstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
-
-        time.sleep( main.startUpSleep )
         main.step( "Installing ONOS package" )
         onosInstallResult = main.TRUE
         for i in range( main.numCtrls ):
@@ -234,12 +244,103 @@
                                  onpass="ONOS service is ready",
                                  onfail="ONOS service did not start properly" )
 
+        # Revisit adding the cli after ensuring the test works without it
+        # Start an ONOS cli to provide functionality that is not currently
+        # supported by the Rest API
+
+        # 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" )
+
         # Remove the first element in main.scale list
         main.scale.remove( main.scale[ 0 ] )
 
+        main.intentFunction.report( main )
+
     def CASE8( self, main ):
+        # OLD FUNCintentRest CASE 8
+        # This remains here for archiving and reference purposes and will be
+        # removed when the new FUNCintentRest is verified to work.
+        # """
+        # Compare Topo
+        # """
+        # import json
+
+        # main.case( "Compare ONOS Topology view to Mininet topology" )
+        # main.caseExplanation = "Compare topology elements between Mininet" +\
+        #                         " and ONOS"
+
+        # main.step( "Gathering topology information" )
+        # # TODO: add a paramaterized sleep here
+        # devicesResults = main.TRUE  # Overall Boolean for device correctness
+        # linksResults = main.TRUE  # Overall Boolean for link correctness
+        # hostsResults = main.TRUE  # Overall Boolean for host correctness
+        # devices = main.topo.getAllDevices( main )
+        # hosts = main.topo.getAllHosts( main )
+        # ports = main.topo.getAllPorts( main )
+        # links = main.topo.getAllLinks( main )
+        # clusters = main.topo.getAllClusters( main )
+
+        # mnSwitches = main.Mininet1.getSwitches()
+        # mnLinks = main.Mininet1.getLinks()
+        # mnHosts = main.Mininet1.getHosts()
+
+        # main.step( "Comparing MN topology to ONOS topology" )
+        # for controller in range( main.numCtrls ):
+        #     controllerStr = str( controller + 1 )
+        #     if devices[ controller ] and ports[ controller ] and\
+        #         "Error" not in devices[ controller ] and\
+        #         "Error" not in ports[ controller ]:
+
+        #         currentDevicesResult = main.Mininet1.compareSwitches(
+        #                 mnSwitches,
+        #                 json.loads( devices[ controller ] ),
+        #                 json.loads( ports[ controller ] ) )
+        #     else:
+        #         currentDevicesResult = main.FALSE
+        #     utilities.assert_equals( expect=main.TRUE,
+        #                              actual=currentDevicesResult,
+        #                              onpass="ONOS" + controllerStr +
+        #                              " Switches view is correct",
+        #                              onfail="ONOS" + controllerStr +
+        #                              " Switches view is incorrect" )
+
+        #     if links[ controller ] and "Error" not in links[ controller ]:
+        #         currentLinksResult = main.Mininet1.compareLinks(
+        #                 mnSwitches, mnLinks,
+        #                 json.loads( links[ controller ] ) )
+        #     else:
+        #         currentLinksResult = main.FALSE
+        #     utilities.assert_equals( expect=main.TRUE,
+        #                              actual=currentLinksResult,
+        #                              onpass="ONOS" + controllerStr +
+        #                              " links view is correct",
+        #                              onfail="ONOS" + controllerStr +
+        #                              " links view is incorrect" )
+
+        #     if hosts[ controller ] or "Error" not in hosts[ controller ]:
+        #         currentHostsResult = main.Mininet1.compareHosts(
+        #                 mnHosts,
+        #                 json.loads( hosts[ controller ] ) )
+        #     else:
+        #         currentHostsResult = main.FALSE
+        #     utilities.assert_equals( expect=main.TRUE,
+        #                              actual=currentHostsResult,
+        #                              onpass="ONOS" + controllerStr +
+        #                              " hosts exist in Mininet",
+        #                              onfail="ONOS" + controllerStr +
+        #                              " hosts don't match Mininet" )
+
+        # NEW FUNCintentRest Case 8 as based off of the CASE 8 from FUNCintent
         """
-        Compare Topo
+        Compare ONOS Topology to Mininet Topology
         """
         import json
 
@@ -247,66 +348,114 @@
         main.caseExplanation = "Compare topology elements between Mininet" +\
                                 " and ONOS"
 
-        main.step( "Gathering topology information" )
-        # TODO: add a paramaterized sleep here
-        devicesResults = main.TRUE
-        linksResults = main.TRUE
-        hostsResults = main.TRUE
-        devices = main.topo.getAllDevices( main )
-        hosts = main.topo.getAllHosts( main )
-        ports = main.topo.getAllPorts( main )
-        links = main.topo.getAllLinks( main )
-        clusters = main.topo.getAllClusters( main )
+        main.log.info( "Gathering topology information from Mininet" )
+        devicesResults = main.FALSE  # Overall Boolean for device correctness
+        linksResults = main.FALSE  # Overall Boolean for link correctness
+        hostsResults = main.FALSE  # Overall Boolean for host correctness
+        deviceFails = []  # Nodes where devices are incorrect
+        linkFails = []  # Nodes where links are incorrect
+        hostFails = []  # Nodes where hosts are incorrect
+        attempts = main.checkTopoAttempts  # Remaining Attempts
 
         mnSwitches = main.Mininet1.getSwitches()
         mnLinks = main.Mininet1.getLinks()
         mnHosts = main.Mininet1.getHosts()
 
-        main.step( "Comparing MN topology to ONOS topology" )
-        for controller in range( main.numCtrls ):
-            controllerStr = str( controller + 1 )
-            if devices[ controller ] and ports[ controller ] and\
-                "Error" not in devices[ controller ] and\
-                "Error" not in ports[ controller ]:
+        main.step( "Comparing Mininet topology to ONOS topology" )
 
-                currentDevicesResult = main.Mininet1.compareSwitches(
-                        mnSwitches,
-                        json.loads( devices[ controller ] ),
-                        json.loads( ports[ controller ] ) )
-            else:
-                currentDevicesResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentDevicesResult,
-                                     onpass="ONOS" + controllerStr +
-                                     " Switches view is correct",
-                                     onfail="ONOS" + controllerStr +
-                                     " Switches view is incorrect" )
+        while ( attempts >= 0 ) and\
+            ( not devicesResults or not linksResults or not hostsResults ):
+            time.sleep( 2 )
+            if not devicesResults:
+                devices = main.topo.getAllDevices( main )
+                ports = main.topo.getAllPorts( main )
+                devicesResults = main.TRUE
+                deviceFails = []  # Reset for each failed attempt
+            if not linksResults:
+                links = main.topo.getAllLinks( main )
+                linksResults = main.TRUE
+                linkFails = []  # Reset for each failed attempt
+            if not hostsResults:
+                hosts = main.topo.getAllHosts( main )
+                hostsResults = main.TRUE
+                hostFails = []  # Reset for each failed attempt
 
-            if links[ controller ] and "Error" not in links[ controller ]:
-                currentLinksResult = main.Mininet1.compareLinks(
-                        mnSwitches, mnLinks,
-                        json.loads( links[ controller ] ) )
-            else:
-                currentLinksResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentLinksResult,
-                                     onpass="ONOS" + controllerStr +
-                                     " links view is correct",
-                                     onfail="ONOS" + controllerStr +
-                                     " links view is incorrect" )
+            #  Check for matching topology on each node
+            for controller in range( main.numCtrls ):
+                controllerStr = str( controller + 1 )  # ONOS node number
+                # Compare Devices
+                if devices[ controller ] and ports[ controller ] and\
+                    "Error" not in devices[ controller ] and\
+                    "Error" not in ports[ controller ]:
 
-            if hosts[ controller ] or "Error" not in hosts[ controller ]:
-                currentHostsResult = main.Mininet1.compareHosts(
-                        mnHosts,
-                        json.loads( hosts[ controller ] ) )
-            else:
-                currentHostsResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentHostsResult,
-                                     onpass="ONOS" + controllerStr +
-                                     " hosts exist in Mininet",
-                                     onfail="ONOS" + controllerStr +
-                                     " hosts don't match Mininet" )
+                    try:
+                        deviceData = json.loads( devices[ controller ] )
+                        portData = json.loads( ports[ controller ] )
+                    except (TypeError,ValueError):
+                        main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) )
+                        currentDevicesResult = main.FALSE
+                    else:
+                        currentDevicesResult = main.Mininet1.compareSwitches(
+                            mnSwitches,deviceData,portData )
+                else:
+                    currentDevicesResult = main.FALSE
+                if not currentDevicesResult:
+                    deviceFails.append( controllerStr )
+                devicesResults = devicesResults and currentDevicesResult
+                # Compare Links
+                if links[ controller ] and "Error" not in links[ controller ]:
+                    try:
+                        linkData = json.loads( links[ controller ] )
+                    except (TypeError,ValueError):
+                        main.log.error("Could not load json:" + str( links[ controller ] ) )
+                        currentLinksResult = main.FALSE
+                    else:
+                        currentLinksResult = main.Mininet1.compareLinks(
+                            mnSwitches, mnLinks,linkData )
+                else:
+                    currentLinksResult = main.FALSE
+                if not currentLinksResult:
+                    linkFails.append( controllerStr )
+                linksResults = linksResults and currentLinksResult
+                # Compare Hosts
+                if hosts[ controller ] and "Error" not in hosts[ controller ]:
+                    try:
+                        hostData = json.loads( hosts[ controller ] )
+                    except (TypeError,ValueError):
+                        main.log.error("Could not load json:" + str( hosts[ controller ] ) )
+                        currentHostsResult = main.FALSE
+                    else:
+                        currentHostsResult = main.Mininet1.compareHosts(
+                                mnHosts,hostData )
+                else:
+                    currentHostsResult = main.FALSE
+                if not currentHostsResult:
+                    hostFails.append( controllerStr )
+                hostsResults = hostsResults and currentHostsResult
+            # Decrement Attempts Remaining
+            attempts -= 1
+
+
+        utilities.assert_equals( expect=[],
+                                 actual=deviceFails,
+                                 onpass="ONOS correctly discovered all devices",
+                                 onfail="ONOS incorrectly discovered devices on nodes: " +
+                                 str( deviceFails ) )
+        utilities.assert_equals( expect=[],
+                                 actual=linkFails,
+                                 onpass="ONOS correctly discovered all links",
+                                 onfail="ONOS incorrectly discovered links on nodes: " +
+                                 str( linkFails ) )
+        utilities.assert_equals( expect=[],
+                                 actual=hostFails,
+                                 onpass="ONOS correctly discovered all hosts",
+                                 onfail="ONOS incorrectly discovered hosts on nodes: " +
+                                 str( hostFails ) )
+        topoResults = hostsResults and linksResults and devicesResults
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=topoResults,
+                                 onpass="ONOS correctly discovered the topology",
+                                 onfail="ONOS incorrectly discovered the topology" )
 
     def CASE9( self, main ):
         '''
@@ -413,7 +562,35 @@
                                         "to controller",
                                  onfail="Failed to assign switches to " +
                                         "controller" )
-    def CASE13( self, main ):
+
+    def CASE13( self,main ):
+        """
+            Create Scapy components
+        """
+        main.case( "Create scapy components" )
+        main.step( "Create scapy components" )
+        import json
+        scapyResult = main.TRUE
+        for hostName in main.scapyHostNames:
+            main.Scapy1.createHostComponent( hostName )
+            main.scapyHosts.append( getattr( main, hostName ) )
+
+        main.step( "Start scapy components" )
+        for host in main.scapyHosts:
+            host.startHostCli()
+            host.startScapy()
+            host.updateSelf()
+            main.log.debug( host.name )
+            main.log.debug( host.hostIp )
+            main.log.debug( host.hostMac )
+
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=scapyResult,
+                                 onpass="Successfully created Scapy Components",
+                                 onfail="Failed to discover Scapy Components" )
+
+    def CASE14( self, main ):
         """
             Discover all hosts and store its data to a dictionary
         """
@@ -441,24 +618,73 @@
                                  onpass="Successfully discovered hosts",
                                  onfail="Failed to discover hosts" )
 
-    def CASE14( self, main ):
+    def CASE15( self, main ):
         """
-            Stop mininet
+            Discover all hosts with scapy arp packets and store its data to a dictionary
         """
-        main.log.report( "Stop Mininet topology" )
-        main.case( "Stop Mininet topology" )
+        main.case( "Discover all hosts using scapy" )
+        main.step( "Send packets from each host to the first host and confirm onos discovery" )
+
+        import collections
+        if len( main.scapyHosts ) < 1:
+            main.log.error( "No scapy hosts have been created" )
+            main.skipCase()
+
+        # Send ARP packets from each scapy host component
+        main.intentFunction.sendDiscoveryArp( main, main.scapyHosts )
+
+        stepResult = utilities.retry( f=main.intentFunction.confirmHostDiscovery,
+                                      retValue=main.FALSE, args=[ main ],
+                                      attempts=main.checkTopoAttempts, sleep=2 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="ONOS correctly discovered all hosts",
+                                 onfail="ONOS incorrectly discovered hosts" )
+
+        main.step( "Populate hostsData" )
+        stepResult = main.intentFunction.populateHostData( main )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully populated hostsData",
+                                 onfail="Failed to populate hostsData" )
+
+    def CASE16( self, main ):
+        """
+            Stop mininet and remove scapy hosts
+        """
+        main.log.report( "Stop Mininet and Scapy" )
+        main.case( "Stop Mininet and Scapy" )
         main.caseExplanation = "Stopping the current mininet topology " +\
                                 "to start up fresh"
 
+        main.step( "Stopping and Removing Scapy Host Components" )
+        scapyResult = main.TRUE
+        for host in main.scapyHosts:
+            scapyResult = scapyResult and host.stopScapy()
+            main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
+
+        for host in main.scapyHosts:
+            scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
+            main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
+
+        main.scapyHosts = []
+        main.scapyHostIPs = []
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=scapyResult,
+                                 onpass="Successfully stopped scapy and removed host components",
+                                 onfail="Failed to stop mininet and scapy" )
+
         main.step( "Stopping Mininet Topology" )
-        topoResult = main.Mininet1.stopNet( )
-        stepResult = topoResult
+        mininetResult = main.Mininet1.stopNet( )
+
         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:
+        if not (mininetResult and scapyResult ):
             main.cleanup()
             main.exit()
 
@@ -502,120 +728,182 @@
                                 "etc;\nThe test will use OF " + main.OFProtocol\
                                 + " OVS running in Mininet"
 
-        main.step( "IPV4: Add host intents between h1 and h9" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.hostIntent( main,
-                                              onosNode='0',
+        main.step( "IPV4: Add and test host intents between h1 and h9" )
+        main.assertReturnString = "Assertion result for IPV4 host intent with mac addresses\n"
+        host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
+        host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
+        testResult = main.FALSE
+        installResult = main.intentFunction.installHostIntent( main,
                                               name='IPV4',
-                                              host1='h1',
-                                              host2='h9',
-                                              host1Id='00:00:00:00:00:01/-1',
-                                              host2Id='00:00:00:00:00:09/-1',
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2 )
+
+        if installResult:
+            testResult = main.intentFunction.testHostIntent( main,
+                                              name='IPV4',
+                                              intentId = installResult,
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2,
                                               sw1='s5',
                                               sw2='s2',
-                                              expectedLink=18 )
+                                              expectedLink = 18 )
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="IPV4: Host intent test successful " +
-                                        "between two IPV4 hosts",
-                                 onfail="IPV4: Host intent test failed " +
-                                        "between two IPV4 hosts")
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
         main.step( "DUALSTACK1: Add host intents between h3 and h11" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.hostIntent( main,
-                                              name='DUALSTACK',
-                                              host1='h3',
-                                              host2='h11',
-                                              host1Id='00:00:00:00:00:03/-1',
-                                              host2Id='00:00:00:00:00:0B/-1',
+        main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
+        host1 = { "name":"h3", "id":"00:00:00:00:00:03/-1" }
+        host2 = { "name":"h11","id":"00:00:00:00:00:0B/-1"}
+        testResult = main.FALSE
+        installResult = main.intentFunction.installHostIntent( main,
+                                              name='DUALSTACK1',
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2 )
+
+        if installResult:
+            testResult = main.intentFunction.testHostIntent( main,
+                                              name='DUALSTACK1',
+                                              intentId = installResult,
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2,
                                               sw1='s5',
                                               sw2='s2',
-                                              expectedLink=18 )
+                                              expectedLink = 18 )
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="DUALSTACK: Host intent test " +
-                                        "successful between two " +
-                                        "dual stack host using IPV4",
-                                 onfail="DUALSTACK: Host intent test " +
-                                        "failed between two" +
-                                        "dual stack host using IPV4" )
-
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString)
 
         main.step( "DUALSTACK2: Add host intents between h1 and h11" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.hostIntent( main,
+        main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
+        host1 = { "name":"h1" }
+        host2 = { "name":"h11" }
+        testResult = main.FALSE
+        installResult = main.intentFunction.installHostIntent( main,
                                               name='DUALSTACK2',
-                                              host1='h1',
-                                              host2='h11',
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2 )
+
+        if installResult:
+            testResult = main.intentFunction.testHostIntent( main,
+                                              name='DUALSTACK2',
+                                              intentId = installResult,
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2,
                                               sw1='s5',
                                               sw2='s2',
-                                              expectedLink=18 )
+                                              expectedLink = 18 )
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="DUALSTACK2: Host intent test " +
-                                        "successful between two " +
-                                        "dual stack host using IPV4",
-                                 onfail="DUALSTACK2: Host intent test " +
-                                        "failed between two" +
-                                        "dual stack host using IPV4" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
         main.step( "1HOP: Add host intents between h1 and h3" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.hostIntent( main,
+        main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
+        host1 = { "name":"h1" }
+        host2 = { "name":"h3" }
+        testResult = main.FALSE
+        installResult = main.intentFunction.installHostIntent( main,
                                               name='1HOP',
-                                              host1='h1',
-                                              host2='h3' )
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2 )
 
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="1HOP: Host intent test " +
-                                        "successful between two " +
-                                        "host using IPV4 in the same switch",
-                                 onfail="1HOP: Host intent test " +
-                                        "failed between two" +
-                                        "host using IPV4 in the same switch" )
-
-        main.step( "VLAN1: Add vlan host intents between h4 and h12" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.hostIntent( main,
-                                              name='VLAN1',
-                                              host1='h4',
-                                              host2='h12',
-                                              host1Id='00:00:00:00:00:04/100',
-                                              host2Id='00:00:00:00:00:0C/100',
+        if installResult:
+            testResult = main.intentFunction.testHostIntent( main,
+                                              name='1HOP',
+                                              intentId = installResult,
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2,
                                               sw1='s5',
                                               sw2='s2',
-                                              expectedLink=18 )
+                                              expectedLink = 18 )
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="VLAN1: Host intent test " +
-                                        "successful between two " +
-                                        "host using IPV4 in the same VLAN",
-                                 onfail="VLAN1: Host intent test " +
-                                        "failed between two" +
-                                        "host using IPV4 in the same VLAN" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
+
+        main.step( "VLAN1: Add vlan host intents between h4 and h12" )
+        main.assertReturnString = "Assertion Result vlan IPV4\n"
+        host1 = { "name":"h4","id":"00:00:00:00:00:04/100" }
+        host2 = { "name":"h12","id":"00:00:00:00:00:0C/100" }
+        testResult = main.FALSE
+        installResult = main.intentFunction.installHostIntent( main,
+                                              name='VLAN1',
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2 )
+
+        if installResult:
+            testResult = main.intentFunction.testHostIntent( main,
+                                              name='VLAN1',
+                                              intentId = installResult,
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2,
+                                              sw1='s5',
+                                              sw2='s2',
+                                              expectedLink = 18 )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
         main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.hostIntent( main,
+        main.assertReturnString = "Assertion Result different VLAN negative test\n"
+        host1 = { "name":"h13" }
+        host2 = { "name":"h20" }
+        testResult = main.FALSE
+        installResult = main.intentFunction.installHostIntent( main,
                                               name='VLAN2',
-                                              host1='h13',
-                                              host2='h20' )
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2 )
 
-        utilities.assert_equals( expect=main.FALSE,
-                                 actual=stepResult,
-                                 onpass="VLAN2: Host intent negative test " +
-                                        "successful between two " +
-                                        "host using IPV4 in different VLAN",
-                                 onfail="VLAN2: Host intent negative test " +
-                                        "failed between two" +
-                                        "host using IPV4 in different VLAN" )
+        if installResult:
+            testResult = main.intentFunction.testHostIntent( main,
+                                              name='VLAN2',
+                                              intentId = installResult,
+                                              onosNode='0',
+                                              host1=host1,
+                                              host2=host2,
+                                              sw1='s5',
+                                              sw2='s2',
+                                              expectedLink = 18 )
 
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
+
+        # Uncomment the following if a REST command is ever added to check leaders
+        # or if the cli is enabled
+
+        # main.step( "Confirm that ONOS leadership is unchanged")
+        # intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
+        # main.intentFunction.checkLeaderChange( intentLeadersOld,
+        #                                         intentLeadersNew )
+
+        # utilities.assert_equals( expect=main.TRUE,
+        #                          actual=testResult,
+        #                          onpass="ONOS Leaders Unchanged",
+        #                          onfail="ONOS Leader Mismatch")
+
+        main.intentFunction.report( main )
 
     def CASE2000( self, main ):
         """
@@ -660,128 +948,140 @@
 
         # No option point intents
         main.step( "NOOPTION: Add point intents between h1 and h9" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.pointIntent(
+        main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
+        senders = [
+            { "name":"h1","device":"of:0000000000000005/1" }
+        ]
+        recipients = [
+            { "name":"h9","device":"of:0000000000000006/1" }
+        ]
+        testResult = main.FALSE
+        installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="NOOPTION",
-                                       host1="h1",
-                                       host2="h9",
-                                       deviceId1="of:0000000000000005/1",
-                                       deviceId2="of:0000000000000006/1",
-                                       sw1="s5",
-                                       sw2="s2",
-                                       expectedLink=18 )
+                                       senders=senders,
+                                       recipients=recipients )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                                         main,
+                                         intentId=installResult,
+                                         name="NOOPTION",
+                                         senders=senders,
+                                         recipients=recipients,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18)
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="NOOPTION: Point intent test " +
-                                        "successful using no match action",
-                                 onfail="NOOPTION: Point intent test " +
-                                        "failed using no match action" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
-        stepResult = main.TRUE
         main.step( "IPV4: Add point intents between h1 and h9" )
-        stepResult = main.intentFunction.pointIntent(
+        main.assertReturnString = "Assertion Result for IPV4 point intent\n"
+        senders = [
+            { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
+        ]
+        recipients = [
+            { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09" }
+        ]
+        installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="IPV4",
-                                       host1="h1",
-                                       host2="h9",
-                                       deviceId1="of:0000000000000005/1",
-                                       deviceId2="of:0000000000000006/1",
-                                       port1="",
-                                       port2="",
-                                       ethType="IPV4",
-                                       mac1="00:00:00:00:00:01",
-                                       mac2="00:00:00:00:00:09",
-                                       bandwidth="",
-                                       lambdaAlloc=False,
-                                       ipProto="",
-                                       ip1="",
-                                       ip2="",
-                                       tcp1="",
-                                       tcp2="",
-                                       sw1="s5",
-                                       sw2="s2",
-                                       expectedLink=18 )
+                                       senders=senders,
+                                       recipients=recipients,
+                                       ethType="IPV4" )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                                         main,
+                                         intentId=installResult,
+                                         name="IPV4",
+                                         senders=senders,
+                                         recipients=recipients,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18)
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="IPV4: Point intent test " +
-                                        "successful using IPV4 type with " +
-                                        "MAC addresses",
-                                 onfail="IPV4: Point intent test " +
-                                        "failed using IPV4 type with " +
-                                        "MAC addresses" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
         main.step( "IPV4_2: Add point intents between h1 and h9" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.pointIntent(
+        main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
+        senders = [
+            { "name":"h1","device":"of:0000000000000005/1" }
+        ]
+        recipients = [
+            { "name":"h9","device":"of:0000000000000006/1" }
+        ]
+        installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="IPV4_2",
-                                       host1="h1",
-                                       host2="h9",
-                                       deviceId1="of:0000000000000005/1",
-                                       deviceId2="of:0000000000000006/1",
-                                       ipProto="",
-                                       ip1="",
-                                       ip2="",
-                                       tcp1="",
-                                       tcp2="",
-                                       sw1="s5",
-                                       sw2="s2",
-                                       expectedLink=18 )
+                                       senders=senders,
+                                       recipients=recipients,
+                                       ethType="IPV4" )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                                         main,
+                                         intentId=installResult,
+                                         name="IPV4_2",
+                                         senders=senders,
+                                         recipients=recipients,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18)
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="IPV4_2: Point intent test " +
-                                        "successful using IPV4 type with " +
-                                        "no MAC addresses",
-                                 onfail="IPV4_2: Point intent test " +
-                                        "failed using IPV4 type with " +
-                                        "no MAC addresses" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
         main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
-        stepResult = main.TRUE
-        mac1 = main.hostsData[ 'h1' ][ 'mac' ]
-        mac2 = main.hostsData[ 'h9' ][ 'mac' ]
-        try:
-            ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
-            ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
-        except KeyError:
-            main.log.debug( "Key Error getting IP addresses of h1 | h9 in" +
-                            "main.hostsData" )
-            ip1 = main.Mininet1.getIPAddress( 'h1')
-            ip2 = main.Mininet1.getIPAddress( 'h9')
-
+        main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
+        senders = [
+            { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01",
+              "ip":main.h1.hostIp }
+        ]
+        recipients = [
+            { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09",
+              "ip":main.h9.hostIp }
+        ]
         ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
         # Uneccessary, not including this in the selectors
-        tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
-        tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
+        tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
+        tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
 
-        stepResult = main.intentFunction.pointIntent(
-                                           main,
-                                           name="SDNIP-ICMP",
-                                           host1="h1",
-                                           host2="h9",
-                                           deviceId1="of:0000000000000005/1",
-                                           deviceId2="of:0000000000000006/1",
-                                           mac1=mac1,
-                                           mac2=mac2,
-                                           ethType="IPV4",
-                                           ipProto=ipProto,
-                                           ip1=ip1,
-                                           ip2=ip2 )
+        installResult = main.intentFunction.installPointIntent(
+                                       main,
+                                       name="SDNIP-ICMP",
+                                       senders=senders,
+                                       recipients=recipients,
+                                       ethType="IPV4",
+                                       ipProto=ipProto,
+                                       tcpSrc=tcpSrc,
+                                       tcpDst=tcpDst )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                                         main,
+                                         intentId=installResult,
+                                         name="SDNIP_ICMP",
+                                         senders=senders,
+                                         recipients=recipients,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18)
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="SDNIP-ICMP: Point intent test " +
-                                        "successful using IPV4 type with " +
-                                        "IP protocol TCP enabled",
-                                 onfail="SDNIP-ICMP: Point intent test " +
-                                        "failed using IPV4 type with " +
-                                        "IP protocol TCP enabled" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
         main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
-        stepResult = main.TRUE
+        main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
         mac1 = main.hostsData[ 'h1' ][ 'mac' ]
         mac2 = main.hostsData[ 'h9' ][ 'mac' ]
         ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
@@ -808,96 +1108,103 @@
 
         utilities.assert_equals( expect=main.TRUE,
                              actual=stepResult,
-                                 onpass="SDNIP-TCP: Point intent test " +
-                                        "successful using IPV4 type with " +
-                                        "IP protocol TCP enabled",
-                                 onfail="SDNIP-TCP: Point intent test " +
-                                        "failed using IPV4 type with " +
-                                        "IP protocol TCP enabled" )
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
-        main.step( "DUALSTACK1: Add point intents between h1 and h9" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.pointIntent(
+        main.step( "DUALSTACK1: Add point intents between h3 and h11" )
+        main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
+        senders = [
+            { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
+        ]
+        recipients = [
+            { "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" }
+        ]
+        installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="DUALSTACK1",
-                                       host1="h3",
-                                       host2="h11",
-                                       deviceId1="of:0000000000000005",
-                                       deviceId2="of:0000000000000006",
-                                       port1="3",
-                                       port2="3",
-                                       ethType="IPV4",
-                                       mac1="00:00:00:00:00:03",
-                                       mac2="00:00:00:00:00:0B",
-                                       bandwidth="",
-                                       lambdaAlloc=False,
-                                       ipProto="",
-                                       ip1="",
-                                       ip2="",
-                                       tcp1="",
-                                       tcp2="",
-                                       sw1="s5",
-                                       sw2="s2",
-                                       expectedLink=18 )
+                                       senders=senders,
+                                       recipients=recipients,
+                                       ethType="IPV4" )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                                         main,
+                                         intentId=installResult,
+                                         name="DUALSTACK1",
+                                         senders=senders,
+                                         recipients=recipients,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18)
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="DUALSTACK1: Point intent test " +
-                                        "successful using IPV4 type with " +
-                                        "MAC addresses",
-                                 onfail="DUALSTACK1: Point intent test " +
-                                        "failed using IPV4 type with " +
-                                        "MAC addresses" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
         main.step( "VLAN: Add point intents between h5 and h21" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.pointIntent(
+        main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
+        senders = [
+            { "name":"h5","device":"of:0000000000000005/5","mac":"00:00:00:00:00:05" }
+        ]
+        recipients = [
+            { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15" }
+        ]
+        installResult = main.intentFunction.installPointIntent(
                                        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 )
+                                       name="DUALSTACK1",
+                                       senders=senders,
+                                       recipients=recipients,
+                                       ethType="IPV4" )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                                         main,
+                                         intentId=installResult,
+                                         name="DUALSTACK1",
+                                         senders=senders,
+                                         recipients=recipients,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18)
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="VLAN1: Point intent test " +
-                                        "successful using IPV4 type with " +
-                                        "MAC addresses",
-                                 onfail="VLAN1: Point intent test " +
-                                        "failed using IPV4 type with " +
-                                        "MAC addresses" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
         main.step( "1HOP: Add point intents between h1 and h3" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.hostIntent( main,
-                                              name='1HOP',
-                                              host1='h1',
-                                              host2='h3' )
+        main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
+        senders = [
+            { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
+        ]
+        recipients = [
+            { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
+        ]
+        installResult = main.intentFunction.installPointIntent(
+                                       main,
+                                       name="1HOP IPV4",
+                                       senders=senders,
+                                       recipients=recipients,
+                                       ethType="IPV4" )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                                         main,
+                                         intentId=installResult,
+                                         name="1HOP IPV4",
+                                         senders=senders,
+                                         recipients=recipients,
+                                         sw1="s5",
+                                         sw2="s2",
+                                         expectedLink=18)
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="1HOP: Point intent test " +
-                                        "successful using IPV4 type with " +
-                                        "no MAC addresses",
-                                 onfail="1HOP: Point intent test " +
-                                        "failed using IPV4 type with " +
-                                        "no MAC addresses" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
+
+        main.intentFunction.report( main )
 
     def CASE3000( self, main ):
         """
@@ -1178,8 +1485,52 @@
                                         " to single point intents" )
 
     def CASE5000( self, main ):
+        # """
+        # Will add description in next patch set
+        # """
+        # assert main, "There is no main"
+        # assert main.CLIs, "There is no main.CLIs"
+        # assert main.Mininet1, "Mininet handle should be named Mininet1"
+        # assert main.numSwitch, "Placed the total number of switch topology in \
+        #                         main.numSwitch"
+        # main.case( "Test host mobility with host intents " )
+        # main.step( " Testing host mobility by moving h1 from s5 to s6" )
+        # h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
+
+        # main.log.info( "Moving h1 from s5 to s6")
+
+        # main.Mininet1.moveHost( "h1","s5","s6" )
+
+        # main.intentFunction.getHostsData( main )
+        # h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
+
+        # utilities.assert_equals( expect="of:0000000000000006",
+        #                          actual=h1PostMove,
+        #                          onpass="Mobility: Successfully moved h1 to s6",
+        #                          onfail="Mobility: Failed to moved h1 to s6" +
+        #                                 " to single point intents" +
+        #                                 " with IPV4 type and MAC addresses" +
+        #                                 " in the same VLAN" )
+
+        # main.step( "IPV4: Add host intents between h1 and h9" )
+        # stepResult = main.TRUE
+        # stepResult = main.intentFunction.hostIntent( main,
+        #                                       onosNode='0',
+        #                                       name='IPV4',
+        #                                       host1='h1',
+        #                                       host2='h9',
+        #                                       host1Id='00:00:00:00:00:01/-1',
+        #                                       host2Id='00:00:00:00:00:09/-1' )
+
+        # utilities.assert_equals( expect=main.TRUE,
+        #                          actual=stepResult,
+        #                          onpass="IPV4: Host intent test successful " +
+        #                                 "between two IPV4 hosts",
+        #                          onfail="IPV4: Host intent test failed " +
+        #                                 "between two IPV4 hosts")
         """
-        Will add description in next patch set
+        Tests Host Mobility
+        Modifies the topology location of h1
         """
         assert main, "There is no main"
         assert main.CLIs, "There is no main.CLIs"
@@ -1187,37 +1538,58 @@
         assert main.numSwitch, "Placed the total number of switch topology in \
                                 main.numSwitch"
         main.case( "Test host mobility with host intents " )
-        main.step( " Testing host mobility by moving h1 from s5 to s6" )
+        main.step( "Testing host mobility by moving h1 from s5 to s6" )
         h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
 
         main.log.info( "Moving h1 from s5 to s6")
-
         main.Mininet1.moveHost( "h1","s5","s6" )
 
-        main.intentFunction.getHostsData( main )
+        # Send discovery ping from moved host
+        # Moving the host brings down the default interfaces and creates a new one.
+        # Scapy is restarted on this host to detect the new interface
+        main.h1.stopScapy()
+        main.h1.startScapy()
+
+        # Discover new host location in ONOS and populate host data.
+        # Host 1 IP and MAC should be unchanged
+        main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] )
+        main.intentFunction.populateHostData( main )
+
         h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
 
         utilities.assert_equals( expect="of:0000000000000006",
                                  actual=h1PostMove,
                                  onpass="Mobility: Successfully moved h1 to s6",
-                                 onfail="Mobility: Failed to moved h1 to s6" +
+                                 onfail="Mobility: Failed to move h1 to s6" +
                                         " to single point intents" +
                                         " with IPV4 type and MAC addresses" +
                                         " in the same VLAN" )
 
         main.step( "IPV4: Add host intents between h1 and h9" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.hostIntent( main,
+        main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
+        host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
+        host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
+
+        installResult = main.intentFunction.installHostIntent( main,
+                                              name='IPV4 Mobility IPV4',
                                               onosNode='0',
-                                              name='IPV4',
-                                              host1='h1',
-                                              host2='h9',
-                                              host1Id='00:00:00:00:00:01/-1',
-                                              host2Id='00:00:00:00:00:09/-1' )
+                                              host1=host1,
+                                              host2=host2)
+        if installResult:
+            testResult = main.intentFunction.testHostIntent( main,
+                                                  name='Host Mobility IPV4',
+                                                  intentId = installResult,
+                                                  onosNode='0',
+                                                  host1=host1,
+                                                  host2=host2,
+                                                  sw1="s6",
+                                                  sw2="s2",
+                                                  expectedLink=18 )
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="IPV4: Host intent test successful " +
-                                        "between two IPV4 hosts",
-                                 onfail="IPV4: Host intent test failed " +
-                                        "between two IPV4 hosts")
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
+
+        main.intentFunction.report( main )
+
diff --git a/TestON/tests/FUNCintentRest/FUNCintentRest.topo b/TestON/tests/FUNCintentRest/FUNCintentRest.topo
index efed3d6..6be48c6 100755
--- a/TestON/tests/FUNCintentRest/FUNCintentRest.topo
+++ b/TestON/tests/FUNCintentRest/FUNCintentRest.topo
@@ -50,8 +50,18 @@
             <password></password>
             <type>MininetCliDriver</type>
             <connect_order>5</connect_order>
-            <COMPONENTS> </COMPONENTS>
+            <COMPONENTS>
+                <home>~/mininet/</home>
+            </COMPONENTS>
         </Mininet1>
 
+        <Scapy1>
+            <host>OCN</host>
+            <user>admin</user>
+            <password></password>
+            <type>ScapyCliDriver</type>
+            <connect_order>6</connect_order>
+        </Scapy1>
+
     </COMPONENT>
 </TOPOLOGY>
