Toshio Koide

Update resource manager API and objects.

package org.onlab.onos.net.resource;
/**
* Representation of allocated bandwidth resource.
*/
public interface BandwidthResourceAllocation extends BandwidthResourceRequest {
}
package org.onlab.onos.net.resource;
/**
* Representation of a request for bandwidth resource.
*/
public interface BandwidthResourceRequest {
/**
* Returns the bandwidth resource.
*
* @return the bandwidth resource
*/
Bandwidth bandwidth();
}
......@@ -30,6 +30,7 @@ public final class Lambda extends LinkResource {
/**
* Returns lambda as an int value.
*
* @return lambda as an int value
*/
public int toInt() {
......
package org.onlab.onos.net.resource;
/**
* Representation of allocated lambda resource.
*/
public interface LambdaResourceAllocation extends LambdaResourceRequest {
/**
* Returns the lambda resource.
*
* @return the lambda resource
*/
Lambda lambda();
}
package org.onlab.onos.net.resource;
/**
* Representation of a request for lambda resource.
*/
public interface LambdaResourceRequest {
}
package org.onlab.onos.net.resource;
import org.onlab.onos.net.Link;
/**
* Representation of allocated link resources.
*/
public interface LinkResourceAllocations extends LinkResourceRequest {
/**
* Returns allocated resource for the given link.
*
* @param link the target link
* @return allocated resource for the link
*/
ResourceAllocation getResourceAllocation(Link link);
}
package org.onlab.onos.net.resource;
import java.util.Collection;
import java.util.Set;
import org.onlab.onos.net.Link;
import org.onlab.onos.net.intent.IntentId;
/**
* Representation of a request for link resource.
*/
public interface LinkResourceRequest extends ResourceRequest {
/**
* Returns the {@link IntentId} associated with the request.
*
* @return the {@link IntentId} associated with the request
*/
IntentId intendId();
/**
* Returns the set of target links.
*
* @return the set of target links
*/
Collection<Link> links();
/**
* Returns the set of resource requests.
*
* @return the set of resource requests
*/
Set<ResourceRequest> resources();
}
package org.onlab.onos.net.resource;
import java.util.Map;
import org.onlab.onos.net.Link;
import org.onlab.onos.net.intent.IntentId;
import org.onlab.onos.net.intent.PathIntent;
/**
* Service for providing link resource allocation.
......@@ -12,49 +9,48 @@ import org.onlab.onos.net.intent.PathIntent;
public interface LinkResourceService {
/**
* Allocates resources along the path.
* <p>
* Tries to allocate given resources on the links along the path specified
* by the given intent.
* Requests resources.
*
* @param res resources to be allocated
* @param intent an intent to be used for specifying the path
* @param req resources to be allocated
* @return allocated resources
*/
void allocateResource(LinkResources res, PathIntent intent);
LinkResourceAllocations requestResources(LinkResourceRequest req);
/**
* Releases resources along the path.
* Releases resources.
*
* @param intentId an ID for the intent for specifying the path
* @param allocations resources to be released
*/
void releaseResource(IntentId intentId);
void releaseResources(LinkResourceAllocations allocations);
/**
* Returns all allocated resources to each link.
* Returns all allocated resources.
*
* @return allocated resources to each link with {@link IntentId}
* @return allocated resources
*/
Map<Link, Map<IntentId, LinkResources>> allocatedResources();
Iterable<LinkResourceAllocations> getAllocations();
/**
* Returns all allocated resources to given link.
*
* @param link a target link
* @return allocated resources to the target link with {@link IntentId}
* @return allocated resources
*/
Map<IntentId, LinkResources> allocatedResources(Link link);
Iterable<LinkResourceAllocations> getAllocations(Link link);
/**
* Returns available resources for each link.
* Returns all IDs of intents using the given link.
*
* @return available resources for each link
* @param link a target link
* @return IDs of intents using the link
*/
Map<Link, LinkResources> availableResources();
Iterable<IntentId> getIntents(Link link);
/**
* Returns available resources for given link.
*
* @param link a target link
* @return available resources for the target link
*/
LinkResources availableResources(Link link);
ResourceRequest getAvailableResources(Link link);
}
......
package org.onlab.onos.net.resource;
/**
* Abstraction of allocated resource.
*/
public interface ResourceAllocation extends ResourceRequest {
}
package org.onlab.onos.net.resource;
/**
* Representation of ID for allocated resource.
*/
public interface ResourceId {
}
package org.onlab.onos.net.resource;
/**
* Abstraction of resource request.
*/
public interface ResourceRequest {
}