6466177ecdce792d245d59b467f4af980e768662
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / reader / FlowOnNode.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
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
8  */
9
10 package org.opendaylight.controller.sal.reader;
11
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 import org.opendaylight.controller.sal.flowprogrammer.Flow;
18
19 /**
20  * Represents the flow that is installed on the network node
21  * along with the table location, hit counters and timers
22  */
23
24 @XmlRootElement (name="FlowStat")
25 @XmlAccessorType(XmlAccessType.NONE)
26 public class FlowOnNode {
27     @XmlElement
28     private Flow flow; // Flow descriptor
29     @XmlElement
30     private byte tableId;
31     @XmlElement
32     private int durationSeconds;
33     @XmlElement
34     private int durationNanoseconds;
35     @XmlElement
36     private long packetCount;
37     @XmlElement
38     private long byteCount;
39
40     /* Dummy constructor for JAXB */
41     @SuppressWarnings("unused")
42     private FlowOnNode () {
43     }
44
45     public FlowOnNode(Flow flow) {
46         this.flow = flow;
47     }
48
49     /**
50      * Returns the description of the flow which statistics are about
51      * @return
52      */
53     public Flow getFlow() {
54         return flow;
55     }
56
57     /**
58      * Set the packet count's value
59      * @param count
60      */
61     public void setPacketCount(long count) {
62         packetCount = count;
63     }
64
65     /**
66      * Set the byte count's value
67      * @param count
68      */
69     public void setByteCount(long count) {
70         byteCount = count;
71     }
72
73     /**
74      * Returns the packet count for the flow
75      * @return
76      */
77     public long getPacketCount() {
78         return packetCount;
79     }
80
81     /**
82      * Return the byte count for the flow
83      * @return
84      */
85     public long getByteCount() {
86         return byteCount;
87     }
88
89     public byte getTableId() {
90         return tableId;
91     }
92
93     public void setTableId(byte tableId) {
94         this.tableId = tableId;
95     }
96
97     public int getDurationSeconds() {
98         return durationSeconds;
99     }
100
101     public void setDurationSeconds(int durationSeconds) {
102         this.durationSeconds = durationSeconds;
103     }
104
105     public int getDurationNanoseconds() {
106         return durationNanoseconds;
107     }
108
109     public void setDurationNanoseconds(int durationNanoseconds) {
110         this.durationNanoseconds = durationNanoseconds;
111     }
112
113     @Override
114     public String toString() {
115         return "FlowOnNode[flow =" + flow + ", tableId = " + tableId
116                 + ", sec = " + durationSeconds + ", nsec = "
117                 + durationNanoseconds + ", pkt = " + packetCount + ", byte = "
118                 + byteCount + "]";
119     }
120 }