Add ResourceType field for ResourceAllocation, and change visibility of some of methods
diff --git a/core/api/src/main/java/org/onlab/onos/net/resource/BandwidthResourceAllocation.java b/core/api/src/main/java/org/onlab/onos/net/resource/BandwidthResourceAllocation.java
index 86f8b4e..37b56fe 100644
--- a/core/api/src/main/java/org/onlab/onos/net/resource/BandwidthResourceAllocation.java
+++ b/core/api/src/main/java/org/onlab/onos/net/resource/BandwidthResourceAllocation.java
@@ -14,4 +14,9 @@
public BandwidthResourceAllocation(Bandwidth bandwidth) {
super(bandwidth);
}
+
+ @Override
+ public ResourceType type() {
+ return ResourceType.BANDWIDTH;
+ }
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/resource/BandwidthResourceRequest.java b/core/api/src/main/java/org/onlab/onos/net/resource/BandwidthResourceRequest.java
index 7251ea1..601a27c 100644
--- a/core/api/src/main/java/org/onlab/onos/net/resource/BandwidthResourceRequest.java
+++ b/core/api/src/main/java/org/onlab/onos/net/resource/BandwidthResourceRequest.java
@@ -30,7 +30,7 @@
*
* @return the bandwidth resource
*/
- Bandwidth bandwidth() {
+ public Bandwidth bandwidth() {
return bandwidth;
}
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/resource/LambdaResourceAllocation.java b/core/api/src/main/java/org/onlab/onos/net/resource/LambdaResourceAllocation.java
index 62ce1bd..9095633 100644
--- a/core/api/src/main/java/org/onlab/onos/net/resource/LambdaResourceAllocation.java
+++ b/core/api/src/main/java/org/onlab/onos/net/resource/LambdaResourceAllocation.java
@@ -7,6 +7,11 @@
implements ResourceAllocation {
private final Lambda lambda;
+ @Override
+ public ResourceType type() {
+ return ResourceType.LAMBDA;
+ }
+
/**
* Creates a new {@link LambdaResourceAllocation} with {@link Lambda}
* object.
@@ -22,7 +27,7 @@
*
* @return the lambda resource
*/
- Lambda lambda() {
+ public Lambda lambda() {
return lambda;
}
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/resource/ResourceAllocation.java b/core/api/src/main/java/org/onlab/onos/net/resource/ResourceAllocation.java
index 5cc1414..93e6ea5 100644
--- a/core/api/src/main/java/org/onlab/onos/net/resource/ResourceAllocation.java
+++ b/core/api/src/main/java/org/onlab/onos/net/resource/ResourceAllocation.java
@@ -4,5 +4,5 @@
* Abstraction of allocated resource.
*/
public interface ResourceAllocation extends ResourceRequest {
-
+ ResourceType type();
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/resource/ResourceType.java b/core/api/src/main/java/org/onlab/onos/net/resource/ResourceType.java
new file mode 100644
index 0000000..06a8174
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/resource/ResourceType.java
@@ -0,0 +1,6 @@
+package org.onlab.onos.net.resource;
+
+public enum ResourceType {
+ LAMBDA,
+ BANDWIDTH,
+}