weibit
Committed by Ray Milkey

update and get available link resource consindering existing linkAllocations

Change-Id: Iee93253d253ff38d23630a2c5ac9c0a14329d92f
......@@ -86,7 +86,7 @@ public interface LinkResourceService {
* @param allocations allocations to be included as available
* @return available resources for the target link
*/
ResourceRequest getAvailableResources(Link link,
Iterable<ResourceRequest> getAvailableResources(Link link,
LinkResourceAllocations allocations);
}
......
......@@ -269,7 +269,7 @@ public class IntentTestsMocks {
}
@Override
public ResourceRequest getAvailableResources(Link link, LinkResourceAllocations allocations) {
public Iterable<ResourceRequest> getAvailableResources(Link link, LinkResourceAllocations allocations) {
return null;
}
}
......
......@@ -156,8 +156,8 @@ public class LinkResourceManager implements LinkResourceService {
@Override
public LinkResourceAllocations updateResources(LinkResourceRequest req,
LinkResourceAllocations oldAllocations) {
// TODO
return null;
releaseResources(oldAllocations);
return requestResources(req);
}
@Override
......@@ -196,10 +196,13 @@ public class LinkResourceManager implements LinkResourceService {
}
@Override
public ResourceRequest getAvailableResources(Link link,
public Iterable<ResourceRequest> getAvailableResources(Link link,
LinkResourceAllocations allocations) {
// TODO
return null;
Set<ResourceRequest> result = new HashSet<>();
Set<ResourceAllocation> allocatedRes = allocations.getResourceAllocation(link);
result = (Set<ResourceRequest>) getAvailableResources(link);
result.addAll(allocatedRes);
return result;
}
}
......