blob: 69bdf4f7bfca570c1cd3450771349b4f42d59322 [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
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.net.Link;
19import org.onosproject.net.intent.IntentId;
Brian O'Connor6de2e202015-05-21 14:30:41 -070020import org.onosproject.net.resource.ResourceRequest;
Toshio Koidec9051db2014-10-20 15:18:37 -070021
22/**
23 * Service for providing link resource allocation.
24 */
25public interface LinkResourceService {
26
27 /**
Toshio Koide485b4782014-10-20 19:34:21 -070028 * Requests resources.
Toshio Koidec9051db2014-10-20 15:18:37 -070029 *
Toshio Koide485b4782014-10-20 19:34:21 -070030 * @param req resources to be allocated
31 * @return allocated resources
Toshio Koidec9051db2014-10-20 15:18:37 -070032 */
Toshio Koide485b4782014-10-20 19:34:21 -070033 LinkResourceAllocations requestResources(LinkResourceRequest req);
Toshio Koidec9051db2014-10-20 15:18:37 -070034
35 /**
Toshio Koide485b4782014-10-20 19:34:21 -070036 * Releases resources.
Toshio Koidec9051db2014-10-20 15:18:37 -070037 *
Toshio Koide485b4782014-10-20 19:34:21 -070038 * @param allocations resources to be released
Toshio Koidec9051db2014-10-20 15:18:37 -070039 */
Toshio Koide485b4782014-10-20 19:34:21 -070040 void releaseResources(LinkResourceAllocations allocations);
Toshio Koidec9051db2014-10-20 15:18:37 -070041
42 /**
Thomas Vachuskaf9976952014-10-24 11:55:05 -070043 * Updates previously made allocations with a new resource request.
44 *
45 * @param req updated resource request
46 * @param oldAllocations old resource allocations
47 * @return new resource allocations
48 */
49 LinkResourceAllocations updateResources(LinkResourceRequest req,
50 LinkResourceAllocations oldAllocations);
51
52 /**
Toshio Koide485b4782014-10-20 19:34:21 -070053 * Returns all allocated resources.
Toshio Koidec9051db2014-10-20 15:18:37 -070054 *
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();
Toshio Koidec9051db2014-10-20 15:18:37 -070058
Brian O'Connor55153ce2014-10-23 13:44:05 -070059 /**
Toshio Koidec9051db2014-10-20 15:18:37 -070060 * Returns all allocated resources to given link.
61 *
62 * @param link a target link
Toshio Koide485b4782014-10-20 19:34:21 -070063 * @return allocated resources
Toshio Koidec9051db2014-10-20 15:18:37 -070064 */
Toshio Koide485b4782014-10-20 19:34:21 -070065 Iterable<LinkResourceAllocations> getAllocations(Link link);
Toshio Koidec9051db2014-10-20 15:18:37 -070066
67 /**
Toshio Koide9be539e2014-10-23 18:43:30 -070068 * Returns the resources allocated for an Intent.
Toshio Koidec9051db2014-10-20 15:18:37 -070069 *
Toshio Koide9be539e2014-10-23 18:43:30 -070070 * @param intentId the target Intent's id
71 * @return allocated resources for Intent
Toshio Koidec9051db2014-10-20 15:18:37 -070072 */
Toshio Koide9be539e2014-10-23 18:43:30 -070073 LinkResourceAllocations getAllocations(IntentId intentId);
Toshio Koidec9051db2014-10-20 15:18:37 -070074
75 /**
76 * Returns available resources for given link.
Toshio Koide485b4782014-10-20 19:34:21 -070077 *
Toshio Koidec9051db2014-10-20 15:18:37 -070078 * @param link a target link
79 * @return available resources for the target link
80 */
Toshio Koide9be539e2014-10-23 18:43:30 -070081 Iterable<ResourceRequest> getAvailableResources(Link link);
Thomas Vachuskaf9976952014-10-24 11:55:05 -070082
83 /**
84 * Returns available resources for given link.
85 *
86 * @param link a target link
87 * @param allocations allocations to be included as available
88 * @return available resources for the target link
89 */
weibit00c94f52014-11-16 07:09:05 -080090 Iterable<ResourceRequest> getAvailableResources(Link link,
Thomas Vachuskaf9976952014-10-24 11:55:05 -070091 LinkResourceAllocations allocations);
92
Ray Milkeye97ede92014-11-20 10:43:12 -080093 /**
94 * Adds a listener for resource related events.
95 *
96 * @param listener listener to add
97 */
98 void addListener(LinkResourceListener listener);
99
100 /**
101 * Removes a listener for resource related events.
102 *
103 * @param listener listener to remove.
104 */
105 void removeListener(LinkResourceListener listener);
106
Toshio Koidec9051db2014-10-20 15:18:37 -0700107}