Search in sources :

Example 1 with PortStats

use of 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 in project openflowplugin by opendaylight.

the class MultipartRequestInputFactory method serializePortStatsBody.

private static void serializePortStatsBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) {
    MultipartRequestPortStatsCase portstatsCase = (MultipartRequestPortStatsCase) multipartRequestBody;
    MultipartRequestPortStats portstats = portstatsCase.getMultipartRequestPortStats();
    output.writeInt(portstats.getPortNo().intValue());
    output.writeZero(PADDING_IN_MULTIPART_REQUEST_PORTSTATS_BODY);
}
Also used : MultipartRequestPortStatsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCase) MultipartRequestPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStats)

Example 2 with PortStats

use of 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 in project openflowplugin by opendaylight.

the class OF10StatsRequestInputFactory method serializePortBody.

private static void serializePortBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) {
    MultipartRequestPortStatsCase portstatsCase = (MultipartRequestPortStatsCase) multipartRequestBody;
    MultipartRequestPortStats portstats = portstatsCase.getMultipartRequestPortStats();
    output.writeShort(portstats.getPortNo().intValue());
    output.writeZero(PADDING_IN_MULTIPART_REQUEST_PORT_BODY);
}
Also used : MultipartRequestPortStatsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCase) MultipartRequestPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStats)

Example 3 with PortStats

use of 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 in project openflowplugin by opendaylight.

the class NodeConnectorStatisticsToNotificationTransformer method processSingleNodeConnectorStats.

@VisibleForTesting
static NodeConnectorStatisticsAndPortNumberMapBuilder processSingleNodeConnectorStats(DeviceInfo deviceInfo, OpenflowVersion ofVersion, PortStats portStats) {
    NodeConnectorStatisticsAndPortNumberMapBuilder statsBuilder = new NodeConnectorStatisticsAndPortNumberMapBuilder();
    statsBuilder.setNodeConnectorId(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(deviceInfo.getDatapathId(), portStats.getPortNo(), ofVersion));
    BytesBuilder bytesBuilder = new BytesBuilder();
    bytesBuilder.setReceived(portStats.getRxBytes());
    bytesBuilder.setTransmitted(portStats.getTxBytes());
    statsBuilder.setBytes(bytesBuilder.build());
    PacketsBuilder packetsBuilder = new PacketsBuilder();
    packetsBuilder.setReceived(portStats.getRxPackets());
    packetsBuilder.setTransmitted(portStats.getTxPackets());
    statsBuilder.setPackets(packetsBuilder.build());
    DurationBuilder durationBuilder = new DurationBuilder();
    if (portStats.getDurationSec() != null) {
        durationBuilder.setSecond(new Counter32(portStats.getDurationSec()));
    }
    if (portStats.getDurationNsec() != null) {
        durationBuilder.setNanosecond(new Counter32(portStats.getDurationNsec()));
    }
    statsBuilder.setDuration(durationBuilder.build());
    statsBuilder.setCollisionCount(portStats.getCollisions());
    statsBuilder.setKey(new NodeConnectorStatisticsAndPortNumberMapKey(statsBuilder.getNodeConnectorId()));
    statsBuilder.setReceiveCrcError(portStats.getRxCrcErr());
    statsBuilder.setReceiveDrops(portStats.getRxDropped());
    statsBuilder.setReceiveErrors(portStats.getRxErrors());
    statsBuilder.setReceiveFrameError(portStats.getRxFrameErr());
    statsBuilder.setReceiveOverRunError(portStats.getRxOverErr());
    statsBuilder.setTransmitDrops(portStats.getTxDropped());
    statsBuilder.setTransmitErrors(portStats.getTxErrors());
    return statsBuilder;
}
Also used : 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) PacketsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.PacketsBuilder) 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) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 4 with PortStats

use of 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 in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorUtil method translatePortStats.

private static org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.reply.multipart.reply.body.MultipartReplyPortStats translatePortStats(final MultipartReply msg, final OpenflowVersion ofVersion, final BigInteger datapathId) {
    MultipartReplyPortStatsBuilder message = new MultipartReplyPortStatsBuilder();
    MultipartReplyPortStatsCase caseBody = (MultipartReplyPortStatsCase) msg.getMultipartReplyBody();
    MultipartReplyPortStats replyBody = caseBody.getMultipartReplyPortStats();
    List<NodeConnectorStatisticsAndPortNumberMap> statsMap = new ArrayList<>();
    for (PortStats portStats : replyBody.getPortStats()) {
        NodeConnectorStatisticsAndPortNumberMapBuilder statsBuilder = new NodeConnectorStatisticsAndPortNumberMapBuilder();
        statsBuilder.setNodeConnectorId(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathId, portStats.getPortNo(), ofVersion));
        BytesBuilder bytesBuilder = new BytesBuilder();
        bytesBuilder.setReceived(portStats.getRxBytes());
        bytesBuilder.setTransmitted(portStats.getTxBytes());
        statsBuilder.setBytes(bytesBuilder.build());
        PacketsBuilder packetsBuilder = new PacketsBuilder();
        packetsBuilder.setReceived(portStats.getRxPackets());
        packetsBuilder.setTransmitted(portStats.getTxPackets());
        statsBuilder.setPackets(packetsBuilder.build());
        DurationBuilder durationBuilder = new DurationBuilder();
        if (portStats.getDurationSec() != null) {
            durationBuilder.setSecond(new Counter32(portStats.getDurationSec()));
        }
        if (portStats.getDurationNsec() != null) {
            durationBuilder.setNanosecond(new Counter32(portStats.getDurationNsec()));
        }
        statsBuilder.setDuration(durationBuilder.build());
        statsBuilder.setCollisionCount(portStats.getCollisions());
        statsBuilder.setKey(new NodeConnectorStatisticsAndPortNumberMapKey(statsBuilder.getNodeConnectorId()));
        statsBuilder.setReceiveCrcError(portStats.getRxCrcErr());
        statsBuilder.setReceiveDrops(portStats.getRxDropped());
        statsBuilder.setReceiveErrors(portStats.getRxErrors());
        statsBuilder.setReceiveFrameError(portStats.getRxFrameErr());
        statsBuilder.setReceiveOverRunError(portStats.getRxOverErr());
        statsBuilder.setTransmitDrops(portStats.getTxDropped());
        statsBuilder.setTransmitErrors(portStats.getTxErrors());
        statsMap.add(statsBuilder.build());
    }
    message.setNodeConnectorStatisticsAndPortNumberMap(statsMap);
    return message.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) 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) MultipartReplyPortStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.reply.multipart.reply.body.MultipartReplyPortStatsBuilder) 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) 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) MultipartReplyPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats) 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)

Example 5 with PortStats

use of 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 in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactory method serializePortStatsBody.

private void serializePortStatsBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
    MultipartReplyPortStatsCase portStatsCase = (MultipartReplyPortStatsCase) body;
    MultipartReplyPortStats portStats = portStatsCase.getMultipartReplyPortStats();
    for (PortStats portStat : portStats.getPortStats()) {
        outBuffer.writeInt(portStat.getPortNo().intValue());
        outBuffer.writeZero(PORT_STATS_PADDING);
        outBuffer.writeLong(portStat.getRxPackets().longValue());
        outBuffer.writeLong(portStat.getTxPackets().longValue());
        outBuffer.writeLong(portStat.getRxBytes().longValue());
        outBuffer.writeLong(portStat.getTxBytes().longValue());
        outBuffer.writeLong(portStat.getRxDropped().longValue());
        outBuffer.writeLong(portStat.getTxDropped().longValue());
        outBuffer.writeLong(portStat.getRxErrors().longValue());
        outBuffer.writeLong(portStat.getTxErrors().longValue());
        outBuffer.writeLong(portStat.getRxFrameErr().longValue());
        outBuffer.writeLong(portStat.getRxOverErr().longValue());
        outBuffer.writeLong(portStat.getRxCrcErr().longValue());
        outBuffer.writeLong(portStat.getCollisions().longValue());
        outBuffer.writeInt(portStat.getDurationSec().intValue());
        outBuffer.writeInt(portStat.getDurationNsec().intValue());
    }
}
Also used : MultipartReplyPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats) MultipartReplyPortStatsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase) 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) MultipartReplyPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats)

Aggregations

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)12 MultipartReplyPortStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats)10 MultipartReplyPortStatsCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase)8 ArrayList (java.util.ArrayList)6 MultipartReplyPortStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStatsBuilder)6 MultipartReplyPortStatsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCaseBuilder)4 PortStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStatsBuilder)4 NodeConnectorStatisticsAndPortNumberMap (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap)4 NodeConnectorStatisticsAndPortNumberMapBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder)4 ByteBuf (io.netty.buffer.ByteBuf)3 Test (org.junit.Test)3 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)3 DurationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)3 BytesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.BytesBuilder)3 PacketsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.PacketsBuilder)3 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)3 MultipartRequestPortStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStats)3 NodeConnectorStatisticsAndPortNumberMapKey (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey)3 BigInteger (java.math.BigInteger)2 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)2