blob: 1ee7911cb4b3e0d99b9125edf9996b974698dc40 [file] [log] [blame]
Andrea Campanella101417d2015-12-11 17:58:07 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Andrea Campanella101417d2015-12-11 17:58:07 -08003 *
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
helenyrwu0407c642016-06-09 12:01:30 -070019import com.google.common.annotations.Beta;
Andrea Campanella101417d2015-12-11 17:58:07 -080020import 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 */
28public interface NetconfStreamHandler {
29 /**
30 * Sends the request on the stream that is used to communicate to and from the device.
31 *
32 * @param request request to send to the physical device
33 * @return a CompletableFuture of type String that will contain the response for the request.
34 */
35 CompletableFuture<String> sendMessage(String request);
36
37 /**
38 * Adds a listener for netconf events on the handled stream.
39 *
40 * @param listener Netconf device event listener
41 */
42 void addDeviceEventListener(NetconfDeviceOutputEventListener listener);
43
44 /**
45 * Removes a listener for netconf events on the handled stream.
46 *
47 * @param listener Netconf device event listener
48 */
49 void removeDeviceEventListener(NetconfDeviceOutputEventListener listener);
helenyrwu0407c642016-06-09 12:01:30 -070050
51 @Beta
52 /**
53 * Sets instance variable that when true allows receipt of notifications.
54 *
55 * @param enableNotifications if true, allows action based off notifications
56 * else, stops action based off notifications
57 */
58 void setEnableNotifications(boolean enableNotifications);
Andrea Campanella101417d2015-12-11 17:58:07 -080059}