private final DeserializerRegistry registry;
private final DeserializationFactory factory;
- public DeserializerExtensionProviderImpl(final DeserializerRegistry registry, DeserializationFactory factory) {
+ DeserializerExtensionProviderImpl(final DeserializerRegistry registry, DeserializationFactory factory) {
this.registry = registry;
this.factory = factory;
}
}
@Override
- public void registerActionDeserializer(ExperimenterActionDeserializerKey key, OFGeneralDeserializer deserializer) {
+ public void registerActionDeserializer(ExperimenterActionDeserializerKey key,
+ OFGeneralDeserializer deserializer) {
}
@Override
- public void registerInstructionDeserializer(ExperimenterInstructionDeserializerKey key, OFGeneralDeserializer deserializer) {
+ public void registerInstructionDeserializer(ExperimenterInstructionDeserializerKey key,
+ OFGeneralDeserializer deserializer) {
}
@Override
- public void registerMatchEntryDeserializer(MatchEntryDeserializerKey key, OFGeneralDeserializer deserializer) {
+ public void registerMatchEntryDeserializer(MatchEntryDeserializerKey key,
+ OFGeneralDeserializer deserializer) {
}
@Override
- public void registerErrorDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<ErrorMessage> deserializer) {
+ public void registerErrorDeserializer(ExperimenterIdDeserializerKey key,
+ OFDeserializer<ErrorMessage> deserializer) {
}
@Override
- public void registerExperimenterMessageDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<? extends ExperimenterDataOfChoice> deserializer) {
+ public void registerExperimenterMessageDeserializer(ExperimenterIdDeserializerKey key,
+ OFDeserializer<? extends ExperimenterDataOfChoice> deserializer) {
}
@Override
- public void registerMultipartReplyMessageDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<? extends ExperimenterDataOfChoice> deserializer) {
+ public void registerMultipartReplyMessageDeserializer(ExperimenterIdDeserializerKey key,
+ OFDeserializer<? extends ExperimenterDataOfChoice> deserializer) {
}
@Override
- public void registerMultipartReplyTFDeserializer(ExperimenterIdDeserializerKey key, OFGeneralDeserializer deserializer) {
+ public void registerMultipartReplyTFDeserializer(ExperimenterIdDeserializerKey key,
+ OFGeneralDeserializer deserializer) {
}
@Override
- public void registerMeterBandDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<MeterBandExperimenterCase> deserializer) {
+ public void registerMeterBandDeserializer(ExperimenterIdDeserializerKey key,
+ OFDeserializer<MeterBandExperimenterCase> deserializer) {
}
@Override
- public void registerQueuePropertyDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<QueueProperty> deserializer) {
+ public void registerQueuePropertyDeserializer(ExperimenterIdDeserializerKey key,
+ OFDeserializer<QueueProperty> deserializer) {
}
@Override
- public void registerDeserializerMapping(TypeToClassKey typeToClassKey, Class<?> aClass) {
- factory.registerMapping(typeToClassKey, aClass);
+ public void registerDeserializerMapping(TypeToClassKey typeToClassKey, Class<?> clazz) {
+ factory.registerMapping(typeToClassKey, clazz);
}
@Override
@Mock
private OFDeserializer<OfHeader> ofDeserializer;
- private Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>> injector;
+ private Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>>
+ injector;
@Before
public void setUp() throws Exception {
- injector = MessageDeserializerInjector.createInjector(switchConnectionProvider, EncodeConstants.OF13_VERSION_ID);
+ injector = MessageDeserializerInjector.createInjector(switchConnectionProvider, EncodeConstants
+ .OF13_VERSION_ID);
}
@Test
public void injectDeserializers() throws Exception {
injector.apply(10).apply(OfHeader.class).accept(ofDeserializer);
- verify(switchConnectionProvider).unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 10));
- verify(switchConnectionProvider).registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 10), OfHeader.class);
- verify(switchConnectionProvider).registerDeserializer(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 10, OfHeader.class), ofDeserializer);
+ verify(switchConnectionProvider).unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants
+ .OF13_VERSION_ID, 10));
+ verify(switchConnectionProvider).registerDeserializerMapping(new TypeToClassKey(EncodeConstants
+ .OF13_VERSION_ID, 10), OfHeader.class);
+ verify(switchConnectionProvider).registerDeserializer(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 10,
+ OfHeader.class), ofDeserializer);
}
}
\ No newline at end of file
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
import io.netty.buffer.ByteBuf;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MessageCodeExperimenterKey;
}
protected abstract short getType();
+
protected abstract short getLength();
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class CopyTtlInActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class CopyTtlOutActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class DecMplsTtlActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class DecNwTtlActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class GroupActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputAction;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class OutputActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
final OutputAction outputAction = OutputActionCase.class.cast(action).getOutputAction();
assertEquals(portNum, InventoryDataServiceUtil.portNumberfromNodeConnectorId(
- OpenflowVersion.OF13, outputAction.getOutputNodeConnector().getValue()).intValue());
+ OpenflowVersion.OF13, outputAction.getOutputNodeConnector().getValue()).intValue());
assertEquals(maxLength, outputAction.getMaxLength().shortValue());
assertEquals(0, in.readableBytes());
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsAction;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class PopMplsActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class PopPbbActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class PopVlanActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class PushMplsActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class PushPbbActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class PushVlanActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.BinContent;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class SetFieldActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
final Action action = deserializeAction(in);
assertTrue(SetFieldCase.class.isInstance(action));
assertEquals(
- OpenflowPortsUtil.getPortLogicalName(EncodeConstants.OF13_VERSION_ID, BinContent.intToUnsignedLong(portNum)),
+ OpenflowPortsUtil
+ .getPortLogicalName(EncodeConstants.OF13_VERSION_ID, BinContent.intToUnsignedLong(portNum)),
SetFieldCase.class.cast(action).getSetField().getInPort().getValue());
assertEquals(0, in.readableBytes());
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class SetMplsTtlActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class SetNwTtlActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class SetQueueActionDeserializerTest extends AbstractActionDeserializerTest {
@Test
package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
import io.netty.buffer.ByteBuf;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MessageCodeExperimenterKey;
}
protected abstract short getType();
+
protected abstract short getLength();
}
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class ApplyActionsInstructionDeserializerTest extends AbstractInstructionDeserializerTest {
private OFDeserializer<Instruction> deserializer;
@Override
+ @SuppressWarnings("checkstyle:LineLength")
protected void init() {
deserializer = getRegistry().getDeserializer(
new MessageCodeActionExperimenterKey(EncodeConstants.OF13_VERSION_ID, getType(), Instruction.class,
- ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
- null));
+ ActionPath
+ .NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
+ null));
}
@Test
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class ClearActionsInstructionDeserializerTest extends AbstractInstructionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class GoToTableInstructionDeserializerTest extends AbstractInstructionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class MeterInstructionDeserializerTest extends AbstractInstructionDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class WriteActionsInstructionDeserializerTest extends AbstractInstructionDeserializerTest {
private OFDeserializer<Instruction> deserializer;
@Override
+ @SuppressWarnings("checkstyle:LineLength")
protected void init() {
deserializer = getRegistry().getDeserializer(
new MessageCodeActionExperimenterKey(EncodeConstants.OF13_VERSION_ID, getType(), Instruction.class,
- ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
- null));
+ ActionPath
+ .NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
+ null));
}
@Test
package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import java.math.BigInteger;
-
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class WriteMetadataInstructionDeserializerTest extends AbstractInstructionDeserializerTest {
@Test
assertEquals(WriteMetadataCase.class, instruction.getImplementedInterface());
assertArrayEquals(
- ByteUtil
- .convertBigIntegerToNBytes(metadata, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
- ByteUtil
- .convertBigIntegerToNBytes(WriteMetadataCase.class.cast(instruction).getWriteMetadata().getMetadata(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ ByteUtil
+ .convertBigIntegerToNBytes(metadata, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil
+ .convertBigIntegerToNBytes(WriteMetadataCase.class.cast(instruction).getWriteMetadata()
+ .getMetadata(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
assertArrayEquals(
- ByteUtil
- .convertBigIntegerToNBytes(metadataMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
- ByteUtil
- .convertBigIntegerToNBytes(WriteMetadataCase.class.cast(instruction).getWriteMetadata().getMetadataMask(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ ByteUtil
+ .convertBigIntegerToNBytes(metadataMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil
+ .convertBigIntegerToNBytes(WriteMetadataCase.class.cast(instruction).getWriteMetadata()
+ .getMetadataMask(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
assertEquals(0, in.readableBytes());
}
}
protected abstract int getOxmClassCode();
+
protected abstract int getOxmFieldCode();
+
protected abstract int getValueLength();
}
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpSourceHardwareAddress));
assertEquals(arpSourceHardwareAddress.getValue(),
- ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpSourceHardwareAddress().getAddress().getValue());
+ ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpSourceHardwareAddress().getAddress()
+ .getValue());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpTargetHardwareAddress));
assertEquals(arpTargetHardwareAddress.getValue(),
- ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpTargetHardwareAddress().getAddress().getValue());
+ ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpTargetHardwareAddress().getAddress()
+ .getValue());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
writeHeader(in, false);
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(ethernetDestinationAddress));
- assertEquals(ethernetDestinationAddress.getValue(), deserialize(in).getEthernetMatch().getEthernetDestination().getAddress().getValue());
+ assertEquals(ethernetDestinationAddress.getValue(), deserialize(in).getEthernetMatch().getEthernetDestination()
+ .getAddress().getValue());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
writeHeader(in, false);
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(ethernetSourceAddress));
- assertEquals(ethernetSourceAddress.getValue(), deserialize(in).getEthernetMatch().getEthernetSource().getAddress().getValue());
+ assertEquals(ethernetSourceAddress.getValue(),
+ deserialize(in).getEthernetMatch().getEthernetSource().getAddress().getValue());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
import static org.junit.Assert.assertEquals;
-import java.util.Iterator;
-
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
+import java.util.Iterator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import static org.junit.Assert.assertEquals;
-import java.util.Iterator;
-
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
+import java.util.Iterator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class Ipv6NdTargetEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFields;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class MplsBosEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFields;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class MplsLabelEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFields;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class MplsTcEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
@Test
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFields;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class PbbEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
@Test
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, SctpMatch.class.cast(deserialize(in).getLayer4Match()).getSctpDestinationPort().getValue().intValue());
+ assertEquals(port, SctpMatch.class.cast(deserialize(in).getLayer4Match()).getSctpDestinationPort().getValue()
+ .intValue());
assertEquals(0, in.readableBytes());
}
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, SctpMatch.class.cast(deserialize(in).getLayer4Match()).getSctpSourcePort().getValue().intValue());
+ assertEquals(port, SctpMatch.class.cast(deserialize(in).getLayer4Match()).getSctpSourcePort().getValue()
+ .intValue());
assertEquals(0, in.readableBytes());
}
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, TcpMatch.class.cast(deserialize(in).getLayer4Match()).getTcpDestinationPort().getValue().intValue());
+ assertEquals(port, TcpMatch.class.cast(deserialize(in).getLayer4Match()).getTcpDestinationPort().getValue()
+ .intValue());
assertEquals(0, in.readableBytes());
}
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatch;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class TcpFlagsEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
@Test
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, TcpMatch.class.cast(deserialize(in).getLayer4Match()).getTcpSourcePort().getValue().intValue());
+ assertEquals(port, TcpMatch.class.cast(deserialize(in).getLayer4Match()).getTcpSourcePort().getValue()
+ .intValue());
assertEquals(0, in.readableBytes());
}
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import java.math.BigInteger;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class TunnelIdEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
@Test
Tunnel match = deserialize(in).getTunnel();
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
- ByteUtil.convertBigIntegerToNBytes(match.getTunnelId(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.convertBigIntegerToNBytes(match.getTunnelId(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
assertEquals(0, in.readableBytes());
match = deserialize(in).getTunnel();
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
- ByteUtil.convertBigIntegerToNBytes(match.getTunnelId(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.convertBigIntegerToNBytes(match.getTunnelId(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(tunnelIdMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
- ByteUtil.convertBigIntegerToNBytes(match.getTunnelMask(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ ByteUtil.convertBigIntegerToNBytes(tunnelIdMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.convertBigIntegerToNBytes(match.getTunnelMask(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
assertEquals(0, in.readableBytes());
}
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, UdpMatch.class.cast(deserialize(in).getLayer4Match()).getUdpDestinationPort().getValue().intValue());
+ assertEquals(port, UdpMatch.class.cast(deserialize(in).getLayer4Match()).getUdpDestinationPort().getValue()
+ .intValue());
assertEquals(0, in.readableBytes());
}
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, UdpMatch.class.cast(deserialize(in).getLayer4Match()).getUdpSourcePort().getValue().intValue());
+ assertEquals(port, UdpMatch.class.cast(deserialize(in).getLayer4Match()).getUdpSourcePort().getValue()
+ .intValue());
assertEquals(0, in.readableBytes());
}
public void deserializeEntry() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final int vlanVid = 8;
- final byte[] vlanMask = new byte[] { 16, 0 };
+ final byte[] vlanMask = new byte[]{16, 0};
writeHeader(in, false);
in.writeShort(vlanVid | (1 << 12));
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModCommand;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class FlowMessageDeserializerTest extends AbstractDeserializerTest {
private static final byte PADDING = 2;
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupModCommand;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class GroupMessageDeserializerTest extends AbstractDeserializerTest {
private static final byte PADDING = 1;
buffer.writeZero(PADDING_IN_PACKET_IN_HEADER);
buffer.writeBytes(PAYLOAD);
- final PacketInMessage message = (PacketInMessage) getFactory().deserialize(buffer, EncodeConstants.OF13_VERSION_ID);
+ final PacketInMessage message =
+ (PacketInMessage) getFactory().deserialize(buffer, EncodeConstants.OF13_VERSION_ID);
assertEquals(XID, message.getXid().intValue());
assertEquals(PacketInUtil.getMdSalPacketInReason(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
public class MultipartReplyFlowAggregateStatsDeserializerTest extends AbstractMultipartDeserializerTest {
- private static final long PACKET_COUNT = 6l;
- private static final long BYTE_COUNT = 256l;
+ private static final long PACKET_COUNT = 6L;
+ private static final long BYTE_COUNT = 256L;
private static final int FLOW_COUNT = 3;
private static final byte PADDING_IN_MULTIPART_REPLY_HEADER = 4;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
-public class MultipartReplyFlowStatsDeserializerTest extends AbstractMultipartDeserializerTest{
+public class MultipartReplyFlowStatsDeserializerTest extends AbstractMultipartDeserializerTest {
private static final byte PADDING_IN_FLOW_STATS_HEADER_01 = 1;
private static final byte PADDING_IN_FLOW_STATS_HEADER_02 = 4;
assertEquals(2, flowAndStatisticsMapList.getInstructions().getInstruction().size());
- final Instruction instruction = flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
+ final Instruction instruction =
+ flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
final ApplyActionsCase applyActions = ApplyActionsCase.class.cast(instruction);
assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
.getAction().getImplementedInterface());
- final Instruction instruction1 = flowAndStatisticsMapList.getInstructions().getInstruction().get(1).getInstruction();
+ final Instruction instruction1 =
+ flowAndStatisticsMapList.getInstructions().getInstruction().get(1).getInstruction();
assertEquals(WriteActionsCase.class, instruction1.getImplementedInterface());
final WriteActionsCase writeActions = WriteActionsCase.class.cast(instruction1);
public class MultipartReplyFlowTableStatsDeserializerTest extends AbstractMultipartDeserializerTest {
private static final byte TABLE_ID = 2;
- private static final long PACKETS_LOOKEDUP = 1l;
- private static final long PACKETS_MATCHED = 2l;
+ private static final long PACKETS_LOOKEDUP = 1L;
+ private static final long PACKETS_MATCHED = 2L;
private static final int ACTIVE_FLOWS = 3;
private static final byte PADDING_IN_TABLE_HEADER = 3;
final MultipartReplyFlowTableStats reply = (MultipartReplyFlowTableStats) deserializeMultipart(buffer);
assertEquals(TABLE_ID, reply.getFlowTableAndStatisticsMap().get(0).getTableId().getValue().byteValue());
assertEquals(ACTIVE_FLOWS, reply.getFlowTableAndStatisticsMap().get(0).getActiveFlows().getValue().intValue());
- assertEquals(PACKETS_LOOKEDUP, reply.getFlowTableAndStatisticsMap().get(0).getPacketsLookedUp().getValue().longValue());
- assertEquals(PACKETS_MATCHED, reply.getFlowTableAndStatisticsMap().get(0).getPacketsMatched().getValue().longValue());
+ assertEquals(PACKETS_LOOKEDUP, reply.getFlowTableAndStatisticsMap().get(0).getPacketsLookedUp().getValue()
+ .longValue());
+ assertEquals(PACKETS_MATCHED, reply.getFlowTableAndStatisticsMap().get(0).getPacketsMatched().getValue()
+ .longValue());
assertEquals(0, buffer.readableBytes());
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
-public class MultipartReplyGroupDescDeserializerTest extends AbstractMultipartDeserializerTest{
+public class MultipartReplyGroupDescDeserializerTest extends AbstractMultipartDeserializerTest {
private static final byte PADDING_IN_GROUP_DESC_HEADER = 1;
private static final byte PADDING_IN_BUCKETS_HEADER = 4;
private static final short ITEM_LENGTH = 32;
assertEquals(GROUP_ID, reply.getGroupDescStats().get(0).getGroupId().getValue().intValue());
assertEquals(WEIGHT, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWeight().intValue());
- assertEquals(WATCH_PORT, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWatchPort().intValue());
- assertEquals(WATCH_GROUP, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWatchGroup().intValue());
+ assertEquals(WATCH_PORT, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWatchPort()
+ .intValue());
+ assertEquals(WATCH_GROUP, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWatchGroup()
+ .intValue());
assertEquals(GROUP_TYPE, reply.getGroupDescStats().get(0).getGroupType().getIntValue());
assertEquals(0, buffer.readableBytes());
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
public class MultipartReplyGroupFeaturesDeserializerTest extends AbstractMultipartDeserializerTest {
- private static final List<Long> MAX_GROUPS_LIST = Arrays.asList(1l, 2l, 3l, 4l);
- private static final List<Long> ACTIONS_LIST = Arrays.asList(5l, 6l, 7l, 8l);
+ private static final List<Long> MAX_GROUPS_LIST = Arrays.asList(1L, 2L, 3L, 4L);
+ private static final List<Long> ACTIONS_LIST = Arrays.asList(5L, 6L, 7L, 8L);
private static final List<GroupTypes> GROUP_TYPES_SUPPORTED = Arrays.asList(
GroupTypes.GroupAll,
private static final int REF_COUNT = 4;
private static final int SECOND = 5;
private static final int NANOSECOND = 6;
- private static final long PACKET_COUNT = 1l;
- private static final long BYTE_COUNT = 2l;
+ private static final long PACKET_COUNT = 1L;
+ private static final long BYTE_COUNT = 2L;
@Test
public void testDeserialize() throws Exception {
assertEquals(1, flowAndStatisticsMapList.getInstructions().getInstruction().size());
- final Instruction instruction = flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
+ final Instruction instruction =
+ flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
final ApplyActionsCase applyActions = ApplyActionsCase.class.cast(instruction);
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
-public class MultipartReplyMeterFeaturesDeserializerTest extends AbstractMultipartDeserializerTest{
+public class MultipartReplyMeterFeaturesDeserializerTest extends AbstractMultipartDeserializerTest {
private static final int MAX_METER = 3;
private static final List BANDS_SUPPORTED = Arrays.asList(MeterBandDrop.class);
private static final List CAPABILITIES_SUPPORTED = Arrays.asList(MeterKbps.class, MeterBurst.class);
private static final int METER_ID = 1;
private static final short ITEM_LENGTH = 50;
private static final int FLOW_COUNT = 2;
- private static final long PACKET_IN_COUNT = 3l;
- private static final long BYTE_IN_COUNT = 4l;
+ private static final long PACKET_IN_COUNT = 3L;
+ private static final long BYTE_IN_COUNT = 4L;
private static final int SECOND = 5;
private static final int NANOSECOND = 6;
- private static final long PACKET_BAND_COUNT = 7l;
- private static final long BYTE_BAND_COUNT = 8l;
+ private static final long PACKET_BAND_COUNT = 7L;
+ private static final long BYTE_BAND_COUNT = 8L;
@Test
public void deserialize() throws Exception {
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.MultipartReplyPortDesc;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
-public class MultipartReplyPortDescDeserializerTest extends AbstractMultipartDeserializerTest{
+public class MultipartReplyPortDescDeserializerTest extends AbstractMultipartDeserializerTest {
private static final byte PADDING_IN_PORT_DESC_HEADER_01 = 4;
private static final byte PADDING_IN_PORT_DESC_HEADER_02 = 2;
public class MultipartReplyPortStatsDeserializerTest extends AbstractMultipartDeserializerTest {
private static final byte PADDING_IN_PORT_STATS_HEADER = 4;
private static final int PORT = 1;
- private static final long PACKETS_RECEIVED = 2l;
- private static final long PACKETS_TRANSMITTED = 3l;
- private static final long BYTES_RECEIVED = 4l;
- private static final long BYTES_TRANSMITTED = 5l;
- private static final long RECEIVE_DROPS = 6l;
- private static final long TRANSMIT_DROPS = 7l;
- private static final long RECEIVE_ERRORS = 8l;
- private static final long TRANSMIT_ERRORS = 9l;
- private static final long RECEIVE_FRAME_ERROR = 10l;
- private static final long RECEIVE_OVER_RUN_ERROR = 11l;
- private static final long RECEIVE_CRC_ERROR = 12l;
- private static final long COLLIESION_COUNT = 13l;
+ private static final long PACKETS_RECEIVED = 2L;
+ private static final long PACKETS_TRANSMITTED = 3L;
+ private static final long BYTES_RECEIVED = 4L;
+ private static final long BYTES_TRANSMITTED = 5L;
+ private static final long RECEIVE_DROPS = 6L;
+ private static final long TRANSMIT_DROPS = 7L;
+ private static final long RECEIVE_ERRORS = 8L;
+ private static final long TRANSMIT_ERRORS = 9L;
+ private static final long RECEIVE_FRAME_ERROR = 10L;
+ private static final long RECEIVE_OVER_RUN_ERROR = 11L;
+ private static final long RECEIVE_CRC_ERROR = 12L;
+ private static final long COLLIESION_COUNT = 13L;
private static final int SECOND = 14;
private static final int NANOSECOND = 15;
final MultipartReplyPortStats reply = (MultipartReplyPortStats) deserializeMultipart(buffer);
- final NodeConnectorStatisticsAndPortNumberMap portStats = reply.getNodeConnectorStatisticsAndPortNumberMap().get(0);
+ final NodeConnectorStatisticsAndPortNumberMap portStats =
+ reply.getNodeConnectorStatisticsAndPortNumberMap().get(0);
assertEquals(PACKETS_RECEIVED, portStats.getPackets().getReceived().longValue());
assertEquals(PACKETS_TRANSMITTED, portStats.getPackets().getTransmitted().longValue());
assertEquals(BYTES_RECEIVED, portStats.getBytes().getReceived().longValue());
public class MultipartReplyQueueStatsDeserializerTest extends AbstractMultipartDeserializerTest {
private static final int PORT = 1;
private static final int QUEUE_ID = 1;
- private static final long TRANSMITTED_BYTES = 5l;
- private static final long TRANSMITTED_PACKETS = 3l;
- private static final long TRANSMISSON_ERRORS = 9l;
+ private static final long TRANSMITTED_BYTES = 5L;
+ private static final long TRANSMITTED_PACKETS = 3L;
+ private static final long TRANSMISSON_ERRORS = 9L;
private static final int SECOND = 14;
private static final int NANOSECOND = 15;
private static final byte TABLE_ID = 1;
private static final long METADATA_MATCH = 2;
private static final long METADATA_WRITE = 3;
- private static final int TABLE_CONFIG= 3;
- private static final int MAX_ENTRIES= 3;
+ private static final int TABLE_CONFIG = 3;
+ private static final int MAX_ENTRIES = 3;
private static final int OFPTFPT_INSTRUCTIONS = 0;
private static final int OFPTFPT_INSTRUCTIONS_MISS = 1;
}
private void writeValues(ByteBuf buffer, int propertyType) {
- TableFeaturesPropType propType = TableFeaturesPropType.forValue(propertyType);
-
buffer.clear();
- int replyIndex = buffer.readerIndex();
+ final int replyIndex = buffer.readerIndex();
buffer.writeShort(EncodeConstants.EMPTY_LENGTH);
buffer.writeByte(TABLE_ID);
buffer.writeZero(PADDING_IN_MULTIPART_REPLY_TABLE_FEATURES);
buffer.writeInt(TABLE_CONFIG);
buffer.writeInt(MAX_ENTRIES);
- int propIndex = buffer.writerIndex();
+ final int propIndex = buffer.writerIndex();
buffer.writeShort(propertyType);
- int propLengthIndex = buffer.writerIndex();
+ final int propLengthIndex = buffer.writerIndex();
buffer.writeShort(EncodeConstants.EMPTY_LENGTH);
+ TableFeaturesPropType propType = TableFeaturesPropType.forValue(propertyType);
+
switch (propType) {
case OFPTFPTINSTRUCTIONS:
case OFPTFPTINSTRUCTIONSMISS:
@Override
public <K> void registerSerializer(MessageTypeKey<K> messageTypeKey, OFGeneralSerializer ofGeneralSerializer) {
- registry.registerSerializer(messageTypeKey, ofGeneralSerializer);
+ registry.registerSerializer(messageTypeKey, ofGeneralSerializer);
}
@Override
@Override
public void registerActionSerializer(ActionSerializerKey<?> key, OFGeneralSerializer serializer) {
-
}
@Override
public void registerInstructionSerializer(InstructionSerializerKey<?> key, OFGeneralSerializer serializer) {
-
}
@Override
- public <C extends OxmClassBase, F extends MatchField> void registerMatchEntrySerializer(MatchEntrySerializerKey<C, F> key, OFGeneralSerializer serializer) {
-
+ public <C extends OxmClassBase, F extends MatchField> void registerMatchEntrySerializer(
+ MatchEntrySerializerKey<C, F> key, OFGeneralSerializer serializer) {
}
@Override
- public void registerExperimenterMessageSerializer(ExperimenterIdSerializerKey<? extends ExperimenterDataOfChoice> key, OFSerializer<? extends ExperimenterDataOfChoice> serializer) {
-
+ public void registerExperimenterMessageSerializer(ExperimenterIdSerializerKey<? extends
+ ExperimenterDataOfChoice> key, OFSerializer<? extends ExperimenterDataOfChoice> serializer) {
}
@Override
- public void registerMultipartRequestSerializer(ExperimenterIdSerializerKey<? extends ExperimenterDataOfChoice> key, OFSerializer<? extends ExperimenterDataOfChoice> serializer) {
-
+ public void registerMultipartRequestSerializer(ExperimenterIdSerializerKey<? extends
+ ExperimenterDataOfChoice> key, OFSerializer<? extends ExperimenterDataOfChoice> serializer) {
}
@Override
- public void registerMultipartRequestTFSerializer(ExperimenterIdSerializerKey<TableFeatureProperties> key, OFGeneralSerializer serializer) {
-
+ public void registerMultipartRequestTFSerializer(ExperimenterIdSerializerKey<TableFeatureProperties> key,
+ OFGeneralSerializer serializer) {
}
@Override
- public void registerMeterBandSerializer(ExperimenterIdSerializerKey<MeterBandExperimenterCase> key, OFSerializer<MeterBandExperimenterCase> serializer) {
+ public void registerMeterBandSerializer(ExperimenterIdSerializerKey<MeterBandExperimenterCase> key,
+ OFSerializer<MeterBandExperimenterCase> serializer) {
}
@Override
- public void registerMeterBandSerializer(ExperimenterIdMeterSubTypeSerializerKey<MeterBandExperimenterCase> key, OFSerializer<MeterBandExperimenterCase> serializer) {
-
+ public void registerMeterBandSerializer(ExperimenterIdMeterSubTypeSerializerKey<MeterBandExperimenterCase>
+ key, OFSerializer<MeterBandExperimenterCase> serializer) {
}
}
-
}
\ No newline at end of file
@Before
public void setUp() throws Exception {
- injector = InstructionSerializerInjector.createInjector(switchConnectionProvider, EncodeConstants.OF13_VERSION_ID);
+ injector =
+ InstructionSerializerInjector.createInjector(switchConnectionProvider, EncodeConstants.OF13_VERSION_ID);
}
@Test
@Test
public void injectSerializers() throws Exception {
injector.apply(OfHeader.class).accept(ofSerializer);
- verify(switchConnectionProvider).registerSerializer(new MessageTypeKey<>(OFConstants.OFP_VERSION_1_3, OfHeader.class), ofSerializer);
+ verify(switchConnectionProvider)
+ .registerSerializer(new MessageTypeKey<>(OFConstants.OFP_VERSION_1_3, OfHeader.class), ofSerializer);
}
}
\ No newline at end of file
}
protected abstract Class<? extends Action> getClazz();
+
protected abstract int getType();
+
protected abstract int getLength();
}
\ No newline at end of file
}
protected abstract Class<? extends Instruction> getClazz();
+
protected abstract int getType();
+
protected abstract int getLength();
}
\ No newline at end of file
public abstract class AbstractExperimenterMatchEntrySerializerTest extends AbstractMatchEntrySerializerTest {
- protected void assertMatch(final Match match, final boolean hasMask, final Consumer<ByteBuf> assertBody) throws Exception {
+ protected void assertMatch(final Match match,
+ final boolean hasMask,
+ final Consumer<ByteBuf> assertBody) throws Exception {
final ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();
getSerializer().serialize(match, buffer);
serializer = getRegistry().getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class));
}
- protected void assertMatch(final Match match, final boolean hasMask, final Consumer<ByteBuf> assertBody) throws Exception {
+ protected void assertMatch(final Match match,
+ final boolean hasMask,
+ final Consumer<ByteBuf> assertBody) throws Exception {
final ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(match, buffer);
}
protected abstract int getOxmFieldCode();
+
protected abstract int getOxmClassCode();
+
protected abstract short getLength();
}
\ No newline at end of file
assertMatch(ipv6abmMatch, true, (out) -> {
byte[] address = new byte[16];
out.readBytes(address);
- assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
+ assertArrayEquals(address,
+ IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
byte[] mask = new byte[16];
out.readBytes(mask);
- assertArrayEquals(mask, IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(ipv6Address)));
+ assertArrayEquals(mask,
+ IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(ipv6Address)));
});
}
assertMatch(ipv6abmMatch, false, (out) -> {
byte[] address = new byte[16];
out.readBytes(address);
- assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
+ assertArrayEquals(address,
+ IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
});
}
assertMatch(ipv6NdSllMatch, false, (out) -> {
byte[] addressBytes = new byte[6];
out.readBytes(addressBytes);
- assertEquals(new MacAddress(ByteBufUtils.macAddressToString(addressBytes)).getValue(), ipv6NdSll.getValue());
+ assertEquals(new MacAddress(ByteBufUtils.macAddressToString(addressBytes)).getValue(),
+ ipv6NdSll.getValue());
});
}
assertMatch(ipv6NdTllMatch, false, (out) -> {
byte[] addressBytes = new byte[6];
out.readBytes(addressBytes);
- assertEquals(new MacAddress(ByteBufUtils.macAddressToString(addressBytes)).getValue(), ipv6NdTll.getValue());
+ assertEquals(new MacAddress(ByteBufUtils.macAddressToString(addressBytes)).getValue(),
+ ipv6NdTll.getValue());
});
}
assertMatch(ipv6abmMatch, true, (out) -> {
byte[] address = new byte[16];
out.readBytes(address);
- assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
+ assertArrayEquals(address,
+ IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
byte[] mask = new byte[16];
out.readBytes(mask);
- assertArrayEquals(mask, IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(ipv6Address)));
+ assertArrayEquals(mask,
+ IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(ipv6Address)));
});
}
assertMatch(ipv6abmMatch, false, (out) -> {
byte[] address = new byte[16];
out.readBytes(address);
- assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
+ assertArrayEquals(address,
+ IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
});
}
assertMatch(vlanMatchMaskOnly, true, out -> {
assertEquals(out.readShort(), (1 << 12));
- byte mask[] = new byte[2];
+ byte[] mask = new byte[2];
out.readBytes(mask);
assertArrayEquals(mask, new byte[] { 16, 0 });
});
@Override
protected void init() {
- serializer = getRegistry().getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, FlowMessage.class));
+ serializer = getRegistry()
+ .getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, FlowMessage.class));
}
@Test
// Set vlan id action
int setVlanIdLength = 16;
- int setVlanStartIndex = out.readerIndex();
+ final int setVlanStartIndex = out.readerIndex();
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
assertEquals(out.readUnsignedShort(), setVlanIdLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
// Set tp src action
int setTpSrcLength = 16;
- int setTpSrcStartIndex = out.readerIndex();
+ final int setTpSrcStartIndex = out.readerIndex();
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
assertEquals(out.readUnsignedShort(), setTpSrcLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
// Set tp dst action
int setTpDstLength = 16;
- int setTpDstStartIndex = out.readerIndex();
+ final int setTpDstStartIndex = out.readerIndex();
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
assertEquals(out.readUnsignedShort(), setTpDstLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
// Set vlan id action
int setVlanIdLength = 16;
- int setVlanStartIndex = out.readerIndex();
+ final int setVlanStartIndex = out.readerIndex();
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
assertEquals(out.readUnsignedShort(), setVlanIdLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
// Set tp src action
int setTpSrcLength = 16;
- int setTpSrcStartIndex = out.readerIndex();
+ final int setTpSrcStartIndex = out.readerIndex();
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
assertEquals(out.readUnsignedShort(), setTpSrcLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
// Set tp dst action
int setTpDstLength = 16;
- int setTpDstStartIndex = out.readerIndex();
+ final int setTpDstStartIndex = out.readerIndex();
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
assertEquals(out.readUnsignedShort(), setTpDstLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
@Override
protected void init() {
- serializer = getRegistry().getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, GroupMessage.class));
+ serializer = getRegistry()
+ .getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, GroupMessage.class));
}
@Test
.setMeterBandHeader(Arrays.asList(
new MeterBandHeaderBuilder()
.setMeterBandTypes(new MeterBandTypesBuilder()
- .setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918
- .MeterBandType(true, false, false))
+ .setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .meter.types.rev130918.MeterBandType(true, false, false))
.build())
.setBandBurstSize(BAND_BURST_SIZE)
.setBandId(new BandId(BAND_ID))
.build(),
new MeterBandHeaderBuilder()
.setMeterBandTypes(new MeterBandTypesBuilder()
- .setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918
- .MeterBandType(false, true, false))
+ .setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .meter.types.rev130918.MeterBandType(false, true, false))
.build())
.setBandBurstSize(BAND_BURST_SIZE)
.setBandId(new BandId(BAND_ID))
@Override
protected void init() {
- serializer = getRegistry().getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MeterMessage.class)) ;
+ serializer = getRegistry()
+ .getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MeterMessage.class)) ;
}
@Test
@Override
protected void init() {
- serializer = getRegistry().getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, PortMessage.class));
+ serializer = getRegistry()
+ .getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, PortMessage.class));
}
@Test
@Override
protected void init() {
- serializer = getRegistry().getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequest.class)) ;
+ serializer = getRegistry()
+ .getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequest.class));
}
@Test
}
protected abstract Class<? extends TableFeaturePropType> getClazz();
+
protected abstract int getType();
}
@Test
public void testSerialize() throws Exception {
final ApplyActionsMiss property = new ApplyActionsMissBuilder()
- .setApplyActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature
- .prop.type.table.feature.prop.type.apply.actions.miss
+ .setApplyActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss
.ApplyActionsMissBuilder()
.setAction(Collections.singletonList(new ActionBuilder()
.setOrder(0)
@Test
public void testSerialize() throws Exception {
final ApplySetfieldMiss property = new ApplySetfieldMissBuilder()
- .setApplySetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature
- .prop.type.table.feature.prop.type.apply.setfield.miss
+ .setApplySetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss
.ApplySetfieldMissBuilder()
.setSetFieldMatch(ImmutableList
.<SetFieldMatch>builder()
@Test
public void testSerialize() throws Exception {
final InstructionsMiss property = new InstructionsMissBuilder()
- .setInstructionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature
- .prop.type.table.feature.prop.type.instructions.miss
+ .setInstructionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss
.InstructionsMissBuilder()
.setInstruction(Collections.singletonList(new InstructionBuilder()
.setOrder(0)
@Test
public void testSerialize() throws Exception {
final WriteActionsMiss property = new WriteActionsMissBuilder()
- .setWriteActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature
- .prop.type.table.feature.prop.type.write.actions.miss
+ .setWriteActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss
.WriteActionsMissBuilder()
.setAction(Collections.singletonList(new ActionBuilder()
.setOrder(0)
@Test
public void testSerialize() throws Exception {
final WriteSetfieldMiss property = new WriteSetfieldMissBuilder()
- .setWriteSetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature
- .prop.type.table.feature.prop.type.write.setfield.miss
+ .setWriteSetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight
+ .table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss
.WriteSetfieldMissBuilder()
.setSetFieldMatch(ImmutableList
.<SetFieldMatch>builder()