blob: 2f3971136c2a88e2d42c00dd674c7e526f06dac5 [file] [log] [blame]
Yuta HIGUCHI348b3232017-04-20 10:19:48 -07001/*
2 * Copyright 2015-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.netconf.ctl;
18
19import com.google.common.annotations.Beta;
20import org.onosproject.netconf.NetconfDeviceOutputEventListener;
21
22import java.util.concurrent.CompletableFuture;
23
24/**
25 * Interface to represent an objects that does all the IO on a NETCONF session
26 * with a device.
27 *
28 * @deprecated in 1.10.0
29 */
30@Deprecated
31public interface NetconfStreamHandler {
32 /**
33 * Sends the request on the stream that is used to communicate to and from the device.
34 *
35 * If this request does not contain a messageId then this will throw a NoSuchElementException
36 *
37 * @param request request to send to the physical device
38 * @return a CompletableFuture of type String that will contain the response for the request.
39 * @deprecated - use method with messageId parameter instead
40 */
41 @Deprecated
42 CompletableFuture<String> sendMessage(String request);
43
44 /**
45 * Sends the request on the stream that is used to communicate to and from the device.
46 *
47 * @param request request to send to the physical device
48 * @param messageId The identifier of the message - should be unique for the session
49 * @return a CompletableFuture of type String that will contain the response for the request.
50 */
51 CompletableFuture<String> sendMessage(String request, int messageId);
52
53 /**
54 * Adds a listener for netconf events on the handled stream.
55 *
56 * @param listener Netconf device event listener
57 */
58 void addDeviceEventListener(NetconfDeviceOutputEventListener listener);
59
60 /**
61 * Removes a listener for netconf events on the handled stream.
62 *
63 * @param listener Netconf device event listener
64 */
65 void removeDeviceEventListener(NetconfDeviceOutputEventListener listener);
66
67 @Beta
68 /**
69 * Sets instance variable that when true allows receipt of notifications.
70 *
71 * @param enableNotifications if true, allows action based off notifications
72 * else, stops action based off notifications
73 */
74 void setEnableNotifications(boolean enableNotifications);
75}