Rename Bandwidth to BandwidthResource
To distinguish unit of bandwidth and resource of bandwidth
Change-Id: Ice52538f0c00f6d7743ca247d0f9bab3febdc94b
diff --git a/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java b/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java
index 1e8e9d3..be75880 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java
@@ -16,7 +16,7 @@
package org.onosproject.net.intent.constraint;
import org.onosproject.net.Link;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.BandwidthResourceRequest;
import org.onosproject.net.resource.LinkResourceService;
import org.onosproject.net.resource.ResourceRequest;
@@ -32,14 +32,14 @@
*/
public class BandwidthConstraint extends BooleanConstraint {
- private final Bandwidth bandwidth;
+ private final BandwidthResource bandwidth;
/**
* Creates a new bandwidth constraint.
*
* @param bandwidth required bandwidth
*/
- public BandwidthConstraint(Bandwidth bandwidth) {
+ public BandwidthConstraint(BandwidthResource bandwidth) {
this.bandwidth = checkNotNull(bandwidth, "Bandwidth cannot be null");
}
@@ -66,7 +66,7 @@
*
* @return required bandwidth
*/
- public Bandwidth bandwidth() {
+ public BandwidthResource bandwidth() {
return bandwidth;
}
diff --git a/core/api/src/main/java/org/onosproject/net/resource/Bandwidth.java b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResource.java
similarity index 66%
rename from core/api/src/main/java/org/onosproject/net/resource/Bandwidth.java
rename to core/api/src/main/java/org/onosproject/net/resource/BandwidthResource.java
index 15fe820..b74c2eb 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/Bandwidth.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResource.java
@@ -20,7 +20,7 @@
/**
* Representation of bandwidth resource in bps.
*/
-public final class Bandwidth extends LinkResource {
+public final class BandwidthResource extends LinkResource {
private final double bandwidth;
@@ -29,12 +29,12 @@
*
* @param bandwidth bandwidth value to be assigned
*/
- private Bandwidth(double bandwidth) {
+ private BandwidthResource(double bandwidth) {
this.bandwidth = bandwidth;
}
// Constructor for serialization
- private Bandwidth() {
+ private BandwidthResource() {
this.bandwidth = 0;
}
@@ -42,10 +42,10 @@
* Creates a new instance with given bandwidth in bps.
*
* @param bandwidth bandwidth value to be assigned
- * @return {@link Bandwidth} instance with given bandwidth
+ * @return {@link BandwidthResource} instance with given bandwidth
*/
@Deprecated
- public static Bandwidth valueOf(double bandwidth) {
+ public static BandwidthResource valueOf(double bandwidth) {
return bps(bandwidth);
}
@@ -53,40 +53,40 @@
* Creates a new instance with given bandwidth in bps.
*
* @param bandwidth bandwidth value to be assigned
- * @return {@link Bandwidth} instance with given bandwidth
+ * @return {@link BandwidthResource} instance with given bandwidth
*/
- public static Bandwidth bps(double bandwidth) {
- return new Bandwidth(bandwidth);
+ public static BandwidthResource bps(double bandwidth) {
+ return new BandwidthResource(bandwidth);
}
/**
* Creates a new instance with given bandwidth in Kbps.
*
* @param bandwidth bandwidth value to be assigned
- * @return {@link Bandwidth} instance with given bandwidth
+ * @return {@link BandwidthResource} instance with given bandwidth
*/
- public static Bandwidth kbps(double bandwidth) {
- return new Bandwidth(bandwidth * 1_000L);
+ public static BandwidthResource kbps(double bandwidth) {
+ return new BandwidthResource(bandwidth * 1_000L);
}
/**
* Creates a new instance with given bandwidth in Mbps.
*
* @param bandwidth bandwidth value to be assigned
- * @return {@link Bandwidth} instance with given bandwidth
+ * @return {@link BandwidthResource} instance with given bandwidth
*/
- public static Bandwidth mbps(double bandwidth) {
- return new Bandwidth(bandwidth * 1_000_000L);
+ public static BandwidthResource mbps(double bandwidth) {
+ return new BandwidthResource(bandwidth * 1_000_000L);
}
/**
* Creates a new instance with given bandwidth in Gbps.
*
* @param bandwidth bandwidth value to be assigned
- * @return {@link Bandwidth} instance with given bandwidth
+ * @return {@link BandwidthResource} instance with given bandwidth
*/
- public static Bandwidth gbps(double bandwidth) {
- return new Bandwidth(bandwidth * 1_000_000_000L);
+ public static BandwidthResource gbps(double bandwidth) {
+ return new BandwidthResource(bandwidth * 1_000_000_000L);
}
/**
@@ -100,8 +100,8 @@
@Override
public boolean equals(Object obj) {
- if (obj instanceof Bandwidth) {
- Bandwidth that = (Bandwidth) obj;
+ if (obj instanceof BandwidthResource) {
+ BandwidthResource that = (BandwidthResource) obj;
return Objects.equals(this.bandwidth, that.bandwidth);
}
return false;
diff --git a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceAllocation.java b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceAllocation.java
index b2628aa..7260536 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceAllocation.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceAllocation.java
@@ -29,12 +29,12 @@
}
/**
- * Creates a new {@link BandwidthResourceAllocation} with {@link Bandwidth}
+ * Creates a new {@link BandwidthResourceAllocation} with {@link BandwidthResource}
* object.
*
* @param bandwidth allocated bandwidth
*/
- public BandwidthResourceAllocation(Bandwidth bandwidth) {
+ public BandwidthResourceAllocation(BandwidthResource bandwidth) {
super(bandwidth);
}
diff --git a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java
index 4e012fc..bf72d42 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java
@@ -23,15 +23,15 @@
* Representation of a request for bandwidth resource.
*/
public class BandwidthResourceRequest implements ResourceRequest {
- private final Bandwidth bandwidth;
+ private final BandwidthResource bandwidth;
/**
- * Creates a new {@link BandwidthResourceRequest} with {@link Bandwidth}
+ * Creates a new {@link BandwidthResourceRequest} with {@link BandwidthResource}
* object.
*
- * @param bandwidth {@link Bandwidth} object to be requested
+ * @param bandwidth {@link BandwidthResource} object to be requested
*/
- public BandwidthResourceRequest(Bandwidth bandwidth) {
+ public BandwidthResourceRequest(BandwidthResource bandwidth) {
this.bandwidth = bandwidth;
}
@@ -40,7 +40,7 @@
*
* @return the bandwidth resource
*/
- public Bandwidth bandwidth() {
+ public BandwidthResource bandwidth() {
return bandwidth;
}
diff --git a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
index 0c6f4bf..1ec1fc4 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
@@ -137,7 +137,7 @@
*/
@Override
public Builder addBandwidthRequest(double bandwidth) {
- resources.add(new BandwidthResourceRequest(Bandwidth.bps(bandwidth)));
+ resources.add(new BandwidthResourceRequest(BandwidthResource.bps(bandwidth)));
return this;
}
diff --git a/core/api/src/main/java/org/onosproject/net/tunnel/DefaultTunnel.java b/core/api/src/main/java/org/onosproject/net/tunnel/DefaultTunnel.java
index c21a516..c045d21 100644
--- a/core/api/src/main/java/org/onosproject/net/tunnel/DefaultTunnel.java
+++ b/core/api/src/main/java/org/onosproject/net/tunnel/DefaultTunnel.java
@@ -9,7 +9,7 @@
import org.onosproject.net.AbstractModel;
import org.onosproject.net.Annotations;
import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
/**
* Default tunnel model implementation.
@@ -22,7 +22,7 @@
private final State state;
private final boolean isDurable;
private final boolean isBidirectional;
- private final Bandwidth bandwidth;
+ private final BandwidthResource bandwidth;
/**
* Constructs an tunnel using the builder pattern.
@@ -80,7 +80,7 @@
}
@Override
- public Bandwidth bandwidth() {
+ public BandwidthResource bandwidth() {
return bandwidth;
}
@@ -127,7 +127,7 @@
private State state = null;
private boolean isDurable = false;
private boolean isBidirectional = false;
- private Bandwidth bandwidth = null;
+ private BandwidthResource bandwidth = null;
private static IdGenerator idGenerator;
@@ -152,7 +152,7 @@
return this;
}
- public TunnelBuilder bandwidth(Bandwidth bandwidth) {
+ public TunnelBuilder bandwidth(BandwidthResource bandwidth) {
this.bandwidth = bandwidth;
return this;
}
diff --git a/core/api/src/main/java/org/onosproject/net/tunnel/Tunnel.java b/core/api/src/main/java/org/onosproject/net/tunnel/Tunnel.java
index 18ae5be..6a044ac 100644
--- a/core/api/src/main/java/org/onosproject/net/tunnel/Tunnel.java
+++ b/core/api/src/main/java/org/onosproject/net/tunnel/Tunnel.java
@@ -18,7 +18,7 @@
import org.onosproject.net.Annotated;
import org.onosproject.net.NetworkResource;
import org.onosproject.net.Provided;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
/**
@@ -149,7 +149,7 @@
*
* @return tunnel bandwidth
*/
- Bandwidth bandwidth();
+ BandwidthResource bandwidth();
}
diff --git a/core/api/src/main/java/org/onosproject/net/tunnel/TunnelService.java b/core/api/src/main/java/org/onosproject/net/tunnel/TunnelService.java
index df7eaa6..3b060fc 100644
--- a/core/api/src/main/java/org/onosproject/net/tunnel/TunnelService.java
+++ b/core/api/src/main/java/org/onosproject/net/tunnel/TunnelService.java
@@ -19,7 +19,7 @@
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.Path;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
/**
* Service for interacting with the tunnel inventory.
@@ -34,7 +34,7 @@
* @param bw bandwidth
* @param path explicit path or null
*/
- void requestTunnel(ConnectPoint src, ConnectPoint dst, Bandwidth bw, Path path);
+ void requestTunnel(ConnectPoint src, ConnectPoint dst, BandwidthResource bw, Path path);
/**
* Invokes the core to create a tunnel based on specified parameters with a tunnel type.
@@ -45,7 +45,7 @@
* @param bw bandwidth
* @param path explicit path or null
*/
- void requestTunnel(ConnectPoint src, ConnectPoint dst, Tunnel.Type type, Bandwidth bw, Path path);
+ void requestTunnel(ConnectPoint src, ConnectPoint dst, Tunnel.Type type, BandwidthResource bw, Path path);
/**
* Returns the count of all known tunnels in the dataStore.
diff --git a/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java b/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
index 279a8bb..37bea8d 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
@@ -35,7 +35,7 @@
import org.onosproject.net.flow.criteria.Criterion.Type;
import org.onosproject.net.flow.instructions.Instruction;
import org.onosproject.net.flow.instructions.Instructions;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.BandwidthResourceRequest;
import org.onosproject.net.resource.LambdaResource;
import org.onosproject.net.resource.LambdaResourceAllocation;
@@ -302,7 +302,7 @@
final List<ResourceRequest> result = new LinkedList<>();
if (availableBandwidth > 0.0) {
result.add(new BandwidthResourceRequest(
- Bandwidth.bps(availableBandwidth)));
+ BandwidthResource.bps(availableBandwidth)));
}
if (availableLambda > 0) {
result.add(new LambdaResourceRequest());
diff --git a/core/api/src/test/java/org/onosproject/net/intent/constraint/ConstraintObjectsTest.java b/core/api/src/test/java/org/onosproject/net/intent/constraint/ConstraintObjectsTest.java
index 4e549ea..5505e13 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/constraint/ConstraintObjectsTest.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/constraint/ConstraintObjectsTest.java
@@ -17,7 +17,7 @@
import org.junit.Test;
import org.onosproject.net.Link;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.LambdaResource;
import com.google.common.testing.EqualsTester;
@@ -35,11 +35,11 @@
// Bandwidth Constraint
final BandwidthConstraint bandwidthConstraint1 =
- new BandwidthConstraint(Bandwidth.bps(100.0));
+ new BandwidthConstraint(BandwidthResource.bps(100.0));
final BandwidthConstraint bandwidthConstraintSameAs1 =
- new BandwidthConstraint(Bandwidth.bps(100.0));
+ new BandwidthConstraint(BandwidthResource.bps(100.0));
final BandwidthConstraint bandwidthConstraint2 =
- new BandwidthConstraint(Bandwidth.bps(200.0));
+ new BandwidthConstraint(BandwidthResource.bps(200.0));
/**
* Checks that the objects were created properly.