From: Maros Marsalek Date: Mon, 16 Feb 2015 16:05:36 +0000 (+0100) Subject: Remove source element from get netconf rpc X-Git-Tag: release/lithium~553 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=3190d3dbe9438f94724a0296a9f0cb937491a094;ds=sidebyside Remove source element from get netconf rpc Change-Id: Ibe30fa36d7cfe86f908a296c7e4f50cc59453c9c Signed-off-by: Maros Marsalek --- diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/ReadOnlyTx.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/ReadOnlyTx.java index 70ad28de72..00bdbb6db0 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/ReadOnlyTx.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/ReadOnlyTx.java @@ -110,7 +110,7 @@ public final class ReadOnlyTx implements DOMDataReadOnlyTransaction { private CheckedFuture>, ReadFailedException> readOperationalData( final YangInstanceIdentifier path) { - final ListenableFuture> configCandidate = netconfOps.getRunning(loggingCallback, Optional.fromNullable(path)); + final ListenableFuture> configCandidate = netconfOps.get(loggingCallback, Optional.fromNullable(path)); // Find data node and normalize its content final ListenableFuture>> transformedFuture = Futures.transform(configCandidate, new Function, Optional>>() { diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfBaseOps.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfBaseOps.java index 8ac8a48b45..40e890e80c 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfBaseOps.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfBaseOps.java @@ -174,33 +174,17 @@ public final class NetconfBaseOps { return getConfig(callback, NETCONF_CANDIDATE_QNAME, filterPath); } - public ListenableFuture> get(final FutureCallback> callback, final QName datastore, final Optional filterPath) { + public ListenableFuture> get(final FutureCallback> callback, final Optional filterPath) { Preconditions.checkNotNull(callback); - Preconditions.checkNotNull(datastore); final ListenableFuture> 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> getRunning(final FutureCallback> callback, final Optional filterPath) { - return get(callback, NETCONF_RUNNING_QNAME, filterPath); - } - - public ListenableFuture> getCandidate(final FutureCallback> callback, final Optional filterPath) { - return get(callback, NETCONF_CANDIDATE_QNAME, filterPath); - } - - public ListenableFuture> editConfigCandidate(final FutureCallback> callback, final CompositeNode editStructure, final ModifyAction modifyAction, final boolean rollback) { return editConfig(callback, NETCONF_CANDIDATE_QNAME, editStructure, Optional.of(modifyAction), rollback); } diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfMessageTransformUtil.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfMessageTransformUtil.java index 5e3ad2c1fb..371907e0fe 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfMessageTransformUtil.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfMessageTransformUtil.java @@ -113,6 +113,10 @@ public class NetconfMessageTransformUtil { public static final CompositeNode COMMIT_RPC_CONTENT = NodeFactory.createImmutableCompositeNode(NETCONF_COMMIT_QNAME, null, Collections.>emptyList()); + // Get message + public static final CompositeNode GET_RPC_CONTENT = + NodeFactory.createImmutableCompositeNode(NETCONF_GET_QNAME, null, Collections.>emptyList()); + // Create-subscription changes message public static final CompositeNode CREATE_SUBSCRIPTION_RPC_CONTENT = NodeFactory.createImmutableCompositeNode(CREATE_SUBSCRIPTION_RPC_QNAME, null, Collections.>emptyList());