Driver properties for P4RuntimeFlowRuleProgrammable

Change-Id: I7f9415742543d6989dbe9b319e4a8d0eb5d25cd3
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/AbstractP4RuntimeHandlerBehaviour.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/AbstractP4RuntimeHandlerBehaviour.java
index a64bc2f..8783adc 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/AbstractP4RuntimeHandlerBehaviour.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/AbstractP4RuntimeHandlerBehaviour.java
@@ -30,6 +30,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 /**
  * Abstract implementation of a behaviour handler for a P4Runtime device.
  */
@@ -51,9 +53,10 @@
     protected PiTranslationService piTranslationService;
 
     /**
-     * Initializes this behaviour attributes. Returns true if the operation was successful, false otherwise. This method
-     * assumes that the P4runtime controller already has a client for this device and that the device has been created
-     * in the core.
+     * Initializes this behaviour attributes. Returns true if the operation was
+     * successful, false otherwise. This method assumes that the P4runtime
+     * controller already has a client for this device and that the device has
+     * been created in the core.
      *
      * @return true if successful, false otherwise
      */
@@ -88,7 +91,8 @@
     }
 
     /**
-     * Create a P4Runtime client for this device. Returns true if the operation was successful, false otherwise.
+     * Create a P4Runtime client for this device. Returns true if the operation
+     * was successful, false otherwise.
      *
      * @return true if successful, false otherwise
      */
@@ -117,4 +121,21 @@
 
         return true;
     }
+
+    /**
+     * Returns the value of the given driver property, if present,
+     * otherwise returns the given default value.
+     *
+     * @param propName property name
+     * @param defaultVal default value
+     * @return boolean
+     */
+    protected boolean driverBoolProperty(String propName, boolean defaultVal) {
+        checkNotNull(propName);
+        if (handler().driver().getProperty(propName) == null) {
+            return defaultVal;
+        } else {
+            return Boolean.parseBoolean(handler().driver().getProperty(propName));
+        }
+    }
 }