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)
25 public class NodeConnectorStatistics implements Serializable {
26 private static final long serialVersionUID = 1L;
29 private NodeConnector nodeConnector;
31 private long receivePackets;
33 private long transmitPackets;
35 private long receiveBytes;
37 private long transmitBytes;
39 private long receiveDrops;
41 private long transmitDrops;
43 private long receiveErrors;
45 private long transmitErrors;
47 private long receiveFrameError;
49 private long receiveOverRunError;
51 private long receiveCrcError;
53 private long collisionCount;
56 public int hashCode() {
59 result = prime * result + (int) (collisionCount ^ (collisionCount >>> 32));
60 result = prime * result + ((nodeConnector == null) ? 0 : nodeConnector.hashCode());
61 result = prime * result + (int) (receiveBytes ^ (receiveBytes >>> 32));
62 result = prime * result + (int) (receiveCrcError ^ (receiveCrcError >>> 32));
63 result = prime * result + (int) (receiveDrops ^ (receiveDrops >>> 32));
64 result = prime * result + (int) (receiveErrors ^ (receiveErrors >>> 32));
65 result = prime * result + (int) (receiveFrameError ^ (receiveFrameError >>> 32));
66 result = prime * result + (int) (receiveOverRunError ^ (receiveOverRunError >>> 32));
67 result = prime * result + (int) (receivePackets ^ (receivePackets >>> 32));
68 result = prime * result + (int) (transmitBytes ^ (transmitBytes >>> 32));
69 result = prime * result + (int) (transmitDrops ^ (transmitDrops >>> 32));
70 result = prime * result + (int) (transmitErrors ^ (transmitErrors >>> 32));
71 result = prime * result + (int) (transmitPackets ^ (transmitPackets >>> 32));
76 public boolean equals(Object obj) {
83 if (!(obj instanceof NodeConnectorStatistics)) {
86 NodeConnectorStatistics other = (NodeConnectorStatistics) obj;
87 if (collisionCount != other.collisionCount) {
90 if (nodeConnector == null) {
91 if (other.nodeConnector != null) {
94 } else if (!nodeConnector.equals(other.nodeConnector)) {
97 if (receiveBytes != other.receiveBytes) {
100 if (receiveCrcError != other.receiveCrcError) {
103 if (receiveDrops != other.receiveDrops) {
106 if (receiveErrors != other.receiveErrors) {
109 if (receiveFrameError != other.receiveFrameError) {
112 if (receiveOverRunError != other.receiveOverRunError) {
115 if (receivePackets != other.receivePackets) {
118 if (transmitBytes != other.transmitBytes) {
121 if (transmitDrops != other.transmitDrops) {
124 if (transmitErrors != other.transmitErrors) {
127 if (transmitPackets != other.transmitPackets) {
134 public NodeConnectorStatistics() {
139 * Set the node connector
143 public void setNodeConnector(NodeConnector port) {
144 this.nodeConnector = port;
148 * Returns the node connector
152 public NodeConnector getNodeConnector() {
153 return nodeConnector;
157 * Set the rx packet count's value
161 public void setReceivePacketCount(long count) {
162 receivePackets = count;
166 * Returns the rx packet count for the port
170 public long getReceivePacketCount() {
171 return receivePackets;
175 * Set the tx packet count's value
179 public void setTransmitPacketCount(long count) {
180 transmitPackets = count;
184 * Returns the tx packet count for the port
188 public long getTransmitPacketCount() {
189 return transmitPackets;
193 * Set the rx byte count's value
197 public void setReceiveByteCount(long count) {
198 receiveBytes = count;
202 * Return the rx byte count for the port
206 public long getReceiveByteCount() {
211 * Set the tx byte count's value
215 public void setTransmitByteCount(long count) {
216 transmitBytes = count;
220 * Return the tx byte count for the port
224 public long getTransmitByteCount() {
225 return transmitBytes;
229 * Set the rx drop count's value
233 public void setReceiveDropCount(long count) {
234 receiveDrops = count;
238 * Returns the rx drop count for the port
242 public long getReceiveDropCount() {
247 * Set the tx drop count's value
251 public void setTransmitDropCount(long count) {
252 transmitDrops = count;
256 * Returns the tx drop count for the port
260 public long getTransmitDropCount() {
261 return transmitDrops;
265 * Set the rx error count's value
269 public void setReceiveErrorCount(long count) {
270 receiveErrors = count;
274 * Return the rx error count for the port
278 public long getReceiveErrorCount() {
279 return receiveErrors;
283 * Set the tx error count's value
287 public void setTransmitErrorCount(long count) {
288 transmitErrors = count;
292 * Return the tx error count for the port
296 public long getTransmitErrorCount() {
297 return transmitErrors;
301 * Set the rx frame error value
305 public void setReceiveFrameErrorCount(long count) {
306 receiveFrameError = count;
310 * Returns the rx frame error for the port
314 public long getReceiveFrameErrorCount() {
315 return receiveFrameError;
319 * Set the rx overrun error value
323 public void setReceiveOverRunErrorCount(long count) {
324 receiveOverRunError = count;
328 * Return the rx overrun error for the port
332 public long getReceiveOverRunErrorCount() {
333 return receiveOverRunError;
337 * Set the rx CRC Error value
341 public void setReceiveCRCErrorCount(long count) {
342 receiveCrcError = count;
346 * Return the rx CRC error for the port
350 public long getReceiveCRCErrorCount() {
351 return receiveCrcError;
355 * Set the collisionCount count's value
359 public void setCollisionCount(long count) {
360 collisionCount = count;
364 * Return the collisionCount count for the port
368 public long getCollisionCount() {
369 return collisionCount;
373 public String toString() {
374 return "NodeConnectorStats[portNumber = " + nodeConnector
375 + ", receivePackets = " + receivePackets
376 + ", transmitPackets = " + transmitPackets
377 + ", receiveBytes = " + receiveBytes + ", transmitBytes = "
378 + transmitBytes + ", receiveDrops = " + receiveDrops
379 + ", transmitDrops = " + transmitDrops + ", receiveErrors = "
380 + receiveErrors + ", transmitErrors = " + transmitErrors
381 + ", receiveFrameError = " + receiveFrameError
382 + ", receiveOverRunError = " + receiveOverRunError
383 + ", receiveCrcError = " + receiveCrcError
384 + ", collisionCount = " + collisionCount + "]";