InstructionsInitializer.registerInstructionSerializers(this);
}
- public void setGroupAddModConfig(boolean isGroupAddModEnabled) {
- this.isGroupAddModEnabled = isGroupAddModEnabled;
+ public void setGroupAddModConfig(boolean value) {
+ this.isGroupAddModEnabled = value;
}
@Override
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for BarrierInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class BarrierInputMessageFactoryTest {
private OFSerializer<BarrierInput> barrierFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link BarrierInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link BarrierInputMessageFactory} for correct translation from POJO.
*/
@Test
public void test() throws Exception {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for BarrierReplyMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class BarrierReplyMessageFactoryTest {
private static final byte MESSAGE_TYPE = 21;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for EchoInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class EchoInputMessageFactoryTest {
private OFSerializer<EchoInput> echoFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link EchoInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link EchoInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV13() throws Exception {
}
/**
- * Testing of {@link EchoInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link EchoInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV10() throws Exception {
}
/**
- * Testing of {@link EchoInputMessageFactory} for correct data serialization
- * @throws Exception
+ * Testing of {@link EchoInputMessageFactory} for correct data serialization.
*/
@Test
- public void testData() throws Exception{
+ public void testData() throws Exception {
byte[] dataToTest = new byte[]{91,92,93,94,95,96,97,98};
EchoInputBuilder eib = new EchoInputBuilder();
BufferHelper.setupHeader(eib, EncodeConstants.OF13_VERSION_ID);
EchoInput ei = eib.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
echoFactory.serialize(ei, out);
- BufferHelper.checkHeaderV13(out, ECHO_REQUEST_MESSAGE_CODE_TYPE, 8+dataToTest.length);
+ BufferHelper.checkHeaderV13(out, ECHO_REQUEST_MESSAGE_CODE_TYPE, 8 + dataToTest.length);
byte[] outData = new byte[dataToTest.length];
out.readBytes(outData);
Assert.assertArrayEquals("Wrong - different output data.", dataToTest, outData);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutputBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for EchoOutputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class EchoOutputMessageFactoryTest {
private static final byte MESSAGE_TYPE = 3;
package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
-import org.junit.Assert;
-
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for EchoReplyInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class EchoReplyInputMessageFactoryTest {
private OFSerializer<EchoReplyInput> echoFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link EchoReplyInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link EchoReplyInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV13() throws Exception {
}
/**
- * Testing of {@link EchoReplyInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link EchoReplyInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV10() throws Exception {
}
/**
- * Testing of {@link EchoReplyInputMessageFactory} for correct message serialization
- * @throws Exception
+ * Testing of {@link EchoReplyInputMessageFactory} for correct message serialization.
*/
@Test
public void testDataSerialize()throws Exception {
EchoReplyInput eri = erib.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
echoFactory.serialize(eri, out);
- BufferHelper.checkHeaderV13(out, ECHO_REPLY_MESSAGE_CODE_TYPE, 8+dataToTest.length);
+ BufferHelper.checkHeaderV13(out, ECHO_REPLY_MESSAGE_CODE_TYPE, 8 + dataToTest.length);
byte[] outData = new byte[dataToTest.length];
out.readBytes(outData);
Assert.assertArrayEquals("Wrong - different output data.",dataToTest, outData);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessageBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for EchoRequestMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class EchoRequestMessageFactoryTest {
private static final byte MESSAGE_TYPE = 2;
- EchoRequestMessage message;
private OFSerializer<EchoRequestMessage> factory;
@Before
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for ErrorMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class ErrorMessageFactoryTest {
private static final byte MESSAGE_TYPE = 1;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
/**
- * @author michal.polkorab
+ * Unit tests for ExperimenterInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class ExperimenterInputMessageFactoryTest {
private ByteBuf out;
/**
- * Sets up ExperimenterInputMessageFactory
+ * Sets up ExperimenterInputMessageFactory.
* @param real true if setup should use real registry, false when mock is desired
*/
public void startUp(boolean real) {
/**
* Testing of {@link ExperimenterInputMessageFactory} for correct serializer
- * lookup and serialization
- * @throws Exception
+ * lookup and serialization.
*/
- @Test(expected=IllegalStateException.class)
+ @Test(expected = IllegalStateException.class)
public void testV10Real() throws Exception {
startUp(true);
ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
/**
* Testing of {@link ExperimenterInputMessageFactory} for correct serializer
- * lookup and serialization
- * @throws Exception
+ * lookup and serialization.
*/
- @Test(expected=IllegalStateException.class)
+ @Test(expected = IllegalStateException.class)
public void testV13Real() throws Exception {
startUp(true);
ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
/**
* Testing of {@link ExperimenterInputMessageFactory} for correct serializer
- * lookup and serialization
- * @throws Exception
+ * lookup and serialization.
*/
@Test
public void testV10() throws Exception {
/**
* Testing of {@link ExperimenterInputMessageFactory} for correct serializer
- * lookup and serialization
- * @throws Exception
+ * lookup and serialization.
*/
@Test
public void testV13() throws Exception {
expFactory.serialize(input, out);
Mockito.verify(serializer, Mockito.times(1)).serialize(input.getExperimenterDataOfChoice(), out);
}
-}
\ No newline at end of file
+}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
/**
+ * Unit tests for FlowModInputMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFSerializer<FlowModInput> flowModFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * @throws Exception
- * Testing of {@link FlowModInputMessageFactory} for correct translation from POJO
+ * Testing of {@link FlowModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testFlowModInputMessageFactory() throws Exception {
builder.setFlags(new FlowModFlags(true, false, true, false, true));
MatchBuilder matchBuilder = new MatchBuilder();
matchBuilder.setType(OxmMatchType.class);
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(InPhyPort.class);
entries.add(entriesBuilder.build());
matchBuilder.setMatchEntry(entries);
builder.setMatch(matchBuilder.build());
- List<Instruction> instructions = new ArrayList<>();
+ final List<Instruction> instructions = new ArrayList<>();
InstructionBuilder insBuilder = new InstructionBuilder();
GotoTableCaseBuilder goToCaseBuilder = new GotoTableCaseBuilder();
GotoTableBuilder instructionBuilder = new GotoTableBuilder();
insBuilder.setInstructionChoice(metadataCaseBuilder.build());
instructions.add(insBuilder.build());
insBuilder = new InstructionBuilder();
- ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
- ApplyActionsBuilder actionsBuilder = new ApplyActionsBuilder();
- List<Action> actions = new ArrayList<>();
- ActionBuilder actionBuilder = new ActionBuilder();
+ final ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
+ final ApplyActionsBuilder actionsBuilder = new ApplyActionsBuilder();
+ final List<Action> actions = new ArrayList<>();
+ final ActionBuilder actionBuilder = new ActionBuilder();
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
outputBuilder.setPort(new PortNumber(42L));
insBuilder.setInstructionChoice(applyActionsCaseBuilder.build());
instructions.add(insBuilder.build());
builder.setInstruction(instructions);
- FlowModInput message = builder.build();
+ final FlowModInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
Assert.assertTrue("Unread data", out.readableBytes() == 0);
}
- private static FlowModFlags createFlowModFlagsFromBitmap(int input){
- final Boolean _oFPFFSENDFLOWREM = (input & (1 << 0)) > 0;
- final Boolean _oFPFFCHECKOVERLAP = (input & (1 << 1)) > 0;
- final Boolean _oFPFFRESETCOUNTS = (input & (1 << 2)) > 0;
- final Boolean _oFPFFNOPKTCOUNTS = (input & (1 << 3)) > 0;
- final Boolean _oFPFFNOBYTCOUNTS = (input & (1 << 4)) > 0;
- return new FlowModFlags(_oFPFFCHECKOVERLAP, _oFPFFNOBYTCOUNTS, _oFPFFNOPKTCOUNTS, _oFPFFRESETCOUNTS, _oFPFFSENDFLOWREM);
+ @SuppressWarnings("checkstyle:AbbreviationAsWordInName")
+ private static FlowModFlags createFlowModFlagsFromBitmap(int input) {
+ final Boolean _oFPFFSENDFLOWREM = (input & 1 << 0) > 0;
+ final Boolean _oFPFFCHECKOVERLAP = (input & 1 << 1) > 0;
+ final Boolean _oFPFFRESETCOUNTS = (input & 1 << 2) > 0;
+ final Boolean _oFPFFNOPKTCOUNTS = (input & 1 << 3) > 0;
+ final Boolean _oFPFFNOBYTCOUNTS = (input & 1 << 4) > 0;
+ return new FlowModFlags(_oFPFFCHECKOVERLAP, _oFPFFNOBYTCOUNTS, _oFPFFNOPKTCOUNTS, _oFPFFRESETCOUNTS,
+ _oFPFFSENDFLOWREM);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for FlowRemovedMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class FlowRemovedMessageFactoryTest {
private OFSerializer<FlowRemovedMessage> factory;
builder.setByteCount(BigInteger.valueOf(1234L));
MatchBuilder matchBuilder = new MatchBuilder();
matchBuilder.setType(OxmMatchType.class);
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(InPhyPort.class);
entries.add(entriesBuilder.build());
matchBuilder.setMatchEntry(entries);
builder.setMatch(matchBuilder.build());
- FlowRemovedMessage message = builder.build();
+ final FlowRemovedMessage message = builder.build();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
// simulate parent message
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PortStatusMaskBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for GetAsyncReplyMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class GetAsyncReplyMessageFactoryTest {
private OFSerializer<GetAsyncOutput> factory;
}
private static List<PacketInMask> createPacketInMask() {
- List<PacketInMask> masks = new ArrayList<>();
+ final List<PacketInMask> masks = new ArrayList<>();
PacketInMaskBuilder builder;
// OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
builder = new PacketInMaskBuilder();
}
private static List<PortStatusMask> createPortStatusMask() {
- List<PortStatusMask> masks = new ArrayList<>();
+ final List<PortStatusMask> masks = new ArrayList<>();
PortStatusMaskBuilder builder;
builder = new PortStatusMaskBuilder();
// OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
}
private static List<FlowRemovedMask> createFlowRemowedMask() {
- List<FlowRemovedMask> masks = new ArrayList<>();
+ final List<FlowRemovedMask> masks = new ArrayList<>();
FlowRemovedMaskBuilder builder;
// OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
builder = new FlowRemovedMaskBuilder();
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for GetConfigInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class GetConfigInputMessageFactoryTest {
private OFSerializer<GetConfigInput> getConfigFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link GetConfigInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link GetConfigInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV13() throws Exception {
}
/**
- * Testing of {@link GetConfigInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link GetConfigInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV10() throws Exception {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutputBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for GetConfigReplyMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class GetConfigReplyMessageFactoryTest {
private static final byte MESSAGE_TYPE = 8;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for GetFeaturesInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class GetFeaturesInputMessageFactoryTest {
private OFSerializer<GetFeaturesInput> featuresFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link GetFeaturesInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link GetFeaturesInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV13() throws Exception {
}
/**
- * Testing of {@link GetFeaturesInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link GetFeaturesInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV10() throws Exception {
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInputBuilder;
/**
+ * Unit tests for GetQueueConfigInputMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFSerializer<GetQueueConfigInput> getQueueFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link GetQueueConfigInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link GetQueueConfigInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testGetQueueConfigInputMessage() throws Exception {
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInputBuilder;
/**
+ * Unit tests for GetaAsyncRequestMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFSerializer<GetAsyncInput> getAsyncFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link GetAsyncRequestMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link GetAsyncRequestMessageFactory} for correct translation from POJO.
*/
@Test
public void testGetAsyncReques() throws Exception {
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
-import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsListBuilder;
/**
- * @author timotej.kubas
+ * Unit tests for GroupModInputMessageFactory.
*
+ * @author timotej.kubas
*/
public class GroupModInputMessageFactoryTest {
private static final byte MESSAGE_TYPE = 15;
private GroupModInputMessageFactory groupModFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * @throws Exception
- * Testing of {@link GroupModInputMessageFactory} for correct translation from POJO
+ * Testing of {@link GroupModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testGroupModInputMessage() throws Exception {
builder.setGroupId(new GroupId(256L));
List<BucketsList> exp = createBucketsList();
builder.setBucketsList(exp);
- GroupModInput message = builder.build();
+ final GroupModInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
Assert.assertArrayEquals("Wrong bucketList", exp.toArray(), rec.toArray());
}
- private static List<BucketsList> createBucketsList(){
- List<BucketsList> bucketsList = new ArrayList<>();
+ private static List<BucketsList> createBucketsList() {
+ final List<BucketsList> bucketsList = new ArrayList<>();
BucketsListBuilder bucketsBuilder = new BucketsListBuilder();
- BucketsList bucket;
bucketsBuilder.setWeight(10);
bucketsBuilder.setWatchPort(new PortNumber(65L));
bucketsBuilder.setWatchGroup(22L);
- bucket = bucketsBuilder.build();
+ BucketsList bucket = bucketsBuilder.build();
bucketsList.add(bucket);
return bucketsList;
}
- private static List<BucketsList> createBucketsListFromBufer(ByteBuf out){
- List<BucketsList> bucketsList = new ArrayList<>();
+ private static List<BucketsList> createBucketsListFromBufer(ByteBuf out) {
+ final List<BucketsList> bucketsList = new ArrayList<>();
BucketsListBuilder bucketsBuilder = new BucketsListBuilder();
- BucketsList bucket;
out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
bucketsBuilder.setWeight(out.readUnsignedShort());
bucketsBuilder.setWatchPort(new PortNumber(out.readUnsignedInt()));
bucketsBuilder.setWatchGroup(out.readUnsignedInt());
out.skipBytes(4);
- bucket = bucketsBuilder.build();
+ BucketsList bucket = bucketsBuilder.build();
bucketsList.add(bucket);
return bucketsList;
}
/**
- * Testing of {@link GroupModInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link GroupModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testGroupModInputWithNoBuckets() throws Exception {
Assert.assertEquals("Wrong groupId", message.getGroupId().getValue().intValue(), out.readUnsignedInt());
Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
}
-}
\ No newline at end of file
+}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
import org.opendaylight.openflowjava.util.ByteBufUtils;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.HelloElementType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;
import org.slf4j.LoggerFactory;
/**
- * @author michal.polkorab
+ * Unit tests for HelloInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class HelloInputMessageFactoryTest {
private OFSerializer<HelloInput> helloFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link HelloInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link HelloInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testWithoutElementsSet() throws Exception {
}
/**
- * Testing of {@link HelloInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link HelloInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testWith4BitVersionBitmap() throws Exception {
Elements element = readElement(out).get(0);
Assert.assertEquals("Wrong element type", expectedElement.get(0).getType(), element.getType());
Elements comparation = createComparationElement(lengthOfBitmap).get(0);
- Assert.assertArrayEquals("Wrong element bitmap", comparation.getVersionBitmap().toArray(), element.getVersionBitmap().toArray());
+ Assert.assertArrayEquals("Wrong element bitmap", comparation.getVersionBitmap().toArray(),
+ element.getVersionBitmap().toArray());
}
/**
- * Testing of {@link HelloInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link HelloInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testWith64BitVersionBitmap() throws Exception {
Elements element = readElement(out).get(0);
Assert.assertEquals("Wrong element type", expectedElement.get(0).getType(), element.getType());
Elements comparation = createComparationElement(lengthOfBitmap).get(0);
- Assert.assertArrayEquals("Wrong element bitmap", comparation.getVersionBitmap().toArray(), element.getVersionBitmap().toArray());
+ Assert.assertArrayEquals("Wrong element bitmap", comparation.getVersionBitmap().toArray(),
+ element.getVersionBitmap().toArray());
}
private static List<Elements> createElement(int lengthOfBitmap) {
ElementsBuilder elementsBuilder = new ElementsBuilder();
- List<Elements> elementsList = new ArrayList<>();
+ final List<Elements> elementsList = new ArrayList<>();
List<Boolean> booleanList = new ArrayList<>();
for (int i = 0; i < lengthOfBitmap; i++) {
booleanList.add(true);
}
private static List<Elements> createComparationElement(int lengthOfBitmap) {
- ElementsBuilder elementsBuilder = new ElementsBuilder();
- List<Elements> elementsList = new ArrayList<>();
+ final ElementsBuilder elementsBuilder = new ElementsBuilder();
+ final List<Elements> elementsList = new ArrayList<>();
List<Boolean> booleanList = new ArrayList<>();
for (int i = 0; i < lengthOfBitmap; i++) {
booleanList.add(true);
}
- if ((lengthOfBitmap % Integer.SIZE) != 0) {
- for (int i = 0; i < (Integer.SIZE - (lengthOfBitmap % Integer.SIZE)); i++) {
+ if (lengthOfBitmap % Integer.SIZE != 0) {
+ for (int i = 0; i < Integer.SIZE - lengthOfBitmap % Integer.SIZE; i++) {
booleanList.add(false);
}
}
return elementsList;
}
- private static List<Boolean> readVersionBitmap(int[] input){
+ private static List<Boolean> readVersionBitmap(int[] input) {
List<Boolean> versionBitmapList = new ArrayList<>();
- for (int i = 0; i < input.length; i++) {
- int mask = input[i];
+ for (int mask : input) {
for (int j = 0; j < Integer.SIZE; j++) {
- versionBitmapList.add((mask & (1<<j)) != 0);
+ versionBitmapList.add((mask & 1 << j) != 0);
}
}
return versionBitmapList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for HelloMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class HelloMessageFactoryTest {
private static final byte MESSAGE_TYPE = 0;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.BandsBuilder;
/**
+ * Unit tests for MeterModInputMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFSerializer<MeterModInput> meterModFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * @throws Exception
- * Testing of {@link MeterModInputMessageFactory} for correct translation from POJO
+ * Testing of {@link MeterModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testMeterModInputMessage() throws Exception {
Assert.assertEquals("Wrong bands", message.getBands(), decodeBandsList(out));
}
- private static MeterFlags decodeMeterModFlags(short input){
- final Boolean _oFPMFKBPS = (input & (1 << 0)) > 0;
- final Boolean _oFPMFPKTPS = (input & (1 << 1)) > 0;
- final Boolean _oFPMFBURST = (input & (1 << 2)) > 0;
- final Boolean _oFPMFSTATS = (input & (1 << 3)) > 0;
+ @SuppressWarnings("checkstyle:AbbreviationAsWordInName")
+ private static MeterFlags decodeMeterModFlags(short input) {
+ final Boolean _oFPMFKBPS = (input & 1 << 0) > 0;
+ final Boolean _oFPMFPKTPS = (input & 1 << 1) > 0;
+ final Boolean _oFPMFBURST = (input & 1 << 2) > 0;
+ final Boolean _oFPMFSTATS = (input & 1 << 3) > 0;
return new MeterFlags(_oFPMFBURST, _oFPMFKBPS, _oFPMFPKTPS, _oFPMFSTATS);
}
- private static List<Bands> createBandsList(){
- List<Bands> bandsList = new ArrayList<>();
- BandsBuilder bandsBuilder = new BandsBuilder();
- MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
+ private static List<Bands> createBandsList() {
+ final List<Bands> bandsList = new ArrayList<>();
+ final BandsBuilder bandsBuilder = new BandsBuilder();
+ final MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
MeterBandDropBuilder dropBand = new MeterBandDropBuilder();
dropBand.setType(MeterBandType.OFPMBTDROP);
dropBand.setRate(1L);
dropBand.setBurstSize(2L);
dropCaseBuilder.setMeterBandDrop(dropBand.build());
bandsList.add(bandsBuilder.setMeterBand(dropCaseBuilder.build()).build());
- MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
+ final MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
MeterBandDscpRemarkBuilder dscpRemarkBand = new MeterBandDscpRemarkBuilder();
dscpRemarkBand.setType(MeterBandType.OFPMBTDSCPREMARK);
dscpRemarkBand.setRate(1L);
return bandsList;
}
- private static List<Bands> decodeBandsList(ByteBuf input){
- List<Bands> bandsList = new ArrayList<>();
- BandsBuilder bandsBuilder = new BandsBuilder();
- MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
+ private static List<Bands> decodeBandsList(ByteBuf input) {
+ final List<Bands> bandsList = new ArrayList<>();
+ final BandsBuilder bandsBuilder = new BandsBuilder();
+ final MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
MeterBandDropBuilder dropBand = new MeterBandDropBuilder();
dropBand.setType(MeterBandType.forValue(input.readUnsignedShort()));
- input.skipBytes(Short.SIZE/Byte.SIZE);
+ input.skipBytes(Short.SIZE / Byte.SIZE);
dropBand.setRate(input.readUnsignedInt());
dropBand.setBurstSize(input.readUnsignedInt());
input.skipBytes(4);
dropCaseBuilder.setMeterBandDrop(dropBand.build());
bandsList.add(bandsBuilder.setMeterBand(dropCaseBuilder.build()).build());
- MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
+ final MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
MeterBandDscpRemarkBuilder dscpRemarkBand = new MeterBandDscpRemarkBuilder();
dscpRemarkBand.setType(MeterBandType.forValue(input.readUnsignedShort()));
- input.skipBytes(Short.SIZE/Byte.SIZE);
+ input.skipBytes(Short.SIZE / Byte.SIZE);
dscpRemarkBand.setRate(input.readUnsignedInt());
dscpRemarkBand.setBurstSize(input.readUnsignedInt());
dscpRemarkBand.setPrecLevel(input.readUnsignedByte());
}
/**
- * @throws Exception
- * Testing of {@link MeterModInputMessageFactory} for correct translation from POJO
+ * Testing of {@link MeterModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testMeterModInputMessageWithNoBands() throws Exception {
Assert.assertEquals("Wrong meterId", message.getMeterId().getValue().intValue(), out.readUnsignedInt());
Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartReplyMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartReplyMessageFactoryTest {
private static final byte MESSAGE_TYPE = 19;
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setFlags(new MultipartRequestFlags(true));
builder.setType(MultipartType.forValue(12));
- MultipartReplyTableFeaturesCaseBuilder caseBuilder = new MultipartReplyTableFeaturesCaseBuilder();
- MultipartReplyTableFeaturesBuilder featuresBuilder = new MultipartReplyTableFeaturesBuilder();
- List<TableFeatures> tableFeaturesList = new ArrayList<>();
+ final MultipartReplyTableFeaturesCaseBuilder caseBuilder = new MultipartReplyTableFeaturesCaseBuilder();
+ final MultipartReplyTableFeaturesBuilder featuresBuilder = new MultipartReplyTableFeaturesBuilder();
+ final List<TableFeatures> tableFeaturesList = new ArrayList<>();
TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();
tableFeaturesBuilder.setTableId((short) 8);
tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
tableFeaturesBuilder.setMetadataWrite(new byte[] { 0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01 });
tableFeaturesBuilder.setConfig(new TableConfig(true));
tableFeaturesBuilder.setMaxEntries(65L);
- List<TableFeatureProperties> properties = new ArrayList<>();
TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLES);
NextTableRelatedTableFeaturePropertyBuilder nextPropBuilder = new NextTableRelatedTableFeaturePropertyBuilder();
nextIds.add(new NextTableIdsBuilder().setTableId((short) 2).build());
nextPropBuilder.setNextTableIds(nextIds);
propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());
+ List<TableFeatureProperties> properties = new ArrayList<>();
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS);
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONS);
- InstructionRelatedTableFeaturePropertyBuilder insPropBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
List<Instruction> insIds = new ArrayList<>();
InstructionBuilder insBuilder = new InstructionBuilder();
insBuilder.setInstructionChoice(new WriteActionsCaseBuilder().build());
insBuilder = new InstructionBuilder();
insBuilder.setInstructionChoice(new GotoTableCaseBuilder().build());
insIds.add(insBuilder.build());
+ InstructionRelatedTableFeaturePropertyBuilder insPropBuilder =
+ new InstructionRelatedTableFeaturePropertyBuilder();
insPropBuilder.setInstruction(insIds);
propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());
properties.add(propBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTMATCH);
- OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
- List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(InPhyPort.class);
entriesBuilder.setHasMask(false);
+ List<MatchEntry> entries = new ArrayList<>();
entries.add(entriesBuilder.build());
entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(InPort.class);
entriesBuilder.setHasMask(false);
entries.add(entriesBuilder.build());
+ OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
oxmBuilder.setMatchEntry(entries);
propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
properties.add(propBuilder.build());
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setFlags(new MultipartRequestFlags(true));
builder.setType(MultipartType.forValue(11));
- MultipartReplyMeterFeaturesCaseBuilder meterFeaturesCase = new MultipartReplyMeterFeaturesCaseBuilder();
+ final MultipartReplyMeterFeaturesCaseBuilder meterFeaturesCase = new MultipartReplyMeterFeaturesCaseBuilder();
MultipartReplyMeterFeaturesBuilder meterFeatures = new MultipartReplyMeterFeaturesBuilder();
meterFeatures.setMaxMeter(1L);
meterFeatures.setBandTypes(new MeterBandTypeBitmap(true, false));
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setFlags(new MultipartRequestFlags(true));
builder.setType(MultipartType.forValue(8));
- MultipartReplyGroupFeaturesCaseBuilder featureCase = new MultipartReplyGroupFeaturesCaseBuilder();
+ final MultipartReplyGroupFeaturesCaseBuilder featureCase = new MultipartReplyGroupFeaturesCaseBuilder();
MultipartReplyGroupFeaturesBuilder feature = new MultipartReplyGroupFeaturesBuilder();
feature.setTypes(new GroupTypes(true, false, true, false));
feature.setCapabilities(new GroupCapabilities(true, false, true, true));
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setFlags(new MultipartRequestFlags(true));
builder.setType(MultipartType.forValue(2));
- MultipartReplyAggregateCaseBuilder aggregateCase = new MultipartReplyAggregateCaseBuilder();
+ final MultipartReplyAggregateCaseBuilder aggregateCase = new MultipartReplyAggregateCaseBuilder();
MultipartReplyAggregateBuilder aggregate = new MultipartReplyAggregateBuilder();
aggregate.setPacketCount(BigInteger.valueOf(1L));
aggregate.setByteCount(BigInteger.valueOf(1L));
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setFlags(new MultipartRequestFlags(true));
builder.setType(MultipartType.forValue(0));
- MultipartReplyDescCaseBuilder descCase = new MultipartReplyDescCaseBuilder();
+ final MultipartReplyDescCaseBuilder descCase = new MultipartReplyDescCaseBuilder();
MultipartReplyDescBuilder desc = new MultipartReplyDescBuilder();
desc.setMfrDesc("Test");
desc.setHwDesc("Test");
}
private static PortConfig createPortConfig(long input) {
- final Boolean _portDown = ((input) & (1 << 0)) > 0;
- final Boolean _noRecv = ((input) & (1 << 2)) > 0;
- final Boolean _noFwd = ((input) & (1 << 5)) > 0;
- final Boolean _noPacketIn = ((input) & (1 << 6)) > 0;
+ final Boolean _portDown = (input & 1 << 0) > 0;
+ final Boolean _noRecv = (input & 1 << 2) > 0;
+ final Boolean _noFwd = (input & 1 << 5) > 0;
+ final Boolean _noPacketIn = (input & 1 << 6) > 0;
return new PortConfig(_noFwd, _noPacketIn, _noRecv, _portDown);
}
private static PortFeatures createPortFeatures(long input) {
- final Boolean _10mbHd = ((input) & (1 << 0)) > 0;
- final Boolean _10mbFd = ((input) & (1 << 1)) > 0;
- final Boolean _100mbHd = ((input) & (1 << 2)) > 0;
- final Boolean _100mbFd = ((input) & (1 << 3)) > 0;
- final Boolean _1gbHd = ((input) & (1 << 4)) > 0;
- final Boolean _1gbFd = ((input) & (1 << 5)) > 0;
- final Boolean _10gbFd = ((input) & (1 << 6)) > 0;
- final Boolean _40gbFd = ((input) & (1 << 7)) > 0;
- final Boolean _100gbFd = ((input) & (1 << 8)) > 0;
- final Boolean _1tbFd = ((input) & (1 << 9)) > 0;
- final Boolean _other = ((input) & (1 << 10)) > 0;
- final Boolean _copper = ((input) & (1 << 11)) > 0;
- final Boolean _fiber = ((input) & (1 << 12)) > 0;
- final Boolean _autoneg = ((input) & (1 << 13)) > 0;
- final Boolean _pause = ((input) & (1 << 14)) > 0;
- final Boolean _pauseAsym = ((input) & (1 << 15)) > 0;
+ final Boolean _10mbHd = (input & 1 << 0) > 0;
+ final Boolean _10mbFd = (input & 1 << 1) > 0;
+ final Boolean _100mbHd = (input & 1 << 2) > 0;
+ final Boolean _100mbFd = (input & 1 << 3) > 0;
+ final Boolean _1gbHd = (input & 1 << 4) > 0;
+ final Boolean _1gbFd = (input & 1 << 5) > 0;
+ final Boolean _10gbFd = (input & 1 << 6) > 0;
+ final Boolean _40gbFd = (input & 1 << 7) > 0;
+ final Boolean _100gbFd = (input & 1 << 8) > 0;
+ final Boolean _1tbFd = (input & 1 << 9) > 0;
+ final Boolean _other = (input & 1 << 10) > 0;
+ final Boolean _copper = (input & 1 << 11) > 0;
+ final Boolean _fiber = (input & 1 << 12) > 0;
+ final Boolean _autoneg = (input & 1 << 13) > 0;
+ final Boolean _pause = (input & 1 << 14) > 0;
+ final Boolean _pauseAsym = (input & 1 << 15) > 0;
return new PortFeatures(_100gbFd, _100mbFd, _100mbHd, _10gbFd, _10mbFd, _10mbHd, _1gbFd, _1gbHd, _1tbFd,
_40gbFd, _autoneg, _copper, _fiber, _other, _pause, _pauseAsym);
}
private static PortState createPortState(long input) {
- final Boolean one = ((input) & (1 << 0)) > 0;
- final Boolean two = ((input) & (1 << 1)) > 0;
- final Boolean three = ((input) & (1 << 2)) > 0;
+ final Boolean one = (input & 1 << 0) > 0;
+ final Boolean two = (input & 1 << 1) > 0;
+ final Boolean three = (input & 1 << 2) > 0;
return new PortState(two, one, three);
}
private static List<Bands> decodeBandsList(ByteBuf input) {
- List<Bands> bandsList = new ArrayList<>();
- BandsBuilder bandsBuilder = new BandsBuilder();
- MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
+ final List<Bands> bandsList = new ArrayList<>();
+ final BandsBuilder bandsBuilder = new BandsBuilder();
+ final MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
MeterBandDropBuilder dropBand = new MeterBandDropBuilder();
dropBand.setType(MeterBandType.forValue(input.readUnsignedShort()));
input.skipBytes(Short.SIZE / Byte.SIZE);
dropBand.setBurstSize(input.readUnsignedInt());
dropCaseBuilder.setMeterBandDrop(dropBand.build());
bandsList.add(bandsBuilder.setMeterBand(dropCaseBuilder.build()).build());
- MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
+ final MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
MeterBandDscpRemarkBuilder dscpRemarkBand = new MeterBandDscpRemarkBuilder();
dscpRemarkBand.setType(MeterBandType.forValue(input.readUnsignedShort()));
input.skipBytes(Short.SIZE / Byte.SIZE);
}
private static MeterBandTypeBitmap createMeterBandTypeBitmap(int input) {
- final Boolean one = ((input) & (1 << 0)) > 0;
- final Boolean two = ((input) & (1 << 1)) > 0;
+ final Boolean one = (input & 1 << 0) > 0;
+ final Boolean two = (input & 1 << 1) > 0;
return new MeterBandTypeBitmap(one, two);
}
private static List<Bands> createBandsList() {
- List<Bands> bandsList = new ArrayList<>();
- BandsBuilder bandsBuilder = new BandsBuilder();
- MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
+ final List<Bands> bandsList = new ArrayList<>();
+ final BandsBuilder bandsBuilder = new BandsBuilder();
+ final MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
MeterBandDropBuilder dropBand = new MeterBandDropBuilder();
dropBand.setType(MeterBandType.OFPMBTDROP);
dropBand.setRate(1L);
dropBand.setBurstSize(2L);
dropCaseBuilder.setMeterBandDrop(dropBand.build());
bandsList.add(bandsBuilder.setMeterBand(dropCaseBuilder.build()).build());
- MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
+ final MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
MeterBandDscpRemarkBuilder dscpRemarkBand = new MeterBandDscpRemarkBuilder();
dscpRemarkBand.setType(MeterBandType.OFPMBTDSCPREMARK);
dscpRemarkBand.setRate(1L);
}
private static MeterFlags createMeterFlags(int input) {
- final Boolean one = ((input) & (1 << 0)) > 0;
- final Boolean two = ((input) & (1 << 1)) > 0;
- final Boolean three = ((input) & (1 << 2)) > 0;
- final Boolean four = ((input) & (1 << 3)) > 0;
+ final Boolean one = (input & 1 << 0) > 0;
+ final Boolean two = (input & 1 << 1) > 0;
+ final Boolean three = (input & 1 << 2) > 0;
+ final Boolean four = (input & 1 << 3) > 0;
return new MeterFlags(three, one, two, four);
}
}
private static ActionType createActionType(int input) {
- final Boolean one = ((input) & (1 << 0)) > 0;
- final Boolean two = ((input) & (1 << 1)) > 0;
- final Boolean three = ((input) & (1 << 2)) > 0;
- final Boolean four = ((input) & (1 << 3)) > 0;
- final Boolean five = ((input) & (1 << 4)) > 0;
- final Boolean six = ((input) & (1 << 5)) > 0;
- final Boolean seven = ((input) & (1 << 6)) > 0;
- final Boolean eight = ((input) & (1 << 7)) > 0;
- final Boolean nine = ((input) & (1 << 8)) > 0;
- final Boolean ten = ((input) & (1 << 9)) > 0;
- final Boolean eleven = ((input) & (1 << 10)) > 0;
- final Boolean twelve = ((input) & (1 << 11)) > 0;
- final Boolean thirteen = ((input) & (1 << 12)) > 0;
- final Boolean fourteen = ((input) & (1 << 13)) > 0;
- final Boolean fifthteen = ((input) & (1 << 14)) > 0;
- final Boolean sixteen = ((input) & (1 << 15)) > 0;
- final Boolean seventeen = ((input) & (1 << 16)) > 0;
+ final Boolean one = (input & 1 << 0) > 0;
+ final Boolean two = (input & 1 << 1) > 0;
+ final Boolean three = (input & 1 << 2) > 0;
+ final Boolean four = (input & 1 << 3) > 0;
+ final Boolean five = (input & 1 << 4) > 0;
+ final Boolean six = (input & 1 << 5) > 0;
+ final Boolean seven = (input & 1 << 6) > 0;
+ final Boolean eight = (input & 1 << 7) > 0;
+ final Boolean nine = (input & 1 << 8) > 0;
+ final Boolean ten = (input & 1 << 9) > 0;
+ final Boolean eleven = (input & 1 << 10) > 0;
+ final Boolean twelve = (input & 1 << 11) > 0;
+ final Boolean thirteen = (input & 1 << 12) > 0;
+ final Boolean fourteen = (input & 1 << 13) > 0;
+ final Boolean fifthteen = (input & 1 << 14) > 0;
+ final Boolean sixteen = (input & 1 << 15) > 0;
+ final Boolean seventeen = (input & 1 << 16) > 0;
return new ActionType(three, two, five, thirteen, seventeen, eleven, one, nine, sixteen, seven, eight,
fifthteen, six, fourteen, four, twelve, ten);
}
- private static GroupCapabilities createGroupCapabilities(int input) {
- final Boolean one = ((input) & (1 << 0)) > 0;
- final Boolean two = ((input) & (1 << 1)) > 0;
- final Boolean three = ((input) & (1 << 2)) > 0;
- final Boolean four = ((input) & (1 << 3)) > 0;
- return new GroupCapabilities(three, four, two, one);
- }
-
- private static GroupTypes createGroupTypes(int input) {
- final Boolean one = ((input) & (1 << 0)) > 0;
- final Boolean two = ((input) & (1 << 1)) > 0;
- final Boolean three = ((input) & (1 << 2)) > 0;
- final Boolean four = ((input) & (1 << 3)) > 0;
- return new GroupTypes(one, four, three, two);
- }
-
private static List<ActionType> createActionType() {
ActionType actionType1 = new ActionType(true, false, true, false, true, false, true, false, true, false, true,
false, true, false, true, false, true);
}
+ private static GroupCapabilities createGroupCapabilities(int input) {
+ final Boolean one = (input & 1 << 0) > 0;
+ final Boolean two = (input & 1 << 1) > 0;
+ final Boolean three = (input & 1 << 2) > 0;
+ final Boolean four = (input & 1 << 3) > 0;
+ return new GroupCapabilities(three, four, two, one);
+ }
+
+ private static GroupTypes createGroupTypes(int input) {
+ final Boolean one = (input & 1 << 0) > 0;
+ final Boolean two = (input & 1 << 1) > 0;
+ final Boolean three = (input & 1 << 2) > 0;
+ final Boolean four = (input & 1 << 3) > 0;
+ return new GroupTypes(one, four, three, two);
+ }
+
private static List<GroupDesc> createGroupDesc() {
GroupDescBuilder builder = new GroupDescBuilder();
builder.setType(GroupType.forValue(1));
}
private static List<Action> createActionList() {
- List<Action> actions = new ArrayList<>();
- ActionBuilder actionBuilder = new ActionBuilder();
+ final List<Action> actions = new ArrayList<>();
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
outputBuilder.setPort(new PortNumber(45L));
outputBuilder.setMaxLength(55);
caseBuilder.setOutputAction(outputBuilder.build());
+ ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(caseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
builder.setCollisions(BigInteger.valueOf(1L));
builder.setDurationSec(1L);
builder.setDurationNsec(1L);
- List<PortStats> list = new ArrayList<PortStats>();
+ List<PortStats> list = new ArrayList<>();
list.add(builder.build());
return list;
}
builder.setActiveCount(1L);
builder.setLookupCount(BigInteger.valueOf(1L));
builder.setMatchedCount(BigInteger.valueOf(1L));
- List<TableStats> list = new ArrayList<TableStats>();
+ List<TableStats> list = new ArrayList<>();
list.add(builder.build());
return list;
}
builder.setByteCount(BigInteger.valueOf(1234L));
MatchBuilder matchBuilder = new MatchBuilder();
matchBuilder.setType(OxmMatchType.class);
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(InPhyPort.class);
entries.add(entriesBuilder.build());
matchBuilder.setMatchEntry(entries);
builder.setMatch(matchBuilder.build());
- List<Instruction> instructions = new ArrayList<>();
+ final List<Instruction> instructions = new ArrayList<>();
// Goto_table instruction
InstructionBuilder builderInstruction = new InstructionBuilder();
GotoTableCaseBuilder gotoCaseBuilder = new GotoTableCaseBuilder();
instructions.add(builderInstruction.build());
// Write_actions instruction
builderInstruction = new InstructionBuilder();
- WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
- WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
- List<Action> actions = new ArrayList<>();
- ActionBuilder actionBuilder = new ActionBuilder();
+ final WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
+ final WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
outputBuilder.setPort(new PortNumber(45L));
outputBuilder.setMaxLength(55);
caseBuilder.setOutputAction(outputBuilder.build());
+ ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(caseBuilder.build());
+ List<Action> actions = new ArrayList<>();
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
SetNwTtlCaseBuilder ttlCaseBuilder = new SetNwTtlCaseBuilder();
instructions.add(builderInstruction.build());
// Apply_actions instruction
builderInstruction = new InstructionBuilder();
- ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
- ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
+ final ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
+ final ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
actions = new ArrayList<>();
actionBuilder = new ActionBuilder();
PushVlanCaseBuilder vlanCaseBuilder = new PushVlanCaseBuilder();
builderInstruction.setInstructionChoice(applyActionsCaseBuilder.build());
instructions.add(builderInstruction.build());
builder.setInstruction(instructions);
- List<FlowStats> list = new ArrayList<FlowStats>();
+ List<FlowStats> list = new ArrayList<>();
list.add(builder.build());
return list;
}
private static MultipartRequestFlags createMultipartRequestFlags(int input) {
- final Boolean one = ((input) & (1 << 0)) > 0;
+ final Boolean one = (input & 1 << 0) > 0;
return new MultipartRequestFlags(one);
}
private static MultipartReplyDescCase decodeDescBody(ByteBuf output) {
- MultipartReplyDescCaseBuilder descCase = new MultipartReplyDescCaseBuilder();
+ final MultipartReplyDescCaseBuilder descCase = new MultipartReplyDescCaseBuilder();
MultipartReplyDescBuilder desc = new MultipartReplyDescBuilder();
byte[] mfrDesc = new byte[256];
output.readBytes(mfrDesc);
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.math.BigInteger;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;
/**
+ * Unit tests for MultipartRequestInputFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
public class MultipartRequestInputFactoryTest {
- /** padding in MultipartRequest message */
+ static final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01 = 3;
+ static final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02 = 4;
+ static final byte PADDING_IN_MULTIPART_REQUEST_METER_CONFIG_BODY = 4;
+ static final byte PADDING_IN_MULTIPART_REQUEST_AGGREGATE_BODY_01 = 3;
+ static final byte PADDING_IN_MULTIPART_REQUEST_AGGREGATE_BODY_02 = 4;
+ static final byte PADDING_IN_MULTIPART_REQUEST_PORTSTATS_BODY = 4;
+ static final byte PADDING_IN_MULTIPART_REQUEST_GROUP_BODY = 4;
+ static final byte PADDING_IN_MULTIPART_REQUEST_METER_BODY = 4;
+
+ /** padding in MultipartRequest message. */
public static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE = 4;
private SerializerRegistry registry;
private OFSerializer<MultipartRequestInput> multipartFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * @throws Exception
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestFlowInputFactory() throws Exception {
}
private static MultipartRequestFlowCase createRequestFlow() {
- MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
+ final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
MultipartRequestFlowBuilder builder = new MultipartRequestFlowBuilder();
builder.setTableId((short) 8);
builder.setOutPort(85L);
}
private static MultipartRequestFlowCase decodeRequestFlow(ByteBuf output) {
- final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01 = 3;
- final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02 = 4;
- MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
+ final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
MultipartRequestFlowBuilder builder = new MultipartRequestFlowBuilder();
builder.setTableId(output.readUnsignedByte());
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01);
}
/**
- * @throws Exception
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestInputAggregateBodyFactory() throws Exception {
Assert.assertEquals("Wrong aggregate", message.getMultipartRequestBody(), decodeRequestAggregate(out));
}
- private static MultipartRequestFlags decodeMultipartRequestFlags(short input){
- final Boolean _oFPMPFREQMORE = (input & (1 << 0)) > 0;
+ @SuppressWarnings("checkstyle:AbbreviationAsWordInName")
+ private static MultipartRequestFlags decodeMultipartRequestFlags(short input) {
+ final Boolean _oFPMPFREQMORE = (input & 1 << 0) > 0;
return new MultipartRequestFlags(_oFPMPFREQMORE);
}
private static MultipartRequestAggregateCase createRequestAggregate() {
- MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
+ final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
MultipartRequestAggregateBuilder builder = new MultipartRequestAggregateBuilder();
builder.setTableId((short) 8);
builder.setOutPort(85L);
}
private static MultipartRequestAggregateCase decodeRequestAggregate(ByteBuf output) {
- final byte PADDING_IN_MULTIPART_REQUEST_AGGREGATE_BODY_01 = 3;
- final byte PADDING_IN_MULTIPART_REQUEST_AGGREGATE_BODY_02 = 4;
- MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
+ final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
MultipartRequestAggregateBuilder builder = new MultipartRequestAggregateBuilder();
builder.setTableId(output.readUnsignedByte());
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_AGGREGATE_BODY_01);
}
/**
- * @throws Exception
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestInputTableFactory() throws Exception {
}
/**
- * @throws Exception
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestPortStatsMessageFactory() throws Exception {
}
private static MultipartRequestPortStatsCase decodeRequestPortStats(ByteBuf output) {
- final byte PADDING_IN_MULTIPART_REQUEST_PORTSTATS_BODY = 4;
MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
MultipartRequestPortStatsBuilder builder = new MultipartRequestPortStatsBuilder();
builder.setPortNo(output.readUnsignedInt());
}
/**
- * @throws Exception
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestQueueMessageFactory() throws Exception {
}
/**
- * @throws Exception
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestGroupMessageFactory() throws Exception {
}
private static MultipartRequestGroupCase decodeRequestGroup(ByteBuf output) {
- final byte PADDING_IN_MULTIPART_REQUEST_GROUP_BODY = 4;
MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
MultipartRequestGroupBuilder builder = new MultipartRequestGroupBuilder();
builder.setGroupId(new GroupId(output.readUnsignedInt()));
}
/**
- * @throws Exception
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestMeterMessageFactory() throws Exception {
}
private static MultipartRequestMeterCase decodeRequestMeter(ByteBuf output) {
- final byte PADDING_IN_MULTIPART_REQUEST_METER_BODY = 4;
MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
MultipartRequestMeterBuilder builder = new MultipartRequestMeterBuilder();
builder.setMeterId(new MeterId(output.readUnsignedInt()));
}
/**
- * @throws Exception
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestMeterConfigMessageFactory() throws Exception {
}
private static MultipartRequestMeterConfigCase decodeRequestMeterConfig(ByteBuf output) {
- final byte PADDING_IN_MULTIPART_REQUEST_METER_CONFIG_BODY = 4;
MultipartRequestMeterConfigCaseBuilder caseBuilder = new MultipartRequestMeterConfigCaseBuilder();
MultipartRequestMeterConfigBuilder builder = new MultipartRequestMeterConfigBuilder();
builder.setMeterId(new MeterId(output.readUnsignedInt()));
}
/**
- * @throws Exception
- * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
+ * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestDescMessageFactory() throws Exception {
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for OF10BarrierInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class OF10BarrierInputMessageFactoryTest {
private OFSerializer<BarrierInput> barrierFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link OF10BarrierInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link OF10BarrierInputMessageFactory} for correct translation from POJO.
*/
@Test
public void test() throws Exception {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10BarrierReplyMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10BarrierReplyMessageFactoryTest {
private OFSerializer<BarrierOutput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10FeaturesReplyMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10FeaturesReplyMessageFactoryTest {
private OFSerializer<GetFeaturesOutput> factory;
}
private static List<PhyPort> createPorts() {
- List<PhyPort> ports = new ArrayList<>();
+ final List<PhyPort> ports = new ArrayList<>();
PhyPortBuilder builder = new PhyPortBuilder();
builder.setPortNo(1L);
builder.setHwAddr(new MacAddress("94:de:80:a6:61:40"));
}
private static PortConfigV10 createPortConfig(long input) {
- final Boolean _portDown = ((input) & (1 << 0)) > 0;
- final Boolean _noStp = ((input) & (1 << 1)) > 0;
- final Boolean _noRecv = ((input) & (1 << 2)) > 0;
- final Boolean _noRecvStp = ((input) & (1 << 3)) > 0;
- final Boolean _noFlood = ((input) & (1 << 4)) > 0;
- final Boolean _noFwd = ((input) & (1 << 5)) > 0;
- final Boolean _noPacketIn = ((input) & (1 << 6)) > 0;
+ final Boolean _portDown = (input & 1 << 0) > 0;
+ final Boolean _noStp = (input & 1 << 1) > 0;
+ final Boolean _noRecv = (input & 1 << 2) > 0;
+ final Boolean _noRecvStp = (input & 1 << 3) > 0;
+ final Boolean _noFlood = (input & 1 << 4) > 0;
+ final Boolean _noFwd = (input & 1 << 5) > 0;
+ final Boolean _noPacketIn = (input & 1 << 6) > 0;
return new PortConfigV10(_noFlood, _noFwd, _noPacketIn, _noRecv, _noRecvStp, _noStp, _portDown);
}
private static PortFeaturesV10 createPortFeatures(long input) {
- final Boolean _10mbHd = ((input) & (1 << 0)) > 0;
- final Boolean _10mbFd = ((input) & (1 << 1)) > 0;
- final Boolean _100mbHd = ((input) & (1 << 2)) > 0;
- final Boolean _100mbFd = ((input) & (1 << 3)) > 0;
- final Boolean _1gbHd = ((input) & (1 << 4)) > 0;
- final Boolean _1gbFd = ((input) & (1 << 5)) > 0;
- final Boolean _10gbFd = ((input) & (1 << 6)) > 0;
- final Boolean _copper = ((input) & (1 << 7)) > 0;
- final Boolean _fiber = ((input) & (1 << 8)) > 0;
- final Boolean _autoneg = ((input) & (1 << 9)) > 0;
- final Boolean _pause = ((input) & (1 << 10)) > 0;
- final Boolean _pauseAsym = ((input) & (1 << 11)) > 0;
+ final Boolean _10mbHd = (input & 1 << 0) > 0;
+ final Boolean _10mbFd = (input & 1 << 1) > 0;
+ final Boolean _100mbHd = (input & 1 << 2) > 0;
+ final Boolean _100mbFd = (input & 1 << 3) > 0;
+ final Boolean _1gbHd = (input & 1 << 4) > 0;
+ final Boolean _1gbFd = (input & 1 << 5) > 0;
+ final Boolean _10gbFd = (input & 1 << 6) > 0;
+ final Boolean _copper = (input & 1 << 7) > 0;
+ final Boolean _fiber = (input & 1 << 8) > 0;
+ final Boolean _autoneg = (input & 1 << 9) > 0;
+ final Boolean _pause = (input & 1 << 10) > 0;
+ final Boolean _pauseAsym = (input & 1 << 11) > 0;
return new PortFeaturesV10(_100mbFd, _100mbHd, _10gbFd, _10mbFd, _10mbHd, _1gbFd, _1gbHd, _autoneg, _copper,
_fiber, _pause, _pauseAsym);
}
private static PortStateV10 createPortState(long input) {
- final Boolean _linkDown = ((input) & (1 << 0)) > 0;
- final Boolean _blocked = ((input) & (1 << 1)) > 0;
- final Boolean _live = ((input) & (1 << 2)) > 0;
- final Boolean _stpListen = ((input) & (1 << 3)) > 0;
- final Boolean _stpLearn = ((input) & (1 << 4)) > 0;
- final Boolean _stpForward = ((input) & (1 << 5)) > 0;
- final Boolean _stpBlock = ((input) & (1 << 6)) > 0;
- final Boolean _stpMask = ((input) & (1 << 7)) > 0;
+ final Boolean _linkDown = (input & 1 << 0) > 0;
+ final Boolean _blocked = (input & 1 << 1) > 0;
+ final Boolean _live = (input & 1 << 2) > 0;
+ final Boolean _stpListen = (input & 1 << 3) > 0;
+ final Boolean _stpLearn = (input & 1 << 4) > 0;
+ final Boolean _stpForward = (input & 1 << 5) > 0;
+ final Boolean _stpBlock = (input & 1 << 6) > 0;
+ final Boolean _stpMask = (input & 1 << 7) > 0;
return new PortStateV10(_blocked, _linkDown, _live, _stpBlock, _stpForward, _stpLearn, _stpListen, _stpMask);
}
+ @SuppressWarnings("checkstyle:AbbreviationAsWordInName")
private static CapabilitiesV10 createCapabilities(long input) {
- Boolean _oFPCFLOWSTATS = ((input) & (1 << 0)) > 0;
- Boolean _oFPCTABLESTATS = ((input) & (1 << 1)) > 0;
- Boolean _oFPCPORTSTATS = ((input) & (1 << 2)) > 0;
- Boolean _oFPCSTP = ((input) & (1 << 3)) > 0;
- Boolean _oFPCRESERVED = ((input) & (1 << 4)) > 0;
- Boolean _oFPCIPREASM = ((input) & (1 << 5)) > 0;
- Boolean _oFPCQUEUESTATS = ((input) & (1 << 6)) > 0;
- Boolean _oFPCARPMATCHIP = ((input) & (1 << 7)) > 0;
+ final Boolean _oFPCFLOWSTATS = (input & 1 << 0) > 0;
+ final Boolean _oFPCTABLESTATS = (input & 1 << 1) > 0;
+ final Boolean _oFPCPORTSTATS = (input & 1 << 2) > 0;
+ final Boolean _oFPCSTP = (input & 1 << 3) > 0;
+ final Boolean _oFPCRESERVED = (input & 1 << 4) > 0;
+ final Boolean _oFPCIPREASM = (input & 1 << 5) > 0;
+ final Boolean _oFPCQUEUESTATS = (input & 1 << 6) > 0;
+ final Boolean _oFPCARPMATCHIP = (input & 1 << 7) > 0;
return new CapabilitiesV10(_oFPCARPMATCHIP, _oFPCFLOWSTATS, _oFPCIPREASM, _oFPCPORTSTATS, _oFPCQUEUESTATS,
_oFPCRESERVED, _oFPCSTP, _oFPCTABLESTATS);
}
+ @SuppressWarnings("checkstyle:AbbreviationAsWordInName")
private static ActionTypeV10 createActionsV10(long input) {
- Boolean _oFPATOUTPUT = ((input) & (1 << 0)) > 0;
- Boolean _oFPATSETVLANVID = ((input) & (1 << 1)) > 0;
- Boolean _oFPATSETVLANPCP = ((input) & (1 << 2)) > 0;
- Boolean _oFPATSTRIPVLAN = ((input) & (1 << 3)) > 0;
- Boolean _oFPATSETDLSRC = ((input) & (1 << 4)) > 0;
- Boolean _oFPATSETDLDST = ((input) & (1 << 5)) > 0;
- Boolean _oFPATSETNWSRC = ((input) & (1 << 6)) > 0;
- Boolean _oFPATSETNWDST = ((input) & (1 << 7)) > 0;
- Boolean _oFPATSETNWTOS = ((input) & (1 << 8)) > 0;
- Boolean _oFPATSETTPSRC = ((input) & (1 << 9)) > 0;
- Boolean _oFPATSETTPDST = ((input) & (1 << 10)) > 0;
- Boolean _oFPATENQUEUE = ((input) & (1 << 11)) > 0;
- Boolean _oFPATVENDOR = ((input) & (1 << 12)) > 0;
+ final Boolean _oFPATOUTPUT = (input & 1 << 0) > 0;
+ final Boolean _oFPATSETVLANVID = (input & 1 << 1) > 0;
+ final Boolean _oFPATSETVLANPCP = (input & 1 << 2) > 0;
+ final Boolean _oFPATSTRIPVLAN = (input & 1 << 3) > 0;
+ final Boolean _oFPATSETDLSRC = (input & 1 << 4) > 0;
+ final Boolean _oFPATSETDLDST = (input & 1 << 5) > 0;
+ final Boolean _oFPATSETNWSRC = (input & 1 << 6) > 0;
+ final Boolean _oFPATSETNWDST = (input & 1 << 7) > 0;
+ final Boolean _oFPATSETNWTOS = (input & 1 << 8) > 0;
+ final Boolean _oFPATSETTPSRC = (input & 1 << 9) > 0;
+ final Boolean _oFPATSETTPDST = (input & 1 << 10) > 0;
+ final Boolean _oFPATENQUEUE = (input & 1 << 11) > 0;
+ final Boolean _oFPATVENDOR = (input & 1 << 12) > 0;
return new ActionTypeV10(_oFPATENQUEUE, _oFPATOUTPUT, _oFPATSETDLDST, _oFPATSETDLSRC, _oFPATSETNWDST,
_oFPATSETNWSRC, _oFPATSETNWTOS, _oFPATSETTPDST, _oFPATSETTPSRC, _oFPATSETVLANPCP, _oFPATSETVLANVID,
_oFPATSTRIPVLAN, _oFPATVENDOR);
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for OF10FlowModInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class OF10FlowModInputMessageFactoryTest {
private OFSerializer<FlowModInput> flowModFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * @throws Exception
- * Testing of {@link OF10FlowModInputMessageFactory} for correct translation from POJO
+ * Testing of {@link OF10FlowModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testFlowModInputMessageFactory() throws Exception {
builder.setBufferId(2L);
builder.setOutPort(new PortNumber(4422L));
builder.setFlagsV10(new FlowModFlagsV10(true, false, true));
- List<Action> actions = new ArrayList<>();
+ final List<Action> actions = new ArrayList<>();
ActionBuilder actionBuilder = new ActionBuilder();
SetNwDstCaseBuilder nwDstCaseBuilder = new SetNwDstCaseBuilder();
SetNwDstActionBuilder nwDstBuilder = new SetNwDstActionBuilder();
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10FlowRemovedMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10FlowRemovedMessageFactoryTest {
private OFSerializer<FlowRemovedMessage> factory;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for OF10HelloInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class OF10HelloInputMessageFactoryTest {
private OFSerializer<HelloInput> helloFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link OF10HelloInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link OF10HelloInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testWithoutElementsSet() throws Exception {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10PacketInMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10PacketInMessageFactoryTest {
private OFSerializer<PacketInMessage> factory;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for OF10PacketOutInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class OF10PacketOutInputMessageFactoryTest {
private OFSerializer<PacketOutInput> packetOutFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link OF10PacketOutInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link OF10PacketOutInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testPacketOutInputMessage() throws Exception {
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
builder.setBufferId(256L);
builder.setInPort(new PortNumber(257L));
- List<Action> actions = new ArrayList<>();
- ActionBuilder actionBuilder = new ActionBuilder();
+ final List<Action> actions = new ArrayList<>();
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
outputBuilder.setPort(new PortNumber(42L));
outputBuilder.setMaxLength(50);
caseBuilder.setOutputAction(outputBuilder.build());
+ ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(caseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
}
/**
- * Testing of {@link OF10PacketOutInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link OF10PacketOutInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testPacketOutInputWithNoData() throws Exception {
out.skipBytes(8); // skip packet out message to data index
Assert.assertTrue("Unread data", out.readableBytes() == 0);
}
-}
\ No newline at end of file
+}
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
import org.opendaylight.openflowjava.util.ByteBufUtils;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for OF10PortModInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class OF10PortModInputMessageFactoryTest {
private OFSerializer<PortModInput> portModFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link OF10PortModInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link OF10PortModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testPortModInput() throws Exception {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10PortStatusMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10PortStatusMessageFactoryTest {
private OFSerializer<PortStatusMessage> factory;
}
private static PortConfigV10 createPortConfig(long input) {
- final Boolean _portDown = ((input) & (1 << 0)) > 0;
- final Boolean _noStp = ((input) & (1 << 1)) > 0;
- final Boolean _noRecv = ((input) & (1 << 2)) > 0;
- final Boolean _noRecvStp = ((input) & (1 << 3)) > 0;
- final Boolean _noFlood = ((input) & (1 << 4)) > 0;
- final Boolean _noFwd = ((input) & (1 << 5)) > 0;
- final Boolean _noPacketIn = ((input) & (1 << 6)) > 0;
+ final Boolean _portDown = (input & 1 << 0) > 0;
+ final Boolean _noStp = (input & 1 << 1) > 0;
+ final Boolean _noRecv = (input & 1 << 2) > 0;
+ final Boolean _noRecvStp = (input & 1 << 3) > 0;
+ final Boolean _noFlood = (input & 1 << 4) > 0;
+ final Boolean _noFwd = (input & 1 << 5) > 0;
+ final Boolean _noPacketIn = (input & 1 << 6) > 0;
return new PortConfigV10(_noFlood, _noFwd, _noPacketIn, _noRecv, _noRecvStp, _noStp, _portDown);
}
private static PortFeaturesV10 createPortFeatures(long input) {
- final Boolean _10mbHd = ((input) & (1 << 0)) > 0;
- final Boolean _10mbFd = ((input) & (1 << 1)) > 0;
- final Boolean _100mbHd = ((input) & (1 << 2)) > 0;
- final Boolean _100mbFd = ((input) & (1 << 3)) > 0;
- final Boolean _1gbHd = ((input) & (1 << 4)) > 0;
- final Boolean _1gbFd = ((input) & (1 << 5)) > 0;
- final Boolean _10gbFd = ((input) & (1 << 6)) > 0;
- final Boolean _copper = ((input) & (1 << 7)) > 0;
- final Boolean _fiber = ((input) & (1 << 8)) > 0;
- final Boolean _autoneg = ((input) & (1 << 9)) > 0;
- final Boolean _pause = ((input) & (1 << 10)) > 0;
- final Boolean _pauseAsym = ((input) & (1 << 11)) > 0;
+ final Boolean _10mbHd = (input & 1 << 0) > 0;
+ final Boolean _10mbFd = (input & 1 << 1) > 0;
+ final Boolean _100mbHd = (input & 1 << 2) > 0;
+ final Boolean _100mbFd = (input & 1 << 3) > 0;
+ final Boolean _1gbHd = (input & 1 << 4) > 0;
+ final Boolean _1gbFd = (input & 1 << 5) > 0;
+ final Boolean _10gbFd = (input & 1 << 6) > 0;
+ final Boolean _copper = (input & 1 << 7) > 0;
+ final Boolean _fiber = (input & 1 << 8) > 0;
+ final Boolean _autoneg = (input & 1 << 9) > 0;
+ final Boolean _pause = (input & 1 << 10) > 0;
+ final Boolean _pauseAsym = (input & 1 << 11) > 0;
return new PortFeaturesV10(_100mbFd, _100mbHd, _10gbFd, _10mbFd, _10mbHd, _1gbFd, _1gbHd, _autoneg, _copper,
_fiber, _pause, _pauseAsym);
}
private static PortStateV10 createPortState(long input) {
- final Boolean _linkDown = ((input) & (1 << 0)) > 0;
- final Boolean _blocked = ((input) & (1 << 1)) > 0;
- final Boolean _live = ((input) & (1 << 2)) > 0;
- final Boolean _stpListen = ((input) & (1 << 3)) > 0;
- final Boolean _stpLearn = ((input) & (1 << 4)) > 0;
- final Boolean _stpForward = ((input) & (1 << 5)) > 0;
- final Boolean _stpBlock = ((input) & (1 << 6)) > 0;
- final Boolean _stpMask = ((input) & (1 << 7)) > 0;
+ final Boolean _linkDown = (input & 1 << 0) > 0;
+ final Boolean _blocked = (input & 1 << 1) > 0;
+ final Boolean _live = (input & 1 << 2) > 0;
+ final Boolean _stpListen = (input & 1 << 3) > 0;
+ final Boolean _stpLearn = (input & 1 << 4) > 0;
+ final Boolean _stpForward = (input & 1 << 5) > 0;
+ final Boolean _stpBlock = (input & 1 << 6) > 0;
+ final Boolean _stpMask = (input & 1 << 7) > 0;
return new PortStateV10(_blocked, _linkDown, _live, _stpBlock, _stpForward, _stpLearn, _stpListen, _stpMask);
}
}
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInputBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for OF10QueueGetConfigInputMessageFactory.
*
+ * @author michal.polkorab
*/
public class OF10QueueGetConfigInputMessageFactoryTest {
private OFSerializer<GetQueueConfigInput> queueFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link OF10QueueGetConfigInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link OF10QueueGetConfigInputMessageFactory} for correct translation from POJO.
*/
@Test
public void test() throws Exception {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueuePropertyBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10QueueGetConfigReplyMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10QueueGetConfigReplyMessageFactoryTest {
private OFSerializer<GetQueueConfigOutput> factory;
}
private static List<QueueProperty> createPropertiesList() {
- List<QueueProperty> propertiesList = new ArrayList<>();
+ final List<QueueProperty> propertiesList = new ArrayList<>();
QueuePropertyBuilder pb = new QueuePropertyBuilder();
pb.setProperty(QueueProperties.forValue(1));
RateQueuePropertyBuilder rateBuilder = new RateQueuePropertyBuilder();
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.multipart.reply.table.TableStatsBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10StatsReplyMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10StatsReplyMessageFactoryTest {
private OFSerializer<MultipartReplyMessage> factory;
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
builder.setFlags(new MultipartRequestFlags(true));
builder.setType(MultipartType.forValue(0));
- MultipartReplyDescCaseBuilder descCase = new MultipartReplyDescCaseBuilder();
+ final MultipartReplyDescCaseBuilder descCase = new MultipartReplyDescCaseBuilder();
MultipartReplyDescBuilder desc = new MultipartReplyDescBuilder();
desc.setMfrDesc("Test");
desc.setHwDesc("Test");
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
builder.setFlags(new MultipartRequestFlags(true));
builder.setType(MultipartType.forValue(2));
- MultipartReplyAggregateCaseBuilder aggregateCase = new MultipartReplyAggregateCaseBuilder();
+ final MultipartReplyAggregateCaseBuilder aggregateCase = new MultipartReplyAggregateCaseBuilder();
MultipartReplyAggregateBuilder aggregate = new MultipartReplyAggregateBuilder();
aggregate.setPacketCount(BigInteger.valueOf(1234L));
aggregate.setByteCount(BigInteger.valueOf(1234L));
builder.setRxOverErr(BigInteger.valueOf(1L));
builder.setRxCrcErr(BigInteger.valueOf(1L));
builder.setCollisions(BigInteger.valueOf(1L));
- List<PortStats> list = new ArrayList<PortStats>();
+ List<PortStats> list = new ArrayList<>();
list.add(builder.build());
return list;
}
builder.setCookie(BigInteger.valueOf(1234L));
builder.setPacketCount(BigInteger.valueOf(1234L));
builder.setByteCount(BigInteger.valueOf(1234L));
- List<Action> actions = new ArrayList<>();
- ActionBuilder actionBuilder = new ActionBuilder();
+ final List<Action> actions = new ArrayList<>();
+ final ActionBuilder actionBuilder = new ActionBuilder();
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
outputBuilder.setPort(new PortNumber(42L));
actionBuilder.setActionChoice(caseBuilder.build());
actions.add(actionBuilder.build());
builder.setAction(actions);
- List<FlowStats> list = new ArrayList<FlowStats>();
+ List<FlowStats> list = new ArrayList<>();
list.add(builder.build());
return list;
}
private static MultipartRequestFlags createMultipartRequestFlags(int input) {
- final Boolean one = ((input) & (1 << 0)) > 0;
+ final Boolean one = (input & 1 << 0) > 0;
return new MultipartRequestFlags(one);
}
private static MultipartReplyDescCase decodeDescBody(ByteBuf output) {
- MultipartReplyDescCaseBuilder descCase = new MultipartReplyDescCaseBuilder();
+ final MultipartReplyDescCaseBuilder descCase = new MultipartReplyDescCaseBuilder();
MultipartReplyDescBuilder desc = new MultipartReplyDescBuilder();
byte[] mfrDesc = new byte[256];
output.readBytes(mfrDesc);
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for OF10StatsRequestInputFactory.
*
+ * @author michal.polkorab
*/
public class OF10StatsRequestInputFactoryTest {
private OFSerializer<MultipartRequestInput> multipartFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing OF10StatsRequestInputFactory (Desc) for correct serialization
- * @throws Exception
+ * Testing OF10StatsRequestInputFactory (Desc) for correct serialization.
*/
@Test
public void testDesc() throws Exception {
}
/**
- * Testing OF10StatsRequestInputFactory (Flow) for correct serialization
- * @throws Exception
+ * Testing OF10StatsRequestInputFactory (Flow) for correct serialization.
*/
@Test
public void testFlow() throws Exception {
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
builder.setType(MultipartType.OFPMPFLOW);
builder.setFlags(new MultipartRequestFlags(false));
- MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
- MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
+ final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
+ final MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
MatchV10Builder matchBuilder = new MatchV10Builder();
matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true,
true, true, true, true));
}
/**
- * Testing OF10StatsRequestInputFactory (Aggregate) for correct serialization
- * @throws Exception
+ * Testing OF10StatsRequestInputFactory (Aggregate) for correct serialization.
*/
@Test
public void testAggregate() throws Exception {
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
builder.setType(MultipartType.OFPMPAGGREGATE);
builder.setFlags(new MultipartRequestFlags(false));
- MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
- MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
+ final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
+ final MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
MatchV10Builder matchBuilder = new MatchV10Builder();
matchBuilder.setWildcards(new FlowWildcardsV10(false, false, false, false,
false, false, false, false, false, false));
}
/**
- * Testing OF10StatsRequestInputFactory (Table) for correct serialization
- * @throws Exception
+ * Testing OF10StatsRequestInputFactory (Table) for correct serialization.
*/
@Test
public void testTable() throws Exception {
}
/**
- * Testing OF10StatsRequestInputFactory (Port) for correct serialization
- * @throws Exception
+ * Testing OF10StatsRequestInputFactory (Port) for correct serialization.
*/
@Test
public void testPort() throws Exception {
}
/**
- * Testing OF10StatsRequestInputFactory (Queue) for correct serialization
- * @throws Exception
+ * Testing OF10StatsRequestInputFactory (Queue) for correct serialization.
*/
@Test
public void testQueue() throws Exception {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for PacketInMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class PacketInMessageFactoryTest {
private OFSerializer<PacketInMessage> factory;
builder.setCookie(new BigInteger(1, cookie));
MatchBuilder matchBuilder = new MatchBuilder();
matchBuilder.setType(OxmMatchType.class);
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(InPhyPort.class);
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInputBuilder;
/**
- * @author timotej.kubas
+ * Unit tests for PacketOutInputMessageFactory.
*
+ * @author timotej.kubas
*/
public class PacketOutInputMessageFactoryTest {
private static final byte MESSAGE_TYPE = 13;
private OFSerializer<PacketOutInput> packetOutFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link PacketOutInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link PacketOutInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testPacketOutInputMessage() throws Exception {
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setBufferId(256L);
builder.setInPort(new PortNumber(256L));
- List<Action> actions = new ArrayList<>();
+ final List<Action> actions = new ArrayList<>();
ActionBuilder actionBuilder = new ActionBuilder();
PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();
PushVlanActionBuilder pushVlanBuilder = new PushVlanActionBuilder();
}
/**
- * Testing of {@link PacketOutInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link PacketOutInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testPacketOutInputWithNoData() throws Exception {
out.skipBytes(16); // skip packet out message to data index
Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
}
-}
\ No newline at end of file
+}
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
import org.opendaylight.openflowjava.util.ByteBufUtils;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder;
/**
+ * Unit tests for PortModInputMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFSerializer<PortModInput> portModFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link PortModInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link PortModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testPortModInput() throws Exception {
false, false, false, true,
false, false, false, false,
false, false, false, false));
- PortModInput message = builder.build();
+ final PortModInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_03);
}
- private static PortConfig createPortConfig(long input){
- final Boolean _portDown = ((input) & (1<<0)) > 0;
- final Boolean _noRecv = ((input) & (1<<2)) > 0;
- final Boolean _noFwd = ((input) & (1<<5)) > 0;
- final Boolean _noPacketIn = ((input) & (1<<6)) > 0;
+ private static PortConfig createPortConfig(long input) {
+ final Boolean _portDown = (input & 1 << 0) > 0;
+ final Boolean _noRecv = (input & 1 << 2) > 0;
+ final Boolean _noFwd = (input & 1 << 5) > 0;
+ final Boolean _noPacketIn = (input & 1 << 6) > 0;
return new PortConfig(_noFwd, _noPacketIn, _noRecv, _portDown);
}
- private static PortFeatures createPortFeatures(long input){
- final Boolean _10mbHd = ((input) & (1<<0)) > 0;
- final Boolean _10mbFd = ((input) & (1<<1)) > 0;
- final Boolean _100mbHd = ((input) & (1<<2)) > 0;
- final Boolean _100mbFd = ((input) & (1<<3)) > 0;
- final Boolean _1gbHd = ((input) & (1<<4)) > 0;
- final Boolean _1gbFd = ((input) & (1<<5)) > 0;
- final Boolean _10gbFd = ((input) & (1<<6)) > 0;
- final Boolean _40gbFd = ((input) & (1<<7)) > 0;
- final Boolean _100gbFd = ((input) & (1<<8)) > 0;
- final Boolean _1tbFd = ((input) & (1<<9)) > 0;
- final Boolean _other = ((input) & (1<<10)) > 0;
- final Boolean _copper = ((input) & (1<<11)) > 0;
- final Boolean _fiber = ((input) & (1<<12)) > 0;
- final Boolean _autoneg = ((input) & (1<<13)) > 0;
- final Boolean _pause = ((input) & (1<<14)) > 0;
- final Boolean _pauseAsym = ((input) & (1<<15)) > 0;
+ private static PortFeatures createPortFeatures(long input) {
+ final Boolean _10mbHd = (input & 1 << 0) > 0;
+ final Boolean _10mbFd = (input & 1 << 1) > 0;
+ final Boolean _100mbHd = (input & 1 << 2) > 0;
+ final Boolean _100mbFd = (input & 1 << 3) > 0;
+ final Boolean _1gbHd = (input & 1 << 4) > 0;
+ final Boolean _1gbFd = (input & 1 << 5) > 0;
+ final Boolean _10gbFd = (input & 1 << 6) > 0;
+ final Boolean _40gbFd = (input & 1 << 7) > 0;
+ final Boolean _100gbFd = (input & 1 << 8) > 0;
+ final Boolean _1tbFd = (input & 1 << 9) > 0;
+ final Boolean _other = (input & 1 << 10) > 0;
+ final Boolean _copper = (input & 1 << 11) > 0;
+ final Boolean _fiber = (input & 1 << 12) > 0;
+ final Boolean _autoneg = (input & 1 << 13) > 0;
+ final Boolean _pause = (input & 1 << 14) > 0;
+ final Boolean _pauseAsym = (input & 1 << 15) > 0;
return new PortFeatures(_100gbFd, _100mbFd, _100mbHd, _10gbFd, _10mbFd, _10mbHd,
_1gbFd, _1gbHd, _1tbFd, _40gbFd, _autoneg, _copper, _fiber, _other, _pause, _pauseAsym);
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for PortStatusMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class PortStatusMessageFactoryTest {
private OFSerializer<PortStatusMessage> factory;
}
private static PortConfig createPortConfig(long input) {
- final Boolean _portDown = ((input) & (1 << 0)) > 0;
- final Boolean _noRecv = ((input) & (1 << 2)) > 0;
- final Boolean _noFwd = ((input) & (1 << 5)) > 0;
- final Boolean _noPacketIn = ((input) & (1 << 6)) > 0;
+ final Boolean _portDown = (input & 1 << 0) > 0;
+ final Boolean _noRecv = (input & 1 << 2) > 0;
+ final Boolean _noFwd = (input & 1 << 5) > 0;
+ final Boolean _noPacketIn = (input & 1 << 6) > 0;
return new PortConfig(_noFwd, _noPacketIn, _noRecv, _portDown);
}
private static PortFeatures createPortFeatures(long input) {
- final Boolean _10mbHd = ((input) & (1 << 0)) > 0;
- final Boolean _10mbFd = ((input) & (1 << 1)) > 0;
- final Boolean _100mbHd = ((input) & (1 << 2)) > 0;
- final Boolean _100mbFd = ((input) & (1 << 3)) > 0;
- final Boolean _1gbHd = ((input) & (1 << 4)) > 0;
- final Boolean _1gbFd = ((input) & (1 << 5)) > 0;
- final Boolean _10gbFd = ((input) & (1 << 6)) > 0;
- final Boolean _40gbFd = ((input) & (1 << 7)) > 0;
- final Boolean _100gbFd = ((input) & (1 << 8)) > 0;
- final Boolean _1tbFd = ((input) & (1 << 9)) > 0;
- final Boolean _other = ((input) & (1 << 10)) > 0;
- final Boolean _copper = ((input) & (1 << 11)) > 0;
- final Boolean _fiber = ((input) & (1 << 12)) > 0;
- final Boolean _autoneg = ((input) & (1 << 13)) > 0;
- final Boolean _pause = ((input) & (1 << 14)) > 0;
- final Boolean _pauseAsym = ((input) & (1 << 15)) > 0;
+ final Boolean _10mbHd = (input & 1 << 0) > 0;
+ final Boolean _10mbFd = (input & 1 << 1) > 0;
+ final Boolean _100mbHd = (input & 1 << 2) > 0;
+ final Boolean _100mbFd = (input & 1 << 3) > 0;
+ final Boolean _1gbHd = (input & 1 << 4) > 0;
+ final Boolean _1gbFd = (input & 1 << 5) > 0;
+ final Boolean _10gbFd = (input & 1 << 6) > 0;
+ final Boolean _40gbFd = (input & 1 << 7) > 0;
+ final Boolean _100gbFd = (input & 1 << 8) > 0;
+ final Boolean _1tbFd = (input & 1 << 9) > 0;
+ final Boolean _other = (input & 1 << 10) > 0;
+ final Boolean _copper = (input & 1 << 11) > 0;
+ final Boolean _fiber = (input & 1 << 12) > 0;
+ final Boolean _autoneg = (input & 1 << 13) > 0;
+ final Boolean _pause = (input & 1 << 14) > 0;
+ final Boolean _pauseAsym = (input & 1 << 15) > 0;
return new PortFeatures(_100gbFd, _100mbFd, _100mbHd, _10gbFd, _10mbFd, _10mbHd, _1gbFd, _1gbHd, _1tbFd,
_40gbFd, _autoneg, _copper, _fiber, _other, _pause, _pauseAsym);
}
private static PortState createPortState(long input) {
- final Boolean one = ((input) & (1 << 0)) > 0;
- final Boolean two = ((input) & (1 << 1)) > 0;
- final Boolean three = ((input) & (1 << 2)) > 0;
+ final Boolean one = (input & 1 << 0) > 0;
+ final Boolean two = (input & 1 << 1) > 0;
+ final Boolean three = (input & 1 << 2) > 0;
return new PortState(two, one, three);
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueuePropertyBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for QueueGetConfigReplyMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class QueueGetConfigReplyMessageFactoryTest {
private OFSerializer<GetQueueConfigOutput> factory;
}
private static List<QueueProperty> createPropertiesList() {
- List<QueueProperty> propertiesList = new ArrayList<>();
+ final List<QueueProperty> propertiesList = new ArrayList<>();
QueuePropertyBuilder pb = new QueuePropertyBuilder();
pb.setProperty(QueueProperties.forValue(2));
RateQueuePropertyBuilder rateBuilder = new RateQueuePropertyBuilder();
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutputBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for RoleReplyMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class RoleReplyMessageFactoryTest {
private OFSerializer<RoleRequestOutput> factory;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.math.BigInteger;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ControllerRole;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestInputBuilder;
/**
+ * Unit tests for RoleRequestInputMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFSerializer<RoleRequestInput> roleFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link RoleRequestInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link RoleRequestInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testRoleRequestInputMessage() throws Exception {
roleFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, MESSAGE_LENGTH);
- Assert.assertEquals("Wrong role", message.getRole().getIntValue(), ControllerRole.forValue((int) out.readUnsignedInt()).getIntValue());
+ Assert.assertEquals("Wrong role", message.getRole().getIntValue(),
+ ControllerRole.forValue((int) out.readUnsignedInt()).getIntValue());
out.skipBytes(PADDING_IN_ROLE_REQUEST_MESSAGE);
byte[] genId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
out.readBytes(genId);
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PortStatusMaskBuilder;
/**
+ * Unit tests for SetAsyncInputMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFSerializer<SetAsyncInput> setAsyncFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * @throws Exception
- * Testing of {@link SetAsyncInputMessageFactory} for correct translation from POJO
+ * Testing of {@link SetAsyncInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testSetAsyncInputMessage() throws Exception {
}
private static List<PacketInMask> createPacketInMask() {
- List<PacketInMask> masks = new ArrayList<>();
+ final List<PacketInMask> masks = new ArrayList<>();
PacketInMaskBuilder builder;
// OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
builder = new PacketInMaskBuilder();
}
private static List<PortStatusMask> createPortStatusMask() {
- List<PortStatusMask> masks = new ArrayList<>();
+ final List<PortStatusMask> masks = new ArrayList<>();
PortStatusMaskBuilder builder;
builder = new PortStatusMaskBuilder();
// OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
}
private static List<FlowRemovedMask> createFlowRemowedMask() {
- List<FlowRemovedMask> masks = new ArrayList<>();
+ final List<FlowRemovedMask> masks = new ArrayList<>();
FlowRemovedMaskBuilder builder;
// OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
builder = new FlowRemovedMaskBuilder();
}
/**
- * @throws Exception
- * Testing of {@link SetAsyncInputMessageFactory} for correct translation from POJO
+ * Testing of {@link SetAsyncInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testSetAsyncInputWithNullMasks() throws Exception {
BufferHelper.checkHeaderV13(out,(byte) 28, 8);
Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
}
-}
\ No newline at end of file
+}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder;
/**
+ * Unit tests for SetConfigMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFSerializer<SetConfigInput> setConfigFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link SetConfigMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link SetConfigMessageFactory} for correct translation from POJO.
*/
@Test
public void testSetConfigMessageV13() throws Exception {
}
/**
- * Testing of {@link SetConfigMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link SetConfigMessageFactory} for correct translation from POJO.
*/
@Test
public void testSetConfigMessageV10() throws Exception {
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInputBuilder;
/**
+ * Unit tests for TableModInputMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFSerializer<TableModInput> tableModFactory;
/**
- * Initializes serializer registry and stores correct factory in field
+ * Initializes serializer registry and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link TableModInputMessageFactory} for correct translation from POJO
- * @throws Exception
+ * Testing of {@link TableModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testTableModInput() throws Exception {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
/**
- * @author michal.polkorab
+ * Unit tests for VendorInputMessageFactory.
*
+ * @author michal.polkorab
*/
@RunWith(MockitoJUnitRunner.class)
public class VendorInputMessageFactoryTest {
VendorInputMessageFactory serializer;
/**
- * Tests {@link VendorInputMessageFactory#serialize(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterOfMessage, ByteBuf)}
+ * Tests {@link VendorInputMessageFactory#serialize(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
+ * .protocol.rev130731.ExperimenterOfMessage, ByteBuf)}.
*/
@Test
public void test() {
.thenReturn(serializer);
VendorInputMessageFactory factory = new VendorInputMessageFactory();
factory.injectSerializerRegistry(registry);
- ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
+ final ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
builder.setXid(12345L);
Mockito.when(registry.getSerializer(Matchers.<ExperimenterIdSerializerKey<ExperimenterDataOfChoice>>any()))
.thenReturn(foundSerializer);
factory.serialize(experimenterInput, buffer);
- Mockito.verify(foundSerializer, Mockito.times(1)).serialize(experimenterInput.getExperimenterDataOfChoice(), buffer);
+ Mockito.verify(foundSerializer, Mockito.times(1))
+ .serialize(experimenterInput.getExperimenterDataOfChoice(), buffer);
}
-}
\ No newline at end of file
+}
package org.opendaylight.openflowjava.protocol.impl.util;
import io.netty.buffer.ByteBuf;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.LoggerFactory;
/**
- * @author michal.polkorab
+ * Unit tests for ActionsDeserializer.
*
+ * @author michal.polkorab
*/
public class ActionsDeserializerTest {
private DeserializerRegistry registry;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing actions deserialization
+ * Testing actions deserialization.
*/
@Test
public void test() {
}
/**
- * Tests {@link AbstractActionDeserializer#deserializeHeader(ByteBuf)}
+ * Tests {@link AbstractActionDeserializer#deserializeHeader(ByteBuf)}.
*/
@Test
public void testDeserializeHeader() {
Assert.assertTrue("Wrong action type", actions.get(0).getActionChoice() instanceof OutputActionCase);
Assert.assertNull("Wrong action port", ((OutputActionCase) actions.get(0).getActionChoice()).getOutputAction());
- Assert.assertNull("Wrong action max-length", ((OutputActionCase) actions.get(0).getActionChoice()).getOutputAction());
+ Assert.assertNull("Wrong action max-length",
+ ((OutputActionCase) actions.get(0).getActionChoice()).getOutputAction());
Assert.assertTrue("Wrong action type", actions.get(1).getActionChoice() instanceof SetFieldCase);
- Assert.assertNull("Wrong action oxm field", ((SetFieldCase) actions.get(1).getActionChoice()).getSetFieldAction());
+ Assert.assertNull("Wrong action oxm field",
+ ((SetFieldCase) actions.get(1).getActionChoice()).getSetFieldAction());
}
}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-
import org.junit.Assert;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.yangtools.yang.binding.DataObject;
/**
- * @author michal.polkorab
+ * Helper class for buffers.
*
+ * @author michal.polkorab
*/
public abstract class BufferHelper {
- /**
- *
- */
public static final Long DEFAULT_XID = 0x01020304L;
private static final byte[] XID = new byte[] { 0x01, 0x02, 0x03, 0x04 };
/**
- * @param payload
+ * Build a ByteBuffer.
+ *
+ * @param payload the payload data
* @return ByteBuf filled with OpenFlow protocol message without first 4
* bytes
*/
}
/**
+ * Build a ByteBuffer.
+ *
* @param payload String in hex format
* @return ByteBuf filled with OpenFlow protocol message without first 4
* bytes
}
/**
+ * Build a ByteBuffer.
+ *
* @return ByteBuf filled with OpenFlow protocol header message without first 4
* bytes
*/
}
/**
- * Use version 1.3 for encoded message
+ * Use version 1.3 for encoded message.
+ *
* @param input ByteBuf to be checked for correct OpenFlow Protocol header
* @param msgType type of received message
* @param length expected length of message in header
}
/**
- * Use version 1.0 for encoded message
+ * Checks a 1.3 header.
+ *
+ * @param ofHeader OpenFlow protocol header
+ */
+ public static void checkHeaderV13(OfHeader ofHeader) {
+ checkHeader(ofHeader, (short) EncodeConstants.OF13_VERSION_ID);
+ }
+
+ /**
+ * Use version 1.0 for encoded message.
+ *
* @param input ByteBuf to be checked for correct OpenFlow Protocol header
* @param msgType type of received message
* @param length expected length of message in header
checkHeader(input, msgType, length, (short) EncodeConstants.OF10_VERSION_ID);
}
- private static void checkHeader(ByteBuf input, byte msgType, int length, Short version) {
- Assert.assertEquals("Wrong version", version, Short.valueOf(input.readByte()));
- Assert.assertEquals("Wrong type", msgType, input.readByte());
- Assert.assertEquals("Wrong length", length, input.readUnsignedShort());
- Assert.assertEquals("Wrong Xid", DEFAULT_XID, Long.valueOf(input.readUnsignedInt()));
- }
-
-
- /**
- * @param ofHeader OpenFlow protocol header
- */
- public static void checkHeaderV13(OfHeader ofHeader) {
- checkHeader(ofHeader, (short) EncodeConstants.OF13_VERSION_ID);
- }
-
/**
+ * Checks a 1.0 header.
+ *
* @param ofHeader OpenFlow protocol header
*/
public static void checkHeaderV10(OfHeader ofHeader) {
checkHeader(ofHeader, (short) EncodeConstants.OF10_VERSION_ID);
}
+ private static void checkHeader(ByteBuf input, byte msgType, int length, Short version) {
+ Assert.assertEquals("Wrong version", version, Short.valueOf(input.readByte()));
+ Assert.assertEquals("Wrong type", msgType, input.readByte());
+ Assert.assertEquals("Wrong length", length, input.readUnsignedShort());
+ Assert.assertEquals("Wrong Xid", DEFAULT_XID, Long.valueOf(input.readUnsignedInt()));
+ }
+
/**
* Check version and xid of OFP header.
+ *
* @param ofHeader OpenFlow protocol header
* @param version OpenFlow protocol version
*/
}
/**
- * @param builder
+ * Sets up a header.
+ *
+ * @param builder builder
* @param version wire protocol number used
- * @throws NoSuchMethodException
- * @throws SecurityException
- * @throws IllegalAccessException
- * @throws IllegalArgumentException
- * @throws InvocationTargetException
*/
- public static void setupHeader(Object builder, int version) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- Method m = builder.getClass().getMethod("setVersion", Short.class);
- m.invoke(builder, (short) version);
+ public static void setupHeader(Object builder, int version) throws NoSuchMethodException, SecurityException,
+ IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ Method method = builder.getClass().getMethod("setVersion", Short.class);
+ method.invoke(builder, (short) version);
Method m2 = builder.getClass().getMethod("setXid", Long.class);
m2.invoke(builder, BufferHelper.DEFAULT_XID);
}
/**
- * Decode message
+ * Decode message.
+ *
* @param decoder decoder instance
* @param bb data input buffer
* @return message decoded pojo
package org.opendaylight.openflowjava.protocol.impl.util;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
/**
- * @author michal.polkorab
+ * Unit tests for CodeKeyMakerFactory.
*
+ * @author michal.polkorab
*/
public class CodeKeyMakerFactoryTest {
/**
- * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+ * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}.
*/
@Test
public void testMatchEntriesKeyMaker() {
}
/**
- * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+ * Tests {@link CodeKeyMakerFactory#createMatchEntriesKeyMaker(short)}.
*/
@Test
public void testExperimenterMatchEntriesKeyMaker() {
MessageCodeKey codeKey = keyMaker.make(buffer);
Assert.assertNotNull("Null key", codeKey);
- MatchEntryDeserializerKey comparationKey = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 65535, 0);
+ MatchEntryDeserializerKey comparationKey =
+ new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 65535, 0);
comparationKey.setExperimenterId(1L);
Assert.assertEquals("Wrong key", comparationKey, codeKey);
Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());
}
/**
- * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}
+ * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}.
*/
@Test
public void testActionKeyMaker() {
}
/**
- * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}
+ * Tests {@link CodeKeyMakerFactory#createActionsKeyMaker(short)}.
*/
@Test
public void testExperimenterActionKeyMaker() {
}
/**
- * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}
+ * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}.
*/
@Test
public void testInstructionKeyMaker() {
}
/**
- * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}
+ * Tests {@link CodeKeyMakerFactory#createInstructionsKeyMaker(short)}.
*/
@Test
public void testExperimenterInstructionKeyMaker() {
65535, 1L), codeKey);
Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes());
}
-}
\ No newline at end of file
+}
protected void testHeaderVersions(final List<Byte> versions, final ByteBuf buffer) {
for (short version : versions) {
ByteBuf bb = buffer.copy();
- OFDeserializer<T> factory = registry.getDeserializer(
+ OFDeserializer<T> serializer = registry.getDeserializer(
new MessageCodeKey(version, messageCodeKey.getMsgType(), messageCodeKey.getClazz()));
- T builtByFactory = BufferHelper.deserialize(factory, bb);
+ T builtByFactory = BufferHelper.deserialize(serializer, bb);
BufferHelper.checkHeader((OfHeader) builtByFactory, version);
}
}
package org.opendaylight.openflowjava.protocol.impl.util;
import io.netty.buffer.ByteBuf;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
/**
- * @author michal.polkorab
+ * Unit tests for InstructionsDeserializer.
*
+ * @author michal.polkorab
*/
public class InstructionsDeserializerTest {
private DeserializerRegistry registry;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing instructions translation
+ * Testing instructions translation.
*/
@Test
public void test() {
.getMaxLength().intValue());
Action action2 = ((WriteActionsCase) i5.getInstructionChoice()).getWriteActions().getAction().get(1);
Assert.assertTrue("Wrong action", action2.getActionChoice() instanceof GroupCase);
- Assert.assertEquals("Wrong action", 80, ((GroupCase) action2.getActionChoice()).getGroupAction().getGroupId().intValue());
+ Assert.assertEquals("Wrong action", 80,
+ ((GroupCase) action2.getActionChoice()).getGroupAction().getGroupId().intValue());
Instruction i6 = instructions.get(5);
Assert.assertTrue("Wrong type - i6", i6.getInstructionChoice() instanceof ApplyActionsCase);
Assert.assertEquals("Wrong instructions - i6", 2, ((ApplyActionsCase) i6.getInstructionChoice())
package org.opendaylight.openflowjava.protocol.impl.util;
-import java.util.List;
-
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
-
+import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.opendaylight.yangtools.yang.binding.DataObject;
/**
- * @author michal.polkorab
+ * Unit tests for ListDeserializer.
*
+ * @author michal.polkorab
*/
@RunWith(MockitoJUnitRunner.class)
public class ListDeserializerTest {
@Mock DeserializerRegistry registry;
/**
- * Tests {@link ListDeserializer#deserializeList(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}
+ * Tests {@link ListDeserializer#deserializeList(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}.
*/
@Test
public void test() {
}
/**
- * Tests {@link ListDeserializer#deserializeHeaders(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}
+ * Tests {@link ListDeserializer#deserializeHeaders(short, int, ByteBuf, CodeKeyMaker, DeserializerRegistry)}.
*/
@Test
public void test2() {
Assert.assertNull("List is not null", list);
}
-}
\ No newline at end of file
+}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
/**
- * @author michal.polkorab
+ * Unit tests for ListSerializer.
*
+ * @author michal.polkorab
*/
@RunWith(MockitoJUnitRunner.class)
public class ListSerializerTest {
/**
* Tests {@link ListSerializer#serializeHeaderList(List, TypeKeyMaker, SerializerRegistry, ByteBuf)}
- * with null List
+ * with null List.
*/
@Test
public void test() {
Assert.assertEquals("Data written to buffer", 0, buffer.readableBytes());
}
-}
\ No newline at end of file
+}
package org.opendaylight.openflowjava.protocol.impl.util;
import io.netty.buffer.ByteBuf;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match;
/**
- * @author michal.polkorab
+ * Unit tests for MatchDeserializer.
*
+ * @author michal.polkorab
*/
public class MatchDeserializerTest {
private DeserializerRegistry registry;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing Ipv4 address deserialization
+ * Testing Ipv4 address deserialization.
*/
@Test
public void testIpv4Address() {
}
/**
- * Testing Ipv6 address deserialization
+ * Testing Ipv6 address deserialization.
*/
@Test
public void testIpv6Address() {
}
/**
- * Testing match deserialization
+ * Testing match deserialization.
*/
@Test
public void testMatch() {
+ "80 00 4D 10 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 FF "
+ "80 00 4F 04 00 00 03 04");
- System.out.println(buffer.readableBytes());
Match match = matchDeserializer.deserialize(buffer);
Assert.assertEquals("Wrong match type", OxmMatchType.class, match.getType());
Assert.assertEquals("Wrong match entries size", 40, match.getMatchEntry().size());
}
/**
- * Testing header deserialization
+ * Testing header deserialization.
*/
@Test
public void testHeaders() {
}
/**
- * Testing standard match type
+ * Testing standard match type.
*/
@Test
public void testStandardMatch() {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
/**
- * @author michal.polkorab
+ * Unit tests for OF10ActionsDeserializer.
*
+ * @author michal.polkorab
*/
public class OF10ActionsDeserializerTest {
private DeserializerRegistry registry;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing correct deserialization of actions (OF v1.0)
+ * Testing correct deserialization of actions (OF v1.0).
*/
@Test
public void test() {
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueId;
/**
- * @author michal.polkorab
+ * Unit tests for OF10ActionsSerializer.
*
+ * @author michal.polkorab
*/
public class OF10ActionsSerializerTest {
private SerializerRegistry registry;
/**
- * Initializes serializer table and stores correct factory in field
+ * Initializes serializer table and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing correct serialization of actions (OF v1.0)
+ * Testing correct serialization of actions (OF v1.0).
*/
@Test
public void test() {
- List<Action> actions = new ArrayList<>();
- ActionBuilder actionBuilder = new ActionBuilder();
+ final List<Action> actions = new ArrayList<>();
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
outputBuilder.setPort(new PortNumber(42L));
outputBuilder.setMaxLength(32);
caseBuilder.setOutputAction(outputBuilder.build());
+ ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(caseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
package org.opendaylight.openflowjava.protocol.impl.util;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10;
/**
- * @author michal.polkorab
+ * Unit tests for OF10MatchDeserializer.
*
+ * @author michal.polkorab
*/
public class OF10MatchDeserializerTest {
private OFDeserializer<MatchV10> matchDeserializer;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing correct deserialization of ofp_match
+ * Testing correct deserialization of ofp_match.
*/
@Test
public void test() {
}
/**
- * Testing correct deserialization of ofp_match
+ * Testing correct deserialization of ofp_match.
*/
@Test
public void test2() {
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder;
/**
- * @author michal.polkorab
+ * Unit tests for OF10MatchSerializer.
*
+ * @author michal.polkorab
*/
public class OF10MatchSerializerTest {
private OFSerializer<MatchV10> matchSerializer;
/**
- * Initializes serializer table and stores correct factory in field
+ * Initializes serializer table and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing correct serialization of ofp_match
+ * Testing correct serialization of ofp_match.
*/
@Test
public void test() {
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ final ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
MatchV10Builder builder = new MatchV10Builder();
builder.setWildcards(new FlowWildcardsV10(false, false, true, false,
false, true, false, true, true, true));
}
/**
- * Testing correct serialization of ofp_match
+ * Testing correct serialization of ofp_match.
*/
@Test
public void test2() {
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ final ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
MatchV10Builder builder = new MatchV10Builder();
builder.setWildcards(new FlowWildcardsV10(true, true, true, true,
true, true, true, true, true, true));
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPortBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for OF13ActionsSerializer.
*
+ * @author michal.polkorab
*/
public class OF13ActionsSerializerTest {
private SerializerRegistry registry;
/**
- * Initializes serializer table and stores correct factory in field
+ * Initializes serializer table and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing correct serialization of actions
+ * Testing correct serialization of actions.
*/
@Test
public void test() {
- List<Action> actions = new ArrayList<>();
- ActionBuilder actionBuilder = new ActionBuilder();
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
outputBuilder.setPort(new PortNumber(42L));
outputBuilder.setMaxLength(52);
caseBuilder.setOutputAction(outputBuilder.build());
+ ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(caseBuilder.build());
+ List<Action> actions = new ArrayList<>();
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(new CopyTtlOutCaseBuilder().build());
actionBuilder.setActionChoice(new DecNwTtlCaseBuilder().build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
- SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
- SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
- List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
matchBuilder.setOxmClass(OpenflowBasicClass.class);
matchBuilder.setOxmMatchField(InPort.class);
inPortBuilder.setPortNumber(new PortNumber(1L));
inPortCaseBuilder.setInPort(inPortBuilder.build());
matchBuilder.setMatchEntryValue(inPortCaseBuilder.build());
+ List<MatchEntry> entries = new ArrayList<>();
entries.add(matchBuilder.build());
+ SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
setFieldBuilder.setMatchEntry(entries);
+ SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
setFieldCaseBuilder.setSetFieldAction(setFieldBuilder.build());
actionBuilder.setActionChoice(setFieldCaseBuilder.build());
actions.add(actionBuilder.build());
}
/**
- * Testing correct serialization of actions
+ * Testing correct serialization of actions.
*/
@Test
public void testHeaders() {
- List<Action> actions = new ArrayList<>();
- ActionBuilder actionBuilder = new ActionBuilder();
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
outputBuilder.setPort(new PortNumber(42L));
outputBuilder.setMaxLength(52);
caseBuilder.setOutputAction(outputBuilder.build());
+ ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(caseBuilder.build());
+ List<Action> actions = new ArrayList<>();
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
- SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
- SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
- List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
matchBuilder.setOxmClass(OpenflowBasicClass.class);
matchBuilder.setOxmMatchField(InPort.class);
inPortBuilder.setPortNumber(new PortNumber(1L));
inPortCaseBuilder.setInPort(inPortBuilder.build());
matchBuilder.setMatchEntryValue(inPortCaseBuilder.build());
+ List<MatchEntry> entries = new ArrayList<>();
entries.add(matchBuilder.build());
+ SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
setFieldBuilder.setMatchEntry(entries);
+ SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
setFieldCaseBuilder.setSetFieldAction(setFieldBuilder.build());
actionBuilder.setActionChoice(setFieldCaseBuilder.build());
actions.add(actionBuilder.build());
Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());
Assert.assertTrue("Unread data", out.readableBytes() == 0);
}
-}
\ No newline at end of file
+}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
/**
- * @author michal.polkorab
+ * Unit tests for OF13InstructionsSerializer.
*
+ * @author michal.polkorab
*/
public class OF13InstructionsSerializerTest {
private SerializerRegistry registry;
/**
- * Initializes serializer table and stores correct factory in field
+ * Initializes serializer table and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing instructions translation
+ * Testing instructions translation.
*/
@Test
public void test() {
- List<Instruction> instructions = new ArrayList<>();
+ final List<Instruction> instructions = new ArrayList<>();
// Goto_table instruction
InstructionBuilder builder = new InstructionBuilder();
GotoTableCaseBuilder gotoCaseBuilder = new GotoTableCaseBuilder();
instructions.add(builder.build());
// Write_actions instruction
builder = new InstructionBuilder();
- WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
- WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
- List<Action> actions = new ArrayList<>();
- ActionBuilder actionBuilder = new ActionBuilder();
+ final WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
+ final WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
outputBuilder.setPort(new PortNumber(45L));
outputBuilder.setMaxLength(55);
caseBuilder.setOutputAction(outputBuilder.build());
+ ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(caseBuilder.build());
+ List<Action> actions = new ArrayList<>();
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
SetNwTtlCaseBuilder ttlCaseBuilder = new SetNwTtlCaseBuilder();
instructions.add(builder.build());
// Apply_actions instruction
builder = new InstructionBuilder();
- ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
- ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
+ final ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
+ final ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
actions = new ArrayList<>();
actionBuilder = new ActionBuilder();
PushVlanCaseBuilder vlanCaseBuilder = new PushVlanCaseBuilder();
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for OF13MatchSerializer02.
*
+ * @author michal.polkorab
*/
public class OF13MatchSerializer02Test {
private OFSerializer<Match> matchSerializer;
/**
- * Initializes serializer table and stores correct factory in field
+ * Initializes serializer table and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Testing serialization of match
+ * Testing serialization of match.
*/
@Test
public void testEmptyMatch() {
}
/**
- * Testing serialization of match
+ * Testing serialization of match.
*/
@Test
public void test() {
MatchBuilder builder = new MatchBuilder();
builder.setType(OxmMatchType.class);
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entryBuilder = new MatchEntryBuilder();
entryBuilder.setOxmClass(OpenflowBasicClass.class);
entryBuilder.setOxmMatchField(InPort.class);
entryBuilder.setOxmClass(OpenflowBasicClass.class);
entryBuilder.setOxmMatchField(VlanVid.class);
entryBuilder.setHasMask(true);
- VlanVidCaseBuilder vlanVidCaseBuilder = new VlanVidCaseBuilder();
+ final VlanVidCaseBuilder vlanVidCaseBuilder = new VlanVidCaseBuilder();
VlanVidBuilder vlanVidBuilder = new VlanVidBuilder();
vlanVidBuilder.setVlanVid(45);
vlanVidBuilder.setCfiBit(true);
entryBuilder.setOxmClass(OpenflowBasicClass.class);
entryBuilder.setOxmMatchField(Icmpv6Code.class);
entryBuilder.setHasMask(false);
- Icmpv6CodeCaseBuilder Icmpv6CodeCaseBuilder = new Icmpv6CodeCaseBuilder();
- Icmpv6CodeBuilder Icmpv6CodeBuilder = new Icmpv6CodeBuilder();
- Icmpv6CodeBuilder.setIcmpv6Code((short) 60);
- Icmpv6CodeCaseBuilder.setIcmpv6Code(Icmpv6CodeBuilder.build());
- entryBuilder.setMatchEntryValue(Icmpv6CodeCaseBuilder.build());
+ Icmpv6CodeCaseBuilder icmpv6CodeCaseBuilder = new Icmpv6CodeCaseBuilder();
+ Icmpv6CodeBuilder icmpv6CodeBuilder = new Icmpv6CodeBuilder();
+ icmpv6CodeBuilder.setIcmpv6Code((short) 60);
+ icmpv6CodeCaseBuilder.setIcmpv6Code(icmpv6CodeBuilder.build());
+ entryBuilder.setMatchEntryValue(icmpv6CodeCaseBuilder.build());
entries.add(entryBuilder.build());
entryBuilder.setOxmClass(OpenflowBasicClass.class);
entryBuilder.setOxmMatchField(Ipv6NdTarget.class);
entryBuilder.setOxmClass(OpenflowBasicClass.class);
entryBuilder.setOxmMatchField(MplsTc.class);
entryBuilder.setHasMask(false);
- MplsTcCaseBuilder MplsTcCaseBuilder = new MplsTcCaseBuilder();
- MplsTcBuilder MplsTcBuilder = new MplsTcBuilder();
- MplsTcBuilder.setTc((short) 62);
- MplsTcCaseBuilder.setMplsTc(MplsTcBuilder.build());
- entryBuilder.setMatchEntryValue(MplsTcCaseBuilder.build());
+ MplsTcCaseBuilder mplsTcCaseBuilder = new MplsTcCaseBuilder();
+ MplsTcBuilder mplsTcBuilder = new MplsTcBuilder();
+ mplsTcBuilder.setTc((short) 62);
+ mplsTcCaseBuilder.setMplsTc(mplsTcBuilder.build());
+ entryBuilder.setMatchEntryValue(mplsTcCaseBuilder.build());
entries.add(entryBuilder.build());
entryBuilder = new MatchEntryBuilder();
entryBuilder.setOxmClass(OpenflowBasicClass.class);
entryBuilder.setOxmMatchField(MplsBos.class);
entryBuilder.setHasMask(false);
- MplsBosCaseBuilder MplsBosCaseBuilder = new MplsBosCaseBuilder();
- MplsBosBuilder MplsBosBuilder = new MplsBosBuilder();
- MplsBosBuilder.setBos(true);
- MplsBosCaseBuilder.setMplsBos(MplsBosBuilder.build());
- entryBuilder.setMatchEntryValue(MplsBosCaseBuilder.build());
+ MplsBosCaseBuilder mplsBosCaseBuilder = new MplsBosCaseBuilder();
+ MplsBosBuilder mplsBosBuilder = new MplsBosBuilder();
+ mplsBosBuilder.setBos(true);
+ mplsBosCaseBuilder.setMplsBos(mplsBosBuilder.build());
+ entryBuilder.setMatchEntryValue(mplsBosCaseBuilder.build());
entries.add(entryBuilder.build());
entryBuilder = new MatchEntryBuilder();
entryBuilder.setOxmClass(OpenflowBasicClass.class);
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlagsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.experimenter.id._case.ExperimenterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
import org.slf4j.LoggerFactory;
/**
- * @author michal.polkorab
+ * Unit tests for OF13MatchSerializer.
*
+ * @author michal.polkorab
*/
public class OF13MatchSerializerTest {
private OFSerializer<Match> matchSerializer;
/**
- * Initializes serializer table and stores correct factory in field
+ * Initializes serializer table and stores correct factory in field.
*/
@Before
public void startUp() {
}
/**
- * Test for correct serialization of Ipv4Address match entry
+ * Test for correct serialization of Ipv4Address match entry.
*/
@Test
public void testIpv4Src() {
MatchBuilder builder = new MatchBuilder();
builder.setType(OxmMatchType.class);
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(Ipv4Src.class);
}
/**
- * Test for correct serialization of Ipv6Address match entry
+ * Test for correct serialization of Ipv6Address match entry.
*/
@Test
public void testIpv6Various() {
MatchBuilder builder = new MatchBuilder();
builder.setType(OxmMatchType.class);
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
// ipv6 match entry with correct Ipv6 address
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
}
/**
- * Test for correct serialization of incorrect Ipv6Address match entry
+ * Test for correct serialization of incorrect Ipv6Address match entry.
*/
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected = IllegalArgumentException.class)
public void testIpv6Incorrect() {
MatchBuilder builder = new MatchBuilder();
builder.setType(OxmMatchType.class);
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
// ipv6 match entry with incorrect Ipv6 address
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
}
/**
- * Test for correct serialization of Ipv4Address match entry
+ * Test for correct serialization of Ipv4Address match entry.
*/
@Test
public void testIpv6Flabel() {
}
/**
- * Test for correct serialization of Ipv4Address match entry
+ * Test for correct serialization of Ipv4Address match entry.
*/
@Test
public void testIpv6FlabelWithMask() {
}
/**
- * Test for correct serialization of Ipv4Address match entry with wrong mask
+ * Test for correct serialization of Ipv4Address match entry with wrong mask.
*/
@Test
public void testIpv6FlabelWithMaskBad() {
}
}
- /**
- * @param labelValue ipv6 flow label
- * @param hasMask
- * @param mask ipv6 flow label mask
- * @return
- */
private static Match buildIpv6FLabelMatch(long labelValue, boolean hasMask, byte[] mask) {
MatchBuilder builder = new MatchBuilder();
builder.setType(OxmMatchType.class);
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(Ipv6Flabel.class);
}
/**
- * Test Standard match type
+ * Test Standard match type.
*/
@Test
public void testStandardMatchType() {
/**
* Test serialize experimenter match entry - with no experimenter
- * match entry serializer registered
+ * match entry serializer registered.
*/
- @Test(expected=IllegalStateException.class)
+ @Test(expected = IllegalStateException.class)
public void testSerializeExperimenterMatchEntry() {
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder builder = new MatchEntryBuilder();
builder.setOxmClass(ExperimenterClass.class);
builder.setOxmMatchField(OxmMatchFieldClass.class);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;
/**
- * @author michal.polkorab
+ * Unit tests for OpenflowUtils.
*
+ * @author michal.polkorab
*/
public class OpenflowUtilsTest {
/**
- * Tests {@link OpenflowUtils#createPortState(long)}
+ * Tests {@link OpenflowUtils#createPortState(long)}.
*/
@Test
public void testPortState() {
}
/**
- * Tests {@link OpenflowUtils#createPortConfig(long)}
+ * Tests {@link OpenflowUtils#createPortConfig(long)}.
*/
@Test
public void testPortConfig() {
}
/**
- * Tests {@link OpenflowUtils#createPortFeatures(long)}
+ * Tests {@link OpenflowUtils#createPortFeatures(long)}.
*/
@Test
public void testPortFeatures() {
Assert.assertEquals("Wrong port features", new PortFeaturesV10(false, false, false, false, false, false,
false, false, false, false, false, false), features);
}
-}
\ No newline at end of file
+}
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.experimenter.id._case.ExperimenterBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.ExperimenterActionSubType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
/**
- * @author michal.polkorab
+ * Unit tests for TypeKeyMakerFactory.
*
+ * @author michal.polkorab
*/
public class TypeKeyMakerFactoryTest {
/**
- * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}
+ * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}.
*/
@Test
public void testActionKeyMaker() {
}
/**
- * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}
+ * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}.
*/
@Test
public void testExperimenterActionKeyMaker() {
TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
Assert.assertNotNull("Null keyMaker", keyMaker);
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder builder = new ActionBuilder();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
+ .ActionBuilder builder = new ActionBuilder();
builder.setExperimenterId(new ExperimenterId(42L));
builder.setActionChoice(new CopyTtlInCaseBuilder().build());
Action action = builder.build();
}
/**
- * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}
+ * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}.
*/
@Test
public void testInstructionKeyMaker() {
- TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ TypeKeyMaker<Instruction> keyMaker =
+ TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
Assert.assertNotNull("Null keyMaker", keyMaker);
InstructionBuilder builder = new InstructionBuilder();
}
/**
- * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}
+ * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}.
*/
@Test
public void testExperimenterInstructionKeyMaker() {
- TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ TypeKeyMaker<Instruction> keyMaker =
+ TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
Assert.assertNotNull("Null keyMaker", keyMaker);
InstructionBuilder builder = new InstructionBuilder();
}
/**
- * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+ * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}.
*/
@Test
public void testMatchEntriesKeyMaker() {
- TypeKeyMaker<MatchEntry> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ TypeKeyMaker<MatchEntry> keyMaker =
+ TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
Assert.assertNotNull("Null keyMaker", keyMaker);
MatchEntryBuilder builder = new MatchEntryBuilder();
}
/**
- * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}
+ * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}.
*/
@Test
public void testExperimenterMatchEntriesKeyMaker() {
- TypeKeyMaker<MatchEntry> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
+ TypeKeyMaker<MatchEntry> keyMaker =
+ TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
Assert.assertNotNull("Null keyMaker", keyMaker);
MatchEntryBuilder builder = new MatchEntryBuilder();
Assert.assertEquals("Wrong key", comparationKey, key);
}
- private class ActionSubtypeClass extends ExperimenterActionSubType {
- // only for testing purposes
- }
-
private class OxmMatchFieldClass extends MatchField {
// only for testing purposes
}
-}
\ No newline at end of file
+}