From: Renato Aguiar Date: Wed, 18 Nov 2015 23:41:01 +0000 (-0800) Subject: Bug 4473 - Ignore unsupported features on table features X-Git-Tag: release/lithium-sr4~16^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F30082%2F1;p=openflowjava.git Bug 4473 - Ignore unsupported features on table features 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 (cherry picked from commit fa1866fd90861d8652f3868a99ad86d9929d72dc) --- diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListDeserializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListDeserializer.java index 93d3c3e2..a53749c2 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListDeserializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListDeserializer.java @@ -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 deserializer = registry.getDeserializer(keyMaker.make(input)); + HeaderDeserializer 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); }