blob: 6dc04dfc5f6be3aeb17862511b5d45971933f417 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
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'Connor6de2e202015-05-21 14:30:41 -070016package org.onosproject.net.resource.link;
Toshio Koidec9051db2014-10-20 15:18:37 -070017
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070018import org.onosproject.event.ListenerService;
Brian O'Connorabafb502014-12-02 22:26:20 -080019import org.onosproject.net.Link;
20import org.onosproject.net.intent.IntentId;
Brian O'Connor6de2e202015-05-21 14:30:41 -070021import org.onosproject.net.resource.ResourceRequest;
Toshio Koidec9051db2014-10-20 15:18:37 -070022
23/**
24 * Service for providing link resource allocation.
25 */
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070026public interface LinkResourceService
27 extends ListenerService<LinkResourceEvent, LinkResourceListener> {
Toshio Koidec9051db2014-10-20 15:18:37 -070028
29 /**
Toshio Koide485b4782014-10-20 19:34:21 -070030 * Requests resources.
Toshio Koidec9051db2014-10-20 15:18:37 -070031 *
Toshio Koide485b4782014-10-20 19:34:21 -070032 * @param req resources to be allocated
33 * @return allocated resources
Toshio Koidec9051db2014-10-20 15:18:37 -070034 */
Toshio Koide485b4782014-10-20 19:34:21 -070035 LinkResourceAllocations requestResources(LinkResourceRequest req);
Toshio Koidec9051db2014-10-20 15:18:37 -070036
37 /**
Toshio Koide485b4782014-10-20 19:34:21 -070038 * Releases resources.
Toshio Koidec9051db2014-10-20 15:18:37 -070039 *
Toshio Koide485b4782014-10-20 19:34:21 -070040 * @param allocations resources to be released
Toshio Koidec9051db2014-10-20 15:18:37 -070041 */
Toshio Koide485b4782014-10-20 19:34:21 -070042 void releaseResources(LinkResourceAllocations allocations);
Toshio Koidec9051db2014-10-20 15:18:37 -070043
44 /**
Thomas Vachuskaf9976952014-10-24 11:55:05 -070045 * Updates previously made allocations with a new resource request.
46 *
47 * @param req updated resource request
48 * @param oldAllocations old resource allocations
49 * @return new resource allocations
50 */
51 LinkResourceAllocations updateResources(LinkResourceRequest req,
52 LinkResourceAllocations oldAllocations);
53
54 /**
Toshio Koide485b4782014-10-20 19:34:21 -070055 * Returns all allocated resources.
Toshio Koidec9051db2014-10-20 15:18:37 -070056 *
Toshio Koide485b4782014-10-20 19:34:21 -070057 * @return allocated resources
Toshio Koidec9051db2014-10-20 15:18:37 -070058 */
Toshio Koide485b4782014-10-20 19:34:21 -070059 Iterable<LinkResourceAllocations> getAllocations();
Toshio Koidec9051db2014-10-20 15:18:37 -070060
Brian O'Connor55153ce2014-10-23 13:44:05 -070061 /**
Toshio Koidec9051db2014-10-20 15:18:37 -070062 * Returns all allocated resources to given link.
63 *
64 * @param link a target link
Toshio Koide485b4782014-10-20 19:34:21 -070065 * @return allocated resources
Toshio Koidec9051db2014-10-20 15:18:37 -070066 */
Toshio Koide485b4782014-10-20 19:34:21 -070067 Iterable<LinkResourceAllocations> getAllocations(Link link);
Toshio Koidec9051db2014-10-20 15:18:37 -070068
69 /**
Toshio Koide9be539e2014-10-23 18:43:30 -070070 * Returns the resources allocated for an Intent.
Toshio Koidec9051db2014-10-20 15:18:37 -070071 *
Toshio Koide9be539e2014-10-23 18:43:30 -070072 * @param intentId the target Intent's id
73 * @return allocated resources for Intent
Toshio Koidec9051db2014-10-20 15:18:37 -070074 */
Toshio Koide9be539e2014-10-23 18:43:30 -070075 LinkResourceAllocations getAllocations(IntentId intentId);
Toshio Koidec9051db2014-10-20 15:18:37 -070076
77 /**
78 * Returns available resources for given link.
Toshio Koide485b4782014-10-20 19:34:21 -070079 *
Toshio Koidec9051db2014-10-20 15:18:37 -070080 * @param link a target link
81 * @return available resources for the target link
82 */
Toshio Koide9be539e2014-10-23 18:43:30 -070083 Iterable<ResourceRequest> getAvailableResources(Link link);
Thomas Vachuskaf9976952014-10-24 11:55:05 -070084
85 /**
86 * Returns available resources for given link.
87 *
88 * @param link a target link
89 * @param allocations allocations to be included as available
90 * @return available resources for the target link
91 */
weibit00c94f52014-11-16 07:09:05 -080092 Iterable<ResourceRequest> getAvailableResources(Link link,
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070093 LinkResourceAllocations allocations);
Ray Milkeye97ede92014-11-20 10:43:12 -080094
Toshio Koidec9051db2014-10-20 15:18:37 -070095}