Get float value from property name

Extended tools to parse and return Float-based
properties.

Change-Id: I706bc7d1b547d675424a24198d31077eef0fc51f
Signed-off-by: Georgios Katsikas <katsikas.gp@gmail.com>
diff --git a/utils/misc/src/main/java/org/onlab/util/Tools.java b/utils/misc/src/main/java/org/onlab/util/Tools.java
index 1246ec9..e0ea0d5 100644
--- a/utils/misc/src/main/java/org/onlab/util/Tools.java
+++ b/utils/misc/src/main/java/org/onlab/util/Tools.java
@@ -432,6 +432,26 @@
     }
 
     /**
+     * Get Float property from the propertyName
+     * Return null if propertyName is not found.
+     *
+     * @param properties   properties to be looked up
+     * @param propertyName the name of the property to look up
+     * @return value when the propertyName is defined or return null
+     */
+    public static Float getFloatProperty(Dictionary<?, ?> properties,
+                                             String propertyName) {
+        Float value;
+        try {
+            String s = get(properties, propertyName);
+            value = Strings.isNullOrEmpty(s) ? null : Float.valueOf(s);
+        } catch (NumberFormatException | ClassCastException e) {
+            value = null;
+        }
+        return value;
+    }
+
+    /**
      * Returns a function that retries execution on failure.
      * @param base base function
      * @param exceptionClass type of exception for which to retry