@Override public List<OFStatistics> getOFPortStatistics(Long switchId, short portId) { if (!portStatistics.containsKey(switchId)) { return this.dummyList; } List<OFStatistics> list = new ArrayList<OFStatistics>(1); for (OFStatistics stats : portStatistics.get(switchId)) { if (((OFPortStatisticsReply) stats).getPortNumber() == portId) { list.add(stats); break; } } return list; }
NodeConnectorStatistics NCStat = new NodeConnectorStatistics(); NCStat.setNodeConnector(PortConverter.toNodeConnector( ofPortStat.getPortNumber(), node)); NCStat.setReceivePacketCount(ofPortStat.getreceivePackets()); NCStat.setTransmitPacketCount(ofPortStat.getTransmitPackets()); NCStat.setReceiveByteCount(ofPortStat.getReceiveBytes()); NCStat.setTransmitByteCount(ofPortStat.getTransmitBytes()); NCStat.setReceiveDropCount(ofPortStat.getReceiveDropped()); NCStat.setTransmitDropCount(ofPortStat.getTransmitDropped()); NCStat.setReceiveErrorCount(ofPortStat.getreceiveErrors()); NCStat.setTransmitErrorCount(ofPortStat.getTransmitErrors()); NCStat.setReceiveFrameErrorCount(ofPortStat .getReceiveFrameErrors()); NCStat.setReceiveOverRunErrorCount(ofPortStat .getReceiveOverrunErrors()); NCStat.setReceiveCRCErrorCount(ofPortStat.getReceiveCRCErrors()); NCStat.setCollisionCount(ofPortStat.getCollisions()); this.ncStatsList.add(NCStat);
short port = newPortStat.getPortNumber(); TxRates portRatesHolder = rates.get(port); if (portRatesHolder == null) { long transmitBytes = newPortStat.getTransmitBytes(); long value = (transmitBytes < 0) ? 0 : transmitBytes; portRatesHolder.update(value);
NodeConnectorStatistics NCStat = new NodeConnectorStatistics(); NCStat.setNodeConnector(PortConverter.toNodeConnector( ofPortStat.getPortNumber(), node)); NCStat.setReceivePacketCount(ofPortStat.getreceivePackets()); NCStat.setTransmitPacketCount(ofPortStat.getTransmitPackets()); NCStat.setReceiveByteCount(ofPortStat.getReceiveBytes()); NCStat.setTransmitByteCount(ofPortStat.getTransmitBytes()); NCStat.setReceiveDropCount(ofPortStat.getReceiveDropped()); NCStat.setTransmitDropCount(ofPortStat.getTransmitDropped()); NCStat.setReceiveErrorCount(ofPortStat.getreceiveErrors()); NCStat.setTransmitErrorCount(ofPortStat.getTransmitErrors()); NCStat.setReceiveFrameErrorCount(ofPortStat .getReceiveFrameErrors()); NCStat.setReceiveOverRunErrorCount(ofPortStat .getReceiveOverrunErrors()); NCStat.setReceiveCRCErrorCount(ofPortStat.getReceiveCRCErrors()); NCStat.setCollisionCount(ofPortStat.getCollisions()); this.ncStatsList.add(NCStat);
short port = newPortStat.getPortNumber(); TxRates portRatesHolder = rates.get(port); if (portRatesHolder == null) { long transmitBytes = newPortStat.getTransmitBytes(); long value = (transmitBytes < 0) ? 0 : transmitBytes; portRatesHolder.update(value);
@Override public List<OFStatistics> getOFPortStatistics(Long switchId, short portId) { if (!portStatistics.containsKey(switchId)) { return Collections.emptyList(); } List<OFStatistics> list = new ArrayList<OFStatistics>(1); for (OFStatistics stats : portStatistics.get(switchId)) { if (((OFPortStatisticsReply) stats).getPortNumber() == portId) { list.add(stats); break; } } return list; }
/** * Filters a list of OFStatistics elements based on the container * * @param container * @param nodeId * @param list * @return */ private List<OFStatistics> filterPortListPerContainer(String container, long switchId, List<OFStatistics> list) { if (list == null) { return Collections.emptyList(); } // Create new filtered list of flows List<OFStatistics> newList = new ArrayList<OFStatistics>(); for (OFStatistics stat : list) { OFPortStatisticsReply target = (OFPortStatisticsReply) stat; NodeConnector nc = NodeConnectorCreator.createOFNodeConnector( target.getPortNumber(), NodeCreator.createOFNode(switchId)); if (containerOwnsNodeConnector(container, nc)) { newList.add(target); } } return newList; }
/** * Filters a list of FlowOnNode elements based on the container * * @param container * @param nodeId * @param list * @return */ public List<OFStatistics> filterPortListPerContainer(String container, long switchId, List<OFStatistics> list) { if (list == null) { return null; } // Create new filtered list of flows List<OFStatistics> newList = new ArrayList<OFStatistics>(); for (OFStatistics stat : list) { OFPortStatisticsReply target = (OFPortStatisticsReply) stat; NodeConnector nc = NodeConnectorCreator.createOFNodeConnector( target.getPortNumber(), NodeCreator.createOFNode(switchId)); if (containerOwnsNodeConnector(container, nc)) { newList.add(target); } } return newList; }