package org.opendaylight.openflowjava.protocol.impl.deserialization;
import static org.junit.Assert.assertEquals;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
-
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
/**
- * @author michal.polkorab
+ * Unit tests for DeserializationFactory.
*
+ * @author michal.polkorab
*/
public class DeserializationFactoryTest {
/**
- * Test deserializer lookup & deserialization
+ * Test deserializer lookup & deserialization.
*/
@Test
public void test() {
}
/**
- * Test deserializer lookup & deserialization
+ * Test deserializer lookup & deserialization.
*/
- @Test(expected=NullPointerException.class)
+ @Test(expected = NullPointerException.class)
public void testNotExistingDeserializer() {
DeserializerRegistryImpl registry = new DeserializerRegistryImpl();
registry.init();
buffer.writeInt(1234);
factory.deserialize(buffer, (short) 0);
}
-}
\ No newline at end of file
+}
import org.opendaylight.openflowjava.protocol.impl.util.MatchDeserializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10;
+
/**
+ * Unit tests for DeserializerRegistryImpl.
*
* @author madamjak
- *
*/
public class DeserializerRegistryImplTest {
private static final int EMPTY_VALUE = EncodeConstants.EMPTY_VALUE;
/**
- * Test - register deserializer without arguments
+ * Test - register deserializer without arguments.
*/
@Test(expected = IllegalArgumentException.class)
- public void testRegisterDeserializerNoArgs(){
+ public void testRegisterDeserializerNoArgs() {
DeserializerRegistryImpl serReg = new DeserializerRegistryImpl();
serReg.registerDeserializer(null, null);
}
/**
- * Test - register deserializer with no key
+ * Test - register deserializer with no key.
*/
@Test(expected = IllegalArgumentException.class)
- public void testRegisterDeserializerNoKey(){
+ public void testRegisterDeserializerNoKey() {
DeserializerRegistryImpl serReg = new DeserializerRegistryImpl();
serReg.registerDeserializer(null, new MatchDeserializer());
}
/**
- * Test - register deserializer with no deserializer
+ * Test - register deserializer with no deserializer.
*/
@Test(expected = IllegalArgumentException.class)
- public void testRegisterDeserializerNoDeserializer(){
+ public void testRegisterDeserializerNoDeserializer() {
DeserializerRegistryImpl serReg = new DeserializerRegistryImpl();
serReg.registerDeserializer(new MessageCodeKey(OF13, EMPTY_VALUE, Match.class), null);
}
/**
- * Test - unregister deserializer without MessageTypeKey
+ * Test - unregister deserializer without MessageTypeKey.
*/
@Test(expected = IllegalArgumentException.class)
- public void testUnRegisterDeserializerNoMessageTypeKey(){
+ public void testUnRegisterDeserializerNoMessageTypeKey() {
DeserializerRegistryImpl derserReg = new DeserializerRegistryImpl();
derserReg.init();
derserReg.unregisterDeserializer(null);
}
/**
- * Test - unregister deserializer
+ * Test - unregister deserializer.
*/
@Test
- public void testUnRegisterDeserializer(){
+ public void testUnRegisterDeserializer() {
DeserializerRegistryImpl derserReg = new DeserializerRegistryImpl();
derserReg.init();
- Assert.assertTrue("Wrong - unregister serializer",derserReg.unregisterDeserializer(new MessageCodeKey(OF13,EMPTY_VALUE, Match.class)));
- Assert.assertFalse("Wrong - unregister serializer",derserReg.unregisterDeserializer(new MessageCodeKey(OF10,EMPTY_VALUE, Match.class)));
+ Assert.assertTrue("Wrong - unregister serializer",derserReg.unregisterDeserializer(
+ new MessageCodeKey(OF13,EMPTY_VALUE, Match.class)));
+ Assert.assertFalse("Wrong - unregister serializer",derserReg.unregisterDeserializer(
+ new MessageCodeKey(OF10,EMPTY_VALUE, Match.class)));
}
/**
- * Test - get deserializer
+ * Test - get deserializer.
*/
- @Test(expected=IllegalStateException.class)
- public void testGetDeserializer(){
+ @Test(expected = IllegalStateException.class)
+ public void testGetDeserializer() {
DeserializerRegistryImpl registry = new DeserializerRegistryImpl();
registry.init();
registry.getDeserializer(new MessageCodeKey((short) 5000, EncodeConstants.EMPTY_VALUE, MatchV10.class));
Assert.fail();
}
-}
\ No newline at end of file
+}
/**
+ * Unit tests for MessageTypeCodeKey.
*
* @author madamjak
- *
*/
public class MessageTypeCodeKeyTest {
/**
- * Tests equals and hashCode
+ * Tests equals and hashCode.
*/
@Test
- public void testEqualsAndHashcode(){
- short msgType1 = 12;
- short msgVersion1 = 34;
- short msgType2 = 21;
- short msgVersion2 = 43;
+ public void testEqualsAndHashcode() {
+ final short msgType1 = 12;
+ final short msgVersion1 = 34;
+ final short msgType2 = 21;
+ final short msgVersion2 = 43;
MessageTypeCodeKey key1 = new MessageTypeCodeKey(msgVersion1, msgType1);
Assert.assertTrue("Wrong - equals to same object", key1.equals(key1));
}
/**
- * Tests getters
+ * Tests getters.
*/
@Test
- public void testGetter(){
+ public void testGetter() {
short msgType = 12;
short msgVersion = 34;
MessageTypeCodeKey key1 = new MessageTypeCodeKey(msgVersion, msgType);
Assert.assertEquals(msgType, key1.getMsgType());
Assert.assertEquals(msgVersion, key1.getMsgVersion());
}
-}
\ No newline at end of file
+}
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.keys.TypeToClassKey;
+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.BarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
assertEquals("Wrong class", BarrierInput.class, messageClassMap.get(new TypeToClassKey(version, 20)));
}
-}
\ No newline at end of file
+}
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
/**
+ * Unit tests for ErrorMessageFactory.
+ *
* @author michal.polkorab
* @author timotej.kubas
*/
private ErrorMessageFactory errorFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer..
*/
@Before
public void startUp() {
}
/**
- * Test of {@link ErrorMessageFactory} for correct translation into POJO
+ * Test of {@link ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithoutData() {
/**
* Test of {@link ErrorMessageFactory} for correct translation into POJO
- * - not existing code used
+ * - not existing code used.
*/
@Test
public void testWithoutData2() {
}
/**
- * Test of {@link ErrorMessageFactory} for correct translation into POJO
+ * Test of {@link ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithData() {
}
/**
- * Test of {@link ErrorMessageFactory} for correct translation into POJO
+ * Test of {@link ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithIncorrectTypeEnum() {
}
/**
- * Test of {@link ErrorMessageFactory} for correct translation into POJO
+ * Test of {@link ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithIncorrectCodeEnum() {
}
/**
- * Test of {@link ErrorMessageFactory} for correct translation into POJO
+ * Test of {@link ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testExperimenterError() {
Mockito.verify(deserializer, Mockito.times(1)).deserialize(bb);
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
/**
- * @author michal.polkorab
+ * Unit tests for ExperimenterMessageFactory.
*
+ * @author michal.polkorab
*/
@RunWith(MockitoJUnitRunner.class)
public class ExperimenterMessageFactoryTest {
private ExperimenterMessageFactory factory;
/**
- * Initializes mocks
+ * Initializes mocks.
*/
@Before
public void startUp() {
}
/**
- * Test deserializer lookup correctness
+ * Test deserializer lookup correctness.
*/
@Test
public void test() {
Assert.assertEquals("Wrong return value", message, deserializedMessage.getExperimenterDataOfChoice());
Assert.assertEquals("ByteBuf index moved", 0, buffer.readableBytes());
}
-}
\ No newline at end of file
+}
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
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.Capabilities;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
/**
+ * Unit tests for FeaturesReplyMessageFactory.
+ *
* @author michal.polkorab
* @author timotej.kubas
*/
private OFDeserializer<GetFeaturesOutput> featuresFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link FeaturesReplyMessageFactory} for correct translation into POJO
+ * Testing {@link FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void test() {
Assert.assertEquals("Wrong buffers", 0x00010203L, builtByFactory.getBuffers().longValue());
Assert.assertEquals("Wrong number of tables", 0x01, builtByFactory.getTables().shortValue());
Assert.assertEquals("Wrong auxiliaryId", 0x01, builtByFactory.getAuxiliaryId().shortValue());
- Assert.assertEquals("Wrong capabilities", new Capabilities(false, false, false, false, false, false, false), builtByFactory.getCapabilities());
+ Assert.assertEquals("Wrong capabilities", new Capabilities(false, false, false, false, false, false, false),
+ builtByFactory.getCapabilities());
Assert.assertEquals("Wrong reserved", 0x00010203L, builtByFactory.getReserved().longValue());
}
/**
* Testing {@link FeaturesReplyMessageFactory} for correct translation into POJO
- * (capabilities set)
+ * (capabilities set).
*/
@Test
public void testCapabilities() {
GetFeaturesOutput builtByFactory = BufferHelper.deserialize(featuresFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
- Assert.assertEquals("Wrong capabilities", new Capabilities(true, true, true, true, true, true, true), builtByFactory.getCapabilities());
+ Assert.assertEquals("Wrong capabilities", new Capabilities(true, true, true, true, true, true, true),
+ builtByFactory.getCapabilities());
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for FlowModInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class FlowModInputMessageFactoryTest {
private OFDeserializer<FlowModInput> flowFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
@Test
public void test() throws Exception {
- ByteBuf bb = BufferHelper
- .buildBuffer("ff 01 04 01 06 00 07 01 ff 05 00 00 09 30 00 30 41 02 00 0c 00 00 00 7e 00 "
- + "00 00 02 00 00 11 46 00 00 00 62 00 0b 00 00 00 01 00 11 80 00 02 04 00 00 00 2a 80 00 12 01 04 00 "
- + "00 00 00 00 00 00 00 01 00 08 2b 00 00 00 00 02 00 18 00 00 00 00 ff 01 04 01 06 00 07 01 ff 05 00 00 "
- + "09 30 00 30 00 04 00 18 00 00 00 00 00 00 00 10 00 00 00 2a 00 34 00 00 00 00 00 00");
+ ByteBuf bb = BufferHelper.buildBuffer(
+ "ff 01 04 01 06 00 07 01 ff 05 00 00 09 30 00 30 41 02 00 0c 00 00 00 7e 00 "
+ + "00 00 02 00 00 11 46 00 00 00 62 00 0b 00 00 00 01 00 11 80 00 02 04 00 00 00 2a 80 00 12 01 04 00 "
+ + "00 00 00 00 00 00 00 01 00 08 2b 00 00 00 00 02 00 18 00 00 00 00 ff 01 04 01 06 00 07 01 ff 05 00 00 "
+ + "09 30 00 30 00 04 00 18 00 00 00 00 00 00 00 10 00 00 00 2a 00 34 00 00 00 00 00 00");
FlowModInput deserializedMessage = BufferHelper.deserialize(flowFactory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
byte[] cookie = new byte[] { (byte) 0xFF, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01 };
}
private List<Instruction> createInstructions() {
- 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));
private Match createMatch() {
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);
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
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.TableId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
/**
+ * Unit tests for FlowRemovedMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFDeserializer<FlowRemovedMessage> flowFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link FlowRemovedMessageFactory} for correct translation into POJO
+ * Testing {@link FlowRemovedMessageFactory} for correct translation into POJO.
*/
@Test
- public void test(){
+ public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 04 05 06 07 00 03 02 04 00 00 00 02"
+ " 00 00 00 05 00 01 00 03 00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07");
FlowRemovedMessage builtByFactory = BufferHelper.deserialize(flowFactory, bb);
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
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.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
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.FlowRemovedReason;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortReason;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PortStatusMaskBuilder;
/**
- * @author timotej.kubas
+ * Unit tests for GetAsyncReplyMessageFactory.
*
+ * @author timotej.kubas
*/
public class GetAsyncReplyMessageFactoryTest {
private OFDeserializer<GetAsyncOutput> asyncFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link GetAsyncReplyMessageFactory} for correct translation into POJO
+ * Testing {@link GetAsyncReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testGetAsyncReplyMessage() {
- ByteBuf bb = BufferHelper.buildBuffer("00 00 00 07 "+
- "00 00 00 00 "+
- "00 00 00 07 "+
- "00 00 00 00 "+
- "00 00 00 0F "+
- "00 00 00 00");
+ ByteBuf bb = BufferHelper.buildBuffer(
+ "00 00 00 07 " + "00 00 00 00 " + "00 00 00 07 " + "00 00 00 00 " + "00 00 00 0F " + "00 00 00 00");
GetAsyncOutput builtByFactory = BufferHelper.deserialize(asyncFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
}
private static List<PacketInMask> createPacketInMask() {
- List<PacketInMask> inMasks = new ArrayList<>();
+ final List<PacketInMask> inMasks = new ArrayList<>();
PacketInMaskBuilder maskBuilder;
// OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
maskBuilder = new PacketInMaskBuilder();
}
private static List<PortStatusMask> createPortStatusMask() {
- List<PortStatusMask> inMasks = new ArrayList<>();
+ final List<PortStatusMask> inMasks = new ArrayList<>();
PortStatusMaskBuilder maskBuilder;
// OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
maskBuilder = new PortStatusMaskBuilder();
}
private static List<FlowRemovedMask> createFlowRemovedMask() {
- List<FlowRemovedMask> inMasks = new ArrayList<>();
+ final List<FlowRemovedMask> inMasks = new ArrayList<>();
FlowRemovedMaskBuilder maskBuilder;
// OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
maskBuilder = new FlowRemovedMaskBuilder();
inMasks.add(maskBuilder.build());
return inMasks;
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for GetAsyncRequestMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class GetAsyncRequestMessageFactoryTest {
private OFDeserializer<GetAsyncInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;
/**
- * @author giuseppex.petralia@intel.com
+ * UNit tests for GetFeaturesInputFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class GetFeaturesInputFactoryTest {
private OFDeserializer<GetFeaturesInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
/**
- * @author giuseppex.petralia@intel.com
+ * UNit tests for GetQueueConfigInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class GetQueueConfigInputMessageFactoryTest {
private OFDeserializer<GetQueueConfigInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for GroupModInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class GroupModInputMessageFactoryTest {
private OFDeserializer<GroupModInput> factory;
HelloMessage builtByFactory = BufferHelper.deserialize(factory, bb);
List<Elements> element = createElement(4,HelloElementType.VERSIONBITMAP.getIntValue());
Assert.assertEquals("Wrong type", element.get(0).getType(), builtByFactory.getElements().get(0).getType());
- Assert.assertEquals("Wrong versionBitmap", element.get(0).getVersionBitmap(), builtByFactory.getElements().get(0).getVersionBitmap());
+ Assert.assertEquals("Wrong versionBitmap", element.get(0).getVersionBitmap(),
+ builtByFactory.getElements().get(0).getVersionBitmap());
}
/**
HelloMessage builtByFactory = BufferHelper.deserialize(factory, bb);
List<Elements> element = createElement(8,HelloElementType.VERSIONBITMAP.getIntValue());
Assert.assertEquals("Wrong type", element.get(0).getType(), builtByFactory.getElements().get(0).getType());
- Assert.assertEquals("Wrong versionBitmap", element.get(0).getVersionBitmap(), builtByFactory.getElements().get(0).getVersionBitmap());
+ Assert.assertEquals("Wrong versionBitmap", element.get(0).getVersionBitmap(),
+ builtByFactory.getElements().get(0).getVersionBitmap());
}
/**
* Testing {@link HelloMessageFactory} if incorrect version is set.
*/
@Test
- public void testBadType(){
+ public void testBadType() {
ByteBuf bb = BufferHelper.buildBuffer("00 02 " // type
+ "00 0c " // length
+ "00 00 00 11 " // bitmap 1
}
private static List<Elements> createElement(int lengthInByte, int type) {
- 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<>();
booleanList.add(true);
booleanList.add(false);
booleanList.add(false);
booleanList.add(true);
int inSize = booleanList.size();
- for (int i = 1; i < ((lengthInByte * 8) - inSize + 1); i++) {
+ for (int i = 1; i < lengthInByte * 8 - inSize + 1; i++) {
booleanList.add(false);
}
elementsBuilder.setType(HelloElementType.forValue(type));
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.BandsBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MeterModInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MeterModInputMessageFactoryTest {
}
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);
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import java.math.BigInteger;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.LoggerFactory;
/**
+ * Unit tests for MultipartReplyMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
public class MultipartReplyMessageFactoryTest {
+ static final int DESC_STR_LEN = 256;
+ static final int SERIAL_NUM_LEN = 32;
private OFDeserializer<MultipartReplyMessage> multipartFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
.getLogger(MultipartReplyMessageFactoryTest.class);
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void testMultipartReplyDescBody(){
- final int DESC_STR_LEN = 256;
- final int SERIAL_NUM_LEN = 32;
+ public void testMultipartReplyDescBody() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 01 00 00 00 00");
String mfrDesc = "Manufacturer description";
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void testMultipartReplyAggregateBody(){
- ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 00 00 00 00 "+
- "FF 01 01 01 01 01 01 01 "+//packetCount
- "0F 01 01 01 01 01 01 01 "+//byteCount
- "00 00 00 08 "+//flowCount
- "00 00 00 00"//pad
- );
+ public void testMultipartReplyAggregateBody() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 00 00 00 00 "
+ + "FF 01 01 01 01 01 01 01 " //packetCount
+ + "0F 01 01 01 01 01 01 01 " //byteCount
+ + "00 00 00 08 " //flowCount
+ + "00 00 00 00" //pad
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void testMultipartReplyTableBody(){
- ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 00 00 00 00 "+
- "08 "+//tableId
- "00 00 00 "+//pad
- "00 00 00 10 "+//activeCount
- "FF 01 01 01 01 01 01 01 "+//lookupCount
- "AF 01 01 01 01 01 01 01"//matchedCount
- );
+ public void testMultipartReplyTableBody() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 00 00 00 00 "
+ + "08 " //tableId
+ + "00 00 00 " //pad
+ + "00 00 00 10 " //activeCount
+ + "FF 01 01 01 01 01 01 01 " //lookupCount
+ + "AF 01 01 01 01 01 01 01"//matchedCount
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void testMultipartReplyPortStatsBody(){
- ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 00 00 00 00 "+
- "00 00 00 FF "+//portNo
- "00 00 00 00 "+//pad
- "FF 01 01 01 01 01 01 01 "+//rxPackets
- "FF 02 02 02 02 02 02 02 "+//txPackets
- "FF 02 03 02 03 02 03 02 "+//rxBytes
- "FF 02 03 02 03 02 03 02 "+//txBytes
- "FF 02 03 02 03 02 03 02 "+//rxDropped
- "FF 02 03 02 03 02 03 02 "+//txDropped
- "FF 02 03 02 03 02 03 02 "+//rxErrors
- "FF 02 03 02 03 02 03 02 "+//txErrors
- "FF 02 03 02 03 02 03 02 "+//rxFrameErr
- "FF 02 03 02 03 02 03 02 "+//rxOverErr
- "FF 02 03 02 03 02 03 02 "+//rxCrcErr
- "FF 02 03 02 03 02 03 02 "+//collisions
- "00 00 00 02 "+//durationSec
- "00 00 00 04"//durationNsec
- );
+ public void testMultipartReplyPortStatsBody() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 00 00 00 00 "
+ + "00 00 00 FF " //portNo
+ + "00 00 00 00 " //pad
+ + "FF 01 01 01 01 01 01 01 " //rxPackets
+ + "FF 02 02 02 02 02 02 02 " //txPackets
+ + "FF 02 03 02 03 02 03 02 " //rxBytes
+ + "FF 02 03 02 03 02 03 02 " //txBytes
+ + "FF 02 03 02 03 02 03 02 " //rxDropped
+ + "FF 02 03 02 03 02 03 02 " //txDropped
+ + "FF 02 03 02 03 02 03 02 " //rxErrors
+ + "FF 02 03 02 03 02 03 02 " //txErrors
+ + "FF 02 03 02 03 02 03 02 " //rxFrameErr
+ + "FF 02 03 02 03 02 03 02 " //rxOverErr
+ + "FF 02 03 02 03 02 03 02 " //rxCrcErr
+ + "FF 02 03 02 03 02 03 02 " //collisions
+ + "00 00 00 02 " //durationSec
+ + "00 00 00 04"//durationNsec
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void testMultipartReplyQueueBody(){
- ByteBuf bb = BufferHelper.buildBuffer("00 05 00 01 00 00 00 00 "+
- "00 00 00 FF "+//portNo
- "00 00 00 10 "+//queueId
- "FF 02 03 02 03 02 03 02 "+//txBytes
- "FF 02 02 02 02 02 02 02 "+//txPackets
- "FF 02 03 02 03 02 03 02 "+//txErrors
- "00 00 00 02 "+//durationSec
- "00 00 00 04"//durationNsec
- );
+ public void testMultipartReplyQueueBody() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 05 00 01 00 00 00 00 "
+ + "00 00 00 FF " //portNo
+ + "00 00 00 10 " //queueId
+ + "FF 02 03 02 03 02 03 02 " //txBytes
+ + "FF 02 02 02 02 02 02 02 " //txPackets
+ + "FF 02 03 02 03 02 03 02 " //txErrors
+ + "00 00 00 02 " //durationSec
+ + "00 00 00 04"//durationNsec
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void testMultipartReplyGroupBody(){
- ByteBuf bb = BufferHelper.buildBuffer("00 06 00 01 00 00 00 00 "+
- "00 48 "+//length
- "00 00 "+//pad1
- "00 00 00 10 "+//groupId
- "00 00 00 12 "+//refCount
- "00 00 00 00 "+//pad2
- "FF 01 01 01 01 01 01 01 "+//packetCount
- "FF 01 01 01 01 01 01 01 "+//byteCount
- "00 00 00 08 "+//durationSec
- "00 00 00 09 "+//durationNsec
- "FF 01 01 01 01 01 01 01 "+//packetCountBucket
- "FF 01 01 01 01 01 01 01 "+//byteCountBucket
- "FF 02 02 02 02 02 02 02 "+//packetCountBucket_2
- "FF 02 02 02 02 02 02 02 "+//byteCountBucket_2
- "00 48 "+//length_2
- "00 00 "+//pad1.2
- "00 00 00 10 "+//groupId_2
- "00 00 00 12 "+//refCount_2
- "00 00 00 00 "+//pad2.2
- "FF 01 01 01 01 01 01 01 "+//packetCount_2
- "FF 01 01 01 01 01 01 01 "+//byteCount_2
- "00 00 00 08 "+//durationSec_2
- "00 00 00 09 "+//durationNsec_2
- "FF 01 01 01 01 01 01 01 "+//packetCountBucket_1.2
- "FF 01 01 01 01 01 01 01 "+//byteCountBucket_1.2
- "FF 02 02 02 02 02 02 02 "+//packetCountBucket_2.2
- "FF 02 02 02 02 02 02 02"//byteCountBucket_2.2
- );
+ public void testMultipartReplyGroupBody() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 06 00 01 00 00 00 00 "
+ + "00 48 " //length
+ + "00 00 " //pad1
+ + "00 00 00 10 " //groupId
+ + "00 00 00 12 " //refCount
+ + "00 00 00 00 " //pad2
+ + "FF 01 01 01 01 01 01 01 " //packetCount
+ + "FF 01 01 01 01 01 01 01 " //byteCount
+ + "00 00 00 08 " //durationSec
+ + "00 00 00 09 " //durationNsec
+ + "FF 01 01 01 01 01 01 01 " //packetCountBucket
+ + "FF 01 01 01 01 01 01 01 " //byteCountBucket
+ + "FF 02 02 02 02 02 02 02 " //packetCountBucket_2
+ + "FF 02 02 02 02 02 02 02 " //byteCountBucket_2
+ + "00 48 " //length_2
+ + "00 00 " //pad1.2
+ + "00 00 00 10 " //groupId_2
+ + "00 00 00 12 " //refCount_2
+ + "00 00 00 00 " //pad2.2
+ + "FF 01 01 01 01 01 01 01 " //packetCount_2
+ + "FF 01 01 01 01 01 01 01 " //byteCount_2
+ + "00 00 00 08 " //durationSec_2
+ + "00 00 00 09 " //durationNsec_2
+ + "FF 01 01 01 01 01 01 01 " //packetCountBucket_1.2
+ + "FF 01 01 01 01 01 01 01 " //byteCountBucket_1.2
+ + "FF 02 02 02 02 02 02 02 " //packetCountBucket_2.2
+ + "FF 02 02 02 02 02 02 02"//byteCountBucket_2.2
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void testMultipartReplyMeterBody(){
- ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "+
- "00 00 00 09 "+//meterId
- "00 58 "+//len
- "00 00 00 00 00 00 "+//pad
- "00 00 00 07 "+//flowCount
- "FF 01 01 01 01 01 01 01 "+//packetInCount
- "FF 01 01 01 01 01 01 01 "+//byteInCount
- "00 00 00 05 "+//durationSec
- "00 00 00 05 "+//durationNsec
- "FF 01 01 01 01 01 01 01 "+//packetBandCount_01
- "FF 01 01 01 01 01 01 01 "+//byteBandCount_01
- "FF 02 02 02 02 02 02 02 "+//packetBandCount_02
- "FF 02 02 02 02 02 02 02 "+//byteBandCount_02
- "FF 03 03 03 03 03 03 03 "+//packetBandCount_03
- "FF 03 03 03 03 03 03 03"//byteBandCount_03
- );
+ public void testMultipartReplyMeterBody() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "
+ + "00 00 00 09 " //meterId
+ + "00 58 " //len
+ + "00 00 00 00 00 00 " //pad
+ + "00 00 00 07 " //flowCount
+ + "FF 01 01 01 01 01 01 01 " //packetInCount
+ + "FF 01 01 01 01 01 01 01 " //byteInCount
+ + "00 00 00 05 " //durationSec
+ + "00 00 00 05 " //durationNsec
+ + "FF 01 01 01 01 01 01 01 " //packetBandCount_01
+ + "FF 01 01 01 01 01 01 01 " //byteBandCount_01
+ + "FF 02 02 02 02 02 02 02 " //packetBandCount_02
+ + "FF 02 02 02 02 02 02 02 " //byteBandCount_02
+ + "FF 03 03 03 03 03 03 03 " //packetBandCount_03
+ + "FF 03 03 03 03 03 03 03" //byteBandCount_03
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void testMultipartReplyMeterBodyMulti(){
- ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "+
- "00 00 00 09 "+//meterId_0
- "00 58 "+//len_0
- "00 00 00 00 00 00 "+//pad_0
- "00 00 00 07 "+//flowCount_0
- "FF 01 01 01 01 01 01 01 "+//packetInCount_0
- "FF 01 01 01 01 01 01 01 "+//byteInCount_0
- "00 00 00 05 "+//durationSec_0
- "00 00 00 05 "+//durationNsec_0
- "FF 01 01 01 01 01 01 01 "+//packetBandCount_01
- "FF 01 01 01 01 01 01 01 "+//byteBandCount_01
- "FF 02 02 02 02 02 02 02 "+//packetBandCount_02
- "FF 02 02 02 02 02 02 02 "+//byteBandCount_02
- "FF 03 03 03 03 03 03 03 "+//packetBandCount_03
- "FF 03 03 03 03 03 03 03 "+//byteBandCount_03
- "00 00 00 08 "+//meterId_1
- "00 58 "+//len_1
- "00 00 00 00 00 00 "+//pad_1
- "00 00 00 07 "+//flowCount_1
- "FF 01 01 01 01 01 01 01 "+//packetInCount_1
- "FF 01 01 01 01 01 01 01 "+//byteInCount_1
- "00 00 00 05 "+//durationSec_1
- "00 00 00 05 "+//durationNsec_1
- "FF 01 01 01 01 01 01 01 "+//packetBandCount_11
- "FF 01 01 01 01 01 01 01 "+//byteBandCount_11
- "FF 02 02 02 02 02 02 02 "+//packetBandCount_12
- "FF 02 02 02 02 02 02 02 "+//byteBandCount_12
- "FF 03 03 03 03 03 03 03 "+//packetBandCount_13
- "FF 03 03 03 03 03 03 03"//byteBandCount_13
- );
+ public void testMultipartReplyMeterBodyMulti() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 "
+ + "00 00 00 09 " //meterId_0
+ + "00 58 " //len_0
+ + "00 00 00 00 00 00 " //pad_0
+ + "00 00 00 07 " //flowCount_0
+ + "FF 01 01 01 01 01 01 01 " //packetInCount_0
+ + "FF 01 01 01 01 01 01 01 " //byteInCount_0
+ + "00 00 00 05 " //durationSec_0
+ + "00 00 00 05 " //durationNsec_0
+ + "FF 01 01 01 01 01 01 01 " //packetBandCount_01
+ + "FF 01 01 01 01 01 01 01 " //byteBandCount_01
+ + "FF 02 02 02 02 02 02 02 " //packetBandCount_02
+ + "FF 02 02 02 02 02 02 02 " //byteBandCount_02
+ + "FF 03 03 03 03 03 03 03 " //packetBandCount_03
+ + "FF 03 03 03 03 03 03 03 " //byteBandCount_03
+ + "00 00 00 08 " //meterId_1
+ + "00 58 " //len_1
+ + "00 00 00 00 00 00 " //pad_1
+ + "00 00 00 07 " //flowCount_1
+ + "FF 01 01 01 01 01 01 01 " //packetInCount_1
+ + "FF 01 01 01 01 01 01 01 " //byteInCount_1
+ + "00 00 00 05 " //durationSec_1
+ + "00 00 00 05 " //durationNsec_1
+ + "FF 01 01 01 01 01 01 01 " //packetBandCount_11
+ + "FF 01 01 01 01 01 01 01 " //byteBandCount_11
+ + "FF 02 02 02 02 02 02 02 " //packetBandCount_12
+ + "FF 02 02 02 02 02 02 02 " //byteBandCount_12
+ + "FF 03 03 03 03 03 03 03 " //packetBandCount_13
+ + "FF 03 03 03 03 03 03 03"//byteBandCount_13
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void testMultipartReplyMeterConfigBody(){
- ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "+
- "00 28 "+//len
- "00 0A "+//flags
- "00 00 00 09 "+//meterId
- "00 01 "+//meterBandDrop.type
- "00 10 "+//meterBandDrop.len
- "00 00 00 11 "+//meterBandDrop.rate
- "00 00 00 20 "+//meterBandDrop.burstSize
- "00 00 00 00 "+//meterBandDrop.pad
- "00 02 "+//meterBandDscp.type
- "00 10 "+//meterBandDscp.len
- "00 00 00 11 "+//meterBandDscp.rate
- "00 00 00 20 "+//meterBandDscp.burstSize
- "04 "+//meterBandDscp.precLevel
- "00 00 00");//meterBandDscp.pad
+ public void testMultipartReplyMeterConfigBody() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "
+ + "00 28 " //len
+ + "00 0A " //flags
+ + "00 00 00 09 " //meterId
+ + "00 01 " //meterBandDrop.type
+ + "00 10 " //meterBandDrop.len
+ + "00 00 00 11 " //meterBandDrop.rate
+ + "00 00 00 20 " //meterBandDrop.burstSize
+ + "00 00 00 00 " //meterBandDrop.pad
+ + "00 02 " //meterBandDscp.type
+ + "00 10 " //meterBandDscp.len
+ + "00 00 00 11 " //meterBandDscp.rate
+ + "00 00 00 20 " //meterBandDscp.burstSize
+ + "04 " //meterBandDscp.precLevel
+ + "00 00 00");//meterBandDscp.pad
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
- MultipartReplyMeterConfigCase messageCase = (MultipartReplyMeterConfigCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyMeterConfigCase messageCase =
+ (MultipartReplyMeterConfigCase) builtByFactory.getMultipartReplyBody();
MultipartReplyMeterConfig message = messageCase.getMultipartReplyMeterConfig();
Assert.assertEquals("Wrong flags", new MeterFlags(false, false, true, true),
message.getMeterConfig().get(0).getFlags());
Assert.assertEquals("Wrong meterId", 9,
message.getMeterConfig().get(0).getMeterId().getValue().intValue());
- MeterBandDropCase dropCase = (MeterBandDropCase) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
+ MeterBandDropCase dropCase =
+ (MeterBandDropCase) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
MeterBandDrop meterBandDrop = dropCase.getMeterBandDrop();
Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
- MeterBandDscpRemarkCase dscpCase = (MeterBandDscpRemarkCase) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
+ MeterBandDscpRemarkCase dscpCase =
+ (MeterBandDscpRemarkCase) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
MeterBandDscpRemark meterBandDscp = dscpCase.getMeterBandDscpRemark();
Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void testMultipartReplyMeterConfigBodyMulti(){
- ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "+
- "00 28 "+//len
- "00 06 "+//flags
- "00 00 00 09 "+//meterId
- "00 01 "+//meterBandDrop.type
- "00 10 "+//meterBandDrop.len
- "00 00 00 11 "+//meterBandDrop.rate
- "00 00 00 20 "+//meterBandDrop.burstSize
- "00 00 00 00 "+//meterBandDrop.pad
- "00 02 "+//meterBandDscp.type
- "00 10 "+//meterBandDscp.len
- "00 00 00 11 "+//meterBandDscp.rate
- "00 00 00 20 "+//meterBandDscp.burstSize
- "04 "+//meterBandDscp.precLevel
- "00 00 00 "+//meterBandDscp.pad
-
- "00 18 "+//len01
- "00 03 "+//flags01
- "00 00 00 07 "+//meterId01
- "00 02 "+//meterBandDscp01.type
- "00 10 "+//meterBandDscp01.len
- "00 00 00 11 "+//meterBandDscp01.rate
- "00 00 00 20 "+//meterBandDscp01.burstSize
- "04 "+//meterBandDscp01.precLevel
- "00 00 00"//meterBandDscp01.pad
- );
+ public void testMultipartReplyMeterConfigBodyMulti() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 "
+ + "00 28 " //len
+ + "00 06 " //flags
+ + "00 00 00 09 " //meterId
+ + "00 01 " //meterBandDrop.type
+ + "00 10 " //meterBandDrop.len
+ + "00 00 00 11 " //meterBandDrop.rate
+ + "00 00 00 20 " //meterBandDrop.burstSize
+ + "00 00 00 00 " //meterBandDrop.pad
+ + "00 02 " //meterBandDscp.type
+ + "00 10 " //meterBandDscp.len
+ + "00 00 00 11 " //meterBandDscp.rate
+ + "00 00 00 20 " //meterBandDscp.burstSize
+ + "04 " //meterBandDscp.precLevel
+ + "00 00 00 " //meterBandDscp.pad
+ + "00 18 " //len01
+ + "00 03 " //flags01
+ + "00 00 00 07 " //meterId01
+ + "00 02 " //meterBandDscp01.type
+ + "00 10 " //meterBandDscp01.len
+ + "00 00 00 11 " //meterBandDscp01.rate
+ + "00 00 00 20 " //meterBandDscp01.burstSize
+ + "04 " //meterBandDscp01.precLevel
+ + "00 00 00"//meterBandDscp01.pad
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
- MultipartReplyMeterConfigCase messageCase = (MultipartReplyMeterConfigCase) builtByFactory.getMultipartReplyBody();
+ MultipartReplyMeterConfigCase messageCase =
+ (MultipartReplyMeterConfigCase) builtByFactory.getMultipartReplyBody();
MultipartReplyMeterConfig message = messageCase.getMultipartReplyMeterConfig();
Assert.assertEquals("Wrong flags", new MeterFlags(true, false, true, false),
message.getMeterConfig().get(0).getFlags());
Assert.assertEquals("Wrong meterId", 9,
message.getMeterConfig().get(0).getMeterId().getValue().intValue());
- MeterBandDropCase dropCase = (MeterBandDropCase) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
+ MeterBandDropCase dropCase =
+ (MeterBandDropCase) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
MeterBandDrop meterBandDrop = dropCase.getMeterBandDrop();
Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
- MeterBandDscpRemarkCase dscpCase = (MeterBandDscpRemarkCase) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
+ MeterBandDscpRemarkCase dscpCase =
+ (MeterBandDscpRemarkCase) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
MeterBandDscpRemark meterBandDscp = dscpCase.getMeterBandDscpRemark();
Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
Assert.assertEquals("Wrong meterId01", 7,
message.getMeterConfig().get(1).getMeterId().getValue().intValue());
- MeterBandDscpRemarkCase dscpCase01 = (MeterBandDscpRemarkCase) message.getMeterConfig().get(1).getBands().get(0).getMeterBand();
+ MeterBandDscpRemarkCase dscpCase01 =
+ (MeterBandDscpRemarkCase) message.getMeterConfig().get(1).getBands().get(0).getMeterBand();
MeterBandDscpRemark meterBandDscp01 = dscpCase01.getMeterBandDscpRemark();
Assert.assertEquals("Wrong meterBandDscp01.type", 2, meterBandDscp01.getType().getIntValue());
Assert.assertEquals("Wrong meterBandDscp01.rate", 17, meterBandDscp01.getRate().intValue());
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
- * Test covers bodies of actions Output, Copy TTL Out, Copy TTL In
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
+ * Test covers bodies of actions Output, Copy TTL Out, Copy TTL In.
*/
@Test
- public void testMultipartReplyGroupDescBody01(){
- ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
- "00 38 "+//len
- "01 "+//type
- "00 "+//pad
- "00 00 00 08 "+//groupId
- "00 30 "+//bucketLen
- "00 06 "+//bucketWeight
- "00 00 00 05 "+//bucketWatchPort
- "00 00 00 04 "+//bucketWatchGroup
- "00 00 00 00 "+//bucketPad
- "00 00 "+//outputType
- "00 10 "+//outputLen
- "00 00 10 FF "+//outputPort
- "FF FF "+//outputMaxLen
- "00 00 00 00 00 00 "+//outputPad
- "00 0B "+//copyTTLOutType
- "00 08 "+//copyTTLOutLen
- "00 00 00 00 "+//copyTTLOutPad
- "00 0C "+//copyTTLIntType
- "00 08 "+//copyTTLIntLen
- "00 00 00 00"//copyTTLInPad
- );
+ public void testMultipartReplyGroupDescBody01() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "
+ + "00 38 " //len
+ + "01 " //type
+ + "00 " //pad
+ + "00 00 00 08 " //groupId
+ + "00 30 " //bucketLen
+ + "00 06 " //bucketWeight
+ + "00 00 00 05 " //bucketWatchPort
+ + "00 00 00 04 " //bucketWatchGroup
+ + "00 00 00 00 " //bucketPad
+ + "00 00 " //outputType
+ + "00 10 " //outputLen
+ + "00 00 10 FF " //outputPort
+ + "FF FF " //outputMaxLen
+ + "00 00 00 00 00 00 " //outputPad
+ + "00 0B " //copyTTLOutType
+ + "00 08 " //copyTTLOutLen
+ + "00 00 00 00 " //copyTTLOutPad
+ + "00 0C " //copyTTLIntType
+ + "00 08 " //copyTTLIntLen
+ + "00 00 00 00"//copyTTLInPad
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong bucketWeight", 6,
message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
Assert.assertEquals("Wrong bucketWatchPort", 5,
- message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
- getValue().intValue());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().getValue().intValue());
Assert.assertEquals("Wrong bucketWatchGroup", 4,
message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
- * Test covers bodies of actions Set MPLS TTL , Dec MPLS TTL, Push VLAN. Push MPLS, Push PBB
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
+ * Test covers bodies of actions Set MPLS TTL , Dec MPLS TTL, Push VLAN. Push MPLS, Push PBB.
*/
@Test
- public void testMultipartReplyGroupDescBody02(){
- ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
- "00 40 "+//len
- "01 "+//type
- "00 "+//pad
- "00 00 00 08 "+//groupId
- "00 38 "+//bucketLen
- "00 06 "+//bucketWeight
- "00 00 00 05 "+//bucketWatchPort
- "00 00 00 04 "+//bucketWatchGroup
- "00 00 00 00 "+//bucketPad
- "00 0F "+//setMplsTtlType
- "00 08 "+//setMplsTtlLen
- "09 "+//setMplsTtlMPLS_TTL
- "00 00 00 "+//setMplsTtlPad
- "00 10 "+//decMplsTtlType
- "00 08 "+//decMplsTtlLen
- "00 00 00 00 "+//decMplsTtlPad
- "00 11 "+//pushVlanType
- "00 08 "+//pushVlanLen
- "00 20 "+//pushVlanEthertype
- "00 00 "+//pushVlanPad
- "00 13 "+//pushMplsType
- "00 08 "+//pushMplsLen
- "00 FF "+//pushMplsEthertype
- "00 00 "+//pushMplsPad
- "00 1A "+//pushPbbType
- "00 08 "+//pushPbbLen
- "0F FF "+//pushPbbEthertype
- "00 00"//pushPbbPad
- );
+ public void testMultipartReplyGroupDescBody02() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "
+ + "00 40 " //len
+ + "01 " //type
+ + "00 " //pad
+ + "00 00 00 08 " //groupId
+ + "00 38 " //bucketLen
+ + "00 06 " //bucketWeight
+ + "00 00 00 05 " //bucketWatchPort
+ + "00 00 00 04 " //bucketWatchGroup
+ + "00 00 00 00 " //bucketPad
+ + "00 0F " //setMplsTtlType
+ + "00 08 " //setMplsTtlLen
+ + "09 " //setMplsTtlMPLS_TTL
+ + "00 00 00 " //setMplsTtlPad
+ + "00 10 " //decMplsTtlType
+ + "00 08 " //decMplsTtlLen
+ + "00 00 00 00 " //decMplsTtlPad
+ + "00 11 " //pushVlanType
+ + "00 08 " //pushVlanLen
+ + "00 20 " //pushVlanEthertype
+ + "00 00 " //pushVlanPad
+ + "00 13 " //pushMplsType
+ + "00 08 " //pushMplsLen
+ + "00 FF " //pushMplsEthertype
+ + "00 00 " //pushMplsPad
+ + "00 1A " //pushPbbType
+ + "00 08 " //pushPbbLen
+ + "0F FF " //pushPbbEthertype
+ + "00 00"//pushPbbPad
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
- * Test covers bodies of actions Pop VLAN, Pop PBB, Pop MPLS, Group, Dec NW TTL
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
+ * Test covers bodies of actions Pop VLAN, Pop PBB, Pop MPLS, Group, Dec NW TTL.
*/
@Test
- public void testMultipartReplyGroupDescBody03(){
- ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
- "00 48 "+//len
- "01 "+//type
- "00 "+//pad
- "00 00 00 08 "+//groupId
- "00 40 "+//bucketLen
- "00 06 "+//bucketWeight
- "00 00 00 05 "+//bucketWatchPort
- "00 00 00 04 "+//bucketWatchGroup
- "00 00 00 00 "+//bucketPad
- "00 12 "+//popVlanType
- "00 08 "+//popVlanLen
- "00 00 00 00 "+//popVlanPad
- "00 1B "+//popPbbType
- "00 08 "+//popPbbLen
- "00 00 00 00 "+//popPbbPad
- "00 14 "+//popMplsType
- "00 08 "+//popMplsLen
- "00 CF "+//popMplsEthertype
- "00 00 "+//popMplsPad
- "00 15 "+//setQueueType
- "00 08 "+//setQueueLen
- "00 CF 00 00 "+//setQueueQueueId
- "00 16 "+//groupType
- "00 08 "+//groupLen
- "00 CF 00 00 "+//groupGroupId
- "00 18 "+//decNwTtlType
- "00 08 "+//decNwTtlLen
- "00 00 00 00"//decNwTtlPad
- );
+ public void testMultipartReplyGroupDescBody03() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "
+ + "00 48 " //len
+ + "01 " //type
+ + "00 " //pad
+ + "00 00 00 08 " //groupId
+ + "00 40 " //bucketLen
+ + "00 06 " //bucketWeight
+ + "00 00 00 05 " //bucketWatchPort
+ + "00 00 00 04 " //bucketWatchGroup
+ + "00 00 00 00 " //bucketPad
+ + "00 12 " //popVlanType
+ + "00 08 " //popVlanLen
+ + "00 00 00 00 " //popVlanPad
+ + "00 1B " //popPbbType
+ + "00 08 " //popPbbLen
+ + "00 00 00 00 " //popPbbPad
+ + "00 14 " //popMplsType
+ + "00 08 " //popMplsLen
+ + "00 CF " //popMplsEthertype
+ + "00 00 " //popMplsPad
+ + "00 15 " //setQueueType
+ + "00 08 " //setQueueLen
+ + "00 CF 00 00 " //setQueueQueueId
+ + "00 16 " //groupType
+ + "00 08 " //groupLen
+ + "00 CF 00 00 " //groupGroupId
+ + "00 18 " //decNwTtlType
+ + "00 08 " //decNwTtlLen
+ + "00 00 00 00"//decNwTtlPad
+ );
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
}
/**
- * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
- * Test covers bodies of actions NW TTL, Experimenter
+ * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
+ * Test covers bodies of actions NW TTL, Experimenter.
*/
@Test
- public void testMultipartReplyGroupDescBody04(){
- ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "+
- "00 30 "+//len
- "01 "+//type
- "00 "+//pad
- "00 00 00 08 "+//groupId
- "00 28 "+//bucketLen
- "00 06 "+//bucketWeight
- "00 00 00 05 "+//bucketWatchPort
- "00 00 00 04 "+//bucketWatchGroup
- "00 00 00 00 "+//bucketPad
- "00 17 "+//nwTTlType
- "00 08 "+//nwTTlLen
- "0E "+//nwTTlnwTTL
- "00 00 00 "+//nwTTlPad
- "00 19 "+//setFieldType
- "00 10 "+//setFieldLen
- "80 00 "+//setFieldOXMClass
- "00 "+//setFieldOXMField
- "04 "+//setFieldOXMLength
- "00 00 00 FF "+ //setFieldPort
- "00 00 00 00"
- );
+ public void testMultipartReplyGroupDescBody04() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 "
+ + "00 30 " //len
+ + "01 " //type
+ + "00 " //pad
+ + "00 00 00 08 " //groupId
+ + "00 28 " //bucketLen
+ + "00 06 " //bucketWeight
+ + "00 00 00 05 " //bucketWatchPort
+ + "00 00 00 04 " //bucketWatchGroup
+ + "00 00 00 00 " //bucketPad
+ + "00 17 " //nwTTlType
+ + "00 08 " //nwTTlLen
+ + "0E " //nwTTlnwTTL
+ + "00 00 00 " //nwTTlPad
+ + "00 19 " //setFieldType
+ + "00 10 " //setFieldLen
+ + "80 00 " //setFieldOXMClass
+ + "00 " //setFieldOXMField
+ + "04 " //setFieldOXMLength
+ + "00 00 00 FF " //setFieldPort
+ + "00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
Assert.assertEquals("Wrong bucketWeight", 6,
message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
Assert.assertEquals("Wrong bucketWatchPort", 5,
- message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().
- getValue().intValue());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().getValue().intValue());
Assert.assertEquals("Wrong bucketWatchGroup", 4,
message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartRequestAggregateInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartRequestAggregateInputMessageFactoryTest {
}
private static MultipartRequestAggregateCase createRequestAggregate() {
- MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
+ final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
MultipartRequestAggregateBuilder builder = new MultipartRequestAggregateBuilder();
builder.setTableId((short) 8);
builder.setOutPort(85L);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.desc._case.MultipartRequestDescBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartRequestDescInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartRequestDescInputMessageFactoryTest {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartRequestFlowInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartRequestFlowInputMessageFactoryTest {
}
private static MultipartRequestFlowCase createRequestFlow() {
- MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
+ final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
MultipartRequestFlowBuilder builder = new MultipartRequestFlowBuilder();
builder.setTableId((short) 8);
builder.setOutPort(85L);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartRequestGroupInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartRequestGroupInputMessageFactoryTest {
ByteBuf bb = BufferHelper.buildBuffer("00 06 00 01 00 00 00 00 00 00 08 d2 00 00 00 00");
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.config._case.MultipartRequestMeterConfigBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartRequestMeterConfigInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartRequestMeterConfigInputMessageFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartRequestMeterInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartRequestMeterInputMessageFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartRequestPortStatsInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartRequestPortStatsInputMessageFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartRequestQueueInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartRequestQueueInputMessageFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartRequestTableFeaturesInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartRequestTableFeaturesInputMessageFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 0c 00 01 00 00 00 00 00 68 01 00 00 00 00 00 4e 61 6d "
- + "65 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
- + "00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 10 00 01 "
- + "00 04 00 02 00 04 00 04 00 04 00 02 00 05 01 00 00 00 00 04 00 08 00 00 00 04 00 08 00 08 80 00 02 04 ");
+ + "65 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
+ + "00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 10 00 01 "
+ + "00 04 00 02 00 04 00 04 00 04 00 02 00 05 01 00 00 00 00 04 00 08 00 00 00 04 00 08 00 08 80 00 02 04 ");
MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
Assert.assertEquals("Wrong type", MultipartType.forValue(12), deserializedMessage.getType());
}
public List<TableFeatures> createTableFeaturesList() {
- List<TableFeatures> list = new ArrayList<>();
+ final List<TableFeatures> list = new ArrayList<>();
TableFeaturesBuilder builder = new TableFeaturesBuilder();
builder.setTableId((short) 1);
builder.setName("Name");
}
public List<TableFeatureProperties> createTableFeatureProperties() {
- List<TableFeatureProperties> list = new ArrayList<>();
+ final List<TableFeatureProperties> list = new ArrayList<>();
TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();
builder.setType(TableFeaturesPropType.forValue(0));
InstructionRelatedTableFeaturePropertyBuilder insBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
}
public List<MatchEntry> createMatchEntries() {
- List<MatchEntry> entries = new ArrayList<>();
+ final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(InPhyPort.class);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for MultipartRequestTableInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class MultipartRequestTableInputMessageFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
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.ErrorMessage;
/**
+ * Unit tests for OF10ErrorMessageFactory.
+ *
* @author michal.polkorab
*/
public class OF10ErrorMessageFactoryTest {
private OFDeserializer<ErrorMessage> errorFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Test of {@link ErrorMessageFactory} for correct translation into POJO
+ * Test of {@link ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithoutData() {
}
/**
- * Test of {@link ErrorMessageFactory} for correct translation into POJO
+ * Test of {@link ErrorMessageFactory} for correct translation into POJO.
* - not existing code used
*/
@Test
}
/**
- * Test of {@link OF10ErrorMessageFactory} for correct translation into POJO
+ * Test of {@link OF10ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithData() {
}
/**
- * Test of {@link OF10ErrorMessageFactory} for correct translation into POJO
+ * Test of {@link OF10ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithIncorrectTypeEnum() {
}
/**
- * Test of {@link OF10ErrorMessageFactory} for correct translation into POJO
+ * Test of {@link OF10ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithIncorrectCodeEnum() {
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-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.ActionTypeV10;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.CapabilitiesV10;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort;
/**
- * @author michal.polkorab
+ * Unit tests for OF10FeaturesReplyMessageFactory.
*
+ * @author michal.polkorab
*/
public class OF10FeaturesReplyMessageFactoryTest {
private OFDeserializer<GetFeaturesOutput> featuresFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO
+ * Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void test() {
Assert.assertEquals("Wrong port - name", new String("ALOHA"), port.getName());
Assert.assertEquals("Wrong port - config", new PortConfigV10(true, true, true, true, true, true, true),
port.getConfigV10());
- Assert.assertEquals("Wrong port - state", new PortStateV10(false, false, false, false, true, false, true, false),
+ Assert.assertEquals("Wrong port - state", new PortStateV10(false, false, false, false, true,
+ false, true, false),
port.getStateV10());
Assert.assertEquals("Wrong port - curr", new PortFeaturesV10(true, true, true, true, true, true, true,
true, true, true, true, true), port.getCurrentFeaturesV10());
}
/**
- * Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO
+ * Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithTwoPortsSet() {
Assert.assertEquals("Wrong port - state", new PortStateV10(false, true, false, true, true, true, false, true),
port.getStateV10());
port = builtByFactory.getPhyPort().get(1);
- Assert.assertEquals("Wrong port - state", new PortStateV10(false, false, false, false, false, false, true, false),
- port.getStateV10());
+ Assert.assertEquals("Wrong port - state",
+ new PortStateV10(false, false, false, false, false, false, true, false), port.getStateV10());
}
/**
- * Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO
+ * Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithNoPortsSet() {
GetFeaturesOutput builtByFactory = BufferHelper.deserialize(featuresFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
- Assert.assertEquals("Wrong capabilities", new CapabilitiesV10(false, false, false, false, false, false, false, false),
+ Assert.assertEquals("Wrong capabilities",
+ new CapabilitiesV10(false, false, false, false, false, false, false, false),
builtByFactory.getCapabilitiesV10());
Assert.assertEquals("Wrong actions", new ActionTypeV10(false, false, false, false, false, false, false,
false, false, false, false, false, false), builtByFactory.getActionsV10());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10FeaturesRequestMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10FeaturesRequestMessageFactoryTest {
private OFDeserializer<GetFeaturesInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10FlowModInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10FlowModInputMessageFactoryTest {
private OFDeserializer<FlowModInput> factory;
}
private static List<Action> createAction() {
- List<Action> actions = new ArrayList<>();
+ final List<Action> actions = new ArrayList<>();
ActionBuilder actionBuilder = new ActionBuilder();
SetNwDstCaseBuilder nwDstCaseBuilder = new SetNwDstCaseBuilder();
SetNwDstActionBuilder nwDstBuilder = new SetNwDstActionBuilder();
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
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.FlowRemovedMessage;
/**
+ * Unit tests for OF10FlowRemovedMessageFactory.
+ *
* @author michal.polkorab
*/
public class OF10FlowRemovedMessageFactoryTest {
private OFDeserializer<FlowRemovedMessage> flowFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link OF10FlowRemovedMessageFactory} for correct translation into POJO
+ * Testing {@link OF10FlowRemovedMessageFactory} for correct translation into POJO.
*/
@Test
- public void test(){
+ public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 24 08 D1 00 20 AA BB CC DD EE FF "
+ "AA BB CC DD EE FF 00 05 10 00 00 08 07 06 00 00 10 11 12 13 01 02 03 04 "//36
+ "50 50 20 20 "// match
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10GetQueueConfigInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10GetQueueConfigInputMessageFactoryTest {
private OFDeserializer<GetQueueConfigInput> factory;
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
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.HelloMessage;
/**
+ * Unit tests for OF10HelloMessageFactory.
+ *
* @author michal.polkorab
*/
public class OF10HelloMessageFactoryTest {
private OFDeserializer<HelloMessage> helloFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link OF10HelloMessageFactory} for correct translation into POJO
+ * Testing {@link OF10HelloMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithoutElements() {
Assert.assertNull("Wrong elements", builtByFactory.getElements());
}
- /**
- * Testing {@link OF10HelloMessageFactory} for correct translation into POJO
+ /**
+ * Testing {@link OF10HelloMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithElements() {
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
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.PacketInReason;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
/**
+ * Unit tests for OF10PacketInMessageFactory.
+ *
* @author michal.polkorab
*/
public class OF10PacketInMessageFactoryTest {
private OFDeserializer<PacketInMessage> packetInFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link OF10PacketInMessageFactory} for correct translation into POJO
+ * Testing {@link OF10PacketInMessageFactory} for correct translation into POJO.
*/
@Test
- public void test(){
+ public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 01 02 01 02 00 00 01 02 03 04");
PacketInMessage builtByFactory = BufferHelper.deserialize(packetInFactory, bb);
}
/**
- * Testing {@link OF10PacketInMessageFactory} for correct translation into POJO
+ * Testing {@link OF10PacketInMessageFactory} for correct translation into POJO.
*/
@Test
- public void testWithNoAdditionalData(){
+ public void testWithNoAdditionalData() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 01 02 01 02 00 00");
PacketInMessage builtByFactory = BufferHelper.deserialize(packetInFactory, bb);
Assert.assertNull("Wrong data", builtByFactory.getData());
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10PacketOutInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10PacketOutInputMessageFactoryTest {
private OFDeserializer<PacketOutInput> factory;
}
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(42L));
outputBuilder.setMaxLength(50);
caseBuilder.setOutputAction(outputBuilder.build());
+ ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(caseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10PortModInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10PortModInputMessageFactoryTest {
private OFDeserializer<PortModInput> factory;
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-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.PortStatusMessage;
/**
- * @author michal.polkorab
+ * Unit tests for OF10PortStatusMessageFactory.
*
+ * @author michal.polkorab
*/
public class OF10PortStatusMessageFactoryTest {
private OFDeserializer<PortStatusMessage> statusFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link OF10PortStatusMessageFactory} for correct translation into POJO
+ * Testing {@link OF10PortStatusMessageFactory} for correct translation into POJO.
*/
@Test
- public void test(){
+ public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 00 00 00 00 00 "
+ "00 10 01 01 05 01 04 02 41 4C 4F 48 41 00 00 00 00 00 00 00 00 00 00 "
+ "00 00 00 00 15 00 00 00 01 00 00 00 31 00 00 04 42 00 00 03 0C 00 00 08 88");
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong reason", PortReason.OFPPRADD, builtByFactory.getReason());
Assert.assertEquals("Wrong port - port-no", 16, builtByFactory.getPortNo().intValue());
- Assert.assertEquals("Wrong builtByFactory - hw-addr", new MacAddress("01:01:05:01:04:02"), builtByFactory.getHwAddr());
+ Assert.assertEquals("Wrong builtByFactory - hw-addr", new MacAddress("01:01:05:01:04:02"),
+ builtByFactory.getHwAddr());
Assert.assertEquals("Wrong builtByFactory - name", new String("ALOHA"), builtByFactory.getName());
- Assert.assertEquals("Wrong builtByFactory - config", new PortConfigV10(true, false, false, true, false, false, true),
- builtByFactory.getConfigV10());
- Assert.assertEquals("Wrong builtByFactory - state", new PortStateV10(false, true, false, false, false, false, true, false),
- builtByFactory.getStateV10());
- Assert.assertEquals("Wrong builtByFactory - curr", new PortFeaturesV10(false, false, false, false, true, true, true,
- false, false, false, false, false), builtByFactory.getCurrentFeaturesV10());
- Assert.assertEquals("Wrong builtByFactory - advertised", new PortFeaturesV10(false, false, true, true, false, false,
- false, false, false, false, true, false), builtByFactory.getAdvertisedFeaturesV10());
- Assert.assertEquals("Wrong builtByFactory - supbuiltByFactoryed", new PortFeaturesV10(true, true, false, false, false, false,
- false, true, false, true, false, false), builtByFactory.getSupportedFeaturesV10());
- Assert.assertEquals("Wrong builtByFactory - peer", new PortFeaturesV10(true, false, false, false, false, false, false,
- false, true, false, false, true), builtByFactory.getPeerFeaturesV10());
+ Assert.assertEquals("Wrong builtByFactory - config",
+ new PortConfigV10(true, false, false, true, false, false, true), builtByFactory.getConfigV10());
+ Assert.assertEquals("Wrong builtByFactory - state",
+ new PortStateV10(false, true, false, false, false, false, true, false), builtByFactory.getStateV10());
+ Assert.assertEquals("Wrong builtByFactory - curr",
+ new PortFeaturesV10(false, false, false, false, true, true, true, false, false, false, false, false),
+ builtByFactory.getCurrentFeaturesV10());
+ Assert.assertEquals("Wrong builtByFactory - advertised",
+ new PortFeaturesV10(false, false, true, true, false, false, false, false, false, false, true, false),
+ builtByFactory.getAdvertisedFeaturesV10());
+ Assert.assertEquals("Wrong builtByFactory - supbuiltByFactoryed",
+ new PortFeaturesV10(true, true, false, false, false, false, false, true, false, true, false, false),
+ builtByFactory.getSupportedFeaturesV10());
+ Assert.assertEquals("Wrong builtByFactory - peer",
+ new PortFeaturesV10(true, false, false, false, false, false, false, false, true, false, false, true),
+ builtByFactory.getPeerFeaturesV10());
}
}
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
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.protocol.rev130731.queue.get.config.reply.Queues;
/**
- * @author michal.polkorab
+ * Unit tests for OF10QueueGetConfigReplyMessageFactory.
*
+ * @author michal.polkorab
*/
public class OF10QueueGetConfigReplyMessageFactoryTest {
private OFDeserializer<GetQueueConfigOutput> queueFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
/**
* Testing of {@link OF10QueueGetConfigReplyMessageFactory} for correct
- * translation into POJO
+ * translation into POJO.
*/
@Test
public void test() {
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import java.math.BigInteger;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTable;
/**
- * @author michal.polkorab
+ * Unit tests for OF10StatsReplyMessageFactory.
*
+ * @author michal.polkorab
*/
public class OF10StatsReplyMessageFactoryTest {
+ static final int DESC_STR_LEN = 256;
+ static final int SERIAL_NUM_LEN = 32;
private OFDeserializer<MultipartReplyMessage> statsFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing OF10StatsReplyMessageFactory (Desc) for correct deserialization
+ * Testing OF10StatsReplyMessageFactory (Desc) for correct deserialization.
*/
@Test
public void testDesc() {
- final int DESC_STR_LEN = 256;
- final int SERIAL_NUM_LEN = 32;
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 00");
String mfrDesc = "Manufacturer description";
}
/**
- * Testing OF10StatsReplyMessageFactory (Flow) for correct deserialization
+ * Testing OF10StatsReplyMessageFactory (Flow) for correct deserialization.
*/
@Test
public void testFlow() {
}
/**
- * Testing OF10StatsReplyMessageFactory (Aggregate) for correct deserialization
+ * Testing OF10StatsReplyMessageFactory (Aggregate) for correct deserialization.
*/
@Test
public void testAggregate() {
}
/**
- * Testing OF10StatsReplyMessageFactory (Table) for correct deserialization
+ * Testing OF10StatsReplyMessageFactory (Table) for correct deserialization.
*/
@Test
public void testTable() {
}
/**
- * Testing OF10StatsReplyMessageFactory (Port) for correct deserialization
+ * Testing OF10StatsReplyMessageFactory (Port) for correct deserialization.
*/
@Test
public void testPort() {
}
/**
- * Testing OF10StatsReplyMessageFactory (Queue) for correct deserialization
+ * Testing OF10StatsReplyMessageFactory (Queue) for correct deserialization.
*/
@Test
public void testQueue() {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10StatsRequestInputAggregateFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10StatsRequestInputAggregateFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
}
private static MultipartRequestBody createMultipartRequestBody() {
- MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
- MultipartRequestAggregateBuilder aggregateBuilder = new MultipartRequestAggregateBuilder();
+ final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
+ final MultipartRequestAggregateBuilder aggregateBuilder = new MultipartRequestAggregateBuilder();
MatchV10Builder matchBuilder = new MatchV10Builder();
matchBuilder.setWildcards(
new FlowWildcardsV10(false, false, false, false, false, false, false, false, false, false));
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.desc._case.MultipartRequestDescBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10StatsRequestInputDescFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10StatsRequestInputDescFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10StatsRequestInputFlowFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10StatsRequestInputFlowFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
}
private static MultipartRequestBody createMultipartRequestBody() {
- 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));
matchBuilder.setNwSrcMask((short) 8);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10StatsRequestInputPortStatsFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10StatsRequestInputPortStatsFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10StatsRequestInputQueueFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10StatsRequestInputQueueFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for OF10StatsRequestInputTableFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class OF10StatsRequestInputTableFactoryTest {
private OFDeserializer<MultipartRequestInput> factory;
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
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.PacketInReason;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
/**
- * @author timotej.kubas
+ * Unit tests for PacketInMessageFactory.
*
+ * @author timotej.kubas
*/
public class PacketInMessageFactoryTest {
private OFDeserializer<PacketInMessage> packetInFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link PacketInMessageFactory} for correct translation into POJO
+ * Testing {@link PacketInMessageFactory} for correct translation into POJO.
*/
@Test
- public void test(){
+ public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 01 02 01 04 00 01 02 03 04 05 06 07 00 01 00 0C"
+ " 80 00 02 04 00 00 00 01 00 00 00 00 00 00 01 02 03 04");
PacketInMessage builtByFactory = BufferHelper.deserialize(packetInFactory, bb);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for PacketOutInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class PacketOutInputMessageFactoryTest {
private OFDeserializer<PacketOutInput> factory;
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer(
- "00 00 01 00 00 00 01 00 00 28 00 00 00 00 00 00 00 11 00 08 00 19 00 00 00 12 00 08 00 00 00 00 00 12 "
- + "00 08 00 00 00 00 00 12 00 08 00 00 00 00 00 12 00 08 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 10 "
- + "11 12 13 14");
+ "00 00 01 00 00 00 01 00 00 28 00 00 00 00 00 00 00 11 00 08 00 19 00 00 00 12 00 08 00 00 00 00 00 12 "
+ + "00 08 00 00 00 00 00 12 00 08 00 00 00 00 00 12 00 08 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 10 "
+ + "11 12 13 14");
PacketOutInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
}
private List<Action> createAction() {
- List<Action> actions = new ArrayList<>();
+ final List<Action> actions = new ArrayList<>();
ActionBuilder actionBuilder = new ActionBuilder();
PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();
PushVlanActionBuilder pushVlanBuilder = new PushVlanActionBuilder();
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for PortModInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class PortModInputMessageFactoryTest {
private OFDeserializer<PortModInput> factory;
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
-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.PortStatusMessage;
/**
+ * Unit tests for PortStatusMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFDeserializer<PortStatusMessage> statusFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link PortStatusMessageFactory} for correct translation into POJO
+ * Testing {@link PortStatusMessageFactory} for correct translation into POJO.
*/
@Test
- public void test(){
- ByteBuf bb = BufferHelper.buildBuffer("01 " + //reason
- "00 00 00 00 00 00 00 " + //padding
- "00 01 02 03 " + //port no
- "00 00 00 00 " + //padding in ofp_port1
- "08 00 27 00 B0 EB " + //mac address
- "00 00 " + //padding in ofp_port2
- "73 31 2d 65 74 68 31 00 00 00 00 00 00 00 00 00 " + // port name, String "s1-eth1"
- "00 00 00 41 " + //port config
- "00 00 00 05 " + //port state
- "00 00 00 81 " + //current features
- "00 00 00 A1 " + //advertised features
- "00 00 00 B1 " + //supported features
- "00 00 00 81 " + //peer features
- "00 00 00 81 " + //curr speed
- "00 00 00 80" //max speed
- );
+ public void test() {
+ ByteBuf bb = BufferHelper.buildBuffer(
+ "01 " + //reason
+ "00 00 00 00 00 00 00 " + //padding
+ "00 01 02 03 " + //port no
+ "00 00 00 00 " + //padding in ofp_port1
+ "08 00 27 00 B0 EB " + //mac address
+ "00 00 " + //padding in ofp_port2
+ "73 31 2d 65 74 68 31 00 00 00 00 00 00 00 00 00 " + // port name, String "s1-eth1"
+ "00 00 00 41 " + //port config
+ "00 00 00 05 " + //port state
+ "00 00 00 81 " + //current features
+ "00 00 00 A1 " + //advertised features
+ "00 00 00 B1 " + //supported features
+ "00 00 00 81 " + //peer features
+ "00 00 00 81 " + //curr speed
+ "00 00 00 80"); //max speed
PortStatusMessage builtByFactory = BufferHelper.deserialize(statusFactory, bb);
}
/**
- * Testing {@link PortStatusMessageFactory} for correct translation into POJO
+ * Testing {@link PortStatusMessageFactory} for correct translation into POJO.
*/
@Test
- public void testWithDifferentBitmaps(){
- ByteBuf bb = BufferHelper.buildBuffer("01 00 00 00 00 00 00 00 " + //reason, padding
- "00 01 02 03 00 00 00 00 " + //port no, padding
- "08 00 27 00 B0 EB 00 00 " + //mac address, padding
- "73 31 2d 65 74 68 31 00 00 00 00 00 00 00 00 00 " + // port name, String "s1-eth1"
- "00 00 00 24 " + //port config
- "00 00 00 02 " + //port state
- "00 00 00 81 00 00 00 A1 " + //current + advertised features
- "00 00 FF FF 00 00 00 00 " + //supported + peer features
- "00 00 00 81 00 00 00 80" //curr speed, max speed
- );
+ public void testWithDifferentBitmaps() {
+ ByteBuf bb = BufferHelper.buildBuffer(
+ "01 00 00 00 00 00 00 00 " + //reason, padding
+ "00 01 02 03 00 00 00 00 " + //port no, padding
+ "08 00 27 00 B0 EB 00 00 " + //mac address, padding
+ "73 31 2d 65 74 68 31 00 00 00 00 00 00 00 00 00 " + // port name, String "s1-eth1"
+ "00 00 00 24 " + //port config
+ "00 00 00 02 " + //port state
+ "00 00 00 81 00 00 00 A1 " + //current + advertised features
+ "00 00 FF FF 00 00 00 00 " + //supported + peer features
+ "00 00 00 81 00 00 00 80"); //curr speed, max speed
+
PortStatusMessage message = BufferHelper.deserialize(statusFactory, bb);
Assert.assertEquals("Wrong portConfig", new PortConfig(true, false, true, false), message.getConfig());
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
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.queue.property.header.QueuePropertyBuilder;
/**
+ * Unit tests for QueueGetConfigReplyMessageFactoryMulti.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFDeserializer<GetQueueConfigOutput> queueFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
/**
* Testing of {@link QueueGetConfigReplyMessageFactory} for correct
- * translation into POJO
+ * translation into POJO.
*/
@Test
public void test() {
}
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();
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
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.queue.property.header.QueuePropertyBuilder;
/**
+ * Unit tests for QueueGetConfigReplyMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFDeserializer<GetQueueConfigOutput> queueFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing {@link QueueGetConfigReplyMessageFactory} for correct translation into POJO
+ * Testing {@link QueueGetConfigReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void test(){
- ByteBuf bb = BufferHelper.buildBuffer("00 00 00 03 00 00 00 00 00 00 00 01 00 00 00 03 00 20 00 00 00 00 00 00 00 02 00 10 00 00 00 00 00 05 00 00 00 00 00 00");
+ public void test() {
+ ByteBuf bb = BufferHelper.buildBuffer("00 00 00 03 00 00 00 00 00 00 00 01 00 00 00 03 00 20 00 00 00 00 "
+ + "00 00 00 02 00 10 00 00 00 00 00 05 00 00 00 00 00 00");
GetQueueConfigOutput builtByFactory = BufferHelper.deserialize(queueFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong port", 3L, builtByFactory.getPort().getValue().longValue());
Assert.assertEquals("Wrong queues", builtByFactory.getQueues(), createQueuesList());
}
- private static List<Queues> createQueuesList(){
- List<Queues> queuesList = new ArrayList<>();
+ private static List<Queues> createQueuesList() {
+ final List<Queues> queuesList = new ArrayList<>();
QueuesBuilder qb = new QueuesBuilder();
qb.setQueueId(new QueueId(1L));
qb.setPort(new PortNumber(3L));
return queuesList;
}
- private static List<QueueProperty> createPropertiesList(){
- List<QueueProperty> propertiesList = new ArrayList<>();
+ private static List<QueueProperty> createPropertiesList() {
+ final List<QueueProperty> propertiesList = new ArrayList<>();
QueuePropertyBuilder pb = new QueuePropertyBuilder();
pb.setProperty(QueueProperties.forValue(2));
RateQueuePropertyBuilder rateBuilder = new RateQueuePropertyBuilder();
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
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.RoleRequestOutput;
/**
+ * Unit tests for RoleReplyMessageFactory.
+ *
* @author timotej.kubas
* @author michal.polkorab
*/
private OFDeserializer<RoleRequestOutput> roleFactory;
/**
- * Initializes deserializer registry and lookups correct deserializer
+ * Initializes deserializer registry and lookups correct deserializer.
*/
@Before
public void startUp() {
}
/**
- * Testing of {@link RoleReplyMessageFactory} for correct translation into POJO
+ * Testing of {@link RoleReplyMessageFactory} for correct translation into POJO.
*/
@Test
- public void test(){
+ public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 02 00 00 00 00 00 01 02 03 04 05 06 07");
RoleRequestOutput builtByFactory = BufferHelper.deserialize(roleFactory, bb);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for RoleRequestInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class RoleRequestInputMessageFactoryTest {
private OFDeserializer<RoleRequestInput> factory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.async.body.grouping.PortStatusMaskBuilder;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for SetAsyncInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class SetAsyncInputMessageFactoryTest {
private OFDeserializer<SetAsyncInput> 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 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;
/**
- * @author giuseppex.petralia@intel.com
+ * Unit tests for TableModInputMessageFactory.
*
+ * @author giuseppex.petralia@intel.com
*/
public class TableModInputMessageFactoryTest {
import org.opendaylight.openflowjava.util.ByteBufUtils;
/**
- * @author michal.polkorab
+ * Unit tests for VendorMessageFactory.
*
+ * @author michal.polkorab
*/
@RunWith(MockitoJUnitRunner.class)
public class VendorMessageFactoryTest {
@Mock ExperimenterMessageFactory deserializer;
/**
- * Tests {@link VendorMessageFactory#deserialize(ByteBuf)}
+ * Tests {@link VendorMessageFactory#deserialize(ByteBuf)}.
*/
@Test
public void test() {
Mockito.verify(deserializer, Mockito.times(1)).deserialize(buffer);
Assert.assertEquals("Buffer index modified", 4, buffer.readableBytes());
}
-}
\ No newline at end of file
+}