commit | f853b0efb6345f89ea0a77f354a02605d2d7d7ab | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Tue Sep 29 15:15:32 2015 -0700 |
committer | Gerrit Code Review <gerrit@onlab.us> | Fri Oct 02 16:54:21 2015 +0000 |
tree | 9c9f78d6a367c13320d26a80350052e943776389 | |
parent | 1035d6cc37794cf7b10c5181488c33e601ad1a4a [diff] [blame] |
Add a method to get resource allocation of the given resource Change-Id: I06b2f83b5a07a1bcbada9db5263abd2e1a4a4d17
diff --git a/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java b/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java index 2cd1a2e..5226967 100644 --- a/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java +++ b/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java
@@ -91,6 +91,14 @@ } @Override + public Optional<ResourceAllocation> getResourceAllocation(ResourcePath resource) { + checkNotNull(resource); + + Optional<ResourceConsumer> consumer = store.getConsumer(resource); + return consumer.map(x -> new ResourceAllocation(resource, x)); + } + + @Override public <T> Collection<ResourceAllocation> getResourceAllocations(ResourcePath parent, Class<T> cls) { checkNotNull(parent); checkNotNull(cls);