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