Bump MRI upstreams
[openflowplugin.git] / applications / forwardingrules-sync / src / main / java / org / opendaylight / openflowplugin / applications / frsync / util / ReconcileUtil.java
index 0d3799768da246b88e2144a9f1e6650ccc5fd97d..af58030a84019442df3a69a5782b3d9bcbcefcdf 100644 (file)
@@ -40,6 +40,7 @@ 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;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@@ -52,11 +53,10 @@ import org.slf4j.LoggerFactory;
  * Util methods for group reconcil task (future chaining, transforms).
  */
 public final class ReconcileUtil {
-
     private static final Logger LOG = LoggerFactory.getLogger(ReconcileUtil.class);
 
     private ReconcileUtil() {
-        throw new IllegalStateException("This class should not be instantiated.");
+        // Hidden on purpose
     }
 
     /**
@@ -84,7 +84,7 @@ public final class ReconcileUtil {
                 }
             } else {
                 resultSink = RpcResultBuilder.<Void>failed()
-                        .withError(RpcError.ErrorType.APPLICATION, "previous " + previousItemAction + " failed");
+                        .withError(ErrorType.APPLICATION, "previous " + previousItemAction + " failed");
             }
             return resultSink.build();
         };
@@ -111,7 +111,7 @@ public final class ReconcileUtil {
                 }
             } else {
                 resultSink = RpcResultBuilder.<Void>failed()
-                        .withError(RpcError.ErrorType.APPLICATION, "action of " + actionDescription + " failed");
+                        .withError(ErrorType.APPLICATION, "action of " + actionDescription + " failed");
             }
             return resultSink.build();
         };
@@ -184,21 +184,13 @@ public final class ReconcileUtil {
 
                 final Group existingGroup = installedGroups.get(group.getGroupId().getValue());
                 if (existingGroup != null) {
-                    if (!gatherUpdates) {
+                    if (!gatherUpdates || group.equals(existingGroup)) {
                         iterator.remove();
-                    } else {
+                    } else if (checkGroupPrecondition(installedGroups.keySet(), group)) {
                         // check buckets and eventually update
-                        if (group.equals(existingGroup)) {
-                            iterator.remove();
-                        } else {
-                            if (checkGroupPrecondition(installedGroups.keySet(), group)) {
-                                iterator.remove();
-                                LOG.trace("Group {} on device {} differs - planned for update", group.getGroupId(),
-                                        nodeId);
-                                stepPlan.getItemsToUpdate().add(new ItemSyncBox.ItemUpdateTuple<>(existingGroup,
-                                        group));
-                            }
-                        }
+                        iterator.remove();
+                        LOG.trace("Group {} on device {} differs - planned for update", group.getGroupId(), nodeId);
+                        stepPlan.getItemsToUpdate().add(new ItemSyncBox.ItemUpdateTuple<>(existingGroup, group));
                     }
                 } else if (checkGroupPrecondition(installedGroups.keySet(), group)) {
                     iterator.remove();