Fixed a bug that ComponentConfigManager#preSetProperty always fails to update a property value.

Change-Id: Id696d4920c6968c4b7592b60644b7593cec0de16
diff --git a/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java b/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java
index b3b22c7..507e61f 100644
--- a/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java
+++ b/core/net/src/main/java/org/onosproject/cfg/impl/ComponentConfigManager.java
@@ -245,8 +245,9 @@
                 return;
             }
         }
-        log.warn("Unable to set non-existent property {} for component {}",
-                 name, componentName);
+
+        // If definition doesn't exist in local catalog, cache the property.
+        preSet(componentName, name, value);
     }
 
     // Locates the property in the component map and replaces it with an
@@ -265,6 +266,24 @@
         }
     }
 
+    // Stores non-existent property so that loadExistingValues() can load in future.
+    private void preSet(String componentName, String name, String value) {
+        try {
+            Configuration config = cfgAdmin.getConfiguration(componentName);
+            if (config == null) {
+                config = cfgAdmin.createFactoryConfiguration(componentName);
+            }
+            Dictionary<String, Object> property = config.getProperties();
+            if (property == null) {
+                property = new Hashtable<>();
+            }
+            property.put(name, value);
+            config.update(property);
+        } catch (IOException e) {
+            log.error("Failed to preset configuration for {}", componentName);
+        }
+    }
+
     // Loads existing property values that may have been set.
     private void loadExistingValues(String componentName) {
         try {
@@ -301,5 +320,4 @@
             log.warn("Unable to update configuration for " + componentName, e);
         }
     }
-
 }