Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.resource; |
| 2 | |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 3 | import org.onlab.onos.net.Link; |
| 4 | import org.onlab.onos.net.intent.IntentId; |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 5 | |
| 6 | /** |
| 7 | * Service for providing link resource allocation. |
| 8 | */ |
| 9 | public interface LinkResourceService { |
| 10 | |
| 11 | /** |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 12 | * Requests resources. |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 13 | * |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 14 | * @param req resources to be allocated |
| 15 | * @return allocated resources |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 16 | */ |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 17 | LinkResourceAllocations requestResources(LinkResourceRequest req); |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 18 | |
| 19 | /** |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 20 | * Releases resources. |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 21 | * |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 22 | * @param allocations resources to be released |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 23 | */ |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 24 | void releaseResources(LinkResourceAllocations allocations); |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
Thomas Vachuska | f997695 | 2014-10-24 11:55:05 -0700 | [diff] [blame] | 27 | * Updates previously made allocations with a new resource request. |
| 28 | * |
| 29 | * @param req updated resource request |
| 30 | * @param oldAllocations old resource allocations |
| 31 | * @return new resource allocations |
| 32 | */ |
| 33 | LinkResourceAllocations updateResources(LinkResourceRequest req, |
| 34 | LinkResourceAllocations oldAllocations); |
| 35 | |
| 36 | /** |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 37 | * Returns all allocated resources. |
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 | * @return allocated resources |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 40 | */ |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 41 | Iterable<LinkResourceAllocations> getAllocations(); |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 42 | |
Brian O'Connor | 55153ce | 2014-10-23 13:44:05 -0700 | [diff] [blame] | 43 | /** |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 44 | * Returns all allocated resources to given link. |
| 45 | * |
| 46 | * @param link a target link |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 47 | * @return allocated resources |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 48 | */ |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 49 | Iterable<LinkResourceAllocations> getAllocations(Link link); |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 50 | |
| 51 | /** |
Toshio Koide | 9be539e | 2014-10-23 18:43:30 -0700 | [diff] [blame^] | 52 | * Returns the resources allocated for an Intent. |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 53 | * |
Toshio Koide | 9be539e | 2014-10-23 18:43:30 -0700 | [diff] [blame^] | 54 | * @param intentId the target Intent's id |
| 55 | * @return allocated resources for Intent |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 56 | */ |
Toshio Koide | 9be539e | 2014-10-23 18:43:30 -0700 | [diff] [blame^] | 57 | LinkResourceAllocations getAllocations(IntentId intentId); |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Returns available resources for given link. |
Toshio Koide | 485b478 | 2014-10-20 19:34:21 -0700 | [diff] [blame] | 61 | * |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 62 | * @param link a target link |
| 63 | * @return available resources for the target link |
| 64 | */ |
Toshio Koide | 9be539e | 2014-10-23 18:43:30 -0700 | [diff] [blame^] | 65 | Iterable<ResourceRequest> getAvailableResources(Link link); |
Thomas Vachuska | f997695 | 2014-10-24 11:55:05 -0700 | [diff] [blame] | 66 | |
| 67 | /** |
| 68 | * Returns available resources for given link. |
| 69 | * |
| 70 | * @param link a target link |
| 71 | * @param allocations allocations to be included as available |
| 72 | * @return available resources for the target link |
| 73 | */ |
| 74 | ResourceRequest getAvailableResources(Link link, |
| 75 | LinkResourceAllocations allocations); |
| 76 | |
Toshio Koide | c9051db | 2014-10-20 15:18:37 -0700 | [diff] [blame] | 77 | } |