andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.netconf; |
| 18 | |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | |
| 22 | import java.util.Map; |
Andrea Campanella | 86294db | 2016-03-07 11:42:49 -0800 | [diff] [blame] | 23 | import java.util.Set; |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 24 | |
| 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 | */ |
| 29 | public 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 Campanella | 7e6200a | 2016-03-21 09:48:40 -0700 | [diff] [blame] | 49 | * @param deviceId deviceId of the device to connect |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 50 | * @return NetconfDevice Netconf device |
Andrea Campanella | 101417d | 2015-12-11 17:58:07 -0800 | [diff] [blame] | 51 | * @throws NetconfException when device is not available |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 52 | */ |
Andrea Campanella | 7e6200a | 2016-03-21 09:48:40 -0700 | [diff] [blame] | 53 | NetconfDevice connectDevice(DeviceId deviceId) throws NetconfException; |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 54 | |
| 55 | /** |
Andrea Campanella | 86294db | 2016-03-07 11:42:49 -0800 | [diff] [blame] | 56 | * Disconnects a Netconf device and removes it from the core. |
| 57 | * |
Andrea Campanella | 7e6200a | 2016-03-21 09:48:40 -0700 | [diff] [blame] | 58 | * @param deviceId id of the device to remove |
| 59 | * @param remove true if device is to be removed from core |
Andrea Campanella | 86294db | 2016-03-07 11:42:49 -0800 | [diff] [blame] | 60 | */ |
Andrea Campanella | 7e6200a | 2016-03-21 09:48:40 -0700 | [diff] [blame] | 61 | void disconnectDevice(DeviceId deviceId, boolean remove); |
Andrea Campanella | 86294db | 2016-03-07 11:42:49 -0800 | [diff] [blame] | 62 | |
| 63 | /** |
| 64 | * Removes a Netconf device from the core. |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 65 | * |
Andrea Campanella | 7e6200a | 2016-03-21 09:48:40 -0700 | [diff] [blame] | 66 | * @param deviceId id of the device to remove |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 67 | */ |
Andrea Campanella | 7e6200a | 2016-03-21 09:48:40 -0700 | [diff] [blame] | 68 | void removeDevice(DeviceId deviceId); |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 69 | |
| 70 | /** |
| 71 | * Gets all the nodes information. |
| 72 | * |
| 73 | * @return map of devices |
| 74 | */ |
| 75 | Map<DeviceId, NetconfDevice> getDevicesMap(); |
| 76 | |
| 77 | /** |
Andrea Campanella | 86294db | 2016-03-07 11:42:49 -0800 | [diff] [blame] | 78 | * Gets all Netconf Devices. |
| 79 | * |
| 80 | * @return List of all the NetconfDevices Ids |
| 81 | */ |
| 82 | Set<DeviceId> getNetconfDevices(); |
| 83 | |
| 84 | /** |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 85 | * 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); |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 100 | } |