Refactored driver to use new FlowRule api.

Deprecated transition with table types and added api for transition with table ids.

Change-Id: Ifcf2d87d16810666d992e4d9f5ddca3d0da460be
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
index 7d3525c..f944f4b 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
@@ -289,7 +289,7 @@
         return new Builder();
     }
 
-    private static final class Builder implements FlowRule.Builder {
+    public static final class Builder implements FlowRule.Builder {
 
         private FlowId flowId;
         private Integer priority;
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
index 01c95bd..fbca078 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
@@ -328,7 +328,12 @@
 
         @Override
         public Builder transition(FlowRule.Type type) {
-            return add(Instructions.transition(type));
+            return add(Instructions.transition(type.ordinal()));
+        }
+
+        @Override
+        public Builder transition(Integer tableId) {
+            return add(Instructions.transition(tableId));
         }
 
         @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
index f60e9f2..4e62a2a 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
@@ -230,9 +230,19 @@
          * @param type the table type
          * @return a treatement builder
          */
+        @Deprecated
         public Builder transition(FlowRule.Type type);
 
         /**
+         * Sets the next table id to transition to.
+         *
+         * @param tableId the table table
+         * @return a treatement builder
+         */
+        public Builder transition(Integer tableId);
+
+
+        /**
          * Pops outermost VLAN tag.
          *
          * @return a treatment builder.
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index f422e14..03588b8 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -22,11 +22,8 @@
 import org.onlab.packet.VlanId;
 import org.onosproject.core.GroupId;
 import org.onosproject.net.PortNumber;
-import org.onosproject.net.flow.FlowRule;
 import org.onosproject.net.flow.instructions.L0ModificationInstruction.L0SubType;
 import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambdaInstruction;
-import org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType;
-import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction.L3SubType;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction;
@@ -36,12 +33,6 @@
 
 import static com.google.common.base.MoreObjects.toStringHelper;
 import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLabelInstruction;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsTtlInstruction;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.PopVlanInstruction;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.PushHeaderInstructions;
 
 /**
  * Factory class for creating various traffic treatment instructions.
@@ -103,7 +94,8 @@
      */
     public static L2ModificationInstruction modL2Src(MacAddress addr) {
         checkNotNull(addr, "Src l2 address cannot be null");
-        return new ModEtherInstruction(L2SubType.ETH_SRC, addr);
+        return new L2ModificationInstruction.ModEtherInstruction(
+                L2ModificationInstruction.L2SubType.ETH_SRC, addr);
     }
 
     /**
@@ -114,7 +106,8 @@
      */
     public static L2ModificationInstruction modL2Dst(MacAddress addr) {
         checkNotNull(addr, "Dst l2 address cannot be null");
-        return new ModEtherInstruction(L2SubType.ETH_DST, addr);
+        return new L2ModificationInstruction.ModEtherInstruction(
+                L2ModificationInstruction.L2SubType.ETH_DST, addr);
     }
 
     /**
@@ -125,7 +118,7 @@
      */
     public static L2ModificationInstruction modVlanId(VlanId vlanId) {
         checkNotNull(vlanId, "VLAN id cannot be null");
-        return new ModVlanIdInstruction(vlanId);
+        return new L2ModificationInstruction.ModVlanIdInstruction(vlanId);
     }
 
     /**
@@ -136,7 +129,7 @@
      */
     public static L2ModificationInstruction modVlanPcp(Byte vlanPcp) {
         checkNotNull(vlanPcp, "VLAN Pcp cannot be null");
-        return new ModVlanPcpInstruction(vlanPcp);
+        return new L2ModificationInstruction.ModVlanPcpInstruction(vlanPcp);
     }
 
     /**
@@ -147,7 +140,7 @@
      */
     public static L2ModificationInstruction modMplsLabel(MplsLabel mplsLabel) {
         checkNotNull(mplsLabel, "MPLS label cannot be null");
-        return new ModMplsLabelInstruction(mplsLabel);
+        return new L2ModificationInstruction.ModMplsLabelInstruction(mplsLabel);
     }
 
     /**
@@ -156,7 +149,7 @@
      * @return a L2 Modification
      */
     public static L2ModificationInstruction decMplsTtl() {
-        return new ModMplsTtlInstruction();
+        return new L2ModificationInstruction.ModMplsTtlInstruction();
     }
 
     /**
@@ -246,7 +239,8 @@
      * @return a L2 modification.
      */
     public static Instruction pushMpls() {
-        return new PushHeaderInstructions(L2SubType.MPLS_PUSH,
+        return new L2ModificationInstruction.PushHeaderInstructions(
+                L2ModificationInstruction.L2SubType.MPLS_PUSH,
                                           Ethernet.MPLS_UNICAST);
     }
 
@@ -256,7 +250,8 @@
      * @return a L2 modification.
      */
     public static Instruction popMpls() {
-        return new PushHeaderInstructions(L2SubType.MPLS_POP,
+        return new L2ModificationInstruction.PushHeaderInstructions(
+                L2ModificationInstruction.L2SubType.MPLS_POP,
                                           Ethernet.MPLS_UNICAST);
     }
 
@@ -268,7 +263,8 @@
      */
     public static Instruction popMpls(Short etherType) {
         checkNotNull(etherType, "Ethernet type cannot be null");
-        return new PushHeaderInstructions(L2SubType.MPLS_POP, etherType);
+        return new L2ModificationInstruction.PushHeaderInstructions(
+                L2ModificationInstruction.L2SubType.MPLS_POP, etherType);
     }
 
     /**
@@ -277,7 +273,8 @@
      * @return a L2 modification
      */
     public static Instruction popVlan() {
-        return new PopVlanInstruction(L2SubType.VLAN_POP);
+        return new L2ModificationInstruction.PopVlanInstruction(
+                L2ModificationInstruction.L2SubType.VLAN_POP);
     }
 
     /**
@@ -286,18 +283,19 @@
      * @return a L2 modification
      */
     public static Instruction pushVlan() {
-        return new PushHeaderInstructions(L2SubType.VLAN_PUSH, Ethernet.TYPE_VLAN);
+        return new L2ModificationInstruction.PushHeaderInstructions(
+                L2ModificationInstruction.L2SubType.VLAN_PUSH, Ethernet.TYPE_VLAN);
     }
 
     /**
-     * Sends the packet to the table described in 'type'.
+     * Sends the packet to the table id.
      *
-     * @param type flow rule table type
+     * @param tableId flow rule table id
      * @return table type transition instruction
      */
-    public static Instruction transition(FlowRule.Type type) {
-        checkNotNull(type, "Table type cannot be null");
-        return new TableTypeTransition(type);
+    public static Instruction transition(Integer tableId) {
+        checkNotNull(tableId, "Table id cannot be null");
+        return new TableTypeTransition(tableId);
     }
 
     /**
@@ -421,13 +419,12 @@
         }
     }
 
-    // FIXME: Temporary support for this. This should probably become it's own
-    // type like other instructions.
-    public static class TableTypeTransition implements Instruction {
-        private final FlowRule.Type tableType;
 
-        TableTypeTransition(FlowRule.Type type) {
-            this.tableType = type;
+    public static class TableTypeTransition implements Instruction {
+        private final Integer tableId;
+
+        TableTypeTransition(Integer tableId) {
+            this.tableId = tableId;
         }
 
         @Override
@@ -435,19 +432,19 @@
             return Type.TABLE;
         }
 
-        public FlowRule.Type tableType() {
-            return this.tableType;
+        public Integer tableId() {
+            return this.tableId;
         }
 
         @Override
         public String toString() {
             return toStringHelper(type().toString())
-                    .add("tableType", this.tableType).toString();
+                    .add("tableId", this.tableId).toString();
         }
 
         @Override
         public int hashCode() {
-            return Objects.hash(type(), tableType);
+            return Objects.hash(type(), tableId);
         }
 
         @Override
@@ -457,7 +454,7 @@
             }
             if (obj instanceof TableTypeTransition) {
                 TableTypeTransition that = (TableTypeTransition) obj;
-                return Objects.equals(tableType, that.tableType);
+                return Objects.equals(tableId, that.tableId);
 
             }
             return false;
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java b/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java
index 4c7bdee..c54be23 100644
--- a/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java
@@ -77,6 +77,18 @@
  */
 public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeliner {
 
+
+
+    protected static final int FIRST_TABLE = 0;
+    protected static final int VLAN_MPLS_TABLE = 1;
+    protected static final int VLAN_TABLE = 2;
+    //protected static final int MPLS_TABLE = 3;
+    protected static final int ETHER_TABLE = 4;
+    protected static final int COS_MAP_TABLE = 5;
+    protected static final int FIB_TABLE = 6;
+    protected static final int LOCAL_TABLE = 9;
+
+
     private static final int CONTROLLER_PRIORITY = 255;
     private static final int DROP_PRIORITY = 0;
     private static final int HIGHEST_PRIORITY = 0xffff;
@@ -266,10 +278,23 @@
                 .group(group.id())
                 .build();
 
-        return Collections.singletonList(
-                new DefaultFlowRule(deviceId, filteredSelector, treatment,
-                                   fwd.priority(), fwd.appId(), 0, fwd.permanent(),
-                                   FlowRule.Type.IP));
+        FlowRule.Builder ruleBuilder = DefaultFlowRule.builder()
+                .fromApp(fwd.appId())
+                .withPriority(fwd.priority())
+                .forDevice(deviceId)
+                .withSelector(filteredSelector)
+                .withTreatment(treatment);
+
+        if (fwd.permanent()) {
+            ruleBuilder.makePermanent();
+        } else {
+            ruleBuilder.makeTemporary(fwd.timeout());
+        }
+
+        ruleBuilder.forTable(FIB_TABLE);
+
+
+        return Collections.singletonList(ruleBuilder.build());
 
     }
 
@@ -296,11 +321,15 @@
                 TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
                 TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
                 selector.matchEthDst(e.mac());
-                treatment.transition(FlowRule.Type.VLAN_MPLS);
-                FlowRule rule = new DefaultFlowRule(deviceId, selector.build(),
-                                                    treatment.build(),
-                                                    CONTROLLER_PRIORITY, applicationId,
-                                                    0, true, FlowRule.Type.FIRST);
+                treatment.transition(VLAN_MPLS_TABLE);
+                FlowRule rule = DefaultFlowRule.builder()
+                        .forDevice(deviceId)
+                        .withSelector(selector.build())
+                        .withTreatment(treatment.build())
+                        .withPriority(CONTROLLER_PRIORITY)
+                        .fromApp(applicationId)
+                        .makePermanent()
+                        .forTable(FIRST_TABLE).build();
                 ops =  install ? ops.add(rule) : ops.remove(rule);
             } else if (c.type() == Criterion.Type.VLAN_VID) {
                 Criteria.VlanIdCriterion v = (Criteria.VlanIdCriterion) c;
@@ -309,12 +338,16 @@
                 TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
                 selector.matchVlanId(v.vlanId());
                 selector.matchInPort(p.port());
-                treatment.transition(FlowRule.Type.ETHER);
+                treatment.transition(ETHER_TABLE);
                 treatment.deferred().popVlan();
-                FlowRule rule = new DefaultFlowRule(deviceId, selector.build(),
-                                           treatment.build(),
-                                           CONTROLLER_PRIORITY, applicationId,
-                                           0, true, FlowRule.Type.VLAN);
+                FlowRule rule = DefaultFlowRule.builder()
+                        .forDevice(deviceId)
+                        .withSelector(selector.build())
+                        .withTreatment(treatment.build())
+                        .withPriority(CONTROLLER_PRIORITY)
+                        .fromApp(applicationId)
+                        .makePermanent()
+                        .forTable(VLAN_TABLE).build();
                 ops = install ? ops.add(rule) : ops.remove(rule);
             } else if (c.type() == Criterion.Type.IPV4_DST) {
                 Criteria.IPCriterion ip = (Criteria.IPCriterion) c;
@@ -323,10 +356,16 @@
                 TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
                 selector.matchEthType(Ethernet.TYPE_IPV4);
                 selector.matchIPDst(ip.ip());
-                treatment.transition(FlowRule.Type.ACL);
-                FlowRule rule = new DefaultFlowRule(deviceId, selector.build(),
-                                           treatment.build(), HIGHEST_PRIORITY, appId,
-                                           0, true, FlowRule.Type.IP);
+                treatment.transition(LOCAL_TABLE);
+                FlowRule rule = DefaultFlowRule.builder()
+                        .forDevice(deviceId)
+                        .withSelector(selector.build())
+                        .withTreatment(treatment.build())
+                        .withPriority(HIGHEST_PRIORITY)
+                        .fromApp(applicationId)
+                        .makePermanent()
+                        .forTable(FIB_TABLE).build();
+
                 ops = install ? ops.add(rule) : ops.remove(rule);
             } else {
                 log.warn("Driver does not currently process filtering condition"
@@ -381,12 +420,17 @@
         treatment = DefaultTrafficTreatment.builder();
 
         selector.matchEthDst(MacAddress.BROADCAST);
-        treatment.transition(FlowRule.Type.VLAN_MPLS);
+        treatment.transition(VLAN_MPLS_TABLE);
 
-        FlowRule rule = new DefaultFlowRule(deviceId, selector.build(),
-                                            treatment.build(),
-                                            CONTROLLER_PRIORITY, appId, 0,
-                                            true, FlowRule.Type.FIRST);
+        FlowRule rule = DefaultFlowRule.builder()
+                .forDevice(deviceId)
+                .withSelector(selector.build())
+                .withTreatment(treatment.build())
+                .withPriority(CONTROLLER_PRIORITY)
+                .fromApp(appId)
+                .makePermanent()
+                .forTable(FIRST_TABLE).build();
+
 
         FlowRuleOperations.Builder ops = FlowRuleOperations.builder();
 
@@ -399,9 +443,15 @@
 
         treatment.drop();
 
-        rule = new DefaultFlowRule(deviceId, selector.build(),
-                                   treatment.build(), DROP_PRIORITY, appId,
-                                   0, true, FlowRule.Type.FIRST);
+        rule = DefaultFlowRule.builder()
+                .forDevice(deviceId)
+                .withSelector(selector.build())
+                .withTreatment(treatment.build())
+                .withPriority(DROP_PRIORITY)
+                .fromApp(appId)
+                .makePermanent()
+                .forTable(FIRST_TABLE).build();
+
 
         ops = install ? ops.add(rule) : ops.remove(rule);
 
@@ -427,11 +477,17 @@
         FlowRule rule;
 
         selector.matchVlanId(VlanId.ANY);
-        treatment.transition(FlowRule.Type.VLAN);
+        treatment.transition(VLAN_TABLE);
 
-        rule = new DefaultFlowRule(deviceId, selector.build(),
-                                   treatment.build(), CONTROLLER_PRIORITY,
-                                   appId, 0, true, FlowRule.Type.VLAN_MPLS);
+        rule = DefaultFlowRule.builder()
+                .forDevice(deviceId)
+                .withSelector(selector.build())
+                .withTreatment(treatment.build())
+                .withPriority(CONTROLLER_PRIORITY)
+                .fromApp(appId)
+                .makePermanent()
+                .forTable(VLAN_MPLS_TABLE).build();
+
 
         ops = install ? ops.add(rule) : ops.remove(rule);
 
@@ -463,9 +519,14 @@
 
         treatment.drop();
 
-        rule = new DefaultFlowRule(deviceId, selector.build(),
-                                   treatment.build(), DROP_PRIORITY, appId,
-                                   0, true, FlowRule.Type.VLAN);
+        rule = DefaultFlowRule.builder()
+                .forDevice(deviceId)
+                .withSelector(selector.build())
+                .withTreatment(treatment.build())
+                .withPriority(DROP_PRIORITY)
+                .fromApp(appId)
+                .makePermanent()
+                .forTable(VLAN_TABLE).build();
 
         ops = install ? ops.add(rule) : ops.remove(rule);
 
@@ -492,9 +553,14 @@
         selector.matchEthType(Ethernet.TYPE_ARP);
         treatment.punt();
 
-        rule = new DefaultFlowRule(deviceId, selector.build(),
-                                   treatment.build(), CONTROLLER_PRIORITY,
-                                   appId, 0, true, FlowRule.Type.ETHER);
+        rule = DefaultFlowRule.builder()
+                .forDevice(deviceId)
+                .withSelector(selector.build())
+                .withTreatment(treatment.build())
+                .withPriority(CONTROLLER_PRIORITY)
+                .fromApp(appId)
+                .makePermanent()
+                .forTable(ETHER_TABLE).build();
 
         ops = install ? ops.add(rule) : ops.remove(rule);
 
@@ -502,11 +568,16 @@
         treatment = DefaultTrafficTreatment.builder();
 
         selector.matchEthType(Ethernet.TYPE_IPV4);
-        treatment.transition(FlowRule.Type.COS);
+        treatment.transition(COS_MAP_TABLE);
 
-        rule = new DefaultFlowRule(deviceId, selector.build(),
-                                   treatment.build(), CONTROLLER_PRIORITY,
-                                   appId, 0, true, FlowRule.Type.ETHER);
+        rule = DefaultFlowRule.builder()
+                .forDevice(deviceId)
+                .withPriority(CONTROLLER_PRIORITY)
+                .withSelector(selector.build())
+                .withTreatment(treatment.build())
+                .fromApp(appId)
+                .makePermanent()
+                .forTable(ETHER_TABLE).build();
 
         ops = install ? ops.add(rule) : ops.remove(rule);
 
@@ -516,9 +587,15 @@
 
         treatment.drop();
 
-        rule = new DefaultFlowRule(deviceId, selector.build(),
-                                   treatment.build(), DROP_PRIORITY, appId,
-                                   0, true, FlowRule.Type.ETHER);
+        rule = DefaultFlowRule.builder()
+                .forDevice(deviceId)
+                .withSelector(selector.build())
+                .withTreatment(treatment.build())
+                .withPriority(DROP_PRIORITY)
+                .fromApp(appId)
+                .makePermanent()
+                .forTable(ETHER_TABLE).build();
+
 
         ops = install ? ops.add(rule) : ops.remove(rule);
 
@@ -543,11 +620,16 @@
         FlowRuleOperations.Builder ops = FlowRuleOperations.builder();
         FlowRule rule;
 
-        treatment.transition(FlowRule.Type.IP);
+        treatment.transition(FIB_TABLE);
 
-        rule = new DefaultFlowRule(deviceId, selector.build(),
-                                   treatment.build(), DROP_PRIORITY, appId,
-                                   0, true, FlowRule.Type.COS);
+        rule = DefaultFlowRule.builder()
+                .forDevice(deviceId)
+                .withSelector(selector.build())
+                .withTreatment(treatment.build())
+                .withPriority(DROP_PRIORITY)
+                .fromApp(appId)
+                .makePermanent()
+                .forTable(COS_MAP_TABLE).build();
 
         ops = install ? ops.add(rule) : ops.remove(rule);
 
@@ -577,9 +659,14 @@
 
         treatment.drop();
 
-        rule = new DefaultFlowRule(deviceId, selector.build(),
-                                   treatment.build(), DROP_PRIORITY, appId,
-                                   0, true, FlowRule.Type.IP);
+        rule = DefaultFlowRule.builder()
+                .forDevice(deviceId)
+                .withSelector(selector.build())
+                .withTreatment(treatment.build())
+                .withPriority(DROP_PRIORITY)
+                .fromApp(appId)
+                .makePermanent()
+                .forTable(FIB_TABLE).build();
 
         ops = install ? ops.add(rule) : ops.remove(rule);
 
@@ -605,9 +692,14 @@
 
         treatment.punt();
 
-        rule = new DefaultFlowRule(deviceId, selector.build(),
-                                   treatment.build(), CONTROLLER_PRIORITY,
-                                   appId, 0, true, FlowRule.Type.DEFAULT);
+        rule = DefaultFlowRule.builder()
+                .forDevice(deviceId)
+                .withSelector(selector.build())
+                .withTreatment(treatment.build())
+                .withPriority(CONTROLLER_PRIORITY)
+                .fromApp(appId)
+                .makePermanent()
+                .forTable(LOCAL_TABLE).build();
 
         ops = install ? ops.add(rule) : ops.remove(rule);
 
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
index 30711ad..3ba155f 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
@@ -36,7 +36,6 @@
 import org.onosproject.net.flow.instructions.L3ModificationInstruction;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction;
-import org.onosproject.openflow.controller.OpenFlowSwitch;
 import org.projectfloodlight.openflow.protocol.OFFactory;
 import org.projectfloodlight.openflow.protocol.OFFlowAdd;
 import org.projectfloodlight.openflow.protocol.OFFlowDelete;
@@ -238,38 +237,10 @@
 
     private OFInstruction buildTableGoto(Instructions.TableTypeTransition i) {
         OFInstruction instruction = factory().instructions().gotoTable(
-                TableId.of(getTableType(i.tableType()).ordinal()));
+                TableId.of(i.tableId()));
         return instruction;
     }
 
-    // FIXME: this has to go as well perhaps when we implement the SelectorService.
-    private OpenFlowSwitch.TableType getTableType(FlowRule.Type type) {
-        switch (type) {
-
-            case DEFAULT:
-                return OpenFlowSwitch.TableType.NONE;
-            case IP:
-                return OpenFlowSwitch.TableType.IP;
-            case MPLS:
-                return OpenFlowSwitch.TableType.MPLS;
-            case ACL:
-                return OpenFlowSwitch.TableType.ACL;
-            case VLAN_MPLS:
-                return OpenFlowSwitch.TableType.VLAN_MPLS;
-            case VLAN:
-                return OpenFlowSwitch.TableType.VLAN;
-            case ETHER:
-                return OpenFlowSwitch.TableType.ETHER;
-            case COS:
-                return OpenFlowSwitch.TableType.COS;
-            case FIRST:
-                return OpenFlowSwitch.TableType.FIRST;
-            default:
-                return OpenFlowSwitch.TableType.NONE;
-        }
-    }
-
-
     private OFAction buildL0Modification(Instruction i) {
         L0ModificationInstruction l0m = (L0ModificationInstruction) i;
         switch (l0m.subtype()) {