Merge "Use String(byte[], Charset)"
[openflowplugin.git] / applications / forwardingrules-manager / src / main / java / org / opendaylight / openflowplugin / applications / frm / impl / FlowForwarder.java
index 689ffe48c045cf326ccb9f26976d56c171f3e914..9ce70732f0b0568f29b6906791403b942dddad39 100644 (file)
@@ -128,18 +128,23 @@ public class FlowForwarder extends AbstractListeningCommiter<Flow> {
             if (bundleId != null) {
                 provider.getBundleFlowListener().remove(identifier, removeDataObj, nodeIdent, bundleId);
             } else {
-                final RemoveFlowInputBuilder builder = new RemoveFlowInputBuilder(removeDataObj);
-                builder.setFlowRef(new FlowRef(identifier));
-                builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
-                builder.setFlowTable(new FlowTableRef(nodeIdent.child(Table.class, tableKey)));
-
-                // This method is called only when a given flow object has been
-                // removed from datastore. So FRM always needs to set strict flag
-                // into remove-flow input so that only a flow entry associated with
-                // a given flow object is removed.
-                builder.setTransactionUri(new Uri(provider.getNewTransactionId())).setStrict(Boolean.TRUE);
-                LoggingFutures.addErrorLogging(provider.getSalFlowService().removeFlow(builder.build()), LOG,
-                    "removeFlow");
+                final NodeId nodeId = getNodeIdFromNodeIdentifier(nodeIdent);
+                nodeConfigurator.enqueueJob(nodeId.getValue(), () -> {
+                    final RemoveFlowInputBuilder builder = new RemoveFlowInputBuilder(removeDataObj);
+                    builder.setFlowRef(new FlowRef(identifier));
+                    builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
+                    builder.setFlowTable(new FlowTableRef(nodeIdent.child(Table.class, tableKey)));
+
+                    // This method is called only when a given flow object has been
+                    // removed from datastore. So FRM always needs to set strict flag
+                    // into remove-flow input so that only a flow entry associated with
+                    // a given flow object is removed.
+                    builder.setTransactionUri(new Uri(provider.getNewTransactionId())).setStrict(Boolean.TRUE);
+                    final ListenableFuture<RpcResult<RemoveFlowOutput>> resultFuture =
+                            provider.getSalFlowService().removeFlow(builder.build());
+                    LoggingFutures.addErrorLogging(resultFuture, LOG, "removeFlow");
+                    return resultFuture;
+                });
             }
         }
     }
@@ -270,7 +275,7 @@ public class FlowForwarder extends AbstractListeningCommiter<Flow> {
     @Override
     public void createStaleMarkEntity(InstanceIdentifier<Flow> identifier, Flow del,
             InstanceIdentifier<FlowCapableNode> nodeIdent) {
-        LOG.debug("Creating Stale-Mark entry for the switch {} for flow {} ", nodeIdent.toString(), del.toString());
+        LOG.debug("Creating Stale-Mark entry for the switch {} for flow {} ", nodeIdent, del);
         StaleFlow staleFlow = makeStaleFlow(identifier, del, nodeIdent);
         persistStaleFlow(staleFlow, nodeIdent);
     }
@@ -399,7 +404,7 @@ public class FlowForwarder extends AbstractListeningCommiter<Flow> {
                         getFlowId(addFlowInput.getFlowRef()), nodeId);
             } else {
                 LOG.error("Flow add with id {} failed for node {} with error {}", getFlowId(addFlowInput.getFlowRef()),
-                        nodeId, rpcResult.getErrors().toString());
+                        nodeId, rpcResult.getErrors());
                 resultFuture.set(RpcResultBuilder.<AddFlowOutput>failed()
                         .withRpcErrors(rpcResult.getErrors()).build());
             }
@@ -449,7 +454,7 @@ public class FlowForwarder extends AbstractListeningCommiter<Flow> {
                         getFlowId(updateFlowInput.getFlowRef()), nodeId);
             } else {
                 LOG.error("Flow update with id {} failed for node {} with error {}",
-                        getFlowId(updateFlowInput.getFlowRef()), nodeId, rpcResult.getErrors().toString());
+                        getFlowId(updateFlowInput.getFlowRef()), nodeId, rpcResult.getErrors());
                 resultFuture.set(RpcResultBuilder.<UpdateFlowOutput>failed()
                         .withRpcErrors(rpcResult.getErrors()).build());
             }