Sho SHIMIZU
Committed by Gerrit Code Review

Rename Bandwidth to BandwidthResource

To distinguish unit of bandwidth and resource of bandwidth

Change-Id: Ice52538f0c00f6d7743ca247d0f9bab3febdc94b
Showing 21 changed files with 93 additions and 91 deletions
......@@ -38,7 +38,7 @@ import org.onosproject.net.intent.Key;
import org.onosproject.net.intent.constraint.BandwidthConstraint;
import org.onosproject.net.intent.constraint.LambdaConstraint;
import org.onosproject.net.intent.constraint.LinkTypeConstraint;
import org.onosproject.net.resource.Bandwidth;
import org.onosproject.net.resource.BandwidthResource;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
......@@ -307,7 +307,7 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
// Check for a bandwidth specification
if (!isNullOrEmpty(bandwidthString)) {
final double bandwidthValue = Double.parseDouble(bandwidthString);
constraints.add(new BandwidthConstraint(Bandwidth.bps(bandwidthValue)));
constraints.add(new BandwidthConstraint(BandwidthResource.bps(bandwidthValue)));
}
// Check for a lambda specification
......
......@@ -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 @@ import static com.google.common.base.Preconditions.checkNotNull;
*/
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 @@ public class BandwidthConstraint extends BooleanConstraint {
*
* @return required bandwidth
*/
public Bandwidth bandwidth() {
public BandwidthResource bandwidth() {
return bandwidth;
}
......
......@@ -20,7 +20,7 @@ import java.util.Objects;
/**
* 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 @@ public final class Bandwidth extends LinkResource {
*
* @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 @@ public final class Bandwidth extends LinkResource {
* 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 @@ public final class Bandwidth extends LinkResource {
* 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 @@ public final class Bandwidth extends LinkResource {
@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;
......
......@@ -29,12 +29,12 @@ public class BandwidthResourceAllocation extends BandwidthResourceRequest
}
/**
* 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);
}
......
......@@ -23,15 +23,15 @@ import com.google.common.base.MoreObjects;
* 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 @@ public class BandwidthResourceRequest implements ResourceRequest {
*
* @return the bandwidth resource
*/
public Bandwidth bandwidth() {
public BandwidthResource bandwidth() {
return bandwidth;
}
......
......@@ -137,7 +137,7 @@ public final class DefaultLinkResourceRequest implements LinkResourceRequest {
*/
@Override
public Builder addBandwidthRequest(double bandwidth) {
resources.add(new BandwidthResourceRequest(Bandwidth.bps(bandwidth)));
resources.add(new BandwidthResourceRequest(BandwidthResource.bps(bandwidth)));
return this;
}
......
......@@ -9,7 +9,7 @@ import org.onosproject.core.IdGenerator;
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 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel {
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 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel {
}
@Override
public Bandwidth bandwidth() {
public BandwidthResource bandwidth() {
return bandwidth;
}
......@@ -127,7 +127,7 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel {
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 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel {
return this;
}
public TunnelBuilder bandwidth(Bandwidth bandwidth) {
public TunnelBuilder bandwidth(BandwidthResource bandwidth) {
this.bandwidth = bandwidth;
return this;
}
......
......@@ -18,7 +18,7 @@ package org.onosproject.net.tunnel;
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 @@ public interface Tunnel extends Annotated, Provided, NetworkResource {
*
* @return tunnel bandwidth
*/
Bandwidth bandwidth();
BandwidthResource bandwidth();
}
......
......@@ -19,7 +19,7 @@ import java.util.Collection;
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 @@ public interface TunnelService {
* @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 @@ public interface TunnelService {
* @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.
......
......@@ -35,7 +35,7 @@ import org.onosproject.net.flow.criteria.Criterion;
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 @@ public class IntentTestsMocks {
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());
......
......@@ -17,7 +17,7 @@ package org.onosproject.net.intent.constraint;
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 @@ public class ConstraintObjectsTest {
// 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.
......
......@@ -46,7 +46,7 @@ import org.onosproject.net.intent.constraint.LambdaConstraint;
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 @@ public class IntentCodecTest extends AbstractIntentTest {
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(),
......
......@@ -38,7 +38,7 @@ import org.onosproject.net.link.LinkListener;
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 @@ public class TunnelManager extends AbstractProviderRegistry<TunnelProvider, Tunn
@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
}
......
......@@ -33,7 +33,7 @@ import org.onosproject.net.intent.PointToPointIntent;
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 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest {
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 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest {
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);
......
......@@ -23,7 +23,7 @@ import org.onosproject.net.Link;
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 @@ public class ConsistentLinkResourceStore extends
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 @@ public class ConsistentLinkResourceStore extends
// 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 @@ public class ConsistentLinkResourceStore extends
}
}
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);
......
......@@ -36,7 +36,7 @@ import org.onosproject.net.Link;
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 @@ public class HazelcastLinkResourceStore
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 @@ public class HazelcastLinkResourceStore
// 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 @@ public class HazelcastLinkResourceStore
}
}
free.put(type, Sets.newHashSet(new BandwidthResourceAllocation(Bandwidth.bps(freeBw))));
free.put(type, Sets.newHashSet(new BandwidthResourceAllocation(BandwidthResource.bps(freeBw))));
break;
}
......
......@@ -29,7 +29,7 @@ import org.onosproject.net.DefaultLink;
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 @@ public class HazelcastLinkResourceStoreTest {
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 @@ public class HazelcastLinkResourceStoreTest {
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 @@ public class HazelcastLinkResourceStoreTest {
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 @@ public class HazelcastLinkResourceStoreTest {
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 =
......
......@@ -28,6 +28,7 @@ import org.onlab.packet.IpAddress;
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.DefaultOutboundPacket;
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 @@ public final class KryoNamespaces {
.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 @@ public final class KryoNamespaces {
BandwidthResourceRequest.class,
LambdaResourceRequest.class,
LambdaResource.class,
Bandwidth.class,
BandwidthResource.class,
DefaultLinkResourceAllocations.class,
BandwidthResourceAllocation.class,
LambdaResourceAllocation.class,
......
......@@ -24,6 +24,7 @@ import org.junit.After;
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.FlowRule;
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 @@ public class KryoSerializerTest {
.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 @@ public class KryoSerializerTest {
@Test
public void testBandwidth() {
testSerializedEquals(org.onlab.util.Bandwidth.mbps(1000.0));
testSerializedEquals(Bandwidth.mbps(1000.0));
}
@Test
......@@ -377,7 +378,7 @@ public class KryoSerializerTest {
@Test
public void testBandwidthConstraint() {
testSerializable(new BandwidthConstraint(Bandwidth.bps(1000.0)));
testSerializable(new BandwidthConstraint(BandwidthResource.bps(1000.0)));
}
@Test
......
......@@ -31,7 +31,7 @@ import org.onosproject.net.AnnotationKeys;
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 @@ import static org.slf4j.LoggerFactory.getLogger;
@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 @@ public class SimpleLinkResourceStore implements LinkResourceStore {
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 @@ public class SimpleLinkResourceStore implements LinkResourceStore {
return (BandwidthResourceAllocation) res;
}
}
return new BandwidthResourceAllocation(Bandwidth.bps(0));
return new BandwidthResourceAllocation(BandwidthResource.bps(0));
}
/**
......@@ -156,7 +156,7 @@ public class SimpleLinkResourceStore implements LinkResourceStore {
}
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 @@ public class SimpleLinkResourceStore implements LinkResourceStore {
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));
......
......@@ -30,7 +30,7 @@ import org.onosproject.net.DefaultLink;
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 @@ public class SimpleLinkResourceStoreTest {
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 @@ public class SimpleLinkResourceStoreTest {
@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;
......