summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions')
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionPropertyException.java32
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatment.java33
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java104
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java110
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java948
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java139
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java88
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java517
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java391
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L4ModificationInstruction.java114
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/package-info.java20
11 files changed, 0 insertions, 2496 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionPropertyException.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionPropertyException.java
deleted file mode 100644
index 5750d09e..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionPropertyException.java
+++ /dev/null
@@ -1,32 +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.flow.instructions;
-
-/**
- * Exception indicating there was an error while setting/getting an extension
- * instruction property.
- */
-public class ExtensionPropertyException extends Exception {
-
- public ExtensionPropertyException(String message) {
- super(message);
- }
-
- public ExtensionPropertyException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatment.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatment.java
deleted file mode 100644
index 3df152e9..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatment.java
+++ /dev/null
@@ -1,33 +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.flow.instructions;
-
-import org.onosproject.net.flow.Extension;
-
-/**
- * An extension for the treatment API.
- */
-public interface ExtensionTreatment extends Extension {
-
- /**
- * Gets the type of the treatment extension.
- *
- * @return type
- */
- ExtensionTreatmentType type();
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java
deleted file mode 100644
index f597a46c..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java
+++ /dev/null
@@ -1,104 +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.flow.instructions;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-
-import java.util.Objects;
-
-/**
- * Type of treatment extensions.
- */
-@Beta
-public final class ExtensionTreatmentType {
-
- /**
- * A list of well-known named extension instruction type codes.
- * These numbers have no impact on the actual OF type id.
- */
- public enum ExtensionTreatmentTypes {
- NICIRA_SET_TUNNEL_DST(0),
- NICIRA_RESUBMIT(1),
- NICIRA_RESUBMIT_TABLE(14),
- NICIRA_SET_NSH_SPI(32),
- NICIRA_SET_NSH_SI(33),
- NICIRA_SET_NSH_CH1(34),
- NICIRA_SET_NSH_CH2(35),
- NICIRA_SET_NSH_CH3(36),
- NICIRA_SET_NSH_CH4(37),
- NICIRA_MOV_ARP_SHA_TO_THA(2),
- NICIRA_MOV_ARP_SPA_TO_TPA(3),
- NICIRA_MOV_ETH_SRC_TO_DST(4),
- NICIRA_MOV_IP_SRC_TO_DST(5);
-
- private ExtensionTreatmentType type;
-
- /**
- * Creates a new named extension treatment type.
- *
- * @param type type code
- */
- ExtensionTreatmentTypes(int type) {
- this.type = new ExtensionTreatmentType(type);
- }
-
- /**
- * Gets the extension type object for this named type code.
- *
- * @return extension type object
- */
- public ExtensionTreatmentType type() {
- return type;
- }
- }
-
- private final int type;
-
- /**
- * Creates an extension type with the given int type code.
- *
- * @param type type code
- */
- public ExtensionTreatmentType(int type) {
- this.type = type;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ExtensionTreatmentType) {
- final ExtensionTreatmentType that = (ExtensionTreatmentType) obj;
- return this.type == that.type;
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(ExtensionTreatmentType.class)
- .add("type", type)
- .toString();
- }
-}
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
deleted file mode 100644
index 31ad80c5..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2014-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.instructions;
-
-/**
- * Abstraction of a single traffic treatment step.
- */
-public interface Instruction {
-
- /**
- * Represents the type of traffic treatment.
- */
- enum Type {
- /**
- * 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,
-
- /**
- * Signifies that traffic should be sent out of a group.
- */
- GROUP,
-
- /**
- * Signifies that the traffic should be enqueued to an already-configured
- queue on a port.
- */
- QUEUE,
-
- /**
- * Signifies that traffic should be metered according to a meter.
- */
- METER,
-
- /**
- * Signifies that the traffic should be modified in L0 way.
- */
- L0MODIFICATION,
-
- /**
- * Signifies that the traffic should be modified in L1 way.
- */
- L1MODIFICATION,
-
- /**
- * Signifies that the traffic should be modified in L2 way.
- */
- L2MODIFICATION,
-
- /**
- * Signifies that the traffic should be passed to another table.
- */
- TABLE,
-
- /**
- * Signifies that the traffic should be modified in L3 way.
- */
- L3MODIFICATION,
-
- /**
- * Signifies that metadata be attached to traffic.
- */
- METADATA,
-
- /**
- * Signifies that the traffic should be modified in L4 way.
- */
- L4MODIFICATION,
-
- /**
- * Signifies that an extension instruction will be used.
- */
- EXTENSION
- }
-
- /**
- * Returns the type of instruction.
- *
- * @return type of instruction
- */
- Type type();
-
-}
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
deleted file mode 100644
index 8ed882c8..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ /dev/null
@@ -1,948 +0,0 @@
-/*
- * Copyright 2014-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.instructions;
-
-import com.google.common.base.MoreObjects;
-import org.onlab.packet.EthType;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.MplsLabel;
-import org.onlab.packet.TpPort;
-import org.onlab.packet.VlanId;
-import org.onosproject.core.GroupId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.IndexedLambda;
-import org.onosproject.net.Lambda;
-import org.onosproject.net.OchSignal;
-import org.onosproject.net.OduSignalId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.flow.instructions.L0ModificationInstruction.L0SubType;
-import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambdaInstruction;
-import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction;
-import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction;
-import org.onosproject.net.flow.instructions.L3ModificationInstruction.L3SubType;
-import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
-import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpIPInstruction;
-import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpEthInstruction;
-import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpOpInstruction;
-import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction;
-import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModTtlInstruction;
-import org.onosproject.net.flow.instructions.L4ModificationInstruction.L4SubType;
-import org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction;
-import org.onosproject.net.meter.MeterId;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Factory class for creating various traffic treatment instructions.
- */
-public final class Instructions {
-
- // Ban construction
- private Instructions() {}
-
- /**
- * Creates an output instruction using the specified port number. This can
- * include logical ports such as CONTROLLER, FLOOD, etc.
- *
- * @param number port number
- * @return output instruction
- */
- public static OutputInstruction createOutput(final PortNumber number) {
- checkNotNull(number, "PortNumber cannot be null");
- return new OutputInstruction(number);
- }
-
- /**
- * Creates a drop instruction.
- *
- * @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
- * @return group instruction
- */
- public static GroupInstruction createGroup(final GroupId groupId) {
- checkNotNull(groupId, "GroupId cannot be null");
- return new GroupInstruction(groupId);
- }
-
- /**
- * Creates a set-queue instruction.
- *
- * @param queueId Queue Id
- * @param port Port number
- * @return set-queue instruction
- */
- public static SetQueueInstruction setQueue(final long queueId, final PortNumber port) {
- checkNotNull(queueId, "queue ID cannot be null");
- return new SetQueueInstruction(queueId, port);
- }
-
- public static MeterInstruction meterTraffic(final MeterId meterId) {
- checkNotNull(meterId, "meter id cannot be null");
- return new MeterInstruction(meterId);
- }
-
- /**
- * Creates an L0 modification with the specified OCh signal.
- *
- * @param lambda OCh signal
- * @return an L0 modification
- */
- public static L0ModificationInstruction modL0Lambda(Lambda lambda) {
- checkNotNull(lambda, "L0 OCh signal cannot be null");
-
- if (lambda instanceof IndexedLambda) {
- return new ModLambdaInstruction(L0SubType.LAMBDA, (short) ((IndexedLambda) lambda).index());
- } else if (lambda instanceof OchSignal) {
- return new ModOchSignalInstruction((OchSignal) lambda);
- } else {
- throw new UnsupportedOperationException(String.format("Unsupported type: %s", lambda));
- }
- }
-
- /**
- * Creates an L1 modification with the specified ODU signal Id.
- *
- * @param oduSignalId ODU Signal Id
- * @return a L1 modification
- */
- public static L1ModificationInstruction modL1OduSignalId(OduSignalId oduSignalId) {
- checkNotNull(oduSignalId, "L1 ODU signal ID cannot be null");
- return new ModOduSignalIdInstruction(oduSignalId);
- }
- /**
- * Creates a l2 src modification.
- *
- * @param addr the mac address to modify to
- * @return a l2 modification
- */
- public static L2ModificationInstruction modL2Src(MacAddress addr) {
- checkNotNull(addr, "Src l2 address cannot be null");
- return new L2ModificationInstruction.ModEtherInstruction(
- L2ModificationInstruction.L2SubType.ETH_SRC, addr);
- }
-
- /**
- * Creates a L2 dst modification.
- *
- * @param addr the mac address to modify to
- * @return a L2 modification
- */
- public static L2ModificationInstruction modL2Dst(MacAddress addr) {
- checkNotNull(addr, "Dst l2 address cannot be null");
- return new L2ModificationInstruction.ModEtherInstruction(
- L2ModificationInstruction.L2SubType.ETH_DST, addr);
- }
-
- /**
- * Creates a VLAN ID modification.
- *
- * @param vlanId the VLAN ID to modify to
- * @return a L2 modification
- */
- public static L2ModificationInstruction modVlanId(VlanId vlanId) {
- checkNotNull(vlanId, "VLAN id cannot be null");
- return new L2ModificationInstruction.ModVlanIdInstruction(vlanId);
- }
-
- /**
- * Creates a VLAN PCP modification.
- *
- * @param vlanPcp the PCP to modify to
- * @return a L2 modification
- */
- public static L2ModificationInstruction modVlanPcp(Byte vlanPcp) {
- checkNotNull(vlanPcp, "VLAN Pcp cannot be null");
- return new L2ModificationInstruction.ModVlanPcpInstruction(vlanPcp);
- }
-
- /**
- * Creates a MPLS label modification.
- *
- * @param mplsLabel MPLS label to set
- * @return a L2 Modification
- */
- public static L2ModificationInstruction modMplsLabel(MplsLabel mplsLabel) {
- checkNotNull(mplsLabel, "MPLS label cannot be null");
- return new L2ModificationInstruction.ModMplsLabelInstruction(mplsLabel);
- }
-
- /**
- * Creates a MPLS BOS bit modification.
- *
- * @param mplsBos MPLS BOS bit to set (true) or unset (false)
- * @return a L2 Modification
- */
- public static L2ModificationInstruction modMplsBos(boolean mplsBos) {
- return new L2ModificationInstruction.ModMplsBosInstruction(mplsBos);
- }
-
- /**
- * Creates a MPLS decrement TTL modification.
- *
- * @return a L2 Modification
- */
- public static L2ModificationInstruction decMplsTtl() {
- return new L2ModificationInstruction.ModMplsTtlInstruction();
- }
-
- /**
- * Creates a L3 IPv4 src modification.
- *
- * @param addr the IPv4 address to modify to
- * @return a L3 modification
- */
- public static L3ModificationInstruction modL3Src(IpAddress addr) {
- checkNotNull(addr, "Src l3 IPv4 address cannot be null");
- return new ModIPInstruction(L3SubType.IPV4_SRC, addr);
- }
-
- /**
- * Creates a L3 IPv4 dst modification.
- *
- * @param addr the IPv4 address to modify to
- * @return a L3 modification
- */
- public static L3ModificationInstruction modL3Dst(IpAddress addr) {
- checkNotNull(addr, "Dst l3 IPv4 address cannot be null");
- return new ModIPInstruction(L3SubType.IPV4_DST, addr);
- }
-
- /**
- * Creates a L3 IPv6 src modification.
- *
- * @param addr the IPv6 address to modify to
- * @return a L3 modification
- */
- public static L3ModificationInstruction modL3IPv6Src(IpAddress addr) {
- checkNotNull(addr, "Src l3 IPv6 address cannot be null");
- return new ModIPInstruction(L3SubType.IPV6_SRC, addr);
- }
-
- /**
- * Creates a L3 IPv6 dst modification.
- *
- * @param addr the IPv6 address to modify to
- * @return a L3 modification
- */
- public static L3ModificationInstruction modL3IPv6Dst(IpAddress addr) {
- checkNotNull(addr, "Dst l3 IPv6 address cannot be null");
- return new ModIPInstruction(L3SubType.IPV6_DST, addr);
- }
-
- /**
- * Creates a L3 IPv6 Flow Label modification.
- *
- * @param flowLabel the IPv6 flow label to modify to (20 bits)
- * @return a L3 modification
- */
- public static L3ModificationInstruction modL3IPv6FlowLabel(int flowLabel) {
- return new ModIPv6FlowLabelInstruction(flowLabel);
- }
-
- /**
- * Creates a L3 decrement TTL modification.
- *
- * @return a L3 modification
- */
- public static L3ModificationInstruction decNwTtl() {
- return new ModTtlInstruction(L3SubType.DEC_TTL);
- }
-
- /**
- * Creates a L3 copy TTL to outer header modification.
- *
- * @return a L3 modification
- */
- public static L3ModificationInstruction copyTtlOut() {
- return new ModTtlInstruction(L3SubType.TTL_OUT);
- }
-
- /**
- * Creates a L3 copy TTL to inner header modification.
- *
- * @return a L3 modification
- */
- public static L3ModificationInstruction copyTtlIn() {
- return new ModTtlInstruction(L3SubType.TTL_IN);
- }
-
- /**
- * Creates a L3 ARP IP src modification.
- *
- * @param addr the ip address to modify to
- * @return a L3 modification
- */
- public static L3ModificationInstruction modArpSpa(IpAddress addr) {
- checkNotNull(addr, "Src l3 ARP IP address cannot be null");
- return new ModArpIPInstruction(L3SubType.ARP_SPA, addr);
- }
-
- /**
- * Creates a l3 ARP Ether src modification.
- *
- * @param addr the mac address to modify to
- * @return a l3 modification
- */
- public static L3ModificationInstruction modArpSha(MacAddress addr) {
- checkNotNull(addr, "Src l3 ARP address cannot be null");
- return new ModArpEthInstruction(L3SubType.ARP_SHA, addr);
- }
-
- /**
- * Creates a l3 ARP operation modification.
- *
- * @param op the ARP operation to modify to
- * @return a l3 modification
- */
- public static L3ModificationInstruction modL3ArpOp(short op) {
- checkNotNull(op, "Arp operation cannot be null");
- return new ModArpOpInstruction(L3SubType.ARP_OP, op);
- }
-
- /**
- * Creates a push MPLS header instruction.
- *
- * @return a L2 modification.
- */
- public static Instruction pushMpls() {
- return new L2ModificationInstruction.PushHeaderInstructions(
- L2ModificationInstruction.L2SubType.MPLS_PUSH,
- EthType.EtherType.MPLS_UNICAST.ethType());
- }
-
- /**
- * Creates a pop MPLS header instruction.
- *
- * @return a L2 modification.
- */
- public static Instruction popMpls() {
- return new L2ModificationInstruction.PushHeaderInstructions(
- L2ModificationInstruction.L2SubType.MPLS_POP,
- EthType.EtherType.MPLS_UNICAST.ethType());
- }
-
- /**
- * 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");
- return new L2ModificationInstruction.PushHeaderInstructions(
- L2ModificationInstruction.L2SubType.MPLS_POP, etherType);
- }
-
- /**
- * Creates a pop VLAN header instruction.
- *
- * @return a L2 modification
- */
- public static Instruction popVlan() {
- return new L2ModificationInstruction.PopVlanInstruction(
- L2ModificationInstruction.L2SubType.VLAN_POP);
- }
-
- /**
- * Creates a push VLAN header instruction.
- *
- * @return a L2 modification
- */
- public static Instruction pushVlan() {
- return new L2ModificationInstruction.PushHeaderInstructions(
- L2ModificationInstruction.L2SubType.VLAN_PUSH,
- EthType.EtherType.VLAN.ethType());
- }
-
- /**
- * Sends the packet to the table id.
- *
- * @param tableId flow rule table id
- * @return table type transition instruction
- */
- public static Instruction transition(Integer tableId) {
- checkNotNull(tableId, "Table id cannot be null");
- return new TableTypeTransition(tableId);
- }
-
- /**
- * Writes metadata to associate with a packet.
- *
- * @param metadata the metadata value to write
- * @param metadataMask the bits to mask for the metadata value
- * @return metadata instruction
- */
- public static Instruction writeMetadata(long metadata, long metadataMask) {
- return new MetadataInstruction(metadata, metadataMask);
- }
-
- /**
- * Creates a Tunnel ID modification.
- *
- * @param tunnelId the Tunnel ID to modify to
- * @return a L2 modification
- */
- public static L2ModificationInstruction modTunnelId(long tunnelId) {
- checkNotNull(tunnelId, "Tunnel id cannot be null");
- return new L2ModificationInstruction.ModTunnelIdInstruction(tunnelId);
- }
-
- /**
- * Creates a TCP src modification.
- *
- * @param port the TCP port number to modify to
- * @return a L4 modification
- * @deprecated in Drake release
- */
- @Deprecated
- public static L4ModificationInstruction modTcpSrc(short port) {
- checkNotNull(port, "Src TCP port cannot be null");
- return new ModTransportPortInstruction(L4SubType.TCP_SRC, TpPort.tpPort(port));
- }
-
- /**
- * Creates a TCP src modification.
- *
- * @param port the TCP port number to modify to
- * @return a L4 modification
- */
- public static L4ModificationInstruction modTcpSrc(TpPort port) {
- checkNotNull(port, "Src TCP port cannot be null");
- return new ModTransportPortInstruction(L4SubType.TCP_SRC, port);
- }
-
- /**
- * Creates a TCP dst modification.
- *
- * @param port the TCP port number to modify to
- * @return a L4 modification
- * @deprecated in Drake release
- */
- @Deprecated
- public static L4ModificationInstruction modTcpDst(short port) {
- checkNotNull(port, "Dst TCP port cannot be null");
- return new ModTransportPortInstruction(L4SubType.TCP_DST, TpPort.tpPort(port));
- }
-
- /**
- * Creates a TCP dst modification.
- *
- * @param port the TCP port number to modify to
- * @return a L4 modification
- */
- public static L4ModificationInstruction modTcpDst(TpPort port) {
- checkNotNull(port, "Dst TCP port cannot be null");
- return new ModTransportPortInstruction(L4SubType.TCP_DST, port);
- }
-
- /**
- * Creates a UDP src modification.
- *
- * @param port the UDP port number to modify to
- * @return a L4 modification
- * @deprecated in Drake release
- */
- @Deprecated
- public static L4ModificationInstruction modUdpSrc(short port) {
- checkNotNull(port, "Src UDP port cannot be null");
- return new ModTransportPortInstruction(L4SubType.UDP_SRC, TpPort.tpPort(port));
- }
-
- /**
- * Creates a UDP src modification.
- *
- * @param port the UDP port number to modify to
- * @return a L4 modification
- */
- public static L4ModificationInstruction modUdpSrc(TpPort port) {
- checkNotNull(port, "Src UDP port cannot be null");
- return new ModTransportPortInstruction(L4SubType.UDP_SRC, port);
- }
-
- /**
- * Creates a UDP dst modification.
- *
- * @param port the UDP port number to modify to
- * @return a L4 modification
- * @deprecated in Drake release
- */
- @Deprecated
- public static L4ModificationInstruction modUdpDst(short port) {
- checkNotNull(port, "Dst UDP port cannot be null");
- return new ModTransportPortInstruction(L4SubType.UDP_DST, TpPort.tpPort(port));
- }
-
- /**
- * Creates a UDP dst modification.
- *
- * @param port the UDP port number to modify to
- * @return a L4 modification
- */
- public static L4ModificationInstruction modUdpDst(TpPort port) {
- checkNotNull(port, "Dst UDP port cannot be null");
- return new ModTransportPortInstruction(L4SubType.UDP_DST, port);
- }
-
- /**
- * Creates an extension instruction.
- *
- * @param extension extension instruction
- * @param deviceId device ID
- * @return extension instruction
- */
- public static ExtensionInstructionWrapper extension(ExtensionTreatment extension,
- DeviceId deviceId) {
- checkNotNull(extension, "Extension instruction cannot be null");
- checkNotNull(deviceId, "Device ID cannot be null");
- return new ExtensionInstructionWrapper(extension, deviceId);
- }
-
- /**
- * Drop instruction.
- */
- @Deprecated
- public static final class DropInstruction implements Instruction {
-
- private DropInstruction() {}
-
- @Override
- public Type type() {
- return Type.DROP;
- }
-
- @Override
- public String toString() {
- return toStringHelper(type().toString()).toString();
- }
-
- @Override
- public int hashCode() {
- return type().ordinal();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DropInstruction) {
- return true;
- }
- return false;
- }
- }
-
- /**
- * 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 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 {
- private final PortNumber port;
-
- private OutputInstruction(PortNumber port) {
- this.port = port;
- }
-
- public PortNumber port() {
- return port;
- }
-
- @Override
- public Type type() {
- return Type.OUTPUT;
- }
- @Override
- public String toString() {
- return toStringHelper(type().toString())
- .add("port", port).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type().ordinal(), port);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof OutputInstruction) {
- OutputInstruction that = (OutputInstruction) obj;
- return Objects.equals(port, that.port);
-
- }
- return false;
- }
- }
-
- /**
- * Group Instruction.
- */
- public static final class GroupInstruction implements Instruction {
- private final GroupId groupId;
-
- private GroupInstruction(GroupId groupId) {
- this.groupId = groupId;
- }
-
- public GroupId groupId() {
- return groupId;
- }
-
- @Override
- public Type type() {
- return Type.GROUP;
- }
-
- @Override
- public String toString() {
- return toStringHelper(type().toString())
- .addValue("group ID=0x" + Integer.toHexString(groupId.id()))
- .toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type().ordinal(), groupId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof GroupInstruction) {
- GroupInstruction that = (GroupInstruction) obj;
- return Objects.equals(groupId, that.groupId);
-
- }
- return false;
- }
- }
-
- /**
- * Set-Queue Instruction.
- */
- public static final class SetQueueInstruction implements Instruction {
- private final long queueId;
- private final PortNumber port;
-
- private SetQueueInstruction(long queueId) {
- this.queueId = queueId;
- this.port = null;
- }
-
- private SetQueueInstruction(long queueId, PortNumber port) {
- this.queueId = queueId;
- this.port = port;
- }
-
- public long queueId() {
- return queueId;
- }
-
- public PortNumber port() {
- return port;
- }
-
- @Override
- public Type type() {
- return Type.QUEUE;
- }
-
- @Override
- public String toString() {
- MoreObjects.ToStringHelper toStringHelper = toStringHelper(type().toString());
- toStringHelper.add("queueId", queueId);
-
- if (port() != null) {
- toStringHelper.add("port", port);
- }
- return toStringHelper.toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type().ordinal(), queueId, port);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof SetQueueInstruction) {
- SetQueueInstruction that = (SetQueueInstruction) obj;
- return Objects.equals(queueId, that.queueId) && Objects.equals(port, that.port);
-
- }
- return false;
- }
- }
-
- /**
- * 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.
- */
- public static class TableTypeTransition implements Instruction {
- private final Integer tableId;
-
- TableTypeTransition(Integer tableId) {
- this.tableId = tableId;
- }
-
- @Override
- public Type type() {
- return Type.TABLE;
- }
-
- public Integer tableId() {
- return this.tableId;
- }
-
- @Override
- public String toString() {
- return toStringHelper(type().toString())
- .add("tableId", this.tableId).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type().ordinal(), tableId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof TableTypeTransition) {
- TableTypeTransition that = (TableTypeTransition) obj;
- return Objects.equals(tableId, that.tableId);
-
- }
- return false;
- }
- }
-
- /**
- * Metadata instruction.
- */
- public static class MetadataInstruction implements Instruction {
- private final long metadata;
- private final long metadataMask;
-
- MetadataInstruction(long metadata, long metadataMask) {
- this.metadata = metadata;
- this.metadataMask = metadataMask;
- }
-
- @Override
- public Type type() {
- return Type.METADATA;
- }
-
- public long metadata() {
- return this.metadata;
- }
-
- public long metadataMask() {
- return this.metadataMask;
- }
-
- @Override
- public String toString() {
- return toStringHelper(type().toString())
- .add("metadata", Long.toHexString(this.metadata))
- .add("metadata mask", Long.toHexString(this.metadataMask))
- .toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type().ordinal(), metadata, metadataMask);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof MetadataInstruction) {
- MetadataInstruction that = (MetadataInstruction) obj;
- return Objects.equals(metadata, that.metadata) &&
- Objects.equals(metadataMask, that.metadataMask);
-
- }
- return false;
- }
- }
-
- /**
- * Extension instruction.
- */
- public static class ExtensionInstructionWrapper implements Instruction {
- private final ExtensionTreatment extensionTreatment;
- private final DeviceId deviceId;
-
- ExtensionInstructionWrapper(ExtensionTreatment extension, DeviceId deviceId) {
- extensionTreatment = extension;
- this.deviceId = deviceId;
- }
-
- public ExtensionTreatment extensionInstruction() {
- return extensionTreatment;
- }
-
- public DeviceId deviceId() {
- return deviceId;
- }
-
- @Override
- public Type type() {
- return Type.EXTENSION;
- }
-
- @Override
- public String toString() {
- return toStringHelper(type().toString())
- .add("extension", extensionTreatment)
- .add("deviceId", deviceId)
- .toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type().ordinal(), extensionTreatment, deviceId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ExtensionInstructionWrapper) {
- ExtensionInstructionWrapper that = (ExtensionInstructionWrapper) obj;
- return Objects.equals(extensionTreatment, that.extensionTreatment)
- && Objects.equals(deviceId, that.deviceId);
-
- }
- return false;
- }
- }
-
-}
-
-
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java
deleted file mode 100644
index 4af3d168..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright 2014-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.instructions;
-
-import com.google.common.base.MoreObjects;
-import org.onosproject.net.OchSignal;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-import java.util.Objects;
-
-public abstract class L0ModificationInstruction implements Instruction {
-
- /**
- * Represents the type of traffic treatment.
- */
- public enum L0SubType {
- /**
- * Lambda modification.
- */
- LAMBDA,
- /**
- * OCh (Optical Channel) modification.
- */
- OCH,
- }
-
- public abstract L0SubType subtype();
-
- @Override
- public final Type type() {
- return Type.L0MODIFICATION;
- }
-
- /**
- * Represents a L0 lambda modification instruction.
- */
- public static final class ModLambdaInstruction extends L0ModificationInstruction {
-
- private final L0SubType subtype;
- private final short lambda;
-
- ModLambdaInstruction(L0SubType subType, short lambda) {
- this.subtype = subType;
- this.lambda = lambda;
- }
-
- @Override
- public L0SubType subtype() {
- return this.subtype;
- }
-
- public short lambda() {
- return this.lambda;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("lambda", lambda).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype, lambda);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModLambdaInstruction) {
- ModLambdaInstruction that = (ModLambdaInstruction) obj;
- return Objects.equals(lambda, that.lambda) &&
- Objects.equals(subtype, that.subtype);
- }
- return false;
- }
- }
-
- /**
- * Represents an L0 OCh (Optical Channel) modification instruction.
- */
- public static final class ModOchSignalInstruction extends L0ModificationInstruction {
-
- private final OchSignal lambda;
-
- ModOchSignalInstruction(OchSignal lambda) {
- this.lambda = lambda;
- }
-
- @Override
- public L0SubType subtype() {
- return L0SubType.OCH;
- }
-
- public OchSignal lambda() {
- return lambda;
- }
-
- @Override
- public int hashCode() {
- return lambda.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof ModOchSignalInstruction)) {
- return false;
- }
- final ModOchSignalInstruction that = (ModOchSignalInstruction) obj;
- return Objects.equals(this.lambda, that.lambda);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("lambda", lambda)
- .toString();
- }
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
deleted file mode 100644
index b72dd7bc..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2014-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.instructions;
-
-import org.onosproject.net.OduSignalId;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-import java.util.Objects;
-
-public abstract class L1ModificationInstruction implements Instruction {
-
- /**
- * Represents the type of traffic treatment.
- */
- public enum L1SubType {
- /**
- * ODU (Optical channel Data Unit) Signal Id modification.
- */
- ODU_SIGID
- }
-
- public abstract L1SubType subtype();
-
- @Override
- public final Type type() {
- return Type.L1MODIFICATION;
- }
-
- /**
- * Represents an L1 ODU (Optical channel Data Unit) Signal Id modification instruction.
- */
- public static final class ModOduSignalIdInstruction extends L1ModificationInstruction {
-
- private final OduSignalId oduSignalId;
-
- ModOduSignalIdInstruction(OduSignalId oduSignalId) {
- this.oduSignalId = oduSignalId;
- }
-
- @Override
- public L1SubType subtype() {
- return L1SubType.ODU_SIGID;
- }
-
- public OduSignalId oduSignalId() {
- return oduSignalId;
- }
-
- @Override
- public int hashCode() {
- return oduSignalId.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof ModOduSignalIdInstruction)) {
- return false;
- }
- final ModOduSignalIdInstruction that = (ModOduSignalIdInstruction) obj;
- return Objects.equals(this.oduSignalId, that.oduSignalId);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("oduSignalId", oduSignalId)
- .toString();
- }
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
deleted file mode 100644
index 0dbbb451..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * Copyright 2014-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.instructions;
-
-import org.onlab.packet.EthType;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.MplsLabel;
-import org.onlab.packet.VlanId;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Abstraction of a single traffic treatment step.
- */
-public abstract class L2ModificationInstruction implements Instruction {
-
- /**
- * Represents the type of traffic treatment.
- */
- public enum L2SubType {
- /**
- * Ether src modification.
- */
- ETH_SRC,
-
- /**
- * Ether dst modification.
- */
- ETH_DST,
-
- /**
- * VLAN id modification.
- */
- VLAN_ID,
-
- /**
- * VLAN priority modification.
- */
- VLAN_PCP,
-
- /**
- * MPLS Label modification.
- */
- MPLS_LABEL,
-
- /**
- * MPLS Push modification.
- */
- MPLS_PUSH,
-
- /**
- * MPLS Pop modification.
- */
- MPLS_POP,
-
- /**
- * MPLS TTL modification.
- */
- DEC_MPLS_TTL,
-
- /**
- * VLAN Pop modification.
- */
- VLAN_POP,
-
- /**
- * VLAN Push modification.
- */
- VLAN_PUSH,
-
- /**
- * Tunnel id modification.
- */
- TUNNEL_ID,
-
- /**
- * MPLS BOS instruction.
- */
- MPLS_BOS
- }
-
- // TODO: Create factory class 'Instructions' that will have various factory
- // to create specific instructions.
-
- public abstract L2SubType subtype();
-
- @Override
- public final Type type() {
- return Type.L2MODIFICATION;
- }
-
- /**
- * Represents a L2 src/dst modification instruction.
- */
- public static final class ModEtherInstruction extends L2ModificationInstruction {
-
- private final L2SubType subtype;
- private final MacAddress mac;
-
- ModEtherInstruction(L2SubType subType, MacAddress addr) {
-
- this.subtype = subType;
- this.mac = addr;
- }
-
- @Override
- public L2SubType subtype() {
- return this.subtype;
- }
-
- public MacAddress mac() {
- return this.mac;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("mac", mac).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype, mac);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModEtherInstruction) {
- ModEtherInstruction that = (ModEtherInstruction) obj;
- return Objects.equals(mac, that.mac) &&
- Objects.equals(subtype, that.subtype);
- }
- return false;
- }
- }
-
- // TODO This instruction is reused for Pop-Mpls. Consider renaming.
- public static final class PushHeaderInstructions extends
- L2ModificationInstruction {
-
-
- private final L2SubType subtype;
- private final EthType ethernetType; // Ethernet type value: 16 bits
-
- PushHeaderInstructions(L2SubType subType, EthType ethernetType) {
- this.subtype = subType;
- this.ethernetType = ethernetType;
- }
-
- public EthType ethernetType() {
- return ethernetType;
- }
-
- @Override
- public L2SubType subtype() {
- return this.subtype;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("ethernetType", ethernetType())
- .toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype, ethernetType);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof PushHeaderInstructions) {
- PushHeaderInstructions that = (PushHeaderInstructions) obj;
- return Objects.equals(subtype, that.subtype) &&
- Objects.equals(this.ethernetType, that.ethernetType);
- }
- return false;
- }
- }
-
-
-
- /**
- * Represents a VLAN id modification instruction.
- */
- public static final class ModVlanIdInstruction extends L2ModificationInstruction {
-
- private final VlanId vlanId;
-
- ModVlanIdInstruction(VlanId vlanId) {
- this.vlanId = vlanId;
- }
-
- @Override
- public L2SubType subtype() {
- return L2SubType.VLAN_ID;
- }
-
- public VlanId vlanId() {
- return this.vlanId;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("id", vlanId).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), vlanId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModVlanIdInstruction) {
- ModVlanIdInstruction that = (ModVlanIdInstruction) obj;
- return Objects.equals(vlanId, that.vlanId);
- }
- return false;
- }
- }
-
- /**
- * Represents a VLAN PCP modification instruction.
- */
- public static final class ModVlanPcpInstruction extends L2ModificationInstruction {
-
- private static final byte MASK = 0x7;
- private final byte vlanPcp;
-
- ModVlanPcpInstruction(byte vlanPcp) {
- this.vlanPcp = (byte) (vlanPcp & MASK);
- }
-
- @Override
- public L2SubType subtype() {
- return L2SubType.VLAN_PCP;
- }
-
- public byte vlanPcp() {
- return this.vlanPcp;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("pcp", Long.toHexString(vlanPcp)).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), vlanPcp);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModVlanPcpInstruction) {
- ModVlanPcpInstruction that = (ModVlanPcpInstruction) obj;
- return Objects.equals(vlanPcp, that.vlanPcp);
- }
- return false;
- }
- }
-
- /**
- * Represents a VLAN POP modification instruction.
- */
- public static final class PopVlanInstruction extends L2ModificationInstruction {
- private final L2SubType subtype;
-
- PopVlanInstruction(L2SubType subType) {
- this.subtype = subType;
- }
-
- @Override
- public L2SubType subtype() {
- return subtype;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof PopVlanInstruction) {
- PopVlanInstruction that = (PopVlanInstruction) obj;
- return Objects.equals(subtype, that.subtype);
- }
- return false;
- }
- }
-
- /**
- * Represents a MPLS label modification.
- */
- public static final class ModMplsLabelInstruction
- extends L2ModificationInstruction {
-
- private final MplsLabel mplsLabel;
-
- ModMplsLabelInstruction(MplsLabel mplsLabel) {
- this.mplsLabel = mplsLabel;
- }
-
- /**
- * @deprecated in Drake Release.
- * @return integer value of label
- */
- // Consider changing return value to MplsLabel
- // after deprecation process so that it'll be symmetric to
- // MplsCriterion#label()
- @Deprecated
- public Integer label() {
- return mplsLabel.toInt();
- }
-
- public MplsLabel mplsLabel() {
- return mplsLabel;
- }
-
- @Override
- public L2SubType subtype() {
- return L2SubType.MPLS_LABEL;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("mpls", mplsLabel).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), mplsLabel);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModMplsLabelInstruction) {
- ModMplsLabelInstruction that = (ModMplsLabelInstruction) obj;
- return Objects.equals(mplsLabel, that.mplsLabel);
- }
- return false;
- }
- }
-
- /**
- * Represents a MPLS BOS modification.
- */
- public static final class ModMplsBosInstruction
- extends L2ModificationInstruction {
-
- private final boolean mplsBos;
-
- ModMplsBosInstruction(boolean mplsBos) {
- this.mplsBos = mplsBos;
- }
-
- public boolean mplsBos() {
- return mplsBos;
- }
-
- @Override
- public L2SubType subtype() {
- return L2SubType.MPLS_BOS;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString()).add("bos", mplsBos)
- .toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), mplsBos);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModMplsBosInstruction) {
- ModMplsBosInstruction that = (ModMplsBosInstruction) obj;
- return Objects.equals(mplsBos, that.mplsBos());
- }
- return false;
- }
- }
-
- /**
- * Represents a MPLS TTL modification.
- */
- public static final class ModMplsTtlInstruction
- extends L2ModificationInstruction {
-
- ModMplsTtlInstruction() {
- }
-
- @Override
- public L2SubType subtype() {
- return L2SubType.DEC_MPLS_TTL;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModMplsTtlInstruction) {
- return true;
- }
- return false;
- }
- }
-
- /**
- * Represents a Tunnel id modification.
- */
- public static final class ModTunnelIdInstruction
- extends L2ModificationInstruction {
-
- private final long tunnelId;
-
- ModTunnelIdInstruction(long tunnelId) {
- this.tunnelId = tunnelId;
- }
-
- public long tunnelId() {
- return this.tunnelId;
- }
-
- @Override
- public L2SubType subtype() {
- return L2SubType.TUNNEL_ID;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("id", Long.toHexString(tunnelId))
- .toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), tunnelId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModTunnelIdInstruction) {
- ModTunnelIdInstruction that = (ModTunnelIdInstruction) obj;
- return Objects.equals(tunnelId, that.tunnelId);
- }
- return false;
- }
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java
deleted file mode 100644
index 0efe9a77..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * Copyright 2014-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.instructions;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-
-/**
- * Abstraction of a single traffic treatment step.
- */
-public abstract class L3ModificationInstruction implements Instruction {
-
- /**
- * Represents the type of traffic treatment.
- */
- public enum L3SubType {
- /**
- * IPv4 src modification.
- */
- IPV4_SRC,
-
- /**
- * IPv4 dst modification.
- */
- IPV4_DST,
-
- /**
- * IPv6 src modification.
- */
- IPV6_SRC,
-
- /**
- * IPv6 dst modification.
- */
- IPV6_DST,
-
- /**
- * IPv6 flow label modification.
- */
- IPV6_FLABEL,
-
- /**
- * Decrement TTL.
- */
- DEC_TTL,
-
- /**
- * Copy TTL out.
- */
- TTL_OUT,
-
- /**
- * Copy TTL in.
- */
- TTL_IN,
-
- /**
- * ARP IP src modification.
- */
- ARP_SPA,
-
- /**
- * ARP Ether src modification.
- */
- ARP_SHA,
-
- /**
- * Arp operation modification.
- */
- ARP_OP
-
- //TODO: remaining types
- }
-
- /**
- * Returns the subtype of the modification instruction.
- * @return type of instruction
- */
- public abstract L3SubType subtype();
-
- @Override
- public final Type type() {
- return Type.L3MODIFICATION;
- }
-
- /**
- * Represents a L3 src/dst modification instruction.
- */
- public static final class ModIPInstruction extends L3ModificationInstruction {
-
- private final L3SubType subtype;
- private final IpAddress ip;
-
- ModIPInstruction(L3SubType subType, IpAddress addr) {
-
- this.subtype = subType;
- this.ip = addr;
- }
-
- @Override
- public L3SubType subtype() {
- return this.subtype;
- }
-
- public IpAddress ip() {
- return this.ip;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("ip", ip).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), ip);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModIPInstruction) {
- ModIPInstruction that = (ModIPInstruction) obj;
- return Objects.equals(ip, that.ip) &&
- Objects.equals(this.subtype(), that.subtype());
- }
- return false;
- }
- }
-
- /**
- * Represents a L3 ARP IP src/dst modification instruction.
- */
- public static final class ModArpIPInstruction extends L3ModificationInstruction {
-
- private final L3SubType subtype;
- private final IpAddress ip;
-
- ModArpIPInstruction(L3SubType subType, IpAddress addr) {
-
- this.subtype = subType;
- this.ip = addr;
- }
-
- @Override
- public L3SubType subtype() {
- return this.subtype;
- }
-
- public IpAddress ip() {
- return this.ip;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("ip", ip).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), ip);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModArpIPInstruction) {
- ModArpIPInstruction that = (ModArpIPInstruction) obj;
- return Objects.equals(ip, that.ip) &&
- Objects.equals(this.subtype(), that.subtype());
- }
- return false;
- }
- }
-
- /**
- * Represents a L3 ARP Ether src/dst modification instruction.
- */
- public static final class ModArpEthInstruction extends L3ModificationInstruction {
-
- private final L3SubType subtype;
- private final MacAddress mac;
-
- ModArpEthInstruction(L3SubType subType, MacAddress addr) {
-
- this.subtype = subType;
- this.mac = addr;
- }
-
- @Override
- public L3SubType subtype() {
- return this.subtype;
- }
-
- public MacAddress mac() {
- return this.mac;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("mac", mac).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), mac);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModArpEthInstruction) {
- ModArpEthInstruction that = (ModArpEthInstruction) obj;
- return Objects.equals(mac, that.mac) &&
- Objects.equals(this.subtype(), that.subtype());
- }
- return false;
- }
- }
-
- /**
- * Represents a L3 ARP operation modification instruction.
- */
- public static final class ModArpOpInstruction extends L3ModificationInstruction {
-
- private final L3SubType subtype;
- private final short op;
-
- ModArpOpInstruction(L3SubType subType, short op) {
-
- this.subtype = subType;
- this.op = op;
- }
-
- @Override
- public L3SubType subtype() {
- return this.subtype;
- }
-
- public long op() {
- return this.op;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("op", op).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), op);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModArpOpInstruction) {
- ModArpOpInstruction that = (ModArpOpInstruction) obj;
- return Objects.equals(op, that.op) &&
- Objects.equals(this.subtype(), that.subtype());
- }
- return false;
- }
- }
-
- /**
- * Represents a L3 IPv6 Flow Label (RFC 6437) modification instruction
- * (20 bits unsigned integer).
- */
- public static final class ModIPv6FlowLabelInstruction
- extends L3ModificationInstruction {
- private static final int MASK = 0xfffff;
- private final int flowLabel; // IPv6 flow label: 20 bits
-
- /**
- * Creates a new flow mod instruction.
- *
- * @param flowLabel the IPv6 flow label to set in the treatment (20 bits)
- */
- ModIPv6FlowLabelInstruction(int flowLabel) {
- this.flowLabel = flowLabel & MASK;
- }
-
- @Override
- public L3SubType subtype() {
- return L3SubType.IPV6_FLABEL;
- }
-
- /**
- * Gets the IPv6 flow label to set in the treatment.
- *
- * @return the IPv6 flow label to set in the treatment (20 bits)
- */
- public int flowLabel() {
- return this.flowLabel;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("flowLabel", Long.toHexString(flowLabel)).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), flowLabel);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModIPv6FlowLabelInstruction) {
- ModIPv6FlowLabelInstruction that =
- (ModIPv6FlowLabelInstruction) obj;
- return Objects.equals(flowLabel, that.flowLabel);
- }
- return false;
- }
- }
-
- /**
- * Represents a L3 TTL modification instruction.
- */
- public static final class ModTtlInstruction extends L3ModificationInstruction {
-
- private final L3SubType subtype;
-
- ModTtlInstruction(L3SubType subtype) {
- this.subtype = subtype;
- }
-
- @Override
- public L3SubType subtype() {
- return this.subtype;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModTtlInstruction) {
- ModTtlInstruction that = (ModTtlInstruction) obj;
- return Objects.equals(this.subtype(), that.subtype());
- }
- return false;
- }
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L4ModificationInstruction.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L4ModificationInstruction.java
deleted file mode 100644
index 441a2c5f..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L4ModificationInstruction.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2014-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.instructions;
-
-import org.onlab.packet.TpPort;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Abstraction of a single traffic treatment step.
- */
-public abstract class L4ModificationInstruction implements Instruction {
-
- /**
- * Represents the type of traffic treatment.
- */
- public enum L4SubType {
- /**
- * TCP src modification.
- */
- TCP_SRC,
-
- /**
- * TCP dst modification.
- */
- TCP_DST,
-
- /**
- * UDP src modification.
- */
- UDP_SRC,
-
- /**
- * UDP dst modification.
- */
- UDP_DST
-
- //TODO: remaining types
- }
-
- /**
- * Returns the subtype of the modification instruction.
- *
- * @return type of instruction
- */
- public abstract L4SubType subtype();
-
- @Override
- public Type type() {
- return Type.L4MODIFICATION;
- }
-
- /**
- * Represents a L4 src/dst modification instruction.
- */
- public static final class ModTransportPortInstruction extends L4ModificationInstruction {
-
- private final L4SubType subtype;
- private final TpPort port;
-
- public ModTransportPortInstruction(L4SubType subtype, TpPort port) {
- this.subtype = subtype;
- this.port = port;
- }
-
- @Override
- public L4SubType subtype() {
- return this.subtype;
- }
-
- public TpPort port() {
- return this.port;
- }
-
- @Override
- public String toString() {
- return toStringHelper(subtype().toString())
- .add("port", port).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type(), subtype(), port);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ModTransportPortInstruction) {
- ModTransportPortInstruction that = (ModTransportPortInstruction) obj;
- return Objects.equals(port, that.port) &&
- Objects.equals(this.subtype(), that.subtype());
- }
- return false;
- }
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/package-info.java
deleted file mode 100644
index 65f58a40..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2014 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.
- */
-
-/**
- * Traffic treatment model.
- */
-package org.onosproject.net.flow.instructions;