2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
18 package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice;
20 import com.google.common.util.concurrent.ListenableFuture;
21 import java.time.Instant;
22 import java.util.Collection;
24 import java.util.Optional;
25 import org.eclipse.jdt.annotation.NonNull;
26 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
27 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
28 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
29 import org.opendaylight.mdsal.dom.api.DOMMountPoint;
30 import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
31 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
32 import org.opendaylight.mdsal.dom.api.DOMRpcService;
33 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput;
34 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.create.subscription.input.Filter;
35 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream;
36 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamKey;
37 import org.opendaylight.yangtools.concepts.ListenerRegistration;
38 import org.opendaylight.yangtools.yang.binding.DataObject;
39 import org.opendaylight.yangtools.yang.common.QName;
40 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
41 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
42 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
45 * Interface handling netconf connection.
47 public interface NetconfDomAccessor extends NetconfAccessor {
50 * @return the dataBroker
52 DOMDataBroker getDataBroker();
55 * @return the MDSAL Mountpoint service
57 DOMMountPoint getMountpoint();
60 * @return DOMRpcService
62 DOMRpcService getRpcService();
67 DomContext getDomContext();
70 * Deliver the data into a class
72 * @param <T> DataObject type
73 * @param dataStoreType config or operational database
74 * @param path data path
75 * @return Optional<T> with object
77 <T extends DataObject> Optional<T> readData(LogicalDatastoreType dataStoreType, YangInstanceIdentifier path,
81 * Read data from device
83 * @param dataStoreType
85 * @return NormalizedNode<?, ?> with data
87 Optional<NormalizedNode> readDataNode(LogicalDatastoreType dataStoreType, YangInstanceIdentifier path);
90 * Read data from Controller node - controller-config
92 * @param dataStoreType
94 * @return NormalizedNode<?, ?> with data
96 Optional<NormalizedNode> readControllerDataNode(LogicalDatastoreType dataStoreType,
97 YangInstanceIdentifier path);
101 * Register netconf notification listener for related mountpoint
103 * @param <T> specific child class of DOMNotificationListener
104 * @param listener listener to be called
105 * @param types as list of SchemaPath
106 * @return handler to manager registration
108 <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener(
109 @NonNull T listener, Collection<Absolute> types);
112 * Register netconf notification listener for related mountpoint
114 * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a>
116 * @param listener to be registers
117 * @param types as array of SchemaPath
118 * @return Object to close and access
120 <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener(
121 @NonNull T listener, Absolute[] types);
124 * Register netconf notification listener for related mountpoint
127 * @param listener to be registers
128 * @param types as array of QName
129 * @return Object to close and access
131 <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener(
132 @NonNull T listener, QName[] types);
135 * Request notification streams from device.
137 * @return provided streams.
140 Map<StreamKey, Stream> getNotificationStreamsAsMap();
143 * Send out a NETCONF create-subscription for one notification stream.
145 * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a>
146 * @param input with CreateSubscriptionInput
147 * @return RpcMessage for the RPC call.
149 ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(CreateSubscriptionInput input);
152 * Send out a NETCONF create-subscription for one notification stream, using parameters.
154 * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a>
155 * @param oStream Optional Stream
156 * @param filter Optional Filter
157 * @param startTime startTime according the RFC
158 * @param stopTime stopTime according the RFC
161 ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(Optional<Stream> oStream, Optional<Filter> filter,
162 Optional<Instant> startTime, Optional<Instant> stopTime);
165 * Send out a NETCONF create-subscription for a list of streams, not offering replay options.
167 * @param streams is a list of stream with 0..n elements.
168 * @return if ok last rpc call result, if notok the result provided by rpc call providing error response.
170 ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(Stream... streams);
173 * Get NETCONF object to serialize between GenericNodes and Java classes
175 * @return serialization object.
177 //BindingNormalizedNodeSerializer getBindingNormalizedNodeSerializer();