Merge "Make configuration push timeout configurable"
authorEd Warnicke <eaw@cisco.com>
Thu, 23 Jan 2014 03:40:29 +0000 (03:40 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 23 Jan 2014 03:40:29 +0000 (03:40 +0000)
88 files changed:
opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManager.java
opendaylight/commons/opendaylight/pom.xml
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSessionPromise.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ConfigRegistryImpl.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ConfigTransactionControllerImpl.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/DestroyedModule.java
opendaylight/config/shutdown-impl/src/main/java/org/opendaylight/controller/config/yang/shutdown/impl/ShutdownServiceImpl.java
opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/ftl/FtlFilePersister.java
opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTracker.java
opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationService.java
opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ContainerConfigurationService.java
opendaylight/containermanager/implementation/src/main/java/org/opendaylight/controller/containermanager/internal/ContainerManager.java
opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/internal/StaticRoutingImplementation.java
opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManager.java
opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/Activator.java
opendaylight/md-sal/clustered-data-store/implementation/src/main/java/org/opendaylight/controller/datastore/internal/ClusteredDataStoreImpl.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend
opendaylight/md-sal/model/model-flow-base/pom.xml
opendaylight/md-sal/model/model-flow-management/pom.xml
opendaylight/md-sal/model/model-flow-service/pom.xml
opendaylight/md-sal/model/model-flow-statistics/pom.xml
opendaylight/md-sal/model/pom.xml
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcProviderRegistry.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/InstanceIdentifierCodecImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/RuntimeGeneratedMappingServiceImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/TransformerGenerator.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentConnector.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.xtend
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModule.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerConfigActivator.xtend
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerImpl.xtend
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/NotificationModule.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/SchemaServiceImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareDataStoreAdapter.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaContextProvider.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaContextProviders.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java
opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/BrokerFacade.xtend
opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/sample/toaster/provider/impl/ToastConsumerImpl.java
opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/OpendaylightToaster.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatistics.java [deleted file]
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatisticsAger.java [new file with mode: 0644]
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsManagerActivator.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateHandler.java [new file with mode: 0644]
opendaylight/md-sal/test/sal-rest-connector-it/pom.xml
opendaylight/md-sal/topology-lldp-discovery/pom.xml
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/Commit.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/DiscardChanges.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/Validate.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/MissingInstanceHandlingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/get/Get.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/getconfig/GetConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpc.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchema.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/osgi/NetconfSSHActivator.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/SocketThread.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/SendErrorExceptionUtil.java
opendaylight/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/BundleScanner.java
opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/utils/NorthboundUtils.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/ControllerIO.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowConverter.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java
opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java
opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/ConfigManager.java
opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/LBUtil.java
opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerService.java
opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/RandomLBPolicy.java
opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/policies/RoundRobinLBPolicy.java
opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/internal/SimpleForwardingImpl.java
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Subnet.java
opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java
opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java
opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/UserManager.java
opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebUtil.java

index 65e7720dd3141734951cb7d51e2b69bf8619df7b..83db4144007963a94e503a33345b1e641eadc2a0 100644 (file)
@@ -69,7 +69,7 @@ public class ClusterManager implements IClusterServices {
     private ViewChangedListener cacheManagerListener;
 
     private static String loopbackAddress = InetAddress.getLoopbackAddress().getHostAddress();
-
+    private static final int gossipRouterPortDefault = 12001;
     // defaultTransactionTimeout is 60 seconds
     private static int DEFAULT_TRANSACTION_TIMEOUT = 60;
 
@@ -91,12 +91,11 @@ public class ClusterManager implements IClusterServices {
      */
     private GossipRouter startGossiper() {
         boolean amIGossipRouter = false;
-        Integer gossipRouterPortDefault = 12001;
         Integer gossipRouterPort = gossipRouterPortDefault;
         InetAddress gossipRouterAddress = null;
         String supernodes_list = System.getProperty("supernodes",
                 loopbackAddress);
-        StringBuffer sanitized_supernodes_list = new StringBuffer();
+        StringBuilder sanitized_supernodes_list = new StringBuilder();
         List<InetAddress> myAddresses = new ArrayList<InetAddress>();
 
         StringTokenizer supernodes = new StringTokenizer(supernodes_list, ":");
@@ -135,7 +134,7 @@ public class ClusterManager implements IClusterServices {
             try {
                 hostAddr = InetAddress.getByName(host);
             } catch (UnknownHostException ue) {
-                logger.error("Host not known");
+                logger.error("Host {} is not known", host);
                 continue;
             }
             if (host_port.hasMoreTokens()) {
@@ -143,13 +142,12 @@ public class ClusterManager implements IClusterServices {
                 try {
                     port_num = Integer.valueOf(port);
                 } catch (NumberFormatException ne) {
-                    logger
-                            .error("Supplied supernode gossiepr port is not recognized, using standard gossipport");
+                    logger.error("Supplied supernode gossip port is not recognized, using default gossip port {}",
+                                 gossipRouterPortDefault);
                     port_num = gossipRouterPortDefault;
                 }
                 if ((port_num > 65535) || (port_num < 0)) {
-                    logger
-                            .error("Supplied supernode gossip port is outside a valid TCP port range");
+                    logger.error("Supplied supernode gossip port is outside a valid TCP port range");
                     port_num = gossipRouterPortDefault;
                 }
             }
@@ -168,8 +166,7 @@ public class ClusterManager implements IClusterServices {
             if (!sanitized_supernodes_list.toString().equals("")) {
                 sanitized_supernodes_list.append(",");
             }
-            sanitized_supernodes_list.append(hostAddr.getHostAddress() + "["
-                    + port_num + "]");
+            sanitized_supernodes_list.append(hostAddr.getHostAddress()).append("[").append(port_num).append("]");
         }
 
         if (amIGossipRouter) {
index 3eba5f0b3c202078f88a09e5d4381091a3d0c5aa..64c873b347511a7de582b2e3e8c8da594bdbbf17 100644 (file)
@@ -62,8 +62,8 @@
     <ietf-inet-types.version>2010.09.24.2-SNAPSHOT</ietf-inet-types.version>
     <ietf-yang-types.version>2010.09.24.2-SNAPSHOT</ietf-yang-types.version>
     <ietf-topology.version>2013.10.21.0-SNAPSHOT</ietf-topology.version>
-    <opendaylight-l2-types.version>2013.08.27.1</opendaylight-l2-types.version>
-    <yang-ext.version>2013.09.07.1</yang-ext.version>
+    <opendaylight-l2-types.version>2013.08.27.2-SNAPSHOT</opendaylight-l2-types.version>
+    <yang-ext.version>2013.09.07.2-SNAPSHOT</yang-ext.version>
     <javassist.version>3.17.1-GA</javassist.version>
     <sample-toaster.version>1.0-SNAPSHOT</sample-toaster.version>
     <releaseplugin.version>2.3.2</releaseplugin.version>
index 9ecfb1bb0db48b32bb1af7005da9b7d90be42cf8..9f9f811e889f85c20352db331187f008b812bd85 100644 (file)
@@ -56,7 +56,7 @@ public abstract class AbstractSessionNegotiator<M, S extends AbstractProtocolSes
         try {
             startNegotiation();
         } catch (Exception e) {
-            logger.info("Unexpected negotiation failure", e);
+            logger.warn("Unexpected negotiation failure", e);
             negotiationFailed(e);
         }
     }
@@ -67,8 +67,14 @@ public abstract class AbstractSessionNegotiator<M, S extends AbstractProtocolSes
         try {
             handleMessage((M)msg);
         } catch (Exception e) {
-            logger.debug("Unexpected exception during negotiation", e);
+            logger.debug("Unexpected error while handling negotiation message {}", msg, e);
             negotiationFailed(e);
         }
     }
+
+    @Override
+    public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) {
+        logger.info("Unexpected error during negotiation", cause);
+        negotiationFailed(cause);
+    }
 }
index c54bf84987433f20b8fbadc28e70f12a236bc02c..67cf07cdf698f7d4b8f0da2f4bc7186a3b8fb8b7 100644 (file)
@@ -82,7 +82,7 @@ final class ProtocolSessionPromise<S extends ProtocolSession<?>> extends Default
                         }
 
                         if (!cf.isSuccess()) {
-                            LOG.info("Attempt to connect to connect to {} failed", ProtocolSessionPromise.this.address, cf.cause());
+                            LOG.warn("Attempt to connect to connect to {} failed", ProtocolSessionPromise.this.address, cf.cause());
                             final Future<Void> rf = ProtocolSessionPromise.this.strategy.scheduleReconnect(cf.cause());
                             rf.addListener(new FutureListener<Void>() {
                                 @Override
index 19231705d1614f696e2e764260d971c59c513ecd..a8406b00299db14f34a8c1988e95344efcf8be06 100644 (file)
@@ -182,7 +182,7 @@ public class ConfigRegistryImpl implements AutoCloseable, ConfigRegistryImplMXBe
             throws ConflictingVersionException, ValidationException {
         final String transactionName = ObjectNameUtil
                 .getTransactionName(transactionControllerON);
-        logger.info("About to commit {}. Current parentVersion: {}, versionCounter {}", transactionName, version, versionCounter);
+        logger.trace("About to commit {}. Current parentVersion: {}, versionCounter {}", transactionName, version, versionCounter);
 
         // find ConfigTransactionController
         Map<String, ConfigTransactionControllerInternal> transactions = transactionsHolder.getCurrentTransactions();
index e0d1a42661362a0ef425526bec8e9abc5e4633b9..90d2cb4002098812218135b1a039548bc5db1001 100644 (file)
@@ -306,7 +306,7 @@ class ConfigTransactionControllerImpl implements
 
     private void validate_noLocks() throws ValidationException {
         transactionStatus.checkNotAborted();
-        logger.info("Validating transaction {}", getTransactionIdentifier());
+        logger.trace("Validating transaction {}", getTransactionIdentifier());
         // call validate()
         List<ValidationException> collectedExceptions = new ArrayList<>();
         for (Entry<ModuleIdentifier, Module> entry : dependencyResolverManager
@@ -326,7 +326,7 @@ class ConfigTransactionControllerImpl implements
             throw ValidationException
                     .createFromCollectedValidationExceptions(collectedExceptions);
         }
-        logger.info("Validated transaction {}", getTransactionIdentifier());
+        logger.trace("Validated transaction {}", getTransactionIdentifier());
     }
 
     /**
@@ -345,7 +345,7 @@ class ConfigTransactionControllerImpl implements
         try {
             validate_noLocks();
         } catch (ValidationException e) {
-            logger.info("Commit failed on validation");
+            logger.trace("Commit failed on validation");
             configBeanModificationDisabled.set(false); // recoverable error
             throw e;
         }
@@ -368,7 +368,7 @@ class ConfigTransactionControllerImpl implements
                             + "to obtain a lock");
         }
 
-        logger.info("Committing transaction {}", getTransactionIdentifier());
+        logger.trace("Committing transaction {}", getTransactionIdentifier());
 
         // call getInstance()
         for (Entry<ModuleIdentifier, Module> entry : dependencyResolverManager
@@ -391,7 +391,7 @@ class ConfigTransactionControllerImpl implements
 
         // count dependency order
 
-        logger.info("Committed configuration {}", getTransactionIdentifier());
+        logger.trace("Committed configuration {}", getTransactionIdentifier());
         transactionStatus.setCommitted();
         // unregister this and all modules from jmx
         close();
index 682d4a1812acaf58ed9ff5e1373561066b73abb3..e4652c9bb8854fa09afe66d82eeecdb22bd05ba1 100644 (file)
@@ -43,7 +43,7 @@ public class DestroyedModule implements AutoCloseable,
 
     @Override
     public void close() {
-        logger.info("Destroying {}", identifier);
+        logger.trace("Destroying {}", identifier);
         try {
             instance.close();
         } catch (Exception e) {
index 6cdcf605b04716537d73252d75443e92506b3a14..584ea1766e2cd7ebaba141f7f02449473bec88b1 100644 (file)
@@ -138,7 +138,7 @@ class CallSystemExitThread extends Thread {
             logger.warn("Thread dump:{}", sb);
             System.exit(1);
         } catch (InterruptedException e) {
-            logger.info("Interrupted, not going to call System.exit(1)");
+            logger.warn("Interrupted, not going to call System.exit(1)");
         }
     }
 }
index f721895921a8300b7afb0a368c0685e8a56ce871..d6d3893bebdd54113a549bf9692e3851f7545af8 100644 (file)
@@ -83,12 +83,12 @@ public class FtlFilePersister {
                 pathToFile.mkdirs();
             }
             if (targetFile.exists() && overwrite == false) {
-                logger.info("Skipping {} since it already exists", targetFile);
+                logger.trace("Skipping {} since it already exists", targetFile);
             } else {
                 try (Writer fileWriter = new FileWriter(targetFile)) {
                     fileWriter.write(entry.getValue());
                 }
-                logger.info("{}: File {} generated successfully",
+                logger.trace("{}: File {} generated successfully",
                         JMXGenerator.class.getCanonicalName(), targetFile);
                 result.add(targetFile);
             }
index b5efc51d8ba854a3d576f7673b1db22f7fcc9c39..74a36c553fe7237e1a7df4bc7dff24c18bc6b28b 100644 (file)
@@ -136,7 +136,7 @@ public class ExtenderYangTracker extends BundleTracker<Object> implements YangSt
 
         updateCache(snapshot);
         cache.setInconsistentURLsForReporting(Collections.<URL> emptySet());
-        logger.info("Yang store updated to new consistent state containing {} yang files", consistentBundlesToYangURLs.size());
+        logger.trace("Yang store updated to new consistent state containing {} yang files", consistentBundlesToYangURLs.size());
         logger.debug("Yang store updated to new consistent state containing {}", consistentBundlesToYangURLs);
     }
 
index ce2aaea562311ddbb79a1ab98414d39e9a31e6c0..e6bbcf8eb6cdacfe81232e52201f2588bd91e7d9 100644 (file)
@@ -99,7 +99,7 @@ public class ConfigurationService implements IConfigurationService, ICacheUpdate
             Status status = configurationAware.saveConfiguration();
             if (!status.isSuccess()) {
                 success = false;
-                logger.info("Failed to save config for {}",
+                logger.warn("Failed to save config for {}",
                         configurationAware.getClass().getName());
             }
         }
index d4769016a6449c528537ccd5f8bc218a75b12f33..5f1db6b597d707c649b5d094ae15a1a19e62b5d7 100644 (file)
@@ -96,12 +96,12 @@ public class ContainerConfigurationService implements IConfigurationContainerSer
     public Status saveConfiguration() {
         boolean success = true;
         for (IConfigurationContainerAware configurationAware : configurationAwareList) {
-            logger.info("Save Config triggered for {}", configurationAware.getClass().getSimpleName());
+            logger.trace("Save Config triggered for {}", configurationAware.getClass().getSimpleName());
 
             Status status = configurationAware.saveConfiguration();
             if (!status.isSuccess()) {
                 success = false;
-                logger.info("Failed to save config for {}", configurationAware.getClass().getSimpleName());
+                logger.warn("Failed to save config for {}", configurationAware.getClass().getSimpleName());
             }
         }
         if (success) {
index d9e941ef784348eaf0254691c9cee464cea371da..e096c737805fbfccae39f7da3cc17ae49b3ea4a5 100644 (file)
@@ -896,7 +896,7 @@ public class ContainerManager extends Authorization<String> implements IContaine
      */
     private void notifyContainerModeChange(boolean lastActionDelete, boolean notifyLocal) {
         if (lastActionDelete == false && containerConfigs.size() == 1) {
-            logger.info("First container Creation. Inform listeners");
+            logger.trace("First container Creation. Inform listeners");
             synchronized (this.iContainerListener) {
                 for (IContainerListener i : this.iContainerListener) {
                     i.containerModeUpdated(UpdateType.ADDED);
@@ -910,7 +910,7 @@ public class ContainerManager extends Authorization<String> implements IContaine
                 }
             }
         } else if (lastActionDelete == true && containerConfigs.isEmpty()) {
-            logger.info("Last container Deletion. Inform listeners");
+            logger.trace("Last container Deletion. Inform listeners");
             synchronized (this.iContainerListener) {
                 for (IContainerListener i : this.iContainerListener) {
                     i.containerModeUpdated(UpdateType.REMOVED);
index e6651b86a19ee8d8055ecbf1c24044346f0e1d59..fe00b774f5113090b6841a986d3154e8f8564f9d 100644 (file)
@@ -143,7 +143,7 @@ public class StaticRoutingImplementation implements IfNewHostNotify, IForwarding
     @SuppressWarnings("deprecation")
     private void allocateCaches() {
         if (this.clusterContainerService == null) {
-            log.info("un-initialized clusterContainerService, can't create cache");
+            log.trace("un-initialized clusterContainerService, can't create cache");
             return;
         }
 
@@ -162,7 +162,7 @@ public class StaticRoutingImplementation implements IfNewHostNotify, IForwarding
     @SuppressWarnings({ "unchecked", "deprecation" })
     private void retrieveCaches() {
         if (this.clusterContainerService == null) {
-            log.info("un-initialized clusterContainerService, can't retrieve cache");
+            log.warn("un-initialized clusterContainerService, can't retrieve cache");
             return;
         }
 
@@ -181,7 +181,7 @@ public class StaticRoutingImplementation implements IfNewHostNotify, IForwarding
 
     private void notifyStaticRouteUpdate(StaticRoute s, boolean update) {
         if (this.staticRoutingAware != null) {
-            log.info("Invoking StaticRoutingAware listeners");
+            log.trace("Invoking StaticRoutingAware listeners");
             synchronized (this.staticRoutingAware) {
                 for (IStaticRoutingAware ra : this.staticRoutingAware) {
                     try {
index 21b747beee9d7f3eb5572a67832abe286eacadcd..fc5aac031133facd0e6e0aa18a62db3d0414fa0d 100644 (file)
@@ -467,7 +467,7 @@ public class ForwardingRulesManager implements
         Status succeeded = null;
         boolean decouple = false;
         if (installedList.size() != toInstallList.size()) {
-            log.info("Modify: New flow entry does not satisfy the same "
+            log.trace("Modify: New flow entry does not satisfy the same "
                     + "number of container flows as the original entry does");
             decouple = true;
         }
@@ -479,7 +479,7 @@ public class ForwardingRulesManager implements
              */
             FlowEntryInstall sameMatchEntry = installedSwView.get(installEntry);
             if (sameMatchEntry != null && !sameMatchEntry.getOriginal().equals(currentFlowEntry)) {
-                log.info("Modify: new container flow merged flow entry clashes with existing flow");
+                log.trace("Modify: new container flow merged flow entry clashes with existing flow");
                 decouple = true;
             } else {
                 toInstallSafe.add(installEntry);
@@ -1263,7 +1263,7 @@ public class ForwardingRulesManager implements
                 }
                 Status error = modifyEntry(currentFlowEntry, newFlowEntry, false);
                 if (error.isSuccess()) {
-                    log.info("Ports {} added to FlowEntry {}", portList, flowName);
+                    log.trace("Ports {} added to FlowEntry {}", portList, flowName);
                 } else {
                     log.warn("Failed to add ports {} to Flow entry {}. The failure is: {}", portList,
                             currentFlowEntry.toString(), error.getDescription());
@@ -1287,7 +1287,7 @@ public class ForwardingRulesManager implements
                 }
                 Status status = modifyEntry(currentFlowEntry, newFlowEntry, false);
                 if (status.isSuccess()) {
-                    log.info("Ports {} removed from FlowEntry {}", portList, flowName);
+                    log.trace("Ports {} removed from FlowEntry {}", portList, flowName);
                 } else {
                     log.warn("Failed to remove ports {} from Flow entry {}. The failure is: {}", portList,
                             currentFlowEntry.toString(), status.getDescription());
@@ -1335,7 +1335,7 @@ public class ForwardingRulesManager implements
         Status status = modifyEntry(currentFlowEntry, newFlowEntry, false);
 
         if (status.isSuccess()) {
-            log.info("Output port replaced with {} for flow {} on node {}", outPort, flowName, node);
+            log.trace("Output port replaced with {} for flow {} on node {}", outPort, flowName, node);
         } else {
             log.warn("Failed to replace output port for flow {} on node {}. The failure is: {}", flowName, node,
                     status.getDescription());
@@ -1793,7 +1793,7 @@ public class ForwardingRulesManager implements
         // Do not attempt to reinstall the flow, warn user
         if (newFlowConfig.equals(oldFlowConfig)) {
             String msg = "No modification detected";
-            log.info("Static flow modification skipped. New flow and old flow are the same: {}", newFlowConfig);
+            log.trace("Static flow modification skipped. New flow and old flow are the same: {}", newFlowConfig);
             return new Status(StatusCode.SUCCESS, msg);
         }
 
@@ -1895,7 +1895,7 @@ public class ForwardingRulesManager implements
      *            inactive list
      */
     private void uninstallAllFlowEntries(boolean preserveFlowEntries) {
-        log.info("Uninstalling all non-internal flows");
+        log.trace("Uninstalling all non-internal flows");
 
         List<FlowEntryInstall> toRemove = new ArrayList<FlowEntryInstall>();
 
@@ -1933,7 +1933,7 @@ public class ForwardingRulesManager implements
      * default container instance of FRM only when the last container is deleted
      */
     private void reinstallAllFlowEntries() {
-        log.info("Reinstalling all inactive flows");
+        log.trace("Reinstalling all inactive flows");
 
         for (FlowEntry flowEntry : this.inactiveFlows.keySet()) {
             this.addEntry(flowEntry, false);
@@ -2118,11 +2118,11 @@ public class ForwardingRulesManager implements
                 dropAllConfig.setActions(dropAction);
                 defaultConfigs.add(dropAllConfig);
 
-                log.info("Forwarding mode for node {} set to {}", node, (proactive ? "proactive" : "reactive"));
+                log.trace("Forwarding mode for node {} set to {}", node, (proactive ? "proactive" : "reactive"));
                 for (FlowConfig fc : defaultConfigs) {
                     Status status = (proactive) ? addStaticFlowInternal(fc, false) : removeStaticFlow(fc);
                     if (status.isSuccess()) {
-                        log.info("{} Proactive Static flow: {}", (proactive ? "Installed" : "Removed"), fc.getName());
+                        log.trace("{} Proactive Static flow: {}", (proactive ? "Installed" : "Removed"), fc.getName());
                     } else {
                         log.warn("Failed to {} Proactive Static flow: {}", (proactive ? "install" : "remove"),
                                 fc.getName());
@@ -2145,7 +2145,7 @@ public class ForwardingRulesManager implements
      * @param node
      */
     private void cleanDatabaseForNode(Node node) {
-        log.info("Cleaning Flow database for Node {}", node);
+        log.trace("Cleaning Flow database for Node {}", node);
         if (nodeFlows.containsKey(node)) {
             List<FlowEntryInstall> toRemove = new ArrayList<FlowEntryInstall>(nodeFlows.get(node));
 
@@ -2322,7 +2322,7 @@ public class ForwardingRulesManager implements
 
     @Override
     public void portGroupChanged(PortGroupConfig config, Map<Node, PortGroup> data, boolean add) {
-        log.info("PortGroup Changed for: {} Data: {}", config, portGroupData);
+        log.trace("PortGroup Changed for: {} Data: {}", config, portGroupData);
         Map<Node, PortGroup> existingData = portGroupData.get(config);
         if (existingData != null) {
             for (Map.Entry<Node, PortGroup> entry : data.entrySet()) {
index b231faf15307b558cebc629524ee185c12c89a97..fcd27d9a0a45ed0e068289aa1177870acdbd8929 100644 (file)
@@ -50,14 +50,15 @@ public class Activator implements BundleActivator {
                 if (reader == null) {
                     this.log.error("Cannot register the LogListener because "
                             + "cannot retrieve LogReaderService");
-                }
-                reader.addLogListener(this.listener);
-                // Now lets walk all the exiting messages
-                Enumeration<LogEntry> entries = reader.getLog();
-                if (entries != null) {
-                    while (entries.hasMoreElements()) {
-                        LogEntry entry = (LogEntry) entries.nextElement();
-                        this.listener.logged(entry);
+                } else {
+                    reader.addLogListener(this.listener);
+                    // Now lets walk all the exiting messages
+                    Enumeration<LogEntry> entries = reader.getLog();
+                    if (entries != null) {
+                        while (entries.hasMoreElements()) {
+                            LogEntry entry = entries.nextElement();
+                            this.listener.logged(entry);
+                        }
                     }
                 }
 
@@ -76,7 +77,7 @@ public class Activator implements BundleActivator {
                         log.warn("Invalid policy name \"{}\", defaulting to {}", policy, handler);
                     }
                 }
-                log.info("Setting uncaught exception policy to {}", handler);
+                log.trace("Setting uncaught exception policy to {}", handler);
                 Thread.setDefaultUncaughtExceptionHandler(handler);
 
                 /*
@@ -98,10 +99,10 @@ public class Activator implements BundleActivator {
 
     @Override
     public void stop(BundleContext context) {
-        ServiceReference service = null;
-        service = context.getServiceReference(LogReaderService.class.getName());
-        if (service != null) {
-            LogReaderService reader = (LogReaderService) service;
+        ServiceReference serviceRef = context.getServiceReference(
+                LogReaderService.class.getName());
+        if (serviceRef != null) {
+            LogReaderService reader = (LogReaderService) context.getService(serviceRef);
             reader.removeLogListener(this.listener);
         }
         if (this.shutdownHandler != null) {
index 5449c839f5082e7be1ff6321f886e4965789db68..0809ba347ba1bf97d914208978e9c536a3e669cf 100644 (file)
@@ -45,7 +45,7 @@ public class ClusteredDataStoreImpl implements ClusteredDataStore {
     private Logger logger = LoggerFactory.getLogger(ClusteredDataStoreImpl.class);
 
     public ClusteredDataStoreImpl(IClusterGlobalServices clusterGlobalServices) throws CacheConfigException {
-        logger.info("Constructing clustered data store");
+        logger.trace("Constructing clustered data store");
         Preconditions.checkNotNull(clusterGlobalServices, "clusterGlobalServices cannot be null");
 
         operationalDataCache = getOrCreateCache(clusterGlobalServices, OPERATIONAL_DATA_CACHE);
@@ -72,24 +72,24 @@ public class ClusteredDataStoreImpl implements ClusteredDataStore {
     public boolean containsConfigurationPath(InstanceIdentifier path) {
         return configurationDataCache.containsKey(path);
     }
-    
+
     @Override
     public boolean containsOperationalPath(InstanceIdentifier path) {
         return operationalDataCache.containsKey(path);
     }
-    
+
     @Override
     public Iterable<InstanceIdentifier> getStoredConfigurationPaths() {
         return configurationDataCache.keySet();
     }
-    
+
     @Override
     public Iterable<InstanceIdentifier> getStoredOperationalPaths() {
         return operationalDataCache.keySet();
     }
-    
-    
-    
+
+
+
     @Override
     public CompositeNode readConfigurationData(InstanceIdentifier path) {
         Preconditions.checkNotNull(path, "path cannot be null");
index 21af047c3d79a5cb2d6c2508e05f9121b119be71..39d224ba164c937dc9ca389259f640a22b177d20 100644 (file)
@@ -142,7 +142,7 @@ class InventoryAndReadAdapter implements IPluginInReadService,
                val table= it.readConfigurationData(tableRef) as Table;
                
                if(table != null){
-                       LOG.info("Number of flows installed in table 0 of node {} : {}",node,table.flow.size);
+                       LOG.trace("Number of flows installed in table 0 of node {} : {}",node,table.flow.size);
                        
                        for(flow : table.flow){
                                
@@ -248,7 +248,7 @@ class InventoryAndReadAdapter implements IPluginInReadService,
                val table= it.readConfigurationData(tableRef) as Table;
                
                if(table != null){
-                       LOG.info("Number of flows installed in table 0 of node {} : {}",node,table.flow.size);
+                       LOG.trace("Number of flows installed in table 0 of node {} : {}",node,table.flow.size);
                        
                        for(mdsalFlow : table.flow){
                                if(FromSalConversionsUtils.flowEquals(mdsalFlow, MDFlowMapping.toMDSalflow(targetFlow))){
index 5e69548d9a8cbcf70bee61561b6235bae60aae0d..ffa3194418ef39f219e9cc87d99393c3c166eb38 100644 (file)
@@ -19,7 +19,7 @@
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27.1</version>
+            <version>2013.08.27.2-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
index db2c62d9af24e8199988113d80439a3d7c6f252c..fe7b9f29f96002a891824f9be0df42d09bf482dc 100644 (file)
@@ -29,7 +29,7 @@
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27.1</version>
+            <version>2013.08.27.2-SNAPSHOT</version>
         </dependency>
     </dependencies>
     <packaging>bundle</packaging>
index c2e48b3df59d13134c73747b3d5b637fb6eb0ccc..fac7cfae284d660a6077ffc969ee230e9acb0ec9 100644 (file)
@@ -29,7 +29,7 @@
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27.1</version>
+            <version>2013.08.27.2-SNAPSHOT</version>
         </dependency>
     </dependencies>
     <packaging>bundle</packaging>
index e95fe24f28a9e8e6cf9e32af8a2f823fc001a20f..e357f7d76f1c4c9774b31a50f14cf3f6e2ff3631 100644 (file)
@@ -29,7 +29,7 @@
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27.1-SNAPSHOT</version>
+            <version>2013.08.27.2-SNAPSHOT</version>
         </dependency>
     </dependencies>
     <packaging>bundle</packaging>
index f7c137fb32c6ee994dbb2cba5781f5d11c2caa28..f803180e892b6329f2dfd465212ba778e9efad68 100644 (file)
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>yang-ext</artifactId>
-            <version>2013.09.07.1-SNAPSHOT</version>
+            <version>2013.09.07.2-SNAPSHOT</version>
         </dependency>
     </dependencies>
 
index cc764888cca932b89dacfe8210c6671147bc5f9d..0fa85d530e87a8d138d65b038305cdcf8e7176ca 100644 (file)
@@ -4,6 +4,7 @@ import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublishe
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
index f84503bea4d6e720fe3f16578a01e23116b2e72b..d9103727b2debc5e066a34380b7caef2d9f2e8a4 100644 (file)
@@ -59,6 +59,7 @@ class InstanceIdentifierCodecImpl implements InstanceIdentifierCodec {
             baArgs.add(baArg)
         }
         val ret = new InstanceIdentifier(baArgs,baType as Class<? extends DataObject>);
+        LOG.debug("DOM Instance Identifier {} deserialized to {}",input,ret);
         return ret;
     }
     
@@ -110,7 +111,9 @@ class InstanceIdentifierCodecImpl implements InstanceIdentifierCodec {
                 previousAugmentation = baArg.type;
             }
         }
-        return new org.opendaylight.yangtools.yang.data.api.InstanceIdentifier(components);
+        val ret = new org.opendaylight.yangtools.yang.data.api.InstanceIdentifier(components);
+        LOG.debug("Binding Instance Identifier {} serialized to DOM InstanceIdentifier {}",input,ret);
+        return ret;
     }
     
     def updateAugmentationInjection(Class<? extends DataObject> class1, ImmutableList<QName> list, Class<?> augmentation) {
index 1b3acf7674eda63e4430ec8d61b7ef186a2b6c80..7461ba89264d6505ce184f2ccb8748d49272bbf4 100644 (file)
@@ -260,7 +260,7 @@ class RuntimeGeneratedMappingServiceImpl implements BindingIndependentMappingSer
         if (typeDef !== null) {
             return typeDef;
         }
-        LOG.info("Thread blocked waiting for schema for: {}",type.fullyQualifiedName)
+        LOG.trace("Thread blocked waiting for schema for: {}",type.fullyQualifiedName)
         return type.getSchemaInFuture.get();
     }
 
index b22f3287782a3d4c84c00a6691e5e5c0bfa61df3..f68f94e32a62b0a7b5a1da443123eebc3ee7482b 100644 (file)
@@ -1102,7 +1102,7 @@ class TransformerGenerator {
     }
 
     private def createDummyImplementation(Class<?> object, GeneratedTransferObject typeSpec) {
-        log.info("Generating Dummy DOM Codec for {} with {}", object, object.classLoader)
+        log.trace("Generating Dummy DOM Codec for {} with {}", object, object.classLoader)
         return createClass(typeSpec.codecClassName) [
             if (object.isYangBindingAvailable) {
                 implementsType(BINDING_CODEC)
index b4fd6b67712d6054b2f74737d89f3ea091aa9345..a3c8c5f232b0b6e7daae0350880eca7e790985a5 100644 (file)
@@ -185,13 +185,13 @@ class NotifyTask implements Callable<Object> {
             if(log.isDebugEnabled){\r
                 log.debug("Delivering notification {} to {}",notification,listener);\r
             } else {\r
-                log.info("Delivering notification {} to {}",notification.class.name,listener);\r
+                log.trace("Delivering notification {} to {}",notification.class.name,listener);\r
             }\r
             listener.onNotification(notification);\r
             if(log.isDebugEnabled){\r
                 log.debug("Notification delivered {} to {}",notification,listener);\r
             } else {\r
-                log.info("Notification delivered {} to {}",notification.class.name,listener);\r
+                log.trace("Notification delivered {} to {}",notification.class.name,listener);\r
             }\r
         } catch (Exception e) {\r
             log.error("Unhandled exception thrown by listener: {}", listener, e);\r
index ffc72657f0e3ef406961738c6c3598ac044ecd9e..f93457110181967063ec64c27a3f29c026320121 100644 (file)
@@ -56,6 +56,8 @@ public class RpcProviderRegistryImpl implements //
 
     private final String name;
 
+    private ListenerRegistry<GlobalRpcRegistrationListener> globalRpcListeners = ListenerRegistry.create();
+
     public String getName() {
         return name;
     }
@@ -86,6 +88,7 @@ public class RpcProviderRegistryImpl implements //
         checkState(currentDelegate == null, "Rpc service is already registered");
         LOG.debug("Registering {} as global implementation of {} in {}", implementation, type.getSimpleName(), this);
         RuntimeCodeHelper.setDelegate(publicProxy, implementation);
+        notifyGlobalRpcAdded(type);
         return new RpcProxyRegistration<T>(type, implementation, this);
     }
 
@@ -140,6 +143,17 @@ public class RpcProviderRegistryImpl implements //
         }
     }
 
+    private void notifyGlobalRpcAdded(Class<? extends RpcService> type) {
+        for(ListenerRegistration<GlobalRpcRegistrationListener> listener : globalRpcListeners) {
+            try {
+                listener.getInstance().onGlobalRpcRegistered(type);
+            } catch (Exception e) {
+                LOG.error("Unhandled exception during invoking listener {}", e);
+            }
+        }
+        
+    }
+
     private void notifyListenersRoutedCreated(RpcRouter router) {
 
         for (ListenerRegistration<RouterInstantiationListener> listener : routerInstantiationListener) {
@@ -182,6 +196,16 @@ public class RpcProviderRegistryImpl implements //
     public interface RouterInstantiationListener extends EventListener {
         void onRpcRouterCreated(RpcRouter<?> router);
     }
+    
+    public ListenerRegistration<GlobalRpcRegistrationListener> registerGlobalRpcRegistrationListener(GlobalRpcRegistrationListener listener) {
+        return globalRpcListeners.register(listener);
+    }
+
+    public interface GlobalRpcRegistrationListener extends EventListener {
+        void onGlobalRpcRegistered(Class<? extends RpcService> cls);
+        void onGlobalRpcUnregistered(Class<? extends RpcService> cls);
+        
+    }
 
     private class RouteChangeForwarder<T extends RpcService> implements
             RouteChangeListener<Class<? extends BaseIdentity>, InstanceIdentifier<?>> {
index 7a7e086ec4c9098ca91e6a7897745eea688819e0..5d48548efd816dfb200039c12d3a948e0638f200 100644 (file)
@@ -43,6 +43,7 @@ import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
 import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl;
+import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl.GlobalRpcRegistrationListener;
 import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl.RouterInstantiationListener;
 import org.opendaylight.controller.sal.common.util.CommitHandlerTransactions;
 import org.opendaylight.controller.sal.common.util.Rpcs;
@@ -190,25 +191,30 @@ public class BindingIndependentConnector implements //
     private DataModificationTransaction createBindingToDomTransaction(
             DataModification<InstanceIdentifier<? extends DataObject>, DataObject> source) {
         DataModificationTransaction target = biDataService.beginTransaction();
+        LOG.debug("Created DOM Transaction {} for {},", target.getIdentifier(),source.getIdentifier());
         for (Entry<InstanceIdentifier<? extends DataObject>, DataObject> entry : source.getUpdatedConfigurationData()
                 .entrySet()) {
             Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> biEntry = mappingService
                     .toDataDom(entry);
             target.putConfigurationData(biEntry.getKey(), biEntry.getValue());
+            LOG.debug("Update of Binding Configuration Data {} is translated to {}",entry,biEntry);
         }
         for (Entry<InstanceIdentifier<? extends DataObject>, DataObject> entry : source.getUpdatedOperationalData()
                 .entrySet()) {
             Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> biEntry = mappingService
                     .toDataDom(entry);
             target.putOperationalData(biEntry.getKey(), biEntry.getValue());
+            LOG.debug("Update of Binding Operational Data {} is translated to {}",entry,biEntry);
         }
         for (InstanceIdentifier<? extends DataObject> entry : source.getRemovedConfigurationData()) {
             org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biEntry = mappingService.toDataDom(entry);
             target.removeConfigurationData(biEntry);
+            LOG.debug("Delete of Binding Configuration Data {} is translated to {}",entry,biEntry);
         }
         for (InstanceIdentifier<? extends DataObject> entry : source.getRemovedOperationalData()) {
             org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biEntry = mappingService.toDataDom(entry);
             target.removeOperationalData(biEntry);
+            LOG.debug("Delete of Binding Operational Data {} is translated to {}",entry,biEntry);
         }
         return target;
     }
@@ -299,6 +305,7 @@ public class BindingIndependentConnector implements //
             if (baRpcRegistry instanceof RpcProviderRegistryImpl) {
                 baRpcRegistryImpl = (RpcProviderRegistryImpl) baRpcRegistry;
                 baRpcRegistryImpl.registerRouterInstantiationListener(domToBindingRpcManager.getInstance());
+                baRpcRegistryImpl.registerGlobalRpcRegistrationListener(domToBindingRpcManager.getInstance());
             }
             if(biRpcRegistry instanceof org.opendaylight.controller.sal.dom.broker.spi.RpcRouter) {
                 biRouter = (org.opendaylight.controller.sal.dom.broker.spi.RpcRouter) biRpcRegistry;
@@ -444,7 +451,7 @@ public class BindingIndependentConnector implements //
             }
             DataModificationTransaction domTransaction = createBindingToDomTransaction(bindingTransaction);
             BindingToDomTransaction wrapped = new BindingToDomTransaction(domTransaction, bindingTransaction);
-            LOG.info("Forwarding Binding Transaction: {} as DOM Transaction: {} .", bindingTransaction.getIdentifier(),
+            LOG.trace("Forwarding Binding Transaction: {} as DOM Transaction: {} .", bindingTransaction.getIdentifier(),
                     domTransaction.getIdentifier());
             return wrapped;
         }
@@ -484,7 +491,7 @@ public class BindingIndependentConnector implements //
 
             org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction baTransaction = createDomToBindingTransaction(domTransaction);
             DomToBindingTransaction forwardedTransaction = new DomToBindingTransaction(baTransaction, domTransaction);
-            LOG.info("Forwarding DOM Transaction: {} as Binding Transaction: {}.", domTransaction.getIdentifier(),
+            LOG.trace("Forwarding DOM Transaction: {} as Binding Transaction: {}.", domTransaction.getIdentifier(),
                     baTransaction.getIdentifier());
             return forwardedTransaction;
         }
@@ -497,7 +504,8 @@ public class BindingIndependentConnector implements //
      */
     private class DomToBindingRpcForwardingManager implements
             RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>,
-            RouterInstantiationListener {
+            RouterInstantiationListener,
+            GlobalRpcRegistrationListener {
 
         private final Map<Class<? extends RpcService>, DomToBindingRpcForwarder> forwarders = new WeakHashMap<>();
         private RpcProviderRegistryImpl registryImpl;
@@ -510,6 +518,15 @@ public class BindingIndependentConnector implements //
             this.registryImpl = registryImpl;
         }
         
+        @Override
+        public void onGlobalRpcRegistered(Class<? extends RpcService> cls) {
+            getRpcForwarder(cls, null);
+        }
+        
+        @Override
+        public void onGlobalRpcUnregistered(Class<? extends RpcService> cls) {
+            // NOOP
+        }
         
         @Override
         public void onRpcRouterCreated(RpcRouter<?> router) {
index f90465f925a28bdeacf153fa9aeb0940ded58411..d86547ab99087bba598c3b19c5cab628dfc6263f 100644 (file)
@@ -85,7 +85,7 @@ DataProvisionService<P, D> {
     override final registerCommitHandler(P path, DataCommitHandler<P, D> commitHandler) {\r
         val registration = new DataCommitHandlerRegistrationImpl(path, commitHandler, this);\r
         commitHandlers.put(path, registration)\r
-        LOG.info("Registering Commit Handler {} for path: {}",commitHandler,path);\r
+        LOG.trace("Registering Commit Handler {} for path: {}",commitHandler,path);\r
         for(listener : commitHandlerRegistrationListeners) {\r
             try {\r
                 listener.instance.onRegister(registration);\r
@@ -132,7 +132,7 @@ DataProvisionService<P, D> {
     protected final def removeCommitHandler(DataCommitHandlerRegistrationImpl<P, D> registration) {\r
         commitHandlers.remove(registration.path, registration);\r
         \r
-         LOG.info("Removing Commit Handler {} for path: {}",registration.instance,registration.path);\r
+         LOG.trace("Removing Commit Handler {} for path: {}",registration.instance,registration.path);\r
         for(listener : commitHandlerRegistrationListeners) {\r
             try {\r
                 listener.instance.onUnregister(registration);\r
@@ -264,7 +264,7 @@ package class TwoPhaseCommit<P extends Path<P>, D, DCL extends DataChangeListene
 \r
         val transactionId = transaction.identifier;\r
 \r
-        log.info("Transaction: {} Started.",transactionId);\r
+        log.trace("Transaction: {} Started.",transactionId);\r
         // requesting commits\r
         val Iterable<DataCommitHandler<P, D>> commitHandlers = dataBroker.affectedCommitHandlers(affectedPaths);\r
         val List<DataCommitTransaction<P, D>> handlerTransactions = new ArrayList();\r
@@ -288,7 +288,7 @@ package class TwoPhaseCommit<P extends Path<P>, D, DCL extends DataChangeListene
             dataBroker.failedTransactionsCount.andIncrement\r
             return rollback(handlerTransactions, e);\r
         }\r
-        log.info("Transaction: {} Finished successfully.",transactionId);\r
+        log.trace("Transaction: {} Finished successfully.",transactionId);\r
         dataBroker.finishedTransactionsCount.andIncrement;\r
         return Rpcs.getRpcResult(true, TransactionStatus.COMMITED, Collections.emptySet());\r
 \r
index 6b597dea9e5c1bc691acd78e2737db391c842f07..d61d709600b0761c2f2659e683574c98fed55a3d 100644 (file)
@@ -51,7 +51,6 @@ public final class SchemaServiceImplSingletonModule extends org.opendaylight.con
     public java.lang.AutoCloseable createInstance() {
         SchemaServiceImpl newInstance = new SchemaServiceImpl();
         newInstance.setContext(getBundleContext());
-        newInstance.setParser(new YangParserImpl());
         newInstance.start();
         return newInstance;
     }
index 3baae04019954d3ec7a9469d395b8b2a105aec0e..b5737a5454e2f12ec230233055e23cccac5675e5 100644 (file)
@@ -1,73 +1,75 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.controller.sal.dom.broker
 
-import org.osgi.framework.ServiceRegistration
-import org.opendaylight.controller.sal.core.api.model.SchemaService
+import java.util.Hashtable
 import org.opendaylight.controller.sal.core.api.data.DataBrokerService
 import org.opendaylight.controller.sal.core.api.data.DataProviderService
-import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore
+import org.opendaylight.controller.sal.core.api.data.DataStore
+import org.opendaylight.controller.sal.core.api.model.SchemaService
+import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService
 import org.opendaylight.controller.sal.core.api.mount.MountService
-import org.osgi.framework.BundleContext
-import java.util.Hashtable
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
-import org.opendaylight.controller.sal.core.api.data.DataStore
 import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter
-import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener
 import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+import org.osgi.framework.BundleContext
+import org.osgi.framework.ServiceRegistration
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProviders
 
 class BrokerConfigActivator implements AutoCloseable {
-    
-    
+
     private static val ROOT = InstanceIdentifier.builder().toInstance();
 
     @Property
     private var DataBrokerImpl dataService;
-    
+
     private var ServiceRegistration<SchemaService> schemaReg;
     private var ServiceRegistration<DataBrokerService> dataReg;
     private var ServiceRegistration<DataProviderService> dataProviderReg;
     private var ServiceRegistration<MountService> mountReg;
     private var ServiceRegistration<MountProvisionService> mountProviderReg;
-    private var SchemaServiceImpl schemaService;
+    private var SchemaService schemaService;
     private var MountPointManagerImpl mountService;
-    
+
     SchemaAwareDataStoreAdapter wrappedStore
 
-    public def void start(BrokerImpl broker,DataStore store,BundleContext context) {
+    public def void start(BrokerImpl broker, DataStore store, BundleContext context) {
         val emptyProperties = new Hashtable<String, String>();
         broker.setBundleContext(context);
-        
-        
-        schemaService = new SchemaServiceImpl();
-        schemaService.setContext(context);
-        schemaService.setParser(new YangParserImpl());
-        schemaService.start();
+
+        val serviceRef = context.getServiceReference(SchemaService);
+        schemaService = context.getService(serviceRef);
         schemaReg = context.registerService(SchemaService, schemaService, emptyProperties);
-        
-        broker.setRouter(new SchemaAwareRpcBroker("/",schemaService));
-        
+
+        broker.setRouter(new SchemaAwareRpcBroker("/", SchemaContextProviders.fromSchemaService(schemaService)));
+
         dataService = new DataBrokerImpl();
         dataService.setExecutor(broker.getExecutor());
-        
+
         dataReg = context.registerService(DataBrokerService, dataService, emptyProperties);
         dataProviderReg = context.registerService(DataProviderService, dataService, emptyProperties);
 
         wrappedStore = new SchemaAwareDataStoreAdapter();
         wrappedStore.changeDelegate(store);
         wrappedStore.setValidationEnabled(false);
-       
-        context.registerService(SchemaServiceListener,wrappedStore,emptyProperties)  
-        
+
+        context.registerService(SchemaServiceListener, wrappedStore, emptyProperties)
+
         dataService.registerConfigurationReader(ROOT, wrappedStore);
         dataService.registerCommitHandler(ROOT, wrappedStore);
         dataService.registerOperationalReader(ROOT, wrappedStore);
-        
+
         mountService = new MountPointManagerImpl();
         mountService.setDataBroker(dataService);
-        
+
         mountReg = context.registerService(MountService, mountService, emptyProperties);
-        mountProviderReg =  context.registerService(MountProvisionService, mountService, emptyProperties);
+        mountProviderReg = context.registerService(MountProvisionService, mountService, emptyProperties);
     }
 
     override def close() {
@@ -77,5 +79,5 @@ class BrokerConfigActivator implements AutoCloseable {
         mountReg?.unregister();
         mountProviderReg?.unregister();
     }
-    
-}
\ No newline at end of file
+
+}
index 4c84440c7ebb3e496472d523274efaabbd50d745..aa5138a04db226d777c70dbd8ece6d3df5b77736 100644 (file)
@@ -57,7 +57,7 @@ public class BrokerImpl implements Broker, RpcProvisionRegistry, AutoCloseable {
 
     override registerConsumer(Consumer consumer, BundleContext ctx) {
         checkPredicates(consumer);
-        log.info("Registering consumer " + consumer);
+        log.trace("Registering consumer " + consumer);
         val session = newSessionFor(consumer, ctx);
         consumer.onSessionInitiated(session);
         sessions.add(session);
index 8c272e5a4c8a957b64bcf2d6b139d7e10c8ed8c3..403f7c8da0e99cdcc0c21aa841849701bc478edf 100644 (file)
@@ -83,7 +83,7 @@ public class NotificationModule implements BrokerModule {
     private void sendNotification(CompositeNode notification) {
         QName type = notification.getNodeType();
         Collection<NotificationListener> toNotify = listeners.get(type);
-        log.info("Publishing notification " + type);
+        log.trace("Publishing notification " + type);
 
         if (toNotify == null) {
             // No listeners were registered - returns.
@@ -118,7 +118,7 @@ public class NotificationModule implements BrokerModule {
                 .create();
         private boolean closed = false;
 
-    
+
         public Registration<NotificationListener> addNotificationListener(QName notification,
                 NotificationListener listener) {
             checkSessionState();
@@ -132,7 +132,7 @@ public class NotificationModule implements BrokerModule {
 
             consumerListeners.put(notification, listener);
             listeners.put(notification, listener);
-            log.info("Registered listener for notification: " + notification);
+            log.trace("Registered listener for notification: " + notification);
             return null; // Return registration Object.
         }
 
index 8afa1eeb5f0e475cfe65fb43936967a6f35bb0f3..428521b72f28bfbb719a3bd0fe4f214e5766b46f 100644 (file)
@@ -1,45 +1,40 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.controller.sal.dom.broker;
 
-import java.io.IOException;
-import java.io.InputStream;
+import static com.google.common.base.Preconditions.checkState;
+
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Enumeration;
-import java.util.List;
-import java.util.Set;
-import java.util.zip.Checksum;
 
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.osgi.util.tracker.BundleTracker;
-import org.osgi.util.tracker.BundleTrackerCustomizer;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
 import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.parser.api.YangModelParser;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.impl.util.URLSchemaContextResolver;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.ServiceReference;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.controller.sal.core.api.model.SchemaServiceListener;
-import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider;
+import org.osgi.util.tracker.BundleTracker;
+import org.osgi.util.tracker.BundleTrackerCustomizer;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Function;
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
-
-import static com.google.common.base.Preconditions.*;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
 
 public class SchemaServiceImpl implements //
         SchemaContextProvider, //
@@ -49,22 +44,18 @@ public class SchemaServiceImpl implements //
     private static final Logger logger = LoggerFactory.getLogger(SchemaServiceImpl.class);
 
     private ListenerRegistry<SchemaServiceListener> listeners;
-    private YangModelParser parser;
-
+    
     private BundleContext context;
     private BundleScanner scanner = new BundleScanner();
 
-    /**
-     * Map of currently problematic yang files that should get fixed eventually
-     * after all events are received.
-     */
-    private final Multimap<Bundle, URL> inconsistentBundlesToYangURLs = HashMultimap.create();
-    private final Multimap<Bundle, URL> consistentBundlesToYangURLs = HashMultimap.create();
-    private BundleTracker<Object> bundleTracker;
-    private final YangStoreCache cache = new YangStoreCache();
+    private BundleTracker<ImmutableSet<Registration<URL>>> bundleTracker;
+
+    private final URLSchemaContextResolver contextResolver = new URLSchemaContextResolver();
 
     private ServiceTracker<SchemaServiceListener, SchemaServiceListener> listenerTracker;
 
+    private boolean starting = true;
+
     public ListenerRegistry<SchemaServiceListener> getListeners() {
         return listeners;
     }
@@ -73,14 +64,6 @@ public class SchemaServiceImpl implements //
         this.listeners = listeners;
     }
 
-    public YangModelParser getParser() {
-        return parser;
-    }
-
-    public void setParser(YangModelParser parser) {
-        this.parser = parser;
-    }
-
     public BundleContext getContext() {
         return context;
     }
@@ -90,53 +73,41 @@ public class SchemaServiceImpl implements //
     }
 
     public void start() {
-        checkState(parser != null);
         checkState(context != null);
         if (listeners == null) {
             listeners = new ListenerRegistry<>();
         }
 
-        listenerTracker = new ServiceTracker<>(context, SchemaServiceListener.class, this);
-        bundleTracker = new BundleTracker<Object>(context, BundleEvent.RESOLVED | BundleEvent.UNRESOLVED, scanner);
+        listenerTracker = new ServiceTracker<>(context, SchemaServiceListener.class, SchemaServiceImpl.this);
+        bundleTracker = new BundleTracker<ImmutableSet<Registration<URL>>>(context, BundleEvent.RESOLVED
+                        | BundleEvent.UNRESOLVED, scanner);
         bundleTracker.open();
         listenerTracker.open();
+        starting = false;
+        tryToUpdateSchemaContext();
     }
 
-    
     @Override
     public SchemaContext getSchemaContext() {
         return getGlobalContext();
     }
-    
-    public SchemaContext getGlobalContext() {
-        return getSchemaContextSnapshot();
-    }
 
-    public synchronized SchemaContext getSchemaContextSnapshot() {
-        Optional<SchemaContext> yangStoreOpt = cache.getCachedSchemaContext(consistentBundlesToYangURLs);
-        if (yangStoreOpt.isPresent()) {
-            return yangStoreOpt.get();
-        }
-        SchemaContext snapshot = createSnapshot(parser, consistentBundlesToYangURLs);
-        updateCache(snapshot);
-        return snapshot;
+    public SchemaContext getGlobalContext() {
+        return contextResolver.getSchemaContext().orNull();
     }
 
     @Override
     public void addModule(Module module) {
-        // TODO Auto-generated method stub
         throw new UnsupportedOperationException();
     }
 
     @Override
     public SchemaContext getSessionContext() {
-        // TODO Auto-generated method stub
         throw new UnsupportedOperationException();
     }
 
     @Override
     public void removeModule(Module module) {
-        // TODO Auto-generated method stub
         throw new UnsupportedOperationException();
     }
 
@@ -147,63 +118,17 @@ public class SchemaServiceImpl implements //
 
     @Override
     public void close() throws Exception {
-        bundleTracker.close();
-        // FIXME: Add listeners.close();
-
-    }
-
-    private synchronized boolean tryToUpdateState(Collection<URL> changedURLs, Multimap<Bundle, URL> proposedNewState,
-            boolean adding) {
-        Preconditions.checkArgument(!changedURLs.isEmpty(), "No change can occur when no URLs are changed");
-
-        try {
-            // consistent state
-            // merge into
-            SchemaContext snapshot = createSnapshot(parser, proposedNewState);
-            consistentBundlesToYangURLs.clear();
-            consistentBundlesToYangURLs.putAll(proposedNewState);
-            inconsistentBundlesToYangURLs.clear();
-            // update cache
-            updateCache(snapshot);
-            logger.info("SchemaService updated to new consistent state");
-            logger.trace("SchemaService  updated to new consistent state containing {}", consistentBundlesToYangURLs);
-
-            // notifyListeners(changedURLs, adding);
-            return true;
-        } catch (Exception e) {
-            // inconsistent state
-            logger.debug(
-                    "SchemaService is falling back on last consistent state containing {}, inconsistent yang files {}",
-                    consistentBundlesToYangURLs, inconsistentBundlesToYangURLs, e);
-            return false;
+        if (bundleTracker != null) {
+            bundleTracker.close();
         }
+        if (listenerTracker != null) {
+            listenerTracker.close();
+        }
+        // FIXME: Add listeners.close();
     }
 
-    private static Collection<InputStream> fromUrlsToInputStreams(Multimap<Bundle, URL> multimap) {
-        return Collections2.transform(multimap.values(), new Function<URL, InputStream>() {
-
-            @Override
-            public InputStream apply(URL url) {
-                try {
-                    return url.openStream();
-                } catch (IOException e) {
-                    logger.warn("Unable to open stream from {}", url);
-                    throw new IllegalStateException("Unable to open stream from " + url, e);
-                }
-            }
-        });
-    }
-
-    private static SchemaContext createSnapshot(YangModelParser parser, Multimap<Bundle, URL> multimap) {
-        List<InputStream> models = new ArrayList<>(fromUrlsToInputStreams(multimap));
-        Set<Module> modules = parser.parseYangModelsFromStreams(models);
-        SchemaContext yangStoreSnapshot = parser.resolveSchemaContext(modules);
-        return yangStoreSnapshot;
-    }
-
-    private void updateCache(SchemaContext snapshot) {
-        cache.cacheYangStore(consistentBundlesToYangURLs, snapshot);
 
+    private void updateContext(SchemaContext snapshot) {
         Object[] services = listenerTracker.getServices();
         if (services != null) {
             for (Object rawListener : services) {
@@ -224,44 +149,30 @@ public class SchemaServiceImpl implements //
         }
     }
 
-    private class BundleScanner implements BundleTrackerCustomizer<Object> {
+    private class BundleScanner implements BundleTrackerCustomizer<ImmutableSet<Registration<URL>>> {
         @Override
-        public Object addingBundle(Bundle bundle, BundleEvent event) {
+        public ImmutableSet<Registration<URL>> addingBundle(Bundle bundle, BundleEvent event) {
 
-            // Ignore system bundle:
-            // system bundle might have config-api on classpath &&
-            // config-api contains yang files =>
-            // system bundle might contain yang files from that bundle
             if (bundle.getBundleId() == 0) {
-                return bundle;
+                return ImmutableSet.of();
             }
 
             Enumeration<URL> enumeration = bundle.findEntries("META-INF/yang", "*.yang", false);
-            if (enumeration != null && enumeration.hasMoreElements()) {
-                synchronized (this) {
-                    List<URL> addedURLs = new ArrayList<>();
-                    while (enumeration.hasMoreElements()) {
-                        URL url = enumeration.nextElement();
-                        addedURLs.add(url);
-                    }
-                    logger.trace("Bundle {} has event {}, bundle state {}, URLs {}", bundle, event, bundle.getState(),
-                            addedURLs);
-                    // test that yang store is consistent
-                    Multimap<Bundle, URL> proposedNewState = HashMultimap.create(consistentBundlesToYangURLs);
-                    proposedNewState.putAll(inconsistentBundlesToYangURLs);
-                    proposedNewState.putAll(bundle, addedURLs);
-                    boolean adding = true;
-
-                    if (tryToUpdateState(addedURLs, proposedNewState, adding) == false) {
-                        inconsistentBundlesToYangURLs.putAll(bundle, addedURLs);
-                    }
-                }
+            Builder<Registration<URL>> builder = ImmutableSet.<Registration<URL>> builder();
+            while (enumeration != null && enumeration.hasMoreElements()) {
+                Registration<URL> reg = contextResolver.registerSource(enumeration.nextElement());
+                builder.add(reg);
+            }
+            ImmutableSet<Registration<URL>> urls = builder.build();
+            if(urls.isEmpty()) {
+                return urls;
             }
-            return bundle;
+            tryToUpdateSchemaContext();
+            return urls;
         }
 
         @Override
-        public void modifiedBundle(Bundle bundle, BundleEvent event, Object object) {
+        public void modifiedBundle(Bundle bundle, BundleEvent event, ImmutableSet<Registration<URL>> object) {
             logger.debug("Modified bundle {} {} {}", bundle, event, object);
         }
 
@@ -272,41 +183,15 @@ public class SchemaServiceImpl implements //
          */
 
         @Override
-        public synchronized void removedBundle(Bundle bundle, BundleEvent event, Object object) {
-            inconsistentBundlesToYangURLs.removeAll(bundle);
-            Collection<URL> consistentURLsToBeRemoved = consistentBundlesToYangURLs.removeAll(bundle);
-
-            if (consistentURLsToBeRemoved.isEmpty()) {
-                return; // no change
-            }
-            boolean adding = false;
-            // notifyListeners(consistentURLsToBeRemoved, adding);
-        }
-    }
-
-    private static final class YangStoreCache {
-
-        Set<URL> cachedUrls;
-        SchemaContext cachedContextSnapshot;
-
-        Optional<SchemaContext> getCachedSchemaContext(Multimap<Bundle, URL> bundlesToYangURLs) {
-            Set<URL> urls = setFromMultimapValues(bundlesToYangURLs);
-            if (cachedUrls != null && cachedUrls.equals(urls)) {
-                Preconditions.checkState(cachedContextSnapshot != null);
-                return Optional.of(cachedContextSnapshot);
+        public synchronized void removedBundle(Bundle bundle, BundleEvent event, ImmutableSet<Registration<URL>> urls) {
+            for (Registration<URL> url : urls) {
+                try {
+                    url.close();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
             }
-            return Optional.absent();
-        }
-
-        private static Set<URL> setFromMultimapValues(Multimap<Bundle, URL> bundlesToYangURLs) {
-            Set<URL> urls = Sets.newHashSet(bundlesToYangURLs.values());
-            Preconditions.checkState(bundlesToYangURLs.size() == urls.size());
-            return urls;
-        }
-
-        void cacheYangStore(Multimap<Bundle, URL> urls, SchemaContext ctx) {
-            this.cachedUrls = setFromMultimapValues(urls);
-            this.cachedContextSnapshot = ctx;
+            tryToUpdateSchemaContext();
         }
     }
 
@@ -321,6 +206,16 @@ public class SchemaServiceImpl implements //
         return listener;
     }
 
+    public synchronized void tryToUpdateSchemaContext() {
+        if(starting ) {
+            return;
+        }
+        Optional<SchemaContext> schema = contextResolver.tryToUpdateSchemaContext();
+        if(schema.isPresent()) {
+            updateContext(schema.get());
+        }
+    }
+
     @Override
     public void modifiedService(ServiceReference<SchemaServiceListener> reference, SchemaServiceListener service) {
         // NOOP
index 6d7b600dbcb3a4b68377cdec27a3314e24df6812..6242dee038661da6d4d79685bc6e0a35b7c720da 100644 (file)
@@ -43,7 +43,7 @@ public class NotificationRouterImpl implements NotificationRouter {
     private void sendNotification(CompositeNode notification) {
         QName type = notification.getNodeType();
         Collection<Registration<NotificationListener>> toNotify = listeners.get(type);
-        log.info("Publishing notification " + type);
+        log.trace("Publishing notification " + type);
 
         if (toNotify == null) {
             // No listeners were registered - returns.
index 75e96491b68c2bf5ffd93b08412002f846b94b89..8dc65e2ced109f6052879d4e842049ae45af7fa2 100644 (file)
@@ -131,7 +131,7 @@ public class SchemaAwareDataStoreAdapter extends AbstractLockableDelegator<DataS
         }
 
         if (schema == null) {
-            LOG.info("Validation not performed for {}. Reason: YANG Schema not present.", modification.getIdentifier());
+            LOG.warn("Validation not performed for {}. Reason: YANG Schema not present.", modification.getIdentifier());
             return;
         }
     }
index 3cf9a5dabc6dd7ed6ea3e166cceaed098eed7b8c..fc8ccd674614a355de65c54a3149b9ac56207067 100644 (file)
@@ -1,11 +1,16 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.controller.sal.dom.broker.impl;
 
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-import com.google.common.base.Optional;
-
 public interface SchemaContextProvider {
 
     SchemaContext getSchemaContext();
-    
+
 }
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaContextProviders.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaContextProviders.java
new file mode 100644 (file)
index 0000000..df985cb
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.sal.dom.broker.impl;
+
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.yangtools.concepts.Delegator;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public class SchemaContextProviders {
+
+    public static final SchemaContextProvider fromSchemaService(SchemaService schemaService) {
+        if (schemaService instanceof SchemaContextProvider) {
+            return (SchemaContextProvider) schemaService;
+        }
+        return new SchemaServiceAdapter(schemaService);
+    }
+
+    private final static class SchemaServiceAdapter implements SchemaContextProvider, Delegator<SchemaService> {
+
+        private final SchemaService service;
+
+        public SchemaServiceAdapter(SchemaService service) {
+            super();
+            this.service = service;
+        }
+
+        @Override
+        public SchemaContext getSchemaContext() {
+            return service.getGlobalContext();
+        }
+
+        @Override
+        public SchemaService getDelegate() {
+            return service;
+        }
+
+        @Override
+        public String toString() {
+            return "SchemaServiceAdapter [service=" + service + "]";
+        }
+    }
+}
index 12be689cb94fdd94f9df329d9cf7162ca250625c..79264abe6cda3cc1dff1536520cbcae50ca72e51 100644 (file)
@@ -38,16 +38,16 @@ class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider<String>
             request.addLeaf("version", revision.get());
         }
 
-        device.logger.info("Loading YANG schema source for {}:{}", moduleName, revision);
+        device.logger.trace("Loading YANG schema source for {}:{}", moduleName, revision);
         RpcResult<CompositeNode> schemaReply = device.invokeRpc(GET_SCHEMA_QNAME, request.toInstance());
         if (schemaReply.isSuccessful()) {
             String schemaBody = getSchemaFromRpc(schemaReply.getResult());
             if (schemaBody != null) {
-                device.logger.info("YANG Schema successfully retrieved from remote for {}:{}", moduleName, revision);
+                device.logger.trace("YANG Schema successfully retrieved from remote for {}:{}", moduleName, revision);
                 return Optional.of(schemaBody);
             }
         }
-        device.logger.info("YANG shcema was not successfully retrieved.");
+        device.logger.warn("YANG shcema was not successfully retrieved.");
         return Optional.absent();
     }
 
@@ -62,7 +62,7 @@ class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider<String>
         }
         return null;
     }
-    
+
     public static final boolean isSupportedFor(Set<QName> capabilities) {
         return capabilities.contains(IETF_NETCONF_MONITORING);
     }
index d748d69c83f2bc5532e7385a0d16baff3509bc54..96eda6eb3708d13c119bb0c057f6ea72c6b59163 100644 (file)
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>yang-ext</artifactId>
-            <version>2013.09.07.1</version>
+            <version>2013.09.07.2-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27.1</version>
+            <version>2013.08.27.2-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
index 9c0c3ac14c9eabb9757ac526b505822e573a0824..6e05d3f24a5c46e7e479e8bada1e00d5b4c3c1f1 100644 (file)
@@ -42,25 +42,25 @@ class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
 
     override readConfigurationData(InstanceIdentifier path) {
         checkPreconditions
-        LOG.info("Read Configuration via Restconf: {}", path)
+        LOG.trace("Read Configuration via Restconf: {}", path)
         return dataService.readConfigurationData(path);
     }
     
     def readConfigurationDataBehindMountPoint(MountInstance mountPoint, InstanceIdentifier path) {
         checkPreconditions
-        LOG.info("Read Configuration via Restconf: {}", path)
+        LOG.trace("Read Configuration via Restconf: {}", path)
         return mountPoint.readConfigurationData(path);
     }
 
     override readOperationalData(InstanceIdentifier path) {
         checkPreconditions
-        LOG.info("Read Operational via Restconf: {}", path)
+        LOG.trace("Read Operational via Restconf: {}", path)
         return dataService.readOperationalData(path);
     }
     
     def readOperationalDataBehindMountPoint(MountInstance mountPoint, InstanceIdentifier path) {
         checkPreconditions
-        LOG.info("Read Operational via Restconf: {}", path)
+        LOG.trace("Read Operational via Restconf: {}", path)
         return mountPoint.readOperationalData(path);
     }
 
@@ -73,7 +73,7 @@ class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
     def commitConfigurationDataPut(InstanceIdentifier path, CompositeNode payload) {
         checkPreconditions
         val transaction = dataService.beginTransaction;
-        LOG.info("Put Configuration via Restconf: {}", path)
+        LOG.trace("Put Configuration via Restconf: {}", path)
         transaction.putConfigurationData(path, payload);
         return transaction.commit
     }
@@ -81,7 +81,7 @@ class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
     def commitConfigurationDataPutBehindMountPoint(MountInstance mountPoint, InstanceIdentifier path, CompositeNode payload) {
         checkPreconditions
         val transaction = mountPoint.beginTransaction;
-        LOG.info("Put Configuration via Restconf: {}", path)
+        LOG.trace("Put Configuration via Restconf: {}", path)
         transaction.putConfigurationData(path, payload);
         return transaction.commit
     }
@@ -91,10 +91,10 @@ class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
         val transaction = dataService.beginTransaction;
         transaction.putConfigurationData(path, payload);
         if (payload == transaction.createdConfigurationData.get(path)) {
-            LOG.info("Post Configuration via Restconf: {}", path)
+            LOG.trace("Post Configuration via Restconf: {}", path)
             return transaction.commit
         }
-        LOG.info("Post Configuration via Restconf was not executed because data already exists: {}", path)
+        LOG.trace("Post Configuration via Restconf was not executed because data already exists: {}", path)
         return null;
     }
     
@@ -103,10 +103,10 @@ class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
         val transaction = mountPoint.beginTransaction;
         transaction.putConfigurationData(path, payload);
         if (payload == transaction.createdConfigurationData.get(path)) {
-            LOG.info("Post Configuration via Restconf: {}", path)
+            LOG.trace("Post Configuration via Restconf: {}", path)
             return transaction.commit
         }
-        LOG.info("Post Configuration via Restconf was not executed because data already exists: {}", path)
+        LOG.trace("Post Configuration via Restconf was not executed because data already exists: {}", path)
         return null;
     }
 
index 91146f3c2e9b74297293a5757815cb5783cf1308..fde60d64ceb148b01daa037c4d037c7182dafd41 100644 (file)
@@ -49,18 +49,18 @@ public class ToastConsumerImpl extends AbstractBindingAwareConsumer implements B
             RpcResult<Void> result = getToastService().makeToast(toastInput.build()).get();
 
             if (result.isSuccessful()) {
-                log.info("Toast was successfuly finished");
+                log.trace("Toast was successfuly finished");
             } else {
-                log.info("Toast was not successfuly finished");
+                log.warn("Toast was not successfuly finished");
             }
             return result.isSuccessful();
         } catch (InterruptedException | ExecutionException e) {
-            log.info("Error occured during toast creation");
+            log.warn("Error occured during toast creation");
         }
         return false;
 
     }
-    
+
     @Override
     @Deprecated
     protected void startImpl(BundleContext context) {
@@ -76,7 +76,7 @@ public class ToastConsumerImpl extends AbstractBindingAwareConsumer implements B
 
     @Override
     public void onNotification(ToastDone notification) {
-        log.info("ToastDone Notification Received: {} ",notification.getToastStatus());
+        log.trace("ToastDone Notification Received: {} ",notification.getToastStatus());
 
     }
 
index f54213e28744d62a33ba9325db2d462a23d5fd46..ce541bae203727f0cdf208bd79f4a0c9e295a2d2 100644 (file)
@@ -64,7 +64,7 @@ public class OpendaylightToaster implements ToasterData, ToasterService {
     @Override
     public Future<RpcResult<Void>> makeToast(MakeToastInput input) {
         // TODO Auto-generated method stub
-        log.info("makeToast - Received input for toast");
+        log.trace("makeToast - Received input for toast");
         logToastInput(input);
         if (currentTask != null) {
             return inProgressError();
@@ -92,7 +92,7 @@ public class OpendaylightToaster implements ToasterData, ToasterService {
     private void logToastInput(MakeToastInput input) {
         String toastType = input.getToasterToastType().getName();
         String toastDoneness = input.getToasterDoneness().toString();
-        log.info("Toast: {} doneness: {}", toastType, toastDoneness);
+        log.trace("Toast: {} doneness: {}", toastType, toastDoneness);
     }
 
     private class MakeToastTask implements Callable<RpcResult<Void>> {
@@ -110,7 +110,7 @@ public class OpendaylightToaster implements ToasterData, ToasterService {
             ToastDoneBuilder notifyBuilder = new ToastDoneBuilder();
             notifyBuilder.setToastStatus(ToastStatus.Done);
             notificationProvider.notify(notifyBuilder.build());
-            log.info("Toast Done");
+            log.trace("Toast Done");
             logToastInput(toastRequest);
             currentTask = null;
             return Rpcs.<Void> getRpcResult(true, null, Collections.<RpcError> emptySet());
diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatistics.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatistics.java
deleted file mode 100644 (file)
index e84b437..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright IBM Corporation, 2013.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.statistics.manager;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.aggregate.flow.statistics.AggregateFlowStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.features.GroupFeatures;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.MeterFeatures;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.config.stats.reply.MeterConfigStats;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericQueueStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericTableStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.NodeConnectorStatistics;
-
-public class NodeStatistics {
-
-    private NodeRef targetNode;
-    
-    private List<GroupStats> groupStatistics;
-    
-    private List<MeterStats> meterStatistics;
-    
-    private List<GroupDescStats> groupDescStats;
-    
-    private List<MeterConfigStats> meterConfigStats;
-    
-    private GroupFeatures groupFeatures;
-    
-    private MeterFeatures meterFeatures;
-    
-    private final Map<Short,Map<Flow,GenericStatistics>> flowAndStatsMap= 
-            new HashMap<Short,Map<Flow,GenericStatistics>>();
-    
-    private final Map<Short,AggregateFlowStatistics> tableAndAggregateFlowStatsMap = 
-            new HashMap<Short,AggregateFlowStatistics>();
-    
-    private final Map<NodeConnectorId,NodeConnectorStatistics> nodeConnectorStats = 
-            new ConcurrentHashMap<NodeConnectorId,NodeConnectorStatistics>();
-    
-    private final Map<Short,GenericTableStatistics> flowTableAndStatisticsMap = 
-            new HashMap<Short,GenericTableStatistics>();
-    
-    private final Map<NodeConnectorId,Map<QueueId,GenericQueueStatistics>> NodeConnectorAndQueuesStatsMap = 
-            new HashMap<NodeConnectorId,Map<QueueId,GenericQueueStatistics>>();
-    
-    public NodeStatistics(){
-        
-    }
-
-    public NodeRef getTargetNode() {
-        return targetNode;
-    }
-
-    public void setTargetNode(NodeRef targetNode) {
-        this.targetNode = targetNode;
-    }
-
-    public List<GroupStats> getGroupStatistics() {
-        return groupStatistics;
-    }
-
-    public void setGroupStatistics(List<GroupStats> groupStatistics) {
-        this.groupStatistics = groupStatistics;
-    }
-
-    public List<MeterStats> getMeterStatistics() {
-        return meterStatistics;
-    }
-
-    public void setMeterStatistics(List<MeterStats> meterStatistics) {
-        this.meterStatistics = meterStatistics;
-    }
-
-    public List<GroupDescStats> getGroupDescStats() {
-        return groupDescStats;
-    }
-
-    public void setGroupDescStats(List<GroupDescStats> groupDescStats) {
-        this.groupDescStats = groupDescStats;
-    }
-
-    public List<MeterConfigStats> getMeterConfigStats() {
-        return meterConfigStats;
-    }
-
-    public void setMeterConfigStats(List<MeterConfigStats> meterConfigStats) {
-        this.meterConfigStats = meterConfigStats;
-    }
-
-    public GroupFeatures getGroupFeatures() {
-        return groupFeatures;
-    }
-
-    public void setGroupFeatures(GroupFeatures groupFeatures) {
-        this.groupFeatures = groupFeatures;
-    }
-
-    public MeterFeatures getMeterFeatures() {
-        return meterFeatures;
-    }
-
-    public void setMeterFeatures(MeterFeatures meterFeatures) {
-        this.meterFeatures = meterFeatures;
-    }
-
-    public Map<Short,Map<Flow,GenericStatistics>> getFlowAndStatsMap() {
-        return flowAndStatsMap;
-    }
-
-    public Map<Short, GenericTableStatistics> getFlowTableAndStatisticsMap() {
-        return flowTableAndStatisticsMap;
-    }
-
-    public Map<Short, AggregateFlowStatistics> getTableAndAggregateFlowStatsMap() {
-        return tableAndAggregateFlowStatsMap;
-    }
-    public Map<NodeConnectorId, NodeConnectorStatistics> getNodeConnectorStats() {
-        return nodeConnectorStats;
-    }
-
-    public Map<NodeConnectorId, Map<QueueId, GenericQueueStatistics>> getNodeConnectorAndQueuesStatsMap() {
-        return NodeConnectorAndQueuesStatsMap;
-    }
-}
diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatisticsAger.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatisticsAger.java
new file mode 100644 (file)
index 0000000..4ecd620
--- /dev/null
@@ -0,0 +1,346 @@
+/*
+ * Copyright IBM Corporation, 2013.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.statistics.manager;
+
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterConfigStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.config.stats.reply.MeterConfigStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.FlowCapableNodeConnectorQueueStatisticsData;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
+
+/**
+ * Main responsibility of this class to clean up all the stale statistics data
+ * associated to Flow,Meter,Group,Queue.
+ * @author avishnoi@in.ibm.com
+ *
+ */
+public class NodeStatisticsAger {
+    
+    private final int NUMBER_OF_WAIT_CYCLES =2;
+
+    private final StatisticsProvider statisticsProvider;
+
+    private final NodeKey targetNodeKey;
+    
+    private final Map<GroupDescStats,Date> groupDescStatsUpdate
+                = new ConcurrentHashMap<GroupDescStats,Date>();
+    
+    private final Map<MeterConfigStats,Date> meterConfigStatsUpdate
+                = new ConcurrentHashMap<MeterConfigStats,Date>();
+    
+    private final Map<FlowEntry,Date> flowStatsUpdate
+                = new ConcurrentHashMap<FlowEntry,Date>();
+    
+    private final Map<QueueEntry,Date> queuesStatsUpdate 
+                = new ConcurrentHashMap<QueueEntry,Date>();
+    
+    public NodeStatisticsAger(StatisticsProvider statisticsProvider, NodeKey nodeKey){
+        this.targetNodeKey = nodeKey;
+        this.statisticsProvider = statisticsProvider;
+    }
+
+    public class FlowEntry{
+        private final Short tableId;
+        private final Flow flow;
+        
+        public FlowEntry(Short tableId, Flow flow){
+            this.tableId = tableId;
+            this.flow = flow;
+        }
+
+        public Short getTableId() {
+            return tableId;
+        }
+
+        public Flow getFlow() {
+            return flow;
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + getOuterType().hashCode();
+            result = prime * result + ((flow == null) ? 0 : flow.hashCode());
+            result = prime * result + ((tableId == null) ? 0 : tableId.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (getClass() != obj.getClass())
+                return false;
+            FlowEntry other = (FlowEntry) obj;
+            if (!getOuterType().equals(other.getOuterType()))
+                return false;
+            if (flow == null) {
+                if (other.flow != null)
+                    return false;
+            } else if (!flow.equals(other.flow))
+                return false;
+            if (tableId == null) {
+                if (other.tableId != null)
+                    return false;
+            } else if (!tableId.equals(other.tableId))
+                return false;
+            return true;
+        }
+
+        private NodeStatisticsAger getOuterType() {
+            return NodeStatisticsAger.this;
+        }
+        
+    }
+    
+    public class QueueEntry{
+        private final NodeConnectorId nodeConnectorId;
+        private final QueueId queueId;
+        public QueueEntry(NodeConnectorId ncId, QueueId queueId){
+            this.nodeConnectorId = ncId;
+            this.queueId = queueId;
+        }
+        public NodeConnectorId getNodeConnectorId() {
+            return nodeConnectorId;
+        }
+        public QueueId getQueueId() {
+            return queueId;
+        }
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + getOuterType().hashCode();
+            result = prime * result + ((nodeConnectorId == null) ? 0 : nodeConnectorId.hashCode());
+            result = prime * result + ((queueId == null) ? 0 : queueId.hashCode());
+            return result;
+        }
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (!(obj instanceof QueueEntry)) {
+                return false;
+            }
+            QueueEntry other = (QueueEntry) obj;
+            if (!getOuterType().equals(other.getOuterType())) {
+                return false;
+            }
+            if (nodeConnectorId == null) {
+                if (other.nodeConnectorId != null) {
+                    return false;
+                }
+            } else if (!nodeConnectorId.equals(other.nodeConnectorId)) {
+                return false;
+            }
+            if (queueId == null) {
+                if (other.queueId != null) {
+                    return false;
+                }
+            } else if (!queueId.equals(other.queueId)) {
+                return false;
+            }
+            return true;
+        }
+        private NodeStatisticsAger getOuterType() {
+            return NodeStatisticsAger.this;
+        }
+    }
+    
+    public NodeKey getTargetNodeKey() {
+        return targetNodeKey;
+    }
+
+    public Map<GroupDescStats, Date> getGroupDescStatsUpdate() {
+        return groupDescStatsUpdate;
+    }
+
+    public Map<MeterConfigStats, Date> getMeterConfigStatsUpdate() {
+        return meterConfigStatsUpdate;
+    }
+
+    public Map<FlowEntry, Date> getFlowStatsUpdate() {
+        return flowStatsUpdate;
+    }
+
+    public Map<QueueEntry, Date> getQueuesStatsUpdate() {
+        return queuesStatsUpdate;
+    }
+
+    public void updateGroupDescStats(List<GroupDescStats> list){
+        Date expiryTime = getExpiryTime();
+        for(GroupDescStats groupDescStats : list)
+            this.groupDescStatsUpdate.put(groupDescStats, expiryTime);
+    }
+    
+    public void updateMeterConfigStats(List<MeterConfigStats> list){
+        Date expiryTime = getExpiryTime();
+        for(MeterConfigStats meterConfigStats: list)
+            this.meterConfigStatsUpdate.put(meterConfigStats, expiryTime);
+    }
+    
+    public void  updateFlowStats(FlowEntry flowEntry){
+        this.flowStatsUpdate.put(flowEntry, getExpiryTime());
+    }
+    public void updateQueueStats(QueueEntry queueEntry){
+        this.queuesStatsUpdate.put(queueEntry, getExpiryTime());
+    }
+    
+    private Date getExpiryTime(){
+        Date expires = new Date();
+        expires.setTime(expires.getTime()+StatisticsProvider.STATS_THREAD_EXECUTION_TIME*NUMBER_OF_WAIT_CYCLES);
+        return expires;
+    }
+    
+    public void cleanStaleStatistics(){
+        //Clean stale statistics related to group 
+        for (Iterator<GroupDescStats> it = this.groupDescStatsUpdate.keySet().iterator();it.hasNext();){
+            GroupDescStats groupDescStats = it.next();
+            Date now = new Date();
+            Date expiryTime = this.groupDescStatsUpdate.get(groupDescStats);
+            if(now.after(expiryTime)){
+                cleanGroupStatsFromDataStore(groupDescStats );
+                it.remove();
+            }
+        }
+        
+        //Clean stale statistics related to meter 
+        for (Iterator<MeterConfigStats> it = this.meterConfigStatsUpdate.keySet().iterator();it.hasNext();){
+            MeterConfigStats meterConfigStats = it.next();
+            Date now = new Date();
+            Date expiryTime = this.meterConfigStatsUpdate.get(meterConfigStats);
+            if(now.after(expiryTime)){
+                cleanMeterStatsFromDataStore(meterConfigStats);
+                it.remove();
+            }            
+        }
+        
+        //Clean stale statistics related to flow 
+        for (Iterator<FlowEntry> it = this.flowStatsUpdate.keySet().iterator();it.hasNext();){
+            FlowEntry flowEntry = it.next();
+            Date now = new Date();
+            Date expiryTime = this.flowStatsUpdate.get(flowEntry);
+            if(now.after(expiryTime)){
+                cleanFlowStatsFromDataStore(flowEntry);
+                it.remove();
+            }            
+        }
+
+        //Clean stale statistics related to queue
+        for (Iterator<QueueEntry> it = this.queuesStatsUpdate.keySet().iterator();it.hasNext();){
+            QueueEntry queueEntry = it.next();
+            Date now = new Date();
+            Date expiryTime = this.queuesStatsUpdate.get(queueEntry);
+            if(now.after(expiryTime)){
+                cleanQueueStatsFromDataStore(queueEntry);
+                it.remove();
+            }            
+        }
+        
+    }
+
+    private void cleanQueueStatsFromDataStore(QueueEntry queueEntry) {
+        InstanceIdentifier<?> queueRef 
+                        = InstanceIdentifier.builder(Nodes.class)
+                                            .child(Node.class, this.targetNodeKey)
+                                            .child(NodeConnector.class, new NodeConnectorKey(queueEntry.getNodeConnectorId()))
+                                            .augmentation(FlowCapableNodeConnector.class)
+                                            .child(Queue.class, new QueueKey(queueEntry.getQueueId()))
+                                            .augmentation(FlowCapableNodeConnectorQueueStatisticsData.class).toInstance();
+        cleanStaleStatisticsFromDataStore(queueRef);
+    }
+
+    private void cleanFlowStatsFromDataStore(FlowEntry flowEntry) {
+        InstanceIdentifier<?> flowRef 
+                        = InstanceIdentifier.builder(Nodes.class).child(Node.class, this.targetNodeKey)
+                                            .augmentation(FlowCapableNode.class)
+                                            .child(Table.class, new TableKey(flowEntry.getTableId()))
+                                            .child(Flow.class,flowEntry.getFlow().getKey())
+                                            .augmentation(FlowStatisticsData.class).toInstance();
+        
+        cleanStaleStatisticsFromDataStore(flowRef);
+        
+    }
+
+    private void cleanMeterStatsFromDataStore(MeterConfigStats meterConfigStats) {
+        InstanceIdentifierBuilder<Meter> meterRef 
+                        = InstanceIdentifier.builder(Nodes.class).child(Node.class,this.targetNodeKey)
+                                            .augmentation(FlowCapableNode.class)
+                                            .child(Meter.class,new MeterKey(meterConfigStats.getMeterId()));
+        
+        InstanceIdentifier<?> nodeMeterConfigStatsAugmentation = meterRef.augmentation(NodeMeterConfigStats.class).toInstance();
+                                            
+        cleanStaleStatisticsFromDataStore(nodeMeterConfigStatsAugmentation);
+        
+        InstanceIdentifier<?> nodeMeterStatisticsAugmentation = meterRef.augmentation(NodeMeterStatistics.class).toInstance();
+        
+        cleanStaleStatisticsFromDataStore(nodeMeterStatisticsAugmentation);
+        
+    }
+
+    private void cleanGroupStatsFromDataStore(GroupDescStats groupDescStats) {
+        InstanceIdentifierBuilder<Group> groupRef 
+                        = InstanceIdentifier.builder(Nodes.class).child(Node.class,this.targetNodeKey)
+                                            .augmentation(FlowCapableNode.class)
+                                            .child(Group.class,new GroupKey(groupDescStats.getGroupId()));
+        
+        InstanceIdentifier<?> nodeGroupDescStatsAugmentation = groupRef.augmentation(NodeGroupDescStats.class).toInstance();
+        
+        cleanStaleStatisticsFromDataStore(nodeGroupDescStatsAugmentation);
+
+        InstanceIdentifier<?> nodeGroupStatisticsAugmentation = groupRef.augmentation(NodeGroupStatistics.class).toInstance();
+        
+        cleanStaleStatisticsFromDataStore(nodeGroupStatisticsAugmentation);
+    }
+    
+    private void cleanStaleStatisticsFromDataStore(InstanceIdentifier<? extends DataObject> ii){
+        if(ii != null){
+            DataModificationTransaction it = this.statisticsProvider.startChange();
+            it.removeOperationalData(ii);
+            it.commit();
+        }
+    }
+}
index 738c2cb9a8f6375d8681a5e824b0d2f953d1a211..653cc8081ab8a953463760560b54cf1bfd197894 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.md.statistics.manager;
 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.osgi.framework.BundleContext;
 
@@ -26,6 +27,8 @@ public class StatisticsManagerActivator extends AbstractBindingAwareProvider {
         pSession = session;
         DataProviderService dps = session.<DataProviderService>getSALService(DataProviderService.class);
         StatisticsManagerActivator.statsProvider.setDataService(dps);
+        DataBrokerService dbs = session.<DataBrokerService>getSALService(DataBrokerService.class);
+        StatisticsManagerActivator.statsProvider.setDataBrokerService(dbs);
         NotificationProviderService nps = session.<NotificationProviderService>getSALService(NotificationProviderService.class);
         StatisticsManagerActivator.statsProvider.setNotificationService(nps);
         StatisticsManagerActivator.statsProvider.start();
index bb5dea3bd5ad753ca7069169e32a9207b1599715..7b7403f1c327f6492d81e0a1980510025b46e37e 100644 (file)
@@ -17,26 +17,37 @@ import java.util.concurrent.Future;
 import org.eclipse.xtext.xbase.lib.Exceptions;
 import org.opendaylight.controller.md.statistics.manager.MultipartMessageManager.StatsRequestType;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
 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;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInputBuilder;
@@ -49,19 +60,36 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.G
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsService;
 import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/** 
+ * Following are main responsibilities of the class:
+ * 1) Invoke statistics request thread to send periodic statistics request to all the 
+ * flow capable switch connected to the controller. It sends statistics request for 
+ * Group,Meter,Table,Flow,Queue,Aggregate stats.   
+ * 
+ * 2) Invoke statistics ager thread, to clean up all the stale statistics data from 
+ * operational data store.
+ * 
+ * @author avishnoi@in.ibm.com
+ *
+ */
 public class StatisticsProvider implements AutoCloseable {
 
     public final static Logger spLogger = LoggerFactory.getLogger(StatisticsProvider.class);
     
     private DataProviderService dps;
+    
+    private DataBrokerService dbs;
 
     private NotificationProviderService nps;
     
@@ -79,15 +107,19 @@ public class StatisticsProvider implements AutoCloseable {
 
     private final MultipartMessageManager multipartMessageManager = new MultipartMessageManager();
     
+    private StatisticsUpdateHandler statsUpdateHandler;
+    
     private Thread statisticsRequesterThread;
     
+    private Thread statisticsAgerThread;
+
     private final  InstanceIdentifier<Nodes> nodesIdentifier = InstanceIdentifier.builder(Nodes.class).toInstance();
     
-    private final int STATS_THREAD_EXECUTION_TIME= 50000;
+    public static final int STATS_THREAD_EXECUTION_TIME= 30000;
     //Local caching of stats
     
-    private final ConcurrentMap<NodeId,NodeStatistics> statisticsCache = 
-            new ConcurrentHashMap<NodeId,NodeStatistics>();
+    private final ConcurrentMap<NodeId,NodeStatisticsAger> statisticsCache = 
+            new ConcurrentHashMap<NodeId,NodeStatisticsAger>();
     
     public DataProviderService getDataService() {
       return this.dps;
@@ -97,6 +129,14 @@ public class StatisticsProvider implements AutoCloseable {
       this.dps = dataService;
     }
     
+    public DataBrokerService getDataBrokerService() {
+        return this.dbs;
+    }
+      
+    public void setDataBrokerService(final DataBrokerService dataBrokerService) {
+        this.dbs = dataBrokerService;
+    }
+
     public NotificationProviderService getNotificationService() {
       return this.nps;
     }
@@ -119,6 +159,10 @@ public class StatisticsProvider implements AutoCloseable {
         Registration<NotificationListener> registerNotificationListener = nps.registerNotificationListener(this.updateCommiter);
         this.listenerRegistration = registerNotificationListener;
         
+        statsUpdateHandler = new StatisticsUpdateHandler(StatisticsProvider.this);
+        
+        registerDataStoreUpdateListener(this.getDataBrokerService());
+        
         // Get Group/Meter statistics service instance
         groupStatsService = StatisticsManagerActivator.getProviderContext().
                 getRpcService(OpendaylightGroupStatisticsService.class);
@@ -158,9 +202,60 @@ public class StatisticsProvider implements AutoCloseable {
         
         statisticsRequesterThread.start();
         
+        statisticsAgerThread = new Thread( new Runnable(){
+
+            @Override
+            public void run() {
+                while(true){
+                    try {
+                        for(NodeStatisticsAger nodeStatisticsAger : statisticsCache.values()){
+                            nodeStatisticsAger.cleanStaleStatistics();
+                        }
+                        
+                        Thread.sleep(STATS_THREAD_EXECUTION_TIME);
+                    }catch (Exception e){
+                        spLogger.error("Exception occurred while sending stats request : {}",e);
+                    }
+                }
+            }
+        });
+        
+        spLogger.debug("Statistics ager thread started with timer interval : {}",STATS_THREAD_EXECUTION_TIME);
+
+        statisticsAgerThread.start();
+        
         spLogger.info("Statistics Provider started.");
     }
     
+    private void registerDataStoreUpdateListener(DataBrokerService dbs) {
+        //Register for flow updates
+        InstanceIdentifier<? extends DataObject> pathFlow = InstanceIdentifier.builder(Nodes.class).child(Node.class)
+                                                                    .augmentation(FlowCapableNode.class)
+                                                                    .child(Table.class)
+                                                                    .child(Flow.class).toInstance();
+        dbs.registerDataChangeListener(pathFlow, statsUpdateHandler);
+        
+        //Register for meter updates
+        InstanceIdentifier<? extends DataObject> pathMeter = InstanceIdentifier.builder(Nodes.class).child(Node.class)
+                                                    .augmentation(FlowCapableNode.class)
+                                                    .child(Meter.class).toInstance();
+
+        dbs.registerDataChangeListener(pathMeter, statsUpdateHandler);
+        
+        //Register for group updates 
+        InstanceIdentifier<? extends DataObject> pathGroup = InstanceIdentifier.builder(Nodes.class).child(Node.class)
+                                                    .augmentation(FlowCapableNode.class)
+                                                    .child(Group.class).toInstance();
+        dbs.registerDataChangeListener(pathGroup, statsUpdateHandler);
+
+        //Register for queue updates
+        InstanceIdentifier<? extends DataObject> pathQueue = InstanceIdentifier.builder(Nodes.class).child(Node.class)
+                                                                    .child(NodeConnector.class)
+                                                                    .augmentation(FlowCapableNodeConnector.class)
+                                                                    .child(Queue.class).toInstance();
+        dbs.registerDataChangeListener(pathQueue, statsUpdateHandler);
+    }
+
     protected DataModificationTransaction startChange() {
         
         DataProviderService dps = this.getDataService();
@@ -210,7 +305,7 @@ public class StatisticsProvider implements AutoCloseable {
         }
     }
 
-    private void sendAllFlowTablesStatisticsRequest(NodeRef targetNodeRef) throws InterruptedException, ExecutionException {
+    public void sendAllFlowTablesStatisticsRequest(NodeRef targetNodeRef) throws InterruptedException, ExecutionException {
         final GetFlowTablesStatisticsInputBuilder input = 
                 new GetFlowTablesStatisticsInputBuilder();
         
@@ -224,7 +319,7 @@ public class StatisticsProvider implements AutoCloseable {
 
     }
 
-    private void sendAllFlowsStatsFromAllTablesRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
+    public void sendAllFlowsStatsFromAllTablesRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
         final GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input =
                 new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder();
         
@@ -238,7 +333,22 @@ public class StatisticsProvider implements AutoCloseable {
         
     }
     
-    private void sendAggregateFlowsStatsFromAllTablesRequest(NodeKey targetNodeKey) throws InterruptedException, ExecutionException{
+    public void sendFlowStatsFromTableRequest(NodeRef targetNode,Flow flow) throws InterruptedException, ExecutionException{
+        final GetFlowStatisticsFromFlowTableInputBuilder input =
+                new GetFlowStatisticsFromFlowTableInputBuilder();
+        
+        input.setNode(targetNode);
+        input.fieldsFrom(flow);
+        
+        Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> response = 
+                flowStatsService.getFlowStatisticsFromFlowTable(input.build());
+        
+        this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
+                , StatsRequestType.ALL_FLOW);
+        
+    }
+
+    public void sendAggregateFlowsStatsFromAllTablesRequest(NodeKey targetNodeKey) throws InterruptedException, ExecutionException{
         
         List<Short> tablesId = getTablesFromNode(targetNodeKey);
         
@@ -263,7 +373,7 @@ public class StatisticsProvider implements AutoCloseable {
         }
     }
 
-    private void sendAllNodeConnectorsStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
+    public void sendAllNodeConnectorsStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
         
         final GetAllNodeConnectorsStatisticsInputBuilder input = new GetAllNodeConnectorsStatisticsInputBuilder();
         
@@ -276,7 +386,7 @@ public class StatisticsProvider implements AutoCloseable {
 
     }
 
-    private void sendAllGroupStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
+    public void sendAllGroupStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
         
         final GetAllGroupStatisticsInputBuilder input = new GetAllGroupStatisticsInputBuilder();
         
@@ -290,7 +400,7 @@ public class StatisticsProvider implements AutoCloseable {
 
     }
     
-    private void sendGroupDescriptionRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
+    public void sendGroupDescriptionRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
         final GetGroupDescriptionInputBuilder input = new GetGroupDescriptionInputBuilder();
         
         input.setNode(targetNode);
@@ -303,7 +413,7 @@ public class StatisticsProvider implements AutoCloseable {
 
     }
     
-    private void sendAllMeterStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
+    public void sendAllMeterStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
         
         GetAllMeterStatisticsInputBuilder input = new GetAllMeterStatisticsInputBuilder();
         
@@ -317,7 +427,7 @@ public class StatisticsProvider implements AutoCloseable {
 
     }
     
-    private void sendMeterConfigStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
+    public void sendMeterConfigStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
         
         GetAllMeterConfigStatisticsInputBuilder input = new GetAllMeterConfigStatisticsInputBuilder();
         
@@ -331,7 +441,7 @@ public class StatisticsProvider implements AutoCloseable {
 
     }
     
-    private void sendAllQueueStatsFromAllNodeConnector(NodeRef targetNode) throws InterruptedException, ExecutionException {
+    public void sendAllQueueStatsFromAllNodeConnector(NodeRef targetNode) throws InterruptedException, ExecutionException {
         GetAllQueuesStatisticsFromAllPortsInputBuilder input = new GetAllQueuesStatisticsFromAllPortsInputBuilder();
         
         input.setNode(targetNode);
@@ -344,7 +454,21 @@ public class StatisticsProvider implements AutoCloseable {
 
     }
 
-    public ConcurrentMap<NodeId, NodeStatistics> getStatisticsCache() {
+    public void sendQueueStatsFromGivenNodeConnector(NodeRef targetNode,NodeConnectorId nodeConnectorId, QueueId queueId) throws InterruptedException, ExecutionException {
+        GetQueueStatisticsFromGivenPortInputBuilder input = new GetQueueStatisticsFromGivenPortInputBuilder();
+        
+        input.setNode(targetNode);
+        input.setNodeConnectorId(nodeConnectorId);
+        input.setQueueId(queueId);
+        Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> response = 
+                queueStatsService.getQueueStatisticsFromGivenPort(input.build());
+        
+        this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
+                , StatsRequestType.ALL_QUEUE_STATS);;
+
+    }
+
+    public ConcurrentMap<NodeId, NodeStatisticsAger> getStatisticsCache() {
         return statisticsCache;
     }
     
@@ -383,6 +507,8 @@ public class StatisticsProvider implements AutoCloseable {
                 this.listenerRegistration.close();
                 
                 this.statisticsRequesterThread.destroy();
+                
+                this.statisticsAgerThread.destroy();
             
             }
           } catch (Throwable e) {
index f3188e1d0e83dbfd7870fd20b4e67d77d01b2219..ace547a03c9f5d17d28764b0ffe9a53a227e1612 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.md.statistics.manager;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.concurrent.ConcurrentMap;
 
+import org.opendaylight.controller.md.statistics.manager.NodeStatisticsAger.FlowEntry;
+import org.opendaylight.controller.md.statistics.manager.NodeStatisticsAger.QueueEntry;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
@@ -44,7 +45,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesUpdated;
@@ -88,7 +88,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.meter.MeterStatisticsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.config.stats.reply.MeterConfigStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericQueueStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder;
@@ -126,7 +125,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
 
     private final StatisticsProvider statisticsManager;
     
-    private final int unaccountedFlowsCounter = 1;
+    private int unaccountedFlowsCounter = 1;
 
     public StatisticsUpdateCommiter(final StatisticsProvider manager){
 
@@ -143,19 +142,19 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
             return;
         
+        NodeKey key = new NodeKey(notification.getId());
+
         //Add statistics to local cache
-        ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+        ConcurrentMap<NodeId, NodeStatisticsAger> cache = this.statisticsManager.getStatisticsCache();
         if(!cache.containsKey(notification.getId())){
-            cache.put(notification.getId(), new NodeStatistics());
+            cache.put(notification.getId(), new NodeStatisticsAger(statisticsManager,key));
         }
-        cache.get(notification.getId()).setMeterConfigStats(notification.getMeterConfigStats());
+        cache.get(notification.getId()).updateMeterConfigStats(notification.getMeterConfigStats());
         
         //Publish data to configuration data store
-        NodeKey key = new NodeKey(notification.getId());
+        List<MeterConfigStats> meterConfigStatsList = notification.getMeterConfigStats();
         
-        List<MeterConfigStats> eterConfigStatsList = notification.getMeterConfigStats();
-        
-        for(MeterConfigStats meterConfigStats : eterConfigStatsList){
+        for(MeterConfigStats meterConfigStats : meterConfigStatsList){
             DataModificationTransaction it = this.statisticsManager.startChange();
             MeterBuilder meterBuilder = new MeterBuilder();
             MeterKey meterKey = new MeterKey(meterConfigStats.getMeterId());
@@ -185,13 +184,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
             return;
 
-        //Add statistics to local cache
-        ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
-        if(!cache.containsKey(notification.getId())){
-            cache.put(notification.getId(), new NodeStatistics());
-        }
-        cache.get(notification.getId()).setMeterStatistics(notification.getMeterStats());
-        
         NodeKey key = new NodeKey(notification.getId());
         
         List<MeterStats> meterStatsList = notification.getMeterStats();
@@ -227,15 +219,16 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
             return;
 
+        NodeKey key = new NodeKey(notification.getId());
+
         //Add statistics to local cache
-        ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+        ConcurrentMap<NodeId, NodeStatisticsAger> cache = this.statisticsManager.getStatisticsCache();
         if(!cache.containsKey(notification.getId())){
-            cache.put(notification.getId(), new NodeStatistics());
+            cache.put(notification.getId(), new NodeStatisticsAger(statisticsManager,key));
         }
-        cache.get(notification.getId()).setGroupDescStats(notification.getGroupDescStats());
+        cache.get(notification.getId()).updateGroupDescStats(notification.getGroupDescStats());
         
         //Publish data to configuration data store
-        NodeKey key = new NodeKey(notification.getId());
         List<GroupDescStats> groupDescStatsList = notification.getGroupDescStats();
 
         for(GroupDescStats groupDescStats : groupDescStatsList){
@@ -269,13 +262,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
             return;
 
-        //Add statistics to local cache
-        ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
-        if(!cache.containsKey(notification.getId())){
-            cache.put(notification.getId(), new NodeStatistics());
-        }
-        cache.get(notification.getId()).setGroupStatistics(notification.getGroupStats());
-        
         //Publish data to configuration data store
         NodeKey key = new NodeKey(notification.getId());
         List<GroupStats> groupStatsList = notification.getGroupStats();
@@ -306,11 +292,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
     @Override
     public void onMeterFeaturesUpdated(MeterFeaturesUpdated notification) {
 
-        //Add statistics to local cache
-        ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
-        if(!cache.containsKey(notification.getId())){
-            cache.put(notification.getId(), new NodeStatistics());
-        }
         MeterFeaturesBuilder meterFeature = new MeterFeaturesBuilder();
         meterFeature.setMeterBandSupported(notification.getMeterBandSupported());
         meterFeature.setMeterCapabilitiesSupported(notification.getMeterCapabilitiesSupported());
@@ -318,8 +299,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         meterFeature.setMaxColor(notification.getMaxColor());
         meterFeature.setMaxMeter(notification.getMaxMeter());
         
-        cache.get(notification.getId()).setMeterFeatures(meterFeature.build());
-        
         //Publish data to configuration data store
         DataModificationTransaction it = this.statisticsManager.startChange();
         NodeKey key = new NodeKey(notification.getId());
@@ -342,18 +321,11 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
     @Override
     public void onGroupFeaturesUpdated(GroupFeaturesUpdated notification) {
 
-        //Add statistics to local cache
-        ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
-        if(!cache.containsKey(notification.getId())){
-            cache.put(notification.getId(), new NodeStatistics());
-        }
-        
         GroupFeaturesBuilder groupFeatures = new GroupFeaturesBuilder();
         groupFeatures.setActions(notification.getActions());
         groupFeatures.setGroupCapabilitiesSupported(notification.getGroupCapabilitiesSupported());
         groupFeatures.setGroupTypesSupported(notification.getGroupTypesSupported());
         groupFeatures.setMaxGroups(notification.getMaxGroups());
-        cache.get(notification.getId()).setGroupFeatures(groupFeatures.build());
         
         //Publish data to configuration data store
         DataModificationTransaction it = this.statisticsManager.startChange();
@@ -427,14 +399,13 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             GenericStatistics flowStats = stats.build();
                 
             //Add statistics to local cache
-            ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+            ConcurrentMap<NodeId, NodeStatisticsAger> cache = this.statisticsManager.getStatisticsCache();
             if(!cache.containsKey(notification.getId())){
-                cache.put(notification.getId(), new NodeStatistics());
+                cache.put(notification.getId(), new NodeStatisticsAger(statisticsManager,key));
             }
-            if(!cache.get(notification.getId()).getFlowAndStatsMap().containsKey(tableId)){
-                cache.get(notification.getId()).getFlowAndStatsMap().put(tableId, new HashMap<Flow,GenericStatistics>());
-            }
-            cache.get(notification.getId()).getFlowAndStatsMap().get(tableId).put(flowRule,flowStats);
+            NodeStatisticsAger nsa = cache.get(notification.getId());
+            FlowEntry flowStatsEntry = nsa.new FlowEntry(tableId,flowRule);
+            cache.get(notification.getId()).updateFlowStats(flowStatsEntry);
                 
             //Augment the data to the flow node
 
@@ -492,10 +463,35 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
                 }
             }
             
+            table= (Table)it.readOperationalData(tableRef);
+            if(!foundOriginalFlow && table != null){
+
+                for(Flow existingFlow : table.getFlow()){
+                    FlowStatisticsData augmentedflowStatisticsData = existingFlow.getAugmentation(FlowStatisticsData.class);
+                    if(augmentedflowStatisticsData != null){
+                        FlowBuilder existingOperationalFlow = new FlowBuilder();
+                        existingOperationalFlow.fieldsFrom(augmentedflowStatisticsData.getFlowStatistics());
+                        sucLogger.debug("Existing unaccounted flow in operational data store : {}",existingFlow.toString());
+                        if(flowEquals(flowRule,existingOperationalFlow.build())){
+                            InstanceIdentifier<Flow> flowRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
+                                    .augmentation(FlowCapableNode.class)
+                                    .child(Table.class, new TableKey(tableId))
+                                    .child(Flow.class,existingFlow.getKey()).toInstance();
+                            flowBuilder.setKey(existingFlow.getKey());
+                            flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
+                            sucLogger.debug("Found matching flow in the operational datastore, augmenting statistics");
+                            foundOriginalFlow = true;
+                            it.putOperationalData(flowRef, flowBuilder.build());
+                            it.commit();
+                            break;
+                        }
+                    }
+                }
+            }
             if(!foundOriginalFlow){
                 sucLogger.debug("Associated original flow is not found in data store. Augmenting flow in operational data store");
-                //TODO: Temporary fix: format [ 1+tableid+1+unaccounted flow counter]
-                long flowKey = Long.parseLong(new String("1"+Short.toString(tableId)+"1"+Integer.toString(this.unaccountedFlowsCounter)));
+                long flowKey = Long.parseLong(new String("1"+Short.toString(tableId)+"0"+Integer.toString(this.unaccountedFlowsCounter)));
+                this.unaccountedFlowsCounter++;
                 FlowKey newFlowKey = new FlowKey(new FlowId(Long.toString(flowKey)));
                 InstanceIdentifier<Flow> flowRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
                         .augmentation(FlowCapableNode.class)
@@ -534,12 +530,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             aggregateFlowStatisticsBuilder.setPacketCount(notification.getPacketCount());
             aggregateFlowStatisticsDataBuilder.setAggregateFlowStatistics(aggregateFlowStatisticsBuilder.build());
             
-            ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
-            if(!cache.containsKey(notification.getId())){
-                cache.put(notification.getId(), new NodeStatistics());
-            }
-            cache.get(notification.getId()).getTableAndAggregateFlowStatsMap().put(tableId,aggregateFlowStatisticsBuilder.build());
-            
             sucLogger.debug("Augment aggregate statistics: {} for table {} on Node {}",aggregateFlowStatisticsBuilder.build().toString(),tableId,key);
 
             TableBuilder tableBuilder = new TableBuilder();
@@ -560,13 +550,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         NodeKey key = new NodeKey(notification.getId());
         sucLogger.debug("Received port stats update : {}",notification.toString());
         
-        //Add statistics to local cache
-        ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
-        if(!cache.containsKey(notification.getId())){
-            cache.put(notification.getId(), new NodeStatistics());
-        }
-
-
         List<NodeConnectorStatisticsAndPortNumberMap> portsStats = notification.getNodeConnectorStatisticsAndPortNumberMap();
         for(NodeConnectorStatisticsAndPortNumberMap portStats : portsStats){
             
@@ -586,9 +569,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             statisticsBuilder.setTransmitDrops(portStats.getTransmitDrops());
             statisticsBuilder.setTransmitErrors(portStats.getTransmitErrors());
             
-            //Update data in the cache
-            cache.get(notification.getId()).getNodeConnectorStats().put(portStats.getNodeConnectorId(), statisticsBuilder.build());
-            
             //Augment data to the node-connector
             FlowCapableNodeConnectorStatisticsDataBuilder statisticsDataBuilder = 
                     new FlowCapableNodeConnectorStatisticsDataBuilder();
@@ -635,12 +615,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             
             statisticsDataBuilder.setFlowTableStatistics(statisticsBuilder.build());
             
-            ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
-            if(!cache.containsKey(notification.getId())){
-                cache.put(notification.getId(), new NodeStatistics());
-            }
-            cache.get(notification.getId()).getFlowTableAndStatisticsMap().put(ftStats.getTableId().getValue(),statisticsBuilder.build());
-            
             sucLogger.debug("Augment flow table statistics: {} for table {} on Node {}",statisticsBuilder.build().toString(),ftStats.getTableId(),key);
             
             TableBuilder tableBuilder = new TableBuilder();
@@ -662,17 +636,18 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         sucLogger.debug("Received queue stats update : {}",notification.toString());
         
         //Add statistics to local cache
-        ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
+        ConcurrentMap<NodeId, NodeStatisticsAger> cache = this.statisticsManager.getStatisticsCache();
         if(!cache.containsKey(notification.getId())){
-            cache.put(notification.getId(), new NodeStatistics());
+            cache.put(notification.getId(), new NodeStatisticsAger(statisticsManager,key));
         }
         
+        NodeStatisticsAger nsa = cache.get(notification.getId());
+        
         List<QueueIdAndStatisticsMap> queuesStats = notification.getQueueIdAndStatisticsMap();
         for(QueueIdAndStatisticsMap swQueueStats : queuesStats){
             
-            if(!cache.get(notification.getId()).getNodeConnectorAndQueuesStatsMap().containsKey(swQueueStats.getNodeConnectorId())){
-                cache.get(notification.getId()).getNodeConnectorAndQueuesStatsMap().put(swQueueStats.getNodeConnectorId(), new HashMap<QueueId,GenericQueueStatistics>());
-            }
+            QueueEntry queueEntry = nsa.new QueueEntry(swQueueStats.getNodeConnectorId(),swQueueStats.getQueueId());
+            nsa.updateQueueStats(queueEntry);
             
             FlowCapableNodeConnectorQueueStatisticsDataBuilder queueStatisticsDataBuilder = new FlowCapableNodeConnectorQueueStatisticsDataBuilder();
             
@@ -682,11 +657,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             
             queueStatisticsDataBuilder.setFlowCapableNodeConnectorQueueStatistics(queueStatisticsBuilder.build());
             
-            cache.get(notification.getId()).getNodeConnectorAndQueuesStatsMap()
-                                            .get(swQueueStats.getNodeConnectorId())
-                                            .put(swQueueStats.getQueueId(), queueStatisticsBuilder.build());
-            
-            
             DataModificationTransaction it = this.statisticsManager.startChange();
 
             InstanceIdentifier<Queue> queueRef 
diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateHandler.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateHandler.java
new file mode 100644 (file)
index 0000000..f04c29f
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright IBM Corporation, 2013.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.statistics.manager;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+
+import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterConfigStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.FlowCapableNodeConnectorQueueStatisticsData;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Following are two main responsibilities of the class
+ * 1) Listen for the create changes in config data store for tree nodes (Flow,Group,Meter,Queue) 
+ * and send statistics request to the switch to fetch the statistics
+ * 
+ * 2)Listen for the remove changes in config data store for tree nodes (Flow,Group,Meter,Queue)
+ * and remove the relative statistics data from operational data store.
+ * 
+ * @author avishnoi@in.ibm.com
+ *
+ */
+public class StatisticsUpdateHandler implements DataChangeListener {
+
+    public final static Logger suhLogger = LoggerFactory.getLogger(StatisticsUpdateHandler.class);
+
+    private final StatisticsProvider statisticsManager;
+    
+    public StatisticsUpdateHandler(final StatisticsProvider manager){
+
+        this.statisticsManager = manager;
+    }
+    
+    public StatisticsProvider getStatisticsManager(){
+        return statisticsManager;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public void onDataChanged(DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
+        
+        Map<InstanceIdentifier<?>, DataObject> additions = change.getCreatedConfigurationData();
+        for (InstanceIdentifier<? extends DataObject> dataObjectInstance : additions.keySet()) {
+            DataObject dataObject = additions.get(dataObjectInstance);
+            InstanceIdentifier<Node> nodeII = dataObjectInstance.firstIdentifierOf(Node.class);
+            NodeRef nodeRef = new NodeRef(nodeII);
+            if(dataObject instanceof Flow){
+                Flow flow = (Flow) dataObject;
+                try {
+                    this.statisticsManager.sendFlowStatsFromTableRequest(nodeRef, flow);
+                } catch (InterruptedException | ExecutionException e) {
+                    suhLogger.warn("Following exception occured while sending flow statistics request newly added flow: {}", e);
+                }
+            }
+            if(dataObject instanceof Meter){
+                try {
+                    this.statisticsManager.sendMeterConfigStatisticsRequest(nodeRef);
+                } catch (InterruptedException | ExecutionException e) {
+                    suhLogger.warn("Following exception occured while sending meter statistics request for newly added meter: {}", e);
+                }
+            }
+            if(dataObject instanceof Group){
+                try {
+                    this.statisticsManager.sendGroupDescriptionRequest(nodeRef);
+                } catch (InterruptedException | ExecutionException e) {
+                    suhLogger.warn("Following exception occured while sending group description request for newly added group: {}", e);
+                }
+            }
+            if(dataObject instanceof Queue){
+                Queue queue = (Queue) dataObject;
+                InstanceIdentifier<NodeConnector> nodeConnectorII = dataObjectInstance.firstIdentifierOf(NodeConnector.class);
+                NodeConnectorKey nodeConnectorKey = InstanceIdentifier.keyOf(nodeConnectorII);
+                try {
+                    this.statisticsManager.sendQueueStatsFromGivenNodeConnector(nodeRef, nodeConnectorKey.getId(), queue.getQueueId());
+                } catch (InterruptedException | ExecutionException e) {
+                    suhLogger.warn("Following exception occured while sending queue statistics request for newly added group: {}", e);
+                }
+            }
+        }
+            
+        Set<InstanceIdentifier<? extends DataObject>> removals = change.getRemovedConfigurationData();
+        for (InstanceIdentifier<? extends DataObject> dataObjectInstance : removals) {
+            DataObject dataObject = change.getOriginalConfigurationData().get(dataObjectInstance);
+            
+            if(dataObject instanceof Flow){
+                InstanceIdentifier<Flow> flowII = (InstanceIdentifier<Flow>)dataObjectInstance;
+                InstanceIdentifier<?> flowAugmentation = 
+                        InstanceIdentifier.builder(flowII).augmentation(FlowStatisticsData.class).toInstance();
+                removeAugmentedOperationalData(flowAugmentation);
+            }
+            if(dataObject instanceof Meter){
+                InstanceIdentifier<Meter> meterII = (InstanceIdentifier<Meter>)dataObjectInstance;
+                
+                InstanceIdentifier<?> nodeMeterConfigStatsAugmentation = 
+                        InstanceIdentifier.builder(meterII).augmentation(NodeMeterConfigStats.class).toInstance();
+                removeAugmentedOperationalData(nodeMeterConfigStatsAugmentation);
+
+                InstanceIdentifier<?> nodeMeterStatisticsAugmentation = 
+                        InstanceIdentifier.builder(meterII).augmentation(NodeMeterStatistics.class).toInstance();
+                removeAugmentedOperationalData(nodeMeterStatisticsAugmentation);
+            }
+            
+            if(dataObject instanceof Group){
+                InstanceIdentifier<Group> groupII = (InstanceIdentifier<Group>)dataObjectInstance;
+                
+                InstanceIdentifier<?> nodeGroupDescStatsAugmentation = 
+                        InstanceIdentifier.builder(groupII).augmentation(NodeGroupDescStats.class).toInstance();
+                removeAugmentedOperationalData(nodeGroupDescStatsAugmentation);
+
+                InstanceIdentifier<?> nodeGroupStatisticsAugmentation = 
+                        InstanceIdentifier.builder(groupII).augmentation(NodeGroupStatistics.class).toInstance();
+                removeAugmentedOperationalData(nodeGroupStatisticsAugmentation);
+            }
+            
+            if(dataObject instanceof Queue){
+                InstanceIdentifier<Queue> queueII = (InstanceIdentifier<Queue>)dataObjectInstance;
+                
+                InstanceIdentifier<?> nodeConnectorQueueStatisticsDataAugmentation = 
+                        InstanceIdentifier.builder(queueII).augmentation(FlowCapableNodeConnectorQueueStatisticsData.class).toInstance();
+                removeAugmentedOperationalData(nodeConnectorQueueStatisticsDataAugmentation);
+            }
+        }
+    }
+    
+    private void removeAugmentedOperationalData(InstanceIdentifier<? extends DataObject> dataObjectInstance ){
+        if(dataObjectInstance != null){
+            DataModificationTransaction it = this.statisticsManager.startChange();
+            it.removeOperationalData(dataObjectInstance);
+            it.commit();
+        }
+    }
+}
index e49fb33780dd1b16d2dbcaf47245e80611c652d4..c03833d72b8c45c51e4c826194cbdb9f9ea6bf1b 100644 (file)
         <dependency>
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
-            <version>1.8</version>
+            <version>1.7</version>
         </dependency>
         <dependency>
             <groupId>equinoxSDK381</groupId>
index ed94c8dfb74267058b5a7f585753c0161d18783d..36c4f621380d1b415b5e9b090eb89230a4e32141 100644 (file)
@@ -71,7 +71,7 @@
           <dependency>
                    <groupId>commons-codec</groupId>
                    <artifactId>commons-codec</artifactId>
-                   <version>1.8</version>
+                   <version>1.7</version>
                  </dependency>
     <dependency>
             <groupId>org.opendaylight.controller</groupId>
index 8820d58a98a90bd9b657122c4c373867385684f0..592d8e4f3b657933b99144f5c769adf4895a5baf 100644 (file)
@@ -66,7 +66,7 @@ public class Commit extends AbstractConfigNetconfOperation {
                     "Unable to retrieve config snapshot after commit for persister, details: " + e.getMessage(),
                     ErrorType.application, ErrorTag.operation_failed, ErrorSeverity.error, e.getErrorInfo());
         }
-        logger.info("Datastore {} committed successfully: {}", Datastore.candidate, status);
+        logger.trace("Datastore {} committed successfully: {}", Datastore.candidate, status);
 
         return document.createElement(XmlNetconfConstants.OK);
     }
index b8fa5dd86ee14cf97970f61a2aa988aa8dc5c1d1..3da02a84302992ce20c4d66927020034e65b9630 100644 (file)
@@ -71,7 +71,7 @@ public class DiscardChanges extends AbstractConfigNetconfOperation {
             throw new NetconfDocumentedException(e.getMessage(), e, ErrorType.application, ErrorTag.operation_failed,
                     ErrorSeverity.error, errorInfo);
         }
-        logger.info("Changes discarded successfully from datastore {}", Datastore.candidate);
+        logger.trace("Changes discarded successfully from datastore {}", Datastore.candidate);
 
         return document.createElement(XmlNetconfConstants.OK);
     }
index b8cae436433187dfc707f8988da02682d3bb31d6..24611c26cd5030637daed3c3a0aa884afa842a4e 100644 (file)
@@ -98,7 +98,7 @@ public class Validate extends AbstractConfigNetconfOperation {
 
         }
 
-        logger.info("Datastore {} validated successfully", Datastore.candidate);
+        logger.trace("Datastore {} validated successfully", Datastore.candidate);
 
         return document.createElement(XmlNetconfConstants.OK);
     }
index 709573c2414c3249917aae4e03851e0f9ada4da8..a61d4633a2dd7d6ae00bd7cfaa351ff83aa94a49 100644 (file)
@@ -73,7 +73,7 @@ public class EditConfig extends AbstractConfigNetconfOperation {
             executeSet(configRegistryClient, editConfigExecution);
         }
 
-        logger.info("Operation {} successful", EditConfigXmlParser.EDIT_CONFIG);
+        logger.trace("Operation {} successful", EditConfigXmlParser.EDIT_CONFIG);
 
         return document.createElement(XmlNetconfConstants.OK);
     }
index 8ed9eb873146ffe38a2240ce49887a1d01bf7061..92e30f1617d755f8524905c81f2ba99659023186 100644 (file)
@@ -28,7 +28,7 @@ public class MissingInstanceHandlingStrategy extends AbstractEditConfigStrategy
         ObjectName on = null;
         try {
             on = ta.createModule(module, instance);
-            logger.info("New instance for {} {} created under name {}", module, instance, on);
+            logger.trace("New instance for {} {} created under name {}", module, instance, on);
         } catch (InstanceAlreadyExistsException e1) {
             throw new IllegalStateException("Unable to create instance for " + module + " : " + instance);
         }
index ea602091a0423ec0957a5c0974f163b89f0fd72a..dd9a0717b5ae17b0b373507c240156b1f8e9a203 100644 (file)
@@ -153,7 +153,7 @@ public class Get extends AbstractConfigNetconfOperation {
         ConfigTransactionClient ta = configRegistryClient.getConfigTransactionClient(txOn);
         final Element element = runtime.toXml(runtimeBeans, configBeans, document, new ServiceRegistryWrapper(ta));
 
-        logger.info("{} operation successful", XmlNetconfConstants.GET);
+        logger.trace("{} operation successful", XmlNetconfConstants.GET);
 
         return element;
     }
index 16dd5ad80a695aa791ec5b8e86ebacec9dac50ab..297f78960bc85c6932d9824c66af5ee317dbd70c 100644 (file)
@@ -90,7 +90,7 @@ public class GetConfig extends AbstractConfigNetconfOperation {
         ServiceRegistryWrapper serviceTracker = new ServiceRegistryWrapper(ta);
         dataElement = configMapping.toXml(instances, this.maybeNamespace, document, dataElement, serviceTracker);
 
-        logger.info("{} operation successful", GET_CONFIG);
+        logger.trace("{} operation successful", GET_CONFIG);
 
         return dataElement;
     }
index f838c6f9f5e69160b4c889d799f7e42ed2c7338c..e7f9772c011dbf7979463146f6aafe1e2526940e 100644 (file)
@@ -173,7 +173,7 @@ public class RuntimeRpc extends AbstractConfigNetconfOperation {
         final Object result = executeOperation(configRegistryClient, execution.on, execution.operationName,
                 execution.attributes);
 
-        logger.info("Operation {} called successfully on {} with arguments {} with result {}", execution.operationName,
+        logger.trace("Operation {} called successfully on {} with arguments {} with result {}", execution.operationName,
                 execution.on, execution.attributes, result);
 
         if (execution.isVoid()) {
index b66a1a57c20c9288b60e79cdb54daa1cf53bbec3..889fa8428c7fb2617e63b31653c49d0a63cf3ed0 100644 (file)
@@ -69,7 +69,7 @@ public class ConfigPersisterNotificationHandler implements NotificationListener,
         // Socket should not be closed at this point
         // Activator unregisters this as JMX listener before close is called
 
-        logger.info("Received notification {}", notification);
+        logger.trace("Received notification {}", notification);
         if (notification instanceof CommitJMXNotification) {
             try {
                 handleAfterCommitNotification((CommitJMXNotification) notification);
@@ -87,7 +87,7 @@ public class ConfigPersisterNotificationHandler implements NotificationListener,
         try {
             persisterAggregator.persistConfig(new CapabilityStrippingConfigSnapshotHolder(notification.getConfigSnapshot(),
                     notification.getCapabilities(), ignoredMissingCapabilityRegex));
-            logger.info("Configuration persisted successfully");
+            logger.trace("Configuration persisted successfully");
         } catch (IOException e) {
             throw new RuntimeException("Unable to persist configuration snapshot", e);
         }
index e45b092d080a6ec33555707d463a2d31aa9876e3..6e62a982d1588217215f999011b6cfba4a443e46 100644 (file)
@@ -150,7 +150,7 @@ public class ConfigPusher {
             latestCapabilities = netconfClient.getCapabilities();
             if (Util.isSubset(netconfClient, expectedCaps)) {
                 logger.debug("Hello from netconf stable with {} capabilities", latestCapabilities);
-                logger.info("Session id received from netconf server: {}", netconfClient.getClientSession());
+                logger.trace("Session id received from netconf server: {}", netconfClient.getClientSession());
                 return netconfClient;
             }
             logger.debug("Polling hello from netconf, attempt {}, capabilities {}", attempt, latestCapabilities);
@@ -169,7 +169,7 @@ public class ConfigPusher {
             throws ConflictingVersionException, IOException, SAXException {
 
         Element xmlToBePersisted = XmlUtil.readXmlToElement(configSnapshotHolder.getConfigSnapshot());
-        logger.info("Pushing last configuration to netconf: {}", configSnapshotHolder);
+        logger.trace("Pushing last configuration to netconf: {}", configSnapshotHolder);
         StringBuilder response = new StringBuilder("editConfig response = {");
 
         NetconfMessage message = createEditConfigMessage(xmlToBePersisted, "/netconfOp/editConfig.xml");
@@ -188,7 +188,7 @@ public class ConfigPusher {
         response.append("commit response = {");
         response.append(XmlUtil.toString(responseMessage.getDocument()));
         response.append("}");
-        logger.info("Last configuration loaded successfully");
+        logger.trace("Last configuration loaded successfully");
         logger.trace("Detailed message {}", response);
     }
 
index ba9e4d0f8a14fe9cd44c906dc57a91011a89ca99..f34529d53fe0549c7ce5ad6ce6b995386c00ab64 100644 (file)
@@ -95,7 +95,7 @@ public final class DefaultGetSchema extends AbstractNetconfOperation implements
         XmlUtil.addNamespaceAttr(getSchemaResult,
                 XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING);
 
-        logger.info("{} operation successful", GET_SCHEMA);
+        logger.trace("{} operation successful", GET_SCHEMA);
 
         return getSchemaResult;
     }
index 9e84be6c31c32d1a5bbfeb778b8ec05e0b899095..679e280ba22933822d6c08942c80b548b075c0da 100644 (file)
@@ -73,7 +73,7 @@ public class DefaultStartExi extends AbstractNetconfOperation implements Default
                     .createElement(XmlNetconfConstants.RPC_ERROR);\r
         }\r
 \r
-        logger.info("{} operation successful", START_EXI);\r
+        logger.trace("{} operation successful", START_EXI);\r
         logger.debug("received start-exi message {} ", XmlUtil.toString(document));\r
         return getSchemaResult;\r
 \r
index 2c6c89617ffbe19b1ff383604ba0e924fdb75ba6..d841a6619eab5bc285f4a23eabd3a4b9d9ea43bd 100644 (file)
@@ -57,7 +57,7 @@ public class DefaultStopExi extends AbstractNetconfOperation implements DefaultN
         Element getSchemaResult = document.createElement(XmlNetconfConstants.OK);\r
         XmlUtil.addNamespaceAttr(getSchemaResult,\r
                 XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);\r
-        logger.info("{} operation successful", STOP_EXI);\r
+        logger.trace("{} operation successful", STOP_EXI);\r
         logger.debug("received stop-exi message {} ", XmlUtil.toString(document));\r
         return getSchemaResult;\r
     }\r
index 8b3c5d70adfae08090eaa0c8a3f2a210ed743726..91624007d069701ee49eb0cc4a23412b95cae047 100644 (file)
@@ -43,7 +43,7 @@ public class NetconfSSHActivator implements BundleActivator{
     ServiceTrackerCustomizer<IUserManager, IUserManager> customizer = new ServiceTrackerCustomizer<IUserManager, IUserManager>(){
         @Override
         public IUserManager addingService(ServiceReference<IUserManager> reference) {
-            logger.info("Service {} added, let there be SSH bridge.", reference);
+            logger.trace("Service {} added, let there be SSH bridge.", reference);
             iUserManager =  context.getService(reference);
             try {
                 onUserManagerFound(iUserManager);
@@ -54,12 +54,12 @@ public class NetconfSSHActivator implements BundleActivator{
         }
         @Override
         public void modifiedService(ServiceReference<IUserManager> reference, IUserManager service) {
-            logger.info("Replacing modified service {} in netconf SSH.", reference);
+            logger.trace("Replacing modified service {} in netconf SSH.", reference);
             server.addUserManagerService(service);
         }
         @Override
         public void removedService(ServiceReference<IUserManager> reference, IUserManager service) {
-            logger.info("Removing service {} from netconf SSH. " +
+            logger.trace("Removing service {} from netconf SSH. " +
                     "SSH won't authenticate users until IUserManeger service will be started.", reference);
             removeUserManagerService();
         }
index d159f59f1a2cedcefeca01bf24b93854c4fa269b..d1b5213f6e07c0e6d9ef955963efa6d6d8b5e0a9 100644 (file)
@@ -194,7 +194,7 @@ public class SocketThread implements Runnable, ServerAuthenticationCallback, Ser
                 return AuthenticationResult.SUCCESS;
             }
         } catch (Exception e){
-            logger.info("Authentication failed due to :" + e.getLocalizedMessage());
+            logger.warn("Authentication failed due to :" + e.getLocalizedMessage());
         }
         return AuthenticationResult.FAILURE;
     }
index a43216917befd447ec4a6aedb1b82b31934e1633..6dc00bb1509e97b0a485b89e90b0248a642e7a1a 100644 (file)
@@ -34,13 +34,13 @@ public class SendErrorExceptionUtil {
 
     public static void sendErrorMessage(final NetconfSession session,
             final NetconfDocumentedException sendErrorException) {
-        logger.info("Sending error {}", sendErrorException.getMessage(), sendErrorException);
+        logger.trace("Sending error {}", sendErrorException.getMessage(), sendErrorException);
         final Document errorDocument = createDocument(sendErrorException);
         session.sendMessage(new NetconfMessage(errorDocument));
     }
 
     public static void sendErrorMessage(Channel channel, NetconfDocumentedException sendErrorException) {
-        logger.info("Sending error {}", sendErrorException.getMessage(), sendErrorException);
+        logger.trace("Sending error {}", sendErrorException.getMessage(), sendErrorException);
         final Document errorDocument = createDocument(sendErrorException);
         channel.writeAndFlush(new NetconfMessage(errorDocument));
     }
@@ -48,7 +48,7 @@ public class SendErrorExceptionUtil {
     public static void sendErrorMessage(NetconfSession session, NetconfDocumentedException sendErrorException,
             NetconfMessage incommingMessage) {
         final Document errorDocument = createDocument(sendErrorException);
-        logger.info("Sending error {}", XmlUtil.toString(errorDocument));
+        logger.trace("Sending error {}", XmlUtil.toString(errorDocument));
         tryToCopyAttributes(incommingMessage.getDocument(), errorDocument, sendErrorException);
         session.sendMessage(new NetconfMessage(errorDocument));
     }
index 0c640820598b1c4f12f7f786df1ee3f23ee774a2..c590da4dbc1c55fca296a5059061dca4a99c75ef 100644 (file)
@@ -313,7 +313,7 @@ import org.slf4j.LoggerFactory;
             }
         }
         if (conflictsMsg.length() > 0) {
-            LOGGER.info("JAXB type conflicts detected : {}", conflictsMsg.toString());
+            LOGGER.warn("JAXB type conflicts detected : {}", conflictsMsg.toString());
         }
     }
 
index bf8844d9f61d808d4983b2c22585ceecab234c72..58ba77697001b0e4d0b998098d0d17d15165a736 100644 (file)
@@ -135,7 +135,7 @@ public class NorthboundUtils {
         } else {
             auditMsg = "Mode: " + mode + " User " + user + " "  + action + " " + moduleName + " " + resource;
         }
-        logger.info(auditMsg);
+        logger.trace(auditMsg);
     }
 
     public static void auditlog(String moduleName, String user, String action, String resource) {
index 70c507207632af84e2db3f9182cfd76be2223318..47461f472213874a6abb77633f6917af2993b1f7 100644 (file)
@@ -150,7 +150,7 @@ public class ControllerIO {
             } else {
                 if (!currentlyUp) {
                     // only generate log if the interface changes from down to up
-                    logger.info("Interface {} with address {} is UP!",
+                    logger.trace("Interface {} with address {} is UP!",
                             netInt.getDisplayName(),
                             controllerIP.getHostAddress());
                 }
index 811135252da07b5137d33d9a9f78380229346f42..394be07dee2968b838377d8424ad8c70d49f4bce 100644 (file)
@@ -412,7 +412,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa
 
         List<LLDPTLV> optionalTLVList = lldp.getOptionalTLVList();
         if (optionalTLVList == null) {
-            logger.info("The discovery packet with null custom option from {}", dstNodeConnector);
+            logger.warn("The discovery packet with null custom option from {}", dstNodeConnector);
             return false;
         }
 
index 361f977b2c2c547697b46c6cf8b76d18dbd1bafd..78a2ea5120da60ad09053efb894e039533c52d68 100644 (file)
@@ -423,7 +423,7 @@ public class FlowConverter {
                     continue;
                 }
                 if (action.getType() == ActionType.SET_NEXT_HOP) {
-                    logger.info("Unsupported action: {}", action);
+                    logger.warn("Unsupported action: {}", action);
                     continue;
                 }
             }
index 27a7ae6ffb125ebb42d8af542ca27348fa926bb0..e5883d671740e1f0950b4264a2558d65d4ce4228 100644 (file)
@@ -431,7 +431,7 @@ public class OFStatisticsManager implements IOFStatisticsManager, IInventoryShim
     }
 
     private void printInfoMessage(String type, StatsRequest request) {
-        log.info("{} stats request not inserted for switch: {}. Queue size: {}. Collector state: {}.",
+        log.trace("{} stats request not inserted for switch: {}. Queue size: {}. Collector state: {}.",
                 new Object[] {type, HexString.toHexString(request.switchId), pendingStatsRequests.size(),
                 statisticsCollector.getState().toString() });
     }
index 2c3cfb8303736229e6c86b618642f6bd72b12aaa..910695c1e9cbc0ebcfb121b621fb7187305aff37 100644 (file)
@@ -20,6 +20,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.TreeMap;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -444,13 +445,16 @@ public class Match implements Cloneable, Serializable {
         if (this.fields == null) {
             result = prime * result;
         } else {
-            int sum = 0;
-            for (MatchType field : this.fields.keySet()) {
-                MatchField f = this.fields.get(field);
-                sum = sum + ((field==null ? 0 : field.calculateConsistentHashCode()) ^
-                             (f==null ? 0 : f.hashCode()));
+            // use a tree map as the order of hashMap is not guaranteed.
+            // 2 Match objects with fields in different order are still equal.
+            // Hence the hashCode should be the same too.
+            TreeMap<MatchType, MatchField> tm = new TreeMap<MatchType, MatchField>(this.fields);
+            for (MatchType field : tm.keySet()) {
+                MatchField f = tm.get(field);
+                int fieldHashCode = (field==null ? 0 : field.calculateConsistentHashCode()) ^
+                             (f==null ? 0 : f.hashCode());
+                result = prime * result + fieldHashCode;
             }
-            result = prime * result + sum;
         }
         result = prime * result + matches;
         return result;
index 30d49cfd9dcc5b5abb90bafd659ac314e855f99a..b88ae034d9aa713c96f4ce3ef633f977d5a223b3 100644 (file)
@@ -337,6 +337,21 @@ public class MatchTest {
         Assert.assertTrue(match1.equals(match2));
     }
 
+    @Test
+    public void testHashCodeWithReverseMatch() throws Exception {
+        InetAddress srcIP1 = InetAddress.getByName("1.1.1.1");
+        InetAddress ipMask1 = InetAddress.getByName("255.255.255.255");
+        InetAddress srcIP2 = InetAddress.getByName("2.2.2.2");
+        InetAddress ipMask2 = InetAddress.getByName("255.255.255.255");
+        MatchField field1 = new MatchField(MatchType.NW_SRC, srcIP1, ipMask1);
+        MatchField field2 = new MatchField(MatchType.NW_DST, srcIP2, ipMask2);
+        Match match1 = new Match();
+        match1.setField(field1);
+        match1.setField(field2);
+        Match match2 = match1.reverse();
+        Assert.assertFalse(match1.hashCode() == match2.hashCode());
+    }
+
     @Test
     public void testHashCode() throws Exception {
         byte srcMac1[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc };
index ff91e93f58c97e8b4bf234a8b1a601bb05094700..77d03aa1223abf829171a53f7682d4f8080ebcc5 100644 (file)
@@ -91,23 +91,23 @@ public class ConfigManager implements IConfigManager{
     }
 
     public VIP getVIPWithPoolName(VIP vip){
-        cmLogger.info("Search a VIP with name:{}",vip);
+        cmLogger.trace("Search a VIP with name:{}",vip);
         for(VIP vipTemp: this.vips.values()){
             if(vipTemp.equals(vip)){
 
-                cmLogger.info("Found VIP with pool detail : {}",vipTemp);
+                cmLogger.trace("Found VIP with pool detail : {}",vipTemp);
                 return vipTemp;
             }
         }
 
-        cmLogger.info("VIP with pool detail not found ");
+        cmLogger.trace("VIP with pool detail not found ");
         return null;
     }
 
     @Override
     public VIP createVIP(String name,String ip,String protocol,short protocolPort,String poolName){
 
-        cmLogger.info("Create VIP with the following details :[ name : "+name
+        cmLogger.trace("Create VIP with the following details :[ name : "+name
                                                                     +" ip : "+ip
                                                                     +" protocol : "+protocol
                                                                     +" protocol_port : "+protocolPort
@@ -124,7 +124,7 @@ public class ConfigManager implements IConfigManager{
         vip.setStatus(LBConst.STATUS_ACTIVE);
         this.vips.put(name, vip);
 
-        cmLogger.info("New VIP created : "+vip.toString());
+        cmLogger.trace("New VIP created : "+vip.toString());
         return vip;
     }
 
@@ -136,7 +136,7 @@ public class ConfigManager implements IConfigManager{
     @Override
     public VIP updateVIP(String name, String poolName){
 
-        cmLogger.info("Updating VIP : "+name+" pool name  to "+poolName);
+        cmLogger.trace("Updating VIP : "+name+" pool name  to "+poolName);
 
         if(vips.containsKey(name)){
             VIP vip = vips.get(name);
@@ -154,7 +154,7 @@ public class ConfigManager implements IConfigManager{
     @Override
     public VIP deleteVIP(String name){
 
-        cmLogger.info("Deleting VIP : "+name);
+        cmLogger.trace("Deleting VIP : "+name);
 
         VIP vip = vips.get(name);
 
@@ -167,7 +167,7 @@ public class ConfigManager implements IConfigManager{
             }
         }
 
-        cmLogger.info("VIP removed : "+vip.toString());
+        cmLogger.trace("VIP removed : "+vip.toString());
 
         vips.remove(vip.getName());
 
@@ -196,7 +196,7 @@ public class ConfigManager implements IConfigManager{
 
         PoolMember pm = new PoolMember(name,memberIP,poolName);
 
-        cmLogger.info("Adding pool member : "+pm.toString());
+        cmLogger.trace("Adding pool member : "+pm.toString());
 
         pools.get(poolName).addMember(pm);
 
@@ -206,7 +206,7 @@ public class ConfigManager implements IConfigManager{
     @Override
     public PoolMember removePoolMember(String name, String poolName){
 
-        cmLogger.info("Removing pool member : {} from pool {}",name, poolName);
+        cmLogger.trace("Removing pool member : {} from pool {}",name, poolName);
 
         Pool pool = pools.get(poolName);
 
@@ -214,7 +214,7 @@ public class ConfigManager implements IConfigManager{
 
         pool.removeMember(name);
 
-        cmLogger.info("Pool member {} removed from {} ",name,poolName);
+        cmLogger.trace("Pool member {} removed from {} ",name,poolName);
 
         return pm;
     }
@@ -240,7 +240,7 @@ public class ConfigManager implements IConfigManager{
 
         Pool newPool = new Pool(name,lbMethod);
 
-        cmLogger.info("New pool created : " + newPool.toString());
+        cmLogger.trace("New pool created : " + newPool.toString());
 
         pools.put(name, newPool);
 
@@ -258,7 +258,7 @@ public class ConfigManager implements IConfigManager{
 
         }
 
-        cmLogger.info("Pool removed : "+pool.toString());
+        cmLogger.trace("Pool removed : "+pool.toString());
 
         pools.remove(poolName);
 
index aa195a34e9ceb9487291e4e9f020f8b1acec7244..729a49ba5c9ea2be3c7a640e148cf402e4515a43 100644 (file)
@@ -35,17 +35,17 @@ public class LBUtil {
      * @return  Details of the source machine in Client object.
      */
     public Client getClientFromPacket(IPv4 inPkt){
-        lbuLogger.info("Find client information from packet : {}",inPkt.toString());
+        lbuLogger.trace("Find client information from packet : {}",inPkt.toString());
 
         String ip = NetUtils.getInetAddress(inPkt.getSourceAddress()).getHostAddress();
 
         String protocol = IPProtocols.getProtocolName(inPkt.getProtocol());
 
-        lbuLogger.info("client ip {} and protocl {}",ip,protocol);
+        lbuLogger.trace("client ip {} and protocl {}",ip,protocol);
 
         Packet tpFrame= inPkt.getPayload();
 
-        lbuLogger.info("Get protocol layer {}",tpFrame.toString());
+        lbuLogger.trace("Get protocol layer {}",tpFrame.toString());
 
         short port = 0;
 
@@ -57,11 +57,11 @@ public class LBUtil {
             port = udpFrame.getSourcePort();
         }
 
-        lbuLogger.info("Found port {}",port);
+        lbuLogger.trace("Found port {}",port);
 
         Client source = new Client(ip, protocol,port);
 
-        lbuLogger.info("Client information : {}",source.toString());
+        lbuLogger.trace("Client information : {}",source.toString());
 
         return source;
     }
@@ -74,7 +74,7 @@ public class LBUtil {
      */
     public VIP getVIPFromPacket(IPv4 inPkt){
 
-        lbuLogger.info("Find VIP information from packet : {}",inPkt.toString());
+        lbuLogger.trace("Find VIP information from packet : {}",inPkt.toString());
 
         String ip = NetUtils.getInetAddress(inPkt.getDestinationAddress()).getHostAddress();
 
@@ -95,7 +95,7 @@ public class LBUtil {
 
         VIP dest = new VIP(null,ip, protocol,port,null);
 
-        lbuLogger.info("VIP information : {}",dest.toString());
+        lbuLogger.trace("VIP information : {}",dest.toString());
 
         return dest;
     }
index b2229cb022016b3e95fb3876474b8d221ae6be0d..e1a997b44c010b2b4e8289f4a09f7750e5ee0e6e 100644 (file)
@@ -268,14 +268,14 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager {
                                 forwardPort = hnConnector.getnodeConnector();
 
                                 lbsLogger
-                                        .info("Both source (client) and destination pool machine is connected to same switch nodes. Respective ports are - {},{}",
+                                        .trace("Both source (client) and destination pool machine is connected to same switch nodes. Respective ports are - {},{}",
                                                 forwardPort, inPkt.getIncomingNodeConnector());
 
                             } else {
 
                                 Path route = this.routing.getRoute(clientNode, destNode);
 
-                                lbsLogger.info("Path between source (client) and destination switch nodes : {}",
+                                lbsLogger.trace("Path between source (client) and destination switch nodes : {}",
                                         route.toString());
 
                                 forwardPort = route.getEdges().get(0).getTailNodeConnector();
@@ -285,7 +285,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager {
                             if (installLoadBalancerFlow(client, vip, clientNode, poolMemberIp,
                                     hnConnector.getDataLayerAddressBytes(), forwardPort,
                                     LBConst.FORWARD_DIRECTION_LB_FLOW)) {
-                                lbsLogger.info("Traffic from client : {} will be routed " + "to pool machine : {}",
+                                lbsLogger.trace("Traffic from client : {} will be routed " + "to pool machine : {}",
                                         client, poolMemberIp);
                             } else {
                                 lbsLogger.error("Not able to route traffic from client : {}", client);
@@ -293,7 +293,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager {
 
                             if (installLoadBalancerFlow(client, vip, clientNode, poolMemberIp, vipMacAddr,
                                     inPkt.getIncomingNodeConnector(), LBConst.REVERSE_DIRECTION_LB_FLOW)) {
-                                lbsLogger.info("Flow rule installed to change the source ip/mac from "
+                                lbsLogger.trace("Flow rule installed to change the source ip/mac from "
                                         + "pool machine ip {} to VIP {} for traffic coming pool machine", poolMemberIp,
                                         vip);
                             } else {
@@ -389,7 +389,7 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager {
 
         FlowEntry fEntry = new FlowEntry(policyName, flowName, flow, sourceSwitch);
 
-        lbsLogger.info("Install flow entry {} on node {}", fEntry.toString(), sourceSwitch.toString());
+        lbsLogger.trace("Install flow entry {} on node {}", fEntry.toString(), sourceSwitch.toString());
 
         if (!this.ruleManager.checkFlowEntryConflict(fEntry)) {
             if (this.ruleManager.installFlowEntry(fEntry).isSuccess()) {
@@ -413,13 +413,13 @@ public class LoadBalancerService implements IListenDataPacket, IConfigManager {
         if (props != null) {
             this.containerName = (String) props.get("containerName");
 
-            lbsLogger.info("Running container name:" + this.containerName);
+            lbsLogger.trace("Running container name:" + this.containerName);
         } else {
 
             // In the Global instance case the containerName is empty
             this.containerName = "";
         }
-        lbsLogger.info(configManager.toString());
+        lbsLogger.trace(configManager.toString());
 
     }
 
index ba5d5babb6d117e47fbb8413ae13e8e6c19c4cf2..c169d7979954dd4eb6fa5d69853127802e00110a 100644 (file)
@@ -57,7 +57,7 @@ public class RandomLBPolicy implements ILoadBalancingPolicy {
     @Override
     public String getPoolMemberForClient(Client source, VIP dest){
 
-        rLogger.info("Received traffic from client : {} for VIP : {} ",source, dest);
+        rLogger.trace("Received traffic from client : {} for VIP : {} ",source, dest);
 
         syncWithLoadBalancerData();
 
@@ -65,14 +65,14 @@ public class RandomLBPolicy implements ILoadBalancingPolicy {
 
         if(this.clientMemberMap.containsKey(source)){
             pm= this.clientMemberMap.get(source);
-            rLogger.info("Client {} had sent traffic before,new traffic will be routed to the same pool member {}",source,pm);
+            rLogger.trace("Client {} had sent traffic before,new traffic will be routed to the same pool member {}",source,pm);
         }else{
             Pool pool = null;
             pool = this.cmgr.getPool(dest.getPoolName());
             int memberNum = this.randomGenerator.nextInt(pool.getAllMembers().size()-1);
             pm = pool.getAllMembers().get(memberNum);
             this.clientMemberMap.put(source, pm );
-            rLogger.info("Network traffic from client {} will be directed to pool member {}",pm);
+            rLogger.trace("Network traffic from client {} will be directed to pool member {}",pm);
         }
         return pm.getIp();
     }
index 1a473a7c04ea3de5f3255c2cbfabde33748db2d1..492c7a9aa7516cea197eb8ce891ffbc473aaab2b 100644 (file)
@@ -60,7 +60,7 @@ public class RoundRobinLBPolicy implements ILoadBalancingPolicy{
     @Override
     public String getPoolMemberForClient(Client source, VIP dest){
 
-        rrLogger.info("Received traffic from client : {} for VIP : {} ",source, dest);
+        rrLogger.trace("Received traffic from client : {} for VIP : {} ",source, dest);
 
         syncWithLoadBalancerData();
 
@@ -69,7 +69,7 @@ public class RoundRobinLBPolicy implements ILoadBalancingPolicy{
         if(this.clientMemberMap.containsKey(source)){
 
             pm= this.clientMemberMap.get(source);
-            rrLogger.info("Client {} had sent traffic before,new traffic will be routed to the same pool member {}",source,pm);
+            rrLogger.trace("Client {} had sent traffic before,new traffic will be routed to the same pool member {}",source,pm);
         }else{
 
             Pool pool = null;
@@ -80,7 +80,7 @@ public class RoundRobinLBPolicy implements ILoadBalancingPolicy{
                 pool = this.cmgr.getPool(dest.getPoolName());
                 pm = pool.getAllMembers().get(memberNum);
                 this.clientMemberMap.put(source, pm );
-                rrLogger.info("New client's packet will be directed to pool member {}",pm);
+                rrLogger.trace("New client's packet will be directed to pool member {}",pm);
                 memberNum++;
 
                 if(memberNum > pool.getAllMembers().size()-1){
@@ -95,7 +95,7 @@ public class RoundRobinLBPolicy implements ILoadBalancingPolicy{
                 pm = pool.getAllMembers().get(0);
                 this.clientMemberMap.put(source, pm);
 
-                rrLogger.info("Network traffic from client {} will be directed to pool member {}",pm);
+                rrLogger.trace("Network traffic from client {} will be directed to pool member {}",pm);
                 this.nextItemFromPool.put(dest, 1);
                 rrLogger.debug("Next pool member for new client of VIP is set to {}",pool.getAllMembers().get(1));
             }
index 7a3625a229ef5ae04f76de4a6eabe28feef657b7..4b3363b832d72ebbd12215d7236bba43009f4af3 100644 (file)
@@ -168,7 +168,7 @@ public class SimpleForwardingImpl implements IfNewHostNotify,
 
     private void allocateCaches() {
         if (this.clusterContainerService == null) {
-            log.info("un-initialized clusterContainerService, can't create cache");
+            log.trace("un-initialized clusterContainerService, can't create cache");
             return;
         }
 
@@ -185,7 +185,7 @@ public class SimpleForwardingImpl implements IfNewHostNotify,
     @SuppressWarnings({ "unchecked" })
     private void retrieveCaches() {
         if (this.clusterContainerService == null) {
-            log.info("un-initialized clusterContainerService, can't retrieve cache");
+            log.trace("un-initialized clusterContainerService, can't retrieve cache");
             return;
         }
 
@@ -198,7 +198,7 @@ public class SimpleForwardingImpl implements IfNewHostNotify,
 
     private void destroyCaches() {
         if (this.clusterContainerService == null) {
-            log.info("un-initialized clusterContainerService, can't destroy cache");
+            log.trace("un-initialized clusterContainerService, can't destroy cache");
             return;
         }
 
index 56df8e26bd094b82bdd8d6ddb89cec4ab249e7a9..2794109c242bc420677b1e6209bc72921a8a7f6d 100644 (file)
@@ -25,6 +25,7 @@ public class Subnet implements Cloneable, Serializable {
     private static final long serialVersionUID = 1L;
     // Key fields
     private InetAddress networkAddress;
+    private transient InetAddress subnetPrefix;
     private short subnetMaskLength;
     // Property fields
     private short vlan;
@@ -114,6 +115,7 @@ public class Subnet implements Cloneable, Serializable {
      */
     public Subnet setNetworkAddress(InetAddress networkAddress) {
         this.networkAddress = networkAddress;
+        this.subnetPrefix = null;
         return this;
     }
 
@@ -159,10 +161,12 @@ public class Subnet implements Cloneable, Serializable {
         if (ip == null) {
             return false;
         }
-        InetAddress thisPrefix = getPrefixForAddress(this.networkAddress);
+        if(subnetPrefix == null) {
+            subnetPrefix = getPrefixForAddress(this.networkAddress);
+        }
         InetAddress otherPrefix = getPrefixForAddress(ip);
         boolean isSubnetOf = true;
-        if (((thisPrefix == null) || (otherPrefix == null)) || (!thisPrefix.equals(otherPrefix)) ) {
+        if (((subnetPrefix == null) || (otherPrefix == null)) || (!subnetPrefix.equals(otherPrefix)) ) {
             isSubnetOf = false;
         }
         return isSubnetOf;
index 4b186fc4a1320b2e836236159a56deb575a96040..8808beefd7530860dfedad785c7c12e906b2d72e 100644 (file)
@@ -237,7 +237,7 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
     @SuppressWarnings({ "unchecked" })
     private void retrieveCaches() {
         if (this.clusterContainerService == null) {
-            log.info("un-initialized clusterContainerService, can't create cache");
+            log.warn("un-initialized clusterContainerService, can't create cache");
             return;
         }
 
@@ -789,7 +789,7 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
             return;
         }
 
-        log.info("Set Node {}'s Mode to {}", nodeId, cfgObject.getMode());
+        log.trace("Set Node {}'s Mode to {}", nodeId, cfgObject.getMode());
 
         if (modeChange) {
             notifyModeChange(node, cfgObject.isProactive());
index 45a8a5880b70982d83748a3e3d2392dd3e93de1f..b0570fb7f9b6eed29384ac4c0280202df1fd4a5f 100644 (file)
@@ -574,36 +574,38 @@ public class TopologyManagerImpl implements
     private TopoEdgeUpdate edgeUpdate(Edge e, UpdateType type, Set<Property> props) {
         switch (type) {
         case ADDED:
-            // Avoid redundant update as notifications trigger expensive tasks
-            if (edgesDB.containsKey(e)) {
-                log.trace("Skipping redundant edge addition: {}", e);
-                return null;
-            }
-
-            // Ensure that head node connector exists
-            if (!headNodeConnectorExist(e)) {
-                log.warn("Ignore edge that contains invalid node connector: {}", e);
-                return null;
-            }
-
-            // Check if nodeConnectors of the edge were correctly categorized
-            // by OF plugin
-            crossCheckNodeConnectors(e);
 
-            // Make sure the props are non-null
+            // Make sure the props are non-null or create a copy
             if (props == null) {
                 props = new HashSet<Property>();
             } else {
                 props = new HashSet<Property>(props);
             }
 
-            //in case of node switch-over to a different cluster controller,
-            //let's retain edge props
             Set<Property> currentProps = this.edgesDB.get(e);
-            if (currentProps != null){
+            if (currentProps != null) {
+
+                if (currentProps.equals(props)) {
+                    // Avoid redundant updates as notifications trigger expensive tasks
+                    log.trace("Skipping redundant edge addition: {}", e);
+                    return null;
+                }
+
+                // In case of node switch-over to a different cluster controller,
+                // let's retain edge props (e.g. creation time)
                 props.addAll(currentProps);
             }
 
+            // Ensure that head node connector exists
+            if (!headNodeConnectorExist(e)) {
+                log.warn("Ignore edge that contains invalid node connector: {}", e);
+                return null;
+            }
+
+            // Check if nodeConnectors of the edge were correctly categorized
+            // by protocol plugin
+            crossCheckNodeConnectors(e);
+
             // Now make sure there is the creation timestamp for the
             // edge, if not there, stamp with the first update
             boolean found_create = false;
index 5d0cbb62862d6f0e7f61be02a7d72153e0780284..5d673fbca4abb8f4ba4d5bc0f962e29d95a4608b 100644 (file)
@@ -276,18 +276,18 @@ public class UserManager implements IUserManager, IObjectReader,
                 rcResponse = aaaClient.authService(userName, password,
                         aaaServer.getAddress(), aaaServer.getSecret());
                 if (rcResponse.getStatus() == AuthResultEnum.AUTH_ACCEPT) {
-                    logger.info(
+                    logger.trace(
                             "Remote Authentication Succeeded for User: \"{}\", by Server: {}",
                             userName, aaaServer.getAddress());
                     remotelyAuthenticated = true;
                     break;
                 } else if (rcResponse.getStatus() == AuthResultEnum.AUTH_REJECT) {
-                    logger.info(
+                    logger.trace(
                             "Remote Authentication Rejected User: \"{}\", from Server: {}, Reason:{}",
                             new Object[] { userName, aaaServer.getAddress(),
                                     rcResponse.getStatus().toString() });
                 } else {
-                    logger.info(
+                    logger.trace(
                             "Remote Authentication Failed for User: \"{}\", from Server: {}, Reason:{}",
                             new Object[] { userName, aaaServer.getAddress(),
                                     rcResponse.getStatus().toString() });
@@ -684,7 +684,7 @@ public class UserManager implements IUserManager, IObjectReader,
         // Trigger cluster update
         localUserConfigList.put(user, targetConfigEntry);
 
-        logger.info("Password changed for User \"{}\"", user);
+        logger.trace("Password changed for User \"{}\"", user);
 
         return status;
     }
@@ -694,7 +694,7 @@ public class UserManager implements IUserManager, IObjectReader,
         // TODO: if user was authenticated through AAA server, send
         // Acct-Status-Type=stop message to server with logout as reason
         removeUserFromActiveList(userName);
-        logger.info("User \"{}\" logged out", userName);
+        logger.trace("User \"{}\" logged out", userName);
     }
 
     /*
@@ -705,7 +705,7 @@ public class UserManager implements IUserManager, IObjectReader,
         // TODO: if user was authenticated through AAA server, send
         // Acct-Status-Type=stop message to server with timeout as reason
         removeUserFromActiveList(userName);
-        logger.info("User \"{}\" timed out", userName);
+        logger.trace("User \"{}\" timed out", userName);
     }
 
     @Override
index 6f0957790194681be581f27ad839b2707a314015..fb252bf95ce45507f3de37ce3d4a979c1d3560ff 100644 (file)
@@ -73,7 +73,7 @@ public class DaylightWebUtil {
         } else {
             auditMsg = "Mode: " + mode + " User " + user + " "  + action + " " + moduleName + " " + resource;
         }
-        logger.info(auditMsg);
+        logger.trace(auditMsg);
     }
 
     public static void auditlog(String moduleName, String user, String action, String resource) {