3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.sal.reader;
12 import java.io.Serializable;
14 import javax.xml.bind.annotation.XmlAccessType;
15 import javax.xml.bind.annotation.XmlAccessorType;
16 import javax.xml.bind.annotation.XmlElement;
17 import javax.xml.bind.annotation.XmlRootElement;
19 import org.opendaylight.controller.sal.flowprogrammer.Flow;
22 * Represents the flow that is installed on the network node
23 * along with the table location, hit counters and timers
26 @XmlRootElement (name="FlowStat")
27 @XmlAccessorType(XmlAccessType.NONE)
29 public class FlowOnNode implements Serializable{
30 private static final long serialVersionUID = 1L;
33 private Flow flow; // Flow descriptor
37 private int durationSeconds;
39 private int durationNanoseconds;
41 private long packetCount;
43 private long byteCount;
45 /* Dummy constructor for JAXB */
46 @SuppressWarnings("unused")
47 private FlowOnNode () {
50 public FlowOnNode(Flow flow) {
55 * Returns the description of the flow which statistics are about
58 public Flow getFlow() {
63 * Set the packet count's value
66 public void setPacketCount(long count) {
71 * Set the byte count's value
74 public void setByteCount(long count) {
79 * Returns the packet count for the flow
82 public long getPacketCount() {
87 * Return the byte count for the flow
90 public long getByteCount() {
94 public byte getTableId() {
98 public void setTableId(byte tableId) {
99 this.tableId = tableId;
102 public int getDurationSeconds() {
103 return durationSeconds;
106 public void setDurationSeconds(int durationSeconds) {
107 this.durationSeconds = durationSeconds;
110 public int getDurationNanoseconds() {
111 return durationNanoseconds;
114 public void setDurationNanoseconds(int durationNanoseconds) {
115 this.durationNanoseconds = durationNanoseconds;
119 public int hashCode() {
120 final int prime = 31;
122 result = prime * result + (int) (byteCount ^ (byteCount >>> 32));
123 result = prime * result + durationNanoseconds;
124 result = prime * result + durationSeconds;
125 result = prime * result + ((flow == null) ? 0 : flow.hashCode());
126 result = prime * result + (int) (packetCount ^ (packetCount >>> 32));
127 result = prime * result + tableId;
132 public boolean equals(Object obj) {
139 if (!(obj instanceof FlowOnNode)) {
142 FlowOnNode other = (FlowOnNode) obj;
143 if (byteCount != other.byteCount) {
146 if (durationNanoseconds != other.durationNanoseconds) {
149 if (durationSeconds != other.durationSeconds) {
153 if (other.flow != null) {
156 } else if (!flow.equals(other.flow)) {
159 if (packetCount != other.packetCount) {
162 if (tableId != other.tableId) {
169 public String toString() {
170 return "FlowOnNode[flow =" + flow + ", tableId = " + tableId
171 + ", sec = " + durationSeconds + ", nsec = "
172 + durationNanoseconds + ", pkt = " + packetCount + ", byte = "