tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.link; |
| 2 | |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 3 | import org.onlab.onos.net.ConnectPoint; |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 4 | import org.onlab.onos.net.DeviceId; |
| 5 | import org.onlab.onos.net.Link; |
| 6 | |
| 7 | import java.util.Set; |
| 8 | |
| 9 | /** |
| 10 | * Service for interacting with the inventory of infrastructure links. |
| 11 | */ |
| 12 | public interface LinkService { |
| 13 | |
| 14 | /** |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 15 | * Returns the count of all known infrastructure links. |
| 16 | * |
| 17 | * @return number of infrastructure links |
| 18 | */ |
| 19 | int getLinkCount(); |
| 20 | |
| 21 | /** |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 22 | * Returns a collection of all known infrastructure links. |
| 23 | * |
| 24 | * @return all infrastructure links |
| 25 | */ |
| 26 | Iterable<Link> getLinks(); |
| 27 | |
| 28 | /** |
| 29 | * Returns set of all infrastructure links leading to and from the |
| 30 | * specified device. |
| 31 | * |
| 32 | * @param deviceId device identifier |
| 33 | * @return set of device links |
| 34 | */ |
| 35 | Set<Link> getDeviceLinks(DeviceId deviceId); |
| 36 | |
| 37 | /** |
| 38 | * Returns set of all infrastructure links leading from the specified device. |
| 39 | * |
| 40 | * @param deviceId device identifier |
| 41 | * @return set of device egress links |
| 42 | */ |
| 43 | Set<Link> getDeviceEgressLinks(DeviceId deviceId); |
| 44 | |
| 45 | /** |
| 46 | * Returns set of all infrastructure links leading to the specified device. |
| 47 | * |
| 48 | * @param deviceId device identifier |
| 49 | * @return set of device ingress links |
| 50 | */ |
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 51 | Set<Link> getDeviceIngressLinks(DeviceId deviceId); |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 52 | |
| 53 | /** |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 54 | * Returns set of all infrastructure links leading to and from the |
| 55 | * specified connection point. |
| 56 | * |
| 57 | * @param connectPoint connection point |
| 58 | * @return set of links |
| 59 | */ |
| 60 | Set<Link> getLinks(ConnectPoint connectPoint); |
| 61 | |
| 62 | /** |
| 63 | * Returns set of all infrastructure links leading from the specified |
| 64 | * connection point. |
| 65 | * |
| 66 | * @param connectPoint connection point |
| 67 | * @return set of device egress links |
| 68 | */ |
| 69 | Set<Link> getEgressLinks(ConnectPoint connectPoint); |
| 70 | |
| 71 | /** |
| 72 | * Returns set of all infrastructure links leading to the specified |
| 73 | * connection point. |
| 74 | * |
| 75 | * @param connectPoint connection point |
| 76 | * @return set of device ingress links |
| 77 | */ |
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 78 | Set<Link> getIngressLinks(ConnectPoint connectPoint); |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 79 | |
| 80 | /** |
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 81 | * Returns the infrastructure links between the specified source |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 82 | * and destination connection points. |
| 83 | * |
| 84 | * @param src source connection point |
| 85 | * @param dst destination connection point |
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 86 | * @return link from source to destination; null if none found |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 87 | */ |
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 88 | Link getLink(ConnectPoint src, ConnectPoint dst); |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 91 | * Adds the specified link listener. |
| 92 | * |
| 93 | * @param listener link listener |
| 94 | */ |
| 95 | void addListener(LinkListener listener); |
| 96 | |
| 97 | /** |
| 98 | * Removes the specified link listener. |
| 99 | * |
| 100 | * @param listener link listener |
| 101 | */ |
| 102 | void removeListener(LinkListener listener); |
| 103 | |
| 104 | } |