import io.netty.buffer.ByteBuf;
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.extensibility.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.RateQueueProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperties;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;
*/
public class OF10QueueGetConfigReplyMessageFactoryTest {
+ private OFDeserializer<GetQueueConfigOutput> queueFactory;
+
+ /**
+ * Initializes deserializer registry and lookups correct deserializer
+ */
+ @Before
+ public void startUp() {
+ DeserializerRegistry registry = new DeserializerRegistryImpl();
+ registry.init();
+ queueFactory = registry.getDeserializer(
+ new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 21, GetQueueConfigOutput.class));
+ }
+
/**
* Testing of {@link OF10QueueGetConfigReplyMessageFactory} for correct
* translation into POJO
+ "00 00 00 08 00 10 00 00 00 00 00 08 00 00 00 00 "
+ "00 00 00 02 00 28 00 00 00 01 00 10 00 00 00 00 00 20 00 00 00 00 00 00 "
+ "00 01 00 10 00 00 00 00 00 30 00 00 00 00 00 00");
- GetQueueConfigOutput builtByFactory = BufferHelper.decodeV10(
- OF10QueueGetConfigReplyMessageFactory.getInstance(), bb);
+ GetQueueConfigOutput builtByFactory = BufferHelper.deserialize(
+ queueFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong port", 1, builtByFactory.getPort().getValue().intValue());