Search in sources :

Example 6 with MultipartReplyAggregate

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactory method serializeAggregateBody.

private void serializeAggregateBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
    MultipartReplyAggregateCase aggregateCase = (MultipartReplyAggregateCase) body;
    MultipartReplyAggregate aggregate = aggregateCase.getMultipartReplyAggregate();
    outBuffer.writeLong(aggregate.getPacketCount().longValue());
    outBuffer.writeLong(aggregate.getByteCount().longValue());
    outBuffer.writeInt(aggregate.getFlowCount().intValue());
    outBuffer.writeZero(AGGREGATE_PADDING);
}
Also used : MultipartReplyAggregateCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase) MultipartReplyAggregate(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate)

Example 7 with MultipartReplyAggregate

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactoryTest method testMultipartReplyAggregateBody.

/**
 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
 */
@Test
public void testMultipartReplyAggregateBody() {
    ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 00 00 00 00 " + // packetCount
    "FF 01 01 01 01 01 01 01 " + // byteCount
    "0F 01 01 01 01 01 01 01 " + // flowCount
    "00 00 00 08 " + // pad
    "00 00 00 00");
    MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 0x02, builtByFactory.getType().getIntValue());
    Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
    MultipartReplyAggregateCase messageCase = (MultipartReplyAggregateCase) builtByFactory.getMultipartReplyBody();
    MultipartReplyAggregate message = messageCase.getMultipartReplyAggregate();
    Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getPacketCount());
    Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[] { (byte) 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getByteCount());
    Assert.assertEquals("Wrong flowCount", 8, message.getFlowCount().intValue());
}
Also used : MultipartReplyAggregateCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase) MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) MultipartReplyAggregate(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate) BigInteger(java.math.BigInteger) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

MultipartReplyAggregateCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase)7 MultipartReplyAggregate (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate)7 ByteBuf (io.netty.buffer.ByteBuf)3 Test (org.junit.Test)3 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)3 BigInteger (java.math.BigInteger)2 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)2 Counter64 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64)2 AggregatedFlowStatisticsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatisticsBuilder)1 MultipartReplyFlowAggregateStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowAggregateStatsBuilder)1 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)1 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)1 MultipartReplyAggregateCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCaseBuilder)1 MultipartReplyAggregateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder)1