blob: e6674dbdd1e0959d07a2d7d73664a1356ef15377 [file] [log] [blame]
Toshio Koide106d4492014-10-28 11:22:02 -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 Koide106d4492014-10-28 11:22:02 -070017
18import java.util.Set;
19
Brian O'Connorabafb502014-12-02 22:26:20 -080020import org.onosproject.net.Link;
21import org.onosproject.net.intent.IntentId;
Brian O'Connor6de2e202015-05-21 14:30:41 -070022import org.onosproject.net.resource.ResourceAllocation;
Toshio Koide106d4492014-10-28 11:22:02 -070023
Toshio Koide106d4492014-10-28 11:22:02 -070024/**
25 * Manages link resources.
26 */
27public interface LinkResourceStore {
Toshio Koide07df7062014-10-30 10:54:25 -070028 /**
29 * Returns free resources for given link.
30 *
31 * @param link a target link
32 * @return free resources for given link
33 */
Toshio Koide106d4492014-10-28 11:22:02 -070034 Set<ResourceAllocation> getFreeResources(Link link);
35
Toshio Koide07df7062014-10-30 10:54:25 -070036 /**
37 * Allocates resources.
38 *
39 * @param allocations resources to be allocated
40 */
Toshio Koide106d4492014-10-28 11:22:02 -070041 void allocateResources(LinkResourceAllocations allocations);
42
Toshio Koide07df7062014-10-30 10:54:25 -070043 /**
44 * Releases resources.
45 *
46 * @param allocations resources to be released
Pavlin Radoslavov119fd5c2014-11-25 19:08:19 -080047 * @return the link resource event
Toshio Koide07df7062014-10-30 10:54:25 -070048 */
Ray Milkeye97ede92014-11-20 10:43:12 -080049 LinkResourceEvent releaseResources(LinkResourceAllocations allocations);
Toshio Koide106d4492014-10-28 11:22:02 -070050
Toshio Koide07df7062014-10-30 10:54:25 -070051 /**
52 * Returns resources allocated for an Intent.
53 *
54 * @param intentId the target Intent's ID
Yuta HIGUCHI65934892014-12-04 17:47:44 -080055 * @return allocated resources or null if no resource is allocated
Toshio Koide07df7062014-10-30 10:54:25 -070056 */
Toshio Koide106d4492014-10-28 11:22:02 -070057 LinkResourceAllocations getAllocations(IntentId intentId);
58
Toshio Koide07df7062014-10-30 10:54:25 -070059 /**
60 * Returns resources allocated for a link.
61 *
62 * @param link the target link
63 * @return allocated resources
64 */
Toshio Koide106d4492014-10-28 11:22:02 -070065 Iterable<LinkResourceAllocations> getAllocations(Link link);
66
Toshio Koide07df7062014-10-30 10:54:25 -070067 /**
68 * Returns all allocated resources.
69 *
70 * @return allocated resources
71 */
Toshio Koide106d4492014-10-28 11:22:02 -070072 Iterable<LinkResourceAllocations> getAllocations();
73}