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; | ... | @@ -38,7 +38,7 @@ import org.onosproject.net.intent.Key; |
| 38 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 38 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
| 39 | import org.onosproject.net.intent.constraint.LambdaConstraint; | 39 | import org.onosproject.net.intent.constraint.LambdaConstraint; |
| 40 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; | 40 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; |
| 41 | -import org.onosproject.net.resource.Bandwidth; | 41 | +import org.onosproject.net.resource.BandwidthResource; |
| 42 | import org.onlab.packet.IpPrefix; | 42 | import org.onlab.packet.IpPrefix; |
| 43 | import org.onlab.packet.MacAddress; | 43 | import org.onlab.packet.MacAddress; |
| 44 | 44 | ||
| ... | @@ -307,7 +307,7 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { | ... | @@ -307,7 +307,7 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { |
| 307 | // Check for a bandwidth specification | 307 | // Check for a bandwidth specification |
| 308 | if (!isNullOrEmpty(bandwidthString)) { | 308 | if (!isNullOrEmpty(bandwidthString)) { |
| 309 | final double bandwidthValue = Double.parseDouble(bandwidthString); | 309 | final double bandwidthValue = Double.parseDouble(bandwidthString); |
| 310 | - constraints.add(new BandwidthConstraint(Bandwidth.bps(bandwidthValue))); | 310 | + constraints.add(new BandwidthConstraint(BandwidthResource.bps(bandwidthValue))); |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | // Check for a lambda specification | 313 | // Check for a lambda specification | ... | ... |
| ... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
| 16 | package org.onosproject.net.intent.constraint; | 16 | package org.onosproject.net.intent.constraint; |
| 17 | 17 | ||
| 18 | import org.onosproject.net.Link; | 18 | import org.onosproject.net.Link; |
| 19 | -import org.onosproject.net.resource.Bandwidth; | 19 | +import org.onosproject.net.resource.BandwidthResource; |
| 20 | import org.onosproject.net.resource.BandwidthResourceRequest; | 20 | import org.onosproject.net.resource.BandwidthResourceRequest; |
| 21 | import org.onosproject.net.resource.LinkResourceService; | 21 | import org.onosproject.net.resource.LinkResourceService; |
| 22 | import org.onosproject.net.resource.ResourceRequest; | 22 | import org.onosproject.net.resource.ResourceRequest; |
| ... | @@ -32,14 +32,14 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -32,14 +32,14 @@ import static com.google.common.base.Preconditions.checkNotNull; |
| 32 | */ | 32 | */ |
| 33 | public class BandwidthConstraint extends BooleanConstraint { | 33 | public class BandwidthConstraint extends BooleanConstraint { |
| 34 | 34 | ||
| 35 | - private final Bandwidth bandwidth; | 35 | + private final BandwidthResource bandwidth; |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | * Creates a new bandwidth constraint. | 38 | * Creates a new bandwidth constraint. |
| 39 | * | 39 | * |
| 40 | * @param bandwidth required bandwidth | 40 | * @param bandwidth required bandwidth |
| 41 | */ | 41 | */ |
| 42 | - public BandwidthConstraint(Bandwidth bandwidth) { | 42 | + public BandwidthConstraint(BandwidthResource bandwidth) { |
| 43 | this.bandwidth = checkNotNull(bandwidth, "Bandwidth cannot be null"); | 43 | this.bandwidth = checkNotNull(bandwidth, "Bandwidth cannot be null"); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| ... | @@ -66,7 +66,7 @@ public class BandwidthConstraint extends BooleanConstraint { | ... | @@ -66,7 +66,7 @@ public class BandwidthConstraint extends BooleanConstraint { |
| 66 | * | 66 | * |
| 67 | * @return required bandwidth | 67 | * @return required bandwidth |
| 68 | */ | 68 | */ |
| 69 | - public Bandwidth bandwidth() { | 69 | + public BandwidthResource bandwidth() { |
| 70 | return bandwidth; | 70 | return bandwidth; |
| 71 | } | 71 | } |
| 72 | 72 | ... | ... |
| ... | @@ -20,7 +20,7 @@ import java.util.Objects; | ... | @@ -20,7 +20,7 @@ import java.util.Objects; |
| 20 | /** | 20 | /** |
| 21 | * Representation of bandwidth resource in bps. | 21 | * Representation of bandwidth resource in bps. |
| 22 | */ | 22 | */ |
| 23 | -public final class Bandwidth extends LinkResource { | 23 | +public final class BandwidthResource extends LinkResource { |
| 24 | 24 | ||
| 25 | private final double bandwidth; | 25 | private final double bandwidth; |
| 26 | 26 | ||
| ... | @@ -29,12 +29,12 @@ public final class Bandwidth extends LinkResource { | ... | @@ -29,12 +29,12 @@ public final class Bandwidth extends LinkResource { |
| 29 | * | 29 | * |
| 30 | * @param bandwidth bandwidth value to be assigned | 30 | * @param bandwidth bandwidth value to be assigned |
| 31 | */ | 31 | */ |
| 32 | - private Bandwidth(double bandwidth) { | 32 | + private BandwidthResource(double bandwidth) { |
| 33 | this.bandwidth = bandwidth; | 33 | this.bandwidth = bandwidth; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | // Constructor for serialization | 36 | // Constructor for serialization |
| 37 | - private Bandwidth() { | 37 | + private BandwidthResource() { |
| 38 | this.bandwidth = 0; | 38 | this.bandwidth = 0; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| ... | @@ -42,10 +42,10 @@ public final class Bandwidth extends LinkResource { | ... | @@ -42,10 +42,10 @@ public final class Bandwidth extends LinkResource { |
| 42 | * Creates a new instance with given bandwidth in bps. | 42 | * Creates a new instance with given bandwidth in bps. |
| 43 | * | 43 | * |
| 44 | * @param bandwidth bandwidth value to be assigned | 44 | * @param bandwidth bandwidth value to be assigned |
| 45 | - * @return {@link Bandwidth} instance with given bandwidth | 45 | + * @return {@link BandwidthResource} instance with given bandwidth |
| 46 | */ | 46 | */ |
| 47 | @Deprecated | 47 | @Deprecated |
| 48 | - public static Bandwidth valueOf(double bandwidth) { | 48 | + public static BandwidthResource valueOf(double bandwidth) { |
| 49 | return bps(bandwidth); | 49 | return bps(bandwidth); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| ... | @@ -53,40 +53,40 @@ public final class Bandwidth extends LinkResource { | ... | @@ -53,40 +53,40 @@ public final class Bandwidth extends LinkResource { |
| 53 | * Creates a new instance with given bandwidth in bps. | 53 | * Creates a new instance with given bandwidth in bps. |
| 54 | * | 54 | * |
| 55 | * @param bandwidth bandwidth value to be assigned | 55 | * @param bandwidth bandwidth value to be assigned |
| 56 | - * @return {@link Bandwidth} instance with given bandwidth | 56 | + * @return {@link BandwidthResource} instance with given bandwidth |
| 57 | */ | 57 | */ |
| 58 | - public static Bandwidth bps(double bandwidth) { | 58 | + public static BandwidthResource bps(double bandwidth) { |
| 59 | - return new Bandwidth(bandwidth); | 59 | + return new BandwidthResource(bandwidth); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | /** | 62 | /** |
| 63 | * Creates a new instance with given bandwidth in Kbps. | 63 | * Creates a new instance with given bandwidth in Kbps. |
| 64 | * | 64 | * |
| 65 | * @param bandwidth bandwidth value to be assigned | 65 | * @param bandwidth bandwidth value to be assigned |
| 66 | - * @return {@link Bandwidth} instance with given bandwidth | 66 | + * @return {@link BandwidthResource} instance with given bandwidth |
| 67 | */ | 67 | */ |
| 68 | - public static Bandwidth kbps(double bandwidth) { | 68 | + public static BandwidthResource kbps(double bandwidth) { |
| 69 | - return new Bandwidth(bandwidth * 1_000L); | 69 | + return new BandwidthResource(bandwidth * 1_000L); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | /** | 72 | /** |
| 73 | * Creates a new instance with given bandwidth in Mbps. | 73 | * Creates a new instance with given bandwidth in Mbps. |
| 74 | * | 74 | * |
| 75 | * @param bandwidth bandwidth value to be assigned | 75 | * @param bandwidth bandwidth value to be assigned |
| 76 | - * @return {@link Bandwidth} instance with given bandwidth | 76 | + * @return {@link BandwidthResource} instance with given bandwidth |
| 77 | */ | 77 | */ |
| 78 | - public static Bandwidth mbps(double bandwidth) { | 78 | + public static BandwidthResource mbps(double bandwidth) { |
| 79 | - return new Bandwidth(bandwidth * 1_000_000L); | 79 | + return new BandwidthResource(bandwidth * 1_000_000L); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | /** | 82 | /** |
| 83 | * Creates a new instance with given bandwidth in Gbps. | 83 | * Creates a new instance with given bandwidth in Gbps. |
| 84 | * | 84 | * |
| 85 | * @param bandwidth bandwidth value to be assigned | 85 | * @param bandwidth bandwidth value to be assigned |
| 86 | - * @return {@link Bandwidth} instance with given bandwidth | 86 | + * @return {@link BandwidthResource} instance with given bandwidth |
| 87 | */ | 87 | */ |
| 88 | - public static Bandwidth gbps(double bandwidth) { | 88 | + public static BandwidthResource gbps(double bandwidth) { |
| 89 | - return new Bandwidth(bandwidth * 1_000_000_000L); | 89 | + return new BandwidthResource(bandwidth * 1_000_000_000L); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | /** | 92 | /** |
| ... | @@ -100,8 +100,8 @@ public final class Bandwidth extends LinkResource { | ... | @@ -100,8 +100,8 @@ public final class Bandwidth extends LinkResource { |
| 100 | 100 | ||
| 101 | @Override | 101 | @Override |
| 102 | public boolean equals(Object obj) { | 102 | public boolean equals(Object obj) { |
| 103 | - if (obj instanceof Bandwidth) { | 103 | + if (obj instanceof BandwidthResource) { |
| 104 | - Bandwidth that = (Bandwidth) obj; | 104 | + BandwidthResource that = (BandwidthResource) obj; |
| 105 | return Objects.equals(this.bandwidth, that.bandwidth); | 105 | return Objects.equals(this.bandwidth, that.bandwidth); |
| 106 | } | 106 | } |
| 107 | return false; | 107 | return false; | ... | ... |
| ... | @@ -29,12 +29,12 @@ public class BandwidthResourceAllocation extends BandwidthResourceRequest | ... | @@ -29,12 +29,12 @@ public class BandwidthResourceAllocation extends BandwidthResourceRequest |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | - * Creates a new {@link BandwidthResourceAllocation} with {@link Bandwidth} | 32 | + * Creates a new {@link BandwidthResourceAllocation} with {@link BandwidthResource} |
| 33 | * object. | 33 | * object. |
| 34 | * | 34 | * |
| 35 | * @param bandwidth allocated bandwidth | 35 | * @param bandwidth allocated bandwidth |
| 36 | */ | 36 | */ |
| 37 | - public BandwidthResourceAllocation(Bandwidth bandwidth) { | 37 | + public BandwidthResourceAllocation(BandwidthResource bandwidth) { |
| 38 | super(bandwidth); | 38 | super(bandwidth); |
| 39 | } | 39 | } |
| 40 | 40 | ... | ... |
| ... | @@ -23,15 +23,15 @@ import com.google.common.base.MoreObjects; | ... | @@ -23,15 +23,15 @@ import com.google.common.base.MoreObjects; |
| 23 | * Representation of a request for bandwidth resource. | 23 | * Representation of a request for bandwidth resource. |
| 24 | */ | 24 | */ |
| 25 | public class BandwidthResourceRequest implements ResourceRequest { | 25 | public class BandwidthResourceRequest implements ResourceRequest { |
| 26 | - private final Bandwidth bandwidth; | 26 | + private final BandwidthResource bandwidth; |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | - * Creates a new {@link BandwidthResourceRequest} with {@link Bandwidth} | 29 | + * Creates a new {@link BandwidthResourceRequest} with {@link BandwidthResource} |
| 30 | * object. | 30 | * object. |
| 31 | * | 31 | * |
| 32 | - * @param bandwidth {@link Bandwidth} object to be requested | 32 | + * @param bandwidth {@link BandwidthResource} object to be requested |
| 33 | */ | 33 | */ |
| 34 | - public BandwidthResourceRequest(Bandwidth bandwidth) { | 34 | + public BandwidthResourceRequest(BandwidthResource bandwidth) { |
| 35 | this.bandwidth = bandwidth; | 35 | this.bandwidth = bandwidth; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| ... | @@ -40,7 +40,7 @@ public class BandwidthResourceRequest implements ResourceRequest { | ... | @@ -40,7 +40,7 @@ public class BandwidthResourceRequest implements ResourceRequest { |
| 40 | * | 40 | * |
| 41 | * @return the bandwidth resource | 41 | * @return the bandwidth resource |
| 42 | */ | 42 | */ |
| 43 | - public Bandwidth bandwidth() { | 43 | + public BandwidthResource bandwidth() { |
| 44 | return bandwidth; | 44 | return bandwidth; |
| 45 | } | 45 | } |
| 46 | 46 | ... | ... |
| ... | @@ -137,7 +137,7 @@ public final class DefaultLinkResourceRequest implements LinkResourceRequest { | ... | @@ -137,7 +137,7 @@ public final class DefaultLinkResourceRequest implements LinkResourceRequest { |
| 137 | */ | 137 | */ |
| 138 | @Override | 138 | @Override |
| 139 | public Builder addBandwidthRequest(double bandwidth) { | 139 | public Builder addBandwidthRequest(double bandwidth) { |
| 140 | - resources.add(new BandwidthResourceRequest(Bandwidth.bps(bandwidth))); | 140 | + resources.add(new BandwidthResourceRequest(BandwidthResource.bps(bandwidth))); |
| 141 | return this; | 141 | return this; |
| 142 | } | 142 | } |
| 143 | 143 | ... | ... |
| ... | @@ -9,7 +9,7 @@ import org.onosproject.core.IdGenerator; | ... | @@ -9,7 +9,7 @@ import org.onosproject.core.IdGenerator; |
| 9 | import org.onosproject.net.AbstractModel; | 9 | import org.onosproject.net.AbstractModel; |
| 10 | import org.onosproject.net.Annotations; | 10 | import org.onosproject.net.Annotations; |
| 11 | import org.onosproject.net.provider.ProviderId; | 11 | import org.onosproject.net.provider.ProviderId; |
| 12 | -import org.onosproject.net.resource.Bandwidth; | 12 | +import org.onosproject.net.resource.BandwidthResource; |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | * Default tunnel model implementation. | 15 | * Default tunnel model implementation. |
| ... | @@ -22,7 +22,7 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel { | ... | @@ -22,7 +22,7 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel { |
| 22 | private final State state; | 22 | private final State state; |
| 23 | private final boolean isDurable; | 23 | private final boolean isDurable; |
| 24 | private final boolean isBidirectional; | 24 | private final boolean isBidirectional; |
| 25 | - private final Bandwidth bandwidth; | 25 | + private final BandwidthResource bandwidth; |
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | * Constructs an tunnel using the builder pattern. | 28 | * Constructs an tunnel using the builder pattern. |
| ... | @@ -80,7 +80,7 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel { | ... | @@ -80,7 +80,7 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel { |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | @Override | 82 | @Override |
| 83 | - public Bandwidth bandwidth() { | 83 | + public BandwidthResource bandwidth() { |
| 84 | return bandwidth; | 84 | return bandwidth; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| ... | @@ -127,7 +127,7 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel { | ... | @@ -127,7 +127,7 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel { |
| 127 | private State state = null; | 127 | private State state = null; |
| 128 | private boolean isDurable = false; | 128 | private boolean isDurable = false; |
| 129 | private boolean isBidirectional = false; | 129 | private boolean isBidirectional = false; |
| 130 | - private Bandwidth bandwidth = null; | 130 | + private BandwidthResource bandwidth = null; |
| 131 | 131 | ||
| 132 | private static IdGenerator idGenerator; | 132 | private static IdGenerator idGenerator; |
| 133 | 133 | ||
| ... | @@ -152,7 +152,7 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel { | ... | @@ -152,7 +152,7 @@ public final class DefaultTunnel extends AbstractModel implements Tunnel { |
| 152 | return this; | 152 | return this; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | - public TunnelBuilder bandwidth(Bandwidth bandwidth) { | 155 | + public TunnelBuilder bandwidth(BandwidthResource bandwidth) { |
| 156 | this.bandwidth = bandwidth; | 156 | this.bandwidth = bandwidth; |
| 157 | return this; | 157 | return this; |
| 158 | } | 158 | } | ... | ... |
| ... | @@ -18,7 +18,7 @@ package org.onosproject.net.tunnel; | ... | @@ -18,7 +18,7 @@ package org.onosproject.net.tunnel; |
| 18 | import org.onosproject.net.Annotated; | 18 | import org.onosproject.net.Annotated; |
| 19 | import org.onosproject.net.NetworkResource; | 19 | import org.onosproject.net.NetworkResource; |
| 20 | import org.onosproject.net.Provided; | 20 | import org.onosproject.net.Provided; |
| 21 | -import org.onosproject.net.resource.Bandwidth; | 21 | +import org.onosproject.net.resource.BandwidthResource; |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| ... | @@ -149,7 +149,7 @@ public interface Tunnel extends Annotated, Provided, NetworkResource { | ... | @@ -149,7 +149,7 @@ public interface Tunnel extends Annotated, Provided, NetworkResource { |
| 149 | * | 149 | * |
| 150 | * @return tunnel bandwidth | 150 | * @return tunnel bandwidth |
| 151 | */ | 151 | */ |
| 152 | - Bandwidth bandwidth(); | 152 | + BandwidthResource bandwidth(); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | 155 | ... | ... |
| ... | @@ -19,7 +19,7 @@ import java.util.Collection; | ... | @@ -19,7 +19,7 @@ import java.util.Collection; |
| 19 | 19 | ||
| 20 | import org.onosproject.net.ConnectPoint; | 20 | import org.onosproject.net.ConnectPoint; |
| 21 | import org.onosproject.net.Path; | 21 | import org.onosproject.net.Path; |
| 22 | -import org.onosproject.net.resource.Bandwidth; | 22 | +import org.onosproject.net.resource.BandwidthResource; |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * Service for interacting with the tunnel inventory. | 25 | * Service for interacting with the tunnel inventory. |
| ... | @@ -34,7 +34,7 @@ public interface TunnelService { | ... | @@ -34,7 +34,7 @@ public interface TunnelService { |
| 34 | * @param bw bandwidth | 34 | * @param bw bandwidth |
| 35 | * @param path explicit path or null | 35 | * @param path explicit path or null |
| 36 | */ | 36 | */ |
| 37 | - void requestTunnel(ConnectPoint src, ConnectPoint dst, Bandwidth bw, Path path); | 37 | + void requestTunnel(ConnectPoint src, ConnectPoint dst, BandwidthResource bw, Path path); |
| 38 | 38 | ||
| 39 | /** | 39 | /** |
| 40 | * Invokes the core to create a tunnel based on specified parameters with a tunnel type. | 40 | * Invokes the core to create a tunnel based on specified parameters with a tunnel type. |
| ... | @@ -45,7 +45,7 @@ public interface TunnelService { | ... | @@ -45,7 +45,7 @@ public interface TunnelService { |
| 45 | * @param bw bandwidth | 45 | * @param bw bandwidth |
| 46 | * @param path explicit path or null | 46 | * @param path explicit path or null |
| 47 | */ | 47 | */ |
| 48 | - void requestTunnel(ConnectPoint src, ConnectPoint dst, Tunnel.Type type, Bandwidth bw, Path path); | 48 | + void requestTunnel(ConnectPoint src, ConnectPoint dst, Tunnel.Type type, BandwidthResource bw, Path path); |
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | * Returns the count of all known tunnels in the dataStore. | 51 | * Returns the count of all known tunnels in the dataStore. | ... | ... |
| ... | @@ -35,7 +35,7 @@ import org.onosproject.net.flow.criteria.Criterion; | ... | @@ -35,7 +35,7 @@ import org.onosproject.net.flow.criteria.Criterion; |
| 35 | import org.onosproject.net.flow.criteria.Criterion.Type; | 35 | import org.onosproject.net.flow.criteria.Criterion.Type; |
| 36 | import org.onosproject.net.flow.instructions.Instruction; | 36 | import org.onosproject.net.flow.instructions.Instruction; |
| 37 | import org.onosproject.net.flow.instructions.Instructions; | 37 | import org.onosproject.net.flow.instructions.Instructions; |
| 38 | -import org.onosproject.net.resource.Bandwidth; | 38 | +import org.onosproject.net.resource.BandwidthResource; |
| 39 | import org.onosproject.net.resource.BandwidthResourceRequest; | 39 | import org.onosproject.net.resource.BandwidthResourceRequest; |
| 40 | import org.onosproject.net.resource.LambdaResource; | 40 | import org.onosproject.net.resource.LambdaResource; |
| 41 | import org.onosproject.net.resource.LambdaResourceAllocation; | 41 | import org.onosproject.net.resource.LambdaResourceAllocation; |
| ... | @@ -302,7 +302,7 @@ public class IntentTestsMocks { | ... | @@ -302,7 +302,7 @@ public class IntentTestsMocks { |
| 302 | final List<ResourceRequest> result = new LinkedList<>(); | 302 | final List<ResourceRequest> result = new LinkedList<>(); |
| 303 | if (availableBandwidth > 0.0) { | 303 | if (availableBandwidth > 0.0) { |
| 304 | result.add(new BandwidthResourceRequest( | 304 | result.add(new BandwidthResourceRequest( |
| 305 | - Bandwidth.bps(availableBandwidth))); | 305 | + BandwidthResource.bps(availableBandwidth))); |
| 306 | } | 306 | } |
| 307 | if (availableLambda > 0) { | 307 | if (availableLambda > 0) { |
| 308 | result.add(new LambdaResourceRequest()); | 308 | result.add(new LambdaResourceRequest()); | ... | ... |
| ... | @@ -17,7 +17,7 @@ package org.onosproject.net.intent.constraint; | ... | @@ -17,7 +17,7 @@ package org.onosproject.net.intent.constraint; |
| 17 | 17 | ||
| 18 | import org.junit.Test; | 18 | import org.junit.Test; |
| 19 | import org.onosproject.net.Link; | 19 | import org.onosproject.net.Link; |
| 20 | -import org.onosproject.net.resource.Bandwidth; | 20 | +import org.onosproject.net.resource.BandwidthResource; |
| 21 | import org.onosproject.net.resource.LambdaResource; | 21 | import org.onosproject.net.resource.LambdaResource; |
| 22 | 22 | ||
| 23 | import com.google.common.testing.EqualsTester; | 23 | import com.google.common.testing.EqualsTester; |
| ... | @@ -35,11 +35,11 @@ public class ConstraintObjectsTest { | ... | @@ -35,11 +35,11 @@ public class ConstraintObjectsTest { |
| 35 | // Bandwidth Constraint | 35 | // Bandwidth Constraint |
| 36 | 36 | ||
| 37 | final BandwidthConstraint bandwidthConstraint1 = | 37 | final BandwidthConstraint bandwidthConstraint1 = |
| 38 | - new BandwidthConstraint(Bandwidth.bps(100.0)); | 38 | + new BandwidthConstraint(BandwidthResource.bps(100.0)); |
| 39 | final BandwidthConstraint bandwidthConstraintSameAs1 = | 39 | final BandwidthConstraint bandwidthConstraintSameAs1 = |
| 40 | - new BandwidthConstraint(Bandwidth.bps(100.0)); | 40 | + new BandwidthConstraint(BandwidthResource.bps(100.0)); |
| 41 | final BandwidthConstraint bandwidthConstraint2 = | 41 | final BandwidthConstraint bandwidthConstraint2 = |
| 42 | - new BandwidthConstraint(Bandwidth.bps(200.0)); | 42 | + new BandwidthConstraint(BandwidthResource.bps(200.0)); |
| 43 | 43 | ||
| 44 | /** | 44 | /** |
| 45 | * Checks that the objects were created properly. | 45 | * Checks that the objects were created properly. | ... | ... |
| ... | @@ -46,7 +46,7 @@ import org.onosproject.net.intent.constraint.LambdaConstraint; | ... | @@ -46,7 +46,7 @@ import org.onosproject.net.intent.constraint.LambdaConstraint; |
| 46 | import org.onosproject.net.intent.constraint.LatencyConstraint; | 46 | import org.onosproject.net.intent.constraint.LatencyConstraint; |
| 47 | import org.onosproject.net.intent.constraint.ObstacleConstraint; | 47 | import org.onosproject.net.intent.constraint.ObstacleConstraint; |
| 48 | import org.onosproject.net.intent.constraint.WaypointConstraint; | 48 | import org.onosproject.net.intent.constraint.WaypointConstraint; |
| 49 | -import org.onosproject.net.resource.Bandwidth; | 49 | +import org.onosproject.net.resource.BandwidthResource; |
| 50 | import org.onosproject.net.resource.LambdaResource; | 50 | import org.onosproject.net.resource.LambdaResource; |
| 51 | 51 | ||
| 52 | import com.fasterxml.jackson.databind.node.ObjectNode; | 52 | import com.fasterxml.jackson.databind.node.ObjectNode; |
| ... | @@ -145,7 +145,7 @@ public class IntentCodecTest extends AbstractIntentTest { | ... | @@ -145,7 +145,7 @@ public class IntentCodecTest extends AbstractIntentTest { |
| 145 | 145 | ||
| 146 | final List<Constraint> constraints = | 146 | final List<Constraint> constraints = |
| 147 | ImmutableList.of( | 147 | ImmutableList.of( |
| 148 | - new BandwidthConstraint(Bandwidth.bps(1.0)), | 148 | + new BandwidthConstraint(BandwidthResource.bps(1.0)), |
| 149 | new LambdaConstraint(LambdaResource.valueOf(3)), | 149 | new LambdaConstraint(LambdaResource.valueOf(3)), |
| 150 | new AnnotationConstraint("key", 33.0), | 150 | new AnnotationConstraint("key", 33.0), |
| 151 | new AsymmetricPathConstraint(), | 151 | new AsymmetricPathConstraint(), | ... | ... |
| ... | @@ -38,7 +38,7 @@ import org.onosproject.net.link.LinkListener; | ... | @@ -38,7 +38,7 @@ import org.onosproject.net.link.LinkListener; |
| 38 | import org.onosproject.net.provider.AbstractProviderRegistry; | 38 | import org.onosproject.net.provider.AbstractProviderRegistry; |
| 39 | import org.onosproject.net.provider.AbstractProviderService; | 39 | import org.onosproject.net.provider.AbstractProviderService; |
| 40 | import org.onosproject.net.provider.ProviderId; | 40 | import org.onosproject.net.provider.ProviderId; |
| 41 | -import org.onosproject.net.resource.Bandwidth; | 41 | +import org.onosproject.net.resource.BandwidthResource; |
| 42 | import org.onosproject.net.tunnel.Label; | 42 | import org.onosproject.net.tunnel.Label; |
| 43 | import org.onosproject.net.tunnel.Tunnel; | 43 | import org.onosproject.net.tunnel.Tunnel; |
| 44 | import org.onosproject.net.tunnel.TunnelAdminService; | 44 | import org.onosproject.net.tunnel.TunnelAdminService; |
| ... | @@ -236,14 +236,14 @@ public class TunnelManager extends AbstractProviderRegistry<TunnelProvider, Tunn | ... | @@ -236,14 +236,14 @@ public class TunnelManager extends AbstractProviderRegistry<TunnelProvider, Tunn |
| 236 | 236 | ||
| 237 | @Override | 237 | @Override |
| 238 | public void requestTunnel(ConnectPoint src, ConnectPoint dst, | 238 | public void requestTunnel(ConnectPoint src, ConnectPoint dst, |
| 239 | - Bandwidth bw, Path path) { | 239 | + BandwidthResource bw, Path path) { |
| 240 | // TODO Auto-generated method stub | 240 | // TODO Auto-generated method stub |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | 243 | ||
| 244 | @Override | 244 | @Override |
| 245 | public void requestTunnel(ConnectPoint src, ConnectPoint dst, Type type, | 245 | public void requestTunnel(ConnectPoint src, ConnectPoint dst, Type type, |
| 246 | - Bandwidth bw, Path path) { | 246 | + BandwidthResource bw, Path path) { |
| 247 | // TODO Auto-generated method stub | 247 | // TODO Auto-generated method stub |
| 248 | 248 | ||
| 249 | } | 249 | } | ... | ... |
| ... | @@ -33,7 +33,7 @@ import org.onosproject.net.intent.PointToPointIntent; | ... | @@ -33,7 +33,7 @@ import org.onosproject.net.intent.PointToPointIntent; |
| 33 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 33 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
| 34 | import org.onosproject.net.intent.constraint.LambdaConstraint; | 34 | import org.onosproject.net.intent.constraint.LambdaConstraint; |
| 35 | import org.onosproject.net.intent.impl.PathNotFoundException; | 35 | import org.onosproject.net.intent.impl.PathNotFoundException; |
| 36 | -import org.onosproject.net.resource.Bandwidth; | 36 | +import org.onosproject.net.resource.BandwidthResource; |
| 37 | import org.onosproject.net.resource.LambdaResource; | 37 | import org.onosproject.net.resource.LambdaResource; |
| 38 | import org.onosproject.net.resource.LinkResourceService; | 38 | import org.onosproject.net.resource.LinkResourceService; |
| 39 | 39 | ||
| ... | @@ -227,7 +227,7 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { | ... | @@ -227,7 +227,7 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { |
| 227 | 227 | ||
| 228 | final LinkResourceService resourceService = | 228 | final LinkResourceService resourceService = |
| 229 | IntentTestsMocks.MockResourceService.makeBandwidthResourceService(1000.0); | 229 | IntentTestsMocks.MockResourceService.makeBandwidthResourceService(1000.0); |
| 230 | - final List<Constraint> constraints = Arrays.asList(new BandwidthConstraint(Bandwidth.bps(100.0))); | 230 | + final List<Constraint> constraints = Arrays.asList(new BandwidthConstraint(BandwidthResource.bps(100.0))); |
| 231 | 231 | ||
| 232 | final PointToPointIntent intent = makeIntent("s1", "s3", constraints); | 232 | final PointToPointIntent intent = makeIntent("s1", "s3", constraints); |
| 233 | 233 | ||
| ... | @@ -248,7 +248,7 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { | ... | @@ -248,7 +248,7 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { |
| 248 | 248 | ||
| 249 | final LinkResourceService resourceService = | 249 | final LinkResourceService resourceService = |
| 250 | IntentTestsMocks.MockResourceService.makeBandwidthResourceService(10.0); | 250 | IntentTestsMocks.MockResourceService.makeBandwidthResourceService(10.0); |
| 251 | - final List<Constraint> constraints = Arrays.asList(new BandwidthConstraint(Bandwidth.bps(100.0))); | 251 | + final List<Constraint> constraints = Arrays.asList(new BandwidthConstraint(BandwidthResource.bps(100.0))); |
| 252 | 252 | ||
| 253 | try { | 253 | try { |
| 254 | final PointToPointIntent intent = makeIntent("s1", "s3", constraints); | 254 | final PointToPointIntent intent = makeIntent("s1", "s3", constraints); | ... | ... |
| ... | @@ -23,7 +23,7 @@ import org.onosproject.net.Link; | ... | @@ -23,7 +23,7 @@ import org.onosproject.net.Link; |
| 23 | import org.onosproject.net.LinkKey; | 23 | import org.onosproject.net.LinkKey; |
| 24 | import org.onosproject.net.intent.IntentId; | 24 | import org.onosproject.net.intent.IntentId; |
| 25 | import org.onosproject.net.link.LinkService; | 25 | import org.onosproject.net.link.LinkService; |
| 26 | -import org.onosproject.net.resource.Bandwidth; | 26 | +import org.onosproject.net.resource.BandwidthResource; |
| 27 | import org.onosproject.net.resource.BandwidthResourceAllocation; | 27 | import org.onosproject.net.resource.BandwidthResourceAllocation; |
| 28 | import org.onosproject.net.resource.LambdaResource; | 28 | import org.onosproject.net.resource.LambdaResource; |
| 29 | import org.onosproject.net.resource.LambdaResourceAllocation; | 29 | import org.onosproject.net.resource.LambdaResourceAllocation; |
| ... | @@ -67,8 +67,8 @@ public class ConsistentLinkResourceStore extends | ... | @@ -67,8 +67,8 @@ public class ConsistentLinkResourceStore extends |
| 67 | 67 | ||
| 68 | private final Logger log = getLogger(getClass()); | 68 | private final Logger log = getLogger(getClass()); |
| 69 | 69 | ||
| 70 | - private static final Bandwidth DEFAULT_BANDWIDTH = Bandwidth.mbps(1_000); | 70 | + private static final BandwidthResource DEFAULT_BANDWIDTH = BandwidthResource.mbps(1_000); |
| 71 | - private static final Bandwidth EMPTY_BW = Bandwidth.bps(0); | 71 | + private static final BandwidthResource EMPTY_BW = BandwidthResource.bps(0); |
| 72 | 72 | ||
| 73 | // Smallest non-reserved MPLS label | 73 | // Smallest non-reserved MPLS label |
| 74 | private static final int MIN_UNRESERVED_LABEL = 0x10; | 74 | private static final int MIN_UNRESERVED_LABEL = 0x10; |
| ... | @@ -150,11 +150,11 @@ public class ConsistentLinkResourceStore extends | ... | @@ -150,11 +150,11 @@ public class ConsistentLinkResourceStore extends |
| 150 | 150 | ||
| 151 | // if Link annotation exist, use them | 151 | // if Link annotation exist, use them |
| 152 | // if all fails, use DEFAULT_BANDWIDTH | 152 | // if all fails, use DEFAULT_BANDWIDTH |
| 153 | - Bandwidth bandwidth = null; | 153 | + BandwidthResource bandwidth = null; |
| 154 | String strBw = link.annotations().value(BANDWIDTH); | 154 | String strBw = link.annotations().value(BANDWIDTH); |
| 155 | if (strBw != null) { | 155 | if (strBw != null) { |
| 156 | try { | 156 | try { |
| 157 | - bandwidth = Bandwidth.mbps(Double.parseDouble(strBw)); | 157 | + bandwidth = BandwidthResource.mbps(Double.parseDouble(strBw)); |
| 158 | } catch (NumberFormatException e) { | 158 | } catch (NumberFormatException e) { |
| 159 | // do nothings | 159 | // do nothings |
| 160 | bandwidth = null; | 160 | bandwidth = null; |
| ... | @@ -237,7 +237,7 @@ public class ConsistentLinkResourceStore extends | ... | @@ -237,7 +237,7 @@ public class ConsistentLinkResourceStore extends |
| 237 | } | 237 | } |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | - free.put(type, Sets.newHashSet(new BandwidthResourceAllocation(Bandwidth.bps(freeBw)))); | 240 | + free.put(type, Sets.newHashSet(new BandwidthResourceAllocation(BandwidthResource.bps(freeBw)))); |
| 241 | break; | 241 | break; |
| 242 | case LAMBDA: | 242 | case LAMBDA: |
| 243 | Set<? extends ResourceAllocation> lmd = caps.get(type); | 243 | Set<? extends ResourceAllocation> lmd = caps.get(type); | ... | ... |
| ... | @@ -36,7 +36,7 @@ import org.onosproject.net.Link; | ... | @@ -36,7 +36,7 @@ import org.onosproject.net.Link; |
| 36 | import org.onosproject.net.LinkKey; | 36 | import org.onosproject.net.LinkKey; |
| 37 | import org.onosproject.net.intent.IntentId; | 37 | import org.onosproject.net.intent.IntentId; |
| 38 | import org.onosproject.net.link.LinkService; | 38 | import org.onosproject.net.link.LinkService; |
| 39 | -import org.onosproject.net.resource.Bandwidth; | 39 | +import org.onosproject.net.resource.BandwidthResource; |
| 40 | import org.onosproject.net.resource.BandwidthResourceAllocation; | 40 | import org.onosproject.net.resource.BandwidthResourceAllocation; |
| 41 | import org.onosproject.net.resource.LambdaResource; | 41 | import org.onosproject.net.resource.LambdaResource; |
| 42 | import org.onosproject.net.resource.LambdaResourceAllocation; | 42 | import org.onosproject.net.resource.LambdaResourceAllocation; |
| ... | @@ -80,9 +80,9 @@ public class HazelcastLinkResourceStore | ... | @@ -80,9 +80,9 @@ public class HazelcastLinkResourceStore |
| 80 | 80 | ||
| 81 | private final Logger log = getLogger(getClass()); | 81 | private final Logger log = getLogger(getClass()); |
| 82 | 82 | ||
| 83 | - private static final Bandwidth DEFAULT_BANDWIDTH = Bandwidth.mbps(1_000); | 83 | + private static final BandwidthResource DEFAULT_BANDWIDTH = BandwidthResource.mbps(1_000); |
| 84 | 84 | ||
| 85 | - private static final Bandwidth EMPTY_BW = Bandwidth.bps(0); | 85 | + private static final BandwidthResource EMPTY_BW = BandwidthResource.bps(0); |
| 86 | 86 | ||
| 87 | // table to store current allocations | 87 | // table to store current allocations |
| 88 | /** LinkKey -> List<LinkResourceAllocations>. */ | 88 | /** LinkKey -> List<LinkResourceAllocations>. */ |
| ... | @@ -170,11 +170,11 @@ public class HazelcastLinkResourceStore | ... | @@ -170,11 +170,11 @@ public class HazelcastLinkResourceStore |
| 170 | // if Link annotation exist, use them | 170 | // if Link annotation exist, use them |
| 171 | // if all fails, use DEFAULT_BANDWIDTH | 171 | // if all fails, use DEFAULT_BANDWIDTH |
| 172 | 172 | ||
| 173 | - Bandwidth bandwidth = null; | 173 | + BandwidthResource bandwidth = null; |
| 174 | String strBw = link.annotations().value(bandwidthAnnotation); | 174 | String strBw = link.annotations().value(bandwidthAnnotation); |
| 175 | if (strBw != null) { | 175 | if (strBw != null) { |
| 176 | try { | 176 | try { |
| 177 | - bandwidth = Bandwidth.mbps(Double.parseDouble(strBw)); | 177 | + bandwidth = BandwidthResource.mbps(Double.parseDouble(strBw)); |
| 178 | } catch (NumberFormatException e) { | 178 | } catch (NumberFormatException e) { |
| 179 | // do nothings | 179 | // do nothings |
| 180 | bandwidth = null; | 180 | bandwidth = null; |
| ... | @@ -262,7 +262,7 @@ public class HazelcastLinkResourceStore | ... | @@ -262,7 +262,7 @@ public class HazelcastLinkResourceStore |
| 262 | } | 262 | } |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | - free.put(type, Sets.newHashSet(new BandwidthResourceAllocation(Bandwidth.bps(freeBw)))); | 265 | + free.put(type, Sets.newHashSet(new BandwidthResourceAllocation(BandwidthResource.bps(freeBw)))); |
| 266 | break; | 266 | break; |
| 267 | } | 267 | } |
| 268 | 268 | ... | ... |
| ... | @@ -29,7 +29,7 @@ import org.onosproject.net.DefaultLink; | ... | @@ -29,7 +29,7 @@ import org.onosproject.net.DefaultLink; |
| 29 | import org.onosproject.net.Link; | 29 | import org.onosproject.net.Link; |
| 30 | import org.onosproject.net.intent.IntentId; | 30 | import org.onosproject.net.intent.IntentId; |
| 31 | import org.onosproject.net.provider.ProviderId; | 31 | import org.onosproject.net.provider.ProviderId; |
| 32 | -import org.onosproject.net.resource.Bandwidth; | 32 | +import org.onosproject.net.resource.BandwidthResource; |
| 33 | import org.onosproject.net.resource.BandwidthResourceAllocation; | 33 | import org.onosproject.net.resource.BandwidthResourceAllocation; |
| 34 | import org.onosproject.net.resource.DefaultLinkResourceAllocations; | 34 | import org.onosproject.net.resource.DefaultLinkResourceAllocations; |
| 35 | import org.onosproject.net.resource.DefaultLinkResourceRequest; | 35 | import org.onosproject.net.resource.DefaultLinkResourceRequest; |
| ... | @@ -172,7 +172,7 @@ public class HazelcastLinkResourceStoreTest { | ... | @@ -172,7 +172,7 @@ public class HazelcastLinkResourceStoreTest { |
| 172 | final BandwidthResourceAllocation alloc = getBandwidthObj(freeRes); | 172 | final BandwidthResourceAllocation alloc = getBandwidthObj(freeRes); |
| 173 | assertNotNull(alloc); | 173 | assertNotNull(alloc); |
| 174 | 174 | ||
| 175 | - assertEquals(Bandwidth.mbps(1000.0), alloc.bandwidth()); | 175 | + assertEquals(BandwidthResource.mbps(1000.0), alloc.bandwidth()); |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | /** | 178 | /** |
| ... | @@ -209,7 +209,7 @@ public class HazelcastLinkResourceStoreTest { | ... | @@ -209,7 +209,7 @@ public class HazelcastLinkResourceStoreTest { |
| 209 | ImmutableSet.of(link)) | 209 | ImmutableSet.of(link)) |
| 210 | .build(); | 210 | .build(); |
| 211 | final ResourceAllocation allocation = | 211 | final ResourceAllocation allocation = |
| 212 | - new BandwidthResourceAllocation(Bandwidth.mbps(900.0)); | 212 | + new BandwidthResourceAllocation(BandwidthResource.mbps(900.0)); |
| 213 | final Set<ResourceAllocation> allocationSet = ImmutableSet.of(allocation); | 213 | final Set<ResourceAllocation> allocationSet = ImmutableSet.of(allocation); |
| 214 | 214 | ||
| 215 | final LinkResourceAllocations allocations = | 215 | final LinkResourceAllocations allocations = |
| ... | @@ -230,7 +230,7 @@ public class HazelcastLinkResourceStoreTest { | ... | @@ -230,7 +230,7 @@ public class HazelcastLinkResourceStoreTest { |
| 230 | ImmutableSet.of(link)) | 230 | ImmutableSet.of(link)) |
| 231 | .build(); | 231 | .build(); |
| 232 | final ResourceAllocation allocation = | 232 | final ResourceAllocation allocation = |
| 233 | - new BandwidthResourceAllocation(Bandwidth.mbps(9000.0)); | 233 | + new BandwidthResourceAllocation(BandwidthResource.mbps(9000.0)); |
| 234 | final Set<ResourceAllocation> allocationSet = ImmutableSet.of(allocation); | 234 | final Set<ResourceAllocation> allocationSet = ImmutableSet.of(allocation); |
| 235 | 235 | ||
| 236 | final LinkResourceAllocations allocations = | 236 | final LinkResourceAllocations allocations = |
| ... | @@ -258,7 +258,7 @@ public class HazelcastLinkResourceStoreTest { | ... | @@ -258,7 +258,7 @@ public class HazelcastLinkResourceStoreTest { |
| 258 | ImmutableSet.of(link)) | 258 | ImmutableSet.of(link)) |
| 259 | .build(); | 259 | .build(); |
| 260 | final ResourceAllocation allocation = | 260 | final ResourceAllocation allocation = |
| 261 | - new BandwidthResourceAllocation(Bandwidth.mbps(900.0)); | 261 | + new BandwidthResourceAllocation(BandwidthResource.mbps(900.0)); |
| 262 | final Set<ResourceAllocation> allocationSet = ImmutableSet.of(allocation); | 262 | final Set<ResourceAllocation> allocationSet = ImmutableSet.of(allocation); |
| 263 | 263 | ||
| 264 | final LinkResourceAllocations allocations = | 264 | final LinkResourceAllocations allocations = | ... | ... |
| ... | @@ -28,6 +28,7 @@ import org.onlab.packet.IpAddress; | ... | @@ -28,6 +28,7 @@ import org.onlab.packet.IpAddress; |
| 28 | import org.onlab.packet.IpPrefix; | 28 | import org.onlab.packet.IpPrefix; |
| 29 | import org.onlab.packet.MacAddress; | 29 | import org.onlab.packet.MacAddress; |
| 30 | import org.onlab.packet.VlanId; | 30 | import org.onlab.packet.VlanId; |
| 31 | +import org.onlab.util.Bandwidth; | ||
| 31 | import org.onlab.util.Frequency; | 32 | import org.onlab.util.Frequency; |
| 32 | import org.onlab.util.KryoNamespace; | 33 | import org.onlab.util.KryoNamespace; |
| 33 | import org.onosproject.app.ApplicationState; | 34 | import org.onosproject.app.ApplicationState; |
| ... | @@ -147,7 +148,7 @@ import org.onosproject.net.packet.DefaultOutboundPacket; | ... | @@ -147,7 +148,7 @@ import org.onosproject.net.packet.DefaultOutboundPacket; |
| 147 | import org.onosproject.net.packet.DefaultPacketRequest; | 148 | import org.onosproject.net.packet.DefaultPacketRequest; |
| 148 | import org.onosproject.net.packet.PacketPriority; | 149 | import org.onosproject.net.packet.PacketPriority; |
| 149 | import org.onosproject.net.provider.ProviderId; | 150 | import org.onosproject.net.provider.ProviderId; |
| 150 | -import org.onosproject.net.resource.Bandwidth; | 151 | +import org.onosproject.net.resource.BandwidthResource; |
| 151 | import org.onosproject.net.resource.BandwidthResourceAllocation; | 152 | import org.onosproject.net.resource.BandwidthResourceAllocation; |
| 152 | import org.onosproject.net.resource.BandwidthResourceRequest; | 153 | import org.onosproject.net.resource.BandwidthResourceRequest; |
| 153 | import org.onosproject.net.resource.DefaultLinkResourceAllocations; | 154 | import org.onosproject.net.resource.DefaultLinkResourceAllocations; |
| ... | @@ -223,7 +224,7 @@ public final class KryoNamespaces { | ... | @@ -223,7 +224,7 @@ public final class KryoNamespaces { |
| 223 | .register(new MacAddressSerializer(), MacAddress.class) | 224 | .register(new MacAddressSerializer(), MacAddress.class) |
| 224 | .register(VlanId.class) | 225 | .register(VlanId.class) |
| 225 | .register(Frequency.class) | 226 | .register(Frequency.class) |
| 226 | - .register(org.onlab.util.Bandwidth.class) | 227 | + .register(Bandwidth.class) |
| 227 | .build(); | 228 | .build(); |
| 228 | 229 | ||
| 229 | /** | 230 | /** |
| ... | @@ -357,7 +358,7 @@ public final class KryoNamespaces { | ... | @@ -357,7 +358,7 @@ public final class KryoNamespaces { |
| 357 | BandwidthResourceRequest.class, | 358 | BandwidthResourceRequest.class, |
| 358 | LambdaResourceRequest.class, | 359 | LambdaResourceRequest.class, |
| 359 | LambdaResource.class, | 360 | LambdaResource.class, |
| 360 | - Bandwidth.class, | 361 | + BandwidthResource.class, |
| 361 | DefaultLinkResourceAllocations.class, | 362 | DefaultLinkResourceAllocations.class, |
| 362 | BandwidthResourceAllocation.class, | 363 | BandwidthResourceAllocation.class, |
| 363 | LambdaResourceAllocation.class, | 364 | LambdaResourceAllocation.class, | ... | ... |
| ... | @@ -24,6 +24,7 @@ import org.junit.After; | ... | @@ -24,6 +24,7 @@ import org.junit.After; |
| 24 | import org.junit.Before; | 24 | import org.junit.Before; |
| 25 | import org.junit.BeforeClass; | 25 | import org.junit.BeforeClass; |
| 26 | import org.junit.Test; | 26 | import org.junit.Test; |
| 27 | +import org.onlab.util.Bandwidth; | ||
| 27 | import org.onlab.util.Frequency; | 28 | import org.onlab.util.Frequency; |
| 28 | import org.onosproject.cluster.NodeId; | 29 | import org.onosproject.cluster.NodeId; |
| 29 | import org.onosproject.cluster.RoleInfo; | 30 | import org.onosproject.cluster.RoleInfo; |
| ... | @@ -58,7 +59,7 @@ import org.onosproject.net.flow.FlowRule; | ... | @@ -58,7 +59,7 @@ import org.onosproject.net.flow.FlowRule; |
| 58 | import org.onosproject.net.flow.FlowRuleBatchEntry; | 59 | import org.onosproject.net.flow.FlowRuleBatchEntry; |
| 59 | import org.onosproject.net.intent.IntentId; | 60 | import org.onosproject.net.intent.IntentId; |
| 60 | import org.onosproject.net.provider.ProviderId; | 61 | import org.onosproject.net.provider.ProviderId; |
| 61 | -import org.onosproject.net.resource.Bandwidth; | 62 | +import org.onosproject.net.resource.BandwidthResource; |
| 62 | import org.onosproject.net.resource.BandwidthResourceAllocation; | 63 | import org.onosproject.net.resource.BandwidthResourceAllocation; |
| 63 | import org.onosproject.net.resource.DefaultLinkResourceAllocations; | 64 | import org.onosproject.net.resource.DefaultLinkResourceAllocations; |
| 64 | import org.onosproject.net.resource.DefaultLinkResourceRequest; | 65 | import org.onosproject.net.resource.DefaultLinkResourceRequest; |
| ... | @@ -354,7 +355,7 @@ public class KryoSerializerTest { | ... | @@ -354,7 +355,7 @@ public class KryoSerializerTest { |
| 354 | .build(); | 355 | .build(); |
| 355 | Map<Link, Set<ResourceAllocation>> allocations = new HashMap<>(); | 356 | Map<Link, Set<ResourceAllocation>> allocations = new HashMap<>(); |
| 356 | allocations.put(new DefaultLink(PID, CP1, CP2, Type.DIRECT), | 357 | allocations.put(new DefaultLink(PID, CP1, CP2, Type.DIRECT), |
| 357 | - ImmutableSet.of(new BandwidthResourceAllocation(Bandwidth.bps(10.0)), | 358 | + ImmutableSet.of(new BandwidthResourceAllocation(BandwidthResource.bps(10.0)), |
| 358 | new LambdaResourceAllocation(LambdaResource.valueOf(1)))); | 359 | new LambdaResourceAllocation(LambdaResource.valueOf(1)))); |
| 359 | testSerializable(new DefaultLinkResourceAllocations(request, allocations)); | 360 | testSerializable(new DefaultLinkResourceAllocations(request, allocations)); |
| 360 | } | 361 | } |
| ... | @@ -367,7 +368,7 @@ public class KryoSerializerTest { | ... | @@ -367,7 +368,7 @@ public class KryoSerializerTest { |
| 367 | 368 | ||
| 368 | @Test | 369 | @Test |
| 369 | public void testBandwidth() { | 370 | public void testBandwidth() { |
| 370 | - testSerializedEquals(org.onlab.util.Bandwidth.mbps(1000.0)); | 371 | + testSerializedEquals(Bandwidth.mbps(1000.0)); |
| 371 | } | 372 | } |
| 372 | 373 | ||
| 373 | @Test | 374 | @Test |
| ... | @@ -377,7 +378,7 @@ public class KryoSerializerTest { | ... | @@ -377,7 +378,7 @@ public class KryoSerializerTest { |
| 377 | 378 | ||
| 378 | @Test | 379 | @Test |
| 379 | public void testBandwidthConstraint() { | 380 | public void testBandwidthConstraint() { |
| 380 | - testSerializable(new BandwidthConstraint(Bandwidth.bps(1000.0))); | 381 | + testSerializable(new BandwidthConstraint(BandwidthResource.bps(1000.0))); |
| 381 | } | 382 | } |
| 382 | 383 | ||
| 383 | @Test | 384 | @Test | ... | ... |
| ... | @@ -31,7 +31,7 @@ import org.onosproject.net.AnnotationKeys; | ... | @@ -31,7 +31,7 @@ import org.onosproject.net.AnnotationKeys; |
| 31 | import org.onosproject.net.Annotations; | 31 | import org.onosproject.net.Annotations; |
| 32 | import org.onosproject.net.Link; | 32 | import org.onosproject.net.Link; |
| 33 | import org.onosproject.net.intent.IntentId; | 33 | import org.onosproject.net.intent.IntentId; |
| 34 | -import org.onosproject.net.resource.Bandwidth; | 34 | +import org.onosproject.net.resource.BandwidthResource; |
| 35 | import org.onosproject.net.resource.BandwidthResourceAllocation; | 35 | import org.onosproject.net.resource.BandwidthResourceAllocation; |
| 36 | import org.onosproject.net.resource.LambdaResource; | 36 | import org.onosproject.net.resource.LambdaResource; |
| 37 | import org.onosproject.net.resource.LambdaResourceAllocation; | 37 | import org.onosproject.net.resource.LambdaResourceAllocation; |
| ... | @@ -55,7 +55,7 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -55,7 +55,7 @@ import static org.slf4j.LoggerFactory.getLogger; |
| 55 | @Component(immediate = true) | 55 | @Component(immediate = true) |
| 56 | @Service | 56 | @Service |
| 57 | public class SimpleLinkResourceStore implements LinkResourceStore { | 57 | public class SimpleLinkResourceStore implements LinkResourceStore { |
| 58 | - private static final Bandwidth DEFAULT_BANDWIDTH = Bandwidth.mbps(1_000); | 58 | + private static final BandwidthResource DEFAULT_BANDWIDTH = BandwidthResource.mbps(1_000); |
| 59 | private final Logger log = getLogger(getClass()); | 59 | private final Logger log = getLogger(getClass()); |
| 60 | 60 | ||
| 61 | private Map<IntentId, LinkResourceAllocations> linkResourceAllocationsMap; | 61 | private Map<IntentId, LinkResourceAllocations> linkResourceAllocationsMap; |
| ... | @@ -96,9 +96,9 @@ public class SimpleLinkResourceStore implements LinkResourceStore { | ... | @@ -96,9 +96,9 @@ public class SimpleLinkResourceStore implements LinkResourceStore { |
| 96 | log.debug("No optical.wave annotation on link %s", link); | 96 | log.debug("No optical.wave annotation on link %s", link); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | - Bandwidth bandwidth = DEFAULT_BANDWIDTH; | 99 | + BandwidthResource bandwidth = DEFAULT_BANDWIDTH; |
| 100 | try { | 100 | try { |
| 101 | - bandwidth = Bandwidth.mbps((Double.parseDouble(annotations.value(AnnotationKeys.BANDWIDTH)))); | 101 | + bandwidth = BandwidthResource.mbps((Double.parseDouble(annotations.value(AnnotationKeys.BANDWIDTH)))); |
| 102 | } catch (NumberFormatException e) { | 102 | } catch (NumberFormatException e) { |
| 103 | log.debug("No bandwidth annotation on link %s", link); | 103 | log.debug("No bandwidth annotation on link %s", link); |
| 104 | } | 104 | } |
| ... | @@ -123,7 +123,7 @@ public class SimpleLinkResourceStore implements LinkResourceStore { | ... | @@ -123,7 +123,7 @@ public class SimpleLinkResourceStore implements LinkResourceStore { |
| 123 | return (BandwidthResourceAllocation) res; | 123 | return (BandwidthResourceAllocation) res; |
| 124 | } | 124 | } |
| 125 | } | 125 | } |
| 126 | - return new BandwidthResourceAllocation(Bandwidth.bps(0)); | 126 | + return new BandwidthResourceAllocation(BandwidthResource.bps(0)); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | /** | 129 | /** |
| ... | @@ -156,7 +156,7 @@ public class SimpleLinkResourceStore implements LinkResourceStore { | ... | @@ -156,7 +156,7 @@ public class SimpleLinkResourceStore implements LinkResourceStore { |
| 156 | } | 156 | } |
| 157 | freeRes.remove(ba); | 157 | freeRes.remove(ba); |
| 158 | freeRes.add(new BandwidthResourceAllocation( | 158 | freeRes.add(new BandwidthResourceAllocation( |
| 159 | - Bandwidth.bps(newBandwidth))); | 159 | + BandwidthResource.bps(newBandwidth))); |
| 160 | break; | 160 | break; |
| 161 | case LAMBDA: | 161 | case LAMBDA: |
| 162 | final boolean lambdaAvailable = freeRes.remove(res); | 162 | final boolean lambdaAvailable = freeRes.remove(res); |
| ... | @@ -198,7 +198,7 @@ public class SimpleLinkResourceStore implements LinkResourceStore { | ... | @@ -198,7 +198,7 @@ public class SimpleLinkResourceStore implements LinkResourceStore { |
| 198 | double newBandwidth = ba.bandwidth().toDouble() + requestedBandwidth; | 198 | double newBandwidth = ba.bandwidth().toDouble() + requestedBandwidth; |
| 199 | freeRes.remove(ba); | 199 | freeRes.remove(ba); |
| 200 | freeRes.add(new BandwidthResourceAllocation( | 200 | freeRes.add(new BandwidthResourceAllocation( |
| 201 | - Bandwidth.bps(newBandwidth))); | 201 | + BandwidthResource.bps(newBandwidth))); |
| 202 | break; | 202 | break; |
| 203 | case LAMBDA: | 203 | case LAMBDA: |
| 204 | checkState(freeRes.add(res)); | 204 | checkState(freeRes.add(res)); | ... | ... |
core/store/trivial/src/test/java/org/onosproject/store/trivial/impl/SimpleLinkResourceStoreTest.java
| ... | @@ -30,7 +30,7 @@ import org.onosproject.net.DefaultLink; | ... | @@ -30,7 +30,7 @@ import org.onosproject.net.DefaultLink; |
| 30 | import org.onosproject.net.Link; | 30 | import org.onosproject.net.Link; |
| 31 | import org.onosproject.net.intent.IntentId; | 31 | import org.onosproject.net.intent.IntentId; |
| 32 | import org.onosproject.net.provider.ProviderId; | 32 | import org.onosproject.net.provider.ProviderId; |
| 33 | -import org.onosproject.net.resource.Bandwidth; | 33 | +import org.onosproject.net.resource.BandwidthResource; |
| 34 | import org.onosproject.net.resource.BandwidthResourceAllocation; | 34 | import org.onosproject.net.resource.BandwidthResourceAllocation; |
| 35 | import org.onosproject.net.resource.LambdaResource; | 35 | import org.onosproject.net.resource.LambdaResource; |
| 36 | import org.onosproject.net.resource.LambdaResourceAllocation; | 36 | import org.onosproject.net.resource.LambdaResourceAllocation; |
| ... | @@ -159,7 +159,7 @@ public class SimpleLinkResourceStoreTest { | ... | @@ -159,7 +159,7 @@ public class SimpleLinkResourceStoreTest { |
| 159 | final BandwidthResourceAllocation alloc = getBandwidthObj(freeRes); | 159 | final BandwidthResourceAllocation alloc = getBandwidthObj(freeRes); |
| 160 | assertNotNull(alloc); | 160 | assertNotNull(alloc); |
| 161 | 161 | ||
| 162 | - assertEquals(Bandwidth.mbps(1000.0), alloc.bandwidth()); | 162 | + assertEquals(BandwidthResource.mbps(1000.0), alloc.bandwidth()); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | /** | 165 | /** |
| ... | @@ -184,7 +184,7 @@ public class SimpleLinkResourceStoreTest { | ... | @@ -184,7 +184,7 @@ public class SimpleLinkResourceStoreTest { |
| 184 | @Override | 184 | @Override |
| 185 | public Set<ResourceAllocation> getResourceAllocation(Link link) { | 185 | public Set<ResourceAllocation> getResourceAllocation(Link link) { |
| 186 | final ResourceAllocation allocation = | 186 | final ResourceAllocation allocation = |
| 187 | - new BandwidthResourceAllocation(Bandwidth.bps(allocationAmount)); | 187 | + new BandwidthResourceAllocation(BandwidthResource.bps(allocationAmount)); |
| 188 | final Set<ResourceAllocation> allocations = new HashSet<>(); | 188 | final Set<ResourceAllocation> allocations = new HashSet<>(); |
| 189 | allocations.add(allocation); | 189 | allocations.add(allocation); |
| 190 | return allocations; | 190 | return allocations; | ... | ... |
-
Please register or login to post a comment