blob: 9d5fae8aa6201624e21aebf8af9627a7e0d5af51 [file] [log] [blame]
andreaeb70a942015-10-16 21:34:46 -07001/*
2 * Copyright 2015 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;
18
19import org.onlab.packet.IpAddress;
20import org.onosproject.net.DeviceId;
21
22import java.util.Map;
Andrea Campanella86294db2016-03-07 11:42:49 -080023import java.util.Set;
andreaeb70a942015-10-16 21:34:46 -070024
25/**
26 * Abstraction of an NETCONF controller. Serves as a one stop shop for obtaining
27 * NetconfDevice and (un)register listeners on NETCONF device events.
28 */
29public interface NetconfController {
30
31 /**
32 * Adds Device Event Listener.
33 *
34 * @param listener node listener
35 */
36 void addDeviceListener(NetconfDeviceListener listener);
37
38 /**
39 * Removes Device Listener.
40 *
41 * @param listener node listener
42 */
43 void removeDeviceListener(NetconfDeviceListener listener);
44
45 /**
46 * Tries to connect to a specific NETCONF device, if the connection is succesful
47 * it creates and adds the device to the ONOS core as a NetconfDevice.
48 *
Andrea Campanella7e6200a2016-03-21 09:48:40 -070049 * @param deviceId deviceId of the device to connect
andreaeb70a942015-10-16 21:34:46 -070050 * @return NetconfDevice Netconf device
Andrea Campanella101417d2015-12-11 17:58:07 -080051 * @throws NetconfException when device is not available
andreaeb70a942015-10-16 21:34:46 -070052 */
Andrea Campanella7e6200a2016-03-21 09:48:40 -070053 NetconfDevice connectDevice(DeviceId deviceId) throws NetconfException;
andreaeb70a942015-10-16 21:34:46 -070054
55 /**
Andrea Campanella86294db2016-03-07 11:42:49 -080056 * Disconnects a Netconf device and removes it from the core.
57 *
Andrea Campanella7e6200a2016-03-21 09:48:40 -070058 * @param deviceId id of the device to remove
59 * @param remove true if device is to be removed from core
Andrea Campanella86294db2016-03-07 11:42:49 -080060 */
Andrea Campanella7e6200a2016-03-21 09:48:40 -070061 void disconnectDevice(DeviceId deviceId, boolean remove);
Andrea Campanella86294db2016-03-07 11:42:49 -080062
63 /**
64 * Removes a Netconf device from the core.
andreaeb70a942015-10-16 21:34:46 -070065 *
Andrea Campanella7e6200a2016-03-21 09:48:40 -070066 * @param deviceId id of the device to remove
andreaeb70a942015-10-16 21:34:46 -070067 */
Andrea Campanella7e6200a2016-03-21 09:48:40 -070068 void removeDevice(DeviceId deviceId);
andreaeb70a942015-10-16 21:34:46 -070069
70 /**
71 * Gets all the nodes information.
72 *
73 * @return map of devices
74 */
75 Map<DeviceId, NetconfDevice> getDevicesMap();
76
77 /**
Andrea Campanella86294db2016-03-07 11:42:49 -080078 * Gets all Netconf Devices.
79 *
80 * @return List of all the NetconfDevices Ids
81 */
82 Set<DeviceId> getNetconfDevices();
83
84 /**
andreaeb70a942015-10-16 21:34:46 -070085 * Gets a Netconf Device by node identifier.
86 *
87 * @param deviceInfo node identifier
88 * @return NetconfDevice Netconf device
89 */
90 NetconfDevice getNetconfDevice(DeviceId deviceInfo);
91
92 /**
93 * Gets a Netconf Device by node identifier.
94 *
95 * @param ip device ip
96 * @param port device port
97 * @return NetconfDevice Netconf device
98 */
99 NetconfDevice getNetconfDevice(IpAddress ip, int port);
andreaeb70a942015-10-16 21:34:46 -0700100}