blob: 2d709cb98c564a21b2b54bdc6283ab102e963538 [file] [log] [blame]
Toshio Koidec9051db2014-10-20 15:18:37 -07001package org.onlab.onos.net.resource;
2
Toshio Koidec9051db2014-10-20 15:18:37 -07003import org.onlab.onos.net.Link;
4import org.onlab.onos.net.intent.IntentId;
Toshio Koidec9051db2014-10-20 15:18:37 -07005
6/**
7 * Service for providing link resource allocation.
8 */
9public interface LinkResourceService {
10
11 /**
Toshio Koide485b4782014-10-20 19:34:21 -070012 * Requests resources.
Toshio Koidec9051db2014-10-20 15:18:37 -070013 *
Toshio Koide485b4782014-10-20 19:34:21 -070014 * @param req resources to be allocated
15 * @return allocated resources
Toshio Koidec9051db2014-10-20 15:18:37 -070016 */
Toshio Koide485b4782014-10-20 19:34:21 -070017 LinkResourceAllocations requestResources(LinkResourceRequest req);
Toshio Koidec9051db2014-10-20 15:18:37 -070018
19 /**
Toshio Koide485b4782014-10-20 19:34:21 -070020 * Releases resources.
Toshio Koidec9051db2014-10-20 15:18:37 -070021 *
Toshio Koide485b4782014-10-20 19:34:21 -070022 * @param allocations resources to be released
Toshio Koidec9051db2014-10-20 15:18:37 -070023 */
Toshio Koide485b4782014-10-20 19:34:21 -070024 void releaseResources(LinkResourceAllocations allocations);
Toshio Koidec9051db2014-10-20 15:18:37 -070025
26 /**
Thomas Vachuskaf9976952014-10-24 11:55:05 -070027 * 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 Koide485b4782014-10-20 19:34:21 -070037 * Returns all allocated resources.
Toshio Koidec9051db2014-10-20 15:18:37 -070038 *
Toshio Koide485b4782014-10-20 19:34:21 -070039 * @return allocated resources
Toshio Koidec9051db2014-10-20 15:18:37 -070040 */
Toshio Koide485b4782014-10-20 19:34:21 -070041 Iterable<LinkResourceAllocations> getAllocations();
Toshio Koidec9051db2014-10-20 15:18:37 -070042
Brian O'Connor55153ce2014-10-23 13:44:05 -070043 /**
Toshio Koidec9051db2014-10-20 15:18:37 -070044 * Returns all allocated resources to given link.
45 *
46 * @param link a target link
Toshio Koide485b4782014-10-20 19:34:21 -070047 * @return allocated resources
Toshio Koidec9051db2014-10-20 15:18:37 -070048 */
Toshio Koide485b4782014-10-20 19:34:21 -070049 Iterable<LinkResourceAllocations> getAllocations(Link link);
Toshio Koidec9051db2014-10-20 15:18:37 -070050
51 /**
Toshio Koide9be539e2014-10-23 18:43:30 -070052 * Returns the resources allocated for an Intent.
Toshio Koidec9051db2014-10-20 15:18:37 -070053 *
Toshio Koide9be539e2014-10-23 18:43:30 -070054 * @param intentId the target Intent's id
55 * @return allocated resources for Intent
Toshio Koidec9051db2014-10-20 15:18:37 -070056 */
Toshio Koide9be539e2014-10-23 18:43:30 -070057 LinkResourceAllocations getAllocations(IntentId intentId);
Toshio Koidec9051db2014-10-20 15:18:37 -070058
59 /**
60 * Returns available resources for given link.
Toshio Koide485b4782014-10-20 19:34:21 -070061 *
Toshio Koidec9051db2014-10-20 15:18:37 -070062 * @param link a target link
63 * @return available resources for the target link
64 */
Toshio Koide9be539e2014-10-23 18:43:30 -070065 Iterable<ResourceRequest> getAvailableResources(Link link);
Thomas Vachuskaf9976952014-10-24 11:55:05 -070066
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 Koidec9051db2014-10-20 15:18:37 -070077}