2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.client.mdsal.impl;
10 import static com.google.common.base.Preconditions.checkArgument;
11 import static java.util.Objects.requireNonNull;
12 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.COMMIT_RPC_CONTENT;
13 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.DISCARD_CHANGES_RPC_CONTENT;
14 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.EDIT_CONTENT_NODEID;
15 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.GET_RPC_CONTENT;
16 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_CANDIDATE_NODEID;
17 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_COMMIT_QNAME;
18 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_COPY_CONFIG_NODEID;
19 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_COPY_CONFIG_QNAME;
20 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_DEFAULT_OPERATION_NODEID;
21 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_DISCARD_CHANGES_QNAME;
22 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_NODEID;
23 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME;
24 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_ERROR_OPTION_NODEID;
25 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_GET_CONFIG_NODEID;
26 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_GET_CONFIG_QNAME;
27 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_GET_NODEID;
28 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_GET_QNAME;
29 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_LOCK_NODEID;
30 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_LOCK_QNAME;
31 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_RUNNING_NODEID;
32 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_SOURCE_NODEID;
33 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_TARGET_NODEID;
34 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_UNLOCK_NODEID;
35 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_UNLOCK_QNAME;
36 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_VALIDATE_NODEID;
37 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.NETCONF_VALIDATE_QNAME;
38 import static org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformUtil.toFilterStructure;
40 import com.google.common.collect.Iterables;
41 import com.google.common.util.concurrent.FutureCallback;
42 import com.google.common.util.concurrent.Futures;
43 import com.google.common.util.concurrent.ListenableFuture;
44 import com.google.common.util.concurrent.MoreExecutors;
45 import java.util.Collections;
46 import java.util.List;
48 import java.util.Map.Entry;
49 import java.util.Optional;
50 import java.util.stream.Collectors;
51 import org.eclipse.jdt.annotation.NonNull;
52 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
53 import org.opendaylight.netconf.api.EffectiveOperation;
54 import org.opendaylight.netconf.client.mdsal.api.NetconfRpcService;
55 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceServices.Rpcs;
56 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.copy.config.input.target.ConfigTarget;
57 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.get.config.input.source.ConfigSource;
58 import org.opendaylight.yangtools.yang.common.Empty;
59 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
60 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
61 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
62 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
63 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
64 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
65 import org.opendaylight.yangtools.yang.data.api.schema.MountPointContext;
66 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
67 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
68 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
71 * Provides base operations for NETCONF e.g. {@code get}, {@code get-config}, {@code edit-config}, {@code commit} etc.
72 * as per <a href="https://www.rfc-editor.org/rfc/rfc6241#section-7">RFC6241 Protocol Operations</a>.
74 // FIXME: turn Optional arguments to @Nullable
75 public final class NetconfBaseOps {
76 private static final NodeIdentifier CONFIG_SOURCE_NODEID = NodeIdentifier.create(ConfigSource.QNAME);
77 private static final NodeIdentifier CONFIG_TARGET_NODEID = NodeIdentifier.create(ConfigTarget.QNAME);
78 private static final LeafNode<String> NETCONF_ERROR_OPTION_ROLLBACK =
79 ImmutableNodes.leafNode(NETCONF_ERROR_OPTION_NODEID, "rollback-on-error");
81 private final NetconfRpcService rpc;
82 private final MountPointContext mountContext;
83 private final RpcStructureTransformer transformer;
85 public NetconfBaseOps(final Rpcs rpc, final MountPointContext mountContext) {
86 this.rpc = requireNonNull(rpc);
87 this.mountContext = requireNonNull(mountContext);
89 if (rpc instanceof Rpcs.Schemaless) {
90 transformer = new SchemalessRpcStructureTransformer();
91 } else if (rpc instanceof Rpcs.Normalized) {
92 transformer = new NetconfRpcStructureTransformer(mountContext);
94 throw new IllegalStateException("Unhandled rpcs " + rpc);
98 public ListenableFuture<? extends DOMRpcResult> lock(final FutureCallback<DOMRpcResult> callback,
99 final NodeIdentifier datastore) {
100 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_LOCK_QNAME, getLockContent(datastore)));
103 private static <T> ListenableFuture<T> addCallback(final FutureCallback<? super T> callback,
104 final ListenableFuture<T> future) {
105 Futures.addCallback(future, callback, MoreExecutors.directExecutor());
109 public ListenableFuture<? extends DOMRpcResult> lockCandidate(final FutureCallback<DOMRpcResult> callback) {
110 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_LOCK_QNAME,
111 getLockContent(NETCONF_CANDIDATE_NODEID)));
114 public ListenableFuture<? extends DOMRpcResult> lockRunning(final FutureCallback<DOMRpcResult> callback) {
115 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_LOCK_QNAME,
116 getLockContent(NETCONF_RUNNING_NODEID)));
119 public ListenableFuture<? extends DOMRpcResult> unlock(final FutureCallback<DOMRpcResult> callback,
120 final NodeIdentifier datastore) {
121 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_UNLOCK_QNAME,
122 getUnLockContent(datastore)));
125 public ListenableFuture<? extends DOMRpcResult> unlockRunning(final FutureCallback<DOMRpcResult> callback) {
126 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_UNLOCK_QNAME,
127 getUnLockContent(NETCONF_RUNNING_NODEID)));
130 public ListenableFuture<? extends DOMRpcResult> unlockCandidate(final FutureCallback<DOMRpcResult> callback) {
131 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_UNLOCK_QNAME,
132 getUnLockContent(NETCONF_CANDIDATE_NODEID)));
135 public ListenableFuture<? extends DOMRpcResult> discardChanges(final FutureCallback<DOMRpcResult> callback) {
136 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_DISCARD_CHANGES_QNAME,
137 DISCARD_CHANGES_RPC_CONTENT));
140 public ListenableFuture<? extends DOMRpcResult> commit(final FutureCallback<DOMRpcResult> callback) {
141 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_COMMIT_QNAME, COMMIT_RPC_CONTENT));
144 public ListenableFuture<? extends DOMRpcResult> validate(final FutureCallback<DOMRpcResult> callback,
145 final NodeIdentifier datastore) {
146 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_VALIDATE_QNAME,
147 getValidateContent(requireNonNull(datastore))));
150 public ListenableFuture<? extends DOMRpcResult> validateCandidate(final FutureCallback<DOMRpcResult> callback) {
151 return validate(callback, NETCONF_CANDIDATE_NODEID);
154 public ListenableFuture<? extends DOMRpcResult> validateRunning(final FutureCallback<DOMRpcResult> callback) {
155 return validate(callback, NETCONF_RUNNING_NODEID);
158 public ListenableFuture<? extends DOMRpcResult> copyConfig(final FutureCallback<DOMRpcResult> callback,
159 final NodeIdentifier sourceDatastore, final NodeIdentifier targetDatastore) {
160 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_COPY_CONFIG_QNAME,
161 getCopyConfigContent(sourceDatastore, targetDatastore)));
164 public ListenableFuture<? extends DOMRpcResult> copyRunningToCandidate(
165 final FutureCallback<DOMRpcResult> callback) {
166 return copyConfig(callback, NETCONF_RUNNING_NODEID, NETCONF_CANDIDATE_NODEID);
169 public ListenableFuture<? extends DOMRpcResult> getConfig(final FutureCallback<DOMRpcResult> callback,
170 final NodeIdentifier datastore, final Optional<YangInstanceIdentifier> filterPath) {
171 final var source = getSourceNode(datastore);
172 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_GET_CONFIG_QNAME,
173 nonEmptyFilter(filterPath)
174 .map(path -> NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_NODEID, source,
175 transformer.toFilterStructure(path)))
176 .orElseGet(() -> NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_NODEID, source))));
179 private ListenableFuture<? extends DOMRpcResult> getConfig(final FutureCallback<DOMRpcResult> callback,
180 final NodeIdentifier datastore, final Optional<YangInstanceIdentifier> filterPath,
181 final List<YangInstanceIdentifier> fields) {
182 final ContainerNode rpcInput;
183 if (nonEmptyFilter(filterPath).isPresent()) {
184 rpcInput = NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_NODEID, getSourceNode(datastore),
185 transformer.toFilterStructure(List.of(FieldsFilter.of(filterPath.orElseThrow(), fields))));
186 } else if (containsEmptyPath(fields)) {
187 rpcInput = NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_NODEID, getSourceNode(datastore));
189 rpcInput = NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_NODEID,
190 getSourceNode(datastore), getSubtreeFilterFromRootFields(fields));
192 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_GET_CONFIG_QNAME, rpcInput));
196 * Calling GET-CONFIG RPC with subtree filter that is specified by {@link YangInstanceIdentifier}.
198 * @param callback RPC response callback
199 * @param filterPath path to requested data
200 * @return asynchronous completion token with read {@link NormalizedNode} wrapped in {@link Optional} instance
202 public ListenableFuture<Optional<NormalizedNode>> getConfigRunningData(final FutureCallback<DOMRpcResult> callback,
203 final Optional<YangInstanceIdentifier> filterPath) {
204 return extractData(filterPath, getConfigRunning(callback, filterPath));
208 * Calling GET-CONFIG RPC with subtree filter tha tis specified by parent {@link YangInstanceIdentifier} and list
209 * of specific fields that caller would like to read. Field paths are relative to parent path.
211 * @param callback RPC response callback
212 * @param filterPath parent path to requested data
213 * @param fields paths to specific fields that are selected under parent path
214 * @return asynchronous completion token with read {@link NormalizedNode} wrapped in {@link Optional} instance
216 public ListenableFuture<Optional<NormalizedNode>> getConfigRunningData(final FutureCallback<DOMRpcResult> callback,
217 final Optional<YangInstanceIdentifier> filterPath, final List<YangInstanceIdentifier> fields) {
218 if (fields.isEmpty()) {
219 // RFC doesn't allow to build subtree filter that would expect just empty element in response
220 return Futures.immediateFailedFuture(new IllegalArgumentException(
221 "Failed to build NETCONF GET-CONFIG RPC: provided list of fields is empty; filter path: "
224 return extractData(filterPath, getConfigRunning(callback, filterPath, fields));
228 * Calling GET RPC with subtree filter that is specified by {@link YangInstanceIdentifier}.
230 * @param callback RPC response callback
231 * @param filterPath path to requested data
232 * @return asynchronous completion token with read {@link NormalizedNode} wrapped in {@link Optional} instance
234 public ListenableFuture<Optional<NormalizedNode>> getData(final FutureCallback<DOMRpcResult> callback,
235 final Optional<YangInstanceIdentifier> filterPath) {
236 return extractData(filterPath, get(callback, filterPath));
240 * Calling GET RPC with subtree filter tha tis specified by parent {@link YangInstanceIdentifier} and list
241 * of specific fields that caller would like to read. Field paths are relative to parent path.
243 * @param callback RPC response callback
244 * @param filterPath parent path to requested data
245 * @param fields paths to specific fields that are selected under parent path
246 * @return asynchronous completion token with read {@link NormalizedNode} wrapped in {@link Optional} instance
248 public ListenableFuture<Optional<NormalizedNode>> getData(final FutureCallback<DOMRpcResult> callback,
249 final Optional<YangInstanceIdentifier> filterPath, final List<YangInstanceIdentifier> fields) {
250 if (fields.isEmpty()) {
251 // RFC doesn't allow to build subtree filter that would expect just empty element in response
252 return Futures.immediateFailedFuture(new IllegalArgumentException(
253 "Failed to build NETCONF GET RPC: provided list of fields is empty; filter path: " + filterPath));
255 return extractData(filterPath, get(callback, filterPath, fields));
258 private ListenableFuture<Optional<NormalizedNode>> extractData(final Optional<YangInstanceIdentifier> path,
259 final ListenableFuture<? extends DOMRpcResult> configRunning) {
260 return Futures.transform(configRunning, result -> {
261 final var errors = result.errors();
262 checkArgument(errors.isEmpty(), "Unable to read data: %s, errors: %s", path, errors);
263 return transformer.selectFromDataStructure(result.value()
264 .getChildByArg(NetconfMessageTransformUtil.NETCONF_DATA_NODEID), path.orElseThrow());
265 }, MoreExecutors.directExecutor());
268 public ListenableFuture<? extends DOMRpcResult> getConfigRunning(final FutureCallback<DOMRpcResult> callback,
269 final Optional<YangInstanceIdentifier> filterPath) {
270 return getConfig(callback, NETCONF_RUNNING_NODEID, filterPath);
273 private ListenableFuture<? extends DOMRpcResult> getConfigRunning(final FutureCallback<DOMRpcResult> callback,
274 final Optional<YangInstanceIdentifier> filterPath, final List<YangInstanceIdentifier> fields) {
275 return getConfig(callback, NETCONF_RUNNING_NODEID, filterPath, fields);
278 public ListenableFuture<? extends DOMRpcResult> getConfigCandidate(final FutureCallback<DOMRpcResult> callback,
279 final Optional<YangInstanceIdentifier> filterPath) {
280 return getConfig(callback, NETCONF_CANDIDATE_NODEID, filterPath);
283 public ListenableFuture<? extends DOMRpcResult> get(final FutureCallback<DOMRpcResult> callback,
284 final Optional<YangInstanceIdentifier> filterPath) {
285 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_GET_QNAME,
286 nonEmptyFilter(filterPath)
287 .map(path -> NetconfMessageTransformUtil.wrap(NETCONF_GET_NODEID,
288 toFilterStructure(path, mountContext.getEffectiveModelContext())))
289 .orElse(NetconfMessageTransformUtil.GET_RPC_CONTENT)));
292 private ListenableFuture<? extends DOMRpcResult> get(final FutureCallback<DOMRpcResult> callback,
293 final Optional<YangInstanceIdentifier> filterPath, final List<YangInstanceIdentifier> fields) {
294 final ContainerNode rpcInput;
295 if (nonEmptyFilter(filterPath).isPresent()) {
296 rpcInput = NetconfMessageTransformUtil.wrap(NETCONF_GET_NODEID, transformer.toFilterStructure(
297 Collections.singletonList(FieldsFilter.of(filterPath.orElseThrow(), fields))));
298 } else if (containsEmptyPath(fields)) {
299 rpcInput = GET_RPC_CONTENT;
301 rpcInput = NetconfMessageTransformUtil.wrap(NETCONF_GET_NODEID, getSubtreeFilterFromRootFields(fields));
303 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_GET_QNAME, rpcInput));
306 private static boolean containsEmptyPath(final List<YangInstanceIdentifier> fields) {
307 return fields.stream().anyMatch(YangInstanceIdentifier::isEmpty);
310 private DataContainerChild getSubtreeFilterFromRootFields(final List<YangInstanceIdentifier> fields) {
311 return transformer.toFilterStructure(fields.stream()
312 .map(fieldPath -> Map.entry(
313 YangInstanceIdentifier.of(Iterables.limit(fieldPath.getPathArguments(), 1)),
314 YangInstanceIdentifier.of(Iterables.skip(fieldPath.getPathArguments(), 1))))
315 .collect(Collectors.groupingBy(Entry::getKey,
316 Collectors.mapping(Entry::getValue, Collectors.toUnmodifiableList())))
318 .map(entry -> FieldsFilter.of(entry.getKey(), entry.getValue()))
319 .collect(Collectors.toUnmodifiableList()));
322 private static Optional<YangInstanceIdentifier> nonEmptyFilter(final Optional<YangInstanceIdentifier> filterPath) {
323 return filterPath.filter(path -> !path.isEmpty());
326 public ListenableFuture<? extends DOMRpcResult> editConfigCandidate(
327 final FutureCallback<? super DOMRpcResult> callback, final DataContainerChild editStructure,
328 final EffectiveOperation modifyAction, final boolean rollback) {
329 return editConfig(callback, NETCONF_CANDIDATE_NODEID, editStructure, Optional.of(modifyAction), rollback);
332 public ListenableFuture<? extends DOMRpcResult> editConfigCandidate(
333 final FutureCallback<? super DOMRpcResult> callback, final DataContainerChild editStructure,
334 final boolean rollback) {
335 return editConfig(callback, NETCONF_CANDIDATE_NODEID, editStructure, Optional.empty(), rollback);
338 public ListenableFuture<? extends DOMRpcResult> editConfigRunning(
339 final FutureCallback<? super DOMRpcResult> callback, final DataContainerChild editStructure,
340 final EffectiveOperation modifyAction, final boolean rollback) {
341 return editConfig(callback, NETCONF_RUNNING_NODEID, editStructure, Optional.of(modifyAction), rollback);
344 public ListenableFuture<? extends DOMRpcResult> editConfigRunning(
345 final FutureCallback<? super DOMRpcResult> callback, final DataContainerChild editStructure,
346 final boolean rollback) {
347 return editConfig(callback, NETCONF_RUNNING_NODEID, editStructure, Optional.empty(), rollback);
350 public ListenableFuture<? extends DOMRpcResult> editConfig(
351 final FutureCallback<? super DOMRpcResult> callback, final NodeIdentifier datastore,
352 final DataContainerChild editStructure, final Optional<EffectiveOperation> modifyAction,
353 final boolean rollback) {
354 return addCallback(requireNonNull(callback), rpc.invokeNetconf(NETCONF_EDIT_CONFIG_QNAME,
355 getEditConfigContent(requireNonNull(datastore), requireNonNull(editStructure), modifyAction, rollback)));
358 public ChoiceNode createEditConfigStructure(final Optional<NormalizedNode> lastChild,
359 final Optional<EffectiveOperation> operation, final YangInstanceIdentifier dataPath) {
360 return Builders.choiceBuilder()
361 .withNodeIdentifier(EDIT_CONTENT_NODEID)
362 .withChild(transformer.createEditConfigStructure(lastChild, dataPath, operation))
366 private static ContainerNode getEditConfigContent(final NodeIdentifier datastore,
367 final DataContainerChild editStructure, final Optional<EffectiveOperation> defaultOperation,
368 final boolean rollback) {
369 final var editBuilder = Builders.containerBuilder()
370 .withNodeIdentifier(NETCONF_EDIT_CONFIG_NODEID)
372 .withChild(getTargetNode(datastore));
375 defaultOperation.ifPresent(op -> {
376 editBuilder.withChild(ImmutableNodes.leafNode(NETCONF_DEFAULT_OPERATION_NODEID, op.xmlValue()));
381 editBuilder.withChild(NETCONF_ERROR_OPTION_ROLLBACK);
385 return editBuilder.withChild(editStructure).build();
388 public static @NonNull ContainerNode getSourceNode(final NodeIdentifier datastore) {
389 return Builders.containerBuilder()
390 .withNodeIdentifier(NETCONF_SOURCE_NODEID)
391 .withChild(Builders.choiceBuilder()
392 .withNodeIdentifier(CONFIG_SOURCE_NODEID)
393 .withChild(ImmutableNodes.leafNode(datastore, Empty.value()))
398 public static @NonNull ContainerNode getLockContent(final NodeIdentifier datastore) {
399 return Builders.containerBuilder()
400 .withNodeIdentifier(NETCONF_LOCK_NODEID)
401 .withChild(getTargetNode(datastore))
405 public static @NonNull ContainerNode getTargetNode(final NodeIdentifier datastore) {
406 return Builders.containerBuilder()
407 .withNodeIdentifier(NETCONF_TARGET_NODEID)
408 .withChild(Builders.choiceBuilder()
409 .withNodeIdentifier(CONFIG_TARGET_NODEID)
410 .withChild(ImmutableNodes.leafNode(datastore, Empty.value()))
415 public static @NonNull ContainerNode getCopyConfigContent(final NodeIdentifier sourceDatastore,
416 final NodeIdentifier targetDatastore) {
417 return Builders.containerBuilder()
418 .withNodeIdentifier(NETCONF_COPY_CONFIG_NODEID)
419 .withChild(getTargetNode(targetDatastore))
420 .withChild(getSourceNode(sourceDatastore))
424 public static @NonNull ContainerNode getValidateContent(final NodeIdentifier sourceDatastore) {
425 return Builders.containerBuilder()
426 .withNodeIdentifier(NETCONF_VALIDATE_NODEID)
427 .withChild(getSourceNode(sourceDatastore))
431 public static @NonNull ContainerNode getUnLockContent(final NodeIdentifier datastore) {
432 return Builders.containerBuilder()
433 .withNodeIdentifier(NETCONF_UNLOCK_NODEID)
434 .withChild(getTargetNode(datastore))