2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.dom.api;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import edu.umd.cs.findbugs.annotations.CheckReturnValue;
12 import java.util.List;
13 import java.util.Optional;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
16 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
17 import org.opendaylight.mdsal.dom.api.DOMService;
18 import org.opendaylight.netconf.api.EffectiveOperation;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
20 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
23 * Interface for base and additional operations for NETCONF (e.g. {@code get}, {@code get-config}, {@code edit-config},
24 * {@code lock}, {@code unlock}, {@code commit}, etc).
25 * The {@code <edit-config>} operation is extended according its attributes (merge, replace, create, delete, remove), as
28 public interface NetconfDataTreeService extends DOMService<NetconfDataTreeService, NetconfDataTreeService.Extension> {
30 * Type capture of a {@link DOMService.Extension} applicable to {@link NetconfDataTreeService} implementations.
32 interface Extension extends DOMService.Extension<NetconfDataTreeService, Extension> {
37 * Return device identifier.
39 * @return Device's identifier, must not be {@code null}.
41 @NonNull Object getDeviceId();
44 * The {@code <lock>} operation. Allows the client to lock the entire configuration datastore system of a device.
46 * @return result of {@code <lock>} operation
49 ListenableFuture<? extends DOMRpcResult> lock();
52 * The {@code <lock>} operation. Used to release a configuration lock, previously obtained with the {@code <lock>}
55 * @return result of {@code <unlock>} operation
58 ListenableFuture<? extends DOMRpcResult> unlock();
61 * The {@code <discard-changes>} operation. If device supports {@code :candidate} capability, discards any
62 * uncommitted changes by resetting the candidate configuration with the content of the running configuration.
64 * @return result of {@code <discard-changes>} operation
66 ListenableFuture<? extends DOMRpcResult> discardChanges();
69 * The {@code <get>} operation. Retrieve running configuration and device state information.
71 * @return result of {@code <get>} operation
73 ListenableFuture<Optional<NormalizedNode>> get(YangInstanceIdentifier path);
76 * The {@code <get>} operation with specific fields that are read from device.
78 * @param path path to data
79 * @param fields list of fields (paths relative to parent path)
80 * @return result of {@code <get>} operation
82 ListenableFuture<Optional<NormalizedNode>> get(YangInstanceIdentifier path, List<YangInstanceIdentifier> fields);
85 * The {@code <get-config>} operation. Retrieve all or part of a specified configuration datastore.
87 * @return result of {@code <get-config>} operation
89 ListenableFuture<Optional<NormalizedNode>> getConfig(YangInstanceIdentifier path);
92 * The {@code <get-config>} operation with specified fields that are read from device.
94 * @return result of {@code <get-config>} operation
96 ListenableFuture<Optional<NormalizedNode>> getConfig(YangInstanceIdentifier path,
97 List<YangInstanceIdentifier> fields);
100 * The {@code <edit-config>} operation with {@code merge} attribute. The configuration data identified by the
101 * element containing this attribute is merged with the configuration at the corresponding level in the
102 * configuration datastore.
104 * @return result of {@code <edit-config>} operation
106 ListenableFuture<? extends DOMRpcResult> merge(LogicalDatastoreType store, YangInstanceIdentifier path,
107 NormalizedNode data, Optional<EffectiveOperation> defaultOperation);
110 * The {@code <edit-config>} operation with {@code replace} attribute. The configuration data identified by the
111 * element containing this attribute replaces any related configuration in the configuration datastore.
113 * @return result of {@code <edit-config>} operation
115 ListenableFuture<? extends DOMRpcResult> replace(LogicalDatastoreType store, YangInstanceIdentifier path,
116 NormalizedNode data, Optional<EffectiveOperation> defaultOperation);
119 * The {@code <edit-config>} operation with {@code create} attribute. The configuration data identified by the
120 * element containing this attribute is added to the configuration if and only if the configuration data does not
121 * already exist in the configuration datastore.
123 * @return result of{@code <edit-config>} operation
125 ListenableFuture<? extends DOMRpcResult> create(LogicalDatastoreType store, YangInstanceIdentifier path,
126 NormalizedNode data, Optional<EffectiveOperation> defaultOperation);
129 * The {@code <edit-config>} operation with {@code create} attribute. The configuration data identified by the
130 * element containing this attribute is deleted from the configuration if and only if the configuration data
131 * currently exists in the configuration datastore.
133 * @return result of {@code <edit-config>} operation
135 ListenableFuture<? extends DOMRpcResult> delete(LogicalDatastoreType store, YangInstanceIdentifier path);
138 * The {@code <edit-config>} operation with {@code create} attribute. The configuration data identified by the
139 * element containing this attribute is deleted from the configuration if the configuration data currently exists
140 * in the configuration datastore.
142 * @return result of {@code <edit-config>} operation
144 ListenableFuture<? extends DOMRpcResult> remove(LogicalDatastoreType store, YangInstanceIdentifier path);
147 * The {@code <commit>} operation. If device supports {@code :candidate} capability, commit the candidate
148 * configuration as the device's new current configuration.
150 * @return result of {@code <commit>} operation
152 ListenableFuture<? extends DOMRpcResult> commit();