<type>pom</type>
<scope>import</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-artifacts</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
</dependencies>
</dependencyManagement>
<artifactId>akka-testkit_2.11</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-distributed-datastore</artifactId>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
final NetconfDeviceNotificationService notificationService = new NetconfDeviceNotificationService();
- LOG.info("Creating master data broker for device {}", id);
+ LOG.info("{}: Creating master data broker for device", id);
final NetconfDOMTransaction masterDOMTransactions =
new NetconfMasterDOMTransaction(id, remoteSchemaContext, deviceRpc, netconfSessionPreferences);
try {
resource.close();
} catch (final Exception e) {
- LOG.warn("{}: Ignoring exception while closing {}", id, resource, e);
+ LOG.error("{}: Ignoring exception while closing {}", id, resource, e);
}
}
}
@Override
public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
- return new NetconfReadOnlyTransaction(actorSystem, masterDataBroker);
+ return new NetconfReadOnlyTransaction(id, actorSystem, masterDataBroker);
}
@Override
public DOMDataReadWriteTransaction newReadWriteTransaction() {
- return new ReadWriteTx(new NetconfReadOnlyTransaction(actorSystem, masterDataBroker),
- new NetconfWriteOnlyTransaction(actorSystem, masterDataBroker));
+ return new ReadWriteTx(new NetconfReadOnlyTransaction(id, actorSystem, masterDataBroker),
+ new NetconfWriteOnlyTransaction(id, actorSystem, masterDataBroker));
}
@Override
public DOMDataWriteTransaction newWriteOnlyTransaction() {
- return new NetconfWriteOnlyTransaction(actorSystem, masterDataBroker);
+ return new NetconfWriteOnlyTransaction(id, actorSystem, masterDataBroker);
}
@Override
final NodeId nodeId = NetconfTopologyUtils.getNodeId(rootNode.getIdentifier());
switch (rootNode.getModificationType()) {
case SUBTREE_MODIFIED:
- LOG.debug("Operational for node {} updated. Trying to register slave mount point", nodeId);
+ LOG.debug("{}: Operational for node {} updated. Trying to register slave mount point", id, nodeId);
handleSlaveMountPoint(rootNode);
break;
case WRITE:
if (rootNode.getDataBefore() != null) {
- LOG.debug("Operational for node {} rewrited. Trying to register slave mount point", nodeId);
+ LOG.debug("{}: Operational for node {} rewrited. Trying to register slave mount point", id, nodeId);
} else {
- LOG.debug("Operational for node {} created. Trying to register slave mount point", nodeId);
+ LOG.debug("{}: Operational for node {} created. Trying to register slave mount point", id, nodeId);
}
handleSlaveMountPoint(rootNode);
break;
case DELETE:
- LOG.debug("Operational for node {} deleted. Trying to remove slave mount point", nodeId);
+ LOG.debug("{}: Operational for node {} deleted. Trying to remove slave mount point", id, nodeId);
closeActor();
break;
default:
- LOG.debug("Uknown operation for node: {}", nodeId);
+ LOG.debug("{}: Uknown operation for node: {}", id, nodeId);
}
}
}
}
void registerDataTreeChangeListener(final String topologyId, final NodeKey key) {
- LOG.debug("Registering data tree change listener on node {}", key);
+ LOG.debug("{}: Registering data tree change listener on node {}", id, key);
dataChangeListenerRegistration = setup.getDataBroker().registerDataTreeChangeListener(
new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL,
NetconfTopologyUtils.createTopologyNodeListPath(key, topologyId)), this);
try {
netconfTopologyContext.closeFinal();
} catch (Exception e) {
- LOG.warn("Error at closing topology context. InstanceIdentifier: " + instanceIdentifier);
+ LOG.error("Error at closing topology context. InstanceIdentifier: " + instanceIdentifier, e);
}
});
clusterRegistrations.forEach((instanceIdentifier, clusterSingletonServiceRegistration) -> {
try {
clusterSingletonServiceRegistration.close();
} catch (Exception e) {
- LOG.warn("Error at unregistering from cluster. InstanceIdentifier: " + instanceIdentifier);
+ LOG.error("Error at unregistering from cluster. InstanceIdentifier: " + instanceIdentifier, e);
}
});
contexts.clear();
Futures.addCallback(future, new FutureCallback<NetconfDeviceCapabilities>() {
@Override
public void onSuccess(NetconfDeviceCapabilities result) {
- LOG.debug("{}: Connector started succesfully", nodeId.getValue());
+ LOG.debug("{}: Connector started successfully", remoteDeviceId);
}
@Override
public void onFailure(@Nullable Throwable throwable) {
- LOG.error("{}: Connector failed, {}", nodeId.getValue(), throwable);
+ LOG.error("{}: Connector failed, {}", remoteDeviceId, throwable);
}
});
}
@Override
public void stopRemoteDeviceConnection() {
- Preconditions.checkNotNull(deviceCommunicatorDTO, "Device communicator was not created.");
+ Preconditions.checkNotNull(deviceCommunicatorDTO, remoteDeviceId + ": Device communicator was not created.");
try {
deviceCommunicatorDTO.close();
} catch (Exception e) {
- LOG.warn("{}: Error at closing device communicator.", remoteDeviceId);
+ LOG.error("{}: Error at closing device communicator.", remoteDeviceId, e);
}
}
netconfTopologyDeviceSetup.getDomBroker(), netconfTopologyDeviceSetup.getBindingAwareBroker(),
netconfTopologyDeviceSetup.getActorSystem(), deviceContextActorRef);
if (keepaliveDelay > 0) {
- LOG.info("Device: {} , Adding keepalive facade.", nodeId);
+ LOG.info("{}: Adding keepalive facade.", remoteDeviceId);
salFacade = new KeepaliveSalFacade(remoteDeviceId, salFacade,
netconfTopologyDeviceSetup.getKeepaliveExecutor().getExecutor(), keepaliveDelay,
defaultRequestTimeoutMillis);
? NetconfTopologyUtils.DEFAULT_CONCURRENT_RPC_LIMIT : node.getConcurrentRpcLimit();
if (rpcMessageLimit < 1) {
- LOG.info("Device: {}, Concurrent rpc limit is smaller than 1, no limit will be enforced.", remoteDeviceId);
+ LOG.info("{}: Concurrent rpc limit is smaller than 1, no limit will be enforced.", remoteDeviceId);
}
return new NetconfConnectorDTO(
final NetconfSessionPreferences parsedOverrideCapabilities =
NetconfSessionPreferences.fromStrings(capabilities);
- Preconditions.checkState(parsedOverrideCapabilities.getNonModuleCaps().isEmpty(),
- "Capabilities to override can only contain module based capabilities, non-module capabilities "
+ Preconditions.checkState(parsedOverrideCapabilities.getNonModuleCaps().isEmpty(), remoteDeviceId +
+ ": Capabilities to override can only contain module based capabilities, non-module capabilities "
+ "will be retrieved from the device, configured non-module capabilities: "
+ parsedOverrideCapabilities.getNonModuleCaps());
}
}
LOG.info("{} : netconf connector will use schema cache directory {} instead of {}",
- nodeId.getValue(), moduleSchemaCacheDirectory, NetconfTopologyUtils.DEFAULT_CACHE_DIRECTORY);
+ remoteDeviceId, moduleSchemaCacheDirectory, NetconfTopologyUtils.DEFAULT_CACHE_DIRECTORY);
}
} else {
LOG.info("{} : using the default directory {}",
- nodeId.getValue(), NetconfTopologyUtils.QUALIFIED_DEFAULT_CACHE_DIRECTORY);
+ remoteDeviceId, NetconfTopologyUtils.QUALIFIED_DEFAULT_CACHE_DIRECTORY);
}
if (schemaResourcesDTO == null) {
((org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword) credentials).getUsername(),
((org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword) credentials).getPassword());
} else {
- throw new IllegalStateException("Only login/password authentification is supported");
+ throw new IllegalStateException(remoteDeviceId + ": Only login/password authentication is supported");
}
return NetconfReconnectingClientConfigurationBuilder.create()
import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
import org.opendaylight.netconf.topology.singleton.api.RemoteOperationTxProcessor;
import org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage;
-import org.opendaylight.netconf.topology.singleton.messages.SubmitFailedReply;
+import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitFailedReply;
import org.opendaylight.netconf.topology.singleton.messages.transactions.EmptyReadResponse;
import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitReply;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
final NetconfDeviceNotificationService notificationService = new NetconfDeviceNotificationService();
final NetconfDOMTransaction proxyDOMTransactions =
- new NetconfProxyDOMTransaction(actorSystem, masterActorRef);
+ new NetconfProxyDOMTransaction(id, actorSystem, masterActorRef);
final NetconfDOMDataBroker netconfDeviceDataBroker =
new NetconfDOMDataBroker(actorSystem, id, proxyDOMTransactions);
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import scala.concurrent.Future;
import scala.concurrent.impl.Promise.DefaultPromise;
public class NetconfMasterDOMTransaction implements NetconfDOMTransaction {
+ private static final Logger LOG = LoggerFactory.getLogger(NetconfMasterDOMTransaction.class);
+
+ private final RemoteDeviceId id;
private final DOMDataBroker delegateBroker;
private DOMDataReadOnlyTransaction readTx;
private DOMDataWriteTransaction writeTx;
public NetconfMasterDOMTransaction(final RemoteDeviceId id,
- final SchemaContext schemaContext, final DOMRpcService rpc,
+ final SchemaContext schemaContext,
+ final DOMRpcService rpc,
final NetconfSessionPreferences netconfSessionPreferences) {
-
- delegateBroker = new NetconfDeviceDataBroker(id, schemaContext, rpc, netconfSessionPreferences);
-
- // only ever need 1 readTx since it doesnt need to be closed
- readTx = delegateBroker.newReadOnlyTransaction();
+ this(id, new NetconfDeviceDataBroker(id, schemaContext, rpc, netconfSessionPreferences));
}
- public NetconfMasterDOMTransaction(final DOMDataBroker delegateBroker) {
+ public NetconfMasterDOMTransaction(final RemoteDeviceId id, final DOMDataBroker delegateBroker) {
+ this.id = id;
this.delegateBroker = delegateBroker;
// only ever need 1 readTx since it doesnt need to be closed
@Override
public Future<Optional<NormalizedNodeMessage>> read(final LogicalDatastoreType store,
final YangInstanceIdentifier path) {
+ LOG.trace("{}: Read[{}] {} via NETCONF: {}", id, readTx.getIdentifier(), store, path);
+
final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> readFuture = readTx.read(store, path);
final DefaultPromise<Optional<NormalizedNodeMessage>> promise = new DefaultPromise<>();
@Override
public Future<Boolean> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ LOG.trace("{}: Exists[{}] {} via NETCONF: {}", id, readTx.getIdentifier(), store, path);
+
final CheckedFuture<Boolean, ReadFailedException> existsFuture = readTx.exists(store, path);
final DefaultPromise<Boolean> promise = new DefaultPromise<>();
if (writeTx == null) {
writeTx = delegateBroker.newWriteOnlyTransaction();
}
+
+ LOG.trace("{}: Write[{}] {} via NETCONF: {} with payload {}", id, writeTx.getIdentifier(), store,
+ data.getIdentifier(), data.getNode());
+
writeTx.put(store, data.getIdentifier(), data.getNode());
}
if (writeTx == null) {
writeTx = delegateBroker.newWriteOnlyTransaction();
}
+
+ LOG.trace("{}: Merge[{}] {} via NETCONF: {} with payload {}", id, writeTx.getIdentifier(),store,
+ data.getIdentifier(), data.getNode());
+
writeTx.merge(store, data.getIdentifier(), data.getNode());
}
if (writeTx == null) {
writeTx = delegateBroker.newWriteOnlyTransaction();
}
+
+ LOG.trace("{}: Delete[{}} {} via NETCONF: {}", id, writeTx.getIdentifier(), store, path);
+
writeTx.delete(store, path);
}
@Override
public boolean cancel() {
+ LOG.trace("{}: Cancel[{}} via NETCONF", id, writeTx.getIdentifier());
+
return writeTx.cancel();
}
@Override
public Future<Void> submit() {
+ LOG.trace("{}: Submit[{}} via NETCONF", id, writeTx.getIdentifier());
+
final CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTx.submit();
final DefaultPromise<Void> promise = new DefaultPromise<>();
Futures.addCallback(submitFuture, new FutureCallback<Void>() {
import com.google.common.base.Optional;
import org.opendaylight.controller.config.util.xml.DocumentedException;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
import org.opendaylight.netconf.topology.singleton.api.NetconfDOMTransaction;
import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologyUtils;
import org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage;
-import org.opendaylight.netconf.topology.singleton.messages.SubmitFailedReply;
+import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitFailedReply;
import org.opendaylight.netconf.topology.singleton.messages.transactions.CancelRequest;
import org.opendaylight.netconf.topology.singleton.messages.transactions.DeleteRequest;
import org.opendaylight.netconf.topology.singleton.messages.transactions.EmptyReadResponse;
private static final Logger LOG = LoggerFactory.getLogger(NetconfProxyDOMTransaction.class);
+ private final RemoteDeviceId id;
private final ActorSystem actorSystem;
private final ActorRef masterContextRef;
- public NetconfProxyDOMTransaction(final ActorSystem actorSystem, final ActorRef masterContextRef) {
+ public NetconfProxyDOMTransaction(final RemoteDeviceId id,
+ final ActorSystem actorSystem,
+ final ActorRef masterContextRef) {
+ this.id = id;
this.actorSystem = actorSystem;
this.masterContextRef = masterContextRef;
}
final Future<Object> readScalaFuture =
Patterns.ask(masterContextRef, new ReadRequest(store, path), NetconfTopologyUtils.TIMEOUT);
+ LOG.trace("{}: Read {} via NETCONF: {}", id, store, path);
+
final DefaultPromise<Optional<NormalizedNodeMessage>> promise = new DefaultPromise<>();
readScalaFuture.onComplete(new OnComplete<Object>() {
@Override
public void onComplete(final Throwable failure, final Object success) throws Throwable {
if (failure != null) { // ask timeout
- Exception exception = new DocumentedException("Master is down. Please try again.",
+ Exception exception = new DocumentedException(id + ":Master is down. Please try again.",
DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
DocumentedException.ErrorSeverity.WARNING);
promise.failure(exception);
final Future<Object> existsScalaFuture =
Patterns.ask(masterContextRef, new ExistsRequest(store, path), NetconfTopologyUtils.TIMEOUT);
+ LOG.trace("{}: Exists {} via NETCONF: {}", id, store, path);
+
final DefaultPromise<Boolean> promise = new DefaultPromise<>();
existsScalaFuture.onComplete(new OnComplete<Object>() {
@Override
public void onComplete(final Throwable failure, final Object success) throws Throwable {
if (failure != null) { // ask timeout
- Exception exception = new DocumentedException("Master is down. Please try again.",
+ Exception exception = new DocumentedException(id + ":Master is down. Please try again.",
DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
DocumentedException.ErrorSeverity.WARNING);
promise.failure(exception);
@Override
public void put(final LogicalDatastoreType store, final NormalizedNodeMessage data) {
+ LOG.trace("{}: Write {} via NETCONF: {} with payload {}", id, store, data.getIdentifier(), data.getNode());
+
masterContextRef.tell(new PutRequest(store, data), ActorRef.noSender());
}
@Override
public void merge(final LogicalDatastoreType store, final NormalizedNodeMessage data) {
+ LOG.trace("{}: Merge {} via NETCONF: {} with payload {}", id, store, data.getIdentifier(), data.getNode());
+
masterContextRef.tell(new MergeRequest(store, data), ActorRef.noSender());
}
@Override
public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ LOG.trace("{}: Delete {} via NETCONF: {}", id, store, path);
+
masterContextRef.tell(new DeleteRequest(store, path), ActorRef.noSender());
}
public boolean cancel() {
final Future<Object> cancelScalaFuture =
Patterns.ask(masterContextRef, new CancelRequest(), NetconfTopologyUtils.TIMEOUT);
+
+ LOG.trace("{}: Cancel {} via NETCONF", id);
+
try {
// here must be Await because AsyncWriteTransaction do not return future
return (boolean) Await.result(cancelScalaFuture, NetconfTopologyUtils.TIMEOUT.duration());
final Future<Object> submitScalaFuture =
Patterns.ask(masterContextRef, new SubmitRequest(), NetconfTopologyUtils.TIMEOUT);
+ LOG.trace("{}: Submit {} via NETCONF", id);
+
final DefaultPromise<Void> promise = new DefaultPromise<>();
submitScalaFuture.onComplete(new OnComplete<Object>() {
@Override
public void onComplete(final Throwable failure, final Object success) throws Throwable {
if (failure != null) { // ask timeout
- Exception exception = new DocumentedException("Master is down. Please try again.",
+ Exception exception = new DocumentedException(id + ":Master is down. Please try again.",
DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
DocumentedException.ErrorSeverity.WARNING);
promise.failure(exception);
promise.failure((Throwable) success);
} else {
if (success instanceof SubmitFailedReply) {
- LOG.error("Transaction was not submitted.");
+ LOG.error("{}: Transaction was not submitted because already closed.", id);
}
promise.success(null);
}
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
+import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
import org.opendaylight.netconf.topology.singleton.api.NetconfDOMTransaction;
import org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import scala.concurrent.Future;
public class NetconfReadOnlyTransaction implements DOMDataReadOnlyTransaction {
+ private static final Logger LOG = LoggerFactory.getLogger(NetconfReadOnlyTransaction.class);
+
+ private final RemoteDeviceId id;
private final NetconfDOMTransaction delegate;
private final ActorSystem actorSystem;
- public NetconfReadOnlyTransaction(final ActorSystem actorSystem, final NetconfDOMTransaction delegate) {
+ public NetconfReadOnlyTransaction(final RemoteDeviceId id,
+ final ActorSystem actorSystem,
+ final NetconfDOMTransaction delegate) {
+ this.id = id;
this.delegate = delegate;
this.actorSystem = actorSystem;
}
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
final YangInstanceIdentifier path) {
+
+ LOG.trace("{}: Read {} via NETCONF: {}", id, store, path);
+
final Future<Optional<NormalizedNodeMessage>> future = delegate.read(store, path);
final SettableFuture<Optional<NormalizedNode<?, ?>>> settableFuture = SettableFuture.create();
final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> checkedFuture;
@Override
public CheckedFuture<Boolean, ReadFailedException> exists(final LogicalDatastoreType store,
final YangInstanceIdentifier path) {
+
+ LOG.trace("{}: Exists {} via NETCONF: {}", id, store, path);
+
final Future<Boolean> existsFuture = delegate.exists(store, path);
final SettableFuture<Boolean> settableFuture = SettableFuture.create();
final CheckedFuture<Boolean, ReadFailedException> checkedFuture;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
import org.opendaylight.netconf.topology.singleton.api.NetconfDOMTransaction;
import org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import scala.concurrent.Future;
public class NetconfWriteOnlyTransaction implements DOMDataWriteTransaction {
+ private static final Logger LOG = LoggerFactory.getLogger(NetconfWriteOnlyTransaction.class);
+
+ private final RemoteDeviceId id;
private final NetconfDOMTransaction delegate;
private final ActorSystem actorSystem;
- public NetconfWriteOnlyTransaction(final ActorSystem actorSystem, final NetconfDOMTransaction delegate) {
+ public NetconfWriteOnlyTransaction(final RemoteDeviceId id,
+ final ActorSystem actorSystem,
+ final NetconfDOMTransaction delegate) {
+ this.id = id;
this.delegate = delegate;
this.actorSystem = actorSystem;
}
@Override
public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path,
final NormalizedNode<?,?> data) {
+ LOG.trace("{}: Write {} via NETCONF: {} with payload {}", id, store, path, data);
+
delegate.put(store, new NormalizedNodeMessage(path, data));
}
@Override
public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path,
final NormalizedNode<?,?> data) {
+ LOG.trace("{}: Merge {} via NETCONF: {} with payload {}", id, store, path, data);
+
delegate.merge(store, new NormalizedNodeMessage(path, data));
}
@Override
public boolean cancel() {
+ LOG.trace("{}: Cancel", id);
+
return delegate.cancel();
}
@Override
public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ LOG.trace("{}: Delete {} via NETCONF: {}", id, store, path);
+
delegate.delete(store, path);
}
@Override
public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+ LOG.trace("{}: Submit", id);
+
final Future<Void> submit = delegate.submit();
final SettableFuture<Void> settFuture = SettableFuture.create();
final CheckedFuture<Void, TransactionCommitFailedException> checkedFuture;
@Override
public ListenableFuture<RpcResult<TransactionStatus>> commit() {
+ LOG.trace("{}: Commit", id);
+
final Future<Void> commit = delegate.submit();
final SettableFuture<RpcResult<TransactionStatus>> settFuture = SettableFuture.create();
commit.onComplete(new OnComplete<Void>() {
* with reply 'RegisterMountPoint' which includes needed parameters.
*/
public class AskForMasterMountPoint implements Serializable {
+ private static final long serialVersionUID = 1L;
}
* Master sends this message to the own actor to set necessary parameters.
*/
public class CreateInitialMasterActorData implements Serializable {
+ private static final long serialVersionUID = 1L;
private final DOMDataBroker deviceDataBroker;
private final List<SourceIdentifier> allSourceIdentifiers;
* when this message is received by master, operational data-store is changed.
*/
public class MasterActorDataInitialized implements Serializable {
+ private static final long serialVersionUID = 1L;
}
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataInput;
-import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataOutput;
-import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeInputOutput;
+import org.opendaylight.controller.cluster.datastore.utils.SerializationUtils;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
/**
* Message which holds node data, prepared to sending between remote hosts with serialization.
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
- final NormalizedNodeDataOutput dataOutput = NormalizedNodeInputOutput.newDataOutput(out);
- final NormalizedNodeWriter normalizedNodeWriter =
- NormalizedNodeWriter.forStreamWriter((NormalizedNodeStreamWriter) dataOutput);
-
- dataOutput.writeYangInstanceIdentifier(identifier);
-
- normalizedNodeWriter.write(node);
+ SerializationUtils.serializePathAndNode(getIdentifier(), node, out);
}
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
- final NormalizedNodeDataInput dataInput = NormalizedNodeInputOutput.newDataInput(in);
-
- identifier = dataInput.readYangInstanceIdentifier();
- node = dataInput.readNormalizedNode();
+ SerializationUtils.deserializePathAndNode(in, this, APPLIER);
}
+
+ private static final SerializationUtils.Applier<NormalizedNodeMessage> APPLIER = (instance, path, node) -> {
+ instance.identifier = path;
+ instance.node = node;
+ };
}
package org.opendaylight.netconf.topology.singleton.messages;
import java.io.Serializable;
-import java.util.List;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologySetup;
-import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
/**
* Master sends this message to the own actor to refresh setup data
*/
public class RefreshSetupMasterActorData implements Serializable {
+ private static final long serialVersionUID = 1L;
private final NetconfTopologySetup netconfTopologyDeviceSetup;
private final RemoteDeviceId remoteDeviceId;
* Master sends the message to slave with necessary parameters for creating slave mount point.
*/
public class RegisterMountPoint implements Serializable {
+ private static final long serialVersionUID = 1L;
private final List<SourceIdentifier> allSourceIdentifiers;
* close method). Message must be sended before slave actor is poisoned.
*/
public class UnregisterSlaveMountPoint implements Serializable {
+ private static final long serialVersionUID = 1L;
}
* Master responds with resolved schema source.
*/
public class YangTextSchemaSourceRequest implements Serializable {
+ private static final long serialVersionUID = 1L;
private final SourceIdentifier sourceIdentifier;
package org.opendaylight.netconf.topology.singleton.messages.transactions;
public class CancelRequest implements TransactionRequest {
+ private static final long serialVersionUID = 1L;
}
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class DeleteRequest implements TransactionRequest {
+ private static final long serialVersionUID = 1L;
private final LogicalDatastoreType store;
private final YangInstanceIdentifier path;
* Message is sended when read result do not present any value.
*/
public class EmptyReadResponse implements Serializable {
+ private static final long serialVersionUID = 1L;
}
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class ExistsRequest implements TransactionRequest {
+ private static final long serialVersionUID = 1L;
private final LogicalDatastoreType store;
private final YangInstanceIdentifier path;
import org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage;
public class MergeRequest implements TransactionRequest {
+ private static final long serialVersionUID = 1L;
private final NormalizedNodeMessage data;
private final LogicalDatastoreType store;
import org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage;
public class PutRequest implements TransactionRequest {
+ private static final long serialVersionUID = 1L;
private final LogicalDatastoreType store;
private final NormalizedNodeMessage data;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class ReadRequest implements TransactionRequest {
+ private static final long serialVersionUID = 1L;
private final LogicalDatastoreType store;
private final YangInstanceIdentifier path;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.netconf.topology.singleton.messages;
+package org.opendaylight.netconf.topology.singleton.messages.transactions;
import java.io.Serializable;
* Message sent from master back to the slave when submit is not performed, tx is closed
*/
public class SubmitFailedReply implements Serializable {
+ private static final long serialVersionUID = 1L;
}
* Message sent from master back to the slave when submit is successfully performed.
*/
public class SubmitReply implements Serializable {
+ private static final long serialVersionUID = 1L;
}
package org.opendaylight.netconf.topology.singleton.messages.transactions;
public class SubmitRequest implements TransactionRequest {
+ private static final long serialVersionUID = 1L;
}
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
odl:use-default-for-reference-types="true">
<reference id="dataBroker"
interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"/>
-
<reference id="rpcRegistry"
interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"/>
-
<reference id="clusterSingletonService"
interface="org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider"/>
-
<reference id="bindingAwareBroker"
- interface="org.opendaylight.controller.sal.binding.api.BindingAwareBroker"
- />
-
+ interface="org.opendaylight.controller.sal.binding.api.BindingAwareBroker"/>
<reference id="keepAliveExecutor"
- interface="org.opendaylight.controller.config.threadpool.ScheduledThreadPool"
- />
-
+ interface="org.opendaylight.controller.config.threadpool.ScheduledThreadPool"/>
<reference id="processingExecutor"
- interface="org.opendaylight.controller.config.threadpool.ThreadPool"
- />
-
+ interface="org.opendaylight.controller.config.threadpool.ThreadPool"/>
<reference id="domBroker"
- interface="org.opendaylight.controller.sal.core.api.Broker"
- />
-
+ interface="org.opendaylight.controller.sal.core.api.Broker"/>
<reference id="actorSystemProvider"
- interface="org.opendaylight.controller.cluster.ActorSystemProvider"
- />
-
+ interface="org.opendaylight.controller.cluster.ActorSystemProvider"/>
<reference id="eventExecutor"
interface="io.netty.util.concurrent.EventExecutor"
odl:type="global-event-executor"/>
-
<reference id="clientDispatcherDependency"
- interface="org.opendaylight.netconf.client.NetconfClientDispatcher"
- />
+ interface="org.opendaylight.netconf.client.NetconfClientDispatcher"/>
- <bean id="netconfTopologyServiceProvider"
+ <bean id="netconfTopologyManager"
class="org.opendaylight.netconf.topology.singleton.impl.NetconfTopologyManager"
init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="rpcRegistry" />
- <argument ref="clusterSingletonService" />
- <argument ref="bindingAwareBroker" />
- <argument ref="keepAliveExecutor" />
- <argument ref="processingExecutor" />
- <argument ref="domBroker" />
- <argument ref="actorSystemProvider" />
- <argument ref="eventExecutor" />
- <argument ref="clientDispatcherDependency" />
- <argument value="topology-netconf" />
+ <argument ref="dataBroker"/>
+ <argument ref="rpcRegistry"/>
+ <argument ref="clusterSingletonService"/>
+ <argument ref="bindingAwareBroker"/>
+ <argument ref="keepAliveExecutor"/>
+ <argument ref="processingExecutor"/>
+ <argument ref="domBroker"/>
+ <argument ref="actorSystemProvider"/>
+ <argument ref="eventExecutor"/>
+ <argument ref="clientDispatcherDependency"/>
+ <argument value="topology-netconf"/>
</bean>
-
- <service ref="netconfTopologyServiceProvider" interface="org.opendaylight.netconf.topology.singleton.api.NetconfTopologySingletonService"
- />
+ <service ref="netconfTopologyManager"
+ interface="org.opendaylight.netconf.topology.singleton.api.NetconfTopologySingletonService"/>
</blueprint>
doReturn(readTx).when(delegateDataBroker).newReadOnlyTransaction();
final NetconfDOMTransaction masterDOMTransactions =
- new NetconfMasterDOMTransaction(delegateDataBroker);
+ new NetconfMasterDOMTransaction(remoteDeviceId, delegateDataBroker);
masterDataBroker =
new NetconfDOMDataBroker(system, remoteDeviceId, masterDOMTransactions);
// Create slave data broker for testing proxy
final NetconfDOMTransaction proxyDOMTransactions =
- new NetconfProxyDOMTransaction(system, masterRef);
+ new NetconfProxyDOMTransaction(remoteDeviceId, system, masterRef);
slaveDataBroker = new NetconfDOMDataBroker(system, remoteDeviceId, proxyDOMTransactions);
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
doReturn(readTx).when(delegateDataBroker).newReadOnlyTransaction();
final NetconfDOMTransaction masterDOMTransactions =
- new NetconfMasterDOMTransaction(delegateDataBroker);
+ new NetconfMasterDOMTransaction(remoteDeviceId, delegateDataBroker);
masterDataBroker =
new NetconfDOMDataBroker(system, remoteDeviceId, masterDOMTransactions);
// Create slave data broker for testing proxy
final NetconfDOMTransaction proxyDOMTransactions =
- new NetconfProxyDOMTransaction(system, masterRef);
+ new NetconfProxyDOMTransaction(remoteDeviceId, system, masterRef);
slaveDataBroker = new NetconfDOMDataBroker(system, remoteDeviceId, proxyDOMTransactions);