Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 1 | /** |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 2 | * 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 Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 17 | |
Jonathan Hart | 23701d1 | 2014-04-03 10:45:48 -0700 | [diff] [blame] | 18 | package net.onrc.onos.core.linkdiscovery; |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 19 | |
| 20 | import java.util.Map; |
| 21 | import java.util.Set; |
| 22 | |
| 23 | import net.floodlightcontroller.core.module.IFloodlightService; |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 24 | |
Jonathan Hart | 284e70f | 2014-07-05 12:32:51 -0700 | [diff] [blame] | 25 | /** |
| 26 | * Interface to the link discovery module. |
| 27 | */ |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 28 | public interface ILinkDiscoveryService extends IFloodlightService { |
| 29 | /** |
Jonathan Hart | 284e70f | 2014-07-05 12:32:51 -0700 | [diff] [blame] | 30 | * 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 Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 49 | * 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 Milkey | b41100a | 2014-04-10 10:42:15 -0700 | [diff] [blame] | 55 | * Adds a listener to listen for ILinkDiscoveryService messages. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 56 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 57 | * @param listener The listener that wants the notifications |
| 58 | */ |
| 59 | public void addListener(ILinkDiscoveryListener listener); |
| 60 | |
| 61 | /** |
Jonathan Hart | 284e70f | 2014-07-05 12:32:51 -0700 | [diff] [blame] | 62 | * Removes a link discovery listener. |
| 63 | * |
| 64 | * @param listener the listener to remove |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 65 | */ |
Jonathan Hart | 284e70f | 2014-07-05 12:32:51 -0700 | [diff] [blame] | 66 | public void removeListener(ILinkDiscoveryListener listener); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 67 | |
| 68 | /** |
Jonathan Hart | 284e70f | 2014-07-05 12:32:51 -0700 | [diff] [blame] | 69 | * Gets the set of switch ports on which link discovery is disabled. |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 70 | */ |
Jonathan Hart | 284e70f | 2014-07-05 12:32:51 -0700 | [diff] [blame] | 71 | public Set<NodePortTuple> getDiscoveryDisabledPorts(); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 72 | |
| 73 | /** |
Jonathan Hart | 284e70f | 2014-07-05 12:32:51 -0700 | [diff] [blame] | 74 | * 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 Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 80 | */ |
Jonathan Hart | 284e70f | 2014-07-05 12:32:51 -0700 | [diff] [blame] | 81 | 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 Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 96 | } |