Adding Logs to log commit bundle errors 34/82334/16
authorgobinath <gobinath@ericsson.com>
Thu, 21 Mar 2019 09:02:36 +0000 (14:32 +0530)
committerShweta Chaturvedi <shweta.chaturvedi@ericsson.com>
Tue, 3 Sep 2019 07:48:33 +0000 (13:18 +0530)
Logging enhancement to log the commit bundle errors.

Change-Id: I587175acc52b184ff815452b1cd2dddc7e1b765d
Signed-off-by: gobinath <gobinath@ericsson.com>
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/BundleFlowForwarder.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeReconciliationImpl.java

index 1c3ded8b7bc051b2c6517f4189ee5a7aaf213473..51797f58f122a20a6cb3037d43d9ef443f8923d6 100644 (file)
@@ -58,6 +58,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.on
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleId;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
@@ -172,12 +173,15 @@ public class BundleFlowForwarder implements BundleMessagesCommiter<Flow> {
                         }, MoreExecutors.directExecutor());
                     } else {
                         LOG.debug("Group {} not present in the config inventory", groupId);
-                        resultFuture = Futures.immediateFuture(RpcResultBuilder.<AddBundleMessagesOutput>success()
-                                .build());
+                        resultFuture = Futures.immediateFuture(RpcResultBuilder.<AddBundleMessagesOutput>failed()
+                                .withError(RpcError.ErrorType.APPLICATION,
+                                        "Group " + groupId + " not present in the config inventory").build());
                     }
                 } catch (InterruptedException | ExecutionException e) {
                     LOG.error("Error while reading group from config datastore for the group ID {}", groupId, e);
-                    resultFuture = Futures.immediateFuture(RpcResultBuilder.<AddBundleMessagesOutput>success().build());
+                    resultFuture = Futures.immediateFuture(RpcResultBuilder.<AddBundleMessagesOutput>failed()
+                            .withError(RpcError.ErrorType.APPLICATION,
+                                    "Group " + groupId + " not present in the config inventory").build());
                 }
             }
         } else {
@@ -236,6 +240,8 @@ public class BundleFlowForwarder implements BundleMessagesCommiter<Flow> {
                     }
                 },  MoreExecutors.directExecutor());
             } else {
+                LOG.error("Error {} while pushing flow add bundle {} for device {}", rpcResult.getErrors(), messages,
+                        nodeId.getValue());
                 resultFuture.set(rpcResult);
             }
         }
index 0a53760c2c96df5eb97a54c539558cabfde250cf..0c7b31f7115be13d997be38f31af63faa24bcb8c 100644 (file)
@@ -236,9 +236,11 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                         }, MoreExecutors.directExecutor());
 
                 /* Commit the bundle on the openflow switch */
-                ListenableFuture<RpcResult<ControlBundleOutput>> commitBundleFuture
-                        = Futures.transformAsync(addbundlesFuture, rpcResult ->
-                        salBundleService.controlBundle(commitBundleInput), MoreExecutors.directExecutor());
+                ListenableFuture<RpcResult<ControlBundleOutput>> commitBundleFuture = Futures.transformAsync(
+                        addbundlesFuture, rpcResult -> {
+                        LOG.debug("Adding bundle messages completed for device {}", dpnId);
+                        return salBundleService.controlBundle(commitBundleInput);
+                    }, MoreExecutors.directExecutor());
 
                 /* Bundles not supported for meters */
                 List<Meter> meters = flowNode.get().getMeter() != null ? flowNode.get().getMeter()
@@ -261,6 +263,8 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                         OF_EVENT_LOG.debug("Bundle Reconciliation Finish, Node: {}", dpnId);
                         return true;
                     } else {
+                        LOG.error("commit bundle failed for device {} with error {}", dpnId,
+                                commitBundleFuture.get().getErrors());
                         return false;
                     }
                 } catch (InterruptedException | ExecutionException e) {