import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterInstructionDeserializerKey;
import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
* @param deserializer deserializer instance
*/
void registerExperimenterMessageDeserializer(ExperimenterIdDeserializerKey key,
- OFDeserializer<ExperimenterMessage> deserializer);
+ OFDeserializer<? extends ExperimenterDataOfChoice> deserializer);
/**
* Registers multipart-reply (stats) message deserializer
* @param deserializer deserializer instance
*/
void registerMultipartReplyMessageDeserializer(ExperimenterIdDeserializerKey key,
- OFDeserializer<MultipartReplyMessage> deserializer);
+ OFDeserializer<? extends ExperimenterDataOfChoice> deserializer);
/**
* Registers multipart-reply table-features message deserializer
package org.opendaylight.openflowjava.protocol.api.keys;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
* @author michal.polkorab
*
*/
-public final class ExperimenterIdDeserializerKey extends MessageCodeKey
+public class ExperimenterIdDeserializerKey extends MessageCodeKey
implements ExperimenterDeserializerKey {
- private Long experimenterId;
+ private long experimenterId;
/**
* @param <E> type of target experimenter object
* @param experimenterId experimenter / vendor ID
* @param objectClass class of created object
*/
- public <E extends DataObject> ExperimenterIdDeserializerKey(short version,
- Long experimenterId, Class<E> objectClass) {
+ public <E extends DataContainer> ExperimenterIdDeserializerKey(short version,
+ long experimenterId, Class<E> objectClass) {
super(version, EncodeConstants.EXPERIMENTER_VALUE, objectClass);
this.experimenterId = experimenterId;
}
+ protected int hashCodeOfLong(long longValue) {
+ return (int) (longValue ^ (longValue >>> 32));
+ }
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ result = prime * result + hashCodeOfLong(experimenterId);
return result;
}
return false;
}
ExperimenterIdDeserializerKey other = (ExperimenterIdDeserializerKey) obj;
- if (experimenterId == null) {
- if (other.experimenterId != null) {
- return false;
- }
- } else if (!experimenterId.equals(other.experimenterId)) {
+ if (experimenterId != other.experimenterId) {
return false;
}
return true;
--- /dev/null
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.opendaylight.yangtools.yang.binding.DataContainer;
+
+/**
+ * @author michal.polkorab
+ */
+public class ExperimenterIdTypeDeserializerKey extends ExperimenterIdDeserializerKey {
+
+ private long type;
+
+ /**
+ * @param msgVersion protocol wire version
+ * @param experimenterId experimenter / vendor ID
+ * @param type data type according to vendor implementation
+ * @param objectClass class of object to be serialized
+ */
+ public <T extends DataContainer> ExperimenterIdTypeDeserializerKey(short msgVersion,
+ long experimenterId, long type, Class<T> objectClass) {
+ super(msgVersion, experimenterId, objectClass);
+ this.type = type;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + hashCodeOfLong(type);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ExperimenterIdTypeDeserializerKey)) {
+ return false;
+ }
+ ExperimenterIdTypeDeserializerKey other = (ExperimenterIdTypeDeserializerKey) obj;
+ if (type != other.type) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "; type: " + type;
+ }
+}
\ No newline at end of file
type binary;
}
}
- grouping experimenter {
- reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
- /* Symmetric message */
- uses ofHeader;
- leaf experimenter {
- type oft:experimenter-id;
- }
- leaf exp_type {
- type uint32;
- }
- }
-
grouping experimenter-core {
description "General experimenter message content suitable for symmetric and multipart message";
leaf experimenter {
choice experimenter-data-of-choice {
// to be augmented by vendors
}
- }
+ }
grouping experimenter-of-message {
reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
/* Symmetric message */
}
case multipart-reply-experimenter-case {
container multipart-reply-experimenter {
- // empty body - used for experimenter augmentation
+ uses experimenter-core;
}
}
}
/* Symmetric message */
}
notification experimenter-message {
- uses experimenter;
+ description "Experimenter request message from device.";
+ uses experimenter-of-message;
reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
// TODO:: does switch send this when understood experimenter msg from lib?
/* Symmetric message */
key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);
+ key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
key2 = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, ExperimenterMessage.class);
@Test
public void testEquals() {
ExperimenterIdDeserializerKey key1 =
- new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, null, ExperimenterMessage.class);
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0L, ExperimenterMessage.class);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
MessageCodeKey mk = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID,EncodeConstants.EXPERIMENTER_VALUE, ExperimenterMessage.class);
Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
--- /dev/null
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdTypeDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+
+/**
+ * @author michal.polkorab
+ */
+public class ExperimenterIdTypeDeserializerKeyTest {
+
+ /**
+ * Test ExperimenterIdTypeDeserializerKey equals and hashCode
+ */
+ @Test
+ public void testHashCodeAndEquals() {
+ ExperimenterIdTypeDeserializerKey key1 =
+ new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
+ ExperimenterIdTypeDeserializerKey key2 =
+ new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
+ Assert.assertTrue("Wrong equals", key1.equals(key2));
+ Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, 1L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, 1L, null);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, 1L, ErrorMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+
+ key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, 2L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equals", key1.equals(key2));
+ Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+ }
+
+ /**
+ * Test ExperimenterIdTypeDeserializerKey equals - additional test
+ */
+ @Test
+ public void testEquals() {
+ ExperimenterIdTypeDeserializerKey key1 =
+ new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 41L, 1L, ExperimenterMessage.class);
+ Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+ ExperimenterIdSerializerKey<?> mk = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
+ ExperimenterIdTypeDeserializerKey key2 =
+ new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
+
+ ExperimenterIdTypeDeserializerKey key3 =
+ new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 41L, 2L, ExperimenterMessage.class);
+ Assert.assertFalse("Wrong equal by type.", key1.equals(key3));
+ }
+
+}
\ No newline at end of file
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
import org.slf4j.Logger;
@Override
public void registerExperimenterMessageDeserializer(ExperimenterIdDeserializerKey key,
- OFDeserializer<ExperimenterMessage> deserializer) {
+ OFDeserializer<? extends ExperimenterDataOfChoice> deserializer) {
deserializerRegistry.registerDeserializer(key, deserializer);
}
@Override
public void registerMultipartReplyMessageDeserializer(ExperimenterIdDeserializerKey key,
- OFDeserializer<MultipartReplyMessage> deserializer) {
+ OFDeserializer<? extends ExperimenterDataOfChoice> deserializer) {
deserializerRegistry.registerDeserializer(key, deserializer);
}
@Override
public Future<RpcResult<Void>> experimenter(final ExperimenterInput input) {
- return sendToSwitchFuture(input, "experimenter sending failed");
+ return sendToSwitchFuture(input, "experimenter reply sending failed");
}
@Override
import java.util.HashMap;
import java.util.Map;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
package org.opendaylight.openflowjava.protocol.impl.deserialization;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.BarrierReplyMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoReplyMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoRequestMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.ErrorMessageFactory;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.ExperimenterMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FeaturesReplyMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FlowRemovedMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.GetAsyncReplyMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.PortStatusMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.QueueGetConfigReplyMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.RoleReplyMessageFactory;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.VendorMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.util.SimpleDeserializerRegistryHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
helper.registerDeserializer(1, null, ErrorMessage.class, new OF10ErrorMessageFactory());
helper.registerDeserializer(2, null, EchoRequestMessage.class, new OF10EchoRequestMessageFactory());
helper.registerDeserializer(3, null, EchoOutput.class, new OF10EchoReplyMessageFactory());
+ helper.registerDeserializer(4, null, ExperimenterMessage.class, new VendorMessageFactory());
helper.registerDeserializer(6, null, GetFeaturesOutput.class, new OF10FeaturesReplyMessageFactory());
helper.registerDeserializer(8, null, GetConfigOutput.class, new OF10GetConfigReplyMessageFactory());
helper.registerDeserializer(10, null, PacketInMessage.class, new OF10PacketInMessageFactory());
helper.registerDeserializer(1, null, ErrorMessage.class, new ErrorMessageFactory());
helper.registerDeserializer(2, null, EchoRequestMessage.class, new EchoRequestMessageFactory());
helper.registerDeserializer(3, null, EchoOutput.class, new EchoReplyMessageFactory());
+ helper.registerDeserializer(4, null, ExperimenterMessage.class, new ExperimenterMessageFactory());
helper.registerDeserializer(6, null, GetFeaturesOutput.class, new FeaturesReplyMessageFactory());
helper.registerDeserializer(8, null, GetConfigOutput.class, new GetConfigReplyMessageFactory());
helper.registerDeserializer(10, null, PacketInMessage.class, new PacketInMessageFactory());
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
/**
* @author michal.polkorab
public class ExperimenterMessageFactory implements OFDeserializer<ExperimenterMessage>,
DeserializerRegistryInjector {
- /** Experimenter ID index after version, message type and length were read */
- private static final byte EXPERIMENTER_ID_INDEX = 4;
private DeserializerRegistry deserializerRegistry;
@Override
public ExperimenterMessage deserialize(ByteBuf message) {
- long expId = message.getUnsignedInt(message.readerIndex() + EXPERIMENTER_ID_INDEX);
- OFDeserializer<ExperimenterMessage> deserializer = deserializerRegistry.getDeserializer(
+ final long xid = message.readUnsignedInt();
+ final long expId = message.readUnsignedInt();
+ final long expType = message.readUnsignedInt();
+
+ OFDeserializer<ExperimenterDataOfChoice> deserializer = deserializerRegistry.getDeserializer(
ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
- EncodeConstants.OF13_VERSION_ID, expId));
- return deserializer.deserialize(message);
+ EncodeConstants.OF13_VERSION_ID, expId, expType));
+ final ExperimenterDataOfChoice vendorData = deserializer.deserialize(message);
+
+ ExperimenterMessageBuilder messageBld = new ExperimenterMessageBuilder()
+ .setVersion((short) EncodeConstants.OF13_VERSION_ID)
+ .setXid(xid)
+ .setExperimenter(new ExperimenterId(expId))
+ .setExpType(expType)
+ .setExperimenterDataOfChoice(vendorData);
+ return messageBld.build();
}
@Override
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsListBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDropCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemarkCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDescCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDescCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDescBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStatsBuilder;
/**
* Translates MultipartReply messages
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
rawMessage.skipBytes(PADDING_IN_MULTIPART_REPLY_HEADER);
switch (MultipartType.forValue(type)) {
- case OFPMPDESC: builder.setMultipartReplyBody(setDesc(rawMessage));
- break;
- case OFPMPFLOW: builder.setMultipartReplyBody(setFlow(rawMessage));
- break;
- case OFPMPAGGREGATE: builder.setMultipartReplyBody(setAggregate(rawMessage));
- break;
- case OFPMPTABLE: builder.setMultipartReplyBody(setTable(rawMessage));
- break;
- case OFPMPPORTSTATS: builder.setMultipartReplyBody(setPortStats(rawMessage));
- break;
- case OFPMPQUEUE: builder.setMultipartReplyBody(setQueue(rawMessage));
- break;
- case OFPMPGROUP: builder.setMultipartReplyBody(setGroup(rawMessage));
- break;
- case OFPMPGROUPDESC: builder.setMultipartReplyBody(setGroupDesc(rawMessage));
- break;
- case OFPMPGROUPFEATURES: builder.setMultipartReplyBody(setGroupFeatures(rawMessage));
- break;
- case OFPMPMETER: builder.setMultipartReplyBody(setMeter(rawMessage));
- break;
- case OFPMPMETERCONFIG: builder.setMultipartReplyBody(setMeterConfig(rawMessage));
- break;
- case OFPMPMETERFEATURES: builder.setMultipartReplyBody(setMeterFeatures(rawMessage));
- break;
- case OFPMPTABLEFEATURES: builder.setMultipartReplyBody(setTableFeatures(rawMessage));
- break;
- case OFPMPPORTDESC: builder.setMultipartReplyBody(setPortDesc(rawMessage));
- break;
- case OFPMPEXPERIMENTER: builder.setMultipartReplyBody(setExperimenter(rawMessage));
- break;
- default:
- break;
+ case OFPMPDESC:
+ builder.setMultipartReplyBody(setDesc(rawMessage));
+ break;
+ case OFPMPFLOW:
+ builder.setMultipartReplyBody(setFlow(rawMessage));
+ break;
+ case OFPMPAGGREGATE:
+ builder.setMultipartReplyBody(setAggregate(rawMessage));
+ break;
+ case OFPMPTABLE:
+ builder.setMultipartReplyBody(setTable(rawMessage));
+ break;
+ case OFPMPPORTSTATS:
+ builder.setMultipartReplyBody(setPortStats(rawMessage));
+ break;
+ case OFPMPQUEUE:
+ builder.setMultipartReplyBody(setQueue(rawMessage));
+ break;
+ case OFPMPGROUP:
+ builder.setMultipartReplyBody(setGroup(rawMessage));
+ break;
+ case OFPMPGROUPDESC:
+ builder.setMultipartReplyBody(setGroupDesc(rawMessage));
+ break;
+ case OFPMPGROUPFEATURES:
+ builder.setMultipartReplyBody(setGroupFeatures(rawMessage));
+ break;
+ case OFPMPMETER:
+ builder.setMultipartReplyBody(setMeter(rawMessage));
+ break;
+ case OFPMPMETERCONFIG:
+ builder.setMultipartReplyBody(setMeterConfig(rawMessage));
+ break;
+ case OFPMPMETERFEATURES:
+ builder.setMultipartReplyBody(setMeterFeatures(rawMessage));
+ break;
+ case OFPMPTABLEFEATURES:
+ builder.setMultipartReplyBody(setTableFeatures(rawMessage));
+ break;
+ case OFPMPPORTDESC:
+ builder.setMultipartReplyBody(setPortDesc(rawMessage));
+ break;
+ case OFPMPEXPERIMENTER:
+ builder.setMultipartReplyBody(setExperimenter(rawMessage));
+ break;
+ default:
+ break;
}
return builder.build();
return caseBuilder.build();
}
- private static FlowModFlags createFlowModFlagsFromBitmap(int input){
+ private static FlowModFlags createFlowModFlagsFromBitmap(int input) {
final Boolean fmfSENDFLOWREM = (input & (1 << 0)) != 0;
final Boolean fmfCHECKOVERLAP = (input & (1 << 1)) != 0;
final Boolean fmfRESETCOUNTS = (input & (1 << 2)) != 0;
}
private static MultipartReplyQueueCase setQueue(ByteBuf input) {
- MultipartReplyQueueCaseBuilder caseBuilder = new MultipartReplyQueueCaseBuilder();
+ MultipartReplyQueueCaseBuilder caseBuilder = new MultipartReplyQueueCaseBuilder();
MultipartReplyQueueBuilder builder = new MultipartReplyQueueBuilder();
List<QueueStats> queueStatsList = new ArrayList<>();
while (input.readableBytes() > 0) {
return caseBuilder.build();
}
- private static MeterFlags createMeterFlags(long input){
+ private static MeterFlags createMeterFlags(long input) {
final Boolean mfKBPS = (input & (1 << 0)) != 0;
final Boolean mfPKTPS = (input & (1 << 1)) != 0;
final Boolean mfBURST = (input & (1 << 2)) != 0;
int bandType = input.readUnsignedShort();
switch (bandType) {
case 1:
- MeterBandDropCaseBuilder bandDropCaseBuilder = new MeterBandDropCaseBuilder();
+ MeterBandDropCaseBuilder bandDropCaseBuilder = new MeterBandDropCaseBuilder();
MeterBandDropBuilder bandDropBuilder = new MeterBandDropBuilder();
bandDropBuilder.setType(MeterBandType.forValue(bandType));
actualLength += input.readUnsignedShort();
bandsBuilder.setMeterBand(bandDropCaseBuilder.build());
break;
case 2:
- MeterBandDscpRemarkCaseBuilder bandDscpRemarkCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
+ MeterBandDscpRemarkCaseBuilder bandDscpRemarkCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
MeterBandDscpRemarkBuilder bandDscpRemarkBuilder = new MeterBandDscpRemarkBuilder();
bandDscpRemarkBuilder.setType(MeterBandType.forValue(bandType));
actualLength += input.readUnsignedShort();
}
private MultipartReplyExperimenterCase setExperimenter(ByteBuf input) {
- return registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
- EncodeConstants.OF13_VERSION_ID, input.readUnsignedInt()));
+ final long expId = input.readUnsignedInt();
+ final long expType = input.readUnsignedInt();
+
+ final OFDeserializer<ExperimenterDataOfChoice> deserializer = registry.getDeserializer(
+ ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
+ EncodeConstants.OF13_VERSION_ID, expId, expType));
+
+ final MultipartReplyExperimenterBuilder mpExperimenterBld = new MultipartReplyExperimenterBuilder()
+ .setExperimenter(new ExperimenterId(expId))
+ .setExpType(expType)
+ .setExperimenterDataOfChoice(deserializer.deserialize(input));
+ final MultipartReplyExperimenterCaseBuilder mpReplyExperimenterCaseBld = new MultipartReplyExperimenterCaseBuilder()
+ .setMultipartReplyExperimenter(mpExperimenterBld.build());
+ return mpReplyExperimenterCaseBld.build();
}
private static MultipartReplyPortDescCase setPortDesc(ByteBuf input) {
return caseBuilder.build();
}
- private static PortConfig createPortConfig(long input){
- final Boolean pcPortDown = ((input) & (1<<0)) != 0;
- final Boolean pcNRecv = ((input) & (1<<2)) != 0;
- final Boolean pcNFwd = ((input) & (1<<5)) != 0;
- final Boolean pcNPacketIn = ((input) & (1<<6)) != 0;
+ private static PortConfig createPortConfig(long input) {
+ final Boolean pcPortDown = ((input) & (1 << 0)) != 0;
+ final Boolean pcNRecv = ((input) & (1 << 2)) != 0;
+ final Boolean pcNFwd = ((input) & (1 << 5)) != 0;
+ final Boolean pcNPacketIn = ((input) & (1 << 6)) != 0;
return new PortConfig(pcNFwd, pcNPacketIn, pcNRecv, pcPortDown);
}
- private static PortState createPortState(long input){
- final Boolean psLinkDown = ((input) & (1<<0)) != 0;
- final Boolean psBlocked = ((input) & (1<<1)) != 0;
- final Boolean psLive = ((input) & (1<<2)) != 0;
+ private static PortState createPortState(long input) {
+ final Boolean psLinkDown = ((input) & (1 << 0)) != 0;
+ final Boolean psBlocked = ((input) & (1 << 1)) != 0;
+ final Boolean psLive = ((input) & (1 << 2)) != 0;
return new PortState(psBlocked, psLinkDown, psLive);
}
- private static PortFeatures createPortFeatures(long input){
- final Boolean pf10mbHd = ((input) & (1<<0)) != 0;
- final Boolean pf10mbFd = ((input) & (1<<1)) != 0;
- final Boolean pf100mbHd = ((input) & (1<<2)) != 0;
- final Boolean pf100mbFd = ((input) & (1<<3)) != 0;
- final Boolean pf1gbHd = ((input) & (1<<4)) != 0;
- final Boolean pf1gbFd = ((input) & (1<<5)) != 0;
- final Boolean pf10gbFd = ((input) & (1<<6)) != 0;
- final Boolean pf40gbFd = ((input) & (1<<7)) != 0;
- final Boolean pf100gbFd = ((input) & (1<<8)) != 0;
- final Boolean pf1tbFd = ((input) & (1<<9)) != 0;
- final Boolean pfOther = ((input) & (1<<10)) != 0;
- final Boolean pfCopper = ((input) & (1<<11)) != 0;
- final Boolean pfFiber = ((input) & (1<<12)) != 0;
- final Boolean pfAutoneg = ((input) & (1<<13)) != 0;
- final Boolean pfPause = ((input) & (1<<14)) != 0;
- final Boolean pfPauseAsym = ((input) & (1<<15)) != 0;
+ private static PortFeatures createPortFeatures(long input) {
+ final Boolean pf10mbHd = ((input) & (1 << 0)) != 0;
+ final Boolean pf10mbFd = ((input) & (1 << 1)) != 0;
+ final Boolean pf100mbHd = ((input) & (1 << 2)) != 0;
+ final Boolean pf100mbFd = ((input) & (1 << 3)) != 0;
+ final Boolean pf1gbHd = ((input) & (1 << 4)) != 0;
+ final Boolean pf1gbFd = ((input) & (1 << 5)) != 0;
+ final Boolean pf10gbFd = ((input) & (1 << 6)) != 0;
+ final Boolean pf40gbFd = ((input) & (1 << 7)) != 0;
+ final Boolean pf100gbFd = ((input) & (1 << 8)) != 0;
+ final Boolean pf1tbFd = ((input) & (1 << 9)) != 0;
+ final Boolean pfOther = ((input) & (1 << 10)) != 0;
+ final Boolean pfCopper = ((input) & (1 << 11)) != 0;
+ final Boolean pfFiber = ((input) & (1 << 12)) != 0;
+ final Boolean pfAutoneg = ((input) & (1 << 13)) != 0;
+ final Boolean pfPause = ((input) & (1 << 14)) != 0;
+ final Boolean pfPauseAsym = ((input) & (1 << 15)) != 0;
return new PortFeatures(pf100gbFd, pf100mbFd, pf100mbHd, pf10gbFd, pf10mbFd, pf10mbHd, pf1gbFd,
pf1gbHd, pf1tbFd, pf40gbFd, pfAutoneg, pfCopper, pfFiber, pfOther, pfPause, pfPauseAsym);
}
featuresBuilder.setTypes(createGroupType(rawMessage.readUnsignedInt()));
featuresBuilder.setCapabilities(createCapabilities(rawMessage.readUnsignedInt()));
List<Long> maxGroupsList = new ArrayList<>();
- for (int i = 0; i < GROUP_TYPES ; i++) {
+ for (int i = 0; i < GROUP_TYPES; i++) {
maxGroupsList.add(rawMessage.readUnsignedInt());
}
featuresBuilder.setMaxGroups(maxGroupsList);
List<ActionType> actionBitmaps = new ArrayList<>();
- for (int i = 0; i < GROUP_TYPES ; i++) {
+ for (int i = 0; i < GROUP_TYPES; i++) {
actionBitmaps.add(createActionBitmap(rawMessage.readUnsignedInt()));
}
featuresBuilder.setActionsBitmap(actionBitmaps);
}
private static ActionType createActionBitmap(long input) {
- final Boolean atOutput = ((input) & (1<<0)) != 0;
- final Boolean atCopyTTLout = ((input) & (1<<11)) != 0;
- final Boolean atCopyTTLin = ((input) & (1<<12)) != 0;
- final Boolean atSetMplsTTL = ((input) & (1<<15)) != 0;
- final Boolean atDecMplsTTL = ((input) & (1<<16)) != 0;
- final Boolean atPushVLAN = ((input) & (1<<17)) != 0;
- final Boolean atPopVLAN = ((input) & (1<<18)) != 0;
- final Boolean atPushMPLS = ((input) & (1<<19)) != 0;
- final Boolean atPopMPLS = ((input) & (1<<20)) != 0;
- final Boolean atSetQueue = ((input) & (1<<21)) != 0;
- final Boolean atGroup = ((input) & (1<<22)) != 0;
- final Boolean atSetNWTTL = ((input) & (1<<23)) != 0;
- final Boolean atDecNWTTL = ((input) & (1<<24)) != 0;
- final Boolean atSetField = ((input) & (1<<25)) != 0;
- final Boolean atPushPBB = ((input) & (1<<26)) != 0;
- final Boolean atPopPBB = ((input) & (1<<27)) != 0;
+ final Boolean atOutput = ((input) & (1 << 0)) != 0;
+ final Boolean atCopyTTLout = ((input) & (1 << 11)) != 0;
+ final Boolean atCopyTTLin = ((input) & (1 << 12)) != 0;
+ final Boolean atSetMplsTTL = ((input) & (1 << 15)) != 0;
+ final Boolean atDecMplsTTL = ((input) & (1 << 16)) != 0;
+ final Boolean atPushVLAN = ((input) & (1 << 17)) != 0;
+ final Boolean atPopVLAN = ((input) & (1 << 18)) != 0;
+ final Boolean atPushMPLS = ((input) & (1 << 19)) != 0;
+ final Boolean atPopMPLS = ((input) & (1 << 20)) != 0;
+ final Boolean atSetQueue = ((input) & (1 << 21)) != 0;
+ final Boolean atGroup = ((input) & (1 << 22)) != 0;
+ final Boolean atSetNWTTL = ((input) & (1 << 23)) != 0;
+ final Boolean atDecNWTTL = ((input) & (1 << 24)) != 0;
+ final Boolean atSetField = ((input) & (1 << 25)) != 0;
+ final Boolean atPushPBB = ((input) & (1 << 26)) != 0;
+ final Boolean atPopPBB = ((input) & (1 << 27)) != 0;
final Boolean atExperimenter = false;
return new ActionType(atCopyTTLin, atCopyTTLout, atDecMplsTTL,
atDecNWTTL, atExperimenter, atGroup, atOutput, atPopMPLS,
}
private static GroupCapabilities createCapabilities(long input) {
- final Boolean gcSelectWeight = ((input) & (1<<0)) != 0;
- final Boolean gcSelectLiveness = ((input) & (1<<1)) != 0;
- final Boolean gcChaining = ((input) & (1<<2)) != 0;
- final Boolean gcChainingChecks = ((input) & (1<<3)) != 0;
+ final Boolean gcSelectWeight = ((input) & (1 << 0)) != 0;
+ final Boolean gcSelectLiveness = ((input) & (1 << 1)) != 0;
+ final Boolean gcChaining = ((input) & (1 << 2)) != 0;
+ final Boolean gcChainingChecks = ((input) & (1 << 3)) != 0;
return new GroupCapabilities(gcChaining, gcChainingChecks, gcSelectLiveness, gcSelectWeight);
}
private static GroupTypes createGroupType(long input) {
- final Boolean gtAll = ((input) & (1<<0)) != 0;
- final Boolean gtSelect = ((input) & (1<<1)) != 0;
- final Boolean gtIndirect = ((input) & (1<<2)) != 0;
- final Boolean gtFF = ((input) & (1<<3)) != 0;
+ final Boolean gtAll = ((input) & (1 << 0)) != 0;
+ final Boolean gtSelect = ((input) & (1 << 1)) != 0;
+ final Boolean gtIndirect = ((input) & (1 << 2)) != 0;
+ final Boolean gtFF = ((input) & (1 << 3)) != 0;
return new GroupTypes(gtAll, gtFF, gtIndirect, gtSelect);
}
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDescCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDescCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDescBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStatsBuilder;
/**
* Translates StatsReply messages (OpenFlow v1.0)
+ *
* @author michal.polkorab
*/
public class OF10StatsReplyMessageFactory implements OFDeserializer<MultipartReplyMessage>,
builder.setType(MultipartType.forValue(type));
builder.setFlags(new MultipartRequestFlags((rawMessage.readUnsignedShort() & 0x01) != 0));
switch (MultipartType.forValue(type)) {
- case OFPMPDESC: builder.setMultipartReplyBody(setDesc(rawMessage));
- break;
- case OFPMPFLOW: builder.setMultipartReplyBody(setFlow(rawMessage));
- break;
- case OFPMPAGGREGATE: builder.setMultipartReplyBody(setAggregate(rawMessage));
- break;
- case OFPMPTABLE: builder.setMultipartReplyBody(setTable(rawMessage));
- break;
- case OFPMPPORTSTATS: builder.setMultipartReplyBody(setPortStats(rawMessage));
- break;
- case OFPMPQUEUE: builder.setMultipartReplyBody(setQueue(rawMessage));
- break;
- case OFPMPEXPERIMENTER: builder.setMultipartReplyBody(setExperimenter(rawMessage));
- break;
- default:
- break;
+ case OFPMPDESC:
+ builder.setMultipartReplyBody(setDesc(rawMessage));
+ break;
+ case OFPMPFLOW:
+ builder.setMultipartReplyBody(setFlow(rawMessage));
+ break;
+ case OFPMPAGGREGATE:
+ builder.setMultipartReplyBody(setAggregate(rawMessage));
+ break;
+ case OFPMPTABLE:
+ builder.setMultipartReplyBody(setTable(rawMessage));
+ break;
+ case OFPMPPORTSTATS:
+ builder.setMultipartReplyBody(setPortStats(rawMessage));
+ break;
+ case OFPMPQUEUE:
+ builder.setMultipartReplyBody(setQueue(rawMessage));
+ break;
+ case OFPMPEXPERIMENTER:
+ builder.setMultipartReplyBody(setExperimenter(rawMessage));
+ break;
+ default:
+ break;
}
return builder.build();
}
}
private MultipartReplyExperimenterCase setExperimenter(ByteBuf input) {
- return registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, input.readUnsignedInt()));
+ final long expId = input.readUnsignedInt();
+ final OFDeserializer<ExperimenterDataOfChoice> deserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMultipartReplyVendorMessageDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, expId));
+
+ final MultipartReplyExperimenterBuilder mpExperimenterBld = new MultipartReplyExperimenterBuilder()
+ .setExperimenter(new ExperimenterId(expId))
+ .setExperimenterDataOfChoice(deserializer.deserialize(input));
+ final MultipartReplyExperimenterCaseBuilder mpReplyExperimenterCaseBld = new MultipartReplyExperimenterCaseBuilder()
+ .setMultipartReplyExperimenter(mpExperimenterBld.build());
+ return mpReplyExperimenterCaseBld.build();
}
@Override
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.util.ExperimenterDeserializerKeyFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
/**
* @author michal.polkorab
- *
*/
public class VendorMessageFactory implements OFDeserializer<ExperimenterMessage>,
DeserializerRegistryInjector {
- private static final byte VENDOR_ID_INDEX = 8;
private DeserializerRegistry deserializerRegistry;
@Override
public ExperimenterMessage deserialize(ByteBuf message) {
- long expId = message.getUnsignedInt(message.readerIndex() + VENDOR_ID_INDEX);
- OFDeserializer<ExperimenterMessage> deserializer = deserializerRegistry.getDeserializer(
- ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
+ final long xid = message.readUnsignedInt();
+ final long expId = message.readUnsignedInt();
+ OFDeserializer<ExperimenterDataOfChoice> deserializer = deserializerRegistry.getDeserializer(
+ ExperimenterDeserializerKeyFactory.createVendorMessageDeserializerKey(
EncodeConstants.OF10_VERSION_ID, expId));
- return deserializer.deserialize(message);
+ final ExperimenterDataOfChoice vendorData = deserializer.deserialize(message);
+
+ final ExperimenterMessageBuilder messageBld = new ExperimenterMessageBuilder()
+ .setVersion((short) EncodeConstants.OF10_VERSION_ID)
+ .setXid(xid)
+ .setExperimenter(new ExperimenterId(expId))
+ .setExperimenterDataOfChoice(vendorData);
+ return messageBld.build();
}
@Override
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
-import com.google.common.util.concurrent.ListenableFuture;
-
/**
* @author madamjak
* @author michal.polkorab
@Mock OFGeneralSerializer serializer;
@Mock OFGeneralDeserializer deserializer;
@Mock OFDeserializer<ErrorMessage> deserializerError;
- @Mock OFDeserializer<ExperimenterMessage> deserializerExpMsg;
- @Mock OFDeserializer<MultipartReplyMessage> deserializerMultipartRplMsg;
+ @Mock OFDeserializer<ExperimenterDataOfChoice> deserializerExpMsg;
+ @Mock OFDeserializer<ExperimenterDataOfChoice> deserializerMultipartRplMsg;
@Mock OFDeserializer<QueueProperty> deserializerQueueProperty;
@Mock OFDeserializer<MeterBandExperimenterCase> deserializerMeterBandExpCase;
@Mock OFSerializer<ExperimenterDataOfChoice> serializerExperimenterInput;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
-import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBuf;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
/**
* @author michal.polkorab
*
*/
+@RunWith(MockitoJUnitRunner.class)
public class ExperimenterMessageFactoryTest {
@Mock DeserializerRegistry registry;
- @Mock OFDeserializer<ExperimenterMessage> deserializer;
- @Mock ExperimenterMessage message;
+ @Mock OFDeserializer<ExperimenterDataOfChoice> deserializer;
+ @Mock ExperimenterDataOfChoice message;
+ private ExperimenterMessageFactory factory;
/**
* Initializes mocks
*/
@Before
public void startUp() {
- MockitoAnnotations.initMocks(this);
+ factory = new ExperimenterMessageFactory();
}
/**
when(registry.getDeserializer(any(ExperimenterIdDeserializerKey.class))).thenReturn(deserializer);
when(deserializer.deserialize(any(ByteBuf.class))).thenReturn(message);
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 02 03 00 00 00 10");
- ExperimenterMessageFactory factory = new ExperimenterMessageFactory();
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 02 03 00 00 00 10 00 00 00 20");
factory.injectDeserializerRegistry(registry);
ExperimenterMessage deserializedMessage = factory.deserialize(buffer);
- Assert.assertEquals("Wrong return value", message, deserializedMessage);
- Assert.assertEquals("ByteBuf index moved", 0, buffer.readerIndex());
+ Assert.assertEquals("Wrong return value", message, deserializedMessage.getExperimenterDataOfChoice());
+ Assert.assertEquals("ByteBuf index moved", 0, buffer.readableBytes());
}
}
\ No newline at end of file
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
*/
@Test
public void test() {
- Mockito.when(registry.getDeserializer(Matchers.any(MessageCodeKey.class))).thenReturn(deserializer);
- ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("04 04 00 10 01 02 03 04 FF FF FF FF 80 00 00 00");
+ Mockito.when(registry.getDeserializer(Matchers.<MessageCodeKey>any())).thenReturn(deserializer);
+ ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("01 02 03 04 FF FF FF FF 80 00 00 00");
VendorMessageFactory factory = new VendorMessageFactory();
factory.injectDeserializerRegistry(registry);
factory.deserialize(buffer);
Mockito.verify(deserializer, Mockito.times(1)).deserialize(buffer);
- Assert.assertEquals("Buffer index modified", 16, buffer.readableBytes());
+ Assert.assertEquals("Buffer index modified", 4, buffer.readableBytes());
}
}
\ No newline at end of file
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
/**
* @author michal.polkorab
@Mock DeserializerRegistry registry;
private MultipartReplyMessageFactory factory = new MultipartReplyMessageFactory();
+ @Mock
+ private OFDeserializer<ExperimenterDataOfChoice> vendorDeserializer;
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
*/
@Test
public void testMultipartReplyExperimenter() {
+ Mockito.when(registry.getDeserializer(Matchers.<MessageCodeKey>any())).thenReturn(vendorDeserializer);
factory.injectDeserializerRegistry(registry);
ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 "
+ "00 00 00 01 00 00 00 02"); // expID, expType
Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
- Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));
+ Mockito.verify(vendorDeserializer).deserialize(bb);
}
}
\ No newline at end of file
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories.multipart;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10StatsReplyMessageFactory;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
/**
* @author michal.polkorab
public class OF10StatsReplyExperimenterTest {
@Mock DeserializerRegistry registry;
+ @Mock private OFDeserializer<ExperimenterDataOfChoice> vendorDeserializer;
/**
* Tests {@link OF10StatsReplyMessageFactory} for experimenter body translation
*/
@Test
public void test() {
+ Mockito.when(registry.getDeserializer(Matchers.<MessageCodeKey>any())).thenReturn(vendorDeserializer);
OF10StatsReplyMessageFactory factory = new OF10StatsReplyMessageFactory();
factory.injectDeserializerRegistry(registry);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
- Mockito.verify(registry, Mockito.times(1)).getDeserializer(Matchers.any(MessageCodeKey.class));
+
+ Mockito.verify(vendorDeserializer).deserialize(bb);
}
}
\ No newline at end of file
package org.opendaylight.openflowjava.util;
import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdTypeDeserializerKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
/**
* @param version openflow wire version
* @param experimenterId experimenter / vendor ID
+ * @param type experimenter type according to vendor implementation
* @return key instance
*/
- public static ExperimenterIdDeserializerKey createExperimenterMessageDeserializerKey(
- short version, Long experimenterId) {
- return new ExperimenterIdDeserializerKey(version, experimenterId, ExperimenterMessage.class);
+ public static ExperimenterIdTypeDeserializerKey createExperimenterMessageDeserializerKey(
+ short version, long experimenterId, long type) {
+ return new ExperimenterIdTypeDeserializerKey(version, experimenterId, type, ExperimenterDataOfChoice.class);
+ }
+
+ /**
+ * @param version openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdDeserializerKey createVendorMessageDeserializerKey(
+ short version, long experimenterId) {
+ return new ExperimenterIdDeserializerKey(version, experimenterId, ExperimenterDataOfChoice.class);
}
/**
* @param version openflow wire version
* @param experimenterId experimenter / vendor ID
+ * @param type
* @return key instance
*/
- public static ExperimenterIdDeserializerKey createMultipartReplyMessageDeserializerKey(
- short version, Long experimenterId) {
- return new ExperimenterIdDeserializerKey(version, experimenterId, MultipartReplyExperimenterCase.class);
+ public static ExperimenterIdTypeDeserializerKey createMultipartReplyMessageDeserializerKey(
+ short version, long experimenterId, long type) {
+ return new ExperimenterIdTypeDeserializerKey(version, experimenterId, type, ExperimenterDataOfChoice.class);
+ }
+
+ /**
+ * @param version openflow wire version
+ * @param experimenterId experimenter / vendor ID
+ * @return key instance
+ */
+ public static ExperimenterIdDeserializerKey createMultipartReplyVendorMessageDeserializerKey(
+ short version, long experimenterId) {
+ return new ExperimenterIdDeserializerKey(version, experimenterId, ExperimenterDataOfChoice.class);
}
/**
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdTypeDeserializerKey;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
/**
* @author michal.polkorab
- *
*/
public class ExperimenterDeserializerKeyFactoryTest {
- /**
- * Test ExperimenterDeserializerKeyFactory key creation
- */
@Test
- public void test() {
- ExperimenterIdDeserializerKey createdKey = ExperimenterDeserializerKeyFactory
+ public void testCreateExperimenterErrorDeserializerKey() throws Exception {
+ ExperimenterIdDeserializerKey createdKey;
+ ExperimenterIdDeserializerKey comparationKey;
+
+ createdKey = ExperimenterDeserializerKeyFactory
.createExperimenterErrorDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
- ExperimenterIdDeserializerKey comparationKey =
- new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);
- createdKey = ExperimenterDeserializerKeyFactory.createExperimenterErrorDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, null);
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- null, ErrorMessage.class);
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);
- createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, 43L);
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- 43L, ExperimenterMessage.class);
+ comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ErrorMessage.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ }
+
+ @Test
+ public void testCreateExperimenterMessageDeserializerKey() throws Exception {
+ ExperimenterIdDeserializerKey createdKey;
+ ExperimenterIdDeserializerKey comparationKey;
+
createdKey = ExperimenterDeserializerKeyFactory.createExperimenterMessageDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, null);
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- null, ExperimenterMessage.class);
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);
- createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, 44L);
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- 44L, MeterBandExperimenterCase.class);
- Assert.assertEquals("Wrong key created", comparationKey, createdKey);
- createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, null);
- comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- null, MeterBandExperimenterCase.class);
+ EncodeConstants.OF10_VERSION_ID, 43L, 1L);
+ comparationKey = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ 43L, 1L, ExperimenterDataOfChoice.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
+ }
+
+ @Test
+ public void testCreateMultipartReplyMessageDeserializerKey() throws Exception {
+ ExperimenterIdDeserializerKey createdKey;
+ ExperimenterIdDeserializerKey comparationKey;
+
createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, 45L);
+ EncodeConstants.OF10_VERSION_ID, 45L, 1L);
comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- 45L, MultipartReplyExperimenterCase.class);
+ 45L, ExperimenterDataOfChoice.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
- createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, null);
+ }
+
+ @Test
+ public void testCreateMultipartReplyTFDeserializerKey() throws Exception {
+ ExperimenterIdDeserializerKey createdKey;
+ ExperimenterIdDeserializerKey comparationKey;
+
+ createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, 46L);
comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- null, MultipartReplyExperimenterCase.class);
+ 46L, TableFeatureProperties.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
- createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, null);
+ }
+
+ @Test
+ public void testCreateQueuePropertyDeserializerKey() throws Exception {
+ ExperimenterIdDeserializerKey createdKey;
+ ExperimenterIdDeserializerKey comparationKey;
+
+ createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, 47L);
comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- null, TableFeatureProperties.class);
+ 47L, QueueProperty.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
- createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, null);
+ }
+
+ @Test
+ public void testCreateMeterBandDeserializerKey() throws Exception {
+ ExperimenterIdDeserializerKey createdKey;
+ ExperimenterIdDeserializerKey comparationKey;
+
+ createdKey = ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, 44L);
comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- null, TableFeatureProperties.class);
+ 44L, MeterBandExperimenterCase.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
- createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, null);
+ }
+
+ @Test
+ public void testCreateVendorMessageDeserializerKey() throws Exception {
+ ExperimenterIdDeserializerKey createdKey;
+ ExperimenterIdDeserializerKey comparationKey;
+
+ createdKey = ExperimenterDeserializerKeyFactory.createVendorMessageDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, 43L);
comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- null, QueueProperty.class);
+ 43L, ExperimenterDataOfChoice.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
- createdKey = ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(
- EncodeConstants.OF10_VERSION_ID, null);
+ }
+
+ @Test
+ public void testCreateMultipartReplyVendorMessageDeserializerKey() throws Exception {
+ ExperimenterIdDeserializerKey createdKey;
+ ExperimenterIdDeserializerKey comparationKey;
+
+ createdKey = ExperimenterDeserializerKeyFactory.createMultipartReplyVendorMessageDeserializerKey(
+ EncodeConstants.OF10_VERSION_ID, 43L);
comparationKey = new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID,
- null, QueueProperty.class);
+ 43L, ExperimenterDataOfChoice.class);
Assert.assertEquals("Wrong key created", comparationKey, createdKey);
}
}
\ No newline at end of file