diff options
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/meter')
25 files changed, 0 insertions, 2027 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/Band.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/Band.java deleted file mode 100644 index 2bfafad2..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/Band.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -/** - * Represents a band used within a meter. - */ -public interface Band { - - /** - * Specifies the type of band. - */ - enum Type { - /** - * Simple rate limiter which drops packets - * when the rate is exceeded. - */ - DROP, - - /** - * defines a simple DiffServ policer that remark - * the drop precedence of the DSCP field in the - * IP header of the packets that exceed the band - * rate value. - */ - REMARK - } - - /** - * The rate at which this meter applies. - * - * @return the long value of the rate - */ - long rate(); - - /** - * The burst size at which the meter applies. - * - * @return the long value of the size - */ - long burst(); - - /** - * Only meaningful in the case of a REMARK band type. - * indicates by which amount the drop precedence of - * the packet should be increase if the band is exceeded. - * - * @return a short value - */ - short dropPrecedence(); - - /** - * Signals the type of band to create. - * - * @return a band type - */ - Type type(); - - /** - * Returns the packets seen by this band. - * - * @return a long value - */ - long packets(); - - /** - * Return the bytes seen by this band. - * - * @return a byte counter - */ - long bytes(); - - interface Builder { - - /** - * Assigns a rate to this band. The units for this rate - * are defined in the encapsulating meter. - * - * @param rate a long value - * @return this - */ - Builder withRate(long rate); - - /** - * Assigns a burst size to this band. Only meaningful if - * the encapsulating meter is of burst type. - * - * @param burstSize a long value. - * @return this - */ - Builder burstSize(long burstSize); - - /** - * Assigns the drop precedence for this band. Only meaningful if - * the band is of REMARK type. - * - * @param prec a short value - * @return this - */ - Builder dropPrecedence(short prec); - - /** - * Assigns the @See Type of this band. - * - * @param type a band type - * @return this - */ - Builder ofType(Type type); - - /** - * Builds the band. - * - * @return a band - */ - Band build(); - - } - - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/BandEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/BandEntry.java deleted file mode 100644 index 03145e91..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/BandEntry.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -/** - * Represents a stored band. - */ -public interface BandEntry extends Band { - - /** - * Sets the number of packets seen by this band. - * - * @param packets a packet count - */ - void setPackets(long packets); - - /** - * Sets the number of bytes seen by this band. - * - * @param bytes a byte counter - */ - void setBytes(long bytes); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultBand.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultBand.java deleted file mode 100644 index 58a24766..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultBand.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkArgument; - -/** - * A default implementation for a Band. - */ -public final class DefaultBand implements Band, BandEntry { - - private final Type type; - private final long rate; - //TODO: should be made optional - private final Long burstSize; - private final Short prec; - private long packets; - private long bytes; - - public DefaultBand(Type type, long rate, - Long burstSize, Short prec) { - this.type = type; - this.rate = rate; - this.burstSize = burstSize; - this.prec = prec; - } - - @Override - public long rate() { - return rate; - } - - @Override - public long burst() { - return burstSize; - } - - @Override - public short dropPrecedence() { - return prec; - } - - @Override - public Type type() { - return type; - } - - @Override - public long packets() { - return packets; - } - - @Override - public long bytes() { - return bytes; - } - - @Override - public void setPackets(long packets) { - this.packets = packets; - } - - @Override - public void setBytes(long bytes) { - this.bytes = bytes; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("rate", rate) - .add("burst-size", burstSize) - .add("type", type) - .add("drop-precedence", prec).toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public static final class Builder implements Band.Builder { - - private long rate; - private Long burstSize; - private Short prec; - private Type type; - - @Override - public Band.Builder withRate(long rate) { - this.rate = rate; - return this; - } - - @Override - public Band.Builder burstSize(long burstSize) { - this.burstSize = burstSize; - return this; - } - - @Override - public Band.Builder dropPrecedence(short prec) { - this.prec = prec; - return this; - } - - @Override - public Band.Builder ofType(Type type) { - this.type = type; - return this; - } - - @Override - public DefaultBand build() { - checkArgument(type != Type.REMARK && prec == null, - "Only REMARK bands can have a precendence."); - - return new DefaultBand(type, rate, burstSize, prec); - } - - - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeter.java deleted file mode 100644 index f7d6210d..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeter.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableSet; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.DeviceId; - -import java.util.Collection; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * A default implementation of a meter. - */ -public final class DefaultMeter implements Meter, MeterEntry { - - - private final MeterId id; - private final ApplicationId appId; - private final Unit unit; - private final boolean burst; - private final Collection<Band> bands; - private final DeviceId deviceId; - - private MeterState state; - private long life; - private long refCount; - private long packets; - private long bytes; - - private DefaultMeter(DeviceId deviceId, MeterId id, ApplicationId appId, - Unit unit, boolean burst, - Collection<Band> bands) { - this.deviceId = deviceId; - this.id = id; - this.appId = appId; - this.unit = unit; - this.burst = burst; - this.bands = bands; - } - - @Override - public DeviceId deviceId() { - return deviceId; - } - - @Override - public MeterId id() { - return id; - } - - @Override - public ApplicationId appId() { - return appId; - } - - @Override - public Unit unit() { - return unit; - } - - @Override - public boolean isBurst() { - return burst; - } - - @Override - public Collection<Band> bands() { - return bands; - } - - @Override - public MeterState state() { - return state; - } - - @Override - public long life() { - return life; - } - - @Override - public long referenceCount() { - return refCount; - } - - @Override - public long packetsSeen() { - return packets; - } - - @Override - public long bytesSeen() { - return bytes; - } - - public static Builder builder() { - return new Builder(); - } - - @Override - public void setState(MeterState state) { - this.state = state; - } - - @Override - public void setLife(long life) { - this.life = life; - } - - @Override - public void setReferenceCount(long count) { - this.refCount = count; - } - - @Override - public void setProcessedPackets(long packets) { - this.packets = packets; - } - - @Override - public void setProcessedBytes(long bytes) { - this.bytes = bytes; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("device", deviceId) - .add("id", id) - .add("appId", appId.name()) - .add("unit", unit) - .add("isBurst", burst) - .add("state", state) - .add("bands", bands).toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DefaultMeter that = (DefaultMeter) o; - return Objects.equal(id, that.id) && - Objects.equal(appId, that.appId) && - Objects.equal(unit, that.unit) && - Objects.equal(deviceId, that.deviceId); - } - - @Override - public int hashCode() { - return Objects.hashCode(id, appId, unit, deviceId); - } - - public static final class Builder implements Meter.Builder { - - private MeterId id; - private ApplicationId appId; - private Unit unit = Unit.KB_PER_SEC; - private boolean burst = false; - private Collection<Band> bands; - private DeviceId deviceId; - - - @Override - public Meter.Builder forDevice(DeviceId deviceId) { - this.deviceId = deviceId; - return this; - } - - @Override - public Meter.Builder withId(MeterId id) { - this.id = id; - return this; - } - - @Override - public Meter.Builder fromApp(ApplicationId appId) { - this.appId = appId; - return this; - } - - @Override - public Meter.Builder withUnit(Unit unit) { - this.unit = unit; - return this; - } - - @Override - public Meter.Builder burst() { - this.burst = true; - return this; - } - - @Override - public Meter.Builder withBands(Collection<Band> bands) { - this.bands = ImmutableSet.copyOf(bands); - return this; - } - - @Override - public DefaultMeter build() { - checkNotNull(deviceId, "Must specify a device"); - checkNotNull(bands, "Must have bands."); - checkArgument(bands.size() > 0, "Must have at least one band."); - checkNotNull(appId, "Must have an application id"); - checkNotNull(id, "Must specify a meter id"); - return new DefaultMeter(deviceId, id, appId, unit, burst, bands); - } - - - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java deleted file mode 100644 index 51394c30..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import com.google.common.collect.ImmutableSet; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.DeviceId; - -import java.util.Collection; -import java.util.Optional; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * A default implementation of a meter. - */ -public final class DefaultMeterRequest implements MeterRequest { - - - - private final ApplicationId appId; - private final Meter.Unit unit; - private final boolean burst; - private final Collection<Band> bands; - private final DeviceId deviceId; - private final Optional<MeterContext> context; - private final Type op; - - private DefaultMeterRequest(DeviceId deviceId, ApplicationId appId, - Meter.Unit unit, boolean burst, - Collection<Band> bands, MeterContext context, - Type op) { - this.deviceId = deviceId; - this.appId = appId; - this.unit = unit; - this.burst = burst; - this.bands = bands; - this.context = Optional.ofNullable(context); - this.op = op; - } - - @Override - public DeviceId deviceId() { - return deviceId; - } - - - @Override - public ApplicationId appId() { - return appId; - } - - @Override - public Meter.Unit unit() { - return unit; - } - - @Override - public boolean isBurst() { - return burst; - } - - @Override - public Collection<Band> bands() { - return bands; - } - - @Override - public Optional<MeterContext> context() { - return context; - } - - - - public static Builder builder() { - return new Builder(); - } - - @Override - public String toString() { - return toStringHelper(this) - .add("device", deviceId) - .add("appId", appId.name()) - .add("unit", unit) - .add("isBurst", burst) - .add("bands", bands).toString(); - } - - public static final class Builder implements MeterRequest.Builder { - - private ApplicationId appId; - private Meter.Unit unit = Meter.Unit.KB_PER_SEC; - private boolean burst = false; - private Collection<Band> bands; - private DeviceId deviceId; - private MeterContext context; - private Optional<MeterId> desiredId = Optional.empty(); - - - @Override - public MeterRequest.Builder forDevice(DeviceId deviceId) { - this.deviceId = deviceId; - return this; - } - - @Override - public MeterRequest.Builder fromApp(ApplicationId appId) { - this.appId = appId; - return this; - } - - @Override - public MeterRequest.Builder withUnit(Meter.Unit unit) { - this.unit = unit; - return this; - } - - @Override - public MeterRequest.Builder burst() { - this.burst = true; - return this; - } - - @Override - public MeterRequest.Builder withBands(Collection<Band> bands) { - this.bands = ImmutableSet.copyOf(bands); - return this; - } - - @Override - public MeterRequest.Builder withContext(MeterContext context) { - this.context = context; - return this; - } - - @Override - public MeterRequest add() { - validate(); - return new DefaultMeterRequest(deviceId, appId, unit, burst, bands, - context, Type.ADD); - } - - @Override - public MeterRequest remove() { - validate(); - return new DefaultMeterRequest(deviceId, appId, unit, burst, bands, - context, Type.REMOVE); - } - - private void validate() { - checkNotNull(deviceId, "Must specify a device"); - checkNotNull(bands, "Must have bands."); - checkArgument(bands.size() > 0, "Must have at least one band."); - checkNotNull(appId, "Must have an application id"); - } - - - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/Meter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/Meter.java deleted file mode 100644 index 98ebc350..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/Meter.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import org.onosproject.core.ApplicationId; -import org.onosproject.net.DeviceId; - -import java.util.Collection; - -/** - * Represents a generalized meter to be deployed on a device. - */ -public interface Meter { - - enum Unit { - /** - * Packets per second. - */ - PKTS_PER_SEC, - - /** - * Kilo bits per second. - */ - KB_PER_SEC - } - - /** - * The target device for this meter. - * - * @return a device id - */ - DeviceId deviceId(); - - /** - * This meters id. - * - * @return a meter id - */ - MeterId id(); - - /** - * The id of the application which created this meter. - * - * @return an application id - */ - ApplicationId appId(); - - /** - * The unit used within this meter. - * - * @return the unit - */ - Unit unit(); - - /** - * Signals whether this meter applies to bursts only. - * - * @return a boolean - */ - boolean isBurst(); - - /** - * The collection of bands to apply on the dataplane. - * - * @return a collection of bands. - */ - Collection<Band> bands(); - - /** - * Fetches the state of this meter. - * - * @return a meter state - */ - MeterState state(); - - /** - * The lifetime in seconds of this meter. - * - * @return number of seconds - */ - long life(); - - /** - * The number of flows pointing to this meter. - * - * @return a reference count - */ - long referenceCount(); - - /** - * Number of packets processed by this meter. - * - * @return a packet count - */ - long packetsSeen(); - - /** - * Number of bytes processed by this meter. - * - * @return a byte count - */ - long bytesSeen(); - - /** - * A meter builder. - */ - interface Builder { - - /** - * Assigns the target device for this meter. - * - * @param deviceId a device id - * @return this - */ - Builder forDevice(DeviceId deviceId); - - /** - * Assigns the id to this meter. - * - * @param id a e - * @return this - */ - Builder withId(MeterId id); - - /** - * Assigns the application that built this meter. - * - * @param appId an application id - * @return this - */ - Builder fromApp(ApplicationId appId); - - /** - * Assigns the @See Unit to use for this meter. - * Defaults to kb/s - * - * @param unit a unit - * @return this - */ - Builder withUnit(Unit unit); - - /** - * Sets this meter as applicable to burst traffic only. - * Defaults to false. - * - * @return this - */ - Builder burst(); - - /** - * Assigns bands to this meter. There must be at least one band. - * - * @param bands a collection of bands - * @return this - */ - Builder withBands(Collection<Band> bands); - - /** - * Builds the meter based on the specified parameters. - * - * @return a meter - */ - Meter build(); - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterContext.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterContext.java deleted file mode 100644 index 574bdca9..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterContext.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -/** - * A context permitting the application to be notified when the - * meter installation has been successful. - */ -public interface MeterContext { - - /** - * Invoked on successful installation of the meter. - * - * @param op a meter - */ - default void onSuccess(MeterRequest op) {} - - /** - * Invoked when error is encountered while installing a meter. - * - * @param op a meter - * @param reason the reason why it failed - */ - default void onError(MeterRequest op, MeterFailReason reason) {} -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterEntry.java deleted file mode 100644 index 178a564c..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterEntry.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -/** - * Represents a stored meter. - */ -public interface MeterEntry extends Meter { - - /** - * Updates the state of this meter. - * - * @param state a meter state - */ - void setState(MeterState state); - - /** - * Set the amount of time the meter has existed in seconds. - * - * @param life number of seconds - */ - void setLife(long life); - - /** - * Sets the number of flows which are using this meter. - * - * @param count a reference count. - */ - void setReferenceCount(long count); - - /** - * Updates the number of packets seen by this meter. - * - * @param packets a packet count. - */ - void setProcessedPackets(long packets); - - /** - * Updates the number of bytes seen by the meter. - * - * @param bytes a byte counter. - */ - void setProcessedBytes(long bytes); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterEvent.java deleted file mode 100644 index 72f0a53a..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterEvent.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import org.onosproject.event.AbstractEvent; - -/** - * Entity that represents Meter events. - */ -public class MeterEvent extends AbstractEvent<MeterEvent.Type, Meter> { - - - public enum Type { - /** - * A meter addition was requested. - */ - METER_ADD_REQ, - - /** - * A meter removal was requested. - */ - METER_REM_REQ - } - - - /** - * Creates an event of a given type and for the specified meter and the - * current time. - * - * @param type meter event type - * @param meter event subject - */ - public MeterEvent(Type type, Meter meter) { - super(type, meter); - } - - /** - * Creates an event of a given type and for the specified meter and time. - * - * @param type meter event type - * @param meter event subject - * @param time occurrence time - */ - public MeterEvent(Type type, Meter meter, long time) { - super(type, meter, time); - } - - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterFailReason.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterFailReason.java deleted file mode 100644 index 8683e2a2..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterFailReason.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -/** - * Enum used to represent a meter failure condition. - */ -public enum MeterFailReason { - /** - * A meter with the same identifier already exists. - * Essentially a duplicate meter exists. - */ - EXISTING_METER, - - /** - * The device does not support any more meters. - */ - OUT_OF_METERS, - - /** - * The device does not support any more bands for this meter. - */ - OUT_OF_BANDS, - - /** - * The meter that was attempted to be modified is unknown. - */ - UNKNOWN, - - /** - * The operation for this meter installation timed out. - */ - TIMEOUT, - - /** - * Invalid meter definition. - */ - INVALID_METER, - - /** - * The target device is unknown. - */ - UNKNOWN_DEVICE, - - /** - * Unknown command. - */ - UNKNOWN_COMMAND, - - /** - * Unknown flags. - */ - UNKNOWN_FLAGS, - - /** - * Bad rate value. - */ - BAD_RATE, - - /** - * Bad burst size value. - */ - BAD_BURST, - - /** - * Bad band. - */ - BAD_BAND, - - /** - * Bad value value. - */ - BAD_BAND_VALUE - - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterId.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterId.java deleted file mode 100644 index 872de2d8..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterId.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import static com.google.common.base.Preconditions.checkArgument; - -/** - * A representation of a meter id. - * Uniquely identifies a meter system wide. - */ -public final class MeterId { - - static final long MAX = 0xFFFF0000; - - private final long id; - - public static final MeterId SLOWPATH = new MeterId(0xFFFFFFFD); - public static final MeterId CONTROLLER = new MeterId(0xFFFFFFFE); - public static final MeterId ALL = new MeterId(0xFFFFFFFF); - - private MeterId(long id) { - checkArgument(id >= MAX, "id cannot be larger than 0xFFFF0000"); - this.id = id; - } - - /** - * The integer representation of the meter id. - * - * @return a long - */ - public long id() { - return id; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - MeterId meterId = (MeterId) o; - - return id == meterId.id; - - } - - @Override - public int hashCode() { - return Long.hashCode(id); - } - - @Override - public String toString() { - return Long.toHexString(this.id); - } - - public static MeterId meterId(long id) { - return new MeterId(id); - - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterKey.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterKey.java deleted file mode 100644 index 5bc01b02..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterKey.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import com.google.common.base.Objects; -import org.onosproject.net.DeviceId; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * A meter key represents a meter uniquely. - */ -public final class MeterKey { - - private final DeviceId deviceId; - private final MeterId id; - - private MeterKey(DeviceId deviceId, MeterId id) { - this.deviceId = deviceId; - this.id = id; - } - - public DeviceId deviceId() { - return deviceId; - } - - public MeterId meterId() { - return id; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MeterKey meterKey = (MeterKey) o; - return Objects.equal(deviceId, meterKey.deviceId) && - Objects.equal(id, meterKey.id); - } - - @Override - public int hashCode() { - return Objects.hashCode(deviceId, id); - } - - @Override - public String toString() { - return toStringHelper(this) - .add("deviceId", deviceId) - .add("meterId", id).toString(); - } - - public static MeterKey key(DeviceId deviceId, MeterId id) { - return new MeterKey(deviceId, id); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterListener.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterListener.java deleted file mode 100644 index 0a5e203f..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import org.onosproject.event.EventListener; - -/** - * Entity capable of receiving Meter related events. - */ -public interface MeterListener extends EventListener<MeterEvent> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterOperation.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterOperation.java deleted file mode 100644 index 437dd269..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterOperation.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; - -/** - * Representation of an operation on the meter table. - */ -public class MeterOperation { - - - /** - * Tyoe of meter operation. - */ - public enum Type { - ADD, - REMOVE, - MODIFY - } - - private final Meter meter; - private final Type type; - - - public MeterOperation(Meter meter, Type type) { - this.meter = meter; - this.type = type; - } - - /** - * Returns the type of operation. - * - * @return type - */ - public Type type() { - return type; - } - - /** - * Returns the meter. - * - * @return a meter - */ - public Meter meter() { - return meter; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("meter", meter) - .add("type", type) - .toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MeterOperation that = (MeterOperation) o; - return Objects.equal(meter, that.meter) && - Objects.equal(type, that.type); - } - - @Override - public int hashCode() { - return Objects.hashCode(meter, type); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterOperations.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterOperations.java deleted file mode 100644 index 92b0c3aa..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterOperations.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import com.google.common.collect.ImmutableList; - -import java.util.List; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Immutable collection of meter operation to be used between - * core and provider layers of group subsystem. - * - */ -public final class MeterOperations { - private final List<MeterOperation> operations; - - /** - * Creates a immutable list of meter operation. - * - * @param operations list of meter operation - */ - public MeterOperations(List<MeterOperation> operations) { - this.operations = ImmutableList.copyOf(checkNotNull(operations)); - } - - /** - * Returns immutable list of Meter operation. - * - * @return list of Meter operation - */ - public List<MeterOperation> operations() { - return operations; - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterProvider.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterProvider.java deleted file mode 100644 index 4655e234..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.Provider; - -/** - * Abstraction of a Meter provider. - */ -public interface MeterProvider extends Provider { - - /** - * Performs a batch of meter operation on the specified device with the - * specified parameters. - * - * @param deviceId device identifier on which the batch of group - * operations to be executed - * @param meterOps immutable list of meter operation - */ - void performMeterOperation(DeviceId deviceId, - MeterOperations meterOps); - - - /** - * Performs a meter operation on the specified device with the - * specified parameters. - * - * @param deviceId device identifier on which the batch of group - * operations to be executed - * @param meterOp a meter operation - */ - void performMeterOperation(DeviceId deviceId, - MeterOperation meterOp); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterProviderRegistry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterProviderRegistry.java deleted file mode 100644 index 019ca19a..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterProviderRegistry.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - - -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction for a meter provider registry. - */ -public interface MeterProviderRegistry - extends ProviderRegistry<MeterProvider, MeterProviderService> { -} - diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterProviderService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterProviderService.java deleted file mode 100644 index 85c0c43e..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterProviderService.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderService; - -import java.util.Collection; - -/** - * Service through which meter providers can inject information - * into the core. - */ -public interface MeterProviderService extends ProviderService<MeterProvider> { - - /** - * Notifies the core that a meter operaton failed for a - * specific reason. - * @param operation the failed operation - * @param reason the failure reason - */ - void meterOperationFailed(MeterOperation operation, - MeterFailReason reason); - - /** - * Pushes the collection of meters observed on the data plane as - * well as their associated statistics. - * - * @param deviceId a device id - * @param meterEntries a collection of meter entries - */ - void pushMeterMetrics(DeviceId deviceId, - Collection<Meter> meterEntries); - - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterRequest.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterRequest.java deleted file mode 100644 index fd11ca41..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterRequest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import org.onosproject.core.ApplicationId; -import org.onosproject.net.DeviceId; - -import java.util.Collection; -import java.util.Optional; - -/** - * Represents a generalized meter request to be deployed on a device. - */ -public interface MeterRequest { - - enum Type { - ADD, - MODIFY, - REMOVE - } - - /** - * The target device for this meter. - * - * @return a device id - */ - DeviceId deviceId(); - - /** - * The id of the application which created this meter. - * - * @return an application id - */ - ApplicationId appId(); - - /** - * The unit used within this meter. - * - * @return the unit - */ - Meter.Unit unit(); - - /** - * Signals whether this meter applies to bursts only. - * - * @return a boolean - */ - boolean isBurst(); - - /** - * The collection of bands to apply on the dataplane. - * - * @return a collection of bands. - */ - Collection<Band> bands(); - - /** - * Returns the callback context for this meter. - * - * @return an optional meter context - */ - Optional<MeterContext> context(); - - /** - * A meter builder. - */ - interface Builder { - - /** - * Assigns the target device for this meter. - * - * @param deviceId a device id - * @return this - */ - Builder forDevice(DeviceId deviceId); - - /** - * Assigns the application that built this meter. - * - * @param appId an application id - * @return this - */ - Builder fromApp(ApplicationId appId); - - /** - * Assigns the @See Unit to use for this meter. - * Defaults to kb/s - * - * @param unit a unit - * @return this - */ - Builder withUnit(Meter.Unit unit); - - /** - * Sets this meter as applicable to burst traffic only. - * Defaults to false. - * - * @return this - */ - Builder burst(); - - /** - * Assigns bands to this meter. There must be at least one band. - * - * @param bands a collection of bands - * @return this - */ - Builder withBands(Collection<Band> bands); - - /** - * Assigns an execution context for this meter request. - * - * @param context a meter context - * @return this - */ - Builder withContext(MeterContext context); - - /** - * Requests the addition of a meter. - * - * @return a meter request - */ - MeterRequest add(); - - /** - * Requests the removal of a meter. - * - * @return a meter request - */ - MeterRequest remove(); - - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterService.java deleted file mode 100644 index 2e07cb67..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterService.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import org.onosproject.event.ListenerService; -import org.onosproject.net.DeviceId; - -import java.util.Collection; - -/** - * Service for add/updating and removing meters. Meters are - * are assigned to flow to rate limit them and provide a certain - * quality of service. - */ -public interface MeterService - extends ListenerService<MeterEvent, MeterListener> { - - /** - * Adds a meter to the system and performs it installation. - * - * @param meter a meter - * @return a meter (with a meter id) - */ - Meter submit(MeterRequest meter); - - /** - * Remove a meter from the system and the dataplane. - * - * @param meter a meter to remove - * @param meterId the meter id of the meter to remove. - */ - void withdraw(MeterRequest meter, MeterId meterId); - - /** - * Fetch the meter by the meter id. - * - * @param deviceId a device id - * @param id a meter id - * @return a meter - */ - Meter getMeter(DeviceId deviceId, MeterId id); - - /** - * Fetches all the meters. - * - * @return a collection of meters - */ - Collection<Meter> getAllMeters(); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterState.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterState.java deleted file mode 100644 index 3b936099..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterState.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -/** - * Represents the state of the meter as seen by the store. - */ -public enum MeterState { - - /** - * The meter is in the process of being added. - */ - PENDING_ADD, - - /** - * THe meter has been added. - */ - ADDED, - - /** - * The meter is in the process of being removed. - */ - PENDING_REMOVE, - - /** - * The meter has been removed. - */ - REMOVED, - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java deleted file mode 100644 index f429e95a..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import org.onosproject.store.Store; - -import java.util.Collection; -import java.util.concurrent.CompletableFuture; - -/** - * Entity that stores and distributed meter objects. - */ -public interface MeterStore extends Store<MeterEvent, MeterStoreDelegate> { - - /** - * Adds a meter to the store. - * - * @param meter a meter - * @return a future indicating the result of the store operation - */ - CompletableFuture<MeterStoreResult> storeMeter(Meter meter); - - /** - * Deletes a meter from the store. - * - * @param meter a meter - * @return a future indicating the result of the store operation - */ - CompletableFuture<MeterStoreResult> deleteMeter(Meter meter); - - /** - * Updates a meter whose meter id is the same as the passed meter. - * - * @param meter a new meter - * @return a future indicating the result of the store operation - */ - CompletableFuture<MeterStoreResult> updateMeter(Meter meter); - - /** - * Updates a given meter's state with the provided state. - * - * @param meter a meter - */ - void updateMeterState(Meter meter); - - /** - * Obtains a meter matching the given meter key. - * - * @param key a meter key - * @return a meter - */ - Meter getMeter(MeterKey key); - - /** - * Returns all meters stored in the store. - * - * @return a collection of meters - */ - Collection<Meter> getAllMeters(); - - /** - * Update the store by deleting the failed meter. - * Notifies the delegate that the meter failed to allow it - * to nofity the app. - * - * @param op a failed meter operation - * @param reason a failure reason - */ - void failedMeter(MeterOperation op, MeterFailReason reason); - - /** - * Delete this meter immediately. - * @param m a meter - */ - void deleteMeterNow(Meter m); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStoreDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStoreDelegate.java deleted file mode 100644 index 9bfeb42f..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStoreDelegate.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import org.onosproject.store.StoreDelegate; - -/** - * Meter store delegate abstraction. - */ -public interface MeterStoreDelegate extends StoreDelegate<MeterEvent> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStoreResult.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStoreResult.java deleted file mode 100644 index 7a26746f..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStoreResult.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.meter; - -import java.util.Optional; - -/** - * An entity used to indicate whether the store operation passed. - */ -public final class MeterStoreResult { - - - private final Type type; - private final Optional<MeterFailReason> reason; - - public enum Type { - SUCCESS, - FAIL - } - - private MeterStoreResult(Type type, MeterFailReason reason) { - this.type = type; - this.reason = Optional.ofNullable(reason); - } - - public Type type() { - return type; - } - - public Optional<MeterFailReason> reason() { - return reason; - } - - /** - * A successful store opertion. - * - * @return a meter store result - */ - public static MeterStoreResult success() { - return new MeterStoreResult(Type.SUCCESS, null); - } - - /** - * A failed store operation. - * - * @param reason a failure reason - * @return a meter store result - */ - public static MeterStoreResult fail(MeterFailReason reason) { - return new MeterStoreResult(Type.FAIL, reason); - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/package-info.java deleted file mode 100644 index 258634da..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Flow meter model and related services. - */ -package org.onosproject.net.meter;
\ No newline at end of file |