Merge "BUG-2573: mark CompositeNode-based RPC APIs obsolete"
authorTony Tkacik <ttkacik@cisco.com>
Wed, 18 Feb 2015 09:31:01 +0000 (09:31 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 18 Feb 2015 09:31:01 +0000 (09:31 +0000)
54 files changed:
features/pom.xml
opendaylight/commons/opendaylight/pom.xml
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/controller/config/yang/protocol/framework/NeverReconnectStrategyFactoryModule.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/controller/config/yang/protocol/framework/NeverReconnectStrategyFactoryModuleFactory.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/controller/config/yang/protocol/framework/ReconnectImmediatelyStrategyFactoryModule.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/controller/config/yang/protocol/framework/ReconnectImmediatelyStrategyFactoryModuleFactory.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/controller/config/yang/protocol/framework/TimedReconnectStrategyFactoryModule.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/controller/config/yang/protocol/framework/TimedReconnectStrategyFactoryModuleFactory.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractProtocolSession.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/NeverReconnectStrategy.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSession.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSessionPromise.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ReconnectImmediatelyStrategy.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ReconnectPromise.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ReconnectStrategy.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ReconnectStrategyFactory.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/SessionListener.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/SessionListenerFactory.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/SessionNegotiator.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/SessionNegotiatorFactory.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/TerminationReason.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/TimedReconnectStrategy.java
opendaylight/config/config-api/pom.xml
opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/ConfigPushingRunnable.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/InitiateInstallSnapshot.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImplTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMRpcIdentifier.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransaction.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDOMStoreTransaction.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SnapshotBackedWriteTransaction.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/ReadOnlyTx.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/schema/NetconfRemoteSchemaYangSourceProvider.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfBaseOps.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfMessageTransformUtil.java
opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/ReadOnlyTxTest.java [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/pom.xml
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusherImpl.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java
opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/NetconfDeviceSimulator.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/test/XmlFileLoader.java
opendaylight/networkconfiguration/neutron/features/pom.xml [moved from features/neutron/pom.xml with 100% similarity]
opendaylight/networkconfiguration/neutron/features/src/main/resources/features.xml [moved from features/neutron/src/main/resources/features.xml with 100% similarity]
opendaylight/networkconfiguration/neutron/northbound/pom.xml
pom.xml

index ed4fa499a9aeb075d3308474c33997742b49b537..9363d9e03be18c1e7af7a889e9902e9fc905e312 100644 (file)
@@ -22,6 +22,5 @@
     <module>netconf-connector</module>
     <module>restconf</module>
     <module>extras</module>
-    <module>neutron</module>
   </modules>
 </project>
index 6cc363b96fba04cf18232432e0b713e7d65af200..70b60c2dd584bce887d2bf1c9e5b80481ee8da02 100644 (file)
   <properties>
 
     <akka.version>2.3.4</akka.version>
-    <aopalliance.version>1.0.0</aopalliance.version>
     <appauth.version>0.5.0-SNAPSHOT</appauth.version>
     <archetype-app-northbound>0.1.0-SNAPSHOT</archetype-app-northbound>
-    <aries.util.version>1.1.0</aries.util.version>
     <arphandler.version>0.6.0-SNAPSHOT</arphandler.version>
-    <!-- Controller Modules Versions -->
-    <asm.version>4.1</asm.version>
     <!-- Plugin Versions -->
-    <bouncycastle.version>1.50</bouncycastle.version>
-    <bundle.plugin.version>2.4.0</bundle.plugin.version>
     <bundlescanner.api.version>0.5.0-SNAPSHOT</bundlescanner.api.version>
     <bundlescanner.implementation.version>0.5.0-SNAPSHOT</bundlescanner.implementation.version>
     <bundlescanner.version>0.5.0-SNAPSHOT</bundlescanner.version>
-    <checkstyle.version>2.12</checkstyle.version>
     <clustering.services.version>0.6.0-SNAPSHOT</clustering.services.version>
     <clustering.services_implementation.version>0.5.0-SNAPSHOT</clustering.services_implementation.version>
     <clustering.stub.version>0.5.0-SNAPSHOT</clustering.stub.version>
     <commons.tomcat.util>7.0.53.v201406070630</commons.tomcat.util>
 
     <commons.checkstyle.version>0.1.0-SNAPSHOT</commons.checkstyle.version>
-    <commons.fileupload.version>1.2.2</commons.fileupload.version>
     <commons.httpclient.version>0.2.0-SNAPSHOT</commons.httpclient.version>
-    <commons.io.version>2.4</commons.io.version>
-    <commons.lang3.version>3.1</commons.lang3.version>
     <commons.logback_settings.version>0.1.0-SNAPSHOT</commons.logback_settings.version>
     <commons.net.version>3.0.1</commons.net.version>
     <commons.opendaylight.commons.httpclient>0.2.0-SNAPSHOT</commons.opendaylight.commons.httpclient>
     <commons.opendaylight.concepts.version>0.6.0-SNAPSHOT</commons.opendaylight.concepts.version>
     <commons.opendaylight.version>1.5.0-SNAPSHOT</commons.opendaylight.version>
     <commons.parent.version>1.1.0-SNAPSHOT</commons.parent.version>
-    <compiler.version>2.3.2</compiler.version>
     <commons.httpclient.version>0.2.0-SNAPSHOT</commons.httpclient.version>
     <concepts.version>0.6.0-SNAPSHOT</concepts.version>
     <concurrentlinkedhashmap.version>1.4</concurrentlinkedhashmap.version>
     <config.statistics.manager.configfile>30-statistics-manager.xml</config.statistics.manager.configfile>
     <eclipse.persistence.version>2.5.0</eclipse.persistence.version>
     <eclipse.jdt.core.compiler.batch.version>3.8.0.I20120518-2145</eclipse.jdt.core.compiler.batch.version>
-    <!-- enforcer version -->
-    <enforcer.version>1.3.1</enforcer.version>
-    <enunciate.version>1.28</enunciate.version>
 
     <!-- OpenEXI third party lib for netconf-->
-
     <exi.nagasena.version>0000.0002.0038.0</exi.nagasena.version>
     <felix.util.version>1.6.0</felix.util.version>
     <filtervalve.version>1.5.0-SNAPSHOT</filtervalve.version>
     <leveldb.version>0.7</leveldb.version>
     <leveldbjni.version>1.8</leveldbjni.version>
     <lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
-    <logback.version>1.0.9</logback.version>
     <logging.bridge.version>0.5.0-SNAPSHOT</logging.bridge.version>
     <maven.plugin.api.version>3.0.5</maven.plugin.api.version>
     <mimepull.version>1.9.4</mimepull.version>
index a97f65e941c890df21f1bf595fd755d59f8e7659..31e7a24feec44ed63581e41e09ad9d711f7338a2 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.protocol.framework.ReconnectStrategyFactory;
 /**
 *
 */
+@Deprecated
 public final class NeverReconnectStrategyFactoryModule extends org.opendaylight.controller.config.yang.protocol.framework.AbstractNeverReconnectStrategyFactoryModule
  {
 
index 7f5233c827c2624befc01adb1b9c02a5da30c606..7b8816bd1b38843f2b0440c2bc565beaa13144fa 100644 (file)
@@ -39,6 +39,7 @@ import io.netty.util.concurrent.Promise;
  * Dispatcher class for creating servers and clients. The idea is to first create servers and clients and the run the
  * start method that will handle sockets in different thread.
  */
+@Deprecated
 public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends SessionListener<?, ?, ?>> implements Closeable {
 
 
index af196a941a777df18eacc9d2929a3048e57677ab..44afc4e7a1f18c52b61916a8e3948343122956c1 100644 (file)
@@ -13,6 +13,7 @@ import io.netty.channel.SimpleChannelInboundHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Deprecated
 public abstract class AbstractProtocolSession<M> extends SimpleChannelInboundHandler<Object> implements ProtocolSession<M> {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractProtocolSession.class);
 
index 2ecd267b9f47b195b406b4ed0d8c8fd3b068937a..8a19828c578d21b5a29b0c6ca14ddbea5831b889 100644 (file)
@@ -27,6 +27,7 @@ import com.google.common.base.Preconditions;
  * @param <M> Protocol message type
  * @param <S> Protocol session type, has to extend ProtocolSession<M>
  */
+@Deprecated
 public abstract class AbstractSessionNegotiator<M, S extends AbstractProtocolSession<?>> extends ChannelInboundHandlerAdapter implements SessionNegotiator<S> {
     private final Logger LOG = LoggerFactory.getLogger(AbstractSessionNegotiator.class);
     private final Promise<S> promise;
index c4802944178ba37d8636924c73cd51c383a6871c..926183f973ed43ec722a8350b846d83d4a1024f6 100644 (file)
@@ -18,6 +18,7 @@ import com.google.common.base.Preconditions;
  * Utility ReconnectStrategy singleton, which will cause the reconnect process
  * to always fail.
  */
+@Deprecated
 @ThreadSafe
 public final class NeverReconnectStrategy implements ReconnectStrategy {
     private final EventExecutor executor;
index 6e79d6765dce0ff50ff10c168440469331690b2a..b99844112f7789b918f337a88390ba03ef984f1f 100644 (file)
@@ -17,6 +17,7 @@ import java.io.Closeable;
  *
  * This interface should be implemented by a final class representing a protocol specific session.
  */
+@Deprecated
 public interface ProtocolSession<T> extends Closeable {
     @Override
     void close();
index a38db61eaddcdb4ebd2daa79f03790fc6bde2007..b64c4828a4a7315524afc3370a6bca95c8711b29 100644 (file)
@@ -23,6 +23,7 @@ import javax.annotation.concurrent.ThreadSafe;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Deprecated
 @ThreadSafe
 final class ProtocolSessionPromise<S extends ProtocolSession<?>> extends DefaultPromise<S> {
     private static final Logger LOG = LoggerFactory.getLogger(ProtocolSessionPromise.class);
index a567af1f762aac9016b9ccfefc2a54f239f44b6c..56cdcfb0c35b09e673984d7846d379395a1e0c1a 100644 (file)
@@ -21,6 +21,7 @@ import com.google.common.base.Preconditions;
  * Utility ReconnectStrategy singleton, which will cause the reconnect process
  * to immediately schedule a reconnection attempt.
  */
+@Deprecated
 @ThreadSafe
 public final class ReconnectImmediatelyStrategy implements ReconnectStrategy {
     private static final Logger LOG = LoggerFactory.getLogger(ReconnectImmediatelyStrategy.class);
index 865c666ad299ccbf86e260ed9f477d052763695f..e57976449bef78f2c6422420233f2d60e79fd0cd 100644 (file)
@@ -21,6 +21,7 @@ import java.net.InetSocketAddress;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Deprecated
 final class ReconnectPromise<S extends ProtocolSession<?>, L extends SessionListener<?, ?, ?>> extends DefaultPromise<Void> {
     private static final Logger LOG = LoggerFactory.getLogger(ReconnectPromise.class);
 
index 24ff84b6ab3466a8815d1afb4a4bf972480c7495..a0a91507997fa34bc5518de9cf18a5266e59d818 100644 (file)
@@ -23,6 +23,7 @@ import io.netty.util.concurrent.Future;
  * not attempt any more connection attempts and should abort the reconnection
  * process.
  */
+@Deprecated
 public interface ReconnectStrategy {
     /**
      * Query the strategy for the connect timeout.
index 3c61044beeeaf4714c8a5caf45eb8477c063697c..a71fa677c82539b2426452d8cda827d4d80084d8 100644 (file)
@@ -12,6 +12,7 @@ package org.opendaylight.protocol.framework;
  * primarily useful for allowing injection of a specific type of strategy for
  * on-demand use, pretty much like you would use a ThreadFactory.
  */
+@Deprecated
 public interface ReconnectStrategyFactory {
     /**
      * Create a new ReconnectStrategy.
index a756a0da7e780e84510d8e329b475b9342e0c9e7..dfe0208c54b33156892843bf961c0e0ad6aafd6c 100644 (file)
@@ -14,6 +14,7 @@ import java.util.EventListener;
  * implemented by a protocol specific abstract class, that is extended by
  * a final class that implements the methods.
  */
+@Deprecated
 public interface SessionListener<M, S extends ProtocolSession<?>, T extends TerminationReason> extends EventListener {
     /**
      * Fired when the session was established successfully.
index 11871286cf7f01e2f386487d1137f8d228bd1b0b..99087a5434538461f28887866c4fe2bf0c30a6f1 100644 (file)
@@ -13,6 +13,7 @@ package org.opendaylight.protocol.framework;
  * implemented by a protocol specific abstract class, that is extended by
  * a final class that implements the methods.
  */
+@Deprecated
 public interface SessionListenerFactory<T extends SessionListener<?, ?, ?>> {
     /**
      * Returns one session listener
index 3de64b07ff589f49a0428b55288d7a34c9628040..c2abf50716648b87405c338cf809dfb8a31c55fb 100644 (file)
@@ -17,6 +17,7 @@ import io.netty.channel.ChannelInboundHandler;
  *
  * @param <T> Protocol session type.
  */
+@Deprecated
 public interface SessionNegotiator<T extends ProtocolSession<?>> extends ChannelInboundHandler {
 
 }
index 90844ca712a1d012b15f390618fd68f19dcd238d..66293f368fa66f2a46cfdcd03b806c7ab9df7328 100644 (file)
@@ -15,6 +15,7 @@ import io.netty.util.concurrent.Promise;
  *
  * @param <S> session type
  */
+@Deprecated
 public interface SessionNegotiatorFactory<M, S extends ProtocolSession<?>, L extends SessionListener<?, ?, ?>> {
     /**
      * Create a new negotiator attached to a channel, which will notify
index 1a6179dc3548175a2b6287f2af1d021a6391d668..19d11125e5b86aa42df55aa9189cceddd396756d 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.framework;
 /**
  * Marker interface for grouping session termination cause.
  */
+@Deprecated
 public interface TerminationReason {
 
     /**
index 8bb326821dcd98d4e2a300b2ce595d07824e55e4..ecb9e65a528a104f0e7727f45e65f97d9e583c44 100644 (file)
@@ -42,6 +42,7 @@ import com.google.common.base.Preconditions;
  *
  * Both these caps can be combined, with the strategy giving up as soon as the first one is reached.
  */
+@Deprecated
 @ThreadSafe
 public final class TimedReconnectStrategy implements ReconnectStrategy {
     private static final Logger LOG = LoggerFactory.getLogger(TimedReconnectStrategy.class);
index eff635c17e9f2d80c502b326ef285c8688e85bfe..d76bd50a3d646e49be9eca943a1b5e61b79f3304 100644 (file)
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
+
+      <!-- We are adding generated code which is bound to OSGi, so we need
+           to make sure anyone dependending on this artifact inherits it -->
+      <scope>compile</scope>
     </dependency>
       <dependency>
           <groupId>org.opendaylight.yangtools</groupId>
index 5c257effba14cfe740c7ad10d1d94527beaf0546..a32a0ac28fe5591435b2444a7a6d73589b5f287e 100644 (file)
@@ -33,7 +33,7 @@ public class ConfigPushingRunnable implements Runnable {
     @Override
     public void run() {
         List<Feature> toInstall = new ArrayList<Feature>();
-        FeatureEvent event;
+        FeatureEvent event = null;
         boolean interuppted = false;
         while(true) {
             try {
@@ -54,7 +54,7 @@ public class ConfigPushingRunnable implements Runnable {
                 LOG.error("ConfigPushingRunnable - interupted");
                 interuppted = true;
             } catch (Exception e) {
-                LOG.error("Exception while processing features ", e);
+                LOG.error("Exception while processing features {} event {}", toInstall, event, e);
             }
         }
     }
index 0fed63098d6da1edfb6229245ffd63d1e4e4b7df..935c4f0bbd7495de286196a0ce65e2502cf93f95 100644 (file)
@@ -19,7 +19,7 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
 
     private final String id;
 
-    private final Stopwatch stopwatch = new Stopwatch();
+    private final Stopwatch stopwatch = Stopwatch.createUnstarted();
 
     private final long followerTimeoutMillis;
 
index 3dc6ae469a932474effca186c956a7a6f4ec8631..1f446c72f1ee9eccef904866236c1ec5ea235fb9 100644 (file)
@@ -126,8 +126,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
 
     private void initRecoveryTimer() {
         if(recoveryTimer == null) {
-            recoveryTimer = new Stopwatch();
-            recoveryTimer.start();
+            recoveryTimer = Stopwatch.createStarted();
         }
     }
 
@@ -190,8 +189,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         context.setLastApplied(snapshot.getLastAppliedIndex());
         context.setCommitIndex(snapshot.getLastAppliedIndex());
 
-        Stopwatch timer = new Stopwatch();
-        timer.start();
+        Stopwatch timer = Stopwatch.createStarted();
 
         // Apply the snapshot to the actors state
         applyRecoverySnapshot(snapshot.getState());
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/InitiateInstallSnapshot.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/InitiateInstallSnapshot.java
deleted file mode 100644 (file)
index 7844914..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2014 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.cluster.raft.base.messages;
-
-/**
- * Internal message by Leader to initiate an install snapshot
- */
-public class InitiateInstallSnapshot {
-}
-
index 9b6c08857a50d50e81065c52c39c6c5469687ad9..9e4f3b46c45b5de54458770b910b63f6c70305a8 100644 (file)
@@ -34,7 +34,6 @@ import org.opendaylight.controller.cluster.raft.RaftActorContext;
 import org.opendaylight.controller.cluster.raft.RaftState;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
 import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshot;
-import org.opendaylight.controller.cluster.raft.base.messages.InitiateInstallSnapshot;
 import org.opendaylight.controller.cluster.raft.base.messages.Replicate;
 import org.opendaylight.controller.cluster.raft.base.messages.SendHeartBeat;
 import org.opendaylight.controller.cluster.raft.base.messages.SendInstallSnapshot;
@@ -309,9 +308,6 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
                 sendHeartBeat();
                 return this;
 
-            } else if(message instanceof InitiateInstallSnapshot) {
-                installSnapshotIfNeeded();
-
             } else if(message instanceof SendInstallSnapshot) {
                 // received from RaftActor
                 setSnapshot(Optional.of(((SendInstallSnapshot) message).getSnapshot()));
@@ -488,12 +484,13 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
                             followerNextIndex, leaderSnapShotIndex, leaderLastIndex
                         );
                     }
-                    actor().tell(new InitiateInstallSnapshot(), actor());
 
                     // Send heartbeat to follower whenever install snapshot is initiated.
                     sendAppendEntriesToFollower(followerActor, followerLogInformation.getNextIndex(),
                             Collections.<ReplicatedLogEntry>emptyList(), followerId);
 
+                    initiateCaptureSnapshot(followerId, followerNextIndex);
+
                 } else if(sendHeartbeat) {
                     //we send an AppendEntries, even if the follower is inactive
                     // in-order to update the followers timestamp, in case it becomes active again
@@ -521,74 +518,57 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
     }
 
     /**
-     * An installSnapshot is scheduled at a interval that is a multiple of
-     * a HEARTBEAT_INTERVAL. This is to avoid the need to check for installing
-     * snapshots at every heartbeat.
-     *
+     * /**
      * Install Snapshot works as follows
-     * 1. Leader sends a InitiateInstallSnapshot message to self
-     * 2. Leader then initiates the capture snapshot by sending a CaptureSnapshot message to actor
-     * 3. RaftActor on receipt of the CaptureSnapshotReply (from Shard), stores the received snapshot in the replicated log
+     * 1. Leader initiates the capture snapshot by sending a CaptureSnapshot message to actor
+     * 2. RaftActor on receipt of the CaptureSnapshotReply (from Shard), stores the received snapshot in the replicated log
      * and makes a call to Leader's handleMessage , with SendInstallSnapshot message.
-     * 4. Leader , picks the snapshot from im-mem ReplicatedLog and sends it in chunks to the Follower
-     * 5. On complete, Follower sends back a InstallSnapshotReply.
-     * 6. On receipt of the InstallSnapshotReply for the last chunk, Leader marks the install complete for that follower
+     * 3. Leader , picks the snapshot from im-mem ReplicatedLog and sends it in chunks to the Follower
+     * 4. On complete, Follower sends back a InstallSnapshotReply.
+     * 5. On receipt of the InstallSnapshotReply for the last chunk, Leader marks the install complete for that follower
      * and replenishes the memory by deleting the snapshot in Replicated log.
-     *
+     * 6. If another follower requires a snapshot and a snapshot has been collected (via CaptureSnapshotReply)
+     * then send the existing snapshot in chunks to the follower.
+     * @param followerId
+     * @param followerNextIndex
      */
-    private void installSnapshotIfNeeded() {
+    private void initiateCaptureSnapshot(String followerId, long followerNextIndex) {
         if(LOG.isDebugEnabled()) {
-            LOG.debug("{}: installSnapshotIfNeeded, followers {}", context.getId(), followerToLog.keySet());
+            LOG.debug("{}: initiateCaptureSnapshot, followers {}", context.getId(), followerToLog.keySet());
         }
 
-        for (Entry<String, FollowerLogInformation> e : followerToLog.entrySet()) {
-            final ActorSelection followerActor = context.getPeerActorSelection(e.getKey());
-
-            if (followerActor != null) {
-                long nextIndex = e.getValue().getNextIndex();
-
-                if (!context.getReplicatedLog().isPresent(nextIndex) &&
-                        context.getReplicatedLog().isInSnapshot(nextIndex)) {
-                    LOG.info("{}: {} follower needs a snapshot install", context.getId(), e.getKey());
-                    if (snapshot.isPresent()) {
-                        // if a snapshot is present in the memory, most likely another install is in progress
-                        // no need to capture snapshot
-                        sendSnapshotChunk(followerActor, e.getKey());
-
-                    } else if (!context.isSnapshotCaptureInitiated()) {
-                        initiateCaptureSnapshot();
-                        //we just need 1 follower who would need snapshot to be installed.
-                        // when we have the snapshot captured, we would again check (in SendInstallSnapshot)
-                        // who needs an install and send to all who need
-                        break;
-                    }
+        if (!context.getReplicatedLog().isPresent(followerNextIndex) &&
+                context.getReplicatedLog().isInSnapshot(followerNextIndex)) {
 
+            if (snapshot.isPresent()) {
+                // if a snapshot is present in the memory, most likely another install is in progress
+                // no need to capture snapshot.
+                // This could happen if another follower needs an install when one is going on.
+                final ActorSelection followerActor = context.getPeerActorSelection(followerId);
+                sendSnapshotChunk(followerActor, followerId);
+
+            } else if (!context.isSnapshotCaptureInitiated()) {
+
+                LOG.info("{}: Initiating Snapshot Capture to Install Snapshot, Leader:{}", context.getId(), getLeaderId());
+                ReplicatedLogEntry lastAppliedEntry = context.getReplicatedLog().get(context.getLastApplied());
+                long lastAppliedIndex = -1;
+                long lastAppliedTerm = -1;
+
+                if (lastAppliedEntry != null) {
+                    lastAppliedIndex = lastAppliedEntry.getIndex();
+                    lastAppliedTerm = lastAppliedEntry.getTerm();
+                } else if (context.getReplicatedLog().getSnapshotIndex() > -1)  {
+                    lastAppliedIndex = context.getReplicatedLog().getSnapshotIndex();
+                    lastAppliedTerm = context.getReplicatedLog().getSnapshotTerm();
                 }
-            }
-        }
-    }
-
-    // on every install snapshot, we try to capture the snapshot.
-    // Once a capture is going on, another one issued will get ignored by RaftActor.
-    private void initiateCaptureSnapshot() {
-        LOG.info("{}: Initiating Snapshot Capture to Install Snapshot, Leader:{}", context.getId(), getLeaderId());
-        ReplicatedLogEntry lastAppliedEntry = context.getReplicatedLog().get(context.getLastApplied());
-        long lastAppliedIndex = -1;
-        long lastAppliedTerm = -1;
 
-        if (lastAppliedEntry != null) {
-            lastAppliedIndex = lastAppliedEntry.getIndex();
-            lastAppliedTerm = lastAppliedEntry.getTerm();
-        } else if (context.getReplicatedLog().getSnapshotIndex() > -1)  {
-            lastAppliedIndex = context.getReplicatedLog().getSnapshotIndex();
-            lastAppliedTerm = context.getReplicatedLog().getSnapshotTerm();
+                boolean isInstallSnapshotInitiated = true;
+                actor().tell(new CaptureSnapshot(lastIndex(), lastTerm(),
+                                lastAppliedIndex, lastAppliedTerm, isInstallSnapshotInitiated),
+                        actor());
+                context.setSnapshotCaptureInitiated(true);
+            }
         }
-
-        boolean isInstallSnapshotInitiated = true;
-        actor().tell(new CaptureSnapshot(lastIndex(), lastTerm(),
-                lastAppliedIndex, lastAppliedTerm, isInstallSnapshotInitiated),
-            actor());
-        context.setSnapshotCaptureInitiated(true);
     }
 
 
index a092c46533d251414ee7f22cf843c4fc3765f691..84d1545a65e3302462b69f9ee96f8dd982955654 100644 (file)
@@ -55,8 +55,7 @@ public class FollowerLogInformationImplTest {
     // hence getting the actual elapsed time and do a match.
     // if the sleep has spilled over, then return the test gracefully
     private long sleepWithElaspsedTimeReturned(long millis) {
-        Stopwatch stopwatch = new Stopwatch();
-        stopwatch.start();
+        Stopwatch stopwatch = Stopwatch.createStarted();
         Uninterruptibles.sleepUninterruptibly(millis, TimeUnit.MILLISECONDS);
         stopwatch.stop();
         return stopwatch.elapsed(TimeUnit.MILLISECONDS);
index 56bf6200dc4d328aec1a35b6a35470609fa5cc7e..59046fd779fb1319ed4d8f48bb8f6911b9eae301 100644 (file)
@@ -60,7 +60,7 @@ import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
 import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshot;
 import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshotReply;
-import org.opendaylight.controller.cluster.raft.base.messages.InitiateInstallSnapshot;
+import org.opendaylight.controller.cluster.raft.base.messages.SendHeartBeat;
 import org.opendaylight.controller.cluster.raft.behaviors.Follower;
 import org.opendaylight.controller.cluster.raft.behaviors.Leader;
 import org.opendaylight.controller.cluster.raft.client.messages.FindLeader;
@@ -1162,7 +1162,7 @@ public class RaftActorTest extends AbstractActorTest {
                 assertEquals(5, leaderActor.getReplicatedLog().size());
 
                 // simulate a real snapshot
-                leaderActor.onReceiveCommand(new InitiateInstallSnapshot());
+                leaderActor.onReceiveCommand(new SendHeartBeat());
                 assertEquals(5, leaderActor.getReplicatedLog().size());
                 assertEquals(String.format("expected to be Leader but was %s. Current Leader = %s ",
                         leaderActor.getCurrentBehavior().state(), leaderActor.getLeaderId())
index 8251c6b265bd5ca85e247119104b4e6b268be9f6..119b958799e815d21b22c18dae11e9ff7415d928 100644 (file)
@@ -31,7 +31,6 @@ import org.opendaylight.controller.cluster.raft.SerializationUtils;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyLogEntries;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
 import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshot;
-import org.opendaylight.controller.cluster.raft.base.messages.InitiateInstallSnapshot;
 import org.opendaylight.controller.cluster.raft.base.messages.IsolatedLeaderCheck;
 import org.opendaylight.controller.cluster.raft.base.messages.Replicate;
 import org.opendaylight.controller.cluster.raft.base.messages.SendHeartBeat;
@@ -359,23 +358,23 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest {
 
             assertTrue(raftBehavior instanceof Leader);
 
-            // we might receive some heartbeat messages, so wait till we InitiateInstallSnapshot
+            // we might receive some heartbeat messages, so wait till we get CaptureSnapshot
             Boolean[] matches = new ReceiveWhile<Boolean>(Boolean.class, duration("2 seconds")) {
                 @Override
                 protected Boolean match(Object o) throws Exception {
-                    if (o instanceof InitiateInstallSnapshot) {
+                    if (o instanceof CaptureSnapshot) {
                         return true;
                     }
                     return false;
                 }
             }.get();
 
-            boolean initiateInitiateInstallSnapshot = false;
+            boolean captureSnapshot = false;
             for (Boolean b: matches) {
-                initiateInitiateInstallSnapshot = b | initiateInitiateInstallSnapshot;
+                captureSnapshot = b | captureSnapshot;
             }
 
-            assertTrue(initiateInitiateInstallSnapshot);
+            assertTrue(captureSnapshot);
         }};
     }
 
@@ -388,12 +387,9 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest {
             ActorRef followerActor = getTestActor();
 
             Map<String, String> peerAddresses = new HashMap<>();
-            peerAddresses.put(followerActor.path().toString(),
-                followerActor.path().toString());
-
+            peerAddresses.put(followerActor.path().toString(), followerActor.path().toString());
 
-            MockRaftActorContext actorContext =
-                (MockRaftActorContext) createActorContext(leaderActor);
+            MockRaftActorContext actorContext = (MockRaftActorContext) createActorContext(leaderActor);
             actorContext.setPeerAddresses(peerAddresses);
 
             Map<String, String> leadersSnapshot = new HashMap<>();
@@ -421,15 +417,16 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest {
             leader.setSnapshot(Optional.<ByteString>absent());
 
             // new entry
-            ReplicatedLogImplEntry entry =
-                new ReplicatedLogImplEntry(newEntryIndex, currentTerm,
+            ReplicatedLogImplEntry entry = new ReplicatedLogImplEntry(newEntryIndex, currentTerm,
                     new MockRaftActorContext.MockPayload("D"));
 
             actorContext.getReplicatedLog().append(entry);
 
-            // this should invoke a sendinstallsnapshot as followersLastIndex < snapshotIndex
+            //update follower timestamp
+            leader.markFollowerActive(followerActor.path().toString());
+
             RaftActorBehavior raftBehavior = leader.handleMessage(
-                leaderActor, new InitiateInstallSnapshot());
+                    senderActor, new Replicate(null, "state-id", entry));
 
             CaptureSnapshot cs = MessageCollectorActor.
                 getFirstMatching(leaderActor, CaptureSnapshot.class);
@@ -443,7 +440,7 @@ public class LeaderTest extends AbstractRaftActorBehaviorTest {
             assertEquals(2, cs.getLastTerm());
 
             // if an initiate is started again when first is in progress, it shouldnt initiate Capture
-            raftBehavior = leader.handleMessage(leaderActor, new InitiateInstallSnapshot());
+            leader.handleMessage(senderActor, new Replicate(null, "state-id", entry));
             List<Object> captureSnapshots = MessageCollectorActor.getAllMatching(leaderActor, CaptureSnapshot.class);
             assertEquals("CaptureSnapshot should not get invoked when  initiate is in progress", 1, captureSnapshots.size());
 
index 3dbac003b9d66b74520d431c2d7ebb45da488fbc..d52965e055262434c3ff34227fdd4ebca898bc5e 100644 (file)
@@ -271,7 +271,7 @@ public class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
         if(newModules.containsAll(knownModules)) {
 
-            LOG.info("New SchemaContext has a super set of current knownModules - persisting info");
+            LOG.debug("New SchemaContext has a super set of current knownModules - persisting info");
 
             knownModules = ImmutableSet.copyOf(newModules);
 
@@ -279,7 +279,7 @@ public class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
                 @Override
                 public void apply(SchemaContextModules param) throws Exception {
-                    LOG.info("Sending new SchemaContext to Shards");
+                    LOG.debug("Sending new SchemaContext to Shards");
                     for (ShardInformation info : localShards.values()) {
                         if (info.getActor() == null) {
                             info.setActor(getContext().actorOf(Shard.props(info.getShardId(),
@@ -293,7 +293,8 @@ public class ShardManager extends AbstractUntypedPersistentActorWithMetering {
 
             });
         } else {
-            LOG.info("Rejecting schema context update because it is not a super set of previously known modules");
+            LOG.debug("Rejecting schema context update - not a super set of previously known modules:\nUPDATE: {}\nKNOWN: {}",
+                    newModules, knownModules);
         }
 
     }
index 9d8227a11b238b71b08133a8f8ea136188d07b93..7ce41a4db1304bd84cbdf2b7e02ce0fd4363e828 100644 (file)
@@ -1345,15 +1345,15 @@ public class TransactionProxyTest {
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
 
-        long start = System.currentTimeMillis();
+        long start = System.nanoTime();
 
         operation.run(transactionProxy);
 
-        long end = System.currentTimeMillis();
+        long end = System.nanoTime();
 
         Assert.assertTrue(String.format("took less time than expected %s was %s",
-                mockActorContext.getDatastoreContext().getOperationTimeoutInSeconds()*1000,
-                (end-start)), (end - start) > mockActorContext.getDatastoreContext().getOperationTimeoutInSeconds()*1000);
+                TimeUnit.SECONDS.toNanos(mockActorContext.getDatastoreContext().getOperationTimeoutInSeconds()),
+                (end-start)), (end - start) > TimeUnit.SECONDS.toNanos(mockActorContext.getDatastoreContext().getOperationTimeoutInSeconds()));
 
     }
 
@@ -1392,15 +1392,15 @@ public class TransactionProxyTest {
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
 
-        long start = System.currentTimeMillis();
+        long start = System.nanoTime();
 
         operation.run(transactionProxy);
 
-        long end = System.currentTimeMillis();
+        long end = System.nanoTime();
 
         Assert.assertTrue(String.format("took more time than expected %s was %s",
-                mockActorContext.getDatastoreContext().getOperationTimeoutInSeconds()*1000,
-                (end-start)), (end - start) <= mockActorContext.getDatastoreContext().getOperationTimeoutInSeconds()*1000);
+                TimeUnit.SECONDS.toNanos(mockActorContext.getDatastoreContext().getOperationTimeoutInSeconds()),
+                (end-start)), (end - start) <= TimeUnit.SECONDS.toNanos(mockActorContext.getDatastoreContext().getOperationTimeoutInSeconds()));
     }
 
     public void testWriteThrottling(boolean shardFound){
index 8ae2a8657d2ec05abd439c6f60376d28b4516114..b9d44b2586f75a34b163322f9888b94419dd7cee 100644 (file)
@@ -80,8 +80,7 @@ public class MutableCompositeModificationTest extends AbstractModificationTest {
             compositeModification.addModification(new WriteModification(writePath, writeData));
         }
 
-        Stopwatch sw = new Stopwatch();
-        sw.start();
+        Stopwatch sw = Stopwatch.createStarted();
         for(int i = 0; i < 1000; i++) {
             new ModificationPayload(compositeModification);
         }
index 1976913a1744e9ff8ba782a85dd83fdd79e2682c..4e6c7a5f7f2964dc8b4655c7a3d73d508409ae5a 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.md.sal.dom.api;
 
+import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;
 import java.util.Objects;
 import javax.annotation.Nonnull;
@@ -119,6 +120,6 @@ public abstract class DOMRpcIdentifier {
 
     @Override
     public final String toString() {
-        return com.google.common.base.Objects.toStringHelper(this).omitNullValues().add("type", type).add("contextReference", getContextReference()).toString();
+        return MoreObjects.toStringHelper(this).omitNullValues().add("type", type).add("contextReference", getContextReference()).toString();
     }
 }
index fdb80ebcbef49bbaf17aa2981f3c322a6a2d47ab..51b28e14502459ae44cebeb6887828ac78c79648 100644 (file)
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
@@ -73,7 +73,7 @@ final class PingPongTransaction implements FutureCallback<Void> {
 
     @Override
     public String toString() {
-        return addToStringAttributes(Objects.toStringHelper(this)).toString();
+        return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
     }
 
     protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
index 6cc593904723ee6cf7a28f26fd0367703ec89371..8d040f612e82b70f59bff3feb45628cbb0ed9625 100644 (file)
@@ -7,10 +7,9 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.base.Preconditions;
-
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
 import org.slf4j.Logger;
 
@@ -42,7 +41,7 @@ abstract class AbstractDOMStoreTransaction implements DOMStoreTransaction {
 
     @Override
     public final String toString() {
-        return addToStringAttributes(Objects.toStringHelper(this)).toString();
+        return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
     }
 
     /**
index 60a23403b3ac7fce67b01b85295752cdbb2a2e6e..faddbae850ce50753dc7ca1e7298bdc6e77c0f21 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import static com.google.common.base.Preconditions.checkState;
-import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Throwables;
index a3186f8e692ecec7c0e6115f74575fb73c85282c..00bdbb6db0d69f2cdd95e7fc81000de1b0646e82 100644 (file)
@@ -110,7 +110,7 @@ public final class ReadOnlyTx implements DOMDataReadOnlyTransaction {
 
     private CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> readOperationalData(
             final YangInstanceIdentifier path) {
-        final ListenableFuture<RpcResult<CompositeNode>> configCandidate = netconfOps.getConfigRunning(loggingCallback, Optional.fromNullable(path));
+        final ListenableFuture<RpcResult<CompositeNode>> configCandidate = netconfOps.get(loggingCallback, Optional.fromNullable(path));
 
         // Find data node and normalize its content
         final ListenableFuture<Optional<NormalizedNode<?, ?>>> transformedFuture = Futures.transform(configCandidate, new Function<RpcResult<CompositeNode>, Optional<NormalizedNode<?, ?>>>() {
index 5a528bc418ea386a04b428e047c58fe7d47c74bb..3565ba1113f6d4571bc8730dd52dc2fe0c36e600 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.sal.connect.netconf.schema;
 
 import com.google.common.base.Function;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
@@ -166,7 +166,7 @@ public final class NetconfRemoteSchemaYangSourceProvider implements SchemaSource
         }
 
         @Override
-        protected Objects.ToStringHelper addToStringAttributes(final Objects.ToStringHelper toStringHelper) {
+        protected MoreObjects.ToStringHelper addToStringAttributes(final MoreObjects.ToStringHelper toStringHelper) {
             return toStringHelper.add("device", id);
         }
 
index 8ac8a48b45d7ad0b98717c93aa223a697ba55b6c..40e890e80cc4c5636ccfc0bec8855537d001bb9d 100644 (file)
@@ -174,33 +174,17 @@ public final class NetconfBaseOps {
         return getConfig(callback, NETCONF_CANDIDATE_QNAME, filterPath);
     }
 
-    public ListenableFuture<RpcResult<CompositeNode>> get(final FutureCallback<RpcResult<CompositeNode>> callback, final QName datastore, final Optional<YangInstanceIdentifier> filterPath) {
+    public ListenableFuture<RpcResult<CompositeNode>> get(final FutureCallback<RpcResult<CompositeNode>> callback, final Optional<YangInstanceIdentifier> filterPath) {
         Preconditions.checkNotNull(callback);
-        Preconditions.checkNotNull(datastore);
 
         final ListenableFuture<RpcResult<CompositeNode>> future;
-        if (filterPath.isPresent()) {
-            final Node<?> node = toFilterStructure(filterPath.get());
-            future = rpc.invokeRpc(NETCONF_GET_QNAME,
-                            NetconfMessageTransformUtil.wrap(NETCONF_GET_QNAME, getSourceNode(datastore), node));
-        } else {
-            future = rpc.invokeRpc(NETCONF_GET_QNAME,
-                            NetconfMessageTransformUtil.wrap(NETCONF_GET_QNAME, getSourceNode(datastore)));
-        }
+        final Node<?> node = filterPath.isPresent() ? toFilterStructure(filterPath.get()) : NetconfMessageTransformUtil.GET_RPC_CONTENT;
+        future = rpc.invokeRpc(NETCONF_GET_QNAME, NetconfMessageTransformUtil.wrap(NETCONF_GET_QNAME, node));
 
         Futures.addCallback(future, callback);
         return future;
     }
 
-    public ListenableFuture<RpcResult<CompositeNode>> getRunning(final FutureCallback<RpcResult<CompositeNode>> callback, final Optional<YangInstanceIdentifier> filterPath) {
-        return get(callback, NETCONF_RUNNING_QNAME, filterPath);
-    }
-
-    public ListenableFuture<RpcResult<CompositeNode>> getCandidate(final FutureCallback<RpcResult<CompositeNode>> callback, final Optional<YangInstanceIdentifier> filterPath) {
-        return get(callback, NETCONF_CANDIDATE_QNAME, filterPath);
-    }
-
-
     public ListenableFuture<RpcResult<CompositeNode>> editConfigCandidate(final FutureCallback<? super RpcResult<CompositeNode>> callback, final CompositeNode editStructure, final ModifyAction modifyAction, final boolean rollback) {
         return editConfig(callback, NETCONF_CANDIDATE_QNAME, editStructure, Optional.of(modifyAction), rollback);
     }
index 5e3ad2c1fb4e3996f02a1ccd43b3cf3a86e7b370..371907e0fe386d3a9697141e15fde388079e7ae7 100644 (file)
@@ -113,6 +113,10 @@ public class NetconfMessageTransformUtil {
     public static final CompositeNode COMMIT_RPC_CONTENT =
             NodeFactory.createImmutableCompositeNode(NETCONF_COMMIT_QNAME, null, Collections.<Node<?>>emptyList());
 
+    // Get message
+    public static final CompositeNode GET_RPC_CONTENT =
+            NodeFactory.createImmutableCompositeNode(NETCONF_GET_QNAME, null, Collections.<Node<?>>emptyList());
+
     // Create-subscription changes message
     public static final CompositeNode CREATE_SUBSCRIPTION_RPC_CONTENT =
             NodeFactory.createImmutableCompositeNode(CREATE_SUBSCRIPTION_RPC_QNAME, null, Collections.<Node<?>>emptyList());
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/ReadOnlyTxTest.java b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/ReadOnlyTxTest.java
new file mode 100644 (file)
index 0000000..072cb18
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2015 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.connect.netconf.sal.tx;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+import java.net.InetSocketAddress;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.sal.connect.netconf.util.NetconfBaseOps;
+import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
+import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class ReadOnlyTxTest {
+
+    private static final YangInstanceIdentifier path = YangInstanceIdentifier.create();
+
+    @Mock
+    private RpcImplementation rpc;
+    @Mock
+    private DataNormalizer normalizer;
+    @Mock
+    private CompositeNode mockedNode;
+
+    @Before
+    public void setUp() throws DataNormalizationException {
+        MockitoAnnotations.initMocks(this);
+        doReturn(path).when(normalizer).toLegacy(any(YangInstanceIdentifier.class));
+        doReturn(com.google.common.util.concurrent.Futures.immediateFuture(RpcResultBuilder.success(mockedNode).build())).when(rpc).invokeRpc(any(org.opendaylight.yangtools.yang.common.QName.class), any(CompositeNode.class));
+        doReturn("node").when(mockedNode).toString();
+    }
+
+    @Test
+    public void testRead() throws Exception {
+        final NetconfBaseOps netconfOps = new NetconfBaseOps(rpc);
+
+        final ReadOnlyTx readOnlyTx = new ReadOnlyTx(netconfOps, normalizer, new RemoteDeviceId("a", new InetSocketAddress("localhost", 196)));
+
+        readOnlyTx.read(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.create());
+        verify(rpc).invokeRpc(Mockito.same(NetconfMessageTransformUtil.NETCONF_GET_CONFIG_QNAME), any(CompositeNode.class));
+        readOnlyTx.read(LogicalDatastoreType.OPERATIONAL, path);
+        verify(rpc).invokeRpc(Mockito.same(NetconfMessageTransformUtil.NETCONF_GET_QNAME), any(CompositeNode.class));
+    }
+}
\ No newline at end of file
index cc684a58b2815dac30e68780902880e4f5ff66ab..70cd4b87029fc6e0f9fc57ed9c62509240442680 100644 (file)
@@ -12,7 +12,6 @@
   <packaging>bundle</packaging>
   <properties>
     <bundle.plugin.version>2.4.0</bundle.plugin.version>
-    <guava.version>14.0.1</guava.version>
     <maven.clean.plugin.version>2.5</maven.clean.plugin.version>
   </properties>
   <dependencies>
index cf9958e7f8abf44303aeb18f79a77d01b62d7a9b..0aebc68bbe3f653d9a738a3ec6121ee0c162d2a9 100644 (file)
@@ -115,7 +115,7 @@ public class ConfigPusherImpl implements ConfigPusher {
      */
     private synchronized EditAndCommitResponse pushConfigWithConflictingVersionRetries(ConfigSnapshotHolder configSnapshotHolder) throws NetconfDocumentedException {
         ConflictingVersionException lastException;
-        Stopwatch stopwatch = new Stopwatch();
+        Stopwatch stopwatch = Stopwatch.createUnstarted();
         do {
             String idForReporting = configSnapshotHolder.toString();
             SortedSet<String> expectedCapabilities = checkNotNull(configSnapshotHolder.getCapabilities(),
@@ -137,7 +137,7 @@ public class ConfigPusherImpl implements ConfigPusher {
     }
 
     private NetconfOperationService getOperationServiceWithRetries(Set<String> expectedCapabilities, String idForReporting) {
-        Stopwatch stopwatch = new Stopwatch().start();
+        Stopwatch stopwatch = Stopwatch.createStarted();
         NotEnoughCapabilitiesException lastException;
         do {
             try {
@@ -230,7 +230,7 @@ public class ConfigPusherImpl implements ConfigPusher {
             throw new IllegalStateException("Cannot parse " + configSnapshotHolder);
         }
         LOG.trace("Pushing last configuration to netconf: {}", configSnapshotHolder);
-        Stopwatch stopwatch = new Stopwatch().start();
+        Stopwatch stopwatch = Stopwatch.createStarted();
         NetconfMessage editConfigMessage = createEditConfigMessage(xmlToBePersisted);
 
         Document editResponseMessage = sendRequestGetResponseCheckIsOK(editConfigMessage, operationService,
index 72534e242e92dc4a4d8a19690caecd0fcf5d0cdd..ab731260216f4452f6ba3d5e8c6b64c8179bdad2 100644 (file)
@@ -84,7 +84,7 @@ public class SSHTest {
 
         final EchoClientHandler echoClientHandler = connectClient(addr);
 
-        Stopwatch stopwatch = new Stopwatch().start();
+        Stopwatch stopwatch = Stopwatch.createStarted();
         while(echoClientHandler.isConnected() == false && stopwatch.elapsed(TimeUnit.SECONDS) < 30) {
             Thread.sleep(500);
         }
@@ -131,7 +131,7 @@ public class SSHTest {
     public void testClientWithoutServer() throws Exception {
         final InetSocketAddress address = new InetSocketAddress(12345);
         final EchoClientHandler echoClientHandler = connectClient(address);
-        final Stopwatch stopwatch = new Stopwatch().start();
+        final Stopwatch stopwatch = Stopwatch.createStarted();
         while(echoClientHandler.getState() == State.CONNECTING && stopwatch.elapsed(TimeUnit.SECONDS) < 5) {
             Thread.sleep(100);
         }
index 0d7ee3b9456f15e2c26c78eec5118af8edf6aeb8..8f24a5741ea8a52b68b31513721b2347b896b273 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.netconf.test.tool;
 
 import com.google.common.base.Charsets;
 import com.google.common.base.Function;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
 import com.google.common.base.Optional;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
@@ -360,7 +360,7 @@ public class NetconfDeviceSimulator implements Closeable {
             public CheckedFuture<? extends SchemaSourceRepresentation, SchemaSourceException> getSource(final SourceIdentifier sourceIdentifier) {
                 return Futures.immediateCheckedFuture(new YangTextSchemaSource(sourceId) {
                     @Override
-                    protected Objects.ToStringHelper addToStringAttributes(final Objects.ToStringHelper toStringHelper) {
+                    protected MoreObjects.ToStringHelper addToStringAttributes(final MoreObjects.ToStringHelper toStringHelper) {
                         return toStringHelper;
                     }
 
index e1331b1380935e86bad9fa962060e8c02210ce24..176a0de9a48f1d87a7eebb4ac2e48a74b89cac6e 100644 (file)
@@ -10,11 +10,9 @@ package org.opendaylight.controller.netconf.util.test;
 
 import com.google.common.base.Charsets;
 import com.google.common.base.Preconditions;
-import com.google.common.io.CharStreams;
-import com.google.common.io.InputSupplier;
+import com.google.common.io.ByteSource;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import javax.xml.parsers.ParserConfigurationException;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
@@ -51,17 +49,13 @@ public class XmlFileLoader {
     public static String fileToString(final String fileName) throws IOException {
         try (InputStream resourceAsStream = XmlFileLoader.class.getClassLoader().getResourceAsStream(fileName)) {
             Preconditions.checkNotNull(resourceAsStream);
-
-            InputSupplier<? extends InputStream> supplier = new InputSupplier<InputStream>() {
+            return new ByteSource() {
                 @Override
-                public InputStream getInput() throws IOException {
+                public InputStream openStream() {
                     return resourceAsStream;
                 }
-            };
-
-            InputSupplier<InputStreamReader> readerSupplier = CharStreams.newReaderSupplier(supplier, Charsets.UTF_8);
+            }.asCharSource(Charsets.UTF_8).read();
 
-            return CharStreams.toString(readerSupplier);
         }
     }
 
index e61a8e5118b0c19e2cc72bc529f82fe78e954c6b..1e7bcf0ae690ac955cab239175207c1f9df54d6d 100644 (file)
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>networkconfig.neutron</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/pom.xml b/pom.xml
index 0aaf0945c6bce63e1d60fb6b868b5b851a240c2b..d41b51b2145828151de5b2fe72102d61314feb77 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -30,6 +30,7 @@
     <module>opendaylight/networkconfiguration/neutron</module>
     <module>opendaylight/networkconfiguration/neutron/implementation</module>
     <module>opendaylight/networkconfiguration/neutron/northbound</module>
+    <module>opendaylight/networkconfiguration/neutron/features</module>
 
     <!-- Parents -->
     <module>opendaylight/commons/concepts</module>