Have openflow switch report all flow removals 48/2148/3
authorAlessandro Boch <aboch@cisco.com>
Thu, 24 Oct 2013 17:23:44 +0000 (10:23 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 25 Oct 2013 16:16:57 +0000 (16:16 +0000)
- Current Flow Programmer Service code in protocol_plugins.openflow
  instructs the switch to report the flow removal event to the controller
  only for hard or idle timeout flows, during flowmod message creation.
  Nevrekar pointed out in some switches a removal of openflow flows may
  be done by other entities. So in order for the app on top of controller
  to get to know about this flow deletions, we are here enabling the flow
  removal event report from the switch for all controller installed flows.

Change-Id: Iae2f7716b592269fd09c4e2fa4a18ae274367f9d
Signed-off-by: Alessandro Boch <aboch@cisco.com>
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java

index daf1aa8b7168a8b3a4670f21d0468036e42a380f..2bbe9c12c6719e736f960bd2fba4a1457825060c 100644 (file)
@@ -451,13 +451,10 @@ public class FlowConverter {
             if (port != null) {
                 ((OFFlowMod) fm).setOutPort(port);
             }
             if (port != null) {
                 ((OFFlowMod) fm).setOutPort(port);
             }
-            if (command == OFFlowMod.OFPFC_ADD
-                    || command == OFFlowMod.OFPFC_MODIFY
+            if (command == OFFlowMod.OFPFC_ADD || command == OFFlowMod.OFPFC_MODIFY
                     || command == OFFlowMod.OFPFC_MODIFY_STRICT) {
                     || command == OFFlowMod.OFPFC_MODIFY_STRICT) {
-                if (flow.getIdleTimeout() != 0 || flow.getHardTimeout() != 0) {
-                    // Instruct switch to let controller know when flow expires
-                    ((OFFlowMod) fm).setFlags((short) 1);
-                }
+                // Instruct switch to let controller know when flow is removed
+                ((OFFlowMod) fm).setFlags((short) 1);
             }
         } else {
             ((V6FlowMod) fm).setVendor();
             }
         } else {
             ((V6FlowMod) fm).setVendor();
@@ -475,13 +472,10 @@ public class FlowConverter {
             if (port != null) {
                 ((V6FlowMod) fm).setOutPort(port);
             }
             if (port != null) {
                 ((V6FlowMod) fm).setOutPort(port);
             }
-            if (command == OFFlowMod.OFPFC_ADD
-                    || command == OFFlowMod.OFPFC_MODIFY
+            if (command == OFFlowMod.OFPFC_ADD || command == OFFlowMod.OFPFC_MODIFY
                     || command == OFFlowMod.OFPFC_MODIFY_STRICT) {
                     || command == OFFlowMod.OFPFC_MODIFY_STRICT) {
-                if (flow.getIdleTimeout() != 0 || flow.getHardTimeout() != 0) {
-                    // Instruct switch to let controller know when flow expires
-                    ((V6FlowMod) fm).setFlags((short) 1);
-                }
+                // Instruct switch to let controller know when flow is removed
+                ((V6FlowMod) fm).setFlags((short) 1);
             }
         }
         logger.trace("Openflow Match: {} Openflow Actions: {}", ofMatch,
             }
         }
         logger.trace("Openflow Match: {} Openflow Actions: {}", ofMatch,