Drop flows with actions to non-existing group id 38/82438/12
authorGobinath <gobinath@ericsson.com>
Tue, 2 Apr 2019 12:42:19 +0000 (18:12 +0530)
committerArunprakash D <d.arunprakash@ericsson.com>
Mon, 4 Nov 2019 08:27:25 +0000 (08:27 +0000)
Drop the flows which has action pointing to non-existing group
id in both apply actions and write actions.

Change-Id: I63e000871fe8fb80b7d12d0779232cdd6433f9f8
Signed-off-by: Gobinath <gobinath@ericsson.com>
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/ActionType.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeReconciliationImpl.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/util/FrmUtil.java

index 7b45f67f0bfd13435260f06316a5a405ffaa722c..977e0d09e0565ad17ca673abbd5dae4c3b1c3ae3 100644 (file)
@@ -10,10 +10,12 @@ package org.opendaylight.openflowplugin.applications.frm;
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase;
 
 public enum ActionType {
     APPLY_ACTION(ApplyActionsCase.class),
-    GROUP_ACTION(GroupActionCase.class);
+    GROUP_ACTION(GroupActionCase.class),
+    WRITE_ACTION(WriteActionsCase.class);
 
     private Class<?> actionType;
 
index b3ef2f2f0bf1b125676548537f864e5b1f8171f3..6655cb24bfc706c82265226a3bad9b36602451de 100644 (file)
@@ -40,6 +40,7 @@ import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.applications.frm.FlowNodeReconciliation;
 import org.opendaylight.openflowplugin.applications.frm.ForwardingRulesManager;
+import org.opendaylight.openflowplugin.applications.frm.util.FrmUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
@@ -66,6 +67,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroup;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroupKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
@@ -150,6 +152,9 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
     @Override
     public ListenableFuture<Boolean> reconcileConfiguration(InstanceIdentifier<FlowCapableNode> connectedNode) {
         LOG.info("Triggering reconciliation for device {}", connectedNode.firstKeyOf(Node.class));
+        // Clearing the group registry cache for the connected node if exists
+        NodeId nodeId = FrmUtil.getNodeIdFromNodeIdentifier(connectedNode);
+        provider.getDevicesGroupRegistry().clearNodeGroups(nodeId);
         if (provider.isStaleMarkingEnabled()) {
             LOG.info("Stale-Marking is ENABLED and proceeding with deletion of " + "stale-marked entities on switch {}",
                     connectedNode.toString());
@@ -283,8 +288,6 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
     public ListenableFuture<Boolean> startReconciliation(DeviceInfo node) {
         InstanceIdentifier<FlowCapableNode> connectedNode = node.getNodeInstanceIdentifier()
                 .augmentation(FlowCapableNode.class);
-        // Clearing the group registry cache for the connected node if exists
-        provider.getDevicesGroupRegistry().clearNodeGroups(node.getNodeId());
         return futureMap.computeIfAbsent(node, future -> reconcileConfiguration(connectedNode));
     }
 
index 9bb5be1b5f239c4e396b9e6125cc589fe1c80e90..ff8183d3da885029ba66057eeb39191c0989f7dd 100644 (file)
@@ -24,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.ta
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
@@ -80,6 +81,10 @@ public final class FrmUtil {
                         .equals(ActionType.APPLY_ACTION.getActionType())) {
                     actions = ((ApplyActionsCase) instruction.getInstruction())
                             .getApplyActions().getAction();
+                } else if (instruction.getInstruction().implementedInterface()
+                        .equals(ActionType.WRITE_ACTION.getActionType())) {
+                    actions = ((WriteActionsCase)instruction.getInstruction())
+                            .getWriteActions().getAction();
                 }
                 for (Action action : actions) {
                     if (action.getAction().implementedInterface()