Add the RemoteDeviceId at the begining of the log 93/47393/1
authorAlexis de Talhouët <adetalhouet@inocybe.com>
Fri, 21 Oct 2016 20:37:48 +0000 (16:37 -0400)
committerTomas Cere <tcere@cisco.com>
Sun, 23 Oct 2016 15:30:26 +0000 (15:30 +0000)
So it's easier to grep and find things related to one netconf
connector, and also, to keep things consistent with how it's
already done in sal-netconf-connector

Change-Id: I29ee41c699de8287fd6e00f3a04cacb3d17c5fd1
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
(cherry picked from commit 518b77c6c392a18270297705634dd5bff260ea29)

netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/MasterSalFacade.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfNodeManager.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java

index 7fa8e5aaad39464a9758b7183a6025eb98b4eff5..8e45cbc37462965dcb324e75c62c7d470723fc9f 100644 (file)
@@ -131,7 +131,7 @@ class MasterSalFacade implements AutoCloseable, RemoteDeviceHandler<NetconfSessi
 
         final NetconfDeviceNotificationService notificationService = new NetconfDeviceNotificationService();
 
-        LOG.info("Creating master data broker for device {}", id);
+        LOG.info("{}: Creating master data broker for device", id);
 
         final NetconfDOMTransaction masterDOMTransactions =
                 new NetconfMasterDOMTransaction(id, remoteSchemaContext, deviceRpc, netconfSessionPreferences);
@@ -169,7 +169,7 @@ class MasterSalFacade implements AutoCloseable, RemoteDeviceHandler<NetconfSessi
             try {
                 resource.close();
             } catch (final Exception e) {
-                LOG.warn("{}: Ignoring exception while closing {}", id, resource, e);
+                LOG.error("{}: Ignoring exception while closing {}", id, resource, e);
             }
         }
     }
index e90ea662531d35ae1c8cd2988b4e5ef228660274..7cc3d29b86bacd555d37c669a4f1fba41fa52865 100644 (file)
@@ -67,23 +67,23 @@ class NetconfNodeManager
             final NodeId nodeId = NetconfTopologyUtils.getNodeId(rootNode.getIdentifier());
             switch (rootNode.getModificationType()) {
                 case SUBTREE_MODIFIED:
-                    LOG.debug("Operational for node {} updated. Trying to register slave mount point", nodeId);
+                    LOG.debug("{}: Operational for node {} updated. Trying to register slave mount point", id, nodeId);
                     handleSlaveMountPoint(rootNode);
                     break;
                 case WRITE:
                     if (rootNode.getDataBefore() != null) {
-                        LOG.debug("Operational for node {} rewrited. Trying to register slave mount point", nodeId);
+                        LOG.debug("{}: Operational for node {} rewrited. Trying to register slave mount point", id, nodeId);
                     } else {
-                        LOG.debug("Operational for node {} created. Trying to register slave mount point", nodeId);
+                        LOG.debug("{}: Operational for node {} created. Trying to register slave mount point", id, nodeId);
                     }
                     handleSlaveMountPoint(rootNode);
                     break;
                 case DELETE:
-                    LOG.debug("Operational for node {} deleted. Trying to remove slave mount point", nodeId);
+                    LOG.debug("{}: Operational for node {} deleted. Trying to remove slave mount point", id, nodeId);
                     closeActor();
                     break;
                 default:
-                    LOG.debug("Uknown operation for node: {}", nodeId);
+                    LOG.debug("{}: Uknown operation for node: {}", id, nodeId);
             }
         }
     }
@@ -107,7 +107,7 @@ class NetconfNodeManager
     }
 
     void registerDataTreeChangeListener(final String topologyId, final NodeKey key) {
-        LOG.debug("Registering data tree change listener on node {}", key);
+        LOG.debug("{}: Registering data tree change listener on node {}", id, key);
         dataChangeListenerRegistration = setup.getDataBroker().registerDataTreeChangeListener(
                 new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL,
                         NetconfTopologyUtils.createTopologyNodeListPath(key, topologyId)), this);
index 6cad5c1c04775f958478f2ad322246414a66c1fc..cfd9dd81131d438f55665b2c473ee652bc270d00 100644 (file)
@@ -176,14 +176,14 @@ public class NetconfTopologyManager
             try {
                 netconfTopologyContext.closeFinal();
             } catch (Exception e) {
-                LOG.warn("Error at closing topology context. InstanceIdentifier: " + instanceIdentifier);
+                LOG.error("Error at closing topology context. InstanceIdentifier: " + instanceIdentifier, e);
             }
         });
         clusterRegistrations.forEach((instanceIdentifier, clusterSingletonServiceRegistration) -> {
             try {
                 clusterSingletonServiceRegistration.close();
             } catch (Exception e) {
-                LOG.warn("Error at unregistering from cluster. InstanceIdentifier: " + instanceIdentifier);
+                LOG.error("Error at unregistering from cluster. InstanceIdentifier: " + instanceIdentifier, e);
             }
         });
         contexts.clear();
index 47405b87c8fc86c57bac02d096efb630d4704c40..0525789d153eac9f575ee8b05423e075345c2d43 100644 (file)
@@ -137,23 +137,23 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
         Futures.addCallback(future, new FutureCallback<NetconfDeviceCapabilities>() {
             @Override
             public void onSuccess(NetconfDeviceCapabilities result) {
-                LOG.debug("{}: Connector started succesfully", nodeId.getValue());
+                LOG.debug("{}: Connector started successfully", remoteDeviceId);
             }
 
             @Override
             public void onFailure(@Nullable Throwable throwable) {
-                LOG.error("{}: Connector failed, {}", nodeId.getValue(), throwable);
+                LOG.error("{}: Connector failed, {}", remoteDeviceId, throwable);
             }
         });
     }
 
     @Override
     public void stopRemoteDeviceConnection() {
-        Preconditions.checkNotNull(deviceCommunicatorDTO, "Device communicator was not created.");
+        Preconditions.checkNotNull(deviceCommunicatorDTO, remoteDeviceId + ": Device communicator was not created.");
         try {
             deviceCommunicatorDTO.close();
         } catch (Exception e) {
-            LOG.warn("{}: Error at closing device communicator.", remoteDeviceId);
+            LOG.error("{}: Error at closing device communicator.", remoteDeviceId, e);
         }
     }
 
@@ -172,7 +172,7 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
                 netconfTopologyDeviceSetup.getDomBroker(), netconfTopologyDeviceSetup.getBindingAwareBroker(),
                 netconfTopologyDeviceSetup.getActorSystem(), deviceContextActorRef);
         if (keepaliveDelay > 0) {
-            LOG.info("Device: {} , Adding keepalive facade.", nodeId);
+            LOG.info("{}: Adding keepalive facade.", remoteDeviceId);
             salFacade = new KeepaliveSalFacade(remoteDeviceId, salFacade,
                     netconfTopologyDeviceSetup.getKeepaliveExecutor().getExecutor(), keepaliveDelay,
                     defaultRequestTimeoutMillis);
@@ -226,7 +226,7 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
                         ? NetconfTopologyUtils.DEFAULT_CONCURRENT_RPC_LIMIT : node.getConcurrentRpcLimit();
 
         if (rpcMessageLimit < 1) {
-            LOG.info("Device: {}, Concurrent rpc limit is smaller than 1, no limit will be enforced.", remoteDeviceId);
+            LOG.info("{}: Concurrent rpc limit is smaller than 1, no limit will be enforced.", remoteDeviceId);
         }
 
         return new NetconfConnectorDTO(
@@ -249,8 +249,8 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
 
         final NetconfSessionPreferences parsedOverrideCapabilities =
                 NetconfSessionPreferences.fromStrings(capabilities);
-        Preconditions.checkState(parsedOverrideCapabilities.getNonModuleCaps().isEmpty(),
-                "Capabilities to override can only contain module based capabilities, non-module capabilities "
+        Preconditions.checkState(parsedOverrideCapabilities.getNonModuleCaps().isEmpty(), remoteDeviceId +
+                "Capabilities to override can only contain module based capabilities, non-module capabilities "
                         + "will be retrieved from the device, configured non-module capabilities: "
                         + parsedOverrideCapabilities.getNonModuleCaps());
 
@@ -283,11 +283,11 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
                     }
                 }
                 LOG.info("{} : netconf connector will use schema cache directory {} instead of {}",
-                        nodeId.getValue(), moduleSchemaCacheDirectory, NetconfTopologyUtils.DEFAULT_CACHE_DIRECTORY);
+                        remoteDeviceId, moduleSchemaCacheDirectory, NetconfTopologyUtils.DEFAULT_CACHE_DIRECTORY);
             }
         } else {
             LOG.info("{} : using the default directory {}",
-                    nodeId.getValue(), NetconfTopologyUtils.QUALIFIED_DEFAULT_CACHE_DIRECTORY);
+                    remoteDeviceId, NetconfTopologyUtils.QUALIFIED_DEFAULT_CACHE_DIRECTORY);
         }
 
         if (schemaResourcesDTO == null) {
@@ -402,7 +402,7 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
                     ((org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword) credentials).getUsername(),
                     ((org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword) credentials).getPassword());
         } else {
-            throw new IllegalStateException("Only login/password authentification is supported");
+            throw new IllegalStateException(remoteDeviceId + ": Only login/password authentication is supported");
         }
 
         return NetconfReconnectingClientConfigurationBuilder.create()