diff options
author | Ashlee Young <ashlee@onosfw.com> | 2015-10-09 18:32:44 -0700 |
---|---|---|
committer | Ashlee Young <ashlee@onosfw.com> | 2015-10-09 18:32:44 -0700 |
commit | 6a07d2d622eaa06953f3353e39c080984076e8de (patch) | |
tree | bfb50a2090fce186c2cc545a400c969bf2ea702b /framework/src/onos/core/api/src/main/java/org/onosproject/net/flow | |
parent | e6d71622143ff9b2421a1abbe8434b954b5b1099 (diff) |
Updated master to commit id 6ee8aa3e67ce89908a8c93aa9445c6f71a18f986
Change-Id: I94b055ee2f298daf71e2ec794fd0f2495bd8081f
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/flow')
15 files changed, 472 insertions, 157 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTableStatisticsEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTableStatisticsEntry.java new file mode 100644 index 00000000..929b285d --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTableStatisticsEntry.java @@ -0,0 +1,89 @@ +/* + * 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.flow; + +import org.onosproject.net.DeviceId; +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * Default implementation of table statistics entry interface. + */ +public final class DefaultTableStatisticsEntry implements TableStatisticsEntry { + + private final DeviceId deviceId; + private final int tableId; + private final long activeFlowEntries; + private final long packetsLookedupCount; + private final long packetsMatchedCount; + + /** + * Default table statistics constructor. + * + * @param deviceId device identifier + * @param tableId table identifier + * @param activeFlowEntries number of active flow entries in the table + * @param packetsLookedupCount number of packets looked up in table + * @param packetsMatchedCount number of packets that hit table + */ + public DefaultTableStatisticsEntry(DeviceId deviceId, + int tableId, + long activeFlowEntries, + long packetsLookedupCount, + long packetsMatchedCount) { + this.deviceId = checkNotNull(deviceId); + this.tableId = tableId; + this.activeFlowEntries = activeFlowEntries; + this.packetsLookedupCount = packetsLookedupCount; + this.packetsMatchedCount = packetsMatchedCount; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("device: " + deviceId + ", "); + + sb.append("tableId: " + this.tableId + ", "); + sb.append("activeEntries: " + this.activeFlowEntries + ", "); + sb.append("packetsLookedUp: " + this.packetsLookedupCount + ", "); + sb.append("packetsMatched: " + this.packetsMatchedCount); + + return sb.toString(); + } + + @Override + public int tableId() { + return tableId; + } + + @Override + public long activeFlowEntries() { + return activeFlowEntries; + } + + @Override + public long packetsLookedup() { + return packetsLookedupCount; + } + + @Override + public long packetsMatched() { + return packetsMatchedCount; + } + + @Override + public DeviceId deviceId() { + return deviceId; + } +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java index f88c6bc3..4416456c 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java @@ -23,22 +23,26 @@ import org.onlab.packet.MacAddress; import org.onlab.packet.MplsLabel; import org.onlab.packet.TpPort; import org.onlab.packet.VlanId; -import org.onosproject.net.IndexedLambda; import org.onosproject.net.PortNumber; import org.onosproject.net.flow.criteria.Criteria; import org.onosproject.net.flow.criteria.Criterion; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.TreeSet; /** * Default traffic selector implementation. */ public final class DefaultTrafficSelector implements TrafficSelector { + private static final Comparator<? super Criterion> TYPE_COMPARATOR = + (c1, c2) -> c1.type().compareTo(c2.type()); + private final Set<Criterion> criteria; private static final TrafficSelector EMPTY @@ -50,7 +54,9 @@ public final class DefaultTrafficSelector implements TrafficSelector { * @param criteria criteria */ private DefaultTrafficSelector(Set<Criterion> criteria) { - this.criteria = ImmutableSet.copyOf(criteria); + TreeSet<Criterion> elements = new TreeSet<>(TYPE_COMPARATOR); + elements.addAll(criteria); + this.criteria = ImmutableSet.copyOf(elements); } @Override @@ -345,18 +351,6 @@ public final class DefaultTrafficSelector implements TrafficSelector { return add(Criteria.matchIPv6ExthdrFlags(exthdrFlags)); } - @Deprecated - @Override - public Builder matchLambda(short lambda) { - return add(Criteria.matchLambda(new IndexedLambda(lambda))); - } - - @Deprecated - @Override - public Builder matchOpticalSignalType(short signalType) { - return add(Criteria.matchOpticalSignalType(signalType)); - } - @Override public TrafficSelector build() { return new DefaultTrafficSelector(ImmutableSet.copyOf(selector.values())); diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java index 5d18a9ad..a628725c 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java @@ -31,7 +31,6 @@ import org.onosproject.net.flow.instructions.Instruction; import org.onosproject.net.flow.instructions.Instructions; import org.onosproject.net.meter.MeterId; -import java.util.Collections; import java.util.List; import java.util.Objects; @@ -51,7 +50,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { private final boolean hasClear; private static final DefaultTrafficTreatment EMPTY - = new DefaultTrafficTreatment(Collections.emptyList()); + = new DefaultTrafficTreatment(ImmutableList.of(Instructions.createNoAction())); private final Instructions.MeterInstruction meter; /** @@ -212,8 +211,6 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { List<Instruction> current = immediate; - - // Creates a new builder private Builder() { } @@ -224,7 +221,10 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { treatment.deferred().forEach(i -> add(i)); immediate(); - treatment.immediate().forEach(i -> add(i)); + treatment.immediate().stream() + // NOACTION will get re-added if there are no other actions + .filter(i -> i.type() != Instruction.Type.NOACTION) + .forEach(i -> add(i)); clear = treatment.clearedDeferred(); } @@ -234,6 +234,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { switch (instruction.type()) { case DROP: + case NOACTION: case OUTPUT: case GROUP: case L0MODIFICATION: @@ -250,6 +251,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { break; case METER: meter = (Instructions.MeterInstruction) instruction; + break; default: throw new IllegalArgumentException("Unknown instruction type: " + instruction.type()); @@ -258,9 +260,23 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { return this; } + /** + * Add a NOACTION when DROP instruction is explicitly specified. + * + * @return the traffic treatment builder + */ @Override public Builder drop() { - return add(Instructions.createDrop()); + return add(Instructions.createNoAction()); + } + + /** + * Add a NOACTION when no instruction is specified. + * + * @return the traffic treatment builder + */ + private Builder noAction() { + return add(Instructions.createNoAction()); } @Override @@ -380,11 +396,6 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { } @Override - public Builder transition(FlowRule.Type type) { - return add(Instructions.transition(type.ordinal())); - } - - @Override public Builder transition(Integer tableId) { return add(Instructions.transition(tableId)); } @@ -463,14 +474,11 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { @Override public TrafficTreatment build() { - //Don't add DROP instruction by default when instruction - //set is empty. This will be handled in DefaultSingleTablePipeline - //driver. - - //if (deferred.size() == 0 && immediate.size() == 0 - // && table == null && !clear) { - // drop(); - //} + if (deferred.size() == 0 && immediate.size() == 0 + && table == null && !clear) { + immediate(); + noAction(); + } return new DefaultTrafficTreatment(deferred, immediate, table, clear, meta, meter); } diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java new file mode 100644 index 00000000..afceb14e --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java @@ -0,0 +1,122 @@ +/*
+ * 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.flow;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Default flow entry class with FlowLiveType value, IMMEDIATE_FLOW, SHORT_FLOW, MID_FLOW, LONG_FLOW.
+ */
+public class DefaultTypedFlowEntry extends DefaultFlowEntry
+ implements TypedStoredFlowEntry {
+ private FlowLiveType liveType;
+
+ /**
+ * Creates a typed flow entry from flow rule and its statistics, with default flow live type(IMMEDIATE_FLOW).
+ *
+ * @param rule the flow rule
+ * @param state the flow state
+ * @param life the flow duration since creation
+ * @param packets the flow packets count
+ * @param bytes the flow bytes count
+ *
+ */
+ public DefaultTypedFlowEntry(FlowRule rule, FlowEntryState state,
+ long life, long packets, long bytes) {
+ super(rule, state, life, packets, bytes);
+ this.liveType = FlowLiveType.IMMEDIATE_FLOW;
+ }
+
+ /**
+ * Creates a typed flow entry from flow rule, with default flow live type(IMMEDIATE_FLOW).
+ *
+ * @param rule the flow rule
+ *
+ */
+ public DefaultTypedFlowEntry(FlowRule rule) {
+ super(rule);
+ this.liveType = FlowLiveType.IMMEDIATE_FLOW;
+ }
+
+ /**
+ * Creates a typed flow entry from flow entry, with default flow live type(IMMEDIATE_FLOW).
+ *
+ * @param fe the flow entry
+ *
+ */
+ public DefaultTypedFlowEntry(FlowEntry fe) {
+ super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes());
+ this.liveType = FlowLiveType.IMMEDIATE_FLOW;
+ }
+
+ /**
+ * Creates a typed flow entry from flow rule and flow live type.
+ *
+ * @param rule the flow rule
+ * @param liveType the flow live type
+ *
+ */
+ public DefaultTypedFlowEntry(FlowRule rule, FlowLiveType liveType) {
+ super(rule);
+ this.liveType = liveType;
+ }
+
+ /**
+ * Creates a typed flow entry from flow entry and flow live type.
+ *
+ * @param fe the flow rule
+ * @param liveType the flow live type
+ *
+ */
+ public DefaultTypedFlowEntry(FlowEntry fe, FlowLiveType liveType) {
+ super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes());
+ this.liveType = liveType;
+ }
+
+ /**
+ * Creates a typed flow entry from flow rule, error code and flow live type.
+ *
+ * @param rule the flow rule
+ * @param errType the flow error type
+ * @param errCode the flow error code
+ * @param liveType the flow live type
+ *
+ */
+ public DefaultTypedFlowEntry(FlowRule rule, int errType, int errCode, FlowLiveType liveType) {
+ super(rule, errType, errCode);
+ this.liveType = liveType;
+ }
+
+ @Override
+ public FlowLiveType flowLiveType() {
+ return this.liveType;
+ }
+
+ @Override
+ public void setFlowLiveType(FlowLiveType liveType) {
+ this.liveType = liveType;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("entry", super.toString())
+ .add("type", liveType)
+ .toString();
+ }
+}
+
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java index a487cbc4..35d45fbd 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java @@ -29,43 +29,6 @@ public interface FlowRule { int MIN_PRIORITY = 0; /** - * The FlowRule type is used to determine in which table the flow rule needs - * to be put for multi-table support switch. For single table switch, - * Default is used. - * - * @deprecated in Cardinal Release - */ - @Deprecated - enum Type { - /* - * Default type - used in flow rule for single table switch NOTE: this - * setting should not be used as Table 0 in a multi-table pipeline - */ - DEFAULT, - /* Used in flow entry for IP table */ - IP, - /* Used in flow entry for MPLS table */ - MPLS, - /* Used in flow entry for ACL table */ - ACL, - - /* VLAN-to-MPLS table */ - VLAN_MPLS, - - /* VLAN table */ - VLAN, - - /* Ethtype table */ - ETHER, - - /* Class of Service table */ - COS, - - /* Table 0 in a multi-table pipeline */ - FIRST, - } - - /** * Returns the ID of this flow. * * @return the flow ID diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleProviderService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleProviderService.java index 8a36a921..aefa96b4 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleProviderService.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleProviderService.java @@ -15,6 +15,8 @@ */ package org.onosproject.net.flow; +import java.util.List; + import org.onosproject.net.DeviceId; import org.onosproject.net.provider.ProviderService; @@ -41,6 +43,24 @@ public interface FlowRuleProviderService extends ProviderService<FlowRuleProvide void pushFlowMetrics(DeviceId deviceId, Iterable<FlowEntry> flowEntries); /** + * Pushes the collection of flow entries currently applied on the given + * device without flowMissing process. + * + * @param deviceId device identifier + * @param flowEntries collection of flow rules + */ + void pushFlowMetricsWithoutFlowMissing(DeviceId deviceId, Iterable<FlowEntry> flowEntries); + + /** + * Pushes the collection of table statistics entries currently extracted + * from the given device. + * + * @param deviceId device identifier + * @param tableStatsEntries collection of flow table statistics entries + */ + void pushTableStatistics(DeviceId deviceId, List<TableStatisticsEntry> tableStatsEntries); + + /** * Indicates to the core that the requested batch operation has * been completed. * @@ -48,5 +68,4 @@ public interface FlowRuleProviderService extends ProviderService<FlowRuleProvide * @param operation the resulting outcome of the operation */ void batchOperationCompleted(long batchId, CompletedBatchOperation operation); - } diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java index d4f959c3..ee8d5a98 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java @@ -104,4 +104,11 @@ public interface FlowRuleService */ void apply(FlowRuleOperations ops); + /** + * Returns the collection of flow table statistics of the specified device. + * + * @param deviceId device identifier + * @return collection of flow table statistics + */ + Iterable<TableStatisticsEntry> getFlowTableStatistics(DeviceId deviceId); } diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleStore.java index cece9893..d81c73c9 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleStore.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleStore.java @@ -15,6 +15,8 @@ */ package org.onosproject.net.flow; +import java.util.List; + import org.onosproject.net.DeviceId; import org.onosproject.store.Store; @@ -93,4 +95,23 @@ public interface FlowRuleStore extends Store<FlowRuleBatchEvent, FlowRuleStoreDe * @return flow_removed event, or null if nothing removed */ FlowRuleEvent removeFlowRule(FlowEntry rule); + + /** + * Updates the flow table statistics of the specified device using + * the given statistics. + * + * @param deviceId device identifier + * @param tableStats list of table statistics + * @return ready to send event describing what occurred; + */ + FlowRuleEvent updateTableStatistics(DeviceId deviceId, + List<TableStatisticsEntry> tableStats); + + /** + * Returns the flow table statistics associated with a device. + * + * @param deviceId the device ID + * @return the flow table statistics + */ + Iterable<TableStatisticsEntry> getTableStatistics(DeviceId deviceId); } diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TableStatisticsEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TableStatisticsEntry.java new file mode 100644 index 00000000..563f31ce --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TableStatisticsEntry.java @@ -0,0 +1,59 @@ +/* + * 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.flow; + +import org.onosproject.net.DeviceId; + +/** + * Interface for flow table statistics of a device. + */ +public interface TableStatisticsEntry { + + /** + * Returns the device Id. + * + * @return device id + */ + DeviceId deviceId(); + + /** + * Returns the table number. + * + * @return table number + */ + int tableId(); + + /** + * Returns the number of active flow entries in this table. + * + * @return the number of active flow entries + */ + long activeFlowEntries(); + + /** + * Returns the number of packets looked up in the table. + * + * @return the number of packets looked up in the table + */ + long packetsLookedup(); + + /** + * Returns the number of packets that successfully matched in the table. + * + * @return the number of packets that successfully matched in the table + */ + long packetsMatched(); +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java index 534f6b9e..1286ffc1 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java @@ -386,30 +386,6 @@ public interface TrafficSelector { Builder matchIPv6ExthdrFlags(short exthdrFlags); /** - * Matches an optical signal ID or lambda. - * - * @param lambda lambda - * @return a selection builder - * @deprecated in Cardinal Release. - * Use {@link #add(Criterion)} with an instance created - * by {@link org.onosproject.net.flow.criteria.Criteria#matchLambda(org.onosproject.net.Lambda)}. - */ - @Deprecated - Builder matchLambda(short lambda); - - /** - * Matches an optical Signal Type. - * - * @param signalType signalType - * @return a selection builder - * @deprecated in Cardinal Release. - * Use {@link #add(Criterion)}} with an instance created - * by {@link org.onosproject.net.flow.criteria.Criteria#matchOchSignalType(org.onosproject.net.OchSignalType)}. - */ - @Deprecated - Builder matchOpticalSignalType(short signalType); - - /** * Builds an immutable traffic selector. * * @return traffic selector diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java index 1ce669c2..33753afa 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java @@ -269,16 +269,6 @@ public interface TrafficTreatment { Builder meter(MeterId meterId); /** - * Sets the next table type to transition to. - * - * @param type the table type - * @return a treatement builder - * @deprecated in Cardinal Release - */ - @Deprecated - Builder transition(FlowRule.Type type); - - /** * Sets the next table id to transition to. * * @param tableId the table table diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java new file mode 100644 index 00000000..a93dc071 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java @@ -0,0 +1,65 @@ +/*
+ * 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.flow;
+
+/**
+ * Represents a flow live type for a given flow entry.
+ */
+public interface TypedStoredFlowEntry extends StoredFlowEntry {
+ enum FlowLiveType {
+ /**
+ * Indicates that this rule has been submitted for addition immediately.
+ * Not necessarily collecting flow stats.
+ */
+ IMMEDIATE_FLOW,
+
+ /**
+ * Indicates that this rule has been submitted for a short time.
+ * Necessarily collecting flow stats every calAndPollInterval.
+ */
+ SHORT_FLOW,
+
+ /**
+ * Indicates that this rule has been submitted for a mid time.
+ * Necessarily collecting flow stats every midPollInterval.
+ */
+ MID_FLOW,
+
+ /**
+ * Indicates that this rule has been submitted for a long time.
+ * Necessarily collecting flow stats every longPollInterval.
+ */
+ LONG_FLOW,
+
+ /**
+ * Indicates that this rule has been submitted for UNKNOWN or ERROR.
+ * Not necessarily collecting flow stats.
+ */
+ UNKNOWN_FLOW
+ }
+
+ /**
+ * Gets the flow live type for this entry.
+ */
+ FlowLiveType flowLiveType();
+
+ /**
+ * Sets the new flow live type for this entry.
+ * @param liveType new flow live type.
+ */
+ void setFlowLiveType(FlowLiveType liveType);
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java index 0252cfbc..7e1d43a5 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java @@ -461,18 +461,6 @@ public final class Criteria { } /** - * Creates a match on lambda field using the specified value. - * - * @param lambda lambda to match on (16 bits unsigned integer) - * @return match criterion - * @deprecated in Cardinal Release. Use {@link #matchLambda(Lambda)} instead. - */ - @Deprecated - public static Criterion matchLambda(int lambda) { - return new LambdaCriterion(lambda, Type.OCH_SIGID); - } - - /** * Creates a match on lambda using the specified value. * * @param lambda lambda @@ -489,18 +477,6 @@ public final class Criteria { } /** - * Creates a match on optical signal type using the specified value. - * - * @param sigType optical signal type (8 bits unsigned integer) - * @return match criterion - * @deprecated in Cardinal Release - */ - @Deprecated - public static Criterion matchOpticalSignalType(short sigType) { - return new OpticalSignalTypeCriterion(sigType, Type.OCH_SIGTYPE); - } - - /** * Create a match on OCh (Optical Channel) signal type. * * @param signalType OCh signal type diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java index 6f2cac6b..d01ea298 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java @@ -27,9 +27,18 @@ public interface Instruction { /** * Signifies that the traffic should be dropped. */ + @Deprecated DROP, /** + * Signifies that the traffic requires no action. + * + * In OF10, the behavior of NOACTION is DROP. + * In OF13, the behavior depends on current Action Set. + */ + NOACTION, + + /** * Signifies that the traffic should be output to a port. */ OUTPUT, diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java index c5358a29..c9f10685 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java @@ -68,11 +68,21 @@ public final class Instructions { * * @return drop instruction */ + @Deprecated public static DropInstruction createDrop() { return new DropInstruction(); } /** + * Creates a no action instruction. + * + * @return no action instruction + */ + public static NoActionInstruction createNoAction() { + return new NoActionInstruction(); + } + + /** * Creates a group instruction. * * @param groupId Group Id @@ -89,19 +99,6 @@ public final class Instructions { } /** - * Creates a l0 modification. - * - * @param lambda the lambda to modify to - * @return a l0 modification - * @deprecated in Cardinal Release. Use {@link #modL0Lambda(Lambda)} instead. - */ - @Deprecated - public static L0ModificationInstruction modL0Lambda(short lambda) { - checkNotNull(lambda, "L0 lambda cannot be null"); - return new ModLambdaInstruction(L0SubType.LAMBDA, lambda); - } - - /** * Creates an L0 modification with the specified OCh signal. * * @param lambda OCh signal @@ -303,21 +300,6 @@ public final class Instructions { * * @param etherType Ethernet type to set * @return a L2 modification. - * @deprecated in Cardinal Release - */ - @Deprecated - public static Instruction popMpls(int etherType) { - checkNotNull(etherType, "Ethernet type cannot be null"); - return new L2ModificationInstruction.PushHeaderInstructions( - L2ModificationInstruction.L2SubType.MPLS_POP, new EthType(etherType)); - } - - - /** - * Creates a pop MPLS header instruction with a particular ethertype. - * - * @param etherType Ethernet type to set - * @return a L2 modification. */ public static Instruction popMpls(EthType etherType) { checkNotNull(etherType, "Ethernet type cannot be null"); @@ -478,6 +460,7 @@ public final class Instructions { /** * Drop instruction. */ + @Deprecated public static final class DropInstruction implements Instruction { private DropInstruction() {} @@ -510,6 +493,40 @@ public final class Instructions { } /** + * No Action instruction. + */ + public static final class NoActionInstruction implements Instruction { + + private NoActionInstruction() {} + + @Override + public Type type() { + return Type.NOACTION; + } + + @Override + public String toString() { + return toStringHelper(type().toString()).toString(); + } + + @Override + public int hashCode() { + return Objects.hash(type().ordinal()); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof NoActionInstruction) { + return true; + } + return false; + } + } + + /** * Output Instruction. */ public static final class OutputInstruction implements Instruction { |