From 752e57bf2628c36c0f29d39392dbf86777eacc9b Mon Sep 17 00:00:00 2001 From: Renato Aguiar Date: Wed, 18 Nov 2015 15:41:01 -0800 Subject: [PATCH] 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) --- .../protocol/impl/util/ListDeserializer.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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); } -- 2.36.6