blob: 37311b132b4d78b05e8a7d9de16bd88648011a42 [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;
23
24/**
25 * Abstraction of an NETCONF controller. Serves as a one stop shop for obtaining
26 * NetconfDevice and (un)register listeners on NETCONF device events.
27 */
28public interface NetconfController {
29
30 /**
31 * Adds Device Event Listener.
32 *
33 * @param listener node listener
34 */
35 void addDeviceListener(NetconfDeviceListener listener);
36
37 /**
38 * Removes Device Listener.
39 *
40 * @param listener node listener
41 */
42 void removeDeviceListener(NetconfDeviceListener listener);
43
44 /**
45 * Tries to connect to a specific NETCONF device, if the connection is succesful
46 * it creates and adds the device to the ONOS core as a NetconfDevice.
47 *
48 * @param deviceInfo info about the device to add
49 * @return NetconfDevice Netconf device
Andrea Campanella101417d2015-12-11 17:58:07 -080050 * @throws NetconfException when device is not available
andreaeb70a942015-10-16 21:34:46 -070051 */
Andrea Campanella101417d2015-12-11 17:58:07 -080052 NetconfDevice connectDevice(NetconfDeviceInfo deviceInfo) throws NetconfException;
andreaeb70a942015-10-16 21:34:46 -070053
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}