Showing
11 changed files
with
135 additions
and
22 deletions
... | @@ -30,6 +30,7 @@ public final class Lambda extends LinkResource { | ... | @@ -30,6 +30,7 @@ public final class Lambda extends LinkResource { |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Returns lambda as an int value. | 32 | * Returns lambda as an int value. |
33 | + * | ||
33 | * @return lambda as an int value | 34 | * @return lambda as an int value |
34 | */ | 35 | */ |
35 | public int toInt() { | 36 | public int toInt() { | ... | ... |
1 | +package org.onlab.onos.net.resource; | ||
2 | + | ||
3 | +/** | ||
4 | + * Representation of allocated lambda resource. | ||
5 | + */ | ||
6 | +public interface LambdaResourceAllocation extends LambdaResourceRequest { | ||
7 | + /** | ||
8 | + * Returns the lambda resource. | ||
9 | + * | ||
10 | + * @return the lambda resource | ||
11 | + */ | ||
12 | + Lambda lambda(); | ||
13 | +} |
1 | +package org.onlab.onos.net.resource; | ||
2 | + | ||
3 | +import org.onlab.onos.net.Link; | ||
4 | + | ||
5 | +/** | ||
6 | + * Representation of allocated link resources. | ||
7 | + */ | ||
8 | +public interface LinkResourceAllocations extends LinkResourceRequest { | ||
9 | + /** | ||
10 | + * Returns allocated resource for the given link. | ||
11 | + * | ||
12 | + * @param link the target link | ||
13 | + * @return allocated resource for the link | ||
14 | + */ | ||
15 | + ResourceAllocation getResourceAllocation(Link link); | ||
16 | +} |
1 | +package org.onlab.onos.net.resource; | ||
2 | + | ||
3 | +import java.util.Collection; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +import org.onlab.onos.net.Link; | ||
7 | +import org.onlab.onos.net.intent.IntentId; | ||
8 | + | ||
9 | +/** | ||
10 | + * Representation of a request for link resource. | ||
11 | + */ | ||
12 | +public interface LinkResourceRequest extends ResourceRequest { | ||
13 | + | ||
14 | + /** | ||
15 | + * Returns the {@link IntentId} associated with the request. | ||
16 | + * | ||
17 | + * @return the {@link IntentId} associated with the request | ||
18 | + */ | ||
19 | + IntentId intendId(); | ||
20 | + | ||
21 | + /** | ||
22 | + * Returns the set of target links. | ||
23 | + * | ||
24 | + * @return the set of target links | ||
25 | + */ | ||
26 | + Collection<Link> links(); | ||
27 | + | ||
28 | + /** | ||
29 | + * Returns the set of resource requests. | ||
30 | + * | ||
31 | + * @return the set of resource requests | ||
32 | + */ | ||
33 | + Set<ResourceRequest> resources(); | ||
34 | +} |
1 | package org.onlab.onos.net.resource; | 1 | package org.onlab.onos.net.resource; |
2 | 2 | ||
3 | -import java.util.Map; | ||
4 | - | ||
5 | import org.onlab.onos.net.Link; | 3 | import org.onlab.onos.net.Link; |
6 | import org.onlab.onos.net.intent.IntentId; | 4 | import org.onlab.onos.net.intent.IntentId; |
7 | -import org.onlab.onos.net.intent.PathIntent; | ||
8 | 5 | ||
9 | /** | 6 | /** |
10 | * Service for providing link resource allocation. | 7 | * Service for providing link resource allocation. |
... | @@ -12,49 +9,48 @@ import org.onlab.onos.net.intent.PathIntent; | ... | @@ -12,49 +9,48 @@ import org.onlab.onos.net.intent.PathIntent; |
12 | public interface LinkResourceService { | 9 | public interface LinkResourceService { |
13 | 10 | ||
14 | /** | 11 | /** |
15 | - * Allocates resources along the path. | 12 | + * Requests resources. |
16 | - * <p> | ||
17 | - * Tries to allocate given resources on the links along the path specified | ||
18 | - * by the given intent. | ||
19 | * | 13 | * |
20 | - * @param res resources to be allocated | 14 | + * @param req resources to be allocated |
21 | - * @param intent an intent to be used for specifying the path | 15 | + * @return allocated resources |
22 | */ | 16 | */ |
23 | - void allocateResource(LinkResources res, PathIntent intent); | 17 | + LinkResourceAllocations requestResources(LinkResourceRequest req); |
24 | 18 | ||
25 | /** | 19 | /** |
26 | - * Releases resources along the path. | 20 | + * Releases resources. |
27 | * | 21 | * |
28 | - * @param intentId an ID for the intent for specifying the path | 22 | + * @param allocations resources to be released |
29 | */ | 23 | */ |
30 | - void releaseResource(IntentId intentId); | 24 | + void releaseResources(LinkResourceAllocations allocations); |
31 | 25 | ||
32 | /** | 26 | /** |
33 | - * Returns all allocated resources to each link. | 27 | + * Returns all allocated resources. |
34 | * | 28 | * |
35 | - * @return allocated resources to each link with {@link IntentId} | 29 | + * @return allocated resources |
36 | */ | 30 | */ |
37 | - Map<Link, Map<IntentId, LinkResources>> allocatedResources(); | 31 | + Iterable<LinkResourceAllocations> getAllocations(); |
38 | 32 | ||
39 | /** | 33 | /** |
40 | * Returns all allocated resources to given link. | 34 | * Returns all allocated resources to given link. |
41 | * | 35 | * |
42 | * @param link a target link | 36 | * @param link a target link |
43 | - * @return allocated resources to the target link with {@link IntentId} | 37 | + * @return allocated resources |
44 | */ | 38 | */ |
45 | - Map<IntentId, LinkResources> allocatedResources(Link link); | 39 | + Iterable<LinkResourceAllocations> getAllocations(Link link); |
46 | 40 | ||
47 | /** | 41 | /** |
48 | - * Returns available resources for each link. | 42 | + * Returns all IDs of intents using the given link. |
49 | * | 43 | * |
50 | - * @return available resources for each link | 44 | + * @param link a target link |
45 | + * @return IDs of intents using the link | ||
51 | */ | 46 | */ |
52 | - Map<Link, LinkResources> availableResources(); | 47 | + Iterable<IntentId> getIntents(Link link); |
53 | 48 | ||
54 | /** | 49 | /** |
55 | * Returns available resources for given link. | 50 | * Returns available resources for given link. |
51 | + * | ||
56 | * @param link a target link | 52 | * @param link a target link |
57 | * @return available resources for the target link | 53 | * @return available resources for the target link |
58 | */ | 54 | */ |
59 | - LinkResources availableResources(Link link); | 55 | + ResourceRequest getAvailableResources(Link link); |
60 | } | 56 | } | ... | ... |
-
Please register or login to post a comment