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 * Read data from Controller node - controller-config
81 * @param dataStoreType
83 * @return NormalizedNode<?, ?> with data
85 Optional<NormalizedNode> readControllerDataNode(LogicalDatastoreType dataStoreType,
86 YangInstanceIdentifier path);
90 * Register netconf notification listener for related mountpoint
92 * @param <T> specific child class of DOMNotificationListener
93 * @param listener listener to be called
94 * @param types as list of SchemaPath
95 * @return handler to manager registration
97 <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener(
98 @NonNull T listener, Collection<Absolute> types);
101 * Register netconf notification listener for related mountpoint
103 * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a>
105 * @param listener to be registers
106 * @param types as array of SchemaPath
107 * @return Object to close and access
109 <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener(
110 @NonNull T listener, Absolute[] types);
113 * Register netconf notification listener for related mountpoint
116 * @param listener to be registers
117 * @param types as array of QName
118 * @return Object to close and access
120 <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener(
121 @NonNull T listener, QName[] types);
124 * Request notification streams from device.
126 * @return provided streams.
129 Map<StreamKey, Stream> getNotificationStreamsAsMap();
132 * Send out a NETCONF create-subscription for one notification stream.
134 * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a>
135 * @param input with CreateSubscriptionInput
136 * @return RpcMessage for the RPC call.
138 ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(CreateSubscriptionInput input);
141 * Send out a NETCONF create-subscription for one notification stream, using parameters.
143 * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a>
144 * @param oStream Optional Stream
145 * @param filter Optional Filter
146 * @param startTime startTime according the RFC
147 * @param stopTime stopTime according the RFC
150 ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(Optional<Stream> oStream, Optional<Filter> filter,
151 Optional<Instant> startTime, Optional<Instant> stopTime);
154 * Send out a NETCONF create-subscription for a list of streams, not offering replay options.
156 * @param streams is a list of stream with 0..n elements.
157 * @return if ok last rpc call result, if notok the result provided by rpc call providing error response.
159 ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(Stream... streams);
162 * Get NETCONF object to serialize between GenericNodes and Java classes
164 * @return serialization object.
166 //BindingNormalizedNodeSerializer getBindingNormalizedNodeSerializer();