use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowAggregateStatsBuilder in project openflowplugin by opendaylight.
the class MultipartReplyFlowAggregateStatsDeserializer method deserialize.
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
final byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(packetCount);
final byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(byteCount);
final MultipartReplyFlowAggregateStatsBuilder builder = new MultipartReplyFlowAggregateStatsBuilder().setPacketCount(new Counter64(new BigInteger(1, packetCount))).setByteCount(new Counter64(new BigInteger(1, byteCount))).setFlowCount(new Counter32(message.readUnsignedInt()));
message.skipBytes(PADDING_IN_AGGREGATE_HEADER);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowAggregateStatsBuilder in project openflowplugin by opendaylight.
the class SingleLayerAggregateFlowMultipartServiceTest method handleAndReply.
@Test
public void handleAndReply() throws Exception {
mockSuccessfulFuture(Collections.singletonList(new MultipartReplyBuilder().setMultipartReplyBody(new MultipartReplyFlowAggregateStatsBuilder().setByteCount(new Counter64(BYTE_COUNT)).build()).build()));
final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input = new GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder().setTableId(TABLE_ID).build();
final Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> rpcResultFuture = service.handleAndReply(input);
final RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput> sendAggregateFlowMpRequestOutputRpcResult = rpcResultFuture.get();
assertEquals(BYTE_COUNT, sendAggregateFlowMpRequestOutputRpcResult.getResult().getAggregatedFlowStatistics().get(0).getByteCount().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowAggregateStatsBuilder 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();
}
Aggregations