2 * Copyright 2014 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onosproject.net.resource.link;
18 import org.onosproject.event.ListenerService;
19 import org.onosproject.net.Link;
20 import org.onosproject.net.intent.IntentId;
21 import org.onosproject.net.resource.ResourceRequest;
24 * Service for providing link resource allocation.
26 public interface LinkResourceService
27 extends ListenerService<LinkResourceEvent, LinkResourceListener> {
32 * @param req resources to be allocated
33 * @return allocated resources
35 LinkResourceAllocations requestResources(LinkResourceRequest req);
40 * @param allocations resources to be released
42 void releaseResources(LinkResourceAllocations allocations);
45 * Updates previously made allocations with a new resource request.
47 * @param req updated resource request
48 * @param oldAllocations old resource allocations
49 * @return new resource allocations
51 LinkResourceAllocations updateResources(LinkResourceRequest req,
52 LinkResourceAllocations oldAllocations);
55 * Returns all allocated resources.
57 * @return allocated resources
59 Iterable<LinkResourceAllocations> getAllocations();
62 * Returns all allocated resources to given link.
64 * @param link a target link
65 * @return allocated resources
67 Iterable<LinkResourceAllocations> getAllocations(Link link);
70 * Returns the resources allocated for an Intent.
72 * @param intentId the target Intent's id
73 * @return allocated resources for Intent
75 LinkResourceAllocations getAllocations(IntentId intentId);
78 * Returns available resources for given link.
80 * @param link a target link
81 * @return available resources for the target link
83 Iterable<ResourceRequest> getAvailableResources(Link link);
86 * Returns available resources for given link.
88 * @param link a target link
89 * @param allocations allocations to be included as available
90 * @return available resources for the target link
92 Iterable<ResourceRequest> getAvailableResources(Link link,
93 LinkResourceAllocations allocations);