Refactor fabric.p4 and pipeliner

 - Rename constants, some control blocks may share same action
 - Remove unused match keys from ACL table
 - Better style for constant file
 - Ignore unsupported match from objective

Change-Id: I6472426d2a2607581c6fa7479ad40d7090a7d660
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java
index c37ffac..c29b599 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java
@@ -47,14 +47,18 @@
     // Header field IDs
     public static final PiMatchFieldId HF_FABRIC_METADATA_L4_SRC_PORT_ID =
             buildPiMatchField(FABRIC_METADATA, "l4_src_port", false);
-    public static final PiMatchFieldId HF_MPLS_BOS_ID = buildPiMatchField(MPLS, "bos", true);
-    public static final PiMatchFieldId HF_IPV4_SRC_ADDR_ID = buildPiMatchField(IPV4, "src_addr", true);
-    public static final PiMatchFieldId HF_VLAN_TAG_VLAN_ID_ID = buildPiMatchField(VLAN_TAG, "vlan_id", true);
-    public static final PiMatchFieldId HF_MPLS_LABEL_ID = buildPiMatchField(MPLS, "label", true);
-    public static final PiMatchFieldId HF_IPV6_DST_ADDR_ID = buildPiMatchField(IPV6, "dst_addr", true);
-    public static final PiMatchFieldId HF_ETHERNET_SRC_ADDR_ID = buildPiMatchField(ETHERNET, "src_addr", true);
-    public static final PiMatchFieldId HF_ICMP_ICMP_TYPE_ID = buildPiMatchField(ICMP, "icmp_type", true);
-    public static final PiMatchFieldId HF_IPV6_SRC_ADDR_ID = buildPiMatchField(IPV6, "src_addr", true);
+    public static final PiMatchFieldId HF_IPV4_SRC_ADDR_ID =
+            buildPiMatchField(IPV4, "src_addr", true);
+    public static final PiMatchFieldId HF_VLAN_TAG_VLAN_ID_ID =
+            buildPiMatchField(VLAN_TAG, "vlan_id", true);
+    public static final PiMatchFieldId HF_MPLS_LABEL_ID =
+            buildPiMatchField(MPLS, "label", true);
+    public static final PiMatchFieldId HF_IPV6_DST_ADDR_ID =
+            buildPiMatchField(IPV6, "dst_addr", true);
+    public static final PiMatchFieldId HF_ETHERNET_SRC_ADDR_ID =
+            buildPiMatchField(ETHERNET, "src_addr", true);
+    public static final PiMatchFieldId HF_ICMP_ICMP_TYPE_ID =
+            buildPiMatchField(ICMP, "icmp_type", true);
     public static final PiMatchFieldId HF_FABRIC_METADATA_NEXT_ID_ID =
             buildPiMatchField(FABRIC_METADATA, "next_id", false);
     public static final PiMatchFieldId HF_FABRIC_METADATA_L4_DST_PORT_ID =
@@ -63,12 +67,16 @@
             buildPiMatchField(STANDARD_METADATA, "ingress_port", false);
     public static final PiMatchFieldId HF_FABRIC_METADATA_ORIGINAL_ETHER_TYPE_ID =
             buildPiMatchField(FABRIC_METADATA, "original_ether_type", false);
-    public static final PiMatchFieldId HF_IPV4_DST_ADDR_ID = buildPiMatchField(IPV4, "dst_addr", true);
-    public static final PiMatchFieldId HF_VLAN_TAG_IS_VALID_ID = buildPiMatchField(VLAN_TAG, "is_valid", true);
+    public static final PiMatchFieldId HF_IPV4_DST_ADDR_ID =
+            buildPiMatchField(IPV4, "dst_addr", true);
+    public static final PiMatchFieldId HF_VLAN_TAG_IS_VALID_ID =
+            buildPiMatchField(VLAN_TAG, "is_valid", true);
     public static final PiMatchFieldId HF_FABRIC_METADATA_IP_PROTO_ID =
             buildPiMatchField(FABRIC_METADATA, "ip_proto", false);
-    public static final PiMatchFieldId HF_ETHERNET_DST_ADDR_ID = buildPiMatchField(ETHERNET, "dst_addr", true);
-    public static final PiMatchFieldId HF_ICMP_ICMP_CODE_ID = buildPiMatchField(ICMP, "icmp_code", true);
+    public static final PiMatchFieldId HF_ETHERNET_DST_ADDR_ID =
+            buildPiMatchField(ETHERNET, "dst_addr", true);
+    public static final PiMatchFieldId HF_ICMP_ICMP_CODE_ID =
+            buildPiMatchField(ICMP, "icmp_code", true);
 
     private static PiMatchFieldId buildPiMatchField(String header, String field, boolean withHdrPrefix) {
         if (withHdrPrefix) {
@@ -79,17 +87,25 @@
     }
 
     // Table IDs
-    public static final PiTableId TBL_MULTICAST_V4_ID = PiTableId.of("forwarding.multicast_v4");
-    public static final PiTableId TBL_MULTICAST_V6_ID = PiTableId.of("forwarding.multicast_v6");
+    public static final PiTableId TBL_MULTICAST_V4_ID =
+            PiTableId.of("forwarding.multicast_v4");
+    public static final PiTableId TBL_MULTICAST_V6_ID =
+            PiTableId.of("forwarding.multicast_v6");
     public static final PiTableId TBL_ACL_ID = PiTableId.of("forwarding.acl");
-    public static final PiTableId TBL_BROADCAST_ID = PiTableId.of("next.broadcast");
+    public static final PiTableId TBL_BROADCAST_ID =
+            PiTableId.of("next.broadcast");
     public static final PiTableId TBL_HASHED_ID = PiTableId.of("next.hashed");
-    public static final PiTableId TBL_INGRESS_PORT_VLAN_ID = PiTableId.of("filtering.ingress_port_vlan");
-    public static final PiTableId TBL_FWD_CLASSIFIER_ID = PiTableId.of("filtering.fwd_classifier");
-    public static final PiTableId TBL_UNICAST_V6_ID = PiTableId.of("forwarding.unicast_v6");
+    public static final PiTableId TBL_INGRESS_PORT_VLAN_ID =
+            PiTableId.of("filtering.ingress_port_vlan");
+    public static final PiTableId TBL_FWD_CLASSIFIER_ID =
+            PiTableId.of("filtering.fwd_classifier");
+    public static final PiTableId TBL_UNICAST_V6_ID =
+            PiTableId.of("forwarding.unicast_v6");
     public static final PiTableId TBL_SIMPLE_ID = PiTableId.of("next.simple");
-    public static final PiTableId TBL_BRIDGING_ID = PiTableId.of("forwarding.bridging");
-    public static final PiTableId TBL_UNICAST_V4_ID = PiTableId.of("forwarding.unicast_v4");
+    public static final PiTableId TBL_BRIDGING_ID =
+            PiTableId.of("forwarding.bridging");
+    public static final PiTableId TBL_UNICAST_V4_ID =
+            PiTableId.of("forwarding.unicast_v4");
     public static final PiTableId TBL_MPLS_ID = PiTableId.of("forwarding.mpls");
 
     // Indirect Counter IDs
@@ -101,39 +117,64 @@
     // Direct Counter IDs
 
     // Action IDs
-    public static final PiActionId ACT_SET_MCAST_GROUP_ID = PiActionId.of("next.set_mcast_group");
-    public static final PiActionId ACT_DUPLICATE_TO_CONTROLLER_ID = PiActionId.of("forwarding.duplicate_to_controller");
-    public static final PiActionId ACT_MPLS_ROUTING_V4_ID = PiActionId.of("next.mpls_routing_v4");
-    public static final PiActionId ACT_PUSH_INTERNAL_VLAN_ID = PiActionId.of("filtering.push_internal_vlan");
-    public static final PiActionId ACT_SET_VLAN_OUTPUT_ID = PiActionId.of("next.set_vlan_output");
+    public static final PiActionId ACT_NEXT_SET_MCAST_GROUP_ID =
+            PiActionId.of("next.set_mcast_group");
+    public static final PiActionId ACT_FORWARDING_DUPLICATE_TO_CONTROLLER_ID =
+            PiActionId.of("forwarding.duplicate_to_controller");
+    public static final PiActionId ACT_NEXT_MPLS_ROUTING_V4_ID =
+            PiActionId.of("next.mpls_routing_v4");
+    public static final PiActionId ACT_FILTERING_PUSH_INTERNAL_VLAN_ID =
+            PiActionId.of("filtering.push_internal_vlan");
+    public static final PiActionId ACT_NEXT_SET_VLAN_OUTPUT_ID =
+            PiActionId.of("next.set_vlan_output");
     public static final PiActionId ACT_NOACTION_ID = PiActionId.of("NoAction");
-    public static final PiActionId ACT_FILTERING_DROP_ID = PiActionId.of("filtering.drop");
-    public static final PiActionId ACT_MPLS_ROUTING_V6_ID = PiActionId.of("next.mpls_routing_v6");
-    public static final PiActionId ACT_SET_FORWARDING_TYPE_ID = PiActionId.of("filtering.set_forwarding_type");
-    public static final PiActionId ACT_FORWARDING_DROP_ID = PiActionId.of("forwarding.drop");
-    public static final PiActionId ACT_L3_ROUTING_ID = PiActionId.of("next.l3_routing");
-    public static final PiActionId ACT_OUTPUT_ID = PiActionId.of("next.output");
+    public static final PiActionId ACT_FILTERING_DROP_ID =
+            PiActionId.of("filtering.drop");
+    public static final PiActionId ACT_NEXT_MPLS_ROUTING_V6_ID =
+            PiActionId.of("next.mpls_routing_v6");
+    public static final PiActionId ACT_FILTERING_SET_FORWARDING_TYPE_ID =
+            PiActionId.of("filtering.set_forwarding_type");
+    public static final PiActionId ACT_FORWARDING_DROP_ID =
+            PiActionId.of("forwarding.drop");
+    public static final PiActionId ACT_NEXT_L3_ROUTING_ID =
+            PiActionId.of("next.l3_routing");
+    public static final PiActionId ACT_NEXT_OUTPUT_ID =
+            PiActionId.of("next.output");
     public static final PiActionId ACT_NOP_ID = PiActionId.of("nop");
-    public static final PiActionId ACT_SET_NEXT_ID_ID = PiActionId.of("forwarding.set_next_id");
-    public static final PiActionId ACT_SET_VLAN_ID = PiActionId.of("filtering.set_vlan");
-    public static final PiActionId ACT_POP_MPLS_AND_NEXT_ID = PiActionId.of("forwarding.pop_mpls_and_next");
+    public static final PiActionId ACT_FORWARDING_SET_NEXT_ID_ID =
+            PiActionId.of("forwarding.set_next_id");
+    public static final PiActionId ACT_FILTERING_SET_VLAN_ID =
+            PiActionId.of("filtering.set_vlan");
+    public static final PiActionId ACT_FORWARDING_POP_MPLS_AND_NEXT_ID =
+            PiActionId.of("forwarding.pop_mpls_and_next");
 
     // Action Param IDs
-    public static final PiActionParamId ACT_PRM_DMAC_ID = PiActionParamId.of("dmac");
-    public static final PiActionParamId ACT_PRM_PORT_NUM_ID = PiActionParamId.of("port_num");
-    public static final PiActionParamId ACT_PRM_LABEL_ID = PiActionParamId.of("label");
-    public static final PiActionParamId ACT_PRM_SMAC_ID = PiActionParamId.of("smac");
-    public static final PiActionParamId ACT_PRM_GID_ID = PiActionParamId.of("gid");
-    public static final PiActionParamId ACT_PRM_NEW_VLAN_ID_ID = PiActionParamId.of("new_vlan_id");
-    public static final PiActionParamId ACT_PRM_FWD_TYPE_ID = PiActionParamId.of("fwd_type");
-    public static final PiActionParamId ACT_PRM_NEXT_ID_ID = PiActionParamId.of("next_id");
+    public static final PiActionParamId ACT_PRM_DMAC_ID =
+            PiActionParamId.of("dmac");
+    public static final PiActionParamId ACT_PRM_PORT_NUM_ID =
+            PiActionParamId.of("port_num");
+    public static final PiActionParamId ACT_PRM_LABEL_ID =
+            PiActionParamId.of("label");
+    public static final PiActionParamId ACT_PRM_SMAC_ID =
+            PiActionParamId.of("smac");
+    public static final PiActionParamId ACT_PRM_GID_ID =
+            PiActionParamId.of("gid");
+    public static final PiActionParamId ACT_PRM_NEW_VLAN_ID_ID =
+            PiActionParamId.of("new_vlan_id");
+    public static final PiActionParamId ACT_PRM_FWD_TYPE_ID =
+            PiActionParamId.of("fwd_type");
+    public static final PiActionParamId ACT_PRM_NEXT_ID_ID =
+            PiActionParamId.of("next_id");
 
     // Action Profile IDs
-    public static final PiActionProfileId ACT_PRF_NEXT_ECMP_SELECTOR_ID = PiActionProfileId.of("next.ecmp_selector");
+    public static final PiActionProfileId ACT_PRF_NEXT_ECMP_SELECTOR_ID =
+            PiActionProfileId.of("next.ecmp_selector");
 
     // Packet Metadata IDs
-    public static final PiControlMetadataId CTRL_META_INGRESS_PORT_ID = PiControlMetadataId.of("ingress_port");
-    public static final PiControlMetadataId CTRL_META_EGRESS_PORT_ID = PiControlMetadataId.of("egress_port");
+    public static final PiControlMetadataId CTRL_META_INGRESS_PORT_ID =
+            PiControlMetadataId.of("ingress_port");
+    public static final PiControlMetadataId CTRL_META_EGRESS_PORT_ID =
+            PiControlMetadataId.of("egress_port");
 
     public static final int PORT_BITWIDTH = 9;
 }
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java
index aa3a99a..f407065 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java
@@ -103,13 +103,11 @@
                     .put(Criterion.Type.ETH_DST, FabricConstants.HF_ETHERNET_DST_ADDR_ID)
                     .put(Criterion.Type.ETH_SRC, FabricConstants.HF_ETHERNET_SRC_ADDR_ID)
                     .put(Criterion.Type.ETH_TYPE, FabricConstants.HF_FABRIC_METADATA_ORIGINAL_ETHER_TYPE_ID)
-                    .put(Criterion.Type.MPLS_BOS, FabricConstants.HF_MPLS_BOS_ID)
                     .put(Criterion.Type.MPLS_LABEL, FabricConstants.HF_MPLS_LABEL_ID)
                     .put(Criterion.Type.VLAN_VID, FabricConstants.HF_VLAN_TAG_VLAN_ID_ID)
                     .put(Criterion.Type.IPV4_DST, FabricConstants.HF_IPV4_DST_ADDR_ID)
                     .put(Criterion.Type.IPV4_SRC, FabricConstants.HF_IPV4_SRC_ADDR_ID)
                     .put(Criterion.Type.IPV6_DST, FabricConstants.HF_IPV6_DST_ADDR_ID)
-                    .put(Criterion.Type.IPV6_SRC, FabricConstants.HF_IPV6_SRC_ADDR_ID)
                     .put(Criterion.Type.TCP_SRC, FabricConstants.HF_FABRIC_METADATA_L4_SRC_PORT_ID)
                     .put(Criterion.Type.TCP_DST, FabricConstants.HF_FABRIC_METADATA_L4_DST_PORT_ID)
                     .put(Criterion.Type.UDP_SRC, FabricConstants.HF_FABRIC_METADATA_L4_SRC_PORT_ID)
@@ -125,18 +123,14 @@
                     .put(FabricConstants.HF_ETHERNET_DST_ADDR_ID, Criterion.Type.ETH_DST)
                     .put(FabricConstants.HF_ETHERNET_SRC_ADDR_ID, Criterion.Type.ETH_SRC)
                     .put(FabricConstants.HF_FABRIC_METADATA_ORIGINAL_ETHER_TYPE_ID, Criterion.Type.ETH_TYPE)
-                    .put(FabricConstants.HF_MPLS_BOS_ID, Criterion.Type.MPLS_BOS)
                     .put(FabricConstants.HF_MPLS_LABEL_ID, Criterion.Type.MPLS_LABEL)
                     .put(FabricConstants.HF_VLAN_TAG_VLAN_ID_ID, Criterion.Type.VLAN_VID)
                     .put(FabricConstants.HF_IPV4_DST_ADDR_ID, Criterion.Type.IPV4_DST)
                     .put(FabricConstants.HF_IPV4_SRC_ADDR_ID, Criterion.Type.IPV4_SRC)
                     .put(FabricConstants.HF_IPV6_DST_ADDR_ID, Criterion.Type.IPV6_DST)
-                    .put(FabricConstants.HF_IPV6_SRC_ADDR_ID, Criterion.Type.IPV6_SRC)
                     // FIXME: might be incorrect if we inverse the map....
                     .put(FabricConstants.HF_FABRIC_METADATA_L4_SRC_PORT_ID, Criterion.Type.UDP_SRC)
                     .put(FabricConstants.HF_FABRIC_METADATA_L4_DST_PORT_ID, Criterion.Type.UDP_DST)
-//                    .put(FabricConstants.HF_FABRIC_METADATA_L4_SRC_PORT_ID, Criterion.Type.TCP_SRC)
-//                    .put(FabricConstants.HF_FABRIC_METADATA_L4_DST_PORT_ID, Criterion.Type.TCP_DST)
                     .put(FabricConstants.HF_FABRIC_METADATA_IP_PROTO_ID, Criterion.Type.IP_PROTO)
                     .put(FabricConstants.HF_ICMP_ICMP_TYPE_ID, Criterion.Type.ICMPV6_TYPE)
                     .put(FabricConstants.HF_ICMP_ICMP_CODE_ID, Criterion.Type.ICMPV6_CODE)
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricTreatmentInterpreter.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricTreatmentInterpreter.java
index 234e541..5ae2e9b 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricTreatmentInterpreter.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricTreatmentInterpreter.java
@@ -102,9 +102,9 @@
         PiActionId actionId;
         if (pushVlanInst != null) {
             // push_internal_vlan
-            actionId = FabricConstants.ACT_PUSH_INTERNAL_VLAN_ID;
+            actionId = FabricConstants.ACT_FILTERING_PUSH_INTERNAL_VLAN_ID;
         } else {
-            actionId = FabricConstants.ACT_SET_VLAN_ID;
+            actionId = FabricConstants.ACT_FILTERING_SET_VLAN_ID;
         }
 
         // set_vlan
@@ -145,7 +145,7 @@
         }
 
         return PiAction.builder()
-                .withId(FabricConstants.ACT_DUPLICATE_TO_CONTROLLER_ID)
+                .withId(FabricConstants.ACT_FORWARDING_DUPLICATE_TO_CONTROLLER_ID)
                 .build();
     }
 
@@ -218,13 +218,13 @@
                                           ImmutableByteSequence.copyFrom(vlanId.toShort()));
                 // set_vlan_output
                 return PiAction.builder()
-                        .withId(FabricConstants.ACT_SET_VLAN_OUTPUT_ID)
+                        .withId(FabricConstants.ACT_NEXT_SET_VLAN_OUTPUT_ID)
                         .withParameters(ImmutableList.of(portNumParam, vlanParam))
                         .build();
             } else {
                 // output
                 return PiAction.builder()
-                        .withId(FabricConstants.ACT_OUTPUT_ID)
+                        .withId(FabricConstants.ACT_NEXT_OUTPUT_ID)
                         .withParameter(portNumParam)
                         .build();
             }
@@ -247,7 +247,7 @@
                     PiActionParam mplsParam = new PiActionParam(FabricConstants.ACT_PRM_LABEL_ID, mplsValue);
                     return PiAction.builder()
                             // FIXME: fins a way to determine v4 or v6
-                            .withId(FabricConstants.ACT_MPLS_ROUTING_V4_ID)
+                            .withId(FabricConstants.ACT_NEXT_MPLS_ROUTING_V4_ID)
                             .withParameters(ImmutableList.of(portNumParam,
                                                              srcMacParam,
                                                              dstMacParam,
@@ -262,7 +262,7 @@
 
             // L3 routing
             return PiAction.builder()
-                    .withId(FabricConstants.ACT_L3_ROUTING_ID)
+                    .withId(FabricConstants.ACT_NEXT_L3_ROUTING_ID)
                     .withParameters(ImmutableList.of(portNumParam,
                                                      srcMacParam,
                                                      dstMacParam))
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricFilteringPipeliner.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricFilteringPipeliner.java
index 69ec0ab..36cfcaf 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricFilteringPipeliner.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricFilteringPipeliner.java
@@ -233,7 +233,7 @@
         PiActionParam param = new PiActionParam(FabricConstants.ACT_PRM_FWD_TYPE_ID,
                                                 ImmutableByteSequence.copyFrom(fwdType));
         PiAction action = PiAction.builder()
-                .withId(FabricConstants.ACT_SET_FORWARDING_TYPE_ID)
+                .withId(FabricConstants.ACT_FILTERING_SET_FORWARDING_TYPE_ID)
                 .withParameter(param)
                 .build();
         return DefaultTrafficTreatment.builder()
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricForwardingPipeliner.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricForwardingPipeliner.java
index bceefdd..e72042f 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricForwardingPipeliner.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricForwardingPipeliner.java
@@ -68,6 +68,18 @@
 
     private void processVersatileFwd(ForwardingObjective fwd,
                                      PipelinerTranslationResult.Builder resultBuilder) {
+        // TODO: Move IPv6 match to different ACL table
+
+        boolean unsupported = fwd.selector().criteria().stream()
+                .anyMatch(criterion -> criterion.type() == Criterion.Type.IPV6_DST);
+        unsupported |= fwd.selector().criteria().stream()
+                .anyMatch(criterion -> criterion.type() == Criterion.Type.IPV6_SRC);
+
+        if (unsupported) {
+            resultBuilder.setError(ObjectiveError.UNSUPPORTED);
+            return;
+        }
+
         // program ACL table only
         FlowRule flowRule = DefaultFlowRule.builder()
                 .withSelector(fwd.selector())
@@ -254,7 +266,7 @@
         PiActionParam nextIdParam = new PiActionParam(FabricConstants.ACT_PRM_NEXT_ID_ID,
                                                       ImmutableByteSequence.copyFrom(fwd.nextId().byteValue()));
         PiAction nextIdAction = PiAction.builder()
-                .withId(FabricConstants.ACT_POP_MPLS_AND_NEXT_ID)
+                .withId(FabricConstants.ACT_FORWARDING_POP_MPLS_AND_NEXT_ID)
                 .withParameter(nextIdParam)
                 .build();
         TrafficTreatment treatment = DefaultTrafficTreatment.builder()
@@ -278,7 +290,7 @@
         PiActionParam nextIdParam = new PiActionParam(FabricConstants.ACT_PRM_NEXT_ID_ID,
                                                       ImmutableByteSequence.copyFrom(nextId.byteValue()));
         PiAction nextIdAction = PiAction.builder()
-                .withId(FabricConstants.ACT_SET_NEXT_ID_ID)
+                .withId(FabricConstants.ACT_FORWARDING_SET_NEXT_ID_ID)
                 .withParameter(nextIdParam)
                 .build();
 
diff --git a/pipelines/fabric/src/main/resources/include/control/forwarding.p4 b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
index 055f77b..4e9ada1 100644
--- a/pipelines/fabric/src/main/resources/include/control/forwarding.p4
+++ b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
@@ -113,17 +113,13 @@
             fabric_metadata.ip_proto: ternary; // 8
             fabric_metadata.l4_src_port: ternary; // 16
             fabric_metadata.l4_dst_port: ternary; // 16
+            fabric_metadata.original_ether_type: ternary; //16
 
             hdr.ethernet.dst_addr: ternary; // 48
             hdr.ethernet.src_addr: ternary; // 48
-            fabric_metadata.original_ether_type: ternary; //16
             hdr.vlan_tag.vlan_id: ternary; // 12
-            hdr.mpls.bos: ternary; // 1
-            hdr.mpls.label: ternary; // 20
             hdr.ipv4.src_addr: ternary; // 32
             hdr.ipv4.dst_addr: ternary; // 32
-            hdr.ipv6.src_addr: ternary; // 128
-            hdr.ipv6.dst_addr: ternary; // 128
             hdr.icmp.icmp_type: ternary; // 8
             hdr.icmp.icmp_code: ternary; // 8
         }
diff --git a/pipelines/fabric/src/main/resources/include/parser.p4 b/pipelines/fabric/src/main/resources/include/parser.p4
index c5653dc..b5eadbc 100644
--- a/pipelines/fabric/src/main/resources/include/parser.p4
+++ b/pipelines/fabric/src/main/resources/include/parser.p4
@@ -75,8 +75,10 @@
 
     state parse_mpls {
         packet.extract(hdr.mpls);
-        //There is only one MPLS label for this fabric.
-        transition select(packet.lookahead<ipv4_t>().version) {
+        // There is only one MPLS label for this fabric.
+        // Assume header after MPLS header is IP/IPv6
+        // Lookup first 4 bits for version
+        transition select(packet.lookahead<bit<4>>()) {
             //The packet should be either IPv4 or IPv6.
             IP_VERSION_4: parse_ipv4;
             IP_VERSION_6: parse_ipv6;
diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
index 51d5a08..5c6e645 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
+++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
@@ -9,9 +9,9 @@
       "name" : "scalars_0",
       "id" : 0,
       "fields" : [
-        ["tmp_0", 161, false],
+        ["tmp", 4, false],
+        ["tmp_0", 32, false],
         ["tmp_1", 32, false],
-        ["tmp_2", 32, false],
         ["next_tmp_0", 1, false],
         ["fabric_metadata_t.fwd_type", 3, false],
         ["fabric_metadata_t.next_id", 32, false],
@@ -20,12 +20,41 @@
         ["fabric_metadata_t.l4_src_port", 16, false],
         ["fabric_metadata_t.l4_dst_port", 16, false],
         ["fabric_metadata_t.original_ether_type", 16, false],
-        ["_padding_0", 2, false]
+        ["_padding_0", 7, false]
+      ]
+    },
+    {
+      "name" : "ethernet_t",
+      "id" : 1,
+      "fields" : [
+        ["dst_addr", 48, false],
+        ["src_addr", 48, false],
+        ["ether_type", 16, false]
+      ]
+    },
+    {
+      "name" : "vlan_tag_t",
+      "id" : 2,
+      "fields" : [
+        ["pri", 3, false],
+        ["cfi", 1, false],
+        ["vlan_id", 12, false],
+        ["ether_type", 16, false]
+      ]
+    },
+    {
+      "name" : "mpls_t",
+      "id" : 3,
+      "fields" : [
+        ["label", 20, false],
+        ["tc", 3, false],
+        ["bos", 1, false],
+        ["ttl", 8, false]
       ]
     },
     {
       "name" : "ipv4_t",
-      "id" : 1,
+      "id" : 4,
       "fields" : [
         ["version", 4, false],
         ["ihl", 4, false],
@@ -42,35 +71,6 @@
       ]
     },
     {
-      "name" : "ethernet_t",
-      "id" : 2,
-      "fields" : [
-        ["dst_addr", 48, false],
-        ["src_addr", 48, false],
-        ["ether_type", 16, false]
-      ]
-    },
-    {
-      "name" : "vlan_tag_t",
-      "id" : 3,
-      "fields" : [
-        ["pri", 3, false],
-        ["cfi", 1, false],
-        ["vlan_id", 12, false],
-        ["ether_type", 16, false]
-      ]
-    },
-    {
-      "name" : "mpls_t",
-      "id" : 4,
-      "fields" : [
-        ["label", 20, false],
-        ["tc", 3, false],
-        ["bos", 1, false],
-        ["ttl", 8, false]
-      ]
-    },
-    {
       "name" : "ipv6_t",
       "id" : 5,
       "fields" : [
@@ -178,106 +178,99 @@
   ],
   "headers" : [
     {
-      "name" : "tmp",
-      "id" : 0,
-      "header_type" : "ipv4_t",
-      "metadata" : false,
-      "pi_omit" : true
-    },
-    {
       "name" : "scalars",
-      "id" : 1,
+      "id" : 0,
       "header_type" : "scalars_0",
       "metadata" : true,
       "pi_omit" : true
     },
     {
       "name" : "standard_metadata",
-      "id" : 2,
+      "id" : 1,
       "header_type" : "standard_metadata",
       "metadata" : true,
       "pi_omit" : true
     },
     {
       "name" : "ethernet",
-      "id" : 3,
+      "id" : 2,
       "header_type" : "ethernet_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "vlan_tag",
-      "id" : 4,
+      "id" : 3,
       "header_type" : "vlan_tag_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "inner_vlan_tag",
-      "id" : 5,
+      "id" : 4,
       "header_type" : "vlan_tag_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "mpls",
-      "id" : 6,
+      "id" : 5,
       "header_type" : "mpls_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "ipv4",
-      "id" : 7,
+      "id" : 6,
       "header_type" : "ipv4_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "ipv6",
-      "id" : 8,
+      "id" : 7,
       "header_type" : "ipv6_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "arp",
-      "id" : 9,
+      "id" : 8,
       "header_type" : "arp_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "tcp",
-      "id" : 10,
+      "id" : 9,
       "header_type" : "tcp_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "udp",
-      "id" : 11,
+      "id" : 10,
       "header_type" : "udp_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "icmp",
-      "id" : 12,
+      "id" : 11,
       "header_type" : "icmp_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "packet_out",
-      "id" : 13,
+      "id" : 12,
       "header_type" : "packet_out_header_t",
       "metadata" : false,
       "pi_omit" : true
     },
     {
       "name" : "packet_in",
-      "id" : 14,
+      "id" : 13,
       "header_type" : "packet_in_header_t",
       "metadata" : false,
       "pi_omit" : true
@@ -533,603 +526,11 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["scalars", "tmp_0"]
+                  "value" : ["scalars", "tmp"]
                 },
                 {
                   "type" : "lookahead",
-                  "value" : [0, 161]
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "parameters" : [
-                    {
-                      "type" : "header",
-                      "value" : "tmp"
-                    }
-                  ],
-                  "op" : "add_header"
-                }
-              ],
-              "op" : "primitive"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "version"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x9d"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0x0f"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "ihl"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x99"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0x0f"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "diffserv"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x91"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "total_len"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x81"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xffff"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "identification"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x71"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xffff"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "flags"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x6e"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0x07"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "frag_offset"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x61"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0x1fff"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "ttl"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x59"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "protocol"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x51"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "hdr_checksum"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x41"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xffff"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "src_addr"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x21"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xffffffff"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "dst_addr"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "&",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : ">>",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["scalars", "tmp_0"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x1"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01ffffffffffffffffffffffffffffffffffffffff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xffffffff"
-                      }
-                    }
-                  }
-                }
-              ],
-              "op" : "set"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["tmp", "$valid$"]
-                },
-                {
-                  "type" : "expression",
-                  "value" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "field",
-                        "value" : ["scalars", "tmp_0"]
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0x01"
-                      }
-                    }
-                  }
+                  "value" : [0, 4]
                 }
               ],
               "op" : "set"
@@ -1155,7 +556,7 @@
           "transition_key" : [
             {
               "type" : "field",
-              "value" : ["tmp", "version"]
+              "value" : ["scalars", "tmp"]
             }
           ]
         },
@@ -1424,7 +825,7 @@
       "id" : 0,
       "source_info" : {
         "filename" : "./include/parser.p4",
-        "line" : 135,
+        "line" : 137,
         "column" : 8,
         "source_fragment" : "FabricDeparser"
       },
@@ -3151,7 +2552,7 @@
           "parameters" : [
             {
               "type" : "field",
-              "value" : ["scalars", "tmp_1"]
+              "value" : ["scalars", "tmp_0"]
             },
             {
               "type" : "expression",
@@ -3181,7 +2582,7 @@
             },
             {
               "type" : "field",
-              "value" : ["scalars", "tmp_1"]
+              "value" : ["scalars", "tmp_0"]
             }
           ],
           "source_info" : {
@@ -3203,7 +2604,7 @@
           "parameters" : [
             {
               "type" : "field",
-              "value" : ["scalars", "tmp_2"]
+              "value" : ["scalars", "tmp_1"]
             },
             {
               "type" : "expression",
@@ -3233,7 +2634,7 @@
             },
             {
               "type" : "field",
-              "value" : ["scalars", "tmp_2"]
+              "value" : ["scalars", "tmp_1"]
             }
           ],
           "source_info" : {
@@ -3798,6 +3199,11 @@
             },
             {
               "match_type" : "ternary",
+              "target" : ["scalars", "fabric_metadata_t.original_ether_type"],
+              "mask" : null
+            },
+            {
+              "match_type" : "ternary",
               "target" : ["ethernet", "dst_addr"],
               "mask" : null
             },
@@ -3808,26 +3214,11 @@
             },
             {
               "match_type" : "ternary",
-              "target" : ["scalars", "fabric_metadata_t.original_ether_type"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
               "target" : ["vlan_tag", "vlan_id"],
               "mask" : null
             },
             {
               "match_type" : "ternary",
-              "target" : ["mpls", "bos"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
-              "target" : ["mpls", "label"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
               "target" : ["ipv4", "src_addr"],
               "mask" : null
             },
@@ -3838,16 +3229,6 @@
             },
             {
               "match_type" : "ternary",
-              "target" : ["ipv6", "src_addr"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
-              "target" : ["ipv6", "dst_addr"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
               "target" : ["icmp", "icmp_type"],
               "mask" : null
             },
@@ -4187,7 +3568,7 @@
           "id" : 1,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 143,
+            "line" : 139,
             "column" : 11,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_BRIDGING"
           },
@@ -4213,7 +3594,7 @@
           "id" : 2,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 144,
+            "line" : 140,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_MPLS"
           },
@@ -4239,7 +3620,7 @@
           "id" : 3,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 146,
+            "line" : 142,
             "column" : 16,
             "source_fragment" : "hdr.ipv4.isValid()"
           },
@@ -4265,7 +3646,7 @@
           "id" : 4,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 154,
+            "line" : 150,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_UNICAST"
           },
@@ -4291,7 +3672,7 @@
           "id" : 5,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 155,
+            "line" : 151,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_MULTICAST"
           },
@@ -4317,7 +3698,7 @@
           "id" : 6,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 156,
+            "line" : 152,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV6_UNICAST"
           },
@@ -4343,7 +3724,7 @@
           "id" : 7,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 157,
+            "line" : 153,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV6_MULTICAST"
           },
diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
index d3d1dbf..20c0dad 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
+++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
@@ -243,23 +243,23 @@
   }
   match_fields {
     id: 5
+    name: "fabric_metadata.original_ether_type"
+    bitwidth: 16
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 6
     name: "hdr.ethernet.dst_addr"
     bitwidth: 48
     match_type: TERNARY
   }
   match_fields {
-    id: 6
+    id: 7
     name: "hdr.ethernet.src_addr"
     bitwidth: 48
     match_type: TERNARY
   }
   match_fields {
-    id: 7
-    name: "fabric_metadata.original_ether_type"
-    bitwidth: 16
-    match_type: TERNARY
-  }
-  match_fields {
     id: 8
     name: "hdr.vlan_tag.vlan_id"
     bitwidth: 12
@@ -267,48 +267,24 @@
   }
   match_fields {
     id: 9
-    name: "hdr.mpls.bos"
-    bitwidth: 1
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 10
-    name: "hdr.mpls.label"
-    bitwidth: 20
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 11
     name: "hdr.ipv4.src_addr"
     bitwidth: 32
     match_type: TERNARY
   }
   match_fields {
-    id: 12
+    id: 10
     name: "hdr.ipv4.dst_addr"
     bitwidth: 32
     match_type: TERNARY
   }
   match_fields {
-    id: 13
-    name: "hdr.ipv6.src_addr"
-    bitwidth: 128
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 14
-    name: "hdr.ipv6.dst_addr"
-    bitwidth: 128
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 15
+    id: 11
     name: "hdr.icmp.icmp_type"
     bitwidth: 8
     match_type: TERNARY
   }
   match_fields {
-    id: 16
+    id: 12
     name: "hdr.icmp.icmp_code"
     bitwidth: 8
     match_type: TERNARY
diff --git a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/FabricInterpreterTest.java b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/FabricInterpreterTest.java
index fdda55f..f0d27f35 100644
--- a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/FabricInterpreterTest.java
+++ b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/FabricInterpreterTest.java
@@ -64,7 +64,7 @@
         PiActionParam param = new PiActionParam(FabricConstants.ACT_PRM_NEW_VLAN_ID_ID,
                                                 ImmutableByteSequence.copyFrom(VLAN_100.toShort()));
         PiAction expectedAction = PiAction.builder()
-                .withId(FabricConstants.ACT_PUSH_INTERNAL_VLAN_ID)
+                .withId(FabricConstants.ACT_FILTERING_PUSH_INTERNAL_VLAN_ID)
                 .withParameter(param)
                 .build();
 
@@ -84,7 +84,7 @@
         PiActionParam param = new PiActionParam(FabricConstants.ACT_PRM_NEW_VLAN_ID_ID,
                                                 ImmutableByteSequence.copyFrom(VLAN_100.toShort()));
         PiAction expectedAction = PiAction.builder()
-                .withId(FabricConstants.ACT_SET_VLAN_ID)
+                .withId(FabricConstants.ACT_FILTERING_SET_VLAN_ID)
                 .withParameter(param)
                 .build();
 
@@ -119,7 +119,7 @@
         PiAction mappedAction = interpreter.mapTreatment(treatment,
                                                          FabricConstants.TBL_ACL_ID);
         PiAction expectedAction = PiAction.builder()
-                .withId(FabricConstants.ACT_DUPLICATE_TO_CONTROLLER_ID)
+                .withId(FabricConstants.ACT_FORWARDING_DUPLICATE_TO_CONTROLLER_ID)
                 .build();
 
         assertEquals(expectedAction, mappedAction);
@@ -141,7 +141,7 @@
         PiActionParam param = new PiActionParam(FabricConstants.ACT_PRM_PORT_NUM_ID,
                                                 ImmutableByteSequence.copyFrom(portNumVal));
         PiAction expectedAction = PiAction.builder()
-                .withId(FabricConstants.ACT_OUTPUT_ID)
+                .withId(FabricConstants.ACT_NEXT_OUTPUT_ID)
                 .withParameter(param)
                 .build();
 
@@ -168,7 +168,7 @@
         PiActionParam portParam = new PiActionParam(FabricConstants.ACT_PRM_PORT_NUM_ID,
                                                 ImmutableByteSequence.copyFrom(portNumVal));
         PiAction expectedAction = PiAction.builder()
-                .withId(FabricConstants.ACT_L3_ROUTING_ID)
+                .withId(FabricConstants.ACT_NEXT_L3_ROUTING_ID)
                 .withParameters(ImmutableList.of(ethSrcParam, ethDstParam, portParam))
                 .build();
 
@@ -194,7 +194,7 @@
                                                     ImmutableByteSequence.copyFrom(vlanVal));
 
         PiAction expectedAction = PiAction.builder()
-                .withId(FabricConstants.ACT_SET_VLAN_OUTPUT_ID)
+                .withId(FabricConstants.ACT_NEXT_SET_VLAN_OUTPUT_ID)
                 .withParameters(ImmutableList.of(vlanParam, portParam))
                 .build();
 
@@ -224,7 +224,7 @@
                 ImmutableByteSequence.fit(ImmutableByteSequence.copyFrom(MPLS_10.toInt()), 20);
         PiActionParam mplsParam = new PiActionParam(FabricConstants.ACT_PRM_LABEL_ID, mplsVal);
         PiAction expectedAction = PiAction.builder()
-                .withId(FabricConstants.ACT_MPLS_ROUTING_V4_ID)
+                .withId(FabricConstants.ACT_NEXT_MPLS_ROUTING_V4_ID)
                 .withParameters(ImmutableList.of(ethSrcParam, ethDstParam, portParam, mplsParam))
                 .build();
         assertEquals(expectedAction, mappedAction);
diff --git a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricFilteringPipelinerTest.java b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricFilteringPipelinerTest.java
index f3de7b7..9ba1380 100644
--- a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricFilteringPipelinerTest.java
+++ b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricFilteringPipelinerTest.java
@@ -335,7 +335,7 @@
         PiActionParam classParam = new PiActionParam(FabricConstants.ACT_PRM_FWD_TYPE_ID,
                                                      ImmutableByteSequence.copyFrom(fwdClass));
         PiAction fwdClassifierAction = PiAction.builder()
-                .withId(FabricConstants.ACT_SET_FORWARDING_TYPE_ID)
+                .withId(FabricConstants.ACT_FILTERING_SET_FORWARDING_TYPE_ID)
                 .withParameter(classParam)
                 .build();
         TrafficTreatment treatment = DefaultTrafficTreatment.builder()
diff --git a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricForwardingPipelineTest.java b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricForwardingPipelineTest.java
index 1602c58..e65e30b 100644
--- a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricForwardingPipelineTest.java
+++ b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricForwardingPipelineTest.java
@@ -223,7 +223,7 @@
         PiActionParam nextIdParam = new PiActionParam(FabricConstants.ACT_PRM_NEXT_ID_ID,
                                                       ImmutableByteSequence.copyFrom(NEXT_ID_1.byteValue()));
         PiAction setNextIdAction = PiAction.builder()
-                .withId(FabricConstants.ACT_POP_MPLS_AND_NEXT_ID)
+                .withId(FabricConstants.ACT_FORWARDING_POP_MPLS_AND_NEXT_ID)
                 .withParameter(nextIdParam)
                 .build();
         TrafficTreatment treatment = DefaultTrafficTreatment.builder()
@@ -237,7 +237,7 @@
         PiActionParam nextIdParam = new PiActionParam(FabricConstants.ACT_PRM_NEXT_ID_ID,
                                                       ImmutableByteSequence.copyFrom(nextId.byteValue()));
         PiAction setNextIdAction = PiAction.builder()
-                .withId(FabricConstants.ACT_SET_NEXT_ID_ID)
+                .withId(FabricConstants.ACT_FORWARDING_SET_NEXT_ID_ID)
                 .withParameter(nextIdParam)
                 .build();
         TrafficTreatment setNextIdTreatment = DefaultTrafficTreatment.builder()