blob: 0a3fc747c7fd5ff287830f2b1c04db4c397491c1 [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001/**
Ray Milkey269ffb92014-04-03 14:43:30 -07002 * Copyright 2011, Big Switch Networks, Inc.
3 * Originally created by David Erickson, Stanford University
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * not use this file except in compliance with the License. You may obtain
7 * a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations
15 * under the License.
16 **/
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080017
Jonathan Hart23701d12014-04-03 10:45:48 -070018package net.onrc.onos.core.linkdiscovery;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080019
20import java.util.Map;
21import java.util.Set;
22
23import net.floodlightcontroller.core.module.IFloodlightService;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080024
Jonathan Hart284e70f2014-07-05 12:32:51 -070025/**
26 * Interface to the link discovery module.
27 */
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080028public interface ILinkDiscoveryService extends IFloodlightService {
29 /**
Jonathan Hart284e70f2014-07-05 12:32:51 -070030 * Represents the type of a link.
31 * <p/>
32 * This is a placeholder at the moment. Floodlight had defined a number of
33 * different link types which are irrelevant to us now we no longer use
34 * BDDP or support OpenFlow clusters.
35 * Currently we have no differentiation of link types, but in the future we
36 * may want to differentiate between intra-instance links and
37 * inter-instance links.
38 */
39 public enum LinkType {
40 DIRECT_LINK {
41 @Override
42 public String toString() {
43 return "internal";
44 }
45 }
46 }
47
48 /**
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080049 * Retrieves a map of all known link connections between OpenFlow switches
50 * and the associated info (valid time, port states) for the link.
51 */
52 public Map<Link, LinkInfo> getLinks();
53
54 /**
Ray Milkeyb41100a2014-04-10 10:42:15 -070055 * Adds a listener to listen for ILinkDiscoveryService messages.
Ray Milkey269ffb92014-04-03 14:43:30 -070056 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080057 * @param listener The listener that wants the notifications
58 */
59 public void addListener(ILinkDiscoveryListener listener);
60
61 /**
Jonathan Hart284e70f2014-07-05 12:32:51 -070062 * Removes a link discovery listener.
63 *
64 * @param listener the listener to remove
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080065 */
Jonathan Hart284e70f2014-07-05 12:32:51 -070066 public void removeListener(ILinkDiscoveryListener listener);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080067
68 /**
Jonathan Hart284e70f2014-07-05 12:32:51 -070069 * Gets the set of switch ports on which link discovery is disabled.
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080070 */
Jonathan Hart284e70f2014-07-05 12:32:51 -070071 public Set<NodePortTuple> getDiscoveryDisabledPorts();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080072
73 /**
Jonathan Hart284e70f2014-07-05 12:32:51 -070074 * Disables link discovery on a switch port. This method suppresses
75 * discovery probes from being sent from the port, and deletes any existing
76 * links that the discovery module has previously detected on the port.
77 *
78 * @param sw the dpid of the switch the port is on
79 * @param port the port number to disable discovery on
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080080 */
Jonathan Hart284e70f2014-07-05 12:32:51 -070081 public void disableDiscoveryOnPort(long sw, short port);
82
83 /**
84 * Enables link discovery on a switch port. Discovery probes will now be
85 * sent from the port and any links on the port will be discovered.
86 * <p/>
87 * Note: All ports are enabled for discovery by default, however this
88 * method is provided to re-enable link discovery if it had previously been
89 * disabled on the port by a call to
90 * {@link #disableDiscoveryOnPort(long, short)}.
91 *
92 * @param sw the dpid of the switch the port is on
93 * @param port the port number to enable discovery on
94 */
95 public void enableDiscoveryOnPort(long sw, short port);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080096}