fix for cbench
diff --git a/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java b/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
index 98c14f5..b9ae4c4 100644
--- a/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
+++ b/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
@@ -9,7 +9,7 @@
 import org.onlab.onos.net.HostId;
 import org.onlab.onos.net.Path;
 import org.onlab.onos.net.PortNumber;
-import org.onlab.onos.net.flow.Instructions;
+import org.onlab.onos.net.flow.instructions.Instructions;
 import org.onlab.onos.net.host.HostService;
 import org.onlab.onos.net.packet.InboundPacket;
 import org.onlab.onos.net.packet.PacketContext;
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
index 6eaa2c3..6064263 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
@@ -6,6 +6,7 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.onlab.onos.net.flow.instructions.Instruction;
 import org.slf4j.Logger;
 
 @SuppressWarnings("rawtypes")
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/Instructions.java b/core/api/src/main/java/org/onlab/onos/net/flow/Instructions.java
deleted file mode 100644
index cfe1440..0000000
--- a/core/api/src/main/java/org/onlab/onos/net/flow/Instructions.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.onlab.onos.net.flow;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onlab.onos.net.PortNumber;
-/**
- * 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);
-    }
-
-    // TODO: Move these out into separate classes and to flow.instruction package
-    public static DropInstruction createDrop() {
-        return new DropInstruction();
-    }
-
-    // TODO: add create methods
-
-    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/TrafficTreatment.java b/core/api/src/main/java/org/onlab/onos/net/flow/TrafficTreatment.java
index b8b9c10..068bc2c 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/TrafficTreatment.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/TrafficTreatment.java
@@ -2,6 +2,8 @@
 
 import java.util.List;
 
+import org.onlab.onos.net.flow.instructions.Instruction;
+
 /**
  * Abstraction of network traffic treatment.
  */
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/Instruction.java b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instruction.java
similarity index 94%
rename from core/api/src/main/java/org/onlab/onos/net/flow/Instruction.java
rename to core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instruction.java
index 67e3d67..5d34fc2 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/Instruction.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/instructions/Instruction.java
@@ -1,4 +1,4 @@
-package org.onlab.onos.net.flow;
+package org.onlab.onos.net.flow.instructions;
 
 /**
  * Abstraction of a single traffic treatment step.
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;
+        }
+
+    }
+
+
+}
diff --git a/of/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java b/of/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java
index 3c573d3..d7e0186 100644
--- a/of/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java
+++ b/of/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java
@@ -77,6 +77,11 @@
         this.dpid = dp;
     }
 
+    public AbstractOpenFlowSwitch(Dpid dpid, OFDescStatsReply desc) {
+        this.dpid = dpid;
+        this.desc = desc;
+    }
+
     //************************
     // Channel related
     //************************
diff --git a/of/ctl/src/main/java/org/onlab/onos/of/drivers/impl/DriverManager.java b/of/ctl/src/main/java/org/onlab/onos/of/drivers/impl/DriverManager.java
index 1744a76..0dd897f 100644
--- a/of/ctl/src/main/java/org/onlab/onos/of/drivers/impl/DriverManager.java
+++ b/of/ctl/src/main/java/org/onlab/onos/of/drivers/impl/DriverManager.java
@@ -11,6 +11,7 @@
 import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriverFactory;
 import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
 import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFPortDesc;
 import org.projectfloodlight.openflow.protocol.OFVersion;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -57,7 +58,7 @@
 
         log.warn("DriverManager could not identify switch desc: {}. "
                 + "Assigning AbstractOpenFlowSwich", desc);
-        return new AbstractOpenFlowSwitch(dpid) {
+        return new AbstractOpenFlowSwitch(dpid, desc) {
 
             @Override
             public void write(List<OFMessage> msgs) {
@@ -85,6 +86,15 @@
             public boolean isDriverHandshakeComplete() {
                 return true;
             }
+
+            @Override
+            public List<OFPortDesc> getPorts() {
+                if (this.factory().getVersion() == OFVersion.OF_10) {
+                    return Collections.unmodifiableList(features.getPorts());
+                } else {
+                    return Collections.unmodifiableList(ports.getEntries());
+                }
+            }
         };
     }
 
diff --git a/providers/of/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java b/providers/of/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
index 0330bc6..db9aae2 100644
--- a/providers/of/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
+++ b/providers/of/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
@@ -5,9 +5,9 @@
 import java.util.List;
 
 import org.onlab.onos.net.PortNumber;
-import org.onlab.onos.net.flow.Instruction;
-import org.onlab.onos.net.flow.Instruction.Type;
-import org.onlab.onos.net.flow.Instructions.OutputInstruction;
+import org.onlab.onos.net.flow.instructions.Instruction;
+import org.onlab.onos.net.flow.instructions.Instruction.Type;
+import org.onlab.onos.net.flow.instructions.Instructions.OutputInstruction;
 import org.onlab.onos.net.packet.DefaultPacketContext;
 import org.onlab.onos.net.packet.InboundPacket;
 import org.onlab.onos.net.packet.OutboundPacket;