use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterStats in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorUtil method translateMeter.
private static MultipartReplyMeterStats translateMeter(final MultipartReply msg, final VersionDatapathIdConvertorData data, final ConvertorExecutor convertorExecutor) {
MultipartReplyMeterStatsBuilder message = new MultipartReplyMeterStatsBuilder();
MultipartReplyMeterCase caseBody = (MultipartReplyMeterCase) msg.getMultipartReplyBody();
MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats>> meterStatsList = convertorExecutor.convert(replyBody.getMeterStats(), data);
message.setMeterStats(meterStatsList.orElse(Collections.emptyList()));
return message.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterStats in project openflowplugin by opendaylight.
the class MultipartReplyMeterStatsDeserializerTest method deserialize.
@Test
public void deserialize() throws Exception {
ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();
buffer.writeInt(METER_ID);
buffer.writeShort(ITEM_LENGTH);
buffer.writeZero(PADDING_IN_METER_STATS_HEADER);
buffer.writeInt(FLOW_COUNT);
buffer.writeLong(PACKET_IN_COUNT);
buffer.writeLong(BYTE_IN_COUNT);
buffer.writeInt(SECOND);
buffer.writeInt(NANOSECOND);
buffer.writeLong(PACKET_BAND_COUNT);
buffer.writeLong(BYTE_BAND_COUNT);
final MultipartReplyMeterStats reply = (MultipartReplyMeterStats) deserializeMultipart(buffer);
final MeterStats meterStats = reply.getMeterStats().get(0);
assertEquals(METER_ID, meterStats.getMeterId().getValue().intValue());
assertEquals(FLOW_COUNT, meterStats.getFlowCount().getValue().intValue());
assertEquals(PACKET_IN_COUNT, meterStats.getPacketInCount().getValue().longValue());
assertEquals(BYTE_IN_COUNT, meterStats.getByteInCount().getValue().intValue());
assertEquals(SECOND, meterStats.getDuration().getSecond().getValue().intValue());
assertEquals(NANOSECOND, meterStats.getDuration().getNanosecond().getValue().intValue());
assertEquals(PACKET_BAND_COUNT, meterStats.getMeterBandStats().getBandStat().get(0).getPacketBandCount().getValue().longValue());
assertEquals(BYTE_BAND_COUNT, meterStats.getMeterBandStats().getBandStat().get(0).getByteBandCount().getValue().longValue());
assertEquals(0, buffer.readableBytes());
}
Aggregations