Starting point for designing a resource manager API.
diff --git a/core/api/src/main/java/org/onlab/onos/net/resource/Bandwidth.java b/core/api/src/main/java/org/onlab/onos/net/resource/Bandwidth.java
new file mode 100644
index 0000000..3c4eebe
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/resource/Bandwidth.java
@@ -0,0 +1,58 @@
+package org.onlab.onos.net.resource;
+
+import java.util.Objects;
+
+/**
+ * Representation of bandwidth resource.
+ */
+public final class Bandwidth extends LinkResource {
+
+ private final double bandwidth;
+
+ /**
+ * Creates a new instance with given bandwidth.
+ *
+ * @param bandwidth bandwidth value to be assigned
+ */
+ private Bandwidth(double bandwidth) {
+ this.bandwidth = bandwidth;
+ }
+
+ /**
+ * Creates a new instance with given bandwidth.
+ *
+ * @param bandwidth bandwidth value to be assigned
+ * @return {@link Bandwidth} instance with given bandwidth
+ */
+ public static Bandwidth valueOf(double bandwidth) {
+ return new Bandwidth(bandwidth);
+ }
+
+ /**
+ * Returns bandwidth as a double value.
+ *
+ * @return bandwidth as a double value
+ */
+ public double toDouble() {
+ return bandwidth;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Bandwidth) {
+ Bandwidth that = (Bandwidth) obj;
+ return Objects.equals(this.bandwidth, that.bandwidth);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(this.bandwidth);
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(this.bandwidth);
+ }
+}
diff --git a/core/api/src/main/java/org/onlab/onos/net/resource/Lambda.java b/core/api/src/main/java/org/onlab/onos/net/resource/Lambda.java
new file mode 100644
index 0000000..86ea08e
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/resource/Lambda.java
@@ -0,0 +1,58 @@
+package org.onlab.onos.net.resource;
+
+import java.util.Objects;
+
+/**
+ * Representation of lambda resource.
+ */
+public final class Lambda extends LinkResource {
+
+ private final int lambda;
+
+ /**
+ * Creates a new instance with given lambda.
+ *
+ * @param lambda lambda value to be assigned
+ */
+ private Lambda(int lambda) {
+ this.lambda = lambda;
+ }
+
+ /**
+ * Creates a new instance with given lambda.
+ *
+ * @param lambda lambda value to be assigned
+ * @return {@link Lambda} instance with given lambda
+ */
+ public static Lambda valueOf(int lambda) {
+ return new Lambda(lambda);
+ }
+
+ /**
+ * Returns lambda as an int value.
+ * @return lambda as an int value
+ */
+ public int toInt() {
+ return lambda;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Lambda) {
+ Lambda that = (Lambda) obj;
+ return Objects.equals(this.lambda, that.lambda);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(this.lambda);
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(this.lambda);
+ }
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/net/resource/LinkResource.java b/core/api/src/main/java/org/onlab/onos/net/resource/LinkResource.java
new file mode 100644
index 0000000..7605501
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/resource/LinkResource.java
@@ -0,0 +1,8 @@
+package org.onlab.onos.net.resource;
+
+/**
+ * Abstraction of link resource.
+ */
+public abstract class LinkResource {
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/net/resource/LinkResourceService.java b/core/api/src/main/java/org/onlab/onos/net/resource/LinkResourceService.java
new file mode 100644
index 0000000..0d59a46
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/resource/LinkResourceService.java
@@ -0,0 +1,60 @@
+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.
+ */
+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.
+ *
+ * @param res resources to be allocated
+ * @param intent an intent to be used for specifying the path
+ */
+ void allocateResource(LinkResources res, PathIntent intent);
+
+ /**
+ * Releases resources along the path.
+ *
+ * @param intentId an ID for the intent for specifying the path
+ */
+ void releaseResource(IntentId intentId);
+
+ /**
+ * Returns all allocated resources to each link.
+ *
+ * @return allocated resources to each link with {@link IntentId}
+ */
+ Map<Link, Map<IntentId, LinkResources>> allocatedResources();
+
+ /**
+ * Returns all allocated resources to given link.
+ *
+ * @param link a target link
+ * @return allocated resources to the target link with {@link IntentId}
+ */
+ Map<IntentId, LinkResources> allocatedResources(Link link);
+
+ /**
+ * Returns available resources for each link.
+ *
+ * @return available resources for each link
+ */
+ Map<Link, LinkResources> availableResources();
+
+ /**
+ * Returns available resources for given link.
+ * @param link a target link
+ * @return available resources for the target link
+ */
+ LinkResource availableResources(Link link);
+}
diff --git a/core/api/src/main/java/org/onlab/onos/net/resource/LinkResources.java b/core/api/src/main/java/org/onlab/onos/net/resource/LinkResources.java
new file mode 100644
index 0000000..6eadb56
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/resource/LinkResources.java
@@ -0,0 +1,48 @@
+package org.onlab.onos.net.resource;
+
+import java.util.Set;
+
+/**
+ * Abstraction of a resources of a link.
+ */
+public interface LinkResources {
+
+ /**
+ * Returns resources as a set of {@link LinkResource}s.
+ *
+ * @return a set of {@link LinkResource}s
+ */
+ Set<LinkResource> resources();
+
+ /**
+ * Builder of {@link LinkResources}.
+ */
+ public interface Builder {
+
+ /**
+ * Adds bandwidth resource.
+ * <p>
+ * This operation adds given bandwidth to previous bandwidth and
+ * generates single bandwidth resource.
+ *
+ * @param bandwidth bandwidth value to be added
+ * @return self
+ */
+ public Builder addBandwidth(double bandwidth);
+
+ /**
+ * Adds lambda resource.
+ *
+ * @param lambda lambda value to be added
+ * @return self
+ */
+ public Builder addLambda(int lambda);
+
+ /**
+ * Builds an immutable link resources.
+ *
+ * @return link resources
+ */
+ public LinkResources build();
+ }
+}