Search in sources :

Example 1 with GetNodeConnectorStatisticsOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsOutputBuilder in project openflowplugin by opendaylight.

the class PortDirectStatisticsService method buildReply.

@Override
protected GetNodeConnectorStatisticsOutput buildReply(List<MultipartReply> input, boolean success) {
    final List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsAndPortNumberMap = new ArrayList<>();
    if (success) {
        for (final MultipartReply mpReply : input) {
            final MultipartReplyPortStatsCase caseBody = (MultipartReplyPortStatsCase) mpReply.getMultipartReplyBody();
            final MultipartReplyPortStats replyBody = caseBody.getMultipartReplyPortStats();
            for (final PortStats portStats : replyBody.getPortStats()) {
                final NodeConnectorId nodeConnectorId = InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(getDatapathId(), portStats.getPortNo(), getOfVersion());
                final BytesBuilder bytesBuilder = new BytesBuilder().setReceived(portStats.getRxBytes()).setTransmitted(portStats.getTxBytes());
                final PacketsBuilder packetsBuilder = new PacketsBuilder().setReceived(portStats.getRxPackets()).setTransmitted(portStats.getTxPackets());
                final DurationBuilder durationBuilder = new DurationBuilder();
                if (portStats.getDurationSec() != null) {
                    durationBuilder.setSecond(new Counter32(portStats.getDurationSec()));
                }
                if (portStats.getDurationNsec() != null) {
                    durationBuilder.setNanosecond(new Counter32(portStats.getDurationNsec()));
                }
                final NodeConnectorStatisticsAndPortNumberMap stats = new NodeConnectorStatisticsAndPortNumberMapBuilder().setBytes(bytesBuilder.build()).setPackets(packetsBuilder.build()).setNodeConnectorId(nodeConnectorId).setDuration(durationBuilder.build()).setCollisionCount(portStats.getCollisions()).setKey(new NodeConnectorStatisticsAndPortNumberMapKey(nodeConnectorId)).setReceiveCrcError(portStats.getRxCrcErr()).setReceiveDrops(portStats.getRxDropped()).setReceiveErrors(portStats.getRxErrors()).setReceiveFrameError(portStats.getRxFrameErr()).setReceiveOverRunError(portStats.getRxOverErr()).setTransmitDrops(portStats.getTxDropped()).setTransmitErrors(portStats.getTxErrors()).build();
                nodeConnectorStatisticsAndPortNumberMap.add(stats);
            }
        }
    }
    return new GetNodeConnectorStatisticsOutputBuilder().setNodeConnectorStatisticsAndPortNumberMap(nodeConnectorStatisticsAndPortNumberMap).build();
}
Also used : MultipartReplyPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats) GetNodeConnectorStatisticsOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsOutputBuilder) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) ArrayList(java.util.ArrayList) PacketsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.PacketsBuilder) Counter32(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32) NodeConnectorStatisticsAndPortNumberMapKey(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey) NodeConnectorStatisticsAndPortNumberMapBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder) MultipartReplyPortStatsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase) MultipartReplyPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats) PortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStats) NodeConnectorStatisticsAndPortNumberMap(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap) BytesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.BytesBuilder) DurationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)

Aggregations

ArrayList (java.util.ArrayList)1 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)1 GetNodeConnectorStatisticsOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsOutputBuilder)1 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)1 DurationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)1 BytesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.BytesBuilder)1 PacketsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.PacketsBuilder)1 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)1 MultipartReplyPortStatsCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase)1 MultipartReplyPortStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats)1 PortStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStats)1 NodeConnectorStatisticsAndPortNumberMap (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap)1 NodeConnectorStatisticsAndPortNumberMapBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder)1 NodeConnectorStatisticsAndPortNumberMapKey (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey)1