FlowEntry must not be modified outside store.
- Remove set method from FlowEntry
- Storing last seen timestamp for FlowEntry eviction locally on FlowManager.
FlowEntry eviction based on packet counter will take longer time to timeout
after master Node change.
Change-Id: I7134d698dd5b9bf7cca379c5ba7c4fbcc2e3d5f3
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowEntry.java b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowEntry.java
index 7513894..905469f 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowEntry.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowEntry.java
@@ -6,7 +6,8 @@
import org.onlab.onos.net.DeviceId;
import org.slf4j.Logger;
-public class DefaultFlowEntry extends DefaultFlowRule implements FlowEntry {
+public class DefaultFlowEntry extends DefaultFlowRule
+ implements FlowEntry, StoredFlowEntry {
private static final Logger log = getLogger(DefaultFlowEntry.class);
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/FlowEntry.java b/core/api/src/main/java/org/onlab/onos/net/flow/FlowEntry.java
index 882c9df..cdccaa9 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/FlowEntry.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/FlowEntry.java
@@ -65,6 +65,7 @@
*/
long bytes();
+ // TODO: consider removing this attribute
/**
* When this flow entry was last deemed active.
* @return epoch time of last activity
@@ -72,35 +73,6 @@
long lastSeen();
/**
- * Sets the last active epoch time.
- */
- void setLastSeen();
-
- /**
- * Sets the new state for this entry.
- * @param newState new flow entry state.
- */
- void setState(FlowEntryState newState);
-
- /**
- * Sets how long this entry has been entered in the system.
- * @param life epoch time
- */
- void setLife(long life);
-
- /**
- * Number of packets seen by this entry.
- * @param packets a long value
- */
- void setPackets(long packets);
-
- /**
- * Number of bytes seen by this rule.
- * @param bytes a long value
- */
- void setBytes(long bytes);
-
- /**
* Indicates the error type.
* @return an integer value of the error
*/
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/StoredFlowEntry.java b/core/api/src/main/java/org/onlab/onos/net/flow/StoredFlowEntry.java
new file mode 100644
index 0000000..e68ed68
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/StoredFlowEntry.java
@@ -0,0 +1,35 @@
+package org.onlab.onos.net.flow;
+
+
+public interface StoredFlowEntry extends FlowEntry {
+
+ /**
+ * Sets the last active epoch time.
+ */
+ void setLastSeen();
+
+ /**
+ * Sets the new state for this entry.
+ * @param newState new flow entry state.
+ */
+ void setState(FlowEntryState newState);
+
+ /**
+ * Sets how long this entry has been entered in the system.
+ * @param life epoch time
+ */
+ void setLife(long life);
+
+ /**
+ * Number of packets seen by this entry.
+ * @param packets a long value
+ */
+ void setPackets(long packets);
+
+ /**
+ * Number of bytes seen by this rule.
+ * @param bytes a long value
+ */
+ void setBytes(long bytes);
+
+}