mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-18 10:51:04 +02:00
added treatment support and conversion to an instruction
moved to meter api to onos-api Change-Id: I0504f06fdc503953fa7696224d97edda43596d6e
This commit is contained in:
parent
a4122367b0
commit
10c810b199
@ -28,6 +28,7 @@ import org.onosproject.net.IndexedLambda;
|
|||||||
import org.onosproject.net.PortNumber;
|
import org.onosproject.net.PortNumber;
|
||||||
import org.onosproject.net.flow.instructions.Instruction;
|
import org.onosproject.net.flow.instructions.Instruction;
|
||||||
import org.onosproject.net.flow.instructions.Instructions;
|
import org.onosproject.net.flow.instructions.Instructions;
|
||||||
|
import org.onosproject.net.meter.MeterId;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -50,6 +51,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
|
|||||||
|
|
||||||
private static final DefaultTrafficTreatment EMPTY
|
private static final DefaultTrafficTreatment EMPTY
|
||||||
= new DefaultTrafficTreatment(Collections.emptyList());
|
= new DefaultTrafficTreatment(Collections.emptyList());
|
||||||
|
private final Instructions.MeterInstruction meter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new traffic treatment from the specified list of instructions.
|
* Creates a new traffic treatment from the specified list of instructions.
|
||||||
@ -63,6 +65,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
|
|||||||
this.hasClear = false;
|
this.hasClear = false;
|
||||||
this.table = null;
|
this.table = null;
|
||||||
this.meta = null;
|
this.meta = null;
|
||||||
|
this.meter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +80,8 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
|
|||||||
List<Instruction> immediate,
|
List<Instruction> immediate,
|
||||||
Instructions.TableTypeTransition table,
|
Instructions.TableTypeTransition table,
|
||||||
boolean clear,
|
boolean clear,
|
||||||
Instructions.MetadataInstruction meta) {
|
Instructions.MetadataInstruction meta,
|
||||||
|
Instructions.MeterInstruction meter) {
|
||||||
this.immediate = ImmutableList.copyOf(checkNotNull(immediate));
|
this.immediate = ImmutableList.copyOf(checkNotNull(immediate));
|
||||||
this.deferred = ImmutableList.copyOf(checkNotNull(deferred));
|
this.deferred = ImmutableList.copyOf(checkNotNull(deferred));
|
||||||
this.all = new ImmutableList.Builder<Instruction>()
|
this.all = new ImmutableList.Builder<Instruction>()
|
||||||
@ -87,6 +91,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
|
|||||||
this.table = table;
|
this.table = table;
|
||||||
this.meta = meta;
|
this.meta = meta;
|
||||||
this.hasClear = clear;
|
this.hasClear = clear;
|
||||||
|
this.meter = meter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -119,6 +124,11 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
|
|||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Instructions.MeterInstruction metered() {
|
||||||
|
return meter;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new traffic treatment builder.
|
* Returns a new traffic treatment builder.
|
||||||
*
|
*
|
||||||
@ -193,12 +203,16 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
|
|||||||
|
|
||||||
Instructions.MetadataInstruction meta;
|
Instructions.MetadataInstruction meta;
|
||||||
|
|
||||||
|
Instructions.MeterInstruction meter;
|
||||||
|
|
||||||
List<Instruction> deferred = Lists.newLinkedList();
|
List<Instruction> deferred = Lists.newLinkedList();
|
||||||
|
|
||||||
List<Instruction> immediate = Lists.newLinkedList();
|
List<Instruction> immediate = Lists.newLinkedList();
|
||||||
|
|
||||||
List<Instruction> current = immediate;
|
List<Instruction> current = immediate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Creates a new builder
|
// Creates a new builder
|
||||||
private Builder() {
|
private Builder() {
|
||||||
}
|
}
|
||||||
@ -233,6 +247,8 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
|
|||||||
case METADATA:
|
case METADATA:
|
||||||
meta = (Instructions.MetadataInstruction) instruction;
|
meta = (Instructions.MetadataInstruction) instruction;
|
||||||
break;
|
break;
|
||||||
|
case METER:
|
||||||
|
meter = (Instructions.MeterInstruction) instruction;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unknown instruction type: " +
|
throw new IllegalArgumentException("Unknown instruction type: " +
|
||||||
instruction.type());
|
instruction.type());
|
||||||
@ -342,6 +358,11 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
|
|||||||
return add(Instructions.createGroup(groupId));
|
return add(Instructions.createGroup(groupId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TrafficTreatment.Builder meter(MeterId meterId) {
|
||||||
|
return add(Instructions.meterTraffic(meterId));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Builder popVlan() {
|
public Builder popVlan() {
|
||||||
return add(Instructions.popVlan());
|
return add(Instructions.popVlan());
|
||||||
@ -420,7 +441,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
|
|||||||
// && table == null && !clear) {
|
// && table == null && !clear) {
|
||||||
// drop();
|
// drop();
|
||||||
//}
|
//}
|
||||||
return new DefaultTrafficTreatment(deferred, immediate, table, clear, meta);
|
return new DefaultTrafficTreatment(deferred, immediate, table, clear, meta, meter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import org.onosproject.core.GroupId;
|
|||||||
import org.onosproject.net.PortNumber;
|
import org.onosproject.net.PortNumber;
|
||||||
import org.onosproject.net.flow.instructions.Instruction;
|
import org.onosproject.net.flow.instructions.Instruction;
|
||||||
import org.onosproject.net.flow.instructions.Instructions;
|
import org.onosproject.net.flow.instructions.Instructions;
|
||||||
|
import org.onosproject.net.meter.MeterId;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -74,6 +75,13 @@ public interface TrafficTreatment {
|
|||||||
*/
|
*/
|
||||||
Instructions.MetadataInstruction writeMetadata();
|
Instructions.MetadataInstruction writeMetadata();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the meter instruction if there is one.
|
||||||
|
*
|
||||||
|
* @return a meter instruction that may be null
|
||||||
|
*/
|
||||||
|
Instructions.MeterInstruction metered();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder of traffic treatment entities.
|
* Builder of traffic treatment entities.
|
||||||
*/
|
*/
|
||||||
@ -243,6 +251,13 @@ public interface TrafficTreatment {
|
|||||||
*/
|
*/
|
||||||
Builder group(GroupId groupId);
|
Builder group(GroupId groupId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a meter to be used by this flow.
|
||||||
|
*
|
||||||
|
* @param meterId a meter id
|
||||||
|
* @return a treatment builder
|
||||||
|
*/
|
||||||
|
Builder meter(MeterId meterId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the next table type to transition to.
|
* Sets the next table type to transition to.
|
||||||
|
@ -39,6 +39,11 @@ public interface Instruction {
|
|||||||
*/
|
*/
|
||||||
GROUP,
|
GROUP,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signifies that traffic should be metered according to a meter.
|
||||||
|
*/
|
||||||
|
METER,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signifies that the traffic should be modified in L0 way.
|
* Signifies that the traffic should be modified in L0 way.
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +34,7 @@ import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6Fl
|
|||||||
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModTtlInstruction;
|
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModTtlInstruction;
|
||||||
import org.onosproject.net.flow.instructions.L4ModificationInstruction.L4SubType;
|
import org.onosproject.net.flow.instructions.L4ModificationInstruction.L4SubType;
|
||||||
import org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction;
|
import org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction;
|
||||||
|
import org.onosproject.net.meter.MeterId;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -81,6 +82,11 @@ public final class Instructions {
|
|||||||
return new GroupInstruction(groupId);
|
return new GroupInstruction(groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MeterInstruction meterTraffic(final MeterId meterId) {
|
||||||
|
checkNotNull(meterId, "meter id cannot be null");
|
||||||
|
return new MeterInstruction(meterId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a l0 modification.
|
* Creates a l0 modification.
|
||||||
*
|
*
|
||||||
@ -527,6 +533,50 @@ public final class Instructions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A meter instruction.
|
||||||
|
*/
|
||||||
|
public static final class MeterInstruction implements Instruction {
|
||||||
|
private final MeterId meterId;
|
||||||
|
|
||||||
|
private MeterInstruction(MeterId meterId) {
|
||||||
|
this.meterId = meterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MeterId meterId() {
|
||||||
|
return meterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type type() {
|
||||||
|
return Type.METER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return toStringHelper(type().toString())
|
||||||
|
.add("meter ID", meterId.id()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(type().ordinal(), meterId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj instanceof MeterInstruction) {
|
||||||
|
MeterInstruction that = (MeterInstruction) obj;
|
||||||
|
return Objects.equals(meterId, that.meterId);
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transition instruction.
|
* Transition instruction.
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a band used within a meter.
|
* Represents a band used within a meter.
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a stored band.
|
* Represents a stored band.
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import org.onosproject.core.ApplicationId;
|
import org.onosproject.core.ApplicationId;
|
||||||
import org.onosproject.net.DeviceId;
|
import org.onosproject.net.DeviceId;
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import org.onosproject.core.ApplicationId;
|
import org.onosproject.core.ApplicationId;
|
||||||
import org.onosproject.net.DeviceId;
|
import org.onosproject.net.DeviceId;
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A context permitting the application to be notified when the
|
* A context permitting the application to be notified when the
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a stored meter.
|
* Represents a stored meter.
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import org.onosproject.event.AbstractEvent;
|
import org.onosproject.event.AbstractEvent;
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum used to represent a meter failure condition.
|
* Enum used to represent a meter failure condition.
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import org.onosproject.event.EventListener;
|
import org.onosproject.event.EventListener;
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import org.onosproject.net.DeviceId;
|
import org.onosproject.net.DeviceId;
|
||||||
import org.onosproject.net.provider.Provider;
|
import org.onosproject.net.provider.Provider;
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
|
|
||||||
import org.onosproject.net.provider.ProviderRegistry;
|
import org.onosproject.net.provider.ProviderRegistry;
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import org.onosproject.net.DeviceId;
|
import org.onosproject.net.DeviceId;
|
||||||
import org.onosproject.net.provider.ProviderService;
|
import org.onosproject.net.provider.ProviderService;
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import org.onosproject.event.ListenerService;
|
import org.onosproject.event.ListenerService;
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the state of the meter as seen by the store.
|
* Represents the state of the meter as seen by the store.
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import org.onosproject.store.Store;
|
import org.onosproject.store.Store;
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import org.onosproject.store.StoreDelegate;
|
import org.onosproject.store.StoreDelegate;
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
@ -17,4 +17,4 @@
|
|||||||
/**
|
/**
|
||||||
* Flow meter model and related services.
|
* Flow meter model and related services.
|
||||||
*/
|
*/
|
||||||
package org.onosproject.incubator.net.meter;
|
package org.onosproject.net.meter;
|
@ -124,6 +124,11 @@ public class IntentTestsMocks {
|
|||||||
public MetadataInstruction writeMetadata() {
|
public MetadataInstruction writeMetadata() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Instructions.MeterInstruction metered() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -610,6 +610,11 @@ public class FlowRuleManagerTest {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Instructions.MeterInstruction metered() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestApplicationId extends DefaultApplicationId {
|
public class TestApplicationId extends DefaultApplicationId {
|
||||||
|
@ -160,6 +160,7 @@ import org.onosproject.net.intent.constraint.ObstacleConstraint;
|
|||||||
import org.onosproject.net.intent.constraint.PartialFailureConstraint;
|
import org.onosproject.net.intent.constraint.PartialFailureConstraint;
|
||||||
import org.onosproject.net.intent.constraint.WaypointConstraint;
|
import org.onosproject.net.intent.constraint.WaypointConstraint;
|
||||||
import org.onosproject.net.link.DefaultLinkDescription;
|
import org.onosproject.net.link.DefaultLinkDescription;
|
||||||
|
import org.onosproject.net.meter.MeterId;
|
||||||
import org.onosproject.net.newresource.ResourceAllocation;
|
import org.onosproject.net.newresource.ResourceAllocation;
|
||||||
import org.onosproject.net.newresource.ResourcePath;
|
import org.onosproject.net.newresource.ResourcePath;
|
||||||
import org.onosproject.net.packet.DefaultOutboundPacket;
|
import org.onosproject.net.packet.DefaultOutboundPacket;
|
||||||
@ -271,6 +272,8 @@ public final class KryoNamespaces {
|
|||||||
.register(MISC)
|
.register(MISC)
|
||||||
.nextId(KryoNamespace.INITIAL_ID + 30 + 10)
|
.nextId(KryoNamespace.INITIAL_ID + 30 + 10)
|
||||||
.register(
|
.register(
|
||||||
|
Instructions.MeterInstruction.class,
|
||||||
|
MeterId.class,
|
||||||
Version.class,
|
Version.class,
|
||||||
ControllerNode.State.class,
|
ControllerNode.State.class,
|
||||||
ApplicationState.class,
|
ApplicationState.class,
|
||||||
|
@ -22,21 +22,21 @@ import org.apache.felix.scr.annotations.Reference;
|
|||||||
import org.apache.felix.scr.annotations.ReferenceCardinality;
|
import org.apache.felix.scr.annotations.ReferenceCardinality;
|
||||||
import org.apache.felix.scr.annotations.Service;
|
import org.apache.felix.scr.annotations.Service;
|
||||||
import org.onlab.util.TriConsumer;
|
import org.onlab.util.TriConsumer;
|
||||||
import org.onosproject.incubator.net.meter.DefaultMeter;
|
import org.onosproject.net.meter.DefaultMeter;
|
||||||
import org.onosproject.incubator.net.meter.Meter;
|
import org.onosproject.net.meter.Meter;
|
||||||
import org.onosproject.incubator.net.meter.MeterEvent;
|
import org.onosproject.net.meter.MeterEvent;
|
||||||
import org.onosproject.incubator.net.meter.MeterFailReason;
|
import org.onosproject.net.meter.MeterFailReason;
|
||||||
import org.onosproject.incubator.net.meter.MeterId;
|
import org.onosproject.net.meter.MeterId;
|
||||||
import org.onosproject.incubator.net.meter.MeterListener;
|
import org.onosproject.net.meter.MeterListener;
|
||||||
import org.onosproject.incubator.net.meter.MeterOperation;
|
import org.onosproject.net.meter.MeterOperation;
|
||||||
import org.onosproject.incubator.net.meter.MeterProvider;
|
import org.onosproject.net.meter.MeterProvider;
|
||||||
import org.onosproject.incubator.net.meter.MeterProviderRegistry;
|
import org.onosproject.net.meter.MeterProviderRegistry;
|
||||||
import org.onosproject.incubator.net.meter.MeterProviderService;
|
import org.onosproject.net.meter.MeterProviderService;
|
||||||
import org.onosproject.incubator.net.meter.MeterService;
|
import org.onosproject.net.meter.MeterService;
|
||||||
import org.onosproject.incubator.net.meter.MeterState;
|
import org.onosproject.net.meter.MeterState;
|
||||||
import org.onosproject.incubator.net.meter.MeterStore;
|
import org.onosproject.net.meter.MeterStore;
|
||||||
import org.onosproject.incubator.net.meter.MeterStoreDelegate;
|
import org.onosproject.net.meter.MeterStoreDelegate;
|
||||||
import org.onosproject.incubator.net.meter.MeterStoreResult;
|
import org.onosproject.net.meter.MeterStoreResult;
|
||||||
import org.onosproject.net.DeviceId;
|
import org.onosproject.net.DeviceId;
|
||||||
import org.onosproject.net.provider.AbstractListenerProviderRegistry;
|
import org.onosproject.net.provider.AbstractListenerProviderRegistry;
|
||||||
import org.onosproject.net.provider.AbstractProviderService;
|
import org.onosproject.net.provider.AbstractProviderService;
|
||||||
|
@ -23,16 +23,16 @@ import org.apache.felix.scr.annotations.Reference;
|
|||||||
import org.apache.felix.scr.annotations.ReferenceCardinality;
|
import org.apache.felix.scr.annotations.ReferenceCardinality;
|
||||||
import org.onosproject.cluster.ClusterService;
|
import org.onosproject.cluster.ClusterService;
|
||||||
import org.onosproject.cluster.NodeId;
|
import org.onosproject.cluster.NodeId;
|
||||||
import org.onosproject.incubator.net.meter.DefaultMeter;
|
import org.onosproject.net.meter.DefaultMeter;
|
||||||
import org.onosproject.incubator.net.meter.Meter;
|
import org.onosproject.net.meter.Meter;
|
||||||
import org.onosproject.incubator.net.meter.MeterEvent;
|
import org.onosproject.net.meter.MeterEvent;
|
||||||
import org.onosproject.incubator.net.meter.MeterFailReason;
|
import org.onosproject.net.meter.MeterFailReason;
|
||||||
import org.onosproject.incubator.net.meter.MeterId;
|
import org.onosproject.net.meter.MeterId;
|
||||||
import org.onosproject.incubator.net.meter.MeterOperation;
|
import org.onosproject.net.meter.MeterOperation;
|
||||||
import org.onosproject.incubator.net.meter.MeterState;
|
import org.onosproject.net.meter.MeterState;
|
||||||
import org.onosproject.incubator.net.meter.MeterStore;
|
import org.onosproject.net.meter.MeterStore;
|
||||||
import org.onosproject.incubator.net.meter.MeterStoreDelegate;
|
import org.onosproject.net.meter.MeterStoreDelegate;
|
||||||
import org.onosproject.incubator.net.meter.MeterStoreResult;
|
import org.onosproject.net.meter.MeterStoreResult;
|
||||||
import org.onosproject.mastership.MastershipService;
|
import org.onosproject.mastership.MastershipService;
|
||||||
import org.onosproject.store.AbstractStore;
|
import org.onosproject.store.AbstractStore;
|
||||||
import org.onosproject.store.serializers.KryoNamespaces;
|
import org.onosproject.store.serializers.KryoNamespaces;
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
package org.onosproject.incubator.store.meter.impl;
|
package org.onosproject.incubator.store.meter.impl;
|
||||||
|
|
||||||
import org.onosproject.cluster.NodeId;
|
import org.onosproject.cluster.NodeId;
|
||||||
import org.onosproject.incubator.net.meter.Meter;
|
import org.onosproject.net.meter.Meter;
|
||||||
import org.onosproject.incubator.net.meter.MeterFailReason;
|
import org.onosproject.net.meter.MeterFailReason;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -161,6 +161,9 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
|
|||||||
if (treatment.writeMetadata() != null) {
|
if (treatment.writeMetadata() != null) {
|
||||||
instructions.add(buildMetadata(treatment.writeMetadata()));
|
instructions.add(buildMetadata(treatment.writeMetadata()));
|
||||||
}
|
}
|
||||||
|
if (treatment.metered() != null) {
|
||||||
|
instructions.add(buildMeter(treatment.metered()));
|
||||||
|
}
|
||||||
|
|
||||||
long cookie = flowRule().id().value();
|
long cookie = flowRule().id().value();
|
||||||
|
|
||||||
@ -263,6 +266,11 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
|
|||||||
return instruction;
|
return instruction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private OFInstruction buildMeter(Instructions.MeterInstruction metered) {
|
||||||
|
return factory().instructions().meter(metered.meterId().id());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private OFAction buildL0Modification(Instruction i) {
|
private OFAction buildL0Modification(Instruction i) {
|
||||||
L0ModificationInstruction l0m = (L0ModificationInstruction) i;
|
L0ModificationInstruction l0m = (L0ModificationInstruction) i;
|
||||||
switch (l0m.subtype()) {
|
switch (l0m.subtype()) {
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.onosproject.provider.of.meter.impl;
|
package org.onosproject.provider.of.meter.impl;
|
||||||
|
|
||||||
import org.onosproject.incubator.net.meter.Band;
|
import org.onosproject.net.meter.Band;
|
||||||
import org.onosproject.incubator.net.meter.Meter;
|
import org.onosproject.net.meter.Meter;
|
||||||
import org.onosproject.incubator.net.meter.MeterId;
|
import org.onosproject.net.meter.MeterId;
|
||||||
import org.projectfloodlight.openflow.protocol.OFFactory;
|
import org.projectfloodlight.openflow.protocol.OFFactory;
|
||||||
import org.projectfloodlight.openflow.protocol.OFMeterFlags;
|
import org.projectfloodlight.openflow.protocol.OFMeterFlags;
|
||||||
import org.projectfloodlight.openflow.protocol.OFMeterMod;
|
import org.projectfloodlight.openflow.protocol.OFMeterMod;
|
||||||
|
@ -28,17 +28,17 @@ import org.apache.felix.scr.annotations.Deactivate;
|
|||||||
import org.apache.felix.scr.annotations.Reference;
|
import org.apache.felix.scr.annotations.Reference;
|
||||||
import org.apache.felix.scr.annotations.ReferenceCardinality;
|
import org.apache.felix.scr.annotations.ReferenceCardinality;
|
||||||
import org.onosproject.core.CoreService;
|
import org.onosproject.core.CoreService;
|
||||||
import org.onosproject.incubator.net.meter.Band;
|
import org.onosproject.net.meter.Band;
|
||||||
import org.onosproject.incubator.net.meter.DefaultBand;
|
import org.onosproject.net.meter.DefaultBand;
|
||||||
import org.onosproject.incubator.net.meter.DefaultMeter;
|
import org.onosproject.net.meter.DefaultMeter;
|
||||||
import org.onosproject.incubator.net.meter.Meter;
|
import org.onosproject.net.meter.Meter;
|
||||||
import org.onosproject.incubator.net.meter.MeterFailReason;
|
import org.onosproject.net.meter.MeterFailReason;
|
||||||
import org.onosproject.incubator.net.meter.MeterOperation;
|
import org.onosproject.net.meter.MeterOperation;
|
||||||
import org.onosproject.incubator.net.meter.MeterOperations;
|
import org.onosproject.net.meter.MeterOperations;
|
||||||
import org.onosproject.incubator.net.meter.MeterProvider;
|
import org.onosproject.net.meter.MeterProvider;
|
||||||
import org.onosproject.incubator.net.meter.MeterProviderRegistry;
|
import org.onosproject.net.meter.MeterProviderRegistry;
|
||||||
import org.onosproject.incubator.net.meter.MeterProviderService;
|
import org.onosproject.net.meter.MeterProviderService;
|
||||||
import org.onosproject.incubator.net.meter.MeterState;
|
import org.onosproject.net.meter.MeterState;
|
||||||
import org.onosproject.net.DeviceId;
|
import org.onosproject.net.DeviceId;
|
||||||
import org.onosproject.net.provider.AbstractProvider;
|
import org.onosproject.net.provider.AbstractProvider;
|
||||||
import org.onosproject.net.provider.ProviderId;
|
import org.onosproject.net.provider.ProviderId;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user