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 java.util.List;
12 import java.util.Optional;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.mdsal.common.api.CommitInfo;
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.ModifyAction;
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. get, get-config, edit-config, (un)lock, commit etc).
24 * <edit-config> operation is extended according it's attributes (merge, replace, create, delete, remove).
25 * According to RFC-6241.
27 public interface NetconfDataTreeService extends DOMService {
30 * The <lock> operation.
31 * Allows the client to lock the entire configuration datastore system of a device.
33 * @return result of <lock> operation
35 List<ListenableFuture<? extends DOMRpcResult>> lock();
38 * The <unlock> operation.
39 * Used to release a configuration lock, previously obtained with the <lock> operation.
44 * The <discard-changes> operation.
45 * If device supports :candidate capability, discards any uncommitted changes by resetting
46 * the candidate configuration with the content of the running configuration.
48 void discardChanges();
51 * The <get> operation.
52 * Retrieve running configuration and device state information.
54 * @return result of <get> operation
56 ListenableFuture<Optional<NormalizedNode<?, ?>>> get(YangInstanceIdentifier path);
59 * The <get-config> operation.
60 * Retrieve all or part of a specified configuration datastore.
62 * @return result of <get-config> operation
64 ListenableFuture<Optional<NormalizedNode<?, ?>>> getConfig(YangInstanceIdentifier path);
67 * The <edit-config> operation with "merge" attribute.
68 * The configuration data identified by the element containing this attribute is merged with the configuration
69 * at the corresponding level in the configuration datastore.
71 * @return result of <edit-config> operation
73 ListenableFuture<? extends DOMRpcResult> merge(LogicalDatastoreType store, YangInstanceIdentifier path,
74 NormalizedNode<?, ?> data,
75 Optional<ModifyAction> defaultOperation);
78 * The <edit-config> operation with "replace" attribute.
79 * The configuration data identified by the element containing this attribute replaces any related configuration
80 * in the configuration datastore.
82 * @return result of <edit-config> operation
84 ListenableFuture<? extends DOMRpcResult> replace(LogicalDatastoreType store, YangInstanceIdentifier path,
85 NormalizedNode<?, ?> data,
86 Optional<ModifyAction> defaultOperation);
89 * The <edit-config> operation with "create" attribute.
90 * The configuration data identified by the element containing this attribute is added to the configuration if
91 * and only if the configuration data does not already exist in the configuration datastore.
93 * @return result of <edit-config> operation
95 ListenableFuture<? extends DOMRpcResult> create(LogicalDatastoreType store, YangInstanceIdentifier path,
96 NormalizedNode<?, ?> data,
97 Optional<ModifyAction> defaultOperation);
100 * The <edit-config> operation with "create" attribute.
101 * The configuration data identified by the element containing this attribute is deleted from the configuration
102 * if and only if the configuration data currently exists in the configuration datastore.
104 * @return result of <edit-config> operation
106 ListenableFuture<? extends DOMRpcResult> delete(LogicalDatastoreType store, YangInstanceIdentifier path);
109 * The <edit-config> operation with "create" attribute.
110 * The configuration data identified by the element containing this attribute is deleted from the configuration
111 * if the configuration data currently exists in the configuration datastore.
113 * @return result of <edit-config> operation
115 ListenableFuture<? extends DOMRpcResult> remove(LogicalDatastoreType store, YangInstanceIdentifier path);
118 * The <commit> operation.
119 * If device supports :candidate capability, commit the candidate configuration as the device's
120 * new current configuration.
122 * @return result of <commit> operation
124 ListenableFuture<? extends CommitInfo> commit(List<ListenableFuture<? extends DOMRpcResult>> resultsFutures);
127 * Return device identifier.
129 * @return Device's identifier, must not be null.
131 @NonNull Object getDeviceId();