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 | 6de2e20 | 2015-05-21 14:30:41 -0700 | [diff] [blame^] | 16 | package org.onosproject.net.resource.link; |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.net.Link; |
| 19 | import org.onosproject.net.intent.IntentId; |
Brian O'Connor | 6de2e20 | 2015-05-21 14:30:41 -0700 | [diff] [blame^] | 20 | import org.onosproject.net.resource.ResourceRequest; |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Service for providing link resource allocation. |
| 24 | */ |
| 25 | public interface LinkResourceService { |
| 26 | |
| 27 | /** |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 28 | * Requests resources. |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 29 | * |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 30 | * @param req resources to be allocated |
| 31 | * @return allocated resources |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 32 | */ |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 33 | LinkResourceAllocations requestResources(LinkResourceRequest req); |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 36 | * Releases resources. |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 37 | * |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 38 | * @param allocations resources to be released |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 39 | */ |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 40 | void releaseResources(LinkResourceAllocations allocations); |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
Thomas Vachuska | f997695 | 2014-10-24 11:55:05 -0700 | [diff] [blame] | 43 | * Updates previously made allocations with a new resource request. |
| 44 | * |
| 45 | * @param req updated resource request |
| 46 | * @param oldAllocations old resource allocations |
| 47 | * @return new resource allocations |
| 48 | */ |
| 49 | LinkResourceAllocations updateResources(LinkResourceRequest req, |
| 50 | LinkResourceAllocations oldAllocations); |
| 51 | |
| 52 | /** |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 53 | * Returns all allocated resources. |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 54 | * |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 55 | * @return allocated resources |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 56 | */ |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 57 | Iterable<LinkResourceAllocations> getAllocations(); |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 58 | |
Brian O'Connor | 55153ce | 2014-10-23 13:44:05 -0700 | [diff] [blame] | 59 | /** |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 60 | * Returns all allocated resources to given link. |
| 61 | * |
| 62 | * @param link a target link |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 63 | * @return allocated resources |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 64 | */ |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 65 | Iterable<LinkResourceAllocations> getAllocations(Link link); |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 66 | |
| 67 | /** |
Toshio Koide | 9be539e | 2014-10-23 18:43:30 -0700 | [diff] [blame] | 68 | * Returns the resources allocated for an Intent. |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 69 | * |
Toshio Koide | 9be539e | 2014-10-23 18:43:30 -0700 | [diff] [blame] | 70 | * @param intentId the target Intent's id |
| 71 | * @return allocated resources for Intent |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 72 | */ |
Toshio Koide | 9be539e | 2014-10-23 18:43:30 -0700 | [diff] [blame] | 73 | LinkResourceAllocations getAllocations(IntentId intentId); |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 74 | |
| 75 | /** |
| 76 | * Returns available resources for given link. |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 77 | * |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 78 | * @param link a target link |
| 79 | * @return available resources for the target link |
| 80 | */ |
Toshio Koide | 9be539e | 2014-10-23 18:43:30 -0700 | [diff] [blame] | 81 | Iterable<ResourceRequest> getAvailableResources(Link link); |
Thomas Vachuska | f997695 | 2014-10-24 11:55:05 -0700 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * Returns available resources for given link. |
| 85 | * |
| 86 | * @param link a target link |
| 87 | * @param allocations allocations to be included as available |
| 88 | * @return available resources for the target link |
| 89 | */ |
weibit | 00c94f5 | 2014-11-16 07:09:05 -0800 | [diff] [blame] | 90 | Iterable<ResourceRequest> getAvailableResources(Link link, |
Thomas Vachuska | f997695 | 2014-10-24 11:55:05 -0700 | [diff] [blame] | 91 | LinkResourceAllocations allocations); |
| 92 | |
Ray Milkey | e97ede9 | 2014-11-20 10:43:12 -0800 | [diff] [blame] | 93 | /** |
| 94 | * Adds a listener for resource related events. |
| 95 | * |
| 96 | * @param listener listener to add |
| 97 | */ |
| 98 | void addListener(LinkResourceListener listener); |
| 99 | |
| 100 | /** |
| 101 | * Removes a listener for resource related events. |
| 102 | * |
| 103 | * @param listener listener to remove. |
| 104 | */ |
| 105 | void removeListener(LinkResourceListener listener); |
| 106 | |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 107 | } |