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