[ONOS-5280] Update FUNCintent and [ONOS-5357] Add more encap types

Change-Id: Id2af75868f5af76c5b3ad14bf46f2826c3d2e745
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.params b/TestON/tests/FUNC/FUNCintent/FUNCintent.params
index 7af98ee..88e8956 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.params
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.params
@@ -47,7 +47,7 @@
         <startup>15</startup>
         <reroute>5</reroute>
         <removeintent>10</removeintent>
-        <checkintent>5</checkintent>
+        <checkintent>10</checkintent>
         <fwd>10</fwd>
         <topoAttempts>3</topoAttempts>
         <flowDuration>10</flowDuration>
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index 6b690d9..b7a4a65 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -6,7 +6,6 @@
         self.default = ''
 
     def CASE1( self, main ):
-        import time
         import imp
         import re
 
@@ -133,7 +132,7 @@
         - Install ONOS cluster
         - Connect to cli
         """
-
+        import time
         main.cycle += 1
 
         # main.scale[ 0 ] determines the current number of ONOS controller
@@ -439,7 +438,6 @@
         main.caseExplanation = "Assign OF " + main.OFProtocol +\
                                 " switches to ONOS nodes"
 
-        assignResult = main.TRUE
         switchList = []
 
         # Creates a list switch name, use getSwitch() function later...
@@ -452,7 +450,7 @@
 
         assignResult = main.Mininet1.assignSwController( sw=switchList,
                                                          ip=tempONOSip,
-                                                         port='6653' )
+                                                         port="6653" )
         if not assignResult:
             main.log.error( "Problem assigning mastership of switches" )
             main.initialized = main.FALSE
@@ -484,7 +482,6 @@
             main.skipCase()
         main.case( "Create scapy components" )
         main.step( "Create scapy components" )
-        import json
         scapyResult = main.TRUE
         for hostName in main.scapyHostNames:
             main.Scapy1.createHostComponent( hostName )
@@ -547,7 +544,6 @@
         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.initialized = main.FALSE
@@ -588,7 +584,6 @@
         main.case( "Balance mastership of switches" )
         main.step( "Balancing mastership of switches" )
 
-        balanceResult = main.FALSE
         balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
 
         utilities.assert_equals( expect=main.TRUE,
@@ -710,9 +705,6 @@
                     - 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()
@@ -758,21 +750,20 @@
         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.FALSE
         installResult = main.intentFunction.installHostIntent( main,
-                                              name='IPV4',
-                                              onosNode='0',
+                                              name="IPV4",
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2 )
         if installResult:
             testResult = main.intentFunction.testHostIntent( main,
-                                              name='IPV4',
+                                              name="IPV4",
                                               intentId = installResult,
-                                              onosNode='0',
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2,
-                                              sw1='s5',
-                                              sw2='s2',
+                                              sw1="s5",
+                                              sw2="s2",
                                               expectedLink=18 )
         else:
             main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -787,22 +778,21 @@
         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.FALSE
         installResult = main.intentFunction.installHostIntent( main,
-                                              name='DUALSTACK',
-                                              onosNode='0',
+                                              name="DUALSTACK",
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2 )
 
         if installResult:
             testResult = main.intentFunction.testHostIntent( main,
-                                              name='DUALSTACK',
+                                              name="DUALSTACK",
                                               intentId = installResult,
-                                              onosNode='0',
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2,
-                                              sw1='s5',
-                                              sw2='s2',
+                                              sw1="s5",
+                                              sw2="s2",
                                               expectedLink=18 )
 
         utilities.assert_equals( expect=main.TRUE,
@@ -815,22 +805,21 @@
         host1 = { "name":"h1" }
         host2 = { "name":"h11" }
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installHostIntent( main,
-                                              name='DUALSTACK2',
-                                              onosNode='0',
+                                              name="DUALSTACK2",
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2 )
 
         if installResult:
             testResult = main.intentFunction.testHostIntent( main,
-                                              name='DUALSTACK2',
+                                              name="DUALSTACK2",
                                               intentId = installResult,
-                                              onosNode='0',
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2,
-                                              sw1='s5',
-                                              sw2='s2',
+                                              sw1="s5",
+                                              sw2="s2",
                                               expectedLink=18 )
         else:
             main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -845,22 +834,21 @@
         host1 = { "name":"h1" }
         host2 = { "name":"h3" }
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installHostIntent( main,
-                                              name='1HOP',
-                                              onosNode='0',
+                                              name="1HOP",
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2 )
 
         if installResult:
             testResult = main.intentFunction.testHostIntent( main,
-                                              name='1HOP',
+                                              name="1HOP",
                                               intentId = installResult,
-                                              onosNode='0',
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2,
-                                              sw1='s5',
-                                              sw2='s2',
+                                              sw1="s5",
+                                              sw2="s2",
                                               expectedLink=18 )
         else:
             main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -875,22 +863,21 @@
         host1 = { "name":"h4","id":"00:00:00:00:00:04/100", "vlan":"100" }
         host2 = { "name":"h12","id":"00:00:00:00:00:0C/100", "vlan":"100" }
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installHostIntent( main,
-                                              name='VLAN1',
-                                              onosNode='0',
+                                              name="VLAN1",
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2 )
 
         if installResult:
             testResult = main.intentFunction.testHostIntent( main,
-                                              name='VLAN1',
+                                              name="VLAN1",
                                               intentId = installResult,
-                                              onosNode='0',
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2,
-                                              sw1='s5',
-                                              sw2='s2',
+                                              sw1="s5",
+                                              sw2="s2",
                                               expectedLink=18 )
         else:
             main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -905,22 +892,21 @@
         host1 = { "name":"h5", "vlan":"200" }
         host2 = { "name":"h12", "vlan":"100" }
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installHostIntent( main,
-                                              name='VLAN2',
-                                              onosNode='0',
+                                              name="VLAN2",
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2 )
 
         if installResult:
             testResult = main.intentFunction.testHostIntent( main,
-                                              name='VLAN2',
+                                              name="VLAN2",
                                               intentId = installResult,
-                                              onosNode='0',
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2,
-                                              sw1='s5',
-                                              sw2='s2',
+                                              sw1="s5",
+                                              sw2="s2",
                                               expectedLink=18 )
         else:
             main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -935,22 +921,21 @@
         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.FALSE
         installResult = main.intentFunction.installHostIntent( main,
-                                              name='ENCAPSULATION',
-                                              onosNode='0',
+                                              name="ENCAPSULATION",
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2,
                                               encap="VLAN" )
         if installResult:
             testResult = main.intentFunction.testHostIntent( main,
-                                              name='ENCAPSULATION',
+                                              name="ENCAPSULATION",
                                               intentId = installResult,
-                                              onosNode='0',
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2,
-                                              sw1='s5',
-                                              sw2='s2',
+                                              sw1="s5",
+                                              sw2="s2",
                                               expectedLink=18 )
         else:
             main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -960,9 +945,39 @@
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
 
+        # Testing MPLS would need to update kernel version (Right now is 3.16)
+        # main.step( "Encapsulation: Add host intents between h1 and h9" )
+        # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\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="ENCAPSULATION",
+        #                                                        onosNode=0,
+        #                                                        host1=host1,
+        #                                                        host2=host2,
+        #                                                        encap="MPLS" )
+        # if installResult:
+        #     testResult = main.intentFunction.testHostIntent( main,
+        #                                                      name="ENCAPSULATION",
+        #                                                      intentId=installResult,
+        #                                                      onosNode=0,
+        #                                                      host1=host1,
+        #                                                      host2=host2,
+        #                                                      sw1="s5",
+        #                                                      sw2="s2",
+        #                                                      expectedLink=18 )
+        # else:
+        #     main.CLIs[ 0 ].removeAllIntents( purge=True )
+        #
+        # utilities.assert_equals( expect=main.TRUE,
+        #                          actual=testResult,
+        #                          onpass=main.assertReturnString,
+        #                          onfail=main.assertReturnString )
+
         main.step( "Confirm that ONOS leadership is unchanged" )
         intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
-        main.intentFunction.checkLeaderChange( intentLeadersOld,
+        testResult = main.intentFunction.checkLeaderChange( intentLeadersOld,
                                                 intentLeadersNew )
 
         utilities.assert_equals( expect=main.TRUE,
@@ -991,9 +1006,6 @@
                     - 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()
@@ -1042,7 +1054,6 @@
             { "name":"h9","device":"of:0000000000000006/1" }
         ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="NOOPTION",
@@ -1067,7 +1078,6 @@
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
 
-        stepResult = main.TRUE
         main.step( "IPV4: Add point intents between h1 and h9" )
         main.assertReturnString = "Assertion Result for IPV4 point intent\n"
         senders = [
@@ -1077,7 +1087,6 @@
             { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09" }
         ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="IPV4",
@@ -1111,7 +1120,6 @@
             { "name":"h9","device":"of:0000000000000006/1" }
         ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="IPV4_2",
@@ -1152,7 +1160,6 @@
         tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
         tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="SDNIP-ICMP",
@@ -1222,7 +1229,6 @@
             { "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" }
         ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="DUALSTACK1",
@@ -1257,7 +1263,6 @@
             { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15", "vlan":"200" }
         ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="VLAN",
@@ -1289,7 +1294,6 @@
             { "name":"h21", "vlan":"200" }
         ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="VLAN2",
@@ -1322,7 +1326,6 @@
             { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
         ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="1HOP IPV4",
@@ -1357,7 +1360,6 @@
             { "name":"h9","device":"of:0000000000000006/1" }
         ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installPointIntent(
                                        main,
                                        name="ENCAPSULATION",
@@ -1383,6 +1385,41 @@
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
 
+        # Testing MPLS would need to update kernel version (Right now is 3.16)
+        # main.step( "Add point to point intents using MPLS Encapsulation" )
+        # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
+        # senders = [
+        #     { "name": "h1", "device": "of:0000000000000005/1" }
+        # ]
+        # recipients = [
+        #     { "name": "h9", "device": "of:0000000000000006/1" }
+        # ]
+        # testResult = main.FALSE
+        # installResult = main.intentFunction.installPointIntent(
+        #     main,
+        #     name="ENCAPSULATION",
+        #     senders=senders,
+        #     recipients=recipients,
+        #     encap="MPLS" )
+        #
+        # if installResult:
+        #     testResult = main.intentFunction.testPointIntent(
+        #         main,
+        #         intentId=installResult,
+        #         name="ENCAPSULATION",
+        #         senders=senders,
+        #         recipients=recipients,
+        #         sw1="s5",
+        #         sw2="s2",
+        #         expectedLink=18 )
+        # else:
+        #     main.CLIs[ 0 ].removeAllIntents( purge=True )
+        #
+        # utilities.assert_equals( expect=main.TRUE,
+        #                          actual=testResult,
+        #                          onpass=main.assertReturnString,
+        #                          onfail=main.assertReturnString )
+
         main.intentFunction.report( main )
 
     def CASE3000( self, main ):
@@ -1452,7 +1489,6 @@
         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.FALSE
         installResult = main.intentFunction.installSingleToMultiIntent(
                                          main,
                                          name="NOOPTION",
@@ -1493,7 +1529,6 @@
         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.FALSE
         installResult = main.intentFunction.installSingleToMultiIntent(
                                          main,
                                          name="IPV4",
@@ -1535,7 +1570,6 @@
         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.FALSE
         installResult = main.intentFunction.installSingleToMultiIntent(
                                          main,
                                          name="IPV4_2",
@@ -1577,10 +1611,9 @@
         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.FALSE
         installResult = main.intentFunction.installSingleToMultiIntent(
                                          main,
-                                         name="VLAN`",
+                                         name="VLAN",
                                          senders=senders,
                                          recipients=recipients,
                                          sw1="s5",
@@ -1618,7 +1651,6 @@
         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.FALSE
         installResult = main.intentFunction.installSingleToMultiIntent(
                                          main,
                                          name="VLAN2",
@@ -1648,47 +1680,47 @@
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
 
-        main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
-        main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\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.FALSE
-        installResult = main.intentFunction.installSingleToMultiIntent(
-                                         main,
-                                         name="ENCAPSULATION",
-                                         senders=senders,
-                                         recipients=recipients,
-                                         sw1="s5",
-                                         sw2="s2",
-                                         encap="VLAN" )
-
-        if installResult:
-            testResult = main.intentFunction.testPointIntent(
-                                         main,
-                                         intentId=installResult,
-                                         name="ENCAPSULATION",
-                                         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=testResult,
-                                 onpass=main.assertReturnString,
-                                 onfail=main.assertReturnString )
+        # Does not support Single point to multi point encapsulation
+        # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
+        # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\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="ENCAPSULATION",
+        #                                  senders=senders,
+        #                                  recipients=recipients,
+        #                                  sw1="s5",
+        #                                  sw2="s2",
+        #                                  encap="VLAN" )
+        #
+        # if installResult:
+        #     testResult = main.intentFunction.testPointIntent(
+        #                                  main,
+        #                                  intentId=installResult,
+        #                                  name="ENCAPSULATION",
+        #                                  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=testResult,
+        #                          onpass=main.assertReturnString,
+        #                          onfail=main.assertReturnString )
 
         main.intentFunction.report( main )
 
@@ -1759,7 +1791,6 @@
         badSenders=[ { "name":"h17" } ]  # Senders that are not in the intent
         badRecipients=[ { "name":"h9" } ]  # Recipients that are not in the intent
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installMultiToSingleIntent(
                                          main,
                                          name="NOOPTION",
@@ -1800,7 +1831,6 @@
         badSenders=[ { "name":"h17" } ]  # Senders that are not in the intent
         badRecipients=[ { "name":"h9" } ]  # Recipients that are not in the intent
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installMultiToSingleIntent(
                                          main,
                                          name="IPV4",
@@ -1842,7 +1872,6 @@
         badSenders=[ { "name":"h17" } ]  # Senders that are not in the intent
         badRecipients=[ { "name":"h9" } ]  # Recipients that are not in the intent
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installMultiToSingleIntent(
                                          main,
                                          name="IPV4_2",
@@ -1884,7 +1913,6 @@
         badSenders=[ { "name":"h12" } ]  # Senders that are not in the intent
         badRecipients=[ { "name":"h20" } ]  # Recipients that are not in the intent
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installMultiToSingleIntent(
                                          main,
                                          name="VLAN",
@@ -1926,7 +1954,6 @@
         badSenders=[ { "name":"h12" } ]  # Senders that are not in the intent
         badRecipients=[ { "name":"h20" } ]  # Recipients that are not in the intent
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installMultiToSingleIntent(
                                          main,
                                          name="VLAN2",
@@ -1968,7 +1995,6 @@
         badSenders=[ { "name":"h17" } ]  # Senders that are not in the intent
         badRecipients=[ { "name":"h9" } ]  # Recipients that are not in the intent
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installMultiToSingleIntent(
                                          main,
                                          name="ENCAPSULATION",
@@ -1998,6 +2024,48 @@
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
 
+        # Testing MPLS would need to update kernel version (Right now is 3.16)
+        # main.step( "ENCAPSULATION: Add multi point to single point intents" )
+        # main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
+        # senders = [
+        #     { "name": "h16", "device": "of:0000000000000006/8" },
+        #     { "name": "h24", "device": "of:0000000000000007/8" }
+        # ]
+        # recipients = [
+        #     { "name": "h8", "device": "of:0000000000000005/8" }
+        # ]
+        # badSenders = [ { "name": "h17" } ]  # Senders that are not in the intent
+        # badRecipients = [ {"name": "h9" } ]  # Recipients that are not in the intent
+        # testResult = main.FALSE
+        # installResult = main.intentFunction.installMultiToSingleIntent(
+        #     main,
+        #     name="ENCAPSULATION",
+        #     senders=senders,
+        #     recipients=recipients,
+        #     sw1="s5",
+        #     sw2="s2",
+        #     encap="MPLS" )
+        #
+        # if installResult:
+        #     testResult = main.intentFunction.testPointIntent(
+        #         main,
+        #         intentId=installResult,
+        #         name="ENCAPSULATION",
+        #         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=testResult,
+        #                          onpass=main.assertReturnString,
+        #                          onfail=main.assertReturnString )
+
         main.intentFunction.report( main )
 
     def CASE5000( self, main ):
@@ -2028,9 +2096,9 @@
                              main.numSwitch )
             main.initialized = main.FALSE
             main.skipCase()
-        main.case( "Test host mobility with host intents " )
+        main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) +
+                   " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
         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" )
@@ -2061,17 +2129,16 @@
         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.FALSE
         installResult = main.intentFunction.installHostIntent( main,
-                                              name='IPV4 Mobility IPV4',
-                                              onosNode='0',
+                                              name="IPV4 Mobility IPV4",
+                                              onosNode=0,
                                               host1=host1,
                                               host2=host2 )
         if installResult:
             testResult = main.intentFunction.testHostIntent( main,
-                                                  name='Host Mobility IPV4',
+                                                  name="Host Mobility IPV4",
                                                   intentId = installResult,
-                                                  onosNode='0',
+                                                  onosNode=0,
                                                   host1=host1,
                                                   host2=host2,
                                                   sw1="s6",
@@ -2113,11 +2180,11 @@
         try:
             assert main.numSwitch
         except AssertionError:
-            main.log.error( "Place the total number of switch topology in "+\
-                             main.numSwitch )
+            main.log.error( "Place the total number of switch topology in " + main.numSwitch )
             main.initialized = main.FALSE
             main.skipCase()
-        main.case( "Test Multi to Single End Point Failure" )
+        main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) +
+                   " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
         main.step( "Installing Multi to Single Point intents with no options set" )
         main.assertReturnString = "Assertion results for IPV4 multi to single " +\
                                   "point intent end point failure with no options set\n"
@@ -2129,11 +2196,10 @@
             { "name":"h8", "device":"of:0000000000000005/8" }
         ]
         isolatedSenders = [
-            { "name":"h24"}
+            { "name":"h24" }
         ]
         isolatedRecipients = []
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installMultiToSingleIntent(
                                          main,
                                          name="NOOPTION",
@@ -2178,11 +2244,10 @@
             { "name":"h8", "device":"of:0000000000000005/8" }
         ]
         isolatedSenders = [
-            { "name":"h24"}
+            { "name":"h24" }
         ]
         isolatedRecipients = []
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installMultiToSingleIntent(
                                          main,
                                          name="NOOPTION",
@@ -2229,10 +2294,9 @@
         ]
         isolatedSenders = []
         isolatedRecipients = [
-            { "name":"h24"}
+            { "name":"h24" }
         ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installSingleToMultiIntent(
                                          main,
                                          name="NOOPTION",
@@ -2278,10 +2342,9 @@
         ]
         isolatedSenders = []
         isolatedRecipients = [
-            { "name":"h24"}
+            { "name":"h24" }
         ]
         testResult = main.FALSE
-        installResult = main.FALSE
         installResult = main.intentFunction.installSingleToMultiIntent(
                                          main,
                                          name="NOOPTION",
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index 0e563be..1760324 100755
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -63,7 +63,6 @@
 
     global itemName  # The name of this run. Used for logs.
     itemName = name
-    onosNode = int( onosNode )
 
     main.log.info( itemName + ": Adding single point to multi point intents" )
     try:
@@ -92,14 +91,23 @@
 
     # Check intents state
     if utilities.retry( f=checkIntentState, retValue=main.FALSE,
-                        args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
+                        args=( main, [ intentId ] ), sleep=main.checkIntentSleep, attempts=5 ):
         main.assertReturnString += 'Install Intent State Passed\n'
+
+        #Check VLAN if test encapsulation
+        if encap != "":
+            if EncapsulatedIntentCheck( main, tag=encap ):
+                main.assertReturnString += 'Encapsulation intents check Passed\n'
+            else:
+                main.assertReturnString += 'Encapsulation intents check failed\n'
+
         if flowDuration( main ):
             main.assertReturnString += 'Flow duration check Passed\n'
             return intentId
         else:
             main.assertReturnString += 'Flow duration check failed\n'
             return main.FALSE
+
     else:
         main.log.error( "Host Intent did not install correctly" )
         main.assertReturnString += 'Install Intent State Failed\n'
@@ -165,8 +173,6 @@
 
     global itemName
     itemName = name
-    tempHostsData = {}
-    onosNode = int( onosNode )
 
     main.log.info( itemName + ": Testing Host Intent" )
 
@@ -242,7 +248,7 @@
             testResult = main.FALSE
 
         # Check Connection
-        if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ) ):
+        if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ), sleep=5, attempts=5 ):
             main.assertReturnString += 'Link Down Pingall Passed\n'
         else:
             main.assertReturnString += 'Link Down Pingall Failed\n'
@@ -353,7 +359,6 @@
 
     global itemName  # The name of this run. Used for logs.
     itemName = name
-    onosNode = int( onosNode )
 
     main.log.info( itemName + ": Adding point to point intents" )
 
@@ -409,8 +414,15 @@
 
     # Check intents state
     if utilities.retry( f=checkIntentState, retValue=main.FALSE,
-                        args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
+                        args=( main, [ intentId ] ), sleep=main.checkIntentSleep, attempts=5 ):
         main.assertReturnString += 'Install Intent State Passed\n'
+
+        # Check VLAN if test encapsulation
+        if encap != "":
+            if EncapsulatedIntentCheck( main, tag=encap ):
+                main.assertReturnString += 'Encapsulation intents check Passed\n'
+            else:
+                main.assertReturnString += 'Encapsulation intents check failed\n'
         if flowDuration( main ):
             main.assertReturnString += 'Flow duration check Passed\n'
             return intentId
@@ -502,17 +514,11 @@
     itemName = name
     host1 = host1
     host2 = host2
-    hostNames = [ host1, host2 ]
     intentsId = []
 
     iperfResult = main.TRUE
-    intentResult = main.TRUE
-    removeIntentResult = main.TRUE
-    flowResult = main.TRUE
-    topoResult = main.TRUE
     linkDownResult = main.TRUE
     linkUpResult = main.TRUE
-    onosNode = int( onosNode )
 
     # Adding bidirectional point  intents
     main.log.info( itemName + ": Adding point intents" )
@@ -650,7 +656,7 @@
 
         # link up
         linkUpResult = link( main, sw1, sw2, "up" )
-        if linkUpTemp:
+        if linkUpResult:
             main.assertReturnString += 'Link Up Passed\n'
         else:
             main.assertReturnString += 'Link Up Failed\n'
@@ -764,7 +770,6 @@
 
     global itemName  # The name of this run. Used for logs.
     itemName = name
-    onosNode = int( onosNode )
 
     main.log.info( itemName + ": Adding single point to multi point intents" )
 
@@ -891,7 +896,6 @@
 
     global itemName  # The name of this run. Used for logs.
     itemName = name
-    onosNode = int( onosNode )
 
     main.log.info( itemName + ": Adding mutli to single point intents" )
 
@@ -1031,8 +1035,6 @@
 
     global itemName
     itemName = name
-    tempHostsData = {}
-    onosNode = int( onosNode )
 
     main.log.info( itemName + ": Testing Point Intent" )
 
@@ -1129,7 +1131,7 @@
             testResult = main.FALSE
 
         # Check Connection
-        if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
+        if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ), sleep=5, attempts=5 ):
             main.assertReturnString += 'Link Down Pingall Passed\n'
         else:
             main.assertReturnString += 'Link Down Pingall Failed\n'
@@ -1215,8 +1217,6 @@
 
     global itemName
     itemName = name
-    tempHostsData = {}
-    onosNode = int( onosNode )
 
     main.log.info( itemName + ": Testing Point Intent" )
 
@@ -1506,9 +1506,7 @@
     """
         Use fwd app and pingall to discover all the hosts
     """
-    activateResult = main.TRUE
     appCheck = main.TRUE
-    getDataResult = main.TRUE
     main.log.info( "Activating reactive forwarding app " )
     activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
 
@@ -1541,7 +1539,6 @@
         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
 
@@ -1667,8 +1664,6 @@
         tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
         results.append( tempResult )
 
-    expectedState = [ 'INSTALLED', 'INSTALLING' ]
-
     if all( result == main.TRUE for result in results ):
         main.log.info( itemName + ": Intents are installed correctly" )
     else:
@@ -1699,7 +1694,7 @@
 def link( main, sw1, sw2, option ):
 
     # link down
-    main.log.info( itemName + ": Bring link " + option + "between " +
+    main.log.info( itemName + ": Bring link " + option + " between " +
                        sw1 + " and " + sw2 )
     linkResult = main.Mininet1.link( end1=sw1, end2=sw2, option=option )
     return linkResult
@@ -1776,6 +1771,7 @@
                     connectionsFunctional = main.FALSE
                 else:
                     main.log.info( "Packet from {0} successfully received by {1}".format( sender , recipient ) )
+                    connectionsFunctional = main.TRUE
             else:
                 recipientComp.killFilter()
                 if expectFailure:
@@ -1786,6 +1782,7 @@
 
         return connectionsFunctional
 
+
 def removeAllIntents( main, intentsId ):
     """
         Remove all intents in the intentsId
@@ -1949,9 +1946,54 @@
                 waitFlowLife.append( device[ 'flows' ][ i ][ 'life' ] )
     main.log.info( "Determining whether flows where overwritten" )
     if len( flowLife ) == len( waitFlowLife ):
-        for i in range( len( flowLife) ):
+        for i in range( len( flowLife ) ):
             if waitFlowLife[ i ] - flowLife[ i ] < main.flowDurationSleep:
                 return main.FALSE
     else:
         return main.FALSE
     return main.TRUE
+
+
+def EncapsulatedIntentCheck( main, tag="" ):
+    """
+        Check encapsulated intents
+        tag: encapsulation tag (e.g. VLAN, MPLS)
+
+        Getting added flows
+        Check tags on each flows
+        If each direction has push or pop, passed
+        else failed
+
+    """
+    import json
+    HostJson = []
+    Jflows = main.CLIs[ 0 ].flows( noCore=True )
+    try:
+        Jflows = json.loads( Jflows )
+    except ValueError:
+        main.log.error( "Unable to read flows" )
+        return main.FALSE
+
+    for flow in Jflows:
+        if len(flow[ "flows" ]) != 0:
+            HostJson.append( flow[ "flows" ] )
+
+    totalflows = len( HostJson[ 0 ])
+
+    pop = 0
+    push = 0
+
+    PopTag = tag + "_POP"
+    PushTag = tag + "_PUSH"
+
+    for EachHostJson in HostJson:
+        for i in range( totalflows ):
+            if EachHostJson[ i ][ "treatment" ][ "instructions" ][ 0 ][ "subtype" ] == PopTag:
+                pop += 1
+            elif EachHostJson[ i ][ "treatment" ][ "instructions" ][ 0 ][ "subtype" ] == PushTag:
+                push += 1
+
+    if pop == totalflows and push == totalflows:
+        return main.TRUE
+    else:
+        return main.FALSE
\ No newline at end of file