use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link in project openflowplugin by opendaylight.
the class GroupingResolverTest method testGetExtension.
/**
* test of method {@link GroupingResolver#getExtension(Augmentable)}.
*/
@Test
public void testGetExtension() {
GroupingResolver<GeneralExtensionListGrouping, Match> eqGroup = new GroupingResolver<>(GeneralExtensionListGrouping.class);
eqGroup.add(GeneralAugMatchNodesNodeTableFlow.class);
eqGroup.add(GeneralAugMatchRpcAddFlow.class);
MatchBuilder mb1 = new MatchBuilder();
ExtensionList extension1 = new ExtensionListBuilder().setExtensionKey(JoachimTheBig.class).build();
GeneralAugMatchNodesNodeTableFlow odlxxx1 = new GeneralAugMatchNodesNodeTableFlowBuilder().setExtensionList(Collections.singletonList(extension1)).build();
Match match1 = mb1.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, odlxxx1).build();
MatchBuilder mb2 = new MatchBuilder();
ExtensionList extension2 = new ExtensionListBuilder().setExtensionKey(JoachimTheTiny.class).build();
GeneralAugMatchNodesNodeTableFlow odlxxx2 = new GeneralAugMatchNodesNodeTableFlowBuilder().setExtensionList(Collections.singletonList(extension2)).build();
Match match2 = mb2.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, odlxxx2).build();
Assert.assertEquals(JoachimTheBig.class, eqGroup.getExtension(match1).get().getExtensionList().get(0).getExtensionKey());
Assert.assertEquals(JoachimTheTiny.class, eqGroup.getExtension(match2).get().getExtensionList().get(0).getExtensionKey());
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link in project openflowplugin by opendaylight.
the class GetConfigReplyMessageFactoryTest method test.
/**
* Testing {@link GetConfigReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 00 03");
GetConfigOutput builtByFactory = BufferHelper.deserialize(factory, bb);
Assert.assertEquals("Wrong switchConfigFlag", 0x01, builtByFactory.getFlags().getIntValue());
Assert.assertEquals("Wrong missSendLen", 0x03, builtByFactory.getMissSendLen().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link in project openflowplugin by opendaylight.
the class HelloMessageFactoryTest method testWithoutPadding.
/**
* Testing {@link HelloMessageFactory} for correct length without padding.
*/
@Test
public void testWithoutPadding() {
ByteBuf bb = BufferHelper.buildBuffer(// type
"00 01 " + // length
"00 08 " + // bitmap 1
"00 00 00 11");
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());
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyMeterBodyMulti.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyMeterBodyMulti() {
ByteBuf bb = BufferHelper.buildBuffer("00 09 00 01 00 00 00 00 " + // meterId_0
"00 00 00 09 " + // len_0
"00 58 " + // pad_0
"00 00 00 00 00 00 " + // flowCount_0
"00 00 00 07 " + // packetInCount_0
"FF 01 01 01 01 01 01 01 " + // byteInCount_0
"FF 01 01 01 01 01 01 01 " + // durationSec_0
"00 00 00 05 " + // durationNsec_0
"00 00 00 05 " + // packetBandCount_01
"FF 01 01 01 01 01 01 01 " + // byteBandCount_01
"FF 01 01 01 01 01 01 01 " + // packetBandCount_02
"FF 02 02 02 02 02 02 02 " + // byteBandCount_02
"FF 02 02 02 02 02 02 02 " + // packetBandCount_03
"FF 03 03 03 03 03 03 03 " + // byteBandCount_03
"FF 03 03 03 03 03 03 03 " + // meterId_1
"00 00 00 08 " + // len_1
"00 58 " + // pad_1
"00 00 00 00 00 00 " + // flowCount_1
"00 00 00 07 " + // packetInCount_1
"FF 01 01 01 01 01 01 01 " + // byteInCount_1
"FF 01 01 01 01 01 01 01 " + // durationSec_1
"00 00 00 05 " + // durationNsec_1
"00 00 00 05 " + // packetBandCount_11
"FF 01 01 01 01 01 01 01 " + // byteBandCount_11
"FF 01 01 01 01 01 01 01 " + // packetBandCount_12
"FF 02 02 02 02 02 02 02 " + // byteBandCount_12
"FF 02 02 02 02 02 02 02 " + // packetBandCount_13
"FF 03 03 03 03 03 03 03 " + // byteBandCount_13
"FF 03 03 03 03 03 03 03");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 9, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyMeterCase messageCase = (MultipartReplyMeterCase) builtByFactory.getMultipartReplyBody();
MultipartReplyMeter message = messageCase.getMultipartReplyMeter();
Assert.assertEquals("Wrong meterId", 9, message.getMeterStats().get(0).getMeterId().getValue().intValue());
Assert.assertEquals("Wrong flowCount", 7, message.getMeterStats().get(0).getFlowCount().intValue());
Assert.assertEquals("Wrong packetInCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getMeterStats().get(0).getPacketInCount());
Assert.assertEquals("Wrong byteInCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getMeterStats().get(0).getByteInCount());
Assert.assertEquals("Wrong durationSec", 5, message.getMeterStats().get(0).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec", 5, message.getMeterStats().get(0).getDurationNsec().intValue());
Assert.assertEquals("Wrong packetBandCount_01", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_01", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
Assert.assertEquals("Wrong packetBandCount_02", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 }), message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_02", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 }), message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
Assert.assertEquals("Wrong packetBandCount_03", new BigInteger(1, new byte[] { (byte) 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }), message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_03", new BigInteger(1, new byte[] { (byte) 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }), message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
Assert.assertEquals("Wrong meterId", 8, message.getMeterStats().get(1).getMeterId().getValue().intValue());
Assert.assertEquals("Wrong flowCount", 7, message.getMeterStats().get(1).getFlowCount().intValue());
Assert.assertEquals("Wrong packetInCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getMeterStats().get(1).getPacketInCount());
Assert.assertEquals("Wrong byteInCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getMeterStats().get(1).getByteInCount());
Assert.assertEquals("Wrong durationSec", 5, message.getMeterStats().get(1).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec", 5, message.getMeterStats().get(1).getDurationNsec().intValue());
Assert.assertEquals("Wrong packetBandCount_01", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getMeterStats().get(1).getMeterBandStats().get(0).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_01", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getMeterStats().get(1).getMeterBandStats().get(0).getByteBandCount());
Assert.assertEquals("Wrong packetBandCount_02", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 }), message.getMeterStats().get(1).getMeterBandStats().get(1).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_02", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 }), message.getMeterStats().get(1).getMeterBandStats().get(1).getByteBandCount());
Assert.assertEquals("Wrong packetBandCount_03", new BigInteger(1, new byte[] { (byte) 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }), message.getMeterStats().get(1).getMeterBandStats().get(2).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_03", new BigInteger(1, new byte[] { (byte) 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }), message.getMeterStats().get(1).getMeterBandStats().get(2).getByteBandCount());
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyGroupBody.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyGroupBody() {
ByteBuf bb = BufferHelper.buildBuffer("00 06 00 01 00 00 00 00 " + // length
"00 48 " + // pad1
"00 00 " + // groupId
"00 00 00 10 " + // refCount
"00 00 00 12 " + // pad2
"00 00 00 00 " + // packetCount
"FF 01 01 01 01 01 01 01 " + // byteCount
"FF 01 01 01 01 01 01 01 " + // durationSec
"00 00 00 08 " + // durationNsec
"00 00 00 09 " + // packetCountBucket
"FF 01 01 01 01 01 01 01 " + // byteCountBucket
"FF 01 01 01 01 01 01 01 " + // packetCountBucket_2
"FF 02 02 02 02 02 02 02 " + // byteCountBucket_2
"FF 02 02 02 02 02 02 02 " + // length_2
"00 48 " + // pad1.2
"00 00 " + // groupId_2
"00 00 00 10 " + // refCount_2
"00 00 00 12 " + // pad2.2
"00 00 00 00 " + // packetCount_2
"FF 01 01 01 01 01 01 01 " + // byteCount_2
"FF 01 01 01 01 01 01 01 " + // durationSec_2
"00 00 00 08 " + // durationNsec_2
"00 00 00 09 " + // packetCountBucket_1.2
"FF 01 01 01 01 01 01 01 " + // byteCountBucket_1.2
"FF 01 01 01 01 01 01 01 " + // packetCountBucket_2.2
"FF 02 02 02 02 02 02 02 " + // byteCountBucket_2.2
"FF 02 02 02 02 02 02 02");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 0x06, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupCase messageCase = (MultipartReplyGroupCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroup message = messageCase.getMultipartReplyGroup();
Assert.assertEquals("Wrong groupId", 16, message.getGroupStats().get(0).getGroupId().getValue().intValue());
Assert.assertEquals("Wrong refCount", 18, message.getGroupStats().get(0).getRefCount().intValue());
Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getGroupStats().get(0).getPacketCount());
Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getGroupStats().get(0).getByteCount());
Assert.assertEquals("Wrong durationSec", 8, message.getGroupStats().get(0).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec", 9, message.getGroupStats().get(0).getDurationNsec().intValue());
Assert.assertEquals("Wrong packetCountBucket", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getGroupStats().get(0).getBucketStats().get(0).getPacketCount());
Assert.assertEquals("Wrong byteCountBucket", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getGroupStats().get(0).getBucketStats().get(0).getByteCount());
Assert.assertEquals("Wrong packetCountBucket_2", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 }), message.getGroupStats().get(0).getBucketStats().get(1).getPacketCount());
Assert.assertEquals("Wrong byteCountBucket_2", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 }), message.getGroupStats().get(0).getBucketStats().get(1).getByteCount());
Assert.assertEquals("Wrong groupId_2", 16, message.getGroupStats().get(1).getGroupId().getValue().intValue());
Assert.assertEquals("Wrong refCount_2", 18, message.getGroupStats().get(1).getRefCount().intValue());
Assert.assertEquals("Wrong packetCount_2", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getGroupStats().get(1).getPacketCount());
Assert.assertEquals("Wrong byteCount_2", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getGroupStats().get(1).getByteCount());
Assert.assertEquals("Wrong durationSec_2", 8, message.getGroupStats().get(1).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec_2", 9, message.getGroupStats().get(1).getDurationNsec().intValue());
Assert.assertEquals("Wrong packetCountBucket_1.2", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getGroupStats().get(1).getBucketStats().get(0).getPacketCount());
Assert.assertEquals("Wrong byteCountBucket_1.2", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getGroupStats().get(1).getBucketStats().get(0).getByteCount());
Assert.assertEquals("Wrong packetCountBucket_2.2", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 }), message.getGroupStats().get(1).getBucketStats().get(1).getPacketCount());
Assert.assertEquals("Wrong byteCountBucket_2.2", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 }), message.getGroupStats().get(1).getBucketStats().get(1).getByteCount());
}
Aggregations