Bug 2862 - flow ID is unknown value in operational store. (e.g. id: #UF*200-3) 95/21995/1
authorAnil Vishnoi <vishnoianil@gmail.com>
Fri, 5 Jun 2015 13:08:48 +0000 (18:38 +0530)
committerAnil Vishnoi <vishnoianil@gmail.com>
Fri, 5 Jun 2015 15:46:28 +0000 (15:46 +0000)
Fix for old Helium code base.
This issue only occurs when user don't set cookie value while installing the flow
and that's valid flow.

Cookie is used in flow comparison for the applications using match extensions
in their flow body. As of now openflowplugin don't use match extensions
in flow comparison, that can create a scenario where more then one stored flow
can match to any stats flow, if stored flows differ only by match extension.
Once match extensions are part of flow comparison, we should remove cookie
from flow comparison.

Cookie is an optional field, so user might not set it, but if switch
get flow without cookie value , it will use 0 as a default cookie value
and return cookie=0 when openflowplugin fetch the flow stats from switch.
In this scenario flow comparison will fail. This fix make sure that
if user didn't set cookie value while flow installation, skip the cookie
comparison while augmenting flow stats.

Change-Id: Ia156b70b08569ccd573ba07a549093fa1af3a82f
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/impl/helper/FlowComparatorFactory.java

index 20c65346651e1a96960eee43edac65bb27691bba..3018dd970f6570ce083e19b4a77e9b0e3ec675e6 100644 (file)
@@ -91,6 +91,14 @@ public final class FlowComparatorFactory {
         };
     }
 
+    /*
+     * TODO:Cookie is used in flow comparison for the applications using match extensions
+     * in their flow body. As of now openflowplugin don't use match extensions
+     * in flow comparison, that can create a scenario where more then one stored flow
+     * can match to any stats flow, if stored flows differ only by match extension.
+     * Once match extensions are part of flow comparison, we should remove cookie
+     * from flow comparison.
+     */
     public static SimpleComparator<Flow> createCookie() {
         return new SimpleComparator<Flow>() {
             /**
@@ -98,6 +106,16 @@ public final class FlowComparatorFactory {
              */
             @Override
             public boolean areObjectsEqual(final Flow statsFlow, final Flow storedFlow) {
+                /*
+                 * Cookie is an optional field, so user might not set it, but if switch
+                 * get flow without cookie value , it will use 0 as a default cookie value
+                 * and return cookie=0 when openflowplugin fetch the flow stats from switch.
+                 * In this scenario flow comparison will fail. Below check make sure that
+                 * if user didn't set cookie value while flow installation, skip the comparison.
+                 */
+                if(storedFlow.getCookie() == null){
+                    return true;
+                }
                 if (statsFlow.getCookie() == null) {
                     if (storedFlow.getCookie() != null) {
                         return false;