blob: 43cc61c2c2947b030e915142b1d7b18ec06f77ec [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 /**
44 * Returns the resources allocated for an Intent.
45 *
46 * @param intentId the target Intent's id
47 * @return allocated resources for Intent
48 */
Toshio Koide86160f52014-10-23 14:59:07 -070049 LinkResourceAllocations getAllocations(IntentId intentId);
Brian O'Connore7e4bd52014-10-23 13:36:23 -070050
Toshio Koidec9051db2014-10-20 15:18:37 -070051 /**
52 * Returns all allocated resources to given link.
53 *
54 * @param link a target link
Toshio Koide485b4782014-10-20 19:34:21 -070055 * @return allocated resources
Toshio Koidec9051db2014-10-20 15:18:37 -070056 */
Toshio Koide485b4782014-10-20 19:34:21 -070057 Iterable<LinkResourceAllocations> getAllocations(Link link);
Toshio Koidec9051db2014-10-20 15:18:37 -070058
59 /**
Toshio Koide485b4782014-10-20 19:34:21 -070060 * Returns all IDs of intents using the given link.
Toshio Koidec9051db2014-10-20 15:18:37 -070061 *
Toshio Koide485b4782014-10-20 19:34:21 -070062 * @param link a target link
63 * @return IDs of intents using the link
Toshio Koidec9051db2014-10-20 15:18:37 -070064 */
Toshio Koide485b4782014-10-20 19:34:21 -070065 Iterable<IntentId> getIntents(Link link);
Toshio Koidec9051db2014-10-20 15:18:37 -070066
67 /**
68 * Returns available resources for given link.
Toshio Koide485b4782014-10-20 19:34:21 -070069 *
Toshio Koidec9051db2014-10-20 15:18:37 -070070 * @param link a target link
71 * @return available resources for the target link
72 */
Toshio Koide485b4782014-10-20 19:34:21 -070073 ResourceRequest getAvailableResources(Link link);
Thomas Vachuskaf9976952014-10-24 11:55:05 -070074
75 /**
76 * Returns available resources for given link.
77 *
78 * @param link a target link
79 * @param allocations allocations to be included as available
80 * @return available resources for the target link
81 */
82 ResourceRequest getAvailableResources(Link link,
83 LinkResourceAllocations allocations);
84
Toshio Koidec9051db2014-10-20 15:18:37 -070085}