X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Freader%2FNodeConnectorStatistics.java;h=fc6a6d87f1c39139c9b29f1a55c060b53f78451d;hp=a8c83e7913b25c227ed0f042d48d0a097ce75dae;hb=f6ca11900a9672d17193372376368e9ef130a28f;hpb=42210c03b0a4c54706320ba9f55794c0abd4d201 diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeConnectorStatistics.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeConnectorStatistics.java index a8c83e7913..fc6a6d87f1 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeConnectorStatistics.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/reader/NodeConnectorStatistics.java @@ -1,4 +1,3 @@ - /* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * @@ -9,6 +8,8 @@ package org.opendaylight.controller.sal.reader; +import java.io.Serializable; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -17,47 +18,126 @@ import javax.xml.bind.annotation.XmlRootElement; import org.opendaylight.controller.sal.core.NodeConnector; /** - * Represents the statistics for the node conenctor - * - * - * + * Represents the statistics for a node connector */ @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) -public class NodeConnectorStatistics { - @XmlElement +public class NodeConnectorStatistics implements Serializable { + private static final long serialVersionUID = 1L; + + @XmlElement private NodeConnector nodeConnector; - @XmlElement + @XmlElement private long receivePackets; - @XmlElement + @XmlElement private long transmitPackets; - @XmlElement + @XmlElement private long receiveBytes; - @XmlElement + @XmlElement private long transmitBytes; - @XmlElement + @XmlElement private long receiveDrops; - @XmlElement + @XmlElement private long transmitDrops; - @XmlElement + @XmlElement private long receiveErrors; - @XmlElement + @XmlElement private long transmitErrors; - @XmlElement + @XmlElement private long receiveFrameError; - @XmlElement + @XmlElement private long receiveOverRunError; - @XmlElement + @XmlElement private long receiveCrcError; - @XmlElement + @XmlElement private long collisionCount; - //To Satisfy JAXB - public NodeConnectorStatistics() { - - } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (int) (collisionCount ^ (collisionCount >>> 32)); + result = prime * result + ((nodeConnector == null) ? 0 : nodeConnector.hashCode()); + result = prime * result + (int) (receiveBytes ^ (receiveBytes >>> 32)); + result = prime * result + (int) (receiveCrcError ^ (receiveCrcError >>> 32)); + result = prime * result + (int) (receiveDrops ^ (receiveDrops >>> 32)); + result = prime * result + (int) (receiveErrors ^ (receiveErrors >>> 32)); + result = prime * result + (int) (receiveFrameError ^ (receiveFrameError >>> 32)); + result = prime * result + (int) (receiveOverRunError ^ (receiveOverRunError >>> 32)); + result = prime * result + (int) (receivePackets ^ (receivePackets >>> 32)); + result = prime * result + (int) (transmitBytes ^ (transmitBytes >>> 32)); + result = prime * result + (int) (transmitDrops ^ (transmitDrops >>> 32)); + result = prime * result + (int) (transmitErrors ^ (transmitErrors >>> 32)); + result = prime * result + (int) (transmitPackets ^ (transmitPackets >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof NodeConnectorStatistics)) { + return false; + } + NodeConnectorStatistics other = (NodeConnectorStatistics) obj; + if (collisionCount != other.collisionCount) { + return false; + } + if (nodeConnector == null) { + if (other.nodeConnector != null) { + return false; + } + } else if (!nodeConnector.equals(other.nodeConnector)) { + return false; + } + if (receiveBytes != other.receiveBytes) { + return false; + } + if (receiveCrcError != other.receiveCrcError) { + return false; + } + if (receiveDrops != other.receiveDrops) { + return false; + } + if (receiveErrors != other.receiveErrors) { + return false; + } + if (receiveFrameError != other.receiveFrameError) { + return false; + } + if (receiveOverRunError != other.receiveOverRunError) { + return false; + } + if (receivePackets != other.receivePackets) { + return false; + } + if (transmitBytes != other.transmitBytes) { + return false; + } + if (transmitDrops != other.transmitDrops) { + return false; + } + if (transmitErrors != other.transmitErrors) { + return false; + } + if (transmitPackets != other.transmitPackets) { + return false; + } + return true; + } + + // To Satisfy JAXB + public NodeConnectorStatistics() { + + } + /** * Set the node connector + * * @param port */ public void setNodeConnector(NodeConnector port) { @@ -66,6 +146,7 @@ public class NodeConnectorStatistics { /** * Returns the node connector + * * @return */ public NodeConnector getNodeConnector() { @@ -74,6 +155,7 @@ public class NodeConnectorStatistics { /** * Set the rx packet count's value + * * @param count */ public void setReceivePacketCount(long count) { @@ -82,6 +164,7 @@ public class NodeConnectorStatistics { /** * Returns the rx packet count for the port + * * @return */ public long getReceivePacketCount() { @@ -90,6 +173,7 @@ public class NodeConnectorStatistics { /** * Set the tx packet count's value + * * @param count */ public void setTransmitPacketCount(long count) { @@ -98,6 +182,7 @@ public class NodeConnectorStatistics { /** * Returns the tx packet count for the port + * * @return */ public long getTransmitPacketCount() { @@ -106,6 +191,7 @@ public class NodeConnectorStatistics { /** * Set the rx byte count's value + * * @param count */ public void setReceiveByteCount(long count) { @@ -114,6 +200,7 @@ public class NodeConnectorStatistics { /** * Return the rx byte count for the port + * * @return */ public long getReceiveByteCount() { @@ -122,6 +209,7 @@ public class NodeConnectorStatistics { /** * Set the tx byte count's value + * * @param count */ public void setTransmitByteCount(long count) { @@ -130,6 +218,7 @@ public class NodeConnectorStatistics { /** * Return the tx byte count for the port + * * @return */ public long getTransmitByteCount() { @@ -138,6 +227,7 @@ public class NodeConnectorStatistics { /** * Set the rx drop count's value + * * @param count */ public void setReceiveDropCount(long count) { @@ -146,6 +236,7 @@ public class NodeConnectorStatistics { /** * Returns the rx drop count for the port + * * @return */ public long getReceiveDropCount() { @@ -154,6 +245,7 @@ public class NodeConnectorStatistics { /** * Set the tx drop count's value + * * @param count */ public void setTransmitDropCount(long count) { @@ -162,6 +254,7 @@ public class NodeConnectorStatistics { /** * Returns the tx drop count for the port + * * @return */ public long getTransmitDropCount() { @@ -170,6 +263,7 @@ public class NodeConnectorStatistics { /** * Set the rx error count's value + * * @param count */ public void setReceiveErrorCount(long count) { @@ -178,6 +272,7 @@ public class NodeConnectorStatistics { /** * Return the rx error count for the port + * * @return */ public long getReceiveErrorCount() { @@ -186,6 +281,7 @@ public class NodeConnectorStatistics { /** * Set the tx error count's value + * * @param count */ public void setTransmitErrorCount(long count) { @@ -194,6 +290,7 @@ public class NodeConnectorStatistics { /** * Return the tx error count for the port + * * @return */ public long getTransmitErrorCount() { @@ -202,6 +299,7 @@ public class NodeConnectorStatistics { /** * Set the rx frame error value + * * @param count */ public void setReceiveFrameErrorCount(long count) { @@ -210,6 +308,7 @@ public class NodeConnectorStatistics { /** * Returns the rx frame error for the port + * * @return */ public long getReceiveFrameErrorCount() { @@ -218,6 +317,7 @@ public class NodeConnectorStatistics { /** * Set the rx overrun error value + * * @param count */ public void setReceiveOverRunErrorCount(long count) { @@ -226,6 +326,7 @@ public class NodeConnectorStatistics { /** * Return the rx overrun error for the port + * * @return */ public long getReceiveOverRunErrorCount() { @@ -234,6 +335,7 @@ public class NodeConnectorStatistics { /** * Set the rx CRC Error value + * * @param count */ public void setReceiveCRCErrorCount(long count) { @@ -242,6 +344,7 @@ public class NodeConnectorStatistics { /** * Return the rx CRC error for the port + * * @return */ public long getReceiveCRCErrorCount() { @@ -250,6 +353,7 @@ public class NodeConnectorStatistics { /** * Set the collisionCount count's value + * * @param count */ public void setCollisionCount(long count) { @@ -258,6 +362,7 @@ public class NodeConnectorStatistics { /** * Return the collisionCount count for the port + * * @return */ public long getCollisionCount() { @@ -267,16 +372,16 @@ public class NodeConnectorStatistics { @Override public String toString() { return "NodeConnectorStats[portNumber = " + nodeConnector - + ", receivePackets = " + receivePackets - + ", transmitPackets = " + transmitPackets - + ", receiveBytes = " + receiveBytes + ", transmitBytes = " - + transmitBytes + ", receiveDrops = " + receiveDrops - + ", transmitDrops = " + transmitDrops + ", receiveErrors = " - + receiveErrors + ", transmitErrors = " + transmitErrors - + ", receiveFrameError = " + receiveFrameError - + ", receiveOverRunError = " + receiveOverRunError - + ", receiveCrcError = " + receiveCrcError - + ", collisionCount = " + collisionCount + "]"; + + ", receivePackets = " + receivePackets + + ", transmitPackets = " + transmitPackets + + ", receiveBytes = " + receiveBytes + ", transmitBytes = " + + transmitBytes + ", receiveDrops = " + receiveDrops + + ", transmitDrops = " + transmitDrops + ", receiveErrors = " + + receiveErrors + ", transmitErrors = " + transmitErrors + + ", receiveFrameError = " + receiveFrameError + + ", receiveOverRunError = " + receiveOverRunError + + ", receiveCrcError = " + receiveCrcError + + ", collisionCount = " + collisionCount + "]"; } }