X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Futil%2FOF10ActionsDeserializerTest.java;h=5e304dc984f6f4f8b7b6f54decb7350ac3d3dba7;hb=26aeaa7e2754b2cf4f6ad63055ab3ce34f68c961;hp=62b00a8fd60d2d8259626a527af575bbf2a7eadb;hpb=a4af04c204a636b6c0782cc2248068e0860a69ad;p=openflowjava.git diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsDeserializerTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsDeserializerTest.java index 62b00a8f..5e304dc9 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsDeserializerTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsDeserializerTest.java @@ -12,10 +12,13 @@ import io.netty.buffer.ByteBuf; import java.util.List; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; +import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction; @@ -31,6 +34,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1 */ public class OF10ActionsDeserializerTest { + private DeserializerRegistry registry; + + /** + * Initializes deserializer registry and lookups correct deserializer + */ + @Before + public void startUp() { + registry = new DeserializerRegistryImpl(); + registry.init(); + } + /** * Testing correct deserialization of actions (OF v1.0) */ @@ -47,12 +61,13 @@ public class OF10ActionsDeserializerTest { + "00 08 00 08 01 00 00 00 " + "00 09 00 08 00 02 00 00 " + "00 0A 00 08 00 03 00 00 " - + "00 0B 00 10 00 04 00 00 00 00 00 00 00 00 00 30 " - + "FF FF 00 08 00 00 12 34"); + + "00 0B 00 10 00 04 00 00 00 00 00 00 00 00 00 30"); message.skipBytes(4); // skip XID - List actions = OF10ActionsDeserializer.createActionsList(message); - Assert.assertEquals("Wrong number of actions", 13, actions.size()); + CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID); + List actions = ListDeserializer.deserializeList(EncodeConstants.OF10_VERSION_ID, + message.readableBytes(), message, keyMaker, registry); + Assert.assertEquals("Wrong number of actions", 12, actions.size()); Action action1 = actions.get(0); Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight" + ".openflow.common.action.rev130731.Output", action1.getType().getName()); @@ -114,11 +129,6 @@ public class OF10ActionsDeserializerTest { .getPort().getValue().intValue()); Assert.assertEquals("Wrong queue-id", 48, action12.getAugmentation(QueueIdAction.class).getQueueId().intValue()); - Action action13 = actions.get(12); - Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight" - + ".openflow.common.action.rev130731.Experimenter", action13.getType().getName()); - Assert.assertEquals("Wrong port", 4660, action13.getAugmentation(ExperimenterAction.class) - .getExperimenter().intValue()); } }