[ONOS-5760] Add protected intents to FUNCintent

Change-Id: I1f0d5e02fe00de6b3cccb4d333ead09e766df6d8
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
index dcf7425..71bf286 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
@@ -1173,6 +1173,39 @@
                                  onpass=main.assertReturnString,
                                  onfail=main.assertReturnString )
 
+        # main.step( "Protected: Add point intents between h1 and h9" )
+        # main.assertReturnString = "Assertion Result for protected point intent\n"
+        # senders = [
+        #     { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
+        # ]
+        # recipients = [
+        #     { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
+        # ]
+        # testResult = main.FALSE
+        # installResult = main.intentFunction.installPointIntent(
+        #     main,
+        #     name="Protected",
+        #     senders=senders,
+        #     recipients=recipients,
+        #     protected=True )
+        # 
+        # if installResult:
+        #     testResult = main.intentFunction.testPointIntent(
+        #         main,
+        #         name="Protected",
+        #         intentId=installResult,
+        #         senders=senders,
+        #         recipients=recipients,
+        #         sw1="s5",
+        #         sw2="s2",
+        #         protected=True,
+        #         expectedLink=18 )
+        #
+        # utilities.assert_equals( expect=main.TRUE,
+        #                          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 = [
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
index 088d38d..8fa65f2 100755
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
@@ -305,6 +305,7 @@
                         ethType="",
                         bandwidth="",
                         lambdaAlloc=False,
+                        protected=False,
                         ipProto="",
                         ipSrc="",
                         ipDst="",
@@ -394,6 +395,7 @@
                                             ethDst=dstMac,
                                             bandwidth=bandwidth,
                                             lambdaAlloc=lambdaAlloc,
+                                            protected=protected,
                                             ipProto=ipProto,
                                             ipSrc=ipSrc,
                                             ipDst=ipDst,
@@ -436,6 +438,7 @@
                      ethType="",
                      bandwidth="",
                      lambdaAlloc=False,
+                     protected=False,
                      ipProto="",
                      ipAddresses="",
                      tcp="",
@@ -575,6 +578,21 @@
             main.assertReturnString += 'Link Down Failed\n'
             testResult = main.FALSE
 
+        if protected:
+            # Check Connection
+            if utilities.retry(f=scapyCheckConnection, retValue=main.FALSE,
+                               args=(main, senderNames, recipientNames, vlanId, useTCP)):
+                main.assertReturnString += 'Link down Scapy Packet Received Passed\n'
+            else:
+                main.assertReturnString += 'Link down Scapy Packet Recieved Failed\n'
+                testResult = main.FALSE
+
+            if ProtectedIntentCheck(main):
+                main.assertReturnString += 'Protected Intent Check Passed\n'
+            else:
+                main.assertReturnString += 'Protected Intent Check Failed\n'
+                testResult = main.FALSE
+
         # Check intent state
         if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
             main.assertReturnString += 'Link Down Intent State Passed\n'
@@ -1731,3 +1749,11 @@
     else:
         return main.FALSE
     return main.TRUE
+
+def ProtectedIntentCheck( main ):
+    intent = main.RESTs[ 0 ].intents()
+    main.log.debug(intent)
+    main.stop()
+    if "Protection" in intent:
+        return main.TRUE
+    return main.FALSE