blob: 79f7a3e0a5f5e876034264da75e2f0d389537453 [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 */
16package org.onlab.onos.net.resource;
17
18import java.util.Set;
19
20import org.onlab.onos.net.Link;
21import org.onlab.onos.net.intent.IntentId;
22
Toshio Koide106d4492014-10-28 11:22:02 -070023/**
24 * Manages link resources.
25 */
26public interface LinkResourceStore {
Toshio Koide07df7062014-10-30 10:54:25 -070027 /**
28 * Returns free resources for given link.
29 *
30 * @param link a target link
31 * @return free resources for given link
32 */
Toshio Koide106d4492014-10-28 11:22:02 -070033 Set<ResourceAllocation> getFreeResources(Link link);
34
Toshio Koide07df7062014-10-30 10:54:25 -070035 /**
36 * Allocates resources.
37 *
38 * @param allocations resources to be allocated
39 */
Toshio Koide106d4492014-10-28 11:22:02 -070040 void allocateResources(LinkResourceAllocations allocations);
41
Toshio Koide07df7062014-10-30 10:54:25 -070042 /**
43 * Releases resources.
44 *
45 * @param allocations resources to be released
Pavlin Radoslavov119fd5c2014-11-25 19:08:19 -080046 * @return the link resource event
Toshio Koide07df7062014-10-30 10:54:25 -070047 */
Ray Milkeye97ede92014-11-20 10:43:12 -080048 LinkResourceEvent releaseResources(LinkResourceAllocations allocations);
Toshio Koide106d4492014-10-28 11:22:02 -070049
Toshio Koide07df7062014-10-30 10:54:25 -070050 /**
51 * Returns resources allocated for an Intent.
52 *
53 * @param intentId the target Intent's ID
54 * @return allocated resources
55 */
Toshio Koide106d4492014-10-28 11:22:02 -070056 LinkResourceAllocations getAllocations(IntentId intentId);
57
Toshio Koide07df7062014-10-30 10:54:25 -070058 /**
59 * Returns resources allocated for a link.
60 *
61 * @param link the target link
62 * @return allocated resources
63 */
Toshio Koide106d4492014-10-28 11:22:02 -070064 Iterable<LinkResourceAllocations> getAllocations(Link link);
65
Toshio Koide07df7062014-10-30 10:54:25 -070066 /**
67 * Returns all allocated resources.
68 *
69 * @return allocated resources
70 */
Toshio Koide106d4492014-10-28 11:22:02 -070071 Iterable<LinkResourceAllocations> getAllocations();
72}