public Packets build() { return new PacketsImpl(this); }
public Bytes build() { return new BytesImpl(this); }
public BytesBuilder(Bytes base) { this._received = base.getReceived(); this._transmitted = base.getTransmitted(); if (base instanceof BytesImpl) { BytesImpl _impl = (BytesImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
private static NodeConnectorStatistics toNodeConnectorStatistics(final org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.NodeConnectorStatistics nodeConnectorStatistics, final NodeId nodeId, final NodeConnectorId nodeConnectorId) throws ConstructionException { final NodeConnectorStatistics it = new NodeConnectorStatistics(); final Packets packets = nodeConnectorStatistics.getPackets(); it.setReceivePacketCount(packets.getReceived().longValue()); it.setTransmitPacketCount(packets.getTransmitted().longValue()); final Bytes bytes = nodeConnectorStatistics.getBytes(); it.setReceiveByteCount(bytes.getReceived().longValue()); it.setTransmitByteCount(bytes.getTransmitted().longValue()); it.setReceiveDropCount(nodeConnectorStatistics.getReceiveDrops().longValue()); it.setTransmitDropCount(nodeConnectorStatistics.getTransmitDrops().longValue()); it.setReceiveErrorCount(nodeConnectorStatistics.getReceiveErrors().longValue()); it.setTransmitErrorCount(nodeConnectorStatistics.getTransmitErrors().longValue()); it.setReceiveFrameErrorCount(nodeConnectorStatistics.getReceiveFrameError().longValue()); it.setReceiveOverRunErrorCount(nodeConnectorStatistics.getReceiveOverRunError().longValue()); it.setReceiveCRCErrorCount(nodeConnectorStatistics.getReceiveCrcError().longValue()); it.setCollisionCount(nodeConnectorStatistics.getCollisionCount().longValue()); final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector> nodeConnectorRef = InstanceIdentifier.builder(Nodes.class) .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, new NodeKey(nodeId)) .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector.class, new NodeConnectorKey(nodeConnectorId)) .build(); it.setNodeConnector(NodeMapping.toADNodeConnector(new NodeConnectorRef(nodeConnectorRef))); return it; }
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());
if (other.getReceived() != null) { return false; } else if(!_received.equals(other.getReceived())) { return false; if (other.getTransmitted() != null) { return false; } else if(!_transmitted.equals(other.getTransmitted())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
private Bytes extractBytes(NodeConnectorStatistics nodeConnectorStatistics) { long transmitByteCount = nodeConnectorStatistics.getTransmitByteCount(); long receiveByteCount = nodeConnectorStatistics.getReceiveByteCount(); BytesBuilder builder = new BytesBuilder(); builder.setReceived(toBI(receiveByteCount)); builder.setTransmitted(toBI(transmitByteCount)); return builder.build(); }
private Packets extractPackets(NodeConnectorStatistics nodeConnectorStatistics) { long receivePacketCount = nodeConnectorStatistics.getReceivePacketCount(); long transmitPacketCount = nodeConnectorStatistics.getTransmitPacketCount(); PacketsBuilder builder = new PacketsBuilder(); builder.setReceived(toBI(receivePacketCount)); builder.setTransmitted(toBI(transmitPacketCount)); return builder.build(); }
public PacketsBuilder(Packets base) { this._received = base.getReceived(); this._transmitted = base.getTransmitted(); if (base instanceof PacketsImpl) { PacketsImpl _impl = (PacketsImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
if (other.getReceived() != null) { return false; } else if(!_received.equals(other.getReceived())) { return false; if (other.getTransmitted() != null) { return false; } else if(!_transmitted.equals(other.getTransmitted())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
private BytesImpl(BytesBuilder base) { this._received = base.getReceived(); this._transmitted = base.getTransmitted(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Bytes>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Bytes>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Bytes>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Bytes>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
private PacketsImpl(PacketsBuilder base) { this._received = base.getReceived(); this._transmitted = base.getTransmitted(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Packets>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Packets>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Packets>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Packets>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public BytesBuilder setTransmitted(BigInteger value) { if (value != null) { BigInteger _constraint = value; boolean isValidRange = false; for (Range<BigInteger> r : _transmitted_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _transmitted_range)); } } this._transmitted = value; return this; } public static List<Range<BigInteger>> _transmitted_range() {
public PacketsBuilder setTransmitted(BigInteger value) { if (value != null) { BigInteger _constraint = value; boolean isValidRange = false; for (Range<BigInteger> r : _transmitted_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _transmitted_range)); } } this._transmitted = value; return this; } public static List<Range<BigInteger>> _transmitted_range() {
public BytesBuilder setReceived(BigInteger value) { if (value != null) { BigInteger _constraint = value; boolean isValidRange = false; for (Range<BigInteger> r : _received_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _received_range)); } } this._received = value; return this; } public static List<Range<BigInteger>> _received_range() {
public PacketsBuilder setReceived(BigInteger value) { if (value != null) { BigInteger _constraint = value; boolean isValidRange = false; for (Range<BigInteger> r : _received_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _received_range)); } } this._received = value; return this; } public static List<Range<BigInteger>> _received_range() {
if (fs.getBytes() != null) { builder[8].setMetricValue(new Counter64(fs.getBytes() .getTransmitted())); builder[9].setMetricValue(new Counter64(fs.getBytes() .getReceived())); .getTransmitted())); builder[11].setMetricValue(new Counter64(fs.getPackets() .getReceived()));
nodeStatisticData.put(id, ns); ns.rxSpeed = (bytes.getReceived().longValue() - ns.rxHistory) / (statistic.getFlowCapableNodeConnectorStatistics() .getDuration().getSecond().getValue() - ns.timestamp); ns.txSpeed = (bytes.getTransmitted().longValue() - ns.txHistory) / (statistic.getFlowCapableNodeConnectorStatistics() .getDuration().getSecond().getValue() - ns.timestamp); ns.rxHistory = bytes.getReceived().longValue(); ns.txHistory = bytes.getTransmitted().longValue(); ns.timestamp = statistic.getFlowCapableNodeConnectorStatistics()
nodeStatisticData.put(id, ns); ns.rxSpeed = (bytes.getReceived().longValue() - ns.rxHistory) / (statistic.getFlowCapableNodeConnectorStatistics() .getDuration().getSecond().getValue() - ns.timestamp); ns.txSpeed = (bytes.getTransmitted().longValue() - ns.txHistory) / (statistic.getFlowCapableNodeConnectorStatistics() .getDuration().getSecond().getValue() - ns.timestamp); ns.rxHistory = bytes.getReceived().longValue(); ns.txHistory = bytes.getTransmitted().longValue(); ns.timestamp = statistic.getFlowCapableNodeConnectorStatistics()