Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Foundation |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 | 35c0dc3 | 2014-09-19 10:00:58 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.net.ConnectPoint; |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | import org.onosproject.net.Link; |
| 21 | import org.onosproject.net.provider.ProviderId; |
| 22 | import org.onosproject.store.Store; |
tom | 35c0dc3 | 2014-09-19 10:00:58 -0700 | [diff] [blame] | 23 | |
| 24 | import java.util.Set; |
| 25 | |
| 26 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 27 | * Manages inventory of infrastructure links; not intended for direct use. |
tom | 35c0dc3 | 2014-09-19 10:00:58 -0700 | [diff] [blame] | 28 | */ |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 29 | public interface LinkStore extends Store<LinkEvent, LinkStoreDelegate> { |
tom | 35c0dc3 | 2014-09-19 10:00:58 -0700 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Returns the number of links in the store. |
| 33 | * |
| 34 | * @return number of links |
| 35 | */ |
| 36 | int getLinkCount(); |
| 37 | |
| 38 | /** |
| 39 | * Returns an iterable collection of all links in the inventory. |
| 40 | * |
| 41 | * @return collection of all links |
| 42 | */ |
| 43 | Iterable<Link> getLinks(); |
| 44 | |
| 45 | /** |
| 46 | * Returns all links egressing from the specified device. |
| 47 | * |
| 48 | * @param deviceId device identifier |
| 49 | * @return set of device links |
| 50 | */ |
| 51 | Set<Link> getDeviceEgressLinks(DeviceId deviceId); |
| 52 | |
| 53 | /** |
| 54 | * Returns all links ingressing from the specified device. |
| 55 | * |
| 56 | * @param deviceId device identifier |
| 57 | * @return set of device links |
| 58 | */ |
| 59 | Set<Link> getDeviceIngressLinks(DeviceId deviceId); |
| 60 | |
| 61 | /** |
| 62 | * Returns the link between the two end-points. |
| 63 | * |
| 64 | * @param src source connection point |
| 65 | * @param dst destination connection point |
| 66 | * @return link or null if one not found between the end-points |
| 67 | */ |
| 68 | Link getLink(ConnectPoint src, ConnectPoint dst); |
| 69 | |
| 70 | /** |
| 71 | * Returns all links egressing from the specified connection point. |
| 72 | * |
| 73 | * @param src source connection point |
| 74 | * @return set of connection point links |
| 75 | */ |
| 76 | Set<Link> getEgressLinks(ConnectPoint src); |
| 77 | |
| 78 | /** |
| 79 | * Returns all links ingressing to the specified connection point. |
| 80 | * |
| 81 | * @param dst destination connection point |
| 82 | * @return set of connection point links |
| 83 | */ |
| 84 | Set<Link> getIngressLinks(ConnectPoint dst); |
| 85 | |
| 86 | /** |
| 87 | * Creates a new link, or updates an existing one, based on the given |
| 88 | * information. |
| 89 | * |
| 90 | * @param providerId provider identity |
| 91 | * @param linkDescription link description |
| 92 | * @return create or update link event, or null if no change resulted |
| 93 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 94 | LinkEvent createOrUpdateLink(ProviderId providerId, |
tom | 35c0dc3 | 2014-09-19 10:00:58 -0700 | [diff] [blame] | 95 | LinkDescription linkDescription); |
| 96 | |
| 97 | /** |
Thomas Vachuska | 57126fe | 2014-11-11 17:13:24 -0800 | [diff] [blame] | 98 | * Removes the link, or marks it as inactive if the link is durable, |
| 99 | * based on the specified information. |
| 100 | * |
| 101 | * @param src link source |
| 102 | * @param dst link destination |
| 103 | * @return remove or update link event, or null if no change resulted |
| 104 | */ |
| 105 | LinkEvent removeOrDownLink(ConnectPoint src, ConnectPoint dst); |
| 106 | |
| 107 | /** |
tom | 35c0dc3 | 2014-09-19 10:00:58 -0700 | [diff] [blame] | 108 | * Removes the link based on the specified information. |
| 109 | * |
| 110 | * @param src link source |
| 111 | * @param dst link destination |
| 112 | * @return remove link event, or null if no change resulted |
| 113 | */ |
| 114 | LinkEvent removeLink(ConnectPoint src, ConnectPoint dst); |
| 115 | |
Thomas Vachuska | 57126fe | 2014-11-11 17:13:24 -0800 | [diff] [blame] | 116 | |
tom | 35c0dc3 | 2014-09-19 10:00:58 -0700 | [diff] [blame] | 117 | } |