ONOS controls the packet count field from flow statistics to check flow liveness, but some switches (such as Pica8) do not support packet count field of the flow statistics. Pica8 switch sends "-1" as the packet count. Even though packets match flow rules, when the idle-timeout time is up, ONOS deletes these rules based on the packet count field anyways. Therefore, just checking the packet count field is not enough for this situation. Pica8 sends byte count properly. If ONOS checks both packet and byte count, this problem will be solved. I would like to add byte count check to FlowRuleManager - checkRuleLiveness method.

Change-Id: I4ade01bcd17c4b0a7a59750bd1834b87e78f9972
diff --git a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
index 81cf1c8..f577762 100644
--- a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
@@ -483,7 +483,7 @@
                 }
             }
 
-            if (storedRule.packets() != swRule.packets()) {
+            if (storedRule.packets() != swRule.packets() || storedRule.bytes() != swRule.bytes()) {
                 lastSeen.put(storedRule, currentTime);
                 return true;
             }