Merge "md-sal: commons-codec artifact version sync"
authorEd Warnicke <eaw@cisco.com>
Thu, 23 Jan 2014 03:20:22 +0000 (03:20 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 23 Jan 2014 03:20:22 +0000 (03:20 +0000)
120 files changed:
opendaylight/arphandler/src/test/java/org/opendaylight/controller/arphandler/internal/ArphandlerTest.java
opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManager.java
opendaylight/clustering/test/src/test/java/org/opendaylight/controller/clustering/test/internal/TestClusteringTest.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/hosttracker/api/src/test/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnectorTest.java
opendaylight/hosttracker/implementation/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerTest.java
opendaylight/hosttracker_new/api/src/test/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnectorTest.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/pom.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRouterCodegenInstance.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/BindingDomConnectorDeployer.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentConnector.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerRpcTest.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-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcProvisionRegistry.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcRegistrationListener.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcRoutingContext.java
opendaylight/md-sal/sal-dom-broker/pom.xml
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/$ModuleInfo.java [deleted file]
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/MountPointImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointManagerImpl.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/RpcRouterImpl.xtend [deleted file]
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/SchemaAwareRpcBroker.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaContextProvider.java [new file with mode: 0644]
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-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RpcRouter.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ClientRequestHandlerTest.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/StatisticsProvider.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java
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/pom.xml
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/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/Util.java
opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java [new file with mode: 0644]
opendaylight/netconf/netconf-client/src/test/resources/get_schema.xml [new file with mode: 0644]
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorFactory.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-impl/src/main/java/org/opendaylight/controller/netconf/impl/util/NetconfUtil.java [deleted file]
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/pom.xml
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/NetconfUtil.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/SendErrorExceptionUtil.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/NetconfUtilTest.java [moved from opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandlerTest.java with 75% similarity]
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/conflictingversion/conflictingVersionResponse.xml [moved from opendaylight/netconf/config-persister-impl/src/test/resources/conflictingVersionResponse.xml with 100% similarity]
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/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/CommonsNorthboundTest.java
opendaylight/northbound/commons/src/test/java/org/opendaylight/controller/northbound/commons/exception/CommonsNorthboundExceptionTest.java
opendaylight/northbound/controllermanager/src/test/java/org/opendaylight/controller/controllermanager/northbound/ControllerManagerNorthboundTest.java
opendaylight/northbound/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundTest.java
opendaylight/northbound/statistics/src/test/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthboundTest.java
opendaylight/northbound/switchmanager/src/test/java/org/opendaylight/controller/switchmanager/northbound/SwitchManagerNorthboundTest.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/loadbalancer/src/test/java/org/opendaylight/controller/samples/loadbalancer/internal/LoadBalancerTest.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 19c8b4d35bd39f8a1c4ad516911ad149cfc5d9a0..892a0bc370a53e9dd930f089d24040106fb44eb5 100644 (file)
 package org.opendaylight.controller.arphandler.internal;\r
 \r
 \r
-import junit.framework.TestCase;\r
-\r
 import org.junit.Assert;\r
 import org.junit.Test;\r
 \r
-public class ArphandlerTest extends TestCase {\r
+public class ArphandlerTest  {\r
 \r
         @Test\r
         public void testArphandlerCreation() {\r
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 1142909f8562844075b3cbbf475b2a65d016738e..d143a5171a9ffbc4d907cf2aa32dc80fd83ccc50 100644 (file)
@@ -13,9 +13,7 @@ package org.opendaylight.controller.clustering.test.internal;
 import org.junit.Assert;\r
 import org.junit.Test;\r
 \r
-import junit.framework.TestCase;\r
-\r
-public class TestClusteringTest extends TestCase {\r
+public class TestClusteringTest {\r
 \r
         @Test\r
         public void testComplexClass() {\r
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 bdccc99c9c52d29801bf43c7a7ebff602a207c65..96cf308983c1444ea8e68b17fe94685af5c7baa7 100644 (file)
@@ -13,19 +13,14 @@ import java.net.UnknownHostException;
 \r
 import org.junit.Assert;\r
 import org.junit.Test;\r
-\r
 import org.opendaylight.controller.sal.core.ConstructionException;\r
 import org.opendaylight.controller.sal.core.Node;\r
-\r
-import junit.framework.TestCase;\r
-\r
+import org.opendaylight.controller.sal.core.NodeConnector;\r
 import org.opendaylight.controller.sal.packet.address.EthernetAddress;\r
-\r
 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;\r
-import org.opendaylight.controller.sal.core.NodeConnector;\r
 import org.opendaylight.controller.sal.utils.NodeCreator;\r
 \r
-public class HostNodeConnectorTest extends TestCase {\r
+public class HostNodeConnectorTest {\r
 \r
     @Test\r
     public void testHostNodeConnector() throws UnknownHostException {\r
index e222fcd7e42cdb23b5a0850f6b55fd6834deba8a..984d5d3000303865dd44465a32600fc03c9c7feb 100644 (file)
@@ -11,14 +11,12 @@ package org.opendaylight.controller.hosttracker.internal;
 import java.net.InetAddress;\r
 import java.net.UnknownHostException;\r
 \r
-import junit.framework.TestCase;\r
-\r
 import org.junit.Assert;\r
 import org.junit.Test;\r
 import org.opendaylight.controller.hosttracker.IHostId;\r
 import org.opendaylight.controller.hosttracker.IPHostId;\r
 \r
-public class HostTrackerTest extends TestCase {\r
+public class HostTrackerTest {\r
 \r
     @Test\r
     public void testHostTrackerCallable() throws UnknownHostException {\r
index 430d133ad7724024814dc232856f7c365dbd42a1..4248c6dfd0a93de3cb5ceb313e8927d8bc0de8ef 100644 (file)
@@ -13,19 +13,14 @@ import java.net.UnknownHostException;
 \r
 import org.junit.Assert;\r
 import org.junit.Test;\r
-\r
 import org.opendaylight.controller.sal.core.ConstructionException;\r
 import org.opendaylight.controller.sal.core.Node;\r
-\r
-import junit.framework.TestCase;\r
-\r
+import org.opendaylight.controller.sal.core.NodeConnector;\r
 import org.opendaylight.controller.sal.packet.address.EthernetAddress;\r
-\r
 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;\r
-import org.opendaylight.controller.sal.core.NodeConnector;\r
 import org.opendaylight.controller.sal.utils.NodeCreator;\r
 \r
-public class HostNodeConnectorTest extends TestCase {\r
+public class HostNodeConnectorTest {\r
 \r
     @Test\r
     public void testHostNodeConnector() throws UnknownHostException {\r
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 87a07369bd4ada1e0302ab46899dd2adb10cbb49..6dc91e014b5c2bab078a915984abc5f52d510f8b 100644 (file)
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal-broker-impl</artifactId>
             <version>1.0-SNAPSHOT</version>
-            <scope>runtime</scope>
+            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
index d976a0cec9ac7e828b9877001d0847e4cc29dab9..4f994e5673a2c80896d8c5168af4d0c299ee7bcf 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.binding.codegen.impl;
 
 import org.opendaylight.yangtools.yang.binding.RpcService;
@@ -5,6 +12,7 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcR
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
+import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
@@ -125,6 +133,7 @@ public class RpcRouterCodegenInstance<T extends RpcService> implements //
     @Override
     public RpcRegistration<T> registerDefaultService(T service) {
         // TODO Auto-generated method stub
+        RuntimeCodeHelper.setDelegate(invocationProxy, service);
         return null;
     }
 
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 8773476caee9ee4fd01f7b75b3b128bb331e3edd..f93457110181967063ec64c27a3f29c026320121 100644 (file)
@@ -1,5 +1,13 @@
+/*
+ * 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.binding.impl;
 
+import java.util.EventListener;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.HashMap;
@@ -42,11 +50,14 @@ public class RpcProviderRegistryImpl implements //
     private final Map<Class<? extends RpcService>, RpcRouter<?>> rpcRouters = new WeakHashMap<>();
     private final ListenerRegistry<RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> routeChangeListeners = ListenerRegistry
             .create();
+    private final ListenerRegistry<RouterInstantiationListener> routerInstantiationListener = ListenerRegistry.create();
 
     private final static Logger LOG = LoggerFactory.getLogger(RpcProviderRegistryImpl.class);
-    
+
     private final String name;
 
+    private ListenerRegistry<GlobalRpcRegistrationListener> globalRpcListeners = ListenerRegistry.create();
+
     public String getName() {
         return name;
     }
@@ -75,8 +86,9 @@ public class RpcProviderRegistryImpl implements //
         T publicProxy = getRpcService(type);
         RpcService currentDelegate = RuntimeCodeHelper.getDelegate(publicProxy);
         checkState(currentDelegate == null, "Rpc service is already registered");
-        LOG.debug("Registering {} as global implementation of {} in {}",implementation,type.getSimpleName(),this);
+        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);
     }
 
@@ -89,46 +101,84 @@ public class RpcProviderRegistryImpl implements //
         if (potentialProxy != null) {
             return potentialProxy;
         }
-        synchronized(this) {
+        synchronized (this) {
             /**
-             * Potential proxy could be instantiated by other thread while we were
-             * waiting for the lock.
+             * Potential proxy could be instantiated by other thread while we
+             * were waiting for the lock.
              */
-            
+
             potentialProxy = (T) publicProxies.get(type);
             if (potentialProxy != null) {
                 return (T) potentialProxy;
             }
             T proxy = rpcFactory.getDirectProxyFor(type);
-            LOG.debug("Created {} as public proxy for {} in {}",proxy,type.getSimpleName(),this);
+            LOG.debug("Created {} as public proxy for {} in {}", proxy, type.getSimpleName(), this);
             publicProxies.put(type, proxy);
             return proxy;
         }
     }
 
-    private <T extends RpcService> RpcRouter<T> getRpcRouter(Class<T> type) {
+    @SuppressWarnings("unchecked")
+    public <T extends RpcService> RpcRouter<T> getRpcRouter(Class<T> type) {
         RpcRouter<?> potentialRouter = rpcRouters.get(type);
         if (potentialRouter != null) {
             return (RpcRouter<T>) potentialRouter;
         }
-        synchronized(this) {
+        synchronized (this) {
             /**
-             * Potential Router could be instantiated by other thread while we were
-             * waiting for the lock.
+             * Potential Router could be instantiated by other thread while we
+             * were waiting for the lock.
              */
-            potentialRouter = rpcRouters.get(type); 
+            potentialRouter = rpcRouters.get(type);
             if (potentialRouter != null) {
                 return (RpcRouter<T>) potentialRouter;
             }
-            RpcRouter<T> router = rpcFactory.getRouterFor(type,name);
+            RpcRouter<T> router = rpcFactory.getRouterFor(type, name);
             router.registerRouteChangeListener(new RouteChangeForwarder(type));
-            LOG.debug("Registering router {} as global implementation of {} in {}",router,type.getSimpleName(),this);
+            LOG.debug("Registering router {} as global implementation of {} in {}", router, type.getSimpleName(), this);
             RuntimeCodeHelper.setDelegate(getRpcService(type), router.getInvocationProxy());
             rpcRouters.put(type, router);
+            notifyListenersRoutedCreated(router);
             return router;
         }
     }
 
+    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) {
+            try {
+                listener.getInstance().onRpcRouterCreated(router);
+            } catch (Exception e) {
+                LOG.error("Unhandled exception during invoking listener {}", e);
+            }
+        }
+
+    }
+
+    public ListenerRegistration<RouterInstantiationListener> registerRouterInstantiationListener(
+            RouterInstantiationListener listener) {
+        ListenerRegistration<RouterInstantiationListener> reg = routerInstantiationListener.register(listener);
+        try {
+            for (RpcRouter<?> router : rpcRouters.values()) {
+                listener.onRpcRouterCreated(router);
+            }
+        } catch (Exception e) {
+            LOG.error("Unhandled exception during invoking listener {}", e);
+        }
+        return reg;
+    }
+
     @Override
     public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
             L listener) {
@@ -143,6 +193,20 @@ public class RpcProviderRegistryImpl implements //
         this.rpcFactory = rpcFactory;
     }
 
+    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 f200b4d08dc6c955b18ad5a04f639884db3f978a..72b96b22d1226a16f9bc0f76d5b56cebd107446b 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.binding.impl.connect.dom;
 
 import static com.google.common.base.Preconditions.checkNotNull;
index 75b0138e7cd75657adba42182d0dc7e0cf9c270c..5d48548efd816dfb200039c12d3a948e0638f200 100644 (file)
@@ -1,10 +1,22 @@
+/*
+ * 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.binding.impl.connect.dom;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+
 import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashSet;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -28,13 +40,16 @@ import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublishe
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 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.api.rpc.RpcContextIdentifier;
+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;
-import org.opendaylight.controller.sal.core.api.Provider;
 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.core.api.Provider;
 import org.opendaylight.controller.sal.core.api.RpcImplementation;
 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
 import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
@@ -54,15 +69,18 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
-
-import static com.google.common.base.Preconditions.*;
+import com.google.common.collect.ImmutableSet.Builder;
+import com.google.common.util.concurrent.Futures;
 
 public class BindingIndependentConnector implements //
         RuntimeDataProvider, //
@@ -71,11 +89,15 @@ public class BindingIndependentConnector implements //
 
     private final Logger LOG = LoggerFactory.getLogger(BindingIndependentConnector.class);
 
+    @SuppressWarnings( "deprecation")
     private static final InstanceIdentifier<? extends DataObject> ROOT = InstanceIdentifier.builder().toInstance();
 
     private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier ROOT_BI = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
             .builder().toInstance();
 
+    private final static Method EQUALS_METHOD;
+    
+    
     private BindingIndependentMappingService mappingService;
 
     private org.opendaylight.controller.sal.core.api.data.DataProviderService biDataService;
@@ -116,18 +138,33 @@ public class BindingIndependentConnector implements //
 
     private boolean notificationForwarding = false;
 
+    private RpcProviderRegistryImpl baRpcRegistryImpl;
+
+    private org.opendaylight.controller.sal.dom.broker.spi.RpcRouter biRouter;
+    
+    
+    static {
+        try {
+        EQUALS_METHOD = Object.class.getMethod("equals", Object.class);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     @Override
     public DataObject readOperationalData(InstanceIdentifier<? extends DataObject> path) {
         try {
             org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath = mappingService.toDataDom(path);
             CompositeNode result = biDataService.readOperationalData(biPath);
-            return potentialAugmentationRead(path,biPath,result);
+            return potentialAugmentationRead(path, biPath, result);
         } catch (DeserializationException e) {
             throw new IllegalStateException(e);
         }
     }
 
-    private DataObject potentialAugmentationRead(InstanceIdentifier<? extends DataObject> path, org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath, CompositeNode result) throws DeserializationException {
+    private DataObject potentialAugmentationRead(InstanceIdentifier<? extends DataObject> path,
+            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath, CompositeNode result)
+            throws DeserializationException {
         Class<? extends DataObject> targetType = path.getTargetType();
         if (Augmentation.class.isAssignableFrom(targetType)) {
             path = mappingService.fromDataDom(biPath);
@@ -145,7 +182,7 @@ public class BindingIndependentConnector implements //
         try {
             org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath = mappingService.toDataDom(path);
             CompositeNode result = biDataService.readConfigurationData(biPath);
-            return potentialAugmentationRead(path,biPath,result);
+            return potentialAugmentationRead(path, biPath, result);
         } catch (DeserializationException e) {
             throw new IllegalStateException(e);
         }
@@ -154,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;
     }
@@ -255,15 +297,23 @@ public class BindingIndependentConnector implements //
         baDataService.registerCommitHandlerListener(domToBindingCommitHandler);
         dataForwarding = true;
     }
-    
+
     public void startRpcForwarding() {
         if (baRpcRegistry != null && biRpcRegistry != null && baRpcRegistry instanceof RouteChangePublisher<?, ?>) {
-            checkState(!rpcForwarding,"Connector is already forwarding RPCs");
+            checkState(!rpcForwarding, "Connector is already forwarding RPCs");
             domToBindingRpcManager = baRpcRegistry.registerRouteChangeListener(new DomToBindingRpcForwardingManager());
+            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;
+            }
             rpcForwarding = true;
         }
     }
-    
+
     public void startNotificationForwarding() {
         checkState(!notificationForwarding, "Connector is already forwarding notifications.");
         notificationForwarding = true;
@@ -282,7 +332,7 @@ public class BindingIndependentConnector implements //
     public void onSessionInitiated(ProviderSession session) {
         setDomDataService(session.getService(org.opendaylight.controller.sal.core.api.data.DataProviderService.class));
         setDomRpcRegistry(session.getService(RpcProvisionRegistry.class));
-        
+
     }
 
     public <T extends RpcService> void onRpcRouterCreated(Class<T> serviceType, RpcRouter<T> router) {
@@ -401,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;
         }
@@ -441,16 +491,48 @@ 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;
         }
     }
 
+    /**
+     * Manager responsible for instantiating forwarders responsible for
+     * forwarding of RPC invocations from DOM Broker to Binding Aware Broker
+     * 
+     */
     private class DomToBindingRpcForwardingManager implements
-            RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>> {
+            RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>,
+            RouterInstantiationListener,
+            GlobalRpcRegistrationListener {
 
         private final Map<Class<? extends RpcService>, DomToBindingRpcForwarder> forwarders = new WeakHashMap<>();
+        private RpcProviderRegistryImpl registryImpl;
+
+        public RpcProviderRegistryImpl getRegistryImpl() {
+            return registryImpl;
+        }
+
+        public void setRegistryImpl(RpcProviderRegistryImpl registryImpl) {
+            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) {
+            Class<? extends BaseIdentity> ctx = router.getContexts().iterator().next();
+            getRpcForwarder(router.getServiceType(), ctx);
+        }
 
         @Override
         public void onRouteChange(RouteChange<RpcContextIdentifier, InstanceIdentifier<?>> change) {
@@ -478,35 +560,61 @@ public class BindingIndependentConnector implements //
             } else {
                 potential = new DomToBindingRpcForwarder(service, context);
             }
+
             forwarders.put(service, potential);
             return potential;
         }
 
     }
 
-    private class DomToBindingRpcForwarder implements RpcImplementation {
+    private class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
 
         private final Set<QName> supportedRpcs;
         private final WeakReference<Class<? extends RpcService>> rpcServiceType;
         private Set<org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration> registrations;
+        private Map<QName, RpcInvocationStrategy> strategiesByQName = new HashMap<>();
+        private WeakHashMap<Method, RpcInvocationStrategy> strategiesByMethod = new WeakHashMap<>();
 
         public DomToBindingRpcForwarder(Class<? extends RpcService> service) {
             this.rpcServiceType = new WeakReference<Class<? extends RpcService>>(service);
             this.supportedRpcs = mappingService.getRpcQNamesFor(service);
-            for (QName rpc : supportedRpcs) {
-                biRpcRegistry.addRpcImplementation(rpc, this);
+            try {
+                for (QName rpc : supportedRpcs) {
+                    RpcInvocationStrategy strategy = createInvocationStrategy(rpc, service);
+                    strategiesByMethod.put(strategy.targetMethod, strategy);
+                    strategiesByQName.put(rpc, strategy);
+                    biRpcRegistry.addRpcImplementation(rpc, this);
+                }
+
+            } catch (Exception e) {
+                LOG.error("Could not forward Rpcs of type {}", service.getName());
             }
             registrations = ImmutableSet.of();
         }
 
+        /**
+         * Constructor for Routed RPC Forwareder.
+         * 
+         * @param service
+         * @param context
+         */
         public DomToBindingRpcForwarder(Class<? extends RpcService> service, Class<? extends BaseIdentity> context) {
             this.rpcServiceType = new WeakReference<Class<? extends RpcService>>(service);
             this.supportedRpcs = mappingService.getRpcQNamesFor(service);
-            registrations = new HashSet<>();
-            for (QName rpc : supportedRpcs) {
-                registrations.add(biRpcRegistry.addRoutedRpcImplementation(rpc, this));
+            Builder<RoutedRpcRegistration> registrationsBuilder = ImmutableSet
+                    .<org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration> builder();
+            try {
+                for (QName rpc : supportedRpcs) {
+                    RpcInvocationStrategy strategy = createInvocationStrategy(rpc, service);
+                    strategiesByMethod.put(strategy.targetMethod, strategy);
+                    strategiesByQName.put(rpc, strategy);
+                    registrationsBuilder.add(biRpcRegistry.addRoutedRpcImplementation(rpc, this));
+                }
+                createDefaultDomForwarder();
+            } catch (Exception e) {
+                LOG.error("Could not forward Rpcs of type {}", service.getName(),e);
             }
-            registrations = ImmutableSet.copyOf(registrations);
+            registrations = registrationsBuilder.build();
         }
 
         public void registerPaths(Class<? extends BaseIdentity> context, Class<? extends RpcService> service,
@@ -520,6 +628,22 @@ public class BindingIndependentConnector implements //
             }
         }
 
+        
+        @Override
+        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+            if(EQUALS_METHOD.equals(method)) {
+                return false;
+            }
+            RpcInvocationStrategy strategy = strategiesByMethod.get(method);
+            checkState(strategy != null);
+            checkArgument(args.length <= 2);
+            if(args.length == 1) {
+                checkArgument(args[0] instanceof DataObject);
+                return strategy.forwardToDomBroker((DataObject) args[0]);
+            }
+            return strategy.forwardToDomBroker(null);
+        }
+
         public void removePaths(Class<? extends BaseIdentity> context, Class<? extends RpcService> service,
                 Set<InstanceIdentifier<?>> set) {
             QName ctx = BindingReflections.findQName(context);
@@ -536,6 +660,18 @@ public class BindingIndependentConnector implements //
             return supportedRpcs;
         }
 
+        @SuppressWarnings({ "unchecked", "rawtypes" })
+        public void createDefaultDomForwarder() {
+            if (baRpcRegistryImpl != null) {
+                Class<?> cls = rpcServiceType.get();
+                ClassLoader clsLoader = cls.getClassLoader();
+                RpcService proxy = (RpcService) Proxy.newProxyInstance(clsLoader, new Class<?>[] { cls }, this);
+                
+                RpcRouter rpcRouter = baRpcRegistryImpl.getRpcRouter(rpcServiceType.get());
+                rpcRouter.registerDefaultService(proxy);
+            }
+        }
+
         @Override
         public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode domInput) {
             checkArgument(rpc != null);
@@ -547,13 +683,17 @@ public class BindingIndependentConnector implements //
             checkState(rpcService != null);
             CompositeNode domUnwrappedInput = domInput.getFirstCompositeByName(QName.create(rpc, "input"));
             try {
-                return resolveInvocationStrategy(rpc, rpcType).invokeOn(rpcService, domUnwrappedInput);
+                return resolveInvocationStrategy(rpc).invokeOn(rpcService, domUnwrappedInput);
             } catch (Exception e) {
                 throw new IllegalStateException(e);
             }
         }
 
-        private RpcInvocationStrategy resolveInvocationStrategy(final QName rpc,
+        private RpcInvocationStrategy resolveInvocationStrategy(QName rpc) {
+            return strategiesByQName.get(rpc);
+        }
+
+        private RpcInvocationStrategy createInvocationStrategy(final QName rpc,
                 final Class<? extends RpcService> rpcType) throws Exception {
             return ClassLoaderUtils.withClassLoader(rpcType.getClassLoader(), new Callable<RpcInvocationStrategy>() {
                 @Override
@@ -575,9 +715,9 @@ public class BindingIndependentConnector implements //
                     RpcInvocationStrategy strategy = null;
                     if (outputClass.isPresent()) {
                         if (inputClass.isPresent()) {
-                            strategy = new DefaultInvocationStrategy(targetMethod, outputClass.get(), inputClass.get());
+                            strategy = new DefaultInvocationStrategy(rpc,targetMethod, outputClass.get(), inputClass.get());
                         } else {
-                            strategy = new NoInputNoOutputInvocationStrategy(targetMethod);
+                            strategy = new NoInputNoOutputInvocationStrategy(rpc,targetMethod);
                         }
                     } else {
                         strategy = null;
@@ -592,11 +732,15 @@ public class BindingIndependentConnector implements //
     private abstract class RpcInvocationStrategy {
 
         protected final Method targetMethod;
+        protected final QName rpc;
 
-        public RpcInvocationStrategy(Method targetMethod) {
+        public RpcInvocationStrategy(QName rpc,Method targetMethod) {
             this.targetMethod = targetMethod;
+            this.rpc = rpc;
         }
 
+        public abstract Future<RpcResult<?>> forwardToDomBroker(DataObject input);
+
         public abstract RpcResult<CompositeNode> uncheckedInvoke(RpcService rpcService, CompositeNode domInput)
                 throws Exception;
 
@@ -614,9 +758,9 @@ public class BindingIndependentConnector implements //
         private WeakReference<Class> outputClass;
 
         @SuppressWarnings({ "rawtypes", "unchecked" })
-        public DefaultInvocationStrategy(Method targetMethod, Class<?> outputClass,
+        public DefaultInvocationStrategy(QName rpc, Method targetMethod, Class<?> outputClass,
                 Class<? extends DataContainer> inputClass) {
-            super(targetMethod);
+            super(rpc,targetMethod);
             this.outputClass = new WeakReference(outputClass);
             this.inputClass = new WeakReference(inputClass);
         }
@@ -631,13 +775,29 @@ public class BindingIndependentConnector implements //
             RpcResult<?> bindingResult = result.get();
             return Rpcs.getRpcResult(true);
         }
+        
+        @Override
+        public Future<RpcResult<?>> forwardToDomBroker(DataObject input) {
+            if(biRouter != null) { 
+                CompositeNode xml = mappingService.toDataDom(input);
+                CompositeNode wrappedXml = ImmutableCompositeNode.create(rpc,ImmutableList.<Node<?>>of(xml));
+                RpcResult<CompositeNode> result = biRouter.invokeRpc(rpc, wrappedXml);
+                Object baResultValue = null;
+                if(result.getResult() != null) {
+                    baResultValue = mappingService.dataObjectFromDataDom(outputClass.get(), result.getResult());
+                }
+                RpcResult<?> baResult = Rpcs.getRpcResult(result.isSuccessful(), baResultValue, result.getErrors());
+                return Futures.<RpcResult<?>>immediateFuture(baResult);
+            }
+            return Futures.<RpcResult<?>>immediateFuture(Rpcs.getRpcResult(false));
+        }
 
     }
 
     private class NoInputNoOutputInvocationStrategy extends RpcInvocationStrategy {
 
-        public NoInputNoOutputInvocationStrategy(Method targetMethod) {
-            super(targetMethod);
+        public NoInputNoOutputInvocationStrategy(QName rpc, Method targetMethod) {
+            super(rpc,targetMethod);
         }
 
         public RpcResult<CompositeNode> uncheckedInvoke(RpcService rpcService, CompositeNode domInput) throws Exception {
@@ -646,6 +806,11 @@ public class BindingIndependentConnector implements //
             RpcResult<Void> bindingResult = result.get();
             return Rpcs.getRpcResult(bindingResult.isSuccessful(), bindingResult.getErrors());
         }
+        
+        @Override
+        public Future<RpcResult<?>> forwardToDomBroker(DataObject input) {
+            return Futures.immediateFuture(null);
+        }
     }
 
     public boolean isRpcForwarding() {
index c03d851f5c9ef740a14a9097feceaf8909833184..37a9c27d37a71b177668ad0724ead529c101b327 100644 (file)
@@ -36,8 +36,9 @@ import org.opendaylight.controller.sal.dom.broker.BrokerImpl;
 import org.opendaylight.controller.sal.dom.broker.MountPointManagerImpl;
 import org.opendaylight.controller.sal.dom.broker.impl.DataStoreStatsWrapper;
 import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore;
-import org.opendaylight.controller.sal.dom.broker.impl.RpcRouterImpl;
 import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -58,7 +59,7 @@ import com.google.common.util.concurrent.MoreExecutors;
 
 import static com.google.common.base.Preconditions.*;
 
-public class BindingTestContext implements AutoCloseable {
+public class BindingTestContext implements AutoCloseable, SchemaContextProvider {
 
     public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier TREE_ROOT = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
             .builder().toInstance();
@@ -88,6 +89,12 @@ public class BindingTestContext implements AutoCloseable {
 
     private MountPointManagerImpl biMountImpl;
 
+    private SchemaContext schemaContext;
+
+    public SchemaContext getSchemaContext() {
+        return schemaContext;
+    }
+
     protected BindingTestContext(ListeningExecutorService executor, ClassPool classPool, boolean startWithSchema) {
         this.executor = executor;
         this.classPool = classPool;
@@ -218,12 +225,12 @@ public class BindingTestContext implements AutoCloseable {
     }
 
     public void updateYangSchema(String[] files) {
-        SchemaContext context = getContext(files);
+        schemaContext = getContext(files);
         if (schemaAwareDataStore != null) {
-            schemaAwareDataStore.onGlobalContextUpdated(context);
+            schemaAwareDataStore.onGlobalContextUpdated(schemaContext);
         }
         if (mappingServiceImpl != null) {
-            mappingServiceImpl.onGlobalContextUpdated(context);
+            mappingServiceImpl.onGlobalContextUpdated(schemaContext);
         }
     }
 
@@ -275,7 +282,7 @@ public class BindingTestContext implements AutoCloseable {
         checkState(executor != null);
         biBrokerImpl = new BrokerImpl();
         biBrokerImpl.setExecutor(executor);
-        biBrokerImpl.setRouter(new RpcRouterImpl("test"));
+        biBrokerImpl.setRouter(new SchemaAwareRpcBroker("/", this));
     }
 
     public void startBindingNotificationBroker() {
index 92a0a3a98dab8e1075a893f0af0e6730992f56cc..b1547b66a763d690aee4aee76226bf9659d7ac53 100644 (file)
@@ -1,13 +1,25 @@
+/*
+ * 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.binding.test.connect.dom;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNotSame;
+import static junit.framework.Assert.assertTrue;
+
 import java.math.BigInteger;
 import java.util.Collections;
+import java.util.Set;
 import java.util.concurrent.Future;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
 import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
@@ -19,19 +31,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddF
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlowRemoved;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
-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.inventory.rev130819.NodeContext;
 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.yangtools.yang.binding.BaseIdentity;
+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.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -40,11 +47,8 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
 
-import static junit.framework.Assert.*;
-
-import com.google.common.collect.HashMultimap;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Multimap;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
 
@@ -60,6 +64,9 @@ public class CrossBrokerRpcTest {
     public static final NodeId NODE_B = new NodeId("b");
     public static final NodeId NODE_C = new NodeId("c");
     public static final NodeId NODE_D = new NodeId("d");
+    
+    private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
+    private static final QName ADD_FLOW_QNAME = QName.create(NodeFlowRemoved.QNAME, "add-flow");
 
     public static final InstanceIdentifier<Node> BA_NODE_A_ID = createBANodeIdentifier(NODE_A);
     public static final InstanceIdentifier<Node> BA_NODE_B_ID = createBANodeIdentifier(NODE_B);
@@ -71,10 +78,7 @@ public class CrossBrokerRpcTest {
     public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_NODE_C_ID = createBINodeIdentifier(NODE_C);
     public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_NODE_D_ID = createBINodeIdentifier(NODE_D);
 
-    private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
-    private static final QName ADD_FLOW_QNAME = QName.create(NodeFlowRemoved.QNAME, "add-flow");
-    private static final QName REMOVE_FLOW_QNAME = QName.create(NodeFlowRemoved.QNAME, "remove-flow");
-    private static final QName UPDATE_FLOW_QNAME = QName.create(NodeFlowRemoved.QNAME, "update-flow");
+    
 
     @Before
     public void setup() {
@@ -117,8 +121,29 @@ public class CrossBrokerRpcTest {
         assertEquals(addFlowA, flowService.getReceivedAddFlows().get(BA_NODE_A_ID).iterator().next());
     }
 
-    public void bindingRpcInvoker_DomRoutedProviderTest() {
-
+    @Test
+    public void bindingRpcInvoker_DomRoutedProviderTest() throws Exception {
+        AddFlowOutputBuilder builder = new AddFlowOutputBuilder();
+        builder.setTransactionId(new TransactionId(BigInteger.valueOf(10)));
+        final AddFlowOutput output = builder.build();
+        org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration registration = biRpcRegistry.addRoutedRpcImplementation(ADD_FLOW_QNAME, new RpcImplementation() {
+            @Override
+            public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input) {
+                CompositeNode result = testContext.getBindingToDomMappingService().toDataDom(output);
+                return Rpcs.getRpcResult(true, result, ImmutableList.<RpcError>of());
+            }
+
+            @Override
+            public Set<QName> getSupportedRpcs() {
+                return ImmutableSet.of(ADD_FLOW_QNAME);
+            }
+        });
+        registration.registerPath(NodeContext.QNAME, BI_NODE_C_ID);
+        
+        SalFlowService baFlowInvoker = baRpcRegistry.getRpcService(SalFlowService.class);
+        Future<RpcResult<AddFlowOutput>> baResult = baFlowInvoker.addFlow(addFlow(BA_NODE_C_ID).setPriority(500).build());
+        assertNotNull(baResult);
+        assertEquals(output,baResult.get().getResult());
     }
 
     private CompositeNode toDomRpcInput(DataObject addFlowA) {
index 32e59b869e20de484e4f1c27028698e1d8b05a49..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
@@ -324,6 +324,8 @@ package class TwoPhaseCommit<P extends Path<P>, D, DCL extends DataChangeListene
 \r
 public abstract class AbstractDataTransaction<P extends Path<P>, D> extends AbstractDataModification<P, D> {\r
 \r
+    private static val LOG = LoggerFactory.getLogger(AbstractDataTransaction);
+
     @Property\r
     private val Object identifier;\r
 \r
@@ -336,6 +338,7 @@ public abstract class AbstractDataTransaction<P extends Path<P>, D> extends Abst
         _identifier = identifier;\r
         broker = dataBroker;\r
         status = TransactionStatus.NEW;\r
+        LOG.debug("Transaction {} Allocated.", identifier);
 \r
     //listeners = new ListenerRegistry<>();\r
     }\r
@@ -393,6 +396,7 @@ public abstract class AbstractDataTransaction<P extends Path<P>, D> extends Abst
     protected abstract def void onStatusChange(TransactionStatus status);\r
 \r
     public def changeStatus(TransactionStatus status) {\r
+        LOG.debug("Transaction {} transitioned from {} to {}", identifier, this.status, status);
         this.status = status;\r
         onStatusChange(status);\r
     }\r
index 951d5b142e76561485c5cd7f52e12fb84a462cce..faac6501c93c56a2bfbe7be90373faaead36e662 100644 (file)
@@ -1,10 +1,13 @@
 package org.opendaylight.controller.sal.core.api;
 
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
 import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 
-public interface RpcProvisionRegistry extends BrokerService {
+public interface RpcProvisionRegistry extends BrokerService, RouteChangePublisher<RpcRoutingContext, InstanceIdentifier> {
 
     /**
      * Registers an implementation of the rpc.
@@ -28,6 +31,8 @@ public interface RpcProvisionRegistry extends BrokerService {
      */
     RpcRegistration addRpcImplementation(QName rpcType, RpcImplementation implementation)
             throws IllegalArgumentException;
+    
+    ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(RpcRegistrationListener listener);
 
     RoutedRpcRegistration addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation);
 }
index 49b2f450a42840b3736963321bbcd9b9b75467e7..2ba5c4ba20377323f165542301d97153135df17b 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.core.api;
 
 import java.util.EventListener;
index 1680c1927707009a6dc3f147aa0a6bc9322aabdc..64195303e80b1ab6883acef8d12bd8c7940b501a 100644 (file)
@@ -5,14 +5,75 @@
  * 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.core.api;
 
+import java.io.Serializable;
+
+import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public interface RpcRoutingContext {
+public class RpcRoutingContext implements Immutable, Serializable {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -9079324728075883325L;
+    
+    private final QName context;
+    private final QName rpc;
+    
+    
+    private RpcRoutingContext(QName context, QName rpc) {
+        super();
+        this.context = context;
+        this.rpc = rpc;
+    }
+    
+    public static final RpcRoutingContext create(QName context, QName rpc) {
+        return new RpcRoutingContext(context, rpc);
+    }
+
+    public QName getContext() {
+        return context;
+    }
+
+    public QName getRpc() {
+        return rpc;
+    }
+
+    @Override
+    public String toString() {
+        return "RpcRoutingContext [context=" + context + ", rpc=" + rpc + "]";
+    }
 
-  public QName getContext();
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((context == null) ? 0 : context.hashCode());
+        result = prime * result + ((rpc == null) ? 0 : rpc.hashCode());
+        return result;
+    }
 
-  public QName getRpcType();
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        RpcRoutingContext other = (RpcRoutingContext) obj;
+        if (context == null) {
+            if (other.context != null)
+                return false;
+        } else if (!context.equals(other.context))
+            return false;
+        if (rpc == null) {
+            if (other.rpc != null)
+                return false;
+        } else if (!rpc.equals(other.rpc))
+            return false;
+        return true;
+    }
 }
index 949d59c49adbc984261cd24cfd1ec9681c468571..5c53f7685347ae57208ed1aca42a9b379920b05e 100644 (file)
                 <configuration>
                     <instructions>
                         <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                        <Export-Package>
+                            org.opendaylight.controller.sal.dom.broker.spi
+                        </Export-Package>
                         <Private-Package>
-                            org.opendaylight.controller.sal.dom.broker.*,
-                            org.opendaylight.controller.config.yang.md.sal.dom.impl
+                            org.opendaylight.controller.sal.dom.broker,
+                            org.opendaylight.controller.sal.dom.broker.impl,
+                            org.opendaylight.controller.sal.dom.broker.osgi,
+                            org.opendaylight.controller.config.yang.md.sal.dom.impl,
+                            org.opendaylight.controller.config.yang.md.sal.dom.statistics,
+                            org.opendaylight.yangtools.yang.util
                         </Private-Package>
                         <Import-Package>
                             *
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;
     }
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/$ModuleInfo.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/$ModuleInfo.java
deleted file mode 100644 (file)
index 3cc5a61..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.opendaylight.controller.sal.dom.broker;
-
-public class $ModuleInfo {
-
-    
-}
index dc116ca9795537e9d97a7e8de7fac804cda8b041..b5737a5454e2f12ec230233055e23cccac5675e5 100644 (file)
@@ -1,71 +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.RpcRouterImpl
+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);
-        
-        broker.setRouter(new RpcRouterImpl("Rpc router"))
-        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("/", 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() {
@@ -75,5 +79,5 @@ class BrokerConfigActivator implements AutoCloseable {
         mountReg?.unregister();
         mountProviderReg?.unregister();
     }
-    
-}
\ No newline at end of file
+
+}
index 8f179987b9c769e9fb6bab288b4063f40bd3b873..aa5138a04db226d777c70dbd8ece6d3df5b77736 100644 (file)
@@ -31,6 +31,9 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration
 import org.opendaylight.controller.sal.core.api.RpcRegistrationListener
 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry
 import org.opendaylight.controller.sal.core.api.RpcImplementation
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener
+import org.opendaylight.controller.sal.core.api.RpcRoutingContext
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
 
 public class BrokerImpl implements Broker, RpcProvisionRegistry, AutoCloseable {
     private static val log = LoggerFactory.getLogger(BrokerImpl);
@@ -54,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);
@@ -125,4 +128,12 @@ public class BrokerImpl implements Broker, RpcProvisionRegistry, AutoCloseable {
         router.addRoutedRpcImplementation(rpcType,implementation);
     }
     
+    override addRpcRegistrationListener(RpcRegistrationListener listener) {
+        return router.addRpcRegistrationListener(listener);
+    }
+    
+    override <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> registerRouteChangeListener(L listener) {
+        return router.registerRouteChangeListener(listener);
+    }
+    
 }
index b4fccff3b0fe745ae71088942ed05e92429f5e0e..5a3e060a3c9a52a2c55b4876b283ec5559de63e5 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.util.List;
@@ -8,34 +15,34 @@ import org.opendaylight.controller.md.sal.common.api.RegistrationListener;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandlerRegistration;
 import org.opendaylight.controller.md.sal.common.api.data.DataReader;
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
 import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
-import org.opendaylight.controller.sal.core.api.RpcImplementation;
 import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
 import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
+import org.opendaylight.controller.sal.core.api.RpcRoutingContext;
 import org.opendaylight.controller.sal.core.api.data.DataChangeListener;
 import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
 import org.opendaylight.controller.sal.core.api.data.DataValidator;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
-import org.opendaylight.controller.sal.dom.broker.impl.DataReaderRouter;
 import org.opendaylight.controller.sal.dom.broker.impl.NotificationRouterImpl;
-import org.opendaylight.controller.sal.dom.broker.impl.RpcRouterImpl;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider;
 import org.opendaylight.controller.sal.dom.broker.spi.NotificationRouter;
-import org.opendaylight.controller.sal.dom.broker.spi.RpcRouter;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.InstanceIdentifierBuilder;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-public class MountPointImpl implements MountProvisionInstance {
+public class MountPointImpl implements MountProvisionInstance, SchemaContextProvider {
 
-    private final RpcRouter rpcs;
+    private final SchemaAwareRpcBroker rpcs;
     private final DataBrokerImpl dataReader;
     private final NotificationRouter notificationRouter;
     private final DataReader<InstanceIdentifier,CompositeNode> readWrapper;
@@ -47,7 +54,7 @@ public class MountPointImpl implements MountProvisionInstance {
 
     public MountPointImpl(InstanceIdentifier path) {
         this.mountPath = path;
-        rpcs = new RpcRouterImpl("");
+        rpcs = new SchemaAwareRpcBroker(path.toString(),this);
         dataReader = new DataBrokerImpl();
         notificationRouter = new NotificationRouterImpl();
         readWrapper = new ReadWrapper();
@@ -118,7 +125,6 @@ public class MountPointImpl implements MountProvisionInstance {
 
     @Override
     public Future<RpcResult<CompositeNode>> rpc(QName type, CompositeNode input) {
-        // TODO Auto-generated method stub
         return null;
     }
 
@@ -207,4 +213,10 @@ public class MountPointImpl implements MountProvisionInstance {
             RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>> commitHandlerListener) {
         return dataReader.registerCommitHandlerListener(commitHandlerListener);
     }
+
+    @Override
+    public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
+            L listener) {
+        return rpcs.registerRouteChangeListener(listener);
+    }
 }
index 5d441bddbd0f23e263c452695da13afe9ecacc3e..c3bc88ed5e4acc55a85cc3829e743ed107150174 100644 (file)
@@ -35,8 +35,8 @@ class MountPointManagerImpl implements MountProvisionService {
     }
     
     def registerMountPoint(MountPointImpl impl) {
-        dataBroker?.registerConfigurationReader(impl.mountPath,impl.readWrapper);
-        dataBroker?.registerOperationalReader(impl.mountPath,impl.readWrapper);
+        //dataBroker?.registerConfigurationReader(impl.mountPath,impl.readWrapper);
+        //dataBroker?.registerOperationalReader(impl.mountPath,impl.readWrapper);
         
     }
     
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 a6c1c508aaa7327b7a008975dd50aa9c3b09ae9a..428521b72f28bfbb719a3bd0fe4f214e5766b46f 100644 (file)
@@ -1,68 +1,61 @@
+/*
+ * 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.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, //
         SchemaService, //
         ServiceTrackerCustomizer<SchemaServiceListener, SchemaServiceListener>, //
         AutoCloseable {
     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;
     }
@@ -71,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;
     }
@@ -88,47 +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();
     }
 
-    public SchemaContext getGlobalContext() {
-        return getSchemaContextSnapshot();
+    @Override
+    public SchemaContext getSchemaContext() {
+        return getGlobalContext();
     }
 
-    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();
     }
 
@@ -139,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) {
@@ -216,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);
         }
 
@@ -264,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();
         }
     }
 
@@ -313,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.
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/RpcRouterImpl.xtend b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/RpcRouterImpl.xtend
deleted file mode 100644 (file)
index 5ee19a0..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.opendaylight.controller.sal.dom.broker.impl
-
-import org.opendaylight.controller.sal.dom.broker.spi.RpcRouter
-import org.opendaylight.yangtools.concepts.Identifiable
-import org.opendaylight.yangtools.yang.common.QName
-import org.opendaylight.controller.sal.core.api.RpcImplementation
-import org.opendaylight.yangtools.yang.data.api.CompositeNode
-import static com.google.common.base.Preconditions.*;
-import java.util.Map
-import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration
-import java.util.concurrent.ConcurrentHashMap
-import java.util.Set
-import java.util.Collections
-import org.opendaylight.yangtools.concepts.AbstractObjectRegistration
-import org.opendaylight.controller.sal.core.api.RpcRegistrationListener
-import org.slf4j.LoggerFactory
-import org.opendaylight.yangtools.concepts.util.ListenerRegistry
-import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
-
-class RpcRouterImpl implements RpcRouter, Identifiable<String> {
-
-    static val log = LoggerFactory.getLogger(RpcRouterImpl)
-
-    Map<QName, RpcRegistration> implementations = new ConcurrentHashMap();
-
-    @Property
-    val Set<QName> supportedRpcs = Collections.unmodifiableSet(implementations.keySet);
-
-    private val rpcRegistrationListeners = new ListenerRegistry<RpcRegistrationListener>();
-
-    @Property
-    val String identifier;
-
-    new(String name) {
-        _identifier = name;
-    }
-
-    override addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation) {
-                checkNotNull(rpcType, "Rpc Type should not be null");
-        checkNotNull(implementation, "Implementation should not be null.");
-        val reg = new RoutedRpcRegistrationImpl(rpcType, implementation, this);
-        implementations.put(rpcType, reg)
-
-        for (listener : rpcRegistrationListeners.listeners) {
-            try {
-                listener.instance.onRpcImplementationAdded(rpcType);
-            } catch (Exception e) {
-                log.error("Unhandled exception during invoking listener", e);
-            }
-        }
-
-        return reg;
-    }
-
-    override addRpcImplementation(QName rpcType, RpcImplementation implementation) throws IllegalArgumentException {
-        checkNotNull(rpcType, "Rpc Type should not be null");
-        checkNotNull(implementation, "Implementation should not be null.");
-        checkState(!implementations.containsKey(rpcType), "Provider for supplied rpc is already registered.");
-        val reg = new RpcRegistrationImpl(rpcType, implementation, this);
-        implementations.put(rpcType, reg)
-
-        for (listener : rpcRegistrationListeners.listeners) {
-            try {
-                listener.instance.onRpcImplementationAdded(rpcType);
-            } catch (Exception e) {
-                log.error("Unhandled exception during invoking listener", e);
-            }
-        }
-
-        return reg;
-
-    }
-
-    override invokeRpc(QName rpc, CompositeNode input) {
-        checkNotNull(rpc, "Rpc Type should not be null");
-
-        val impl = implementations.get(rpc);
-        checkState(impl !== null, "Provider for supplied rpc is not registered.");
-
-        return impl.instance.invokeRpc(rpc, input);
-    }
-
-    def remove(RpcRegistrationImpl impl) {
-        val existing = implementations.get(impl.type);
-        if (existing == impl) {
-            implementations.remove(impl.type);
-        }
-        for (listener : rpcRegistrationListeners.listeners) {
-            try {
-                listener.instance.onRpcImplementationRemoved(impl.type);
-            } catch (Exception e) {
-                log.error("Unhandled exception during invoking listener", e);
-            }
-        }
-    }
-    
-    override addRpcRegistrationListener(RpcRegistrationListener listener) {
-        rpcRegistrationListeners.register(listener);
-    }
-
-}
-
-class RpcRegistrationImpl extends AbstractObjectRegistration<RpcImplementation> implements RpcRegistration {
-
-    @Property
-    val QName type;
-
-    @Property
-    var RpcRouterImpl router;
-
-    new(QName type, RpcImplementation instance, RpcRouterImpl router) {
-        super(instance)
-        _type = type
-        _router = router
-    }
-
-    override protected removeRegistration() {
-        router.remove(this);
-    }
-}
-class RoutedRpcRegistrationImpl extends RpcRegistrationImpl implements RoutedRpcRegistration {
-
-
-    new(QName type, RpcImplementation instance, RpcRouterImpl router) {
-        super(type,instance,router)
-    }
-
-    override protected removeRegistration() {
-        router.remove(this);
-    }
-    override registerPath(QName context, InstanceIdentifier path) {
-        //
-        
-    }
-
-    override unregisterPath(QName context, InstanceIdentifier path) {
-        //
-    }
-}
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;
         }
     }
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareRpcBroker.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareRpcBroker.java
new file mode 100644 (file)
index 0000000..de6cfa6
--- /dev/null
@@ -0,0 +1,426 @@
+package org.opendaylight.controller.sal.dom.broker.impl;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.md.sal.common.impl.routing.RoutingUtils;
+import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
+import org.opendaylight.controller.sal.core.api.RpcRoutingContext;
+import org.opendaylight.controller.sal.dom.broker.spi.RpcRouter;
+import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
+import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableSet;
+
+public class SchemaAwareRpcBroker implements RpcRouter, Identifiable<String> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SchemaAwareRpcBroker.class);
+
+    private static final QName CONTEXT_REFERENCE = QName.create("urn:opendaylight:yang:extension:yang-ext",
+            "2013-07-09", "context-reference");
+    private final ListenerRegistry<RpcRegistrationListener> rpcRegistrationListeners = new ListenerRegistry<>();
+    private final ListenerRegistry<RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> routeChangeListeners = new ListenerRegistry<>();
+    
+
+    private final String identifier;
+    private final ConcurrentMap<QName, RpcImplementation> implementations = new ConcurrentHashMap<>();
+    private RpcImplementation defaultImplementation;
+    private SchemaContextProvider schemaProvider;
+
+    public SchemaAwareRpcBroker(String identifier, SchemaContextProvider schemaProvider) {
+        super();
+        this.identifier = identifier;
+        this.schemaProvider = schemaProvider;
+    }
+
+    public RpcImplementation getDefaultImplementation() {
+        return defaultImplementation;
+    }
+
+    public void setDefaultImplementation(RpcImplementation defaultImplementation) {
+        this.defaultImplementation = defaultImplementation;
+    }
+
+    public SchemaContextProvider getSchemaProvider() {
+        return schemaProvider;
+    }
+
+    public void setSchemaProvider(SchemaContextProvider schemaProvider) {
+        this.schemaProvider = schemaProvider;
+    }
+
+    @Override
+    public RoutedRpcRegistration addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation) {
+        checkArgument(rpcType != null, "RPC Type should not be null");
+        checkArgument(implementation != null, "RPC Implementatoin should not be null");
+        return getOrCreateRoutedRpcRouter(rpcType).addRoutedRpcImplementation(rpcType, implementation);
+    }
+
+    private RoutedRpcSelector getOrCreateRoutedRpcRouter(QName rpcType) {
+        RoutedRpcSelector potential = getRoutedRpcRouter(rpcType);
+        if (potential != null) {
+            return potential;
+        }
+        synchronized (implementations) {
+            potential = getRoutedRpcRouter(rpcType);
+            if (potential != null) {
+                return potential;
+            }
+            RpcDefinition definition = findRpcDefinition(rpcType);
+            RoutingStrategy strategy = getRoutingStrategy(definition);
+            checkState(strategy instanceof RoutedRpcStrategy, "Rpc %s is not routed.", rpcType);
+            potential = new RoutedRpcSelector((RoutedRpcStrategy) strategy, this);
+            implementations.put(rpcType, potential);
+            return potential;
+        }
+    }
+
+    private RoutedRpcSelector getRoutedRpcRouter(QName rpcType) {
+        RpcImplementation potential = implementations.get(rpcType);
+        if (potential != null) {
+            checkState(potential instanceof RoutedRpcSelector, "Rpc %s is not routed.", rpcType);
+            return (RoutedRpcSelector) potential;
+        }
+        return null;
+
+    }
+
+    @Override
+    public RpcRegistration addRpcImplementation(QName rpcType, RpcImplementation implementation)
+            throws IllegalArgumentException {
+        checkArgument(rpcType != null, "RPC Type should not be null");
+        checkArgument(implementation != null, "RPC Implementatoin should not be null");
+        checkState(!hasRpcImplementation(rpcType), "Implementation already registered");
+        RpcDefinition definition = findRpcDefinition(rpcType);
+        checkArgument(!isRoutedRpc(definition), "RPC Type must not be routed.");
+        GlobalRpcRegistration reg = new GlobalRpcRegistration(rpcType, implementation, this);
+        return reg;
+    }
+
+    private boolean isRoutedRpc(RpcDefinition definition) {
+        return getRoutingStrategy(definition) instanceof RoutedRpcStrategy;
+    }
+
+    @Override
+    public ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(RpcRegistrationListener listener) {
+        return rpcRegistrationListeners.register(listener);
+    }
+
+    @Override
+    public String getIdentifier() {
+        return identifier;
+    }
+
+    @Override
+    public Set<QName> getSupportedRpcs() {
+        return ImmutableSet.copyOf(implementations.keySet());
+    }
+
+    @Override
+    public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input) {
+        return findRpcImplemention(rpc).invokeRpc(rpc, input);
+    }
+
+    private RpcImplementation findRpcImplemention(QName rpc) {
+        checkArgument(rpc != null, "Rpc name should not be null");
+        RpcImplementation potentialImpl = implementations.get(rpc);
+        if (potentialImpl != null) {
+            return potentialImpl;
+        }
+        potentialImpl = defaultImplementation;
+        checkState(potentialImpl != null, "Implementation is not available.");
+        return potentialImpl;
+    }
+
+    private boolean hasRpcImplementation(QName rpc) {
+        return implementations.containsKey(rpc);
+    }
+
+    private RpcDefinition findRpcDefinition(QName rpcType) {
+        checkArgument(rpcType != null, "Rpc name must be supplied.");
+        checkState(schemaProvider != null, "Schema Provider is not available.");
+        SchemaContext ctx = schemaProvider.getSchemaContext();
+        checkState(ctx != null, "YANG Schema Context is not available.");
+        Module module = ctx.findModuleByNamespaceAndRevision(rpcType.getNamespace(), rpcType.getRevision());
+        checkState(module != null, "YANG Module is not available.");
+        return findRpcDefinition(rpcType, module.getRpcs());
+    }
+
+    static private RpcDefinition findRpcDefinition(QName rpcType, Set<RpcDefinition> rpcs) {
+        checkState(rpcs != null, "Rpc schema is not available.");
+        for (RpcDefinition rpc : rpcs) {
+            if (rpcType.equals(rpc.getQName())) {
+                return rpc;
+            }
+        }
+        throw new IllegalArgumentException("Supplied Rpc Type is not defined.");
+    }
+
+    private RoutingStrategy getRoutingStrategy(RpcDefinition rpc) {
+        ContainerSchemaNode input = rpc.getInput();
+        if (input != null) {
+            for (DataSchemaNode schemaNode : input.getChildNodes()) {
+                Optional<QName> context = getRoutingContext(schemaNode);
+                if (context.isPresent()) {
+                    return createRoutedStrategy(rpc, context.get(), schemaNode.getQName());
+                }
+            }
+        }
+        return createGlobalStrategy(rpc);
+    }
+
+    private static RoutingStrategy createRoutedStrategy(RpcDefinition rpc, QName context, QName leafNode) {
+        return new RoutedRpcStrategy(rpc.getQName(), context, leafNode);
+    }
+
+    private Optional<QName> getRoutingContext(DataSchemaNode schemaNode) {
+        for (UnknownSchemaNode extension : schemaNode.getUnknownSchemaNodes()) {
+            if (CONTEXT_REFERENCE.equals(extension.getNodeType())) {
+                return Optional.fromNullable(extension.getQName());
+            }
+            ;
+        }
+        return Optional.absent();
+    }
+
+    private static RoutingStrategy createGlobalStrategy(RpcDefinition rpc) {
+        GlobalRpcStrategy ret = new GlobalRpcStrategy(rpc.getQName());
+        return ret;
+    }
+
+    private static abstract class RoutingStrategy implements Identifiable<QName> {
+
+        private final QName identifier;
+
+        public RoutingStrategy(QName identifier) {
+            super();
+            this.identifier = identifier;
+        }
+
+        @Override
+        public QName getIdentifier() {
+            return identifier;
+        }
+    }
+
+    private static class GlobalRpcStrategy extends RoutingStrategy {
+
+        public GlobalRpcStrategy(QName identifier) {
+            super(identifier);
+        }
+    }
+
+    private static class RoutedRpcStrategy extends RoutingStrategy {
+
+        private final QName context;
+        private final QName leaf;
+
+        public RoutedRpcStrategy(QName identifier, QName ctx, QName leaf) {
+            super(identifier);
+            this.context = ctx;
+            this.leaf = leaf;
+        }
+
+        public QName getContext() {
+            return context;
+        }
+
+        public QName getLeaf() {
+            return leaf;
+        }
+    }
+
+    private static class RoutedRpcSelector implements RpcImplementation, AutoCloseable, Identifiable<QName> {
+
+        private final RoutedRpcStrategy strategy;
+        private final Set<QName> supportedRpcs;
+        private RpcImplementation defaultDelegate;
+        private final ConcurrentMap<InstanceIdentifier, RoutedRpcRegImpl> implementations = new ConcurrentHashMap<>();
+        private SchemaAwareRpcBroker router;
+
+        public RoutedRpcSelector(RoutedRpcStrategy strategy, SchemaAwareRpcBroker router) {
+            super();
+            this.strategy = strategy;
+            supportedRpcs = ImmutableSet.of(strategy.getIdentifier());
+            this.router = router;
+        }
+
+        @Override
+        public QName getIdentifier() {
+            return strategy.getIdentifier();
+        }
+
+        @Override
+        public void close() throws Exception {
+
+        }
+
+        @Override
+        public Set<QName> getSupportedRpcs() {
+            return supportedRpcs;
+        }
+
+        public RoutedRpcRegistration addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation) {
+            return new RoutedRpcRegImpl(rpcType, implementation, this);
+        }
+
+        @Override
+        public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input) {
+            CompositeNode inputContainer = input.getFirstCompositeByName(QName.create(rpc,"input"));
+            checkArgument(inputContainer != null, "Rpc payload must contain input element");
+            SimpleNode<?> routeContainer = inputContainer.getFirstSimpleByName(strategy.getLeaf());
+            checkArgument(routeContainer != null, "Leaf %s must be set with value", strategy.getLeaf());
+            Object route = routeContainer.getValue();
+            RpcImplementation potential = null;
+            if (route != null) {
+                RoutedRpcRegImpl potentialReg = implementations.get(route);
+                if (potentialReg != null) {
+                    potential = potentialReg.getInstance();
+                }
+            }
+            if (potential == null) {
+                potential = defaultDelegate;
+            }
+            checkState(potential != null, "No implementation is available for rpc:%s path:%s", rpc, route);
+            return potential.invokeRpc(rpc, input);
+        }
+
+        public void addPath(QName context, InstanceIdentifier path, RoutedRpcRegImpl routedRpcRegImpl) {
+            //checkArgument(strategy.getContext().equals(context),"Supplied context is not supported.");
+            RoutedRpcRegImpl previous = implementations.put(path, routedRpcRegImpl);
+            if (previous == null) {
+                router.notifyPathAnnouncement(context,strategy.getIdentifier(), path);
+            }
+
+        }
+
+        public void removePath(QName context, InstanceIdentifier path, RoutedRpcRegImpl routedRpcRegImpl) {
+            boolean removed = implementations.remove(path, routedRpcRegImpl);
+            if (removed) {
+                router.notifyPathWithdrawal(context, strategy.getIdentifier(), path);
+            }
+        }
+    }
+
+    private static class GlobalRpcRegistration extends AbstractObjectRegistration<RpcImplementation> implements
+            RpcRegistration {
+        private final QName type;
+        private SchemaAwareRpcBroker router;
+
+        public GlobalRpcRegistration(QName type, RpcImplementation instance, SchemaAwareRpcBroker router) {
+            super(instance);
+            this.type = type;
+            this.router = router;
+        }
+
+        @Override
+        public QName getType() {
+            return type;
+        }
+
+        @Override
+        protected void removeRegistration() {
+            if (router != null) {
+                router.remove(this);
+                router = null;
+            }
+        }
+    }
+
+    private static class RoutedRpcRegImpl extends AbstractObjectRegistration<RpcImplementation> implements
+            RoutedRpcRegistration {
+
+        private final QName type;
+        private RoutedRpcSelector router;
+
+        public RoutedRpcRegImpl(QName rpcType, RpcImplementation implementation, RoutedRpcSelector routedRpcSelector) {
+            super(implementation);
+            this.type = rpcType;
+            router = routedRpcSelector;
+        }
+
+        @Override
+        public void registerPath(QName context, InstanceIdentifier path) {
+            router.addPath(context, path, this);
+        }
+
+        @Override
+        public void unregisterPath(QName context, InstanceIdentifier path) {
+            router.removePath(context, path, this);
+        }
+
+        @Override
+        protected void removeRegistration() {
+
+        }
+
+        @Override
+        public QName getType() {
+            return type;
+        }
+
+    }
+
+    private void remove(GlobalRpcRegistration registration) {
+        implementations.remove(registration.getType(), registration);
+    }
+
+    private void notifyPathAnnouncement(QName context, QName identifier, InstanceIdentifier path) {
+        RpcRoutingContext contextWrapped = RpcRoutingContext.create(context, identifier);
+        RouteChange<RpcRoutingContext, InstanceIdentifier> change = RoutingUtils.announcementChange(contextWrapped , path);
+        for(ListenerRegistration<RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> routeListener : routeChangeListeners) {
+            try {
+                routeListener.getInstance().onRouteChange(change);
+            } catch (Exception e) {
+                LOG.error("Unhandled exception during invoking onRouteChange for {}",routeListener.getInstance(),e);
+                
+            }
+        }
+        
+    }
+
+    
+
+    private void notifyPathWithdrawal(QName context,QName identifier, InstanceIdentifier path) {
+        RpcRoutingContext contextWrapped = RpcRoutingContext.create(context, identifier);
+        RouteChange<RpcRoutingContext, InstanceIdentifier> change = RoutingUtils.removalChange(contextWrapped , path);
+        for(ListenerRegistration<RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> routeListener : routeChangeListeners) {
+            try {
+                routeListener.getInstance().onRouteChange(change);
+            } catch (Exception e) {
+                LOG.error("Unhandled exception during invoking onRouteChange for {}",routeListener.getInstance(),e);
+            }
+        }
+    }
+    
+    @Override
+    public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
+            L listener) {
+        return routeChangeListeners.registerWithType(listener);
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaContextProvider.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaContextProvider.java
new file mode 100644 (file)
index 0000000..fc8ccd6
--- /dev/null
@@ -0,0 +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;
+
+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 6886f892c6c851af6cb4e6ed8053cb1b44750cb4..7ec8ce1d78bf795e94702ca8f12c61dbe8d3d60e 100644 (file)
@@ -26,6 +26,4 @@ public interface RpcRouter extends RpcProvisionRegistry, RpcImplementation {
     
     @Override
     public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input);
-
-    ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(RpcRegistrationListener listener);
 }
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());
index bb5dea3bd5ad753ca7069169e32a9207b1599715..4eaad427381cac032d6e6b48de81d2da0f5e3445 100644 (file)
@@ -60,17 +60,17 @@ import org.slf4j.LoggerFactory;
 public class StatisticsProvider implements AutoCloseable {
 
     public final static Logger spLogger = LoggerFactory.getLogger(StatisticsProvider.class);
-    
+
     private DataProviderService dps;
 
     private NotificationProviderService nps;
-    
+
     private OpendaylightGroupStatisticsService groupStatsService;
-    
+
     private OpendaylightMeterStatisticsService meterStatsService;
-    
+
     private OpendaylightFlowStatisticsService flowStatsService;
-    
+
     private OpendaylightPortStatisticsService portStatsService;
 
     private OpendaylightFlowTableStatisticsService flowTableStatsService;
@@ -78,29 +78,29 @@ public class StatisticsProvider implements AutoCloseable {
     private OpendaylightQueueStatisticsService queueStatsService;
 
     private final MultipartMessageManager multipartMessageManager = new MultipartMessageManager();
-    
+
     private Thread statisticsRequesterThread;
-    
+
     private final  InstanceIdentifier<Nodes> nodesIdentifier = InstanceIdentifier.builder(Nodes.class).toInstance();
-    
+
     private final int STATS_THREAD_EXECUTION_TIME= 50000;
     //Local caching of stats
-    
-    private final ConcurrentMap<NodeId,NodeStatistics> statisticsCache = 
+
+    private final ConcurrentMap<NodeId,NodeStatistics> statisticsCache =
             new ConcurrentHashMap<NodeId,NodeStatistics>();
-    
+
     public DataProviderService getDataService() {
       return this.dps;
     }
-    
+
     public void setDataService(final DataProviderService dataService) {
       this.dps = dataService;
     }
-    
+
     public NotificationProviderService getNotificationService() {
       return this.nps;
     }
-    
+
     public void setNotificationService(final NotificationProviderService notificationService) {
       this.nps = notificationService;
     }
@@ -110,22 +110,22 @@ public class StatisticsProvider implements AutoCloseable {
     }
 
     private final StatisticsUpdateCommiter updateCommiter = new StatisticsUpdateCommiter(StatisticsProvider.this);
-    
+
     private Registration<NotificationListener> listenerRegistration;
-    
+
     public void start() {
-        
+
         NotificationProviderService nps = this.getNotificationService();
         Registration<NotificationListener> registerNotificationListener = nps.registerNotificationListener(this.updateCommiter);
         this.listenerRegistration = registerNotificationListener;
-        
+
         // Get Group/Meter statistics service instance
         groupStatsService = StatisticsManagerActivator.getProviderContext().
                 getRpcService(OpendaylightGroupStatisticsService.class);
-        
+
         meterStatsService = StatisticsManagerActivator.getProviderContext().
                 getRpcService(OpendaylightMeterStatisticsService.class);
-        
+
         flowStatsService = StatisticsManagerActivator.getProviderContext().
                 getRpcService(OpendaylightFlowStatisticsService.class);
 
@@ -134,10 +134,10 @@ public class StatisticsProvider implements AutoCloseable {
 
         flowTableStatsService = StatisticsManagerActivator.getProviderContext().
                 getRpcService(OpendaylightFlowTableStatisticsService.class);
-        
+
         queueStatsService = StatisticsManagerActivator.getProviderContext().
                 getRpcService(OpendaylightQueueStatisticsService.class);
-        
+
         statisticsRequesterThread = new Thread( new Runnable(){
 
             @Override
@@ -145,7 +145,7 @@ public class StatisticsProvider implements AutoCloseable {
                 while(true){
                     try {
                         statsRequestSender();
-                        
+
                         Thread.sleep(STATS_THREAD_EXECUTION_TIME);
                     }catch (Exception e){
                         spLogger.error("Exception occurred while sending stats request : {}",e);
@@ -153,55 +153,55 @@ public class StatisticsProvider implements AutoCloseable {
                 }
             }
         });
-        
+
         spLogger.debug("Statistics requester thread started with timer interval : {}",STATS_THREAD_EXECUTION_TIME);
-        
+
         statisticsRequesterThread.start();
-        
+
         spLogger.info("Statistics Provider started.");
     }
-    
+
     protected DataModificationTransaction startChange() {
-        
+
         DataProviderService dps = this.getDataService();
         return dps.beginTransaction();
     }
-    
+
     private void statsRequestSender(){
-        
+
         List<Node> targetNodes = getAllConnectedNodes();
-        
+
         if(targetNodes == null)
             return;
-        
+
 
         for (Node targetNode : targetNodes){
-            
+
             if(targetNode.getAugmentation(FlowCapableNode.class) != null){
 
-                spLogger.info("Send request for stats collection to node : {})",targetNode.getId());
-                
+                spLogger.trace("Send request for stats collection to node : {})",targetNode.getId());
+
                 InstanceIdentifier<Node> targetInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class,targetNode.getKey()).toInstance();
-                
+
                 NodeRef targetNodeRef = new NodeRef(targetInstanceId);
-            
+
                 try{
                     sendAggregateFlowsStatsFromAllTablesRequest(targetNode.getKey());
-                
+
                     sendAllFlowsStatsFromAllTablesRequest(targetNodeRef);
 
                     sendAllNodeConnectorsStatisticsRequest(targetNodeRef);
-                
+
                     sendAllFlowTablesStatisticsRequest(targetNodeRef);
-                
+
                     sendAllQueueStatsFromAllNodeConnector (targetNodeRef);
 
                     sendAllGroupStatisticsRequest(targetNodeRef);
-                    
+
                     sendAllMeterStatisticsRequest(targetNodeRef);
-                    
+
                     sendGroupDescriptionRequest(targetNodeRef);
-                    
+
                     sendMeterConfigStatisticsRequest(targetNodeRef);
                 }catch(Exception e){
                     spLogger.error("Exception occured while sending statistics requests : {}", e);
@@ -211,12 +211,12 @@ public class StatisticsProvider implements AutoCloseable {
     }
 
     private void sendAllFlowTablesStatisticsRequest(NodeRef targetNodeRef) throws InterruptedException, ExecutionException {
-        final GetFlowTablesStatisticsInputBuilder input = 
+        final GetFlowTablesStatisticsInputBuilder input =
                 new GetFlowTablesStatisticsInputBuilder();
-        
+
         input.setNode(targetNodeRef);
 
-        Future<RpcResult<GetFlowTablesStatisticsOutput>> response = 
+        Future<RpcResult<GetFlowTablesStatisticsOutput>> response =
                 flowTableStatsService.getFlowTablesStatistics(input.build());
 
         this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
@@ -227,33 +227,33 @@ public class StatisticsProvider implements AutoCloseable {
     private void sendAllFlowsStatsFromAllTablesRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
         final GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input =
                 new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder();
-        
+
         input.setNode(targetNode);
-        
-        Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> response = 
+
+        Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> response =
                 flowStatsService.getAllFlowsStatisticsFromAllFlowTables(input.build());
-        
+
         this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
                 , StatsRequestType.ALL_FLOW);
-        
+
     }
-    
+
     private void sendAggregateFlowsStatsFromAllTablesRequest(NodeKey targetNodeKey) throws InterruptedException, ExecutionException{
-        
+
         List<Short> tablesId = getTablesFromNode(targetNodeKey);
-        
+
         if(tablesId.size() != 0){
             for(Short id : tablesId){
-                
-                spLogger.info("Send aggregate stats request for flow table {} to node {}",id,targetNodeKey);
-                GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input = 
+
+                spLogger.trace("Send aggregate stats request for flow table {} to node {}",id,targetNodeKey);
+                GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input =
                         new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder();
-                
+
                 input.setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey).toInstance()));
                 input.setTableId(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId(id));
-                Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> response = 
+                Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> response =
                         flowStatsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build());
-                
+
                 multipartMessageManager.setTxIdAndTableIdMapEntry(response.get().getResult().getTransactionId(), id);
                 this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
                         , StatsRequestType.AGGR_FLOW);
@@ -264,12 +264,12 @@ public class StatisticsProvider implements AutoCloseable {
     }
 
     private void sendAllNodeConnectorsStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
-        
+
         final GetAllNodeConnectorsStatisticsInputBuilder input = new GetAllNodeConnectorsStatisticsInputBuilder();
-        
+
         input.setNode(targetNode);
 
-        Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> response = 
+        Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> response =
                 portStatsService.getAllNodeConnectorsStatistics(input.build());
         this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
                 , StatsRequestType.ALL_PORT);
@@ -277,68 +277,68 @@ public class StatisticsProvider implements AutoCloseable {
     }
 
     private void sendAllGroupStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
-        
+
         final GetAllGroupStatisticsInputBuilder input = new GetAllGroupStatisticsInputBuilder();
-        
+
         input.setNode(targetNode);
 
-        Future<RpcResult<GetAllGroupStatisticsOutput>> response = 
+        Future<RpcResult<GetAllGroupStatisticsOutput>> response =
                 groupStatsService.getAllGroupStatistics(input.build());
-        
+
         this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
                 , StatsRequestType.ALL_GROUP);
 
     }
-    
+
     private void sendGroupDescriptionRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
         final GetGroupDescriptionInputBuilder input = new GetGroupDescriptionInputBuilder();
-        
+
         input.setNode(targetNode);
 
-        Future<RpcResult<GetGroupDescriptionOutput>> response = 
+        Future<RpcResult<GetGroupDescriptionOutput>> response =
                 groupStatsService.getGroupDescription(input.build());
 
         this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
                 , StatsRequestType.GROUP_DESC);
 
     }
-    
+
     private void sendAllMeterStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
-        
+
         GetAllMeterStatisticsInputBuilder input = new GetAllMeterStatisticsInputBuilder();
-        
+
         input.setNode(targetNode);
 
-        Future<RpcResult<GetAllMeterStatisticsOutput>> response = 
+        Future<RpcResult<GetAllMeterStatisticsOutput>> response =
                 meterStatsService.getAllMeterStatistics(input.build());
-        
+
         this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
                 , StatsRequestType.ALL_METER);;
 
     }
-    
+
     private void sendMeterConfigStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
-        
+
         GetAllMeterConfigStatisticsInputBuilder input = new GetAllMeterConfigStatisticsInputBuilder();
-        
+
         input.setNode(targetNode);
 
-        Future<RpcResult<GetAllMeterConfigStatisticsOutput>> response = 
+        Future<RpcResult<GetAllMeterConfigStatisticsOutput>> response =
                 meterStatsService.getAllMeterConfigStatistics(input.build());
-        
+
         this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
                 , StatsRequestType.METER_CONFIG);;
 
     }
-    
+
     private void sendAllQueueStatsFromAllNodeConnector(NodeRef targetNode) throws InterruptedException, ExecutionException {
         GetAllQueuesStatisticsFromAllPortsInputBuilder input = new GetAllQueuesStatisticsFromAllPortsInputBuilder();
-        
+
         input.setNode(targetNode);
-        
-        Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> response = 
+
+        Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> response =
                 queueStatsService.getAllQueuesStatisticsFromAllPorts(input.build());
-        
+
         this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
                 , StatsRequestType.ALL_QUEUE_STATS);;
 
@@ -347,24 +347,24 @@ public class StatisticsProvider implements AutoCloseable {
     public ConcurrentMap<NodeId, NodeStatistics> getStatisticsCache() {
         return statisticsCache;
     }
-    
+
     private List<Node> getAllConnectedNodes(){
-        
+
         Nodes nodes = (Nodes) dps.readOperationalData(nodesIdentifier);
         if(nodes == null)
             return null;
-        
-        spLogger.info("Number of connected nodes : {}",nodes.getNode().size());
+
+        spLogger.trace("Number of connected nodes : {}",nodes.getNode().size());
         return nodes.getNode();
     }
-    
+
     private List<Short> getTablesFromNode(NodeKey nodeKey){
         InstanceIdentifier<FlowCapableNode> nodesIdentifier = InstanceIdentifier.builder(Nodes.class).child(Node.class,nodeKey).augmentation(FlowCapableNode.class).toInstance();
-        
+
         FlowCapableNode node = (FlowCapableNode)dps.readOperationalData(nodesIdentifier);
         List<Short> tablesId = new ArrayList<Short>();
         if(node != null && node.getTable()!=null){
-            spLogger.info("Number of tables {} supported by node {}",node.getTable().size(),nodeKey);
+            spLogger.trace("Number of tables {} supported by node {}",node.getTable().size(),nodeKey);
             for(Table table: node.getTable()){
                 tablesId.add(table.getId());
             }
@@ -375,15 +375,15 @@ public class StatisticsProvider implements AutoCloseable {
     @SuppressWarnings("deprecation")
     @Override
     public void close(){
-        
+
         try {
-            spLogger.info("Statistics Provider stopped.");
+            spLogger.trace("Statistics Provider stopped.");
             if (this.listenerRegistration != null) {
-              
+
                 this.listenerRegistration.close();
-                
+
                 this.statisticsRequesterThread.destroy();
-            
+
             }
           } catch (Throwable e) {
             throw Exceptions.sneakyThrow(e);
index f3188e1d0e83dbfd7870fd20b4e67d77d01b2219..5743865d39539cbf8fb32404abf28c5b9194faa0 100644 (file)
@@ -108,68 +108,68 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Class implement statistics manager related listener interface and augment all the 
+ * Class implement statistics manager related listener interface and augment all the
  * received statistics data to data stores.
- * TODO: Need to add error message listener and clean-up the associated tx id 
+ * TODO: Need to add error message listener and clean-up the associated tx id
  * if it exists in the tx-id cache.
  * @author vishnoianil
  *
  */
 public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsListener,
-        OpendaylightMeterStatisticsListener, 
+        OpendaylightMeterStatisticsListener,
         OpendaylightFlowStatisticsListener,
         OpendaylightPortStatisticsListener,
         OpendaylightFlowTableStatisticsListener,
         OpendaylightQueueStatisticsListener{
-    
+
     public final static Logger sucLogger = LoggerFactory.getLogger(StatisticsUpdateCommiter.class);
 
     private final StatisticsProvider statisticsManager;
-    
+
     private final int unaccountedFlowsCounter = 1;
 
     public StatisticsUpdateCommiter(final StatisticsProvider manager){
 
         this.statisticsManager = manager;
     }
-    
+
     public StatisticsProvider getStatisticsManager(){
         return statisticsManager;
     }
-   
+
     @Override
     public void onMeterConfigStatsUpdated(MeterConfigStatsUpdated notification) {
         //Check if response is for the request statistics-manager sent.
         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()).setMeterConfigStats(notification.getMeterConfigStats());
-        
+
         //Publish data to configuration data store
         NodeKey key = new NodeKey(notification.getId());
-        
+
         List<MeterConfigStats> eterConfigStatsList = notification.getMeterConfigStats();
-        
+
         for(MeterConfigStats meterConfigStats : eterConfigStatsList){
             DataModificationTransaction it = this.statisticsManager.startChange();
             MeterBuilder meterBuilder = new MeterBuilder();
             MeterKey meterKey = new MeterKey(meterConfigStats.getMeterId());
             meterBuilder.setKey(meterKey);
-            
+
             InstanceIdentifier<Meter> meterRef = InstanceIdentifier.builder(Nodes.class).child(Node.class,key)
                                                                                         .augmentation(FlowCapableNode.class)
                                                                                         .child(Meter.class,meterKey).toInstance();
-            
+
             NodeMeterConfigStatsBuilder meterConfig= new NodeMeterConfigStatsBuilder();
             MeterConfigStatsBuilder stats = new MeterConfigStatsBuilder();
             stats.fieldsFrom(meterConfigStats);
             meterConfig.setMeterConfigStats(stats.build());
-            
+
             //Update augmented data
             meterBuilder.addAugmentation(NodeMeterConfigStats.class, meterConfig.build());
             it.putOperationalData(meterRef, meterBuilder.build());
@@ -180,7 +180,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
 
     @Override
     public void onMeterStatisticsUpdated(MeterStatisticsUpdated notification) {
-        
+
         //Check if response is for the request statistics-manager sent.
         if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
             return;
@@ -191,11 +191,11 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             cache.put(notification.getId(), new NodeStatistics());
         }
         cache.get(notification.getId()).setMeterStatistics(notification.getMeterStats());
-        
+
         NodeKey key = new NodeKey(notification.getId());
-        
+
         List<MeterStats> meterStatsList = notification.getMeterStats();
-        
+
         for(MeterStats meterStats : meterStatsList){
 
             //Publish data to configuration data store
@@ -203,11 +203,11 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             MeterBuilder meterBuilder = new MeterBuilder();
             MeterKey meterKey = new MeterKey(meterStats.getMeterId());
             meterBuilder.setKey(meterKey);
-            
+
             InstanceIdentifier<Meter> meterRef = InstanceIdentifier.builder(Nodes.class).child(Node.class,key)
                                                                                         .augmentation(FlowCapableNode.class)
                                                                                         .child(Meter.class,meterKey).toInstance();
-            
+
             NodeMeterStatisticsBuilder meterStatsBuilder= new NodeMeterStatisticsBuilder();
             MeterStatisticsBuilder stats = new MeterStatisticsBuilder();
             stats.fieldsFrom(meterStats);
@@ -222,7 +222,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
 
     @Override
     public void onGroupDescStatsUpdated(GroupDescStatsUpdated notification) {
-        
+
         //Check if response is for the request statistics-manager sent.
         if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
             return;
@@ -233,18 +233,18 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             cache.put(notification.getId(), new NodeStatistics());
         }
         cache.get(notification.getId()).setGroupDescStats(notification.getGroupDescStats());
-        
+
         //Publish data to configuration data store
         NodeKey key = new NodeKey(notification.getId());
         List<GroupDescStats> groupDescStatsList = notification.getGroupDescStats();
 
         for(GroupDescStats groupDescStats : groupDescStatsList){
             DataModificationTransaction it = this.statisticsManager.startChange();
-            
+
             GroupBuilder groupBuilder = new GroupBuilder();
             GroupKey groupKey = new GroupKey(groupDescStats.getGroupId());
             groupBuilder.setKey(groupKey);
-            
+
             InstanceIdentifier<Group> groupRef = InstanceIdentifier.builder(Nodes.class).child(Node.class,key)
                                                                                         .augmentation(FlowCapableNode.class)
                                                                                         .child(Group.class,groupKey).toInstance();
@@ -253,7 +253,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             GroupDescBuilder stats = new GroupDescBuilder();
             stats.fieldsFrom(groupDescStats);
             groupDesc.setGroupDesc(stats.build());
-            
+
             //Update augmented data
             groupBuilder.addAugmentation(NodeGroupDescStats.class, groupDesc.build());
 
@@ -264,7 +264,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
 
     @Override
     public void onGroupStatisticsUpdated(GroupStatisticsUpdated notification) {
-        
+
         //Check if response is for the request statistics-manager sent.
         if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
             return;
@@ -275,18 +275,18 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             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();
 
         for(GroupStats groupStats : groupStatsList){
             DataModificationTransaction it = this.statisticsManager.startChange();
-            
+
             GroupBuilder groupBuilder = new GroupBuilder();
             GroupKey groupKey = new GroupKey(groupStats.getGroupId());
             groupBuilder.setKey(groupKey);
-            
+
             InstanceIdentifier<Group> groupRef = InstanceIdentifier.builder(Nodes.class).child(Node.class,key)
                                                                                         .augmentation(FlowCapableNode.class)
                                                                                         .child(Group.class,groupKey).toInstance();
@@ -295,14 +295,14 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             GroupStatisticsBuilder stats = new GroupStatisticsBuilder();
             stats.fieldsFrom(groupStats);
             groupStatisticsBuilder.setGroupStatistics(stats.build());
-            
+
             //Update augmented data
             groupBuilder.addAugmentation(NodeGroupStatistics.class, groupStatisticsBuilder.build());
             it.putOperationalData(groupRef, groupBuilder.build());
             it.commit();
         }
     }
-    
+
     @Override
     public void onMeterFeaturesUpdated(MeterFeaturesUpdated notification) {
 
@@ -317,28 +317,28 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         meterFeature.setMaxBands(notification.getMaxBands());
         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());
         NodeRef ref = getNodeRef(key);
-        
-        final NodeBuilder nodeData = new NodeBuilder(); 
+
+        final NodeBuilder nodeData = new NodeBuilder();
         nodeData.setKey(key);
-        
+
         NodeMeterFeaturesBuilder nodeMeterFeatures= new NodeMeterFeaturesBuilder();
         nodeMeterFeatures.setMeterFeatures(meterFeature.build());
-        
+
         //Update augmented data
         nodeData.addAugmentation(NodeMeterFeatures.class, nodeMeterFeatures.build());
-        
+
         InstanceIdentifier<? extends Object> refValue = ref.getValue();
         it.putOperationalData(refValue, nodeData.build());
         it.commit();
     }
-    
+
     @Override
     public void onGroupFeaturesUpdated(GroupFeaturesUpdated notification) {
 
@@ -347,28 +347,28 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         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();
         NodeKey key = new NodeKey(notification.getId());
         NodeRef ref = getNodeRef(key);
-        
-        final NodeBuilder nodeData = new NodeBuilder(); 
+
+        final NodeBuilder nodeData = new NodeBuilder();
         nodeData.setKey(key);
-        
+
         NodeGroupFeaturesBuilder nodeGroupFeatures= new NodeGroupFeaturesBuilder();
         nodeGroupFeatures.setGroupFeatures(groupFeatures.build());
-        
+
         //Update augmented data
         nodeData.addAugmentation(NodeGroupFeatures.class, nodeGroupFeatures.build());
-        
+
         InstanceIdentifier<? extends Object> refValue = ref.getValue();
         it.putOperationalData(refValue, nodeData.build());
         it.commit();
@@ -376,17 +376,17 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
 
     @Override
     public void onFlowsStatisticsUpdate(FlowsStatisticsUpdate notification) {
-        
+
         //Check if response is for the request statistics-manager sent.
         if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
             return;
 
         NodeKey key = new NodeKey(notification.getId());
         sucLogger.debug("Received flow stats update : {}",notification.toString());
-        
+
         for(FlowAndStatisticsMapList map: notification.getFlowAndStatisticsMapList()){
             short tableId = map.getTableId();
-            
+
             DataModificationTransaction it = this.statisticsManager.startChange();
 
             boolean foundOriginalFlow = false;
@@ -416,16 +416,16 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             flow.setPriority(map.getPriority());
             flow.setStrict(map.isStrict());
             flow.setTableId(tableId);
-                
+
             Flow flowRule = flow.build();
-                
+
             FlowAndStatisticsMapListBuilder stats = new FlowAndStatisticsMapListBuilder();
             stats.setByteCount(map.getByteCount());
             stats.setPacketCount(map.getPacketCount());
             stats.setDuration(map.getDuration());
-                
+
             GenericStatistics flowStats = stats.build();
-                
+
             //Add statistics to local cache
             ConcurrentMap<NodeId, NodeStatistics> cache = this.statisticsManager.getStatisticsCache();
             if(!cache.containsKey(notification.getId())){
@@ -435,7 +435,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
                 cache.get(notification.getId()).getFlowAndStatsMap().put(tableId, new HashMap<Flow,GenericStatistics>());
             }
             cache.get(notification.getId()).getFlowAndStatsMap().get(tableId).put(flowRule,flowStats);
-                
+
             //Augment the data to the flow node
 
             FlowStatisticsBuilder flowStatistics = new FlowStatisticsBuilder();
@@ -460,17 +460,17 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             flowStatistics.setTableId(tableId);
 
             flowStatisticsData.setFlowStatistics(flowStatistics.build());
-                
+
             sucLogger.debug("Flow : {}",flowRule.toString());
             sucLogger.debug("Statistics to augment : {}",flowStatistics.build().toString());
 
             InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
                     .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tableId)).toInstance();
-            
+
             Table table= (Table)it.readConfigurationData(tableRef);
 
             //TODO: Not a good way to do it, need to figure out better way.
-            //TODO: major issue in any alternate approach is that flow key is incrementally assigned 
+            //TODO: major issue in any alternate approach is that flow key is incrementally assigned
             //to the flows stored in data store.
             if(table != null){
 
@@ -483,7 +483,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
                                 .child(Flow.class,existingFlow.getKey()).toInstance();
                         flowBuilder.setKey(existingFlow.getKey());
                         flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
-                        sucLogger.info("Found matching flow in the datastore, augmenting statistics");
+                        sucLogger.trace("Found matching flow in the datastore, augmenting statistics");
                         foundOriginalFlow = true;
                         it.putOperationalData(flowRef, flowBuilder.build());
                         it.commit();
@@ -491,7 +491,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
                     }
                 }
             }
-            
+
             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]
@@ -503,7 +503,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
                         .child(Flow.class,newFlowKey).toInstance();
                 flowBuilder.setKey(newFlowKey);
                 flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
-                sucLogger.info("Flow was no present in data store, augmenting statistics as an unaccounted flow");
+                sucLogger.trace("Flow was no present in data store, augmenting statistics as an unaccounted flow");
                 it.putOperationalData(flowRef, flowBuilder.build());
                 it.commit();
             }
@@ -518,10 +518,10 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
 
         NodeKey key = new NodeKey(notification.getId());
         sucLogger.debug("Received aggregate flow statistics update : {}",notification.toString());
-        
+
         Short tableId = this.statisticsManager.getMultipartMessageManager().getTableIdForTxId(notification.getTransactionId());
         if(tableId != null){
-            
+
             DataModificationTransaction it = this.statisticsManager.startChange();
 
             InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
@@ -533,13 +533,13 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             aggregateFlowStatisticsBuilder.setFlowCount(notification.getFlowCount());
             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();
@@ -559,7 +559,7 @@ 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())){
@@ -569,10 +569,10 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
 
         List<NodeConnectorStatisticsAndPortNumberMap> portsStats = notification.getNodeConnectorStatisticsAndPortNumberMap();
         for(NodeConnectorStatisticsAndPortNumberMap portStats : portsStats){
-            
+
             DataModificationTransaction it = this.statisticsManager.startChange();
 
-            FlowCapableNodeConnectorStatisticsBuilder statisticsBuilder 
+            FlowCapableNodeConnectorStatisticsBuilder statisticsBuilder
                                             = new FlowCapableNodeConnectorStatisticsBuilder();
             statisticsBuilder.setBytes(portStats.getBytes());
             statisticsBuilder.setCollisionCount(portStats.getCollisionCount());
@@ -585,20 +585,20 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             statisticsBuilder.setReceiveOverRunError(portStats.getReceiveOverRunError());
             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 = 
+            FlowCapableNodeConnectorStatisticsDataBuilder statisticsDataBuilder =
                     new FlowCapableNodeConnectorStatisticsDataBuilder();
-            
+
             statisticsDataBuilder.setFlowCapableNodeConnectorStatistics(statisticsBuilder.build());
-            
+
             InstanceIdentifier<NodeConnector> nodeConnectorRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key).child(NodeConnector.class, new NodeConnectorKey(portStats.getNodeConnectorId())).toInstance();
-            
+
             NodeConnector nodeConnector = (NodeConnector)it.readOperationalData(nodeConnectorRef);
-            
+
             if(nodeConnector != null){
                 sucLogger.debug("Augmenting port statistics {} to port {}",statisticsDataBuilder.build().toString(),nodeConnectorRef.toString());
                 NodeConnectorBuilder nodeConnectorBuilder = new NodeConnectorBuilder();
@@ -617,32 +617,32 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
 
         NodeKey key = new NodeKey(notification.getId());
         sucLogger.debug("Received flow table statistics update : {}",notification.toString());
-        
+
         List<FlowTableAndStatisticsMap> flowTablesStatsList = notification.getFlowTableAndStatisticsMap();
         for (FlowTableAndStatisticsMap ftStats : flowTablesStatsList){
-            
+
             DataModificationTransaction it = this.statisticsManager.startChange();
 
             InstanceIdentifier<Table> tableRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
                     .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(ftStats.getTableId().getValue())).toInstance();
-            
+
             FlowTableStatisticsDataBuilder statisticsDataBuilder = new FlowTableStatisticsDataBuilder();
-            
+
             FlowTableStatisticsBuilder statisticsBuilder = new FlowTableStatisticsBuilder();
             statisticsBuilder.setActiveFlows(ftStats.getActiveFlows());
             statisticsBuilder.setPacketsLookedUp(ftStats.getPacketsLookedUp());
             statisticsBuilder.setPacketsMatched(ftStats.getPacketsMatched());
-            
+
             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();
             tableBuilder.setKey(new TableKey(ftStats.getTableId().getValue()));
             tableBuilder.addAugmentation(FlowTableStatisticsData.class, statisticsDataBuilder.build());
@@ -653,70 +653,70 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
 
     @Override
     public void onQueueStatisticsUpdate(QueueStatisticsUpdate notification) {
-        
+
         //Check if response is for the request statistics-manager sent.
         if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
             return;
 
         NodeKey key = new NodeKey(notification.getId());
         sucLogger.debug("Received queue 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<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>());
             }
-            
+
             FlowCapableNodeConnectorQueueStatisticsDataBuilder queueStatisticsDataBuilder = new FlowCapableNodeConnectorQueueStatisticsDataBuilder();
-            
+
             FlowCapableNodeConnectorQueueStatisticsBuilder queueStatisticsBuilder = new FlowCapableNodeConnectorQueueStatisticsBuilder();
-            
+
             queueStatisticsBuilder.fieldsFrom(swQueueStats);
-            
+
             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 
+            InstanceIdentifier<Queue> queueRef
                     = InstanceIdentifier.builder(Nodes.class)
                                         .child(Node.class, key)
                                         .child(NodeConnector.class, new NodeConnectorKey(swQueueStats.getNodeConnectorId()))
                                         .augmentation(FlowCapableNodeConnector.class)
                                         .child(Queue.class, new QueueKey(swQueueStats.getQueueId())).toInstance();
-            
+
             QueueBuilder queueBuilder = new QueueBuilder();
             queueBuilder.addAugmentation(FlowCapableNodeConnectorQueueStatisticsData.class, queueStatisticsDataBuilder.build());
             queueBuilder.setKey(new QueueKey(swQueueStats.getQueueId()));
 
-            sucLogger.info("Augmenting queue statistics {} of queue {} to port {}"
+            sucLogger.trace("Augmenting queue statistics {} of queue {} to port {}"
                                         ,queueStatisticsDataBuilder.build().toString(),
                                         swQueueStats.getQueueId(),
                                         swQueueStats.getNodeConnectorId());
-            
+
             it.putOperationalData(queueRef, queueBuilder.build());
             it.commit();
-            
+
         }
-        
+
     }
 
     private NodeRef getNodeRef(NodeKey nodeKey){
         InstanceIdentifierBuilder<?> builder = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey);
         return new NodeRef(builder.toInstance());
     }
-    
+
     public boolean flowEquals(Flow statsFlow, Flow storedFlow) {
         if (statsFlow.getClass() != storedFlow.getClass()) {
             return false;
@@ -780,28 +780,28 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         }
         return true;
     }
-    
+
     /**
      * Explicit equals method to compare the 'match' for flows stored in the data-stores and flow fetched from the switch.
-     * Usecase: e.g If user don't set any ethernet source and destination address for match,data store will store null for 
+     * Usecase: e.g If user don't set any ethernet source and destination address for match,data store will store null for
      * these address.
      * e.g [_ethernetMatch=EthernetMatch [_ethernetDestination=null, _ethernetSource=null, _ethernetType=
      * EthernetType [_type=EtherType [_value=2048], _mask=null, augmentation=[]]
-     * 
-     * But when you fetch the flows from switch, openflow driver library converts all zero bytes of mac address in the 
-     * message stream to 00:00:00:00:00:00. Following string shows how library interpret the zero mac address bytes and 
-     * eventually when translator convert it to MD-SAL match, this is how it looks 
-     * [_ethernetDestination=EthernetDestination [_address=MacAddress [_value=00:00:00:00:00:00], _mask=null, augmentation=[]], 
-     * _ethernetSource=EthernetSource [_address=MacAddress [_value=00:00:00:00:00:00], _mask=null, augmentation=[]], 
+     *
+     * But when you fetch the flows from switch, openflow driver library converts all zero bytes of mac address in the
+     * message stream to 00:00:00:00:00:00. Following string shows how library interpret the zero mac address bytes and
+     * eventually when translator convert it to MD-SAL match, this is how it looks
+     * [_ethernetDestination=EthernetDestination [_address=MacAddress [_value=00:00:00:00:00:00], _mask=null, augmentation=[]],
+     * _ethernetSource=EthernetSource [_address=MacAddress [_value=00:00:00:00:00:00], _mask=null, augmentation=[]],
      * _ethernetType=EthernetType [_type=EtherType [_value=2048], _mask=null, augmentation=[]]
-     * 
-     * Similarly for inPort, if user/application don't set any value for it, FRM will store null value for it in data store. 
+     *
+     * Similarly for inPort, if user/application don't set any value for it, FRM will store null value for it in data store.
      * When we fetch the same flow (with its statistics) from switch, plugin converts its value to openflow:X:0.
-     *  e.g _inPort=Uri [_value=openflow:1:0]  
-     * 
+     *  e.g _inPort=Uri [_value=openflow:1:0]
+     *
      * So this custom equals method add additional check to take care of these scenario, in case any match element is null in data-store-flow, but not
      * in the flow fetched from switch.
-     * 
+     *
      * @param statsFlow
      * @param storedFlow
      * @return
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 30215318d9d4a301b172c06b9ab4f584b5f8f83c..fc00177c507748f170bdad72ca214961dc43ba17 100644 (file)
@@ -98,7 +98,8 @@
                             org.xml.sax,
                             javax.xml.namespace,
                             javax.xml.xpath,
-                            org.opendaylight.controller.config.api
+                            org.opendaylight.controller.config.api,
+                            org.opendaylight.controller.netconf.util
                         </Import-Package>
                         <Export-Package>
                         </Export-Package>
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 0b623baaa480dde170d6866d7fe1564242ed704e..17a2ced30ae547c27d506c1ed2e92435bb5f0e59 100644 (file)
@@ -8,23 +8,15 @@
 
 package org.opendaylight.controller.netconf.persist.impl;
 
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
 import io.netty.channel.EventLoopGroup;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetSocketAddress;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.annotation.concurrent.Immutable;
-
 import org.opendaylight.controller.config.api.ConflictingVersionException;
 import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.client.NetconfClient;
 import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
+import org.opendaylight.controller.netconf.util.NetconfUtil;
 import org.opendaylight.controller.netconf.util.messages.NetconfMessageAdditionalHeader;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
@@ -35,8 +27,14 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
+import javax.annotation.concurrent.Immutable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetSocketAddress;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 @Immutable
 public class ConfigPusher {
@@ -84,8 +82,7 @@ public class ConfigPusher {
         int maxAttempts = 30;
         for(int i = 0 ; i < maxAttempts; i++) {
             NetconfClient netconfClient = makeNetconfConnection(configSnapshotHolder.getCapabilities(), oldClientForPossibleReuse);
-            final String configSnapshot = configSnapshotHolder.getConfigSnapshot();
-            logger.trace("Pushing following xml to netconf {}", configSnapshot);
+            logger.trace("Pushing following xml to netconf {}", configSnapshotHolder);
             try {
                 pushLastConfig(configSnapshotHolder, netconfClient);
                 return netconfClient;
@@ -151,7 +148,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);
@@ -170,33 +167,26 @@ 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");
 
         // sending message to netconf
         NetconfMessage responseMessage = getResponse(message, netconfClient);
 
-        XmlElement element = XmlElement.fromDomDocument(responseMessage.getDocument());
-        Preconditions.checkState(element.getName().equals(XmlNetconfConstants.RPC_REPLY_KEY));
-        element = element.getOnlyChildElement();
-
-        Util.checkIsOk(element, responseMessage);
+        NetconfUtil.checkIsMessageOk(responseMessage);
         response.append(XmlUtil.toString(responseMessage.getDocument()));
         response.append("}");
         responseMessage = getResponse(getNetconfMessageFromResource("/netconfOp/commit.xml"), netconfClient);
 
-        element = XmlElement.fromDomDocument(responseMessage.getDocument());
-        Preconditions.checkState(element.getName().equals(XmlNetconfConstants.RPC_REPLY_KEY));
-        element = element.getOnlyChildElement();
 
-        Util.checkIsOk(element, responseMessage);
+
+        NetconfUtil.checkIsMessageOk(responseMessage);
         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 86a024a240db6b97ba45cb493dba36b8fe1d1d62..322a9b753b123c006a4298b3209163b9ea82e9ed 100644 (file)
@@ -8,19 +8,11 @@
 
 package org.opendaylight.controller.netconf.persist.impl;
 
-import org.opendaylight.controller.config.api.ConflictingVersionException;
-import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.client.NetconfClient;
 import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
-import org.opendaylight.controller.netconf.util.xml.XMLNetconfUtil;
-import org.opendaylight.controller.netconf.util.xml.XmlElement;
-import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
-import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
 import java.util.Set;
 
 public final class Util {
@@ -58,27 +50,4 @@ public final class Util {
             }
         }
     }
-
-
-    public static void checkIsOk(XmlElement element, NetconfMessage responseMessage) throws ConflictingVersionException {
-        if (element.getName().equals(XmlNetconfConstants.OK)) {
-            return;
-        }
-
-        if (element.getName().equals(XmlNetconfConstants.RPC_ERROR)) {
-            logger.warn("Can not load last configuration, operation failed");
-            // is it ConflictingVersionException ?
-            XPathExpression xPathExpression = XMLNetconfUtil.compileXPath("/netconf:rpc-reply/netconf:rpc-error/netconf:error-info/netconf:error");
-            String error = (String) XmlUtil.evaluateXPath(xPathExpression, element.getDomElement(), XPathConstants.STRING);
-            if (error!=null && error.contains(ConflictingVersionException.class.getCanonicalName())) {
-                throw new ConflictingVersionException(error);
-            }
-            throw new IllegalStateException("Can not load last configuration, operation failed: "
-                    + XmlUtil.toString(responseMessage.getDocument()));
-        }
-
-        logger.warn("Can not load last configuration. Operation failed.");
-        throw new IllegalStateException("Can not load last configuration. Operation failed: "
-                + XmlUtil.toString(responseMessage.getDocument()));
-    }
 }
diff --git a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java
new file mode 100644 (file)
index 0000000..7f1d289
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.netconf.client;
+
+import io.netty.channel.nio.NioEventLoopGroup;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.util.NetconfUtil;
+import org.opendaylight.controller.netconf.util.handler.ssh.authentication.LoginPassword;
+
+import java.net.InetSocketAddress;
+
+@Ignore
+public class SSHNetconfClientLiveTest {
+
+    NioEventLoopGroup nettyThreadgroup;
+    NetconfSshClientDispatcher netconfClientDispatcher;
+
+    @Before
+    public void setUp() {
+        nettyThreadgroup = new NioEventLoopGroup();
+        netconfClientDispatcher = new NetconfSshClientDispatcher(new LoginPassword(
+                System.getProperty("username"), System.getProperty("password")),
+                nettyThreadgroup, nettyThreadgroup);
+    }
+
+    @Test
+    public void test() throws Exception {
+        InetSocketAddress address = new InetSocketAddress(System.getProperty("host"), 830);
+        int connectionAttempts = 10, attemptMsTimeout = 1000;
+
+        NetconfClient netconfClient = new NetconfClient("client", address, connectionAttempts,
+            attemptMsTimeout, netconfClientDispatcher);
+
+        netconfClient.getCapabilities();
+
+        NetconfMessage netconfMessage = NetconfUtil.createMessage(getClass().getResourceAsStream("/get_schema.xml"));
+        NetconfMessage response = netconfClient.sendMessage(netconfMessage);
+        NetconfUtil.checkIsMessageOk(response);
+    }
+}
diff --git a/opendaylight/netconf/netconf-client/src/test/resources/get_schema.xml b/opendaylight/netconf/netconf-client/src/test/resources/get_schema.xml
new file mode 100644 (file)
index 0000000..3bc5200
--- /dev/null
@@ -0,0 +1,9 @@
+<rpc message-id="2"
+     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
+        <identifier>ietf-netconf-monitoring</identifier>
+        <format
+                xmlns:ncm="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">ncm:yang
+        </format>
+    </get-schema>
+</rpc>
\ No newline at end of file
index 91734beacbf57f3e164411b6832dcfda1ac93a02..3c14d5124f395f54182ce125e1a9bed4ccf03d93 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfServerSessionPreferences;
 import org.opendaylight.controller.netconf.impl.mapping.CapabilityProvider;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener;
-import org.opendaylight.controller.netconf.impl.util.NetconfUtil;
+import org.opendaylight.controller.netconf.util.NetconfUtil;
 import org.opendaylight.controller.netconf.util.xml.XMLNetconfUtil;
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
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
diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/util/NetconfUtil.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/util/NetconfUtil.java
deleted file mode 100644 (file)
index 621c8ea..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.netconf.impl.util;
-
-import com.google.common.base.Preconditions;
-import org.opendaylight.controller.netconf.api.NetconfMessage;
-import org.opendaylight.controller.netconf.util.xml.XmlUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class NetconfUtil {
-
-    private static final Logger logger = LoggerFactory.getLogger(NetconfUtil.class);
-
-    public static NetconfMessage createMessage(final File f) {
-        Preconditions.checkNotNull(f, "File parameter was null");
-        try {
-            return createMessage(new FileInputStream(f));
-        } catch (final FileNotFoundException e) {
-            logger.warn("File {} not found.", f, e);
-        }
-        return null;
-    }
-
-    public static NetconfMessage createMessage(final InputStream is) {
-        Preconditions.checkNotNull(is, "InputStream parameter was null");
-        Document doc = null;
-        try {
-            doc = XmlUtil.readXmlToDocument(is);
-        } catch (final IOException e) {
-            logger.warn("Error ocurred while parsing stream.", e);
-        } catch (final SAXException e) {
-            logger.warn("Error ocurred while final parsing stream.", e);
-        }
-        return (doc == null) ? null : new NetconfMessage(doc);
-    }
-}
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 9078d7de9df01128b4c627dd041a16705d1ec85e..71b7fa6eac991d0274c4ff1da12cbc28c2aabf02 100644 (file)
                             com.siemens.ct.exi.exceptions,
                             com.siemens.ct.exi.api.dom,
                             org.xml.sax.helpers,
+                            org.opendaylight.controller.config.api,
                         </Import-Package>
                     </instructions>
                 </configuration>
diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/NetconfUtil.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/NetconfUtil.java
new file mode 100644 (file)
index 0000000..aae2f71
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * 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.netconf.util;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.config.api.ConflictingVersionException;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.util.xml.XMLNetconfUtil;
+import org.opendaylight.controller.netconf.util.xml.XmlElement;
+import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class NetconfUtil {
+
+    private static final Logger logger = LoggerFactory.getLogger(NetconfUtil.class);
+
+    public static NetconfMessage createMessage(final File f) {
+        Preconditions.checkNotNull(f, "File parameter was null");
+        try {
+            return createMessage(new FileInputStream(f));
+        } catch (final FileNotFoundException e) {
+            logger.warn("File {} not found.", f, e);
+        }
+        return null;
+    }
+
+    public static NetconfMessage createMessage(final InputStream is) {
+        Preconditions.checkNotNull(is, "InputStream parameter was null");
+        Document doc = null;
+        try {
+            doc = XmlUtil.readXmlToDocument(is);
+        } catch (final IOException e) {
+            logger.warn("Error ocurred while parsing stream.", e);
+        } catch (final SAXException e) {
+            logger.warn("Error ocurred while final parsing stream.", e);
+        }
+        return (doc == null) ? null : new NetconfMessage(doc);
+    }
+
+    public static void checkIsMessageOk(NetconfMessage responseMessage) throws ConflictingVersionException {
+        XmlElement element = XmlElement.fromDomDocument(responseMessage.getDocument());
+        Preconditions.checkState(element.getName().equals(XmlNetconfConstants.RPC_REPLY_KEY));
+        element = element.getOnlyChildElement();
+
+        if (element.getName().equals(XmlNetconfConstants.OK)) {
+            return;
+        }
+
+        if (element.getName().equals(XmlNetconfConstants.RPC_ERROR)) {
+            logger.warn("Can not load last configuration, operation failed");
+            // is it ConflictingVersionException ?
+            XPathExpression xPathExpression = XMLNetconfUtil.compileXPath("/netconf:rpc-reply/netconf:rpc-error/netconf:error-info/netconf:error");
+            String error = (String) XmlUtil.evaluateXPath(xPathExpression, element.getDomElement(), XPathConstants.STRING);
+            if (error!=null && error.contains(ConflictingVersionException.class.getCanonicalName())) {
+                throw new ConflictingVersionException(error);
+            }
+            throw new IllegalStateException("Can not load last configuration, operation failed: "
+                    + XmlUtil.toString(responseMessage.getDocument()));
+        }
+
+        logger.warn("Can not load last configuration. Operation failed.");
+        throw new IllegalStateException("Can not load last configuration. Operation failed: "
+                + XmlUtil.toString(responseMessage.getDocument()));
+    }
+}
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));
     }
@@ -5,12 +5,11 @@
  * 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.netconf.persist.impl;
+package org.opendaylight.controller.netconf.util;
 
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ConflictingVersionException;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
-import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.w3c.dom.Document;
 
@@ -18,17 +17,16 @@ import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 import static org.junit.matchers.JUnitMatchers.containsString;
 
-public class ConfigPersisterNotificationHandlerTest {
+public class NetconfUtilTest {
 
     @Test
     public void testConflictingVersionDetection() throws Exception {
-        Document document = XmlUtil.readXmlToDocument(getClass().getResourceAsStream("/conflictingVersionResponse.xml"));
+        Document document = XmlUtil.readXmlToDocument(getClass().getResourceAsStream("/netconfMessages/conflictingversion/conflictingVersionResponse.xml"));
         try{
-            Util.checkIsOk(XmlElement.fromDomDocument(document).getOnlyChildElement(), new NetconfMessage(document));
+            NetconfUtil.checkIsMessageOk(new NetconfMessage(document));
             fail();
         }catch(ConflictingVersionException e){
             assertThat(e.getMessage(), containsString("Optimistic lock failed. Expected parent version 21, was 18"));
         }
     }
-
 }
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 9dba530c341237763c96cab63ac0c50e54e88364..1e910d18fb98ac50e719a09703ad6e4343d57798 100644 (file)
@@ -3,9 +3,7 @@ package org.opendaylight.controller.northbound.commons;
 import org.junit.Assert;
 import org.junit.Test;
 
-import junit.framework.TestCase;
-
-public class CommonsNorthboundTest extends TestCase {
+public class CommonsNorthboundTest {
 
     @Test
     public void testRestMessages() {
index 0a282b9b28b8c3c68ca31e3419a39b0f607105c2..c3296441109b00e5335dde7af1984fbfc4ff3001 100644 (file)
@@ -5,9 +5,7 @@ import javax.ws.rs.core.Response;
 import org.junit.Assert;
 import org.junit.Test;
 
-import junit.framework.TestCase;
-
-public class CommonsNorthboundExceptionTest extends TestCase {
+public class CommonsNorthboundExceptionTest {
 
     @Test
     public void testMethodNotAllowed() {
index a57e615618a8b0854e9ed07721c6df1d2857b247..7f8b0b43bfc0ad227f6ac98b7929bdb35ff3d75a 100644 (file)
@@ -3,13 +3,11 @@ package org.opendaylight.controller.controllermanager.northbound;
 import java.util.HashSet;
 import java.util.Set;
 
-import junit.framework.TestCase;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Property;
 
-public class ControllerManagerNorthboundTest extends TestCase {
+public class ControllerManagerNorthboundTest {
 
     @Test
     public void testControllerProperties() {
index 2023d5256109f734668de07265bac6b01906489f..ac15a91f43a6caa0c2b4480057a9fe4150f2e034 100644 (file)
@@ -6,9 +6,7 @@ import java.util.List;
 import org.junit.Assert;
 import org.junit.Test;
 
-import junit.framework.TestCase;
-
-public class StaticRoutingNorthboundTest extends TestCase {
+public class StaticRoutingNorthboundTest {
 
     @Test
     public void testStaticRoute() {
index 0764c0b0077d25f9d33e2d173079a16e2bae9078..d09ff04574095a9d771ff08c655f993ded13a0b5 100644 (file)
@@ -12,8 +12,6 @@ package org.opendaylight.controller.statistics.northbound;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
@@ -22,7 +20,7 @@ import org.opendaylight.controller.sal.reader.NodeConnectorStatistics;
 import org.opendaylight.controller.sal.reader.NodeTableStatistics;
 import org.opendaylight.controller.sal.utils.NodeCreator;
 
-public class StatisticsNorthboundTest extends TestCase {
+public class StatisticsNorthboundTest {
 
     @Test
     public void testFlowStatistics() {
index 5386d4142fd55f0d3c7c79a5254aaa4faa70710b..f9a88d2e28526a35cbc0c149bd8008887c4ff622 100644 (file)
@@ -1,22 +1,20 @@
 package org.opendaylight.controller.switchmanager.northbound;
 
 
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.ArrayList;
 
 import org.junit.Assert;
 import org.junit.Test;
-import junit.framework.TestCase;
-
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.core.Property;
 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
 import org.opendaylight.controller.sal.utils.NodeCreator;
 
-public class SwitchManagerNorthboundTest extends TestCase {
+public class SwitchManagerNorthboundTest {
 
         @Test
         public void testNodes() {
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 4fd3f4a32de5964fe7f2b0df20c4125497e71eb6..cfffb7e73aa8c83e0bca5ec2af19b11d6ebb5c97 100644 (file)
@@ -17,14 +17,12 @@ import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember;
 import org.opendaylight.controller.samples.loadbalancer.entities.VIP;\r
 import org.opendaylight.controller.samples.loadbalancer.policies.RoundRobinLBPolicy;\r
 \r
-import junit.framework.TestCase;\r
-\r
 /**\r
  *\r
  * Class to unit test the load balancing policies.\r
  *\r
  */\r
-public class LoadBalancerTest extends TestCase {\r
+public class LoadBalancerTest {\r
     @Test\r
     public void testRoundRobinPolicy() {\r
         ConfigManager cm = null;\r
@@ -65,4 +63,4 @@ public class LoadBalancerTest extends TestCase {
         c1 = new Client("10.0.0.1","TCP",(short)5003);\r
         Assert.assertTrue(rrp.getPoolMemberForClient(c1, vip).equals(host4.getIp()));\r
     }\r
-}
\ No newline at end of file
+}
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) {