Search in sources :

Example 6 with MultipartReplyAggregateCase

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

the class MultipartReplyTranslatorUtil method translateAggregate.

private static MultipartReplyFlowAggregateStats translateAggregate(final MultipartReply msg) {
    MultipartReplyFlowAggregateStatsBuilder message = new MultipartReplyFlowAggregateStatsBuilder();
    MultipartReplyAggregateCase caseBody = (MultipartReplyAggregateCase) msg.getMultipartReplyBody();
    MultipartReplyAggregate replyBody = caseBody.getMultipartReplyAggregate();
    message.setByteCount(new Counter64(replyBody.getByteCount()));
    message.setPacketCount(new Counter64(replyBody.getPacketCount()));
    message.setFlowCount(new Counter32(replyBody.getFlowCount()));
    return message.build();
}
Also used : MultipartReplyFlowAggregateStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowAggregateStatsBuilder) Counter32(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32) MultipartReplyAggregateCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase) Counter64(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64) MultipartReplyAggregate(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate)

Example 7 with MultipartReplyAggregateCase

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

the class OF10StatsReplyMessageFactory method serializeAggregateBody.

private void serializeAggregateBody(MultipartReplyBody body, 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 8 with MultipartReplyAggregateCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase 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 9 with MultipartReplyAggregateCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase 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 BigInteger (java.math.BigInteger)4 ByteBuf (io.netty.buffer.ByteBuf)3 Test (org.junit.Test)3 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)3 MultipartReplyAggregateCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCaseBuilder)3 MultipartReplyAggregateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder)3 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