use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetQueueStatisticsOutputBuilder 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