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();
}
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);
}
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);
}
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());
}
Aggregations