2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.sal.reader;
11 import java.io.Serializable;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
18 import org.opendaylight.controller.sal.core.NodeConnector;
21 * Represents the statistics for a node connector
24 @XmlAccessorType(XmlAccessType.NONE)
26 public class NodeConnectorStatistics implements Serializable {
27 private static final long serialVersionUID = 1L;
30 private NodeConnector nodeConnector;
32 private long receivePackets;
34 private long transmitPackets;
36 private long receiveBytes;
38 private long transmitBytes;
40 private long receiveDrops;
42 private long transmitDrops;
44 private long receiveErrors;
46 private long transmitErrors;
48 private long receiveFrameError;
50 private long receiveOverRunError;
52 private long receiveCrcError;
54 private long collisionCount;
57 public int hashCode() {
60 result = prime * result + (int) (collisionCount ^ (collisionCount >>> 32));
61 result = prime * result + ((nodeConnector == null) ? 0 : nodeConnector.hashCode());
62 result = prime * result + (int) (receiveBytes ^ (receiveBytes >>> 32));
63 result = prime * result + (int) (receiveCrcError ^ (receiveCrcError >>> 32));
64 result = prime * result + (int) (receiveDrops ^ (receiveDrops >>> 32));
65 result = prime * result + (int) (receiveErrors ^ (receiveErrors >>> 32));
66 result = prime * result + (int) (receiveFrameError ^ (receiveFrameError >>> 32));
67 result = prime * result + (int) (receiveOverRunError ^ (receiveOverRunError >>> 32));
68 result = prime * result + (int) (receivePackets ^ (receivePackets >>> 32));
69 result = prime * result + (int) (transmitBytes ^ (transmitBytes >>> 32));
70 result = prime * result + (int) (transmitDrops ^ (transmitDrops >>> 32));
71 result = prime * result + (int) (transmitErrors ^ (transmitErrors >>> 32));
72 result = prime * result + (int) (transmitPackets ^ (transmitPackets >>> 32));
77 public boolean equals(Object obj) {
84 if (!(obj instanceof NodeConnectorStatistics)) {
87 NodeConnectorStatistics other = (NodeConnectorStatistics) obj;
88 if (collisionCount != other.collisionCount) {
91 if (nodeConnector == null) {
92 if (other.nodeConnector != null) {
95 } else if (!nodeConnector.equals(other.nodeConnector)) {
98 if (receiveBytes != other.receiveBytes) {
101 if (receiveCrcError != other.receiveCrcError) {
104 if (receiveDrops != other.receiveDrops) {
107 if (receiveErrors != other.receiveErrors) {
110 if (receiveFrameError != other.receiveFrameError) {
113 if (receiveOverRunError != other.receiveOverRunError) {
116 if (receivePackets != other.receivePackets) {
119 if (transmitBytes != other.transmitBytes) {
122 if (transmitDrops != other.transmitDrops) {
125 if (transmitErrors != other.transmitErrors) {
128 if (transmitPackets != other.transmitPackets) {
135 public NodeConnectorStatistics() {
140 * Set the node connector
144 public void setNodeConnector(NodeConnector port) {
145 this.nodeConnector = port;
149 * Returns the node connector
153 public NodeConnector getNodeConnector() {
154 return nodeConnector;
158 * Set the rx packet count's value
162 public void setReceivePacketCount(long count) {
163 receivePackets = count;
167 * Returns the rx packet count for the port
171 public long getReceivePacketCount() {
172 return receivePackets;
176 * Set the tx packet count's value
180 public void setTransmitPacketCount(long count) {
181 transmitPackets = count;
185 * Returns the tx packet count for the port
189 public long getTransmitPacketCount() {
190 return transmitPackets;
194 * Set the rx byte count's value
198 public void setReceiveByteCount(long count) {
199 receiveBytes = count;
203 * Return the rx byte count for the port
207 public long getReceiveByteCount() {
212 * Set the tx byte count's value
216 public void setTransmitByteCount(long count) {
217 transmitBytes = count;
221 * Return the tx byte count for the port
225 public long getTransmitByteCount() {
226 return transmitBytes;
230 * Set the rx drop count's value
234 public void setReceiveDropCount(long count) {
235 receiveDrops = count;
239 * Returns the rx drop count for the port
243 public long getReceiveDropCount() {
248 * Set the tx drop count's value
252 public void setTransmitDropCount(long count) {
253 transmitDrops = count;
257 * Returns the tx drop count for the port
261 public long getTransmitDropCount() {
262 return transmitDrops;
266 * Set the rx error count's value
270 public void setReceiveErrorCount(long count) {
271 receiveErrors = count;
275 * Return the rx error count for the port
279 public long getReceiveErrorCount() {
280 return receiveErrors;
284 * Set the tx error count's value
288 public void setTransmitErrorCount(long count) {
289 transmitErrors = count;
293 * Return the tx error count for the port
297 public long getTransmitErrorCount() {
298 return transmitErrors;
302 * Set the rx frame error value
306 public void setReceiveFrameErrorCount(long count) {
307 receiveFrameError = count;
311 * Returns the rx frame error for the port
315 public long getReceiveFrameErrorCount() {
316 return receiveFrameError;
320 * Set the rx overrun error value
324 public void setReceiveOverRunErrorCount(long count) {
325 receiveOverRunError = count;
329 * Return the rx overrun error for the port
333 public long getReceiveOverRunErrorCount() {
334 return receiveOverRunError;
338 * Set the rx CRC Error value
342 public void setReceiveCRCErrorCount(long count) {
343 receiveCrcError = count;
347 * Return the rx CRC error for the port
351 public long getReceiveCRCErrorCount() {
352 return receiveCrcError;
356 * Set the collisionCount count's value
360 public void setCollisionCount(long count) {
361 collisionCount = count;
365 * Return the collisionCount count for the port
369 public long getCollisionCount() {
370 return collisionCount;
374 public String toString() {
375 return "NodeConnectorStats[portNumber = " + nodeConnector
376 + ", receivePackets = " + receivePackets
377 + ", transmitPackets = " + transmitPackets
378 + ", receiveBytes = " + receiveBytes + ", transmitBytes = "
379 + transmitBytes + ", receiveDrops = " + receiveDrops
380 + ", transmitDrops = " + transmitDrops + ", receiveErrors = "
381 + receiveErrors + ", transmitErrors = " + transmitErrors
382 + ", receiveFrameError = " + receiveFrameError
383 + ", receiveOverRunError = " + receiveOverRunError
384 + ", receiveCrcError = " + receiveCrcError
385 + ", collisionCount = " + collisionCount + "]";