blob: 363657db2257cc1330ff1a814f822c8351f9411c [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
19import org.onosproject.netconf.NetconfDeviceOutputEventListener;
20
21import java.util.concurrent.CompletableFuture;
22
23/**
24 * Interface to represent an objects that does all the IO on a NETCONF session
25 * with a device.
26 */
27public interface NetconfStreamHandler {
28 /**
29 * Sends the request on the stream that is used to communicate to and from the device.
30 *
31 * @param request request to send to the physical device
32 * @return a CompletableFuture of type String that will contain the response for the request.
33 */
34 CompletableFuture<String> sendMessage(String request);
35
36 /**
37 * Adds a listener for netconf events on the handled stream.
38 *
39 * @param listener Netconf device event listener
40 */
41 void addDeviceEventListener(NetconfDeviceOutputEventListener listener);
42
43 /**
44 * Removes a listener for netconf events on the handled stream.
45 *
46 * @param listener Netconf device event listener
47 */
48 void removeDeviceEventListener(NetconfDeviceOutputEventListener listener);
49}