Search in sources :

Example 1 with BytesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.acl.drop.stats.BytesBuilder in project openflowplugin by opendaylight.

the class MultipartReplyPortStatsDeserializer method deserialize.

@Override
public MultipartReplyBody deserialize(ByteBuf message) {
    final MultipartReplyPortStatsBuilder builder = new MultipartReplyPortStatsBuilder();
    final List<NodeConnectorStatisticsAndPortNumberMap> items = new ArrayList<>();
    while (message.readableBytes() > 0) {
        final NodeConnectorStatisticsAndPortNumberMapBuilder itemBuilder = new NodeConnectorStatisticsAndPortNumberMapBuilder();
        final long port = message.readUnsignedInt();
        itemBuilder.setNodeConnectorId(new NodeConnectorId(OpenflowPortsUtil.getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port)));
        message.skipBytes(PADDING_IN_PORT_STATS_HEADER);
        final byte[] recPack = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(recPack);
        final byte[] txPack = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(txPack);
        final byte[] recByt = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(recByt);
        final byte[] txByt = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(txByt);
        final byte[] recDrop = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(recDrop);
        final byte[] txDrop = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(txDrop);
        final byte[] recError = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(recError);
        final byte[] txError = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(txError);
        final byte[] recFrameError = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(recFrameError);
        final byte[] recOverRunError = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(recOverRunError);
        final byte[] recCrcError = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(recCrcError);
        final byte[] collisionCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(collisionCount);
        items.add(itemBuilder.setKey(new NodeConnectorStatisticsAndPortNumberMapKey(itemBuilder.getNodeConnectorId())).setPackets(new PacketsBuilder().setReceived(new BigInteger(1, recPack)).setTransmitted(new BigInteger(1, txPack)).build()).setBytes(new BytesBuilder().setReceived(new BigInteger(1, recByt)).setTransmitted(new BigInteger(1, txByt)).build()).setReceiveDrops(new BigInteger(1, recDrop)).setTransmitDrops(new BigInteger(1, txDrop)).setReceiveErrors(new BigInteger(1, recError)).setTransmitErrors(new BigInteger(1, txError)).setReceiveFrameError(new BigInteger(1, recFrameError)).setReceiveOverRunError(new BigInteger(1, recOverRunError)).setReceiveCrcError(new BigInteger(1, recCrcError)).setCollisionCount(new BigInteger(1, collisionCount)).setDuration(new DurationBuilder().setSecond(new Counter32(message.readUnsignedInt())).setNanosecond(new Counter32(message.readUnsignedInt())).build()).build());
    }
    return builder.setNodeConnectorStatisticsAndPortNumberMap(items).build();
}
Also used : 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) 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) BigInteger(java.math.BigInteger) 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 2 with BytesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.acl.drop.stats.BytesBuilder 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 3 with BytesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.acl.drop.stats.BytesBuilder 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 4 with BytesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.acl.drop.stats.BytesBuilder 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)

Example 5 with BytesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.acl.drop.stats.BytesBuilder in project netvirt by opendaylight.

the class AclLiveStatisticsHelper method getAclDropStats.

/**
 * Gets the acl drop stats.
 *
 * @param direction the direction
 * @param aclStatsBuilder the acl stats builder
 * @param flowStatsOutput the flow stats output
 */
private static void getAclDropStats(Direction direction, AclPortStatsBuilder aclStatsBuilder, GetFlowStatisticsOutput flowStatsOutput) {
    List<FlowAndStatisticsMapList> flowAndStatisticsMapList = flowStatsOutput.getFlowAndStatisticsMapList();
    if (flowAndStatisticsMapList == null || flowAndStatisticsMapList.isEmpty()) {
        String errMsg = "Unable to retrieve drop counts as interface is not configured for statistics collection.";
        aclStatsBuilder.setError(new ErrorBuilder().setErrorMessage(errMsg).build());
        return;
    }
    BytesBuilder portEgressBytesBuilder = new BytesBuilder();
    BytesBuilder portIngressBytesBuilder = new BytesBuilder();
    PacketsBuilder portEgressPacketsBuilder = new PacketsBuilder();
    PacketsBuilder portIngressPacketsBuilder = new PacketsBuilder();
    for (FlowAndStatisticsMapList flowStats : flowAndStatisticsMapList) {
        BigInteger portEgressBytesBuilderDropCount = BigInteger.valueOf(0);
        BigInteger portEgressPacketsBuilderDropCount = BigInteger.valueOf(0);
        BigInteger portIngressBytesBuilderDropCount = BigInteger.valueOf(0);
        BigInteger portIngressPacketsBuilderDropCount = BigInteger.valueOf(0);
        switch(flowStats.getTableId()) {
            case NwConstants.INGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE:
                if (flowStats.getPriority().equals(AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY)) {
                    portEgressBytesBuilder.setInvalidDropCount(flowStats.getByteCount().getValue());
                    portEgressPacketsBuilder.setInvalidDropCount(flowStats.getPacketCount().getValue());
                } else if (flowStats.getPriority().equals(AclConstants.ACL_PORT_SPECIFIC_DROP_PRIORITY)) {
                    if (portEgressBytesBuilder.getDropCount() != null) {
                        portEgressBytesBuilderDropCount = portEgressBytesBuilder.getDropCount().add(flowStats.getByteCount().getValue());
                        portEgressPacketsBuilderDropCount = portEgressPacketsBuilder.getDropCount().add(flowStats.getPacketCount().getValue());
                    } else {
                        portEgressBytesBuilderDropCount = flowStats.getByteCount().getValue();
                        portEgressPacketsBuilderDropCount = flowStats.getPacketCount().getValue();
                    }
                } else if (flowStats.getPriority().equals(AclConstants.ACE_LAST_REMOTE_ACL_PRIORITY)) {
                    if (portEgressBytesBuilder.getDropCount() != null) {
                        portEgressBytesBuilderDropCount = portEgressBytesBuilder.getDropCount().add(flowStats.getByteCount().getValue());
                        portEgressPacketsBuilderDropCount = portEgressPacketsBuilder.getDropCount().add(flowStats.getPacketCount().getValue());
                    } else {
                        portEgressBytesBuilderDropCount = flowStats.getByteCount().getValue();
                        portEgressPacketsBuilderDropCount = flowStats.getPacketCount().getValue();
                    }
                }
                // TODO: Update stats for other drops
                break;
            case NwConstants.EGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE:
                if (flowStats.getPriority().equals(AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY)) {
                    portIngressBytesBuilder.setInvalidDropCount(flowStats.getByteCount().getValue());
                    portIngressPacketsBuilder.setInvalidDropCount(flowStats.getPacketCount().getValue());
                } else if (flowStats.getPriority().equals(AclConstants.ACL_PORT_SPECIFIC_DROP_PRIORITY)) {
                    if (portIngressBytesBuilder.getDropCount() != null) {
                        portIngressBytesBuilderDropCount = portIngressBytesBuilder.getDropCount().add(flowStats.getByteCount().getValue());
                        portIngressPacketsBuilderDropCount = portIngressPacketsBuilder.getDropCount().add(flowStats.getPacketCount().getValue());
                    } else {
                        portIngressBytesBuilderDropCount = flowStats.getByteCount().getValue();
                        portIngressPacketsBuilderDropCount = flowStats.getPacketCount().getValue();
                    }
                } else if (flowStats.getPriority().equals(AclConstants.ACE_LAST_REMOTE_ACL_PRIORITY)) {
                    if (portIngressBytesBuilder.getDropCount() != null) {
                        portIngressBytesBuilderDropCount = portIngressBytesBuilder.getDropCount().add(flowStats.getByteCount().getValue());
                        portIngressPacketsBuilderDropCount = portIngressPacketsBuilder.getDropCount().add(flowStats.getPacketCount().getValue());
                    } else {
                        portIngressBytesBuilderDropCount = flowStats.getByteCount().getValue();
                        portIngressPacketsBuilderDropCount = flowStats.getPacketCount().getValue();
                    }
                }
                // TODO: Update stats for other drops
                break;
            default:
                LOG.warn("Invalid table ID filtered for Acl flow stats: {}", flowStats);
                break;
        }
        portEgressBytesBuilder.setDropCount(portEgressBytesBuilderDropCount);
        portEgressPacketsBuilder.setDropCount(portEgressPacketsBuilderDropCount);
        portIngressBytesBuilder.setDropCount(portIngressBytesBuilderDropCount);
        portIngressPacketsBuilder.setDropCount(portIngressPacketsBuilderDropCount);
    }
    List<AclDropStats> lstAclDropStats = new ArrayList<>();
    if (direction == Direction.Egress || direction == Direction.Both) {
        AclDropStats aclEgressDropStats = new AclDropStatsBuilder().setDirection(Direction.Egress).setBytes(portEgressBytesBuilder.build()).setPackets(portEgressPacketsBuilder.build()).build();
        lstAclDropStats.add(aclEgressDropStats);
    }
    if (direction == Direction.Ingress || direction == Direction.Both) {
        AclDropStats aclIngressDropStats = new AclDropStatsBuilder().setDirection(Direction.Ingress).setBytes(portIngressBytesBuilder.build()).setPackets(portIngressPacketsBuilder.build()).build();
        lstAclDropStats.add(aclIngressDropStats);
    }
    aclStatsBuilder.setAclDropStats(lstAclDropStats);
}
Also used : AclDropStats(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.AclDropStats) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) FlowAndStatisticsMapList(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList) PacketsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.acl.drop.stats.PacketsBuilder) AclDropStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.AclDropStatsBuilder) ErrorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.ErrorBuilder) BytesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.acl.drop.stats.BytesBuilder)

Aggregations

ArrayList (java.util.ArrayList)4 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)4 DurationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)4 BytesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.BytesBuilder)4 PacketsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.PacketsBuilder)4 NodeConnectorStatisticsAndPortNumberMapBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder)4 NodeConnectorStatisticsAndPortNumberMapKey (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey)4 NodeConnectorStatisticsAndPortNumberMap (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap)3 BigInteger (java.math.BigInteger)2 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 MultipartReplyPortStatsCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase)2 MultipartReplyPortStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats)2 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)2 MultipartReplyPortStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.reply.multipart.reply.body.MultipartReplyPortStatsBuilder)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 GetNodeConnectorStatisticsOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsOutputBuilder)1 FlowAndStatisticsMapList (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList)1 AclDropStats (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.AclDropStats)1 AclDropStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.AclDropStatsBuilder)1 ErrorBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.ErrorBuilder)1