Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.link; |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 17 | |
alshabib | b5522ff | 2014-09-29 19:20:00 -0700 | [diff] [blame] | 18 | import java.util.Set; |
| 19 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 20 | import org.onosproject.net.ConnectPoint; |
| 21 | import org.onosproject.net.DeviceId; |
| 22 | import org.onosproject.net.Link; |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 23 | |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 24 | /** |
| 25 | * Service for interacting with the inventory of infrastructure links. |
| 26 | */ |
| 27 | public interface LinkService { |
| 28 | |
| 29 | /** |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 30 | * Returns the count of all known infrastructure links. |
| 31 | * |
| 32 | * @return number of infrastructure links |
| 33 | */ |
| 34 | int getLinkCount(); |
| 35 | |
| 36 | /** |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 37 | * Returns a collection of all known infrastructure links. |
| 38 | * |
| 39 | * @return all infrastructure links |
| 40 | */ |
| 41 | Iterable<Link> getLinks(); |
| 42 | |
| 43 | /** |
Yuta HIGUCHI | f1f2ac0 | 2014-11-26 14:02:22 -0800 | [diff] [blame] | 44 | * Returns a collection of all active infrastructure links. |
| 45 | * |
| 46 | * @return all infrastructure links |
| 47 | */ |
| 48 | Iterable<Link> getActiveLinks(); |
| 49 | |
| 50 | /** |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 51 | * Returns set of all infrastructure links leading to and from the |
| 52 | * specified device. |
| 53 | * |
| 54 | * @param deviceId device identifier |
| 55 | * @return set of device links |
| 56 | */ |
| 57 | Set<Link> getDeviceLinks(DeviceId deviceId); |
| 58 | |
| 59 | /** |
| 60 | * Returns set of all infrastructure links leading from the specified device. |
| 61 | * |
| 62 | * @param deviceId device identifier |
| 63 | * @return set of device egress links |
| 64 | */ |
| 65 | Set<Link> getDeviceEgressLinks(DeviceId deviceId); |
| 66 | |
| 67 | /** |
| 68 | * Returns set of all infrastructure links leading to the specified device. |
| 69 | * |
| 70 | * @param deviceId device identifier |
| 71 | * @return set of device ingress links |
| 72 | */ |
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 73 | Set<Link> getDeviceIngressLinks(DeviceId deviceId); |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 74 | |
| 75 | /** |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 76 | * Returns set of all infrastructure links leading to and from the |
| 77 | * specified connection point. |
| 78 | * |
| 79 | * @param connectPoint connection point |
| 80 | * @return set of links |
| 81 | */ |
| 82 | Set<Link> getLinks(ConnectPoint connectPoint); |
| 83 | |
| 84 | /** |
| 85 | * Returns set of all infrastructure links leading from the specified |
| 86 | * connection point. |
| 87 | * |
| 88 | * @param connectPoint connection point |
| 89 | * @return set of device egress links |
| 90 | */ |
| 91 | Set<Link> getEgressLinks(ConnectPoint connectPoint); |
| 92 | |
| 93 | /** |
| 94 | * Returns set of all infrastructure links leading to the specified |
| 95 | * connection point. |
| 96 | * |
| 97 | * @param connectPoint connection point |
| 98 | * @return set of device ingress links |
| 99 | */ |
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 100 | Set<Link> getIngressLinks(ConnectPoint connectPoint); |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 101 | |
Thomas Vachuska | ca60f2b | 2014-11-06 01:34:28 -0800 | [diff] [blame] | 102 | // FIXME: I don't think this makes sense; discuss and remove or adjust return |
| 103 | // to be a Set<Link> or add Link.Type parameter |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 104 | /** |
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 105 | * Returns the infrastructure links between the specified source |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 106 | * and destination connection points. |
| 107 | * |
| 108 | * @param src source connection point |
| 109 | * @param dst destination connection point |
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 110 | * @return link from source to destination; null if none found |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 111 | */ |
tom | d176fc4 | 2014-09-08 00:12:30 -0700 | [diff] [blame] | 112 | Link getLink(ConnectPoint src, ConnectPoint dst); |
tom | eadbb46 | 2014-09-07 16:10:19 -0700 | [diff] [blame] | 113 | |
| 114 | /** |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 115 | * Adds the specified link listener. |
| 116 | * |
| 117 | * @param listener link listener |
| 118 | */ |
| 119 | void addListener(LinkListener listener); |
| 120 | |
| 121 | /** |
| 122 | * Removes the specified link listener. |
| 123 | * |
| 124 | * @param listener link listener |
| 125 | */ |
| 126 | void removeListener(LinkListener listener); |
| 127 | |
| 128 | } |