Bug 2487 - Too large configuration file from OVS 33/52133/3
authorAnil Vishnoi <vishnoianil@gmail.com>
Wed, 22 Feb 2017 02:38:08 +0000 (18:38 -0800)
committerAnil Vishnoi <vishnoianil@gmail.com>
Wed, 22 Feb 2017 07:05:28 +0000 (23:05 -0800)
Change-Id: Id8d7c9864503cb996112207c6018957ca302a3ad
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/initial/library.cfg
library/impl/src/main/resources/org/opendaylight/blueprint/library.xml

index 76e43cf8aff72308e3cf979966b37978020fb89e..47462f0e115ade5e42acbd471489e999ec9ff787 100644 (file)
@@ -107,6 +107,8 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
     private static boolean useSSL = false;
     private static ICertificateManager certManagerSrv = null;
 
+    private static int jsonRpcDecoderMaxFrameLength = 100000;
+
     private static final StalePassiveConnectionService STALE_PASSIVE_CONNECTION_SERVICE =
             new StalePassiveConnectionService(executorService);
 
@@ -159,7 +161,7 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
                     }
                     channel.pipeline().addLast(
                             //new LoggingHandler(LogLevel.INFO),
-                            new JsonRpcDecoder(100000),
+                            new JsonRpcDecoder(jsonRpcDecoderMaxFrameLength),
                             new StringEncoder(CharsetUtil.UTF_8),
                             new IdleStateHandler(IDLE_READER_TIMEOUT, 0, 0),
                             new ReadTimeoutHandler(READ_TIMEOUT),
@@ -336,7 +338,7 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
                             }
 
                             channel.pipeline().addLast(
-                                 new JsonRpcDecoder(100000),
+                                 new JsonRpcDecoder(jsonRpcDecoderMaxFrameLength),
                                  new StringEncoder(CharsetUtil.UTF_8),
                                  new IdleStateHandler(IDLE_READER_TIMEOUT, 0, 0),
                                  new ReadTimeoutHandler(READ_TIMEOUT),
@@ -564,6 +566,18 @@ public class OvsdbConnectionService implements AutoCloseable, OvsdbConnection {
         certManagerSrv = certificateManagerSrv;
     }
 
+    /**
+     * Blueprint property setter method. Blueprint call this method and set the value of json rpc decoder
+     * max frame length to the value configured for config option (json-rpc-decoder-max-frame-length) in
+     * the configuration file. This option is only configured at the  boot time of the controller. Any
+     * change at the run time will have no impact.
+     * @param maxFrameLength Max frame length (default : 100000)
+     */
+    public void setJsonRpcDecoderMaxFrameLength(int maxFrameLength) {
+        jsonRpcDecoderMaxFrameLength = maxFrameLength;
+        LOG.info("Json Rpc Decoder Max Frame Length set to : {}", jsonRpcDecoderMaxFrameLength);
+    }
+
     public void updateConfigParameter(Map<String, Object> configParameters) {
         LOG.debug("Config parameters received : {}", configParameters.entrySet());
         if (configParameters != null && !configParameters.isEmpty()) {
index 7622593f7bfb365d323d4d8d33396f3adfb27de5..784c38be8bb0e307a00e604d5fddd6ab12710947 100644 (file)
@@ -1,6 +1,25 @@
-#Timeout value (in millisecond) after which OVSDB rpc task will be cancelled.
-#Default value is set to 1000ms, please uncomment and override the value if requires
-#Changing the value don't require controller restart.
-# ovsdb-rpc-task-timeout = 1000
+#********************************************************************************************
+#                               Boot Time Configuration                                     *
+#                   Config knob changes will require controller restart                     *
+#********************************************************************************************
+
 #This flag will be enforced across all the connection's (passive and active) if set to true
-# use-ssl = false
+use-ssl = false
+
+#Set Json Rpc decoder max frame length value. If the OVSDB node contains large configurations
+#that can cause connection related issue while reading the configuration from the OVSDB node
+#database. Increasing the max frame lenge helps resolve the issue. Please see following bug
+#report for more details ( https://bugs.opendaylight.org/show_bug.cgi?id=2732 &
+#https://bugs.opendaylight.org/show_bug.cgi?id=2487). Default value set to 100000.
+json-rpc-decoder-max-frame-length = 100000
+
+
+#********************************************************************************************
+#                               Run Time Configuration                                      *
+#                   Config knob changes doesn't require controller resart                   *
+#********************************************************************************************
+#Timeout value (in millisecond) after which OVSDB rpc task will be cancelled.Default value is
+#set to 1000ms, please uncomment and override the value if requires.Changing the value don't
+#require controller restart.
+ovsdb-rpc-task-timeout = 1000
+
index 29ca7d924bc27d18076c9f295b18d09dda707fe3..365aafa1282504001dcde9315899341d0df51e0e 100644 (file)
@@ -12,6 +12,7 @@
     <cm:default-properties>
       <cm:property name="ovsdb-rpc-task-timeout" value="1000"/>
       <cm:property name="use-ssl" value="false"/>
+      <cm:property name="json-rpc-decoder-max-frame-length" value="100000"/>
     </cm:default-properties>
   </cm:property-placeholder>
 
@@ -23,6 +24,7 @@
     <property name="ovsdbRpcTaskTimeout" value="${ovsdb-rpc-task-timeout}"/>
     <property name="useSsl" value="${use-ssl}"/>
     <property name="certificatManager" ref="aaaCertificateManager"/>
+    <property name="jsonRpcDecoderMaxFrameLength" value="${json-rpc-decoder-max-frame-length}"/>
   </bean>
 
   <!-- Notify OvsdbConnectionService with any change in the config properties value-->