diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.params b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.params
index 4b3af6a..7e8b105 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.params
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.params
@@ -20,8 +20,7 @@
     # 4000 - Test multi to single point intents
     # 5000 - Test host mobility
 
-    <testcases>1,[2,10,12,13,15,16,1000,2000,5000,18,19]*2,[2,10,12,13,15,16,17,1000,2000,5000,18,19]*2,[2,11,12,13,15,16,1000,2000,5000,18,19]*2,[2,11,12,13,15,16,17,1000,2000,5000,18,19]*2</testcases>
-
+    <testcases>1,[2,10,12,13,15,16,1000,2000,3000,5000,18,19]*2,[2,10,12,13,15,16,17,1000,2000,3000,5000,18,19]*2,[2,11,12,13,15,16,1000,2000,3000,5000,18,19]*2,[2,11,12,13,15,16,17,1000,2000,3000,5000,18,19]*2</testcases>
     <SCALE>
         <size>1,3,1,3,1,3,1,3</size>
     </SCALE>
@@ -66,6 +65,7 @@
     <SDNIP>
         <tcpProto>6</tcpProto>
         <icmpProto>1</icmpProto>
+        <ipPrototype>6</ipPrototype>
         <srcPort>5001</srcPort>
         <dstPort>5001</dstPort>
     </SDNIP>
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
index b99d449..7a9d295 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
@@ -405,7 +405,8 @@
                         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 ] ) ) )
+                        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(
@@ -795,7 +796,8 @@
                                             "/tmp/karaf.log",
                                             direction="from" )
             copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
-                                                                    copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
+                                                                    copyFileName=( "karaf.log.node{0}.cycle{1}".format(
+                                                                        str( i + 1 ), str( main.cycle ) ) ) )
             if scpResult and copyResult:
                 stepResult =  main.TRUE and stepResult
             else:
@@ -1063,14 +1065,11 @@
                     - Ping hosts
                 - Remove intents
         """
-        import time
-        import json
-        import re
         if main.initialized == main.FALSE:
             main.log.error( "Test components did not start correctly, skipping further tests" )
             main.skipCase()
-        # Assert variables - These variable's name|format must be followed
-        # if you want to use the wrapper function
+            # Assert variables - These variable's name|format must be followed
+            # if you want to use the wrapper function
         assert main, "There is no main"
         try:
             assert main.RESTs
@@ -1093,31 +1092,31 @@
             main.skipCase()
 
         main.case( "Point Intents Test - " + str( main.numCtrls ) +
-                   " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
-        main.caseExplanation = "This test case will test point to point" +\
-                               " intents using " + str( main.numCtrls ) +\
-                               " node(s) cluster;\n" +\
-                               "Different type of hosts will be tested in " +\
-                               "each step such as IPV4, Dual stack, VLAN etc" +\
-                               ";\nThe test will use OF " + main.OFProtocol +\
-                               " OVS running in Mininet and compile intents" +\
+                  " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
+        main.caseExplanation = "This test case will test point to point" + \
+                               " intents using " + str( main.numCtrls ) + \
+                               " node(s) cluster;\n" + \
+                               "Different type of hosts will be tested in " + \
+                               "each step such as IPV4, Dual stack, VLAN etc" + \
+                               ";\nThe test will use OF " + main.OFProtocol + \
+                               " OVS running in Mininet and compile intents" + \
                                " using " + main.flowCompiler
 
-        # No option point intents
+        # No option point intent
         main.step( "NOOPTION: Add point intents between h1 and h9" )
         main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
         senders = [
-            { "name":"h1","device":"of:0000000000000005/1" }
+            { "name": "h1", "device": "of:0000000000000005/1" }
         ]
         recipients = [
-            { "name":"h9","device":"of:0000000000000006/1" }
+            { "name": "h9", "device": "of:0000000000000006/1" }
         ]
         testResult = main.FALSE
         installResult = main.intentFunction.installPointIntent(
-                                       main,
-                                       name="NOOPTION",
-                                       senders=senders,
-                                       recipients=recipients )
+            main,
+            name="NOOPTION",
+            senders=senders,
+            recipients=recipients )
 
         if installResult:
             testResult = main.intentFunction.testPointIntent(
@@ -1138,17 +1137,17 @@
         main.step( "IPV4: Add point intents between h1 and h9" )
         main.assertReturnString = "Assertion Result for IPV4 point intent\n"
         senders = [
-            { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
+            { "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" }
+            { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
         ]
         installResult = main.intentFunction.installPointIntent(
-                                       main,
-                                       name="IPV4",
-                                       senders=senders,
-                                       recipients=recipients,
-                                       ethType="IPV4" )
+            main,
+            name="IPV4",
+            senders=senders,
+            recipients=recipients,
+            ethType="IPV4" )
 
         if installResult:
             testResult = main.intentFunction.testPointIntent(
@@ -1165,20 +1164,21 @@
                                  actual=testResult,
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
+
         main.step( "IPV4_2: Add point intents between h1 and h9" )
         main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
         senders = [
-            { "name":"h1","device":"of:0000000000000005/1" }
+            { "name": "h1", "device": "of:0000000000000005/1" }
         ]
         recipients = [
-            { "name":"h9","device":"of:0000000000000006/1" }
+            { "name": "h9", "device": "of:0000000000000006/1" }
         ]
         installResult = main.intentFunction.installPointIntent(
-                                       main,
-                                       name="IPV4_2",
-                                       senders=senders,
-                                       recipients=recipients,
-                                       ethType="IPV4" )
+            main,
+            name="IPV4_2",
+            senders=senders,
+            recipients=recipients,
+            ethType="IPV4" )
 
         if installResult:
             testResult = main.intentFunction.testPointIntent(
@@ -1199,39 +1199,40 @@
         main.step( "SDNIP-ICMP: Add point intents between h1 and 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 }
+            { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
+              "ip": ( main.h1.hostIp + "/24" ) }
         ]
         recipients = [
-            { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09",
-              "ip":main.h9.hostIp }
+            { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
+              "ip": ( main.h9.hostIp + "/24" ) }
         ]
-        ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
+        # ipProto = main.params['SDNIP']['icmpProto']
+        ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
         # Uneccessary, not including this in the selectors
-        tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
-        tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
+        tcpSrc = main.params['SDNIP']['srcPort']
+        tcpDst = main.params['SDNIP']['dstPort']
 
         installResult = main.intentFunction.installPointIntent(
-                                       main,
-                                       name="SDNIP-ICMP",
-                                       senders=senders,
-                                       recipients=recipients,
-                                       ethType="IPV4",
-                                       ipProto=ipProto,
-                                       tcpSrc=tcpSrc,
-                                       tcpDst=tcpDst )
+            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,
-                                         useTCP=True )
+                main,
+                intentId=installResult,
+                name="SDNIP_ICMP",
+                senders=senders,
+                recipients=recipients,
+                sw1="s5",
+                sw2="s2",
+                expectedLink=18,
+                useTCP=True )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1240,60 +1241,60 @@
 
         main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
         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"
-        ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
-        ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
-        tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
-        tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
+        mac1 = main.hostsData['h1']['mac']
+        mac2 = main.hostsData['h9']['mac']
+        ip1 = str(main.hostsData['h1']['ipAddresses'][0]) + "/32"
+        ip2 = str(main.hostsData['h9']['ipAddresses'][0]) + "/32"
+        ipProto = main.params['SDNIP']['tcpProto']
+        tcp1 = main.params['SDNIP']['srcPort']
+        tcp2 = main.params['SDNIP']['dstPort']
 
         stepResult = main.intentFunction.pointIntentTcp(
-                                           main,
-                                           name="SDNIP-TCP",
-                                           host1="h1",
-                                           host2="h9",
-                                           deviceId1="of:0000000000000005/1",
-                                           deviceId2="of:0000000000000006/1",
-                                           mac1=mac1,
-                                           mac2=mac2,
-                                           ethType="IPV4",
-                                           ipProto=ipProto,
-                                           ip1=ip1,
-                                           ip2=ip2,
-                                           tcp1=tcp1,
-                                           tcp2=tcp2 )
+            main,
+            name="SDNIP-TCP",
+            host1="h1",
+            host2="h9",
+            deviceId1="of:0000000000000005/1",
+            deviceId2="of:0000000000000006/1",
+            mac1=mac1,
+            mac2=mac2,
+            ethType="IPV4",
+            ipProto=ipProto,
+            ip1=ip1,
+            ip2=ip2,
+            tcp1=tcp1,
+            tcp2=tcp2 )
 
         utilities.assert_equals( expect=main.TRUE,
-                             actual=stepResult,
+                                 actual=stepResult,
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
 
         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" }
+            { "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" }
+            { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
         ]
         installResult = main.intentFunction.installPointIntent(
-                                       main,
-                                       name="DUALSTACK1",
-                                       senders=senders,
-                                       recipients=recipients,
-                                       ethType="IPV4" )
+            main,
+            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 )
+                                        main,
+                                        intentId=installResult,
+                                        name="DUALSTACK1",
+                                        senders=senders,
+                                        recipients=recipients,
+                                        sw1="s5",
+                                        sw2="s2",
+                                        expectedLink=18 )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1303,16 +1304,16 @@
         main.step( "VLAN: Add point intents between h5 and h21" )
         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", "vlanId":"200" }
+            { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlanId": "200" }
         ]
         recipients = [
-            { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15", "vlanId":"200" }
+            { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlanId": "200" }
         ]
         installResult = main.intentFunction.installPointIntent(
-                                       main,
-                                       name="VLAN",
-                                       senders=senders,
-                                       recipients=recipients )
+            main,
+            name="VLAN",
+            senders=senders,
+            recipients=recipients )
 
         if installResult:
             testResult = main.intentFunction.testPointIntent(
@@ -1335,17 +1336,17 @@
         main.step( "1HOP: Add point intents between h1 and 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" }
+            { "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" }
+            { "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" )
+            main,
+            name="1HOP IPV4",
+            senders=senders,
+            recipients=recipients,
+            ethType="IPV4" )
 
         if installResult:
             testResult = main.intentFunction.testPointIntent(
@@ -1365,6 +1366,7 @@
 
         main.intentFunction.report( main )
 
+
     def CASE3000( self, main ):
         """
             Add single point to multi point intents
@@ -1384,127 +1386,229 @@
                     - Ping hosts
                 - Remove intents
         """
+        if main.initialized == main.FALSE:
+            main.log.error( "Test components did not start correctly, skipping further tests" )
+            main.skipCase()
         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( "Single To Multi Point Intents Test - " +
-                   str( main.numCtrls ) + " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
-        main.caseExplanation = "This test case will test single point to" +\
-                               " multi point intents using " +\
-                               str( main.numCtrls ) + " node(s) cluster;\n" +\
-                               "Different type of hosts will be tested in " +\
-                               "each step such as IPV4, Dual stack, VLAN etc" +\
-                               ";\nThe test will use OF " + main.OFProtocol +\
-                               " OVS running in Mininet and compile intents" +\
+        try:
+            assert main.CLIs, "There is no main.CLIs, skipping test cases"
+            assert main.Mininet1, "Mininet handle should be named Mininet1, skipping test cases"
+            assert main.numSwitch, "Place the total number of switch topology in main.numSwitch"
+        except AssertionError:
+            main.initialized = main.FALSE
+            main.skipCase()
+
+        main.testName = "Single to Multi Point Intents"
+        main.case( main.testName + " Test - " + str( main.numCtrls ) +
+                  " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
+        main.caseExplanation = "This test case will test single point to" + \
+                               " multi point intents using " + \
+                               str( main.numCtrls ) + " node(s) cluster;\n" + \
+                               "Different type of hosts will be tested in " + \
+                               "each step such as IPV4, Dual stack, VLAN etc" + \
+                               ";\nThe test will use OF " + main.OFProtocol + \
+                               " OVS running in Mininet and compile intents" + \
                                " using " + main.flowCompiler
 
-        main.step( "NOOPTION: Add single point to multi point intents" )
-        stepResult = main.TRUE
-        hostNames = [ 'h8', 'h16', 'h24' ]
-        devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
-                    'of:0000000000000007/8' ]
-        macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
-        stepResult = main.intentFunction.singleToMultiIntent(
-                                         main,
-                                         name="NOOPTION",
-                                         hostNames=hostNames,
-                                         devices=devices,
-                                         sw1="s5",
-                                         sw2="s2",
-                                         expectedLink=18 )
+        main.step( "NOOPTION: Install and test single point to multi point intents" )
+        main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
+        senders = [
+            { "name": "h8", "device": "of:0000000000000005/8" }
+        ]
+        recipients = [
+            { "name": "h16", "device": "of:0000000000000006/8" },
+            { "name": "h24", "device": "of:0000000000000007/8" }
+        ]
+        badSenders = [ { "name": "h9" } ]  # Senders that are not in the intent
+        badRecipients = [ { "name": "h17" } ]  # Recipients that are not in the intent
+        testResult = main.FALSE
+        installResult = main.intentFunction.installSingleToMultiIntent(
+            main,
+            name="NOOPTION",
+            senders=senders,
+            recipients=recipients )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                main,
+                intentId=installResult,
+                name="NOOPTION",
+                senders=senders,
+                recipients=recipients,
+                badSenders=badSenders,
+                badRecipients=badRecipients,
+                sw1="s5",
+                sw2="s2",
+                expectedLink=18 )
+        else:
+            main.CLIs[ 0 ].removeAllIntents( purge=True )
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="NOOPTION: Successfully added single "
-                                        + " point to multi point intents" +
-                                        " with no match action",
-                                 onfail="NOOPTION: Failed to add single point"
-                                        + " point to multi point intents" +
-                                        " with no match action" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
-        main.step( "IPV4: Add single point to multi point intents" )
-        stepResult = main.TRUE
-        stepResult = main.intentFunction.singleToMultiIntent(
-                                         main,
-                                         name="IPV4",
-                                         hostNames=hostNames,
-                                         devices=devices,
-                                         ports=None,
-                                         ethType="IPV4",
-                                         macs=macs,
-                                         bandwidth="",
-                                         lambdaAlloc=False,
-                                         ipProto="",
-                                         ipAddresses="",
-                                         tcp="",
-                                         sw1="s5",
-                                         sw2="s2",
-                                         expectedLink=18 )
+        main.step("IPV4: Install and test single point to multi point intents")
+        main.assertReturnString = "Assertion results for IPV4 single to multi point intent " \
+                                  "with IPV4 type and MAC addresses\n"
+        senders = [
+            {"name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08"}
+        ]
+        recipients = [
+            {"name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10"},
+            {"name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18"}
+        ]
+        badSenders = [{"name": "h9"}]  # Senders that are not in the intent
+        badRecipients = [{"name": "h17"}]  # Recipients that are not in the intent
+        installResult = main.intentFunction.installSingleToMultiIntent(
+            main,
+            name="IPV4",
+            senders=senders,
+            recipients=recipients,
+            ethType="IPV4")
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                main,
+                intentId=installResult,
+                name="IPV4",
+                senders=senders,
+                recipients=recipients,
+                badSenders=badSenders,
+                badRecipients=badRecipients,
+                sw1="s5",
+                sw2="s2",
+                expectedLink=18 )
+        else:
+            main.CLIs[ 0 ].removeAllIntents( purge=True )
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="IPV4: Successfully added single "
-                                        + " point to multi point intents" +
-                                        " with IPV4 type and MAC addresses",
-                                 onfail="IPV4: Failed to add single point"
-                                        + " point to multi point intents" +
-                                        " with IPV4 type and MAC addresses" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
         main.step( "IPV4_2: Add single point to multi point intents" )
-        stepResult = main.TRUE
-        hostNames = [ 'h8', 'h16', 'h24' ]
-        stepResult = main.intentFunction.singleToMultiIntent(
-                                         main,
-                                         name="IPV4",
-                                         hostNames=hostNames,
-                                         ethType="IPV4",
-                                         lambdaAlloc=False )
+        main.assertReturnString = "Assertion results for IPV4 single to multi point intent " \
+                                  "with IPV4 type and no MAC addresses\n"
+        senders = [
+            { "name": "h8", "device": "of:0000000000000005/8" }
+        ]
+        recipients = [
+            { "name": "h16", "device": "of:0000000000000006/8" },
+            { "name": "h24", "device": "of:0000000000000007/8" }
+        ]
+        badSenders = [ { "name": "h9" } ]  # Senders that are not in the intent
+        badRecipients = [ { "name": "h17" } ]  # Recipients that are not in the intent
+        installResult = main.intentFunction.installSingleToMultiIntent(
+            main,
+            name="IPV4_2",
+            senders=senders,
+            recipients=recipients,
+            ethType="IPV4" )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                main,
+                intentId=installResult,
+                name="IPV4_2",
+                senders=senders,
+                recipients=recipients,
+                badSenders=badSenders,
+                badRecipients=badRecipients,
+                sw1="s5",
+                sw2="s2",
+                expectedLink=18 )
+        else:
+            main.CLIs[ 0 ].removeAllIntents( purge=True )
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="IPV4_2: Successfully added single "
-                                        + " point to multi point intents" +
-                                        " with IPV4 type and no MAC addresses",
-                                 onfail="IPV4_2: Failed to add single point"
-                                        + " point to multi point intents" +
-                                        " with IPV4 type and no MAC addresses" )
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
 
         main.step( "VLAN: Add single point to multi point intents" )
-        stepResult = main.TRUE
-        hostNames = [ 'h4', 'h12', 'h20' ]
-        devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
-                    'of:0000000000000007/4' ]
-        macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ]
-        stepResult = main.intentFunction.singleToMultiIntent(
-                                         main,
-                                         name="VLAN",
-                                         hostNames=hostNames,
-                                         devices=devices,
-                                         ports=None,
-                                         ethType="IPV4",
-                                         macs=macs,
-                                         bandwidth="",
-                                         lambdaAlloc=False,
-                                         ipProto="",
-                                         ipAddresses="",
-                                         tcp="",
-                                         sw1="s5",
-                                         sw2="s2",
-                                         expectedLink=18 )
+        main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type " \
+                                  "and MAC addresses in the same VLAN\n"
+        senders = [
+            { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
+        ]
+        recipients = [
+            { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
+            { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
+        ]
+        badSenders = [ { "name": "h13" } ]  # Senders that are not in the intent
+        badRecipients = [ { "name": "h21" } ]  # Recipients that are not in the intent
+        installResult = main.intentFunction.installSingleToMultiIntent(
+            main,
+            name="VLAN",
+            senders=senders,
+            recipients=recipients,
+            sw1="s5",
+            sw2="s2" )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                main,
+                intentId=installResult,
+                name="VLAN",
+                senders=senders,
+                recipients=recipients,
+                badSenders=badSenders,
+                badRecipients=badRecipients,
+                sw1="s5",
+                sw2="s2",
+                expectedLink=18 )
+        else:
+            main.CLIs[ 0 ].removeAllIntents()
 
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="VLAN: Successfully added single "
-                                        + " point to multi point intents" +
-                                        " with IPV4 type and MAC addresses" +
-                                        " in the same VLAN",
-                                 onfail="VLAN: Failed to add single point"
-                                        + " point to multi point intents" +
-                                        " with IPV4 type and MAC addresses" +
-                                        " in the same VLAN")
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
+
+        main.step( "VLAN: Add single point to multi point intents" )
+        main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
+        senders = [
+            { "name": "h5", "vlan": "200" }
+        ]
+        recipients = [
+            { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
+            { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
+        ]
+        badSenders = [ { "name": "h13" } ]  # Senders that are not in the intent
+        badRecipients = [ { "name": "h21" } ]  # Recipients that are not in the intent
+        testResult = main.FALSE
+        installResult = main.intentFunction.installSingleToMultiIntent(
+            main,
+            name="VLAN2",
+            senders=senders,
+            recipients=recipients,
+            sw1="s5",
+            sw2="s2" )
+            #setVlan=100 )
+
+        if installResult:
+            testResult = main.intentFunction.testPointIntent(
+                main,
+                intentId=installResult,
+                name="VLAN2",
+                senders=senders,
+                recipients=recipients,
+                badSenders=badSenders,
+                badRecipients=badRecipients,
+                sw1="s5",
+                sw2="s2",
+                expectedLink=18 )
+        else:
+            main.CLIs[ 0 ].removeAllIntents()
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=testResult,
+                                 onpass=main.assertReturnString,
+                                 onfail=main.assertReturnString )
+
+        main.intentFunction.report( main )
 
     def CASE4000( self, main ):
         """
@@ -1729,5 +1833,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/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
index 1d4499c..088d38d 100755
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
@@ -886,22 +886,21 @@
 
     return stepResult
 
-def singleToMultiIntent( main,
-                         name,
-                         hostNames,
-                         onosNode=0,
-                         devices="",
-                         ports=None,
-                         ethType="",
-                         macs=None,
-                         bandwidth="",
-                         lambdaAlloc=False,
-                         ipProto="",
-                         ipAddresses="",
-                         tcp="",
-                         sw1="",
-                         sw2="",
-                         expectedLink=0 ):
+
+def installSingleToMultiIntent( main,
+                                name,
+                                senders,
+                                recipients,
+                                onosNode=0,
+                                ethType="",
+                                bandwidth="",
+                                lambdaAlloc=False,
+                                ipProto="",
+                                ipAddresses="",
+                                tcp="",
+                                sw1="",
+                                sw2="",
+                                partial=False ):
     """
         Verify Single to Multi Point intents
         NOTE:If main.hostsData is not defined, variables data should be passed
@@ -958,176 +957,85 @@
     """
 
     assert main, "There is no main variable"
-    assert hostNames, "You must specify hosts"
-    assert devices or main.hostsData, "You must specify devices"
+    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
+    global itemName  # The name of this run. Used for logs.
     itemName = name
-    tempHostsData = {}
-    intentsId = []
     onosNode = int( onosNode )
 
-    macsDict = {}
-    ipDict = {}
-    if hostNames and devices:
-        if len( hostNames ) != len( devices ):
-            main.log.debug( "hosts and devices does not have the same length" )
-            #print "len hostNames = ", len( hostNames )
-            #print "len devices = ", len( devices )
-            return main.FALSE
-        if ports:
-            if len( ports ) != len( devices ):
-                main.log.error( "Ports and devices does " +
-                                "not have the same length" )
-                #print "len devices = ", len( devices )
-                #print "len ports = ", len( ports )
-                return main.FALSE
-        else:
-            main.log.info( "Device Ports are not specified" )
-        if macs:
-            for i in range( len( devices ) ):
-                macsDict[ devices[ i ] ] = macs[ i ]
-
-    elif hostNames and not devices and main.hostsData:
-        devices = []
-        main.log.info( "singleToMultiIntent function is using main.hostsData" )
-        for host in hostNames:
-               devices.append( main.hostsData.get( host ).get( 'location' ) )
-               macsDict[ main.hostsData.get( host ).get( 'location' ) ] = \
-                           main.hostsData.get( host ).get( 'mac' )
-               ipDict[ main.hostsData.get( host ).get( 'location' ) ] = \
-                           main.hostsData.get( host ).get( 'ipAddresses' )
-        #print main.hostsData
-
-    #print 'host names = ', hostNames
-    #print 'devices = ', devices
-    #print "macsDict = ", macsDict
-
-    pingResult = main.TRUE
-    intentResult = main.TRUE
-    removeIntentResult = main.TRUE
-    flowResult = main.TRUE
-    topoResult = main.TRUE
-    linkDownResult = main.TRUE
-    linkUpResult = main.TRUE
-
-    devicesCopy = copy.copy( devices )
-    if ports:
-        portsCopy = copy.copy( ports )
     main.log.info( itemName + ": Adding single point to multi point intents" )
 
-    # Check flows count in each node
-    checkFlowsCount( main )
+    try:
+        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" )
 
-    # Adding bidirectional point  intents
-    for i in range( len( devices ) ):
-        ingressDevice = devicesCopy[ i ]
-        egressDeviceList = copy.copy( devicesCopy )
-        egressDeviceList.remove( ingressDevice )
-        if ports:
-            portIngress = portsCopy[ i ]
-            portEgressList = copy.copy( portsCopy )
-            del portEgressList[ i ]
-        else:
-            portIngress = ""
-            portEgressList = None
-        if not macsDict:
-            srcMac = ""
-        else:
-            srcMac = macsDict[ ingressDevice ]
-            if srcMac == None:
-                main.log.debug( "There is no MAC in device - " + ingressDevice )
-                srcMac = ""
+        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" )
+        vlanId = senders[ 0 ].get( "vlanId" )
 
-        intentsId.append(
-                        main.RESTs[ onosNode ].addSinglepointToMultipointIntent(
+        ingressDevice = senders[ 0 ].get( "device" )
+        egressDeviceList = [ x.get( "device" ) for x in recipients if x.get( "device" ) ]
+
+        portIngress = senders[ 0 ].get( "port", "" )
+        portEgressList = [ x.get( "port" ) for x in recipients if x.get( "port" ) ]
+        if not portEgressList:
+            portEgressList = []
+
+        main.log.debug( ingressDevice )
+        main.log.debug( egressDeviceList )
+
+        srcMac = senders[ 0 ].get( "mac" )
+        dstMac = []
+        for r in recipients:
+            mac = r.get( "mac" )
+            dstMac.append( mac )
+
+        ipSrc = senders[ 0 ].get( "ip" )
+        ipDst = []
+        for r in recipients:
+            ip = r.get( "ip" )
+            ipDst.append( ip )
+
+        # Adding point intent
+        intentId = main.RESTs[ onosNode ].addSinglepointToMultipointIntent(
                                             ingressDevice=ingressDevice,
                                             egressDeviceList=egressDeviceList,
                                             portIngress=portIngress,
                                             portEgressList=portEgressList,
                                             ethType=ethType,
                                             ethSrc=srcMac,
+                                            #ethDst=dstMac, #Isn't working because of ONOS itself
                                             bandwidth=bandwidth,
                                             lambdaAlloc=lambdaAlloc,
                                             ipProto=ipProto,
-                                            ipSrc="",
-                                            ipDst="",
+                                            ipSrc=ipSrc,
+                                            ipDst=ipDst,
                                             tcpSrc="",
-                                            tcpDst="" ) )
+                                            tcpDst="",
+                                            vlanId=vlanId,
+                                            partial=partial )
 
-    # Wait some time for the flow to go through when using multi instance
-    pingResult = pingallHosts( main, hostNames )
+        time.sleep( main.addIntentSleep )
+        intentsId = main.RESTs[ 0 ].getIntentsId()
+    except ( KeyError, TypeError ):
+        errorMsg = "There was a problem loading the hosts data."
+        if intentId:
+            errorMsg += "  There was a problem installing Singlepoint to Multipoint intent."
+        main.log.error( errorMsg )
+        return main.FALSE
 
     # Check intents state
-    time.sleep( main.checkIntentSleep )
-    intentResult = checkIntentState( main, intentsId )
-
-    # Check intents state again if first check fails...
-    if not intentResult:
-        intentResult = checkIntentState( main, intentsId )
-
-    # Check flows count in each node
-    checkFlowsCount( main )
-    # Verify flows
-    checkFlowsState( main )
-
-    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, intentsId )
-
-    stepResult = pingResult and linkDownResult and linkUpResult \
-                 and intentResult and removeIntentResult
-
-    return stepResult
+    if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentsId ), sleep=main.checkIntentSleep ):
+        return intentsId
+    else:
+        main.log.error( "Single to Multi Intent did not install correctly" )
+        return main.FALSE
 
 def multiToSingleIntent( main,
                          name,
@@ -1822,4 +1730,4 @@
                 return main.FALSE
     else:
         return main.FALSE
-    return main.TRUE
\ No newline at end of file
+    return main.TRUE
