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.
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
index 0d88b93..b76ae83 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
@@ -46,7 +46,7 @@
import org.onosproject.net.intent.constraint.LatencyConstraint;
import org.onosproject.net.intent.constraint.ObstacleConstraint;
import org.onosproject.net.intent.constraint.WaypointConstraint;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.LambdaResource;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -145,7 +145,7 @@
final List<Constraint> constraints =
ImmutableList.of(
- new BandwidthConstraint(Bandwidth.bps(1.0)),
+ new BandwidthConstraint(BandwidthResource.bps(1.0)),
new LambdaConstraint(LambdaResource.valueOf(3)),
new AnnotationConstraint("key", 33.0),
new AsymmetricPathConstraint(),
diff --git a/core/net/src/main/java/org/onosproject/net/tunnel/impl/TunnelManager.java b/core/net/src/main/java/org/onosproject/net/tunnel/impl/TunnelManager.java
index a769add..4443640 100644
--- a/core/net/src/main/java/org/onosproject/net/tunnel/impl/TunnelManager.java
+++ b/core/net/src/main/java/org/onosproject/net/tunnel/impl/TunnelManager.java
@@ -38,7 +38,7 @@
import org.onosproject.net.provider.AbstractProviderRegistry;
import org.onosproject.net.provider.AbstractProviderService;
import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.tunnel.Label;
import org.onosproject.net.tunnel.Tunnel;
import org.onosproject.net.tunnel.TunnelAdminService;
@@ -236,14 +236,14 @@
@Override
public void requestTunnel(ConnectPoint src, ConnectPoint dst,
- Bandwidth bw, Path path) {
+ BandwidthResource bw, Path path) {
// TODO Auto-generated method stub
}
@Override
public void requestTunnel(ConnectPoint src, ConnectPoint dst, Type type,
- Bandwidth bw, Path path) {
+ BandwidthResource bw, Path path) {
// TODO Auto-generated method stub
}
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompilerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompilerTest.java
index a890b6a..20df3f1 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompilerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompilerTest.java
@@ -33,7 +33,7 @@
import org.onosproject.net.intent.constraint.BandwidthConstraint;
import org.onosproject.net.intent.constraint.LambdaConstraint;
import org.onosproject.net.intent.impl.PathNotFoundException;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.LambdaResource;
import org.onosproject.net.resource.LinkResourceService;
@@ -227,7 +227,7 @@
final LinkResourceService resourceService =
IntentTestsMocks.MockResourceService.makeBandwidthResourceService(1000.0);
- final List<Constraint> constraints = Arrays.asList(new BandwidthConstraint(Bandwidth.bps(100.0)));
+ final List<Constraint> constraints = Arrays.asList(new BandwidthConstraint(BandwidthResource.bps(100.0)));
final PointToPointIntent intent = makeIntent("s1", "s3", constraints);
@@ -248,7 +248,7 @@
final LinkResourceService resourceService =
IntentTestsMocks.MockResourceService.makeBandwidthResourceService(10.0);
- final List<Constraint> constraints = Arrays.asList(new BandwidthConstraint(Bandwidth.bps(100.0)));
+ final List<Constraint> constraints = Arrays.asList(new BandwidthConstraint(BandwidthResource.bps(100.0)));
try {
final PointToPointIntent intent = makeIntent("s1", "s3", constraints);
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java
index 660440c..62d9d02 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentLinkResourceStore.java
@@ -23,7 +23,7 @@
import org.onosproject.net.LinkKey;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.link.LinkService;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.BandwidthResourceAllocation;
import org.onosproject.net.resource.LambdaResource;
import org.onosproject.net.resource.LambdaResourceAllocation;
@@ -67,8 +67,8 @@
private final Logger log = getLogger(getClass());
- private static final Bandwidth DEFAULT_BANDWIDTH = Bandwidth.mbps(1_000);
- private static final Bandwidth EMPTY_BW = Bandwidth.bps(0);
+ private static final BandwidthResource DEFAULT_BANDWIDTH = BandwidthResource.mbps(1_000);
+ private static final BandwidthResource EMPTY_BW = BandwidthResource.bps(0);
// Smallest non-reserved MPLS label
private static final int MIN_UNRESERVED_LABEL = 0x10;
@@ -150,11 +150,11 @@
// if Link annotation exist, use them
// if all fails, use DEFAULT_BANDWIDTH
- Bandwidth bandwidth = null;
+ BandwidthResource bandwidth = null;
String strBw = link.annotations().value(BANDWIDTH);
if (strBw != null) {
try {
- bandwidth = Bandwidth.mbps(Double.parseDouble(strBw));
+ bandwidth = BandwidthResource.mbps(Double.parseDouble(strBw));
} catch (NumberFormatException e) {
// do nothings
bandwidth = null;
@@ -237,7 +237,7 @@
}
}
- free.put(type, Sets.newHashSet(new BandwidthResourceAllocation(Bandwidth.bps(freeBw))));
+ free.put(type, Sets.newHashSet(new BandwidthResourceAllocation(BandwidthResource.bps(freeBw))));
break;
case LAMBDA:
Set<? extends ResourceAllocation> lmd = caps.get(type);
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/HazelcastLinkResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/HazelcastLinkResourceStore.java
index 8eca091..1bbdbc1 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/HazelcastLinkResourceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/HazelcastLinkResourceStore.java
@@ -36,7 +36,7 @@
import org.onosproject.net.LinkKey;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.link.LinkService;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.BandwidthResourceAllocation;
import org.onosproject.net.resource.LambdaResource;
import org.onosproject.net.resource.LambdaResourceAllocation;
@@ -80,9 +80,9 @@
private final Logger log = getLogger(getClass());
- private static final Bandwidth DEFAULT_BANDWIDTH = Bandwidth.mbps(1_000);
+ private static final BandwidthResource DEFAULT_BANDWIDTH = BandwidthResource.mbps(1_000);
- private static final Bandwidth EMPTY_BW = Bandwidth.bps(0);
+ private static final BandwidthResource EMPTY_BW = BandwidthResource.bps(0);
// table to store current allocations
/** LinkKey -> List<LinkResourceAllocations>. */
@@ -170,11 +170,11 @@
// if Link annotation exist, use them
// if all fails, use DEFAULT_BANDWIDTH
- Bandwidth bandwidth = null;
+ BandwidthResource bandwidth = null;
String strBw = link.annotations().value(bandwidthAnnotation);
if (strBw != null) {
try {
- bandwidth = Bandwidth.mbps(Double.parseDouble(strBw));
+ bandwidth = BandwidthResource.mbps(Double.parseDouble(strBw));
} catch (NumberFormatException e) {
// do nothings
bandwidth = null;
@@ -262,7 +262,7 @@
}
}
- free.put(type, Sets.newHashSet(new BandwidthResourceAllocation(Bandwidth.bps(freeBw))));
+ free.put(type, Sets.newHashSet(new BandwidthResourceAllocation(BandwidthResource.bps(freeBw))));
break;
}
diff --git a/core/store/dist/src/test/java/org/onosproject/store/resource/impl/HazelcastLinkResourceStoreTest.java b/core/store/dist/src/test/java/org/onosproject/store/resource/impl/HazelcastLinkResourceStoreTest.java
index fb32bc3..6df10a6 100644
--- a/core/store/dist/src/test/java/org/onosproject/store/resource/impl/HazelcastLinkResourceStoreTest.java
+++ b/core/store/dist/src/test/java/org/onosproject/store/resource/impl/HazelcastLinkResourceStoreTest.java
@@ -29,7 +29,7 @@
import org.onosproject.net.Link;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.BandwidthResourceAllocation;
import org.onosproject.net.resource.DefaultLinkResourceAllocations;
import org.onosproject.net.resource.DefaultLinkResourceRequest;
@@ -172,7 +172,7 @@
final BandwidthResourceAllocation alloc = getBandwidthObj(freeRes);
assertNotNull(alloc);
- assertEquals(Bandwidth.mbps(1000.0), alloc.bandwidth());
+ assertEquals(BandwidthResource.mbps(1000.0), alloc.bandwidth());
}
/**
@@ -209,7 +209,7 @@
ImmutableSet.of(link))
.build();
final ResourceAllocation allocation =
- new BandwidthResourceAllocation(Bandwidth.mbps(900.0));
+ new BandwidthResourceAllocation(BandwidthResource.mbps(900.0));
final Set<ResourceAllocation> allocationSet = ImmutableSet.of(allocation);
final LinkResourceAllocations allocations =
@@ -230,7 +230,7 @@
ImmutableSet.of(link))
.build();
final ResourceAllocation allocation =
- new BandwidthResourceAllocation(Bandwidth.mbps(9000.0));
+ new BandwidthResourceAllocation(BandwidthResource.mbps(9000.0));
final Set<ResourceAllocation> allocationSet = ImmutableSet.of(allocation);
final LinkResourceAllocations allocations =
@@ -258,7 +258,7 @@
ImmutableSet.of(link))
.build();
final ResourceAllocation allocation =
- new BandwidthResourceAllocation(Bandwidth.mbps(900.0));
+ new BandwidthResourceAllocation(BandwidthResource.mbps(900.0));
final Set<ResourceAllocation> allocationSet = ImmutableSet.of(allocation);
final LinkResourceAllocations allocations =
diff --git a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
index a7dccc6..ed1a498 100644
--- a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
+++ b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
@@ -28,6 +28,7 @@
import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
+import org.onlab.util.Bandwidth;
import org.onlab.util.Frequency;
import org.onlab.util.KryoNamespace;
import org.onosproject.app.ApplicationState;
@@ -147,7 +148,7 @@
import org.onosproject.net.packet.DefaultPacketRequest;
import org.onosproject.net.packet.PacketPriority;
import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.BandwidthResourceAllocation;
import org.onosproject.net.resource.BandwidthResourceRequest;
import org.onosproject.net.resource.DefaultLinkResourceAllocations;
@@ -223,7 +224,7 @@
.register(new MacAddressSerializer(), MacAddress.class)
.register(VlanId.class)
.register(Frequency.class)
- .register(org.onlab.util.Bandwidth.class)
+ .register(Bandwidth.class)
.build();
/**
@@ -357,7 +358,7 @@
BandwidthResourceRequest.class,
LambdaResourceRequest.class,
LambdaResource.class,
- Bandwidth.class,
+ BandwidthResource.class,
DefaultLinkResourceAllocations.class,
BandwidthResourceAllocation.class,
LambdaResourceAllocation.class,
diff --git a/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java b/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java
index 98ee193..94aa5ee 100644
--- a/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java
+++ b/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java
@@ -24,6 +24,7 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.onlab.util.Bandwidth;
import org.onlab.util.Frequency;
import org.onosproject.cluster.NodeId;
import org.onosproject.cluster.RoleInfo;
@@ -58,7 +59,7 @@
import org.onosproject.net.flow.FlowRuleBatchEntry;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.BandwidthResourceAllocation;
import org.onosproject.net.resource.DefaultLinkResourceAllocations;
import org.onosproject.net.resource.DefaultLinkResourceRequest;
@@ -354,7 +355,7 @@
.build();
Map<Link, Set<ResourceAllocation>> allocations = new HashMap<>();
allocations.put(new DefaultLink(PID, CP1, CP2, Type.DIRECT),
- ImmutableSet.of(new BandwidthResourceAllocation(Bandwidth.bps(10.0)),
+ ImmutableSet.of(new BandwidthResourceAllocation(BandwidthResource.bps(10.0)),
new LambdaResourceAllocation(LambdaResource.valueOf(1))));
testSerializable(new DefaultLinkResourceAllocations(request, allocations));
}
@@ -367,7 +368,7 @@
@Test
public void testBandwidth() {
- testSerializedEquals(org.onlab.util.Bandwidth.mbps(1000.0));
+ testSerializedEquals(Bandwidth.mbps(1000.0));
}
@Test
@@ -377,7 +378,7 @@
@Test
public void testBandwidthConstraint() {
- testSerializable(new BandwidthConstraint(Bandwidth.bps(1000.0)));
+ testSerializable(new BandwidthConstraint(BandwidthResource.bps(1000.0)));
}
@Test
diff --git a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleLinkResourceStore.java b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleLinkResourceStore.java
index a8f8f51..b6ec902 100644
--- a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleLinkResourceStore.java
+++ b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleLinkResourceStore.java
@@ -31,7 +31,7 @@
import org.onosproject.net.Annotations;
import org.onosproject.net.Link;
import org.onosproject.net.intent.IntentId;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.BandwidthResourceAllocation;
import org.onosproject.net.resource.LambdaResource;
import org.onosproject.net.resource.LambdaResourceAllocation;
@@ -55,7 +55,7 @@
@Component(immediate = true)
@Service
public class SimpleLinkResourceStore implements LinkResourceStore {
- private static final Bandwidth DEFAULT_BANDWIDTH = Bandwidth.mbps(1_000);
+ private static final BandwidthResource DEFAULT_BANDWIDTH = BandwidthResource.mbps(1_000);
private final Logger log = getLogger(getClass());
private Map<IntentId, LinkResourceAllocations> linkResourceAllocationsMap;
@@ -96,9 +96,9 @@
log.debug("No optical.wave annotation on link %s", link);
}
- Bandwidth bandwidth = DEFAULT_BANDWIDTH;
+ BandwidthResource bandwidth = DEFAULT_BANDWIDTH;
try {
- bandwidth = Bandwidth.mbps((Double.parseDouble(annotations.value(AnnotationKeys.BANDWIDTH))));
+ bandwidth = BandwidthResource.mbps((Double.parseDouble(annotations.value(AnnotationKeys.BANDWIDTH))));
} catch (NumberFormatException e) {
log.debug("No bandwidth annotation on link %s", link);
}
@@ -123,7 +123,7 @@
return (BandwidthResourceAllocation) res;
}
}
- return new BandwidthResourceAllocation(Bandwidth.bps(0));
+ return new BandwidthResourceAllocation(BandwidthResource.bps(0));
}
/**
@@ -156,7 +156,7 @@
}
freeRes.remove(ba);
freeRes.add(new BandwidthResourceAllocation(
- Bandwidth.bps(newBandwidth)));
+ BandwidthResource.bps(newBandwidth)));
break;
case LAMBDA:
final boolean lambdaAvailable = freeRes.remove(res);
@@ -198,7 +198,7 @@
double newBandwidth = ba.bandwidth().toDouble() + requestedBandwidth;
freeRes.remove(ba);
freeRes.add(new BandwidthResourceAllocation(
- Bandwidth.bps(newBandwidth)));
+ BandwidthResource.bps(newBandwidth)));
break;
case LAMBDA:
checkState(freeRes.add(res));
diff --git a/core/store/trivial/src/test/java/org/onosproject/store/trivial/impl/SimpleLinkResourceStoreTest.java b/core/store/trivial/src/test/java/org/onosproject/store/trivial/impl/SimpleLinkResourceStoreTest.java
index 5abaa6d..2522101 100644
--- a/core/store/trivial/src/test/java/org/onosproject/store/trivial/impl/SimpleLinkResourceStoreTest.java
+++ b/core/store/trivial/src/test/java/org/onosproject/store/trivial/impl/SimpleLinkResourceStoreTest.java
@@ -30,7 +30,7 @@
import org.onosproject.net.Link;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.resource.Bandwidth;
+import org.onosproject.net.resource.BandwidthResource;
import org.onosproject.net.resource.BandwidthResourceAllocation;
import org.onosproject.net.resource.LambdaResource;
import org.onosproject.net.resource.LambdaResourceAllocation;
@@ -159,7 +159,7 @@
final BandwidthResourceAllocation alloc = getBandwidthObj(freeRes);
assertNotNull(alloc);
- assertEquals(Bandwidth.mbps(1000.0), alloc.bandwidth());
+ assertEquals(BandwidthResource.mbps(1000.0), alloc.bandwidth());
}
/**
@@ -184,7 +184,7 @@
@Override
public Set<ResourceAllocation> getResourceAllocation(Link link) {
final ResourceAllocation allocation =
- new BandwidthResourceAllocation(Bandwidth.bps(allocationAmount));
+ new BandwidthResourceAllocation(BandwidthResource.bps(allocationAmount));
final Set<ResourceAllocation> allocations = new HashSet<>();
allocations.add(allocation);
return allocations;