Bug 4473 - Ignore unsupported features on table features 82/30082/1
authorRenato Aguiar <renato.aguiar@hpe.com>
Wed, 18 Nov 2015 23:41:01 +0000 (15:41 -0800)
committermichal rehak <mirehak@cisco.com>
Mon, 23 Nov 2015 16:53:46 +0000 (16:53 +0000)
This patch just ignores any unsupported feature, so the controller is
 still able to connect to the switch and use the currently supported
 features.

Without this change, the connection gets dropped if the switch
implements a new feature, e.g. experimenter action, that is not yet
supported by the controller.

Change-Id: Ibb8d3e5d5bde35903277df923aeb226a42ff947b
Signed-off-by: Renato Aguiar <renato.aguiar@hpe.com>
(cherry picked from commit fa1866fd90861d8652f3868a99ad86d9929d72dc)

openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListDeserializer.java

index 93d3c3e282b616a3fffd41445ce81ec5a83e01ae..a53749c28e6cbaddfaf8a57da3cbe06a75ba8d9e 100644 (file)
@@ -16,13 +16,18 @@ import java.util.List;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
 import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author michal.polkorab
  *
  */
 public final class ListDeserializer {
+    private static final Logger LOG = LoggerFactory.getLogger(ListDeserializer.class);
 
     private ListDeserializer() {
         throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
@@ -53,7 +58,7 @@ public final class ListDeserializer {
     }
 
     /**
-     * Deserializes headers of items into list
+     * Deserializes headers of items into list (used in MultipartReplyMessage - Table features)
      * @param version openflow wire version
      * @param length length of list in ByteBuf (bytes)
      * @param input input buffer
@@ -68,7 +73,15 @@ public final class ListDeserializer {
             items = new ArrayList<>();
             int startIndex = input.readerIndex();
             while ((input.readerIndex() - startIndex) < length){
-                HeaderDeserializer<E> deserializer = registry.getDeserializer(keyMaker.make(input));
+                HeaderDeserializer<E> deserializer;
+                MessageCodeKey key = keyMaker.make(input);
+                try {
+                    deserializer = registry.getDeserializer(key);
+                } catch (IllegalStateException e) {
+                    LOG.warn("Problem during reading table feature property. Skipping unknown feature property: {}", key);
+                    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+                    continue;
+                }
                 E item = deserializer.deserializeHeader(input);
                 items.add(item);
             }