fix for cbench
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instruction.java b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instruction.java
new file mode 100644
index 0000000..5d34fc2
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instruction.java
@@ -0,0 +1,42 @@
+package org.onlab.onos.net.flow.instructions;
+
+/**
+ * Abstraction of a single traffic treatment step.
+ */
+public interface Instruction {
+
+ /**
+ * Represents the type of traffic treatment.
+ */
+ public enum Type {
+ /**
+ * Signifies that the traffic should be dropped.
+ */
+ DROP,
+
+ /**
+ * Signifies that the traffic should be output to a port.
+ */
+ OUTPUT,
+
+ /**
+ * Signifies that.... (do we need this?)
+ */
+ GROUP,
+
+ /**
+ * Signifies that the traffic should be modified in some way.
+ */
+ MODIFICATION
+ }
+
+ // TODO: Create factory class 'Instructions' that will have various factory
+ // to create specific instructions.
+
+ /**
+ * Returns the type of instruction.
+ * @return type of instruction
+ */
+ public Type type();
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instructions.java
new file mode 100644
index 0000000..2365bf0
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instructions.java
@@ -0,0 +1,102 @@
+package org.onlab.onos.net.flow.instructions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.onlab.onos.net.PortNumber;
+import org.onlab.onos.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction;
+import org.onlab.onos.net.flow.instructions.L2ModificationInstruction.SubType;
+import org.onlab.packet.MACAddress;
+/**
+ * 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
+ */
+ public static DropInstruction createDrop() {
+ return new DropInstruction();
+ }
+
+ /**
+ * 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 ModEtherInstruction(SubType.L2_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(SubType.L2_DST, addr);
+ }
+
+ /**
+ * Creates a L2 type modification.
+ * @param l2Type the type to change to
+ * @return a L2 modifications
+ */
+ public static L2ModificationInstruction modL2Type(Short l2Type) {
+ checkNotNull(l2Type, "L2 type cannot be null");
+ return new L2ModificationInstruction.ModEtherTypeInstruction(l2Type);
+ }
+
+ public static L2ModificationInstruction modVlanId(Short vlanId) {
+ checkNotNull(vlanId, "VLAN id cannot be null");
+ return new L2ModificationInstruction.ModVlanIdInstruction(vlanId);
+ }
+
+ /*
+ * Output instructions
+ */
+
+ public static final class DropInstruction implements Instruction {
+ @Override
+ public Type type() {
+ return Type.DROP;
+ }
+ }
+
+
+ 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;
+ }
+ }
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/instructions/L2ModificationInstruction.java b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/L2ModificationInstruction.java
new file mode 100644
index 0000000..f71ad2e
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/L2ModificationInstruction.java
@@ -0,0 +1,124 @@
+package org.onlab.onos.net.flow.instructions;
+
+import org.onlab.packet.MACAddress;
+
+/**
+ * Abstraction of a single traffic treatment step.
+ * @param <T> the type parameter for the instruction
+ */
+public abstract class L2ModificationInstruction implements Instruction {
+
+ /**
+ * Represents the type of traffic treatment.
+ */
+ public enum SubType {
+ /**
+ * Ether src modification.
+ */
+ L2_SRC,
+
+ /**
+ * Ether dst modification.
+ */
+ L2_DST,
+
+ /**
+ * Ethertype modification.
+ */
+ L2_TYPE,
+
+ /**
+ * VLAN id modification.
+ */
+ VLAN_ID,
+
+ /**
+ * VLAN priority modification.
+ */
+ VLAN_PCP
+ }
+
+ // TODO: Create factory class 'Instructions' that will have various factory
+ // to create specific instructions.
+
+ /**
+ * Returns the subtype of the modification instruction.
+ * @return type of instruction
+ */
+ public abstract SubType subtype();
+
+ @Override
+ public Type type() {
+ return Type.MODIFICATION;
+ }
+
+ /**
+ * Represents a L2 src/dst modification instruction.
+ */
+ public static final class ModEtherInstruction extends L2ModificationInstruction {
+
+ private final SubType subtype;
+ private final MACAddress mac;
+
+ public ModEtherInstruction(SubType subType, MACAddress addr) {
+ this.subtype = subType;
+ this.mac = addr;
+ }
+
+ @Override
+ public SubType subtype() {
+ return this.subtype;
+ }
+
+ public MACAddress mac() {
+ return this.mac;
+ }
+
+ }
+
+ /**
+ * Represents a L2 type modification instruction.
+ */
+ public static final class ModEtherTypeInstruction extends L2ModificationInstruction {
+
+ public final short l2Type;
+
+ public ModEtherTypeInstruction(short l2Type) {
+ this.l2Type = l2Type;
+ }
+
+ @Override
+ public SubType subtype() {
+ return SubType.L2_TYPE;
+ }
+
+ public short l2Type() {
+ return this.l2Type;
+ }
+
+ }
+
+ /**
+ * Represents a VLAN id modification instruction.
+ */
+ public static final class ModVlanIdInstruction extends L2ModificationInstruction {
+
+ public final Short vlanId;
+
+ public ModVlanIdInstruction(Short vlanId) {
+ this.vlanId = vlanId;
+ }
+
+ @Override
+ public SubType subtype() {
+ return SubType.VLAN_ID;
+ }
+
+ public Short vlanId() {
+ return this.vlanId;
+ }
+
+ }
+
+
+}