use of org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapKey in project openflowplugin by opendaylight.
the class MultipartReplyQueueStatsDeserializer method deserialize.
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
final MultipartReplyQueueStatsBuilder builder = new MultipartReplyQueueStatsBuilder();
final List<QueueIdAndStatisticsMap> items = new ArrayList<>();
while (message.readableBytes() > 0) {
final long port = message.readUnsignedInt();
final NodeConnectorId nodeConnectorId = new NodeConnectorId(OpenflowPortsUtil.getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port));
final QueueId queueId = new QueueId(message.readUnsignedInt());
final byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(txBytes);
final byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(txPackets);
final byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(txErrors);
items.add(new QueueIdAndStatisticsMapBuilder().setKey(new QueueIdAndStatisticsMapKey(nodeConnectorId, queueId)).setNodeConnectorId(nodeConnectorId).setQueueId(queueId).setTransmittedBytes(new Counter64(new BigInteger(1, txBytes))).setTransmittedPackets(new Counter64(new BigInteger(1, txPackets))).setTransmissionErrors(new Counter64(new BigInteger(1, txErrors))).setDuration(new DurationBuilder().setSecond(new Counter32(message.readUnsignedInt())).setNanosecond(new Counter32(message.readUnsignedInt())).build()).build());
}
return builder.setQueueIdAndStatisticsMap(items).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapKey in project openflowplugin by opendaylight.
the class QueueDirectStatisticsService method buildReply.
@Override
protected GetQueueStatisticsOutput buildReply(List<MultipartReply> input, boolean success) {
final List<QueueIdAndStatisticsMap> queueIdAndStatisticsMap = new ArrayList<>();
if (success) {
for (final MultipartReply mpReply : input) {
final MultipartReplyQueueCase caseBody = (MultipartReplyQueueCase) mpReply.getMultipartReplyBody();
final MultipartReplyQueue replyBody = caseBody.getMultipartReplyQueue();
for (final QueueStats queueStats : replyBody.getQueueStats()) {
final DurationBuilder durationBuilder = new DurationBuilder().setSecond(new Counter32(queueStats.getDurationSec())).setNanosecond(new Counter32(queueStats.getDurationNsec()));
final QueueId queueId = new QueueId(queueStats.getQueueId());
final NodeConnectorId nodeConnectorId = InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(getDatapathId(), queueStats.getPortNo(), getOfVersion());
final QueueIdAndStatisticsMapBuilder statsBuilder = new QueueIdAndStatisticsMapBuilder().setKey(new QueueIdAndStatisticsMapKey(nodeConnectorId, queueId)).setNodeConnectorId(nodeConnectorId).setTransmissionErrors(new Counter64(queueStats.getTxErrors())).setTransmittedBytes(new Counter64(queueStats.getTxBytes())).setTransmittedPackets(new Counter64(queueStats.getTxPackets())).setQueueId(queueId).setDuration(durationBuilder.build());
queueIdAndStatisticsMap.add(statsBuilder.build());
}
}
}
return new GetQueueStatisticsOutputBuilder().setQueueIdAndStatisticsMap(queueIdAndStatisticsMap).build();
}
Aggregations