Add check for Flow Duration to FUNCintent and FUNCintentRest
  in order to make sure that flows aren't being overwritten
  by the installed intent.

  Added ability to get flows by appID to onosrestdriver.py

Change-Id: Ia123ad913b4f2c42893802aea2c303adeeffcb72
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index ff3d2e4..abda81e 100644
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -1026,7 +1026,7 @@
             main.cleanup()
             main.exit()
 
-    def flows( self, ip="DEFAULT", port="DEFAULT" ):
+    def flows( self, ip="DEFAULT", port="DEFAULT", subjectClass=None, subjectKey=None ):
         """
         Description:
             Get flows currently added to the system
@@ -1038,6 +1038,7 @@
         """
         try:
             output = None
+            url = "/flows"
             if ip == "DEFAULT":
                 main.log.warn( "No ip given, reverting to ip from topo file" )
                 ip = self.ip_address
@@ -1045,7 +1046,13 @@
                 main.log.warn( "No port given, reverting to port " +
                                "from topo file" )
                 port = self.port
-            response = self.send( url="/flows", ip = ip, port = port )
+            if subjectKey and not subjectClass:
+                main.log.warning( "Subject Key provided without Subject Class.  Ignoring Subject Key" )
+            if subjectClass:
+                url += "/" + subjectClass
+                if subjectKey:
+                    url += "/" + subjectKey
+            response = self.send( url=url, ip=ip, port=port )
             if response:
                 if 200 <= response[ 0 ] <= 299:
                     output = response[ 1 ]
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index cc5ab50..cd9f2f8 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2273,10 +2273,11 @@
             main.log.error( self.name + ": ONOS timeout" )
             return None
 
-    def flows( self, state="", jsonFormat=True, timeout=60, noExit=False ):
+    def flows( self, state="", jsonFormat=True, timeout=60, noExit=False, noCore=False ):
         """
         Optional:
             * jsonFormat: enable output formatting in json
+            * noCore: suppress core flows
         Description:
             Obtain flows currently installed
         """
@@ -2284,6 +2285,8 @@
             cmdStr = "flows"
             if jsonFormat:
                 cmdStr += " -j "
+            if noCore:
+                cmdStr += " -n "
             cmdStr += state
             handle = self.sendline( cmdStr, timeout=timeout, noExit=noExit )
             assert "Command not found:" not in handle, handle