andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.netconf; |
| 18 | |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | |
Andrea Campanella | 087ceb9 | 2015-12-07 09:58:34 -0800 | [diff] [blame^] | 22 | import java.io.IOException; |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 23 | import java.util.Map; |
| 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 | * |
| 49 | * @param deviceInfo info about the device to add |
| 50 | * @return NetconfDevice Netconf device |
| 51 | */ |
Andrea Campanella | 087ceb9 | 2015-12-07 09:58:34 -0800 | [diff] [blame^] | 52 | NetconfDevice connectDevice(NetconfDeviceInfo deviceInfo) throws IOException; |
andrea | eb70a94 | 2015-10-16 21:34:46 -0700 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Removes a Netconf device. |
| 56 | * |
| 57 | * @param deviceInfo info about the device to remove |
| 58 | */ |
| 59 | void removeDevice(NetconfDeviceInfo deviceInfo); |
| 60 | |
| 61 | /** |
| 62 | * Gets all the nodes information. |
| 63 | * |
| 64 | * @return map of devices |
| 65 | */ |
| 66 | Map<DeviceId, NetconfDevice> getDevicesMap(); |
| 67 | |
| 68 | /** |
| 69 | * Gets a Netconf Device by node identifier. |
| 70 | * |
| 71 | * @param deviceInfo node identifier |
| 72 | * @return NetconfDevice Netconf device |
| 73 | */ |
| 74 | NetconfDevice getNetconfDevice(DeviceId deviceInfo); |
| 75 | |
| 76 | /** |
| 77 | * Gets a Netconf Device by node identifier. |
| 78 | * |
| 79 | * @param ip device ip |
| 80 | * @param port device port |
| 81 | * @return NetconfDevice Netconf device |
| 82 | */ |
| 83 | NetconfDevice getNetconfDevice(IpAddress ip, int port); |
| 84 | |
| 85 | } |