Bug 6505 - blueprint managed-property is not reading the .cfg file during the reboot. 18/44518/2
authorAnil Vishnoi <vishnoianil@gmail.com>
Mon, 22 Aug 2016 21:25:30 +0000 (14:25 -0700)
committerAnil Vishnoi <vishnoianil@gmail.com>
Tue, 23 Aug 2016 06:33:47 +0000 (23:33 -0700)
Change-Id: Ifb70a789e809ff5ecaa1cf138fa915606f530bfd
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbConnectionService.java
library/impl/src/main/resources/org/opendaylight/blueprint/library.xml

index 4ce17fa0813c757535da2bfe893336db29ecdc46..731d7f1fb840569d57076638515c30f11a018963 100644 (file)
@@ -501,12 +501,16 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
         }
     }
 
+    public void setOvsdbRpcTaskTimeout(int timeout) {
+        JsonRpcEndpoint.setReaperInterval(timeout);
+    }
+
     public void updateConfigParameter(Map<String, Object> configParameters) {
         LOG.debug("Config parameters received : {}", configParameters.entrySet());
         if (configParameters != null && !configParameters.isEmpty()) {
             for (Map.Entry<String, Object> paramEntry : configParameters.entrySet()) {
                 if (paramEntry.getKey().equalsIgnoreCase(OVSDB_RPC_TASK_TIMEOUT_PARAM)) {
-                    JsonRpcEndpoint.setReaperInterval(Integer.parseInt((String)paramEntry.getValue()));
+                    setOvsdbRpcTaskTimeout(Integer.parseInt((String)paramEntry.getValue()));
 
                     //Please remove the break if you add more config nobs.
                     break;
index d3910163c64a78b559c1b6fe26fa557f62a810f3..3f73ab0cf2d8be4d2e6f61ef63798945120349ec 100644 (file)
@@ -4,11 +4,27 @@
            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
            odl:use-default-for-reference-types="true">
 
+  <!-- Read default values at startup and inject to OvsdbConnectionService-->
+  <cm:property-placeholder persistent-id="org.opendaylight.ovsdb.library" update-strategy="none">
+    <!-- Setting default values, in case library.cfg file is not present
+    or config property is commented out. This will be overridden if user
+    specify the property in library.cfg file-->
+    <cm:default-properties>
+      <cm:property name="ovsdb-rpc-task-timeout" value="1000"/>
+    </cm:default-properties>
+  </cm:property-placeholder>
+
+  <bean id="library" class="org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService">
+    <property name="ovsdbRpcTaskTimeout" value="${ovsdb-rpc-task-timeout}"/>
+  </bean>
+
+  <!-- Notify OvsdbConnectionService with any change in the config properties value-->
   <bean id="ovsdbConnectionService" class="org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService">
     <cm:managed-properties persistent-id="org.opendaylight.ovsdb.library"
                            update-strategy="component-managed"
                            update-method="updateConfigParameter"/>
   </bean>
+
   <service ref="ovsdbConnectionService" interface="org.opendaylight.ovsdb.lib.OvsdbConnection"
     odl:type="default" />