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.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput;
33 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.create.subscription.input.Filter;
34 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream;
35 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamKey;
36 import org.opendaylight.yangtools.concepts.ListenerRegistration;
37 import org.opendaylight.yangtools.yang.binding.DataObject;
38 import org.opendaylight.yangtools.yang.common.QName;
39 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
40 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
41 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
44 * Interface handling netconf connection.
46 public interface NetconfDomAccessor extends NetconfAccessor {
49 * @return the dataBroker
51 DOMDataBroker getDataBroker();
54 * @return the MDSAL Mountpoint service
56 DOMMountPoint getMountpoint();
59 * Deliver the data into a class
61 * @param <T> DataObject type
62 * @param dataStoreType config or operational database
63 * @param path data path
64 * @return Optional<T> with object
66 <T extends DataObject> Optional<T> readData(LogicalDatastoreType dataStoreType, YangInstanceIdentifier path,
70 * Read data from device
72 * @param dataStoreType
74 * @return NormalizedNode<?, ?> with data
76 Optional<NormalizedNode<?, ?>> readDataNode(LogicalDatastoreType dataStoreType, YangInstanceIdentifier path);
79 * Register netconf notification listener for related mountpoint
81 * @param <T> specific child class of DOMNotificationListener
82 * @param listener listener to be called
83 * @param types as list of Absolute
84 * @return handler to manager registration
86 <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener(
87 @NonNull T listener, Collection<Absolute> types);
90 * Register netconf notification listener for related mountpoint
92 * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a>
94 * @param listener to be registers
95 * @param types as array of Absolute
96 * @return Object to close and access
98 <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener(
99 @NonNull T listener, Absolute[] types);
102 * Register netconf notification listener for related mountpoint
105 * @param listener to be registers
106 * @param types as array of QName
107 * @return Object to close and access
109 <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener(
110 @NonNull T listener, QName[] types);
113 * Request notification streams from device.
115 * @return provided streams.
118 Map<StreamKey, Stream> getNotificationStreamsAsMap();
121 * Send out a NETCONF create-subscription for one notification stream.
123 * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a>
124 * @param input with CreateSubscriptionInput
125 * @return RpcMessage for the RPC call.
127 ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(CreateSubscriptionInput input);
130 * Send out a NETCONF create-subscription for one notification stream, using parameters.
132 * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a>
133 * @param oStream Optional Stream
134 * @param filter Optional Filter
135 * @param startTime startTime according the RFC
136 * @param stopTime stopTime according the RFC
139 ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(Optional<Stream> oStream, Optional<Filter> filter,
140 Optional<Instant> startTime, Optional<Instant> stopTime);
143 * Send out a NETCONF create-subscription for a list of streams, not offering replay options.
145 * @param streams is a list of stream with 0..n elements.
146 * @return if ok last rpc call result, if notok the result provided by rpc call providing error response.
148 ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(Stream... streams);
151 * Get NETCONF object to serialize between GenericNodes and Java classes
153 * @return serialization object.
155 BindingNormalizedNodeSerializer getBindingNormalizedNodeSerializer();