[ONOS-7255] Remove next id mapping table from fabric.p4

Change-Id: Ibcdc49f7c802cb4a4175d51314713725d8b05a77
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 63badda..dca2182 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
@@ -91,7 +91,6 @@
     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_NEXT_ID_MAPPING_ID = PiTableId.of("next.next_id_mapping");
     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");
@@ -113,7 +112,6 @@
     public static final PiCounterId CNT_FWD_CLASSIFIER_COUNTER_ID = PiCounterId.of("filtering.fwd_classifier_counter");
     public static final PiCounterId CNT_UNICAST_V6_COUNTER_ID = PiCounterId.of("forwarding.unicast_v6_counter");
     public static final PiCounterId CNT_BRIDGING_COUNTER_ID = PiCounterId.of("forwarding.bridging_counter");
-    public static final PiCounterId CNT_NEXT_ID_MAPPING_COUNTER_ID = PiCounterId.of("next.next_id_mapping_counter");
     public static final PiCounterId CNT_SIMPLE_COUNTER_ID = PiCounterId.of("next.simple_counter");
     public static final PiCounterId CNT_HASHED_COUNTER_ID = PiCounterId.of("next.hashed_counter");
     public static final PiCounterId CNT_BROADCAST_COUNTER_ID = PiCounterId.of("next.broadcast_counter");
@@ -130,7 +128,6 @@
     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_POP_MPLS_AND_NEXT_ID = PiActionId.of("forwarding.pop_mpls_and_next");
-    public static final PiActionId ACT_SET_NEXT_TYPE_ID = PiActionId.of("next.set_next_type");
     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_NOP_ID = PiActionId.of("nop");
@@ -146,11 +143,10 @@
     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_TYPE_ID = PiActionParamId.of("next_type");
     public static final PiActionParamId ACT_PRM_NEXT_ID_ID = PiActionParamId.of("next_id");
 
     // Action Profile IDs
-    public static final PiActionProfileId ACT_PRF_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_EGRESS_PORT_ID = PiControlMetadataId.of("egress_port");
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 65729c0..69a686e 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
@@ -75,10 +75,9 @@
                     .put(7, FabricConstants.TBL_BRIDGING_ID)
                     .put(8, FabricConstants.TBL_ACL_ID)
                     // Next
-                    .put(9, FabricConstants.TBL_NEXT_ID_MAPPING_ID)
-                    .put(10, FabricConstants.TBL_SIMPLE_ID)
-                    .put(11, FabricConstants.TBL_HASHED_ID)
-                    .put(12, FabricConstants.TBL_BROADCAST_ID)
+                    .put(9, FabricConstants.TBL_SIMPLE_ID)
+                    .put(10, FabricConstants.TBL_HASHED_ID)
+                    .put(11, FabricConstants.TBL_BROADCAST_ID)
                     .build();
 
     private static final Set<PiTableId> FILTERING_CTRL_TBLS = ImmutableSet.of(FabricConstants.TBL_INGRESS_PORT_VLAN_ID,
@@ -90,8 +89,7 @@
                                                                                FabricConstants.TBL_MULTICAST_V6_ID,
                                                                                FabricConstants.TBL_BRIDGING_ID,
                                                                                FabricConstants.TBL_ACL_ID);
-    private static final Set<PiTableId> NEXT_CTRL_TBLS = ImmutableSet.of(FabricConstants.TBL_NEXT_ID_MAPPING_ID,
-                                                                         FabricConstants.TBL_SIMPLE_ID,
+    private static final Set<PiTableId> NEXT_CTRL_TBLS = ImmutableSet.of(FabricConstants.TBL_SIMPLE_ID,
                                                                          FabricConstants.TBL_HASHED_ID,
                                                                          FabricConstants.TBL_BROADCAST_ID);
 
@@ -104,7 +102,6 @@
                     .put(FabricConstants.TBL_BROADCAST_ID, FabricConstants.CNT_BROADCAST_COUNTER_ID)
                     .put(FabricConstants.TBL_HASHED_ID, FabricConstants.CNT_HASHED_COUNTER_ID)
                     .put(FabricConstants.TBL_INGRESS_PORT_VLAN_ID, FabricConstants.CNT_INGRESS_PORT_VLAN_COUNTER_ID)
-                    .put(FabricConstants.TBL_NEXT_ID_MAPPING_ID, FabricConstants.CNT_NEXT_ID_MAPPING_COUNTER_ID)
                     .put(FabricConstants.TBL_UNICAST_V6_ID, FabricConstants.CNT_UNICAST_V6_COUNTER_ID)
                     .put(FabricConstants.TBL_SIMPLE_ID, FabricConstants.CNT_SIMPLE_COUNTER_ID)
                     .put(FabricConstants.TBL_BRIDGING_ID, FabricConstants.CNT_BRIDGING_COUNTER_ID)
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipeliner.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipeliner.java
index 324a4f5..9177237 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipeliner.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipeliner.java
@@ -16,7 +16,6 @@
 
 package org.onosproject.pipelines.fabric.pipeliner;
 
-import com.google.common.collect.ImmutableMap;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.flow.DefaultFlowRule;
 import org.onosproject.net.flow.DefaultTrafficSelector;
@@ -33,23 +32,16 @@
 import org.onosproject.net.group.GroupBucket;
 import org.onosproject.net.group.GroupBuckets;
 import org.onosproject.net.group.GroupDescription;
-import org.onosproject.net.pi.runtime.PiAction;
 import org.onosproject.net.pi.runtime.PiActionGroupId;
-import org.onosproject.net.pi.runtime.PiActionParam;
 import org.onosproject.net.pi.runtime.PiGroupKey;
 import org.slf4j.Logger;
 
 import java.util.List;
-import java.util.Map;
 import java.util.stream.Collectors;
 
-import static org.onlab.util.ImmutableByteSequence.copyFrom;
-import static org.onosproject.pipelines.fabric.FabricConstants.ACT_PRF_ECMP_SELECTOR_ID;
-import static org.onosproject.pipelines.fabric.FabricConstants.ACT_PRM_NEXT_TYPE_ID;
-import static org.onosproject.pipelines.fabric.FabricConstants.ACT_SET_NEXT_TYPE_ID;
+import static org.onosproject.pipelines.fabric.FabricConstants.ACT_PRF_NEXT_ECMP_SELECTOR_ID;
 import static org.onosproject.pipelines.fabric.FabricConstants.HF_FABRIC_METADATA_NEXT_ID_ID;
 import static org.onosproject.pipelines.fabric.FabricConstants.TBL_HASHED_ID;
-import static org.onosproject.pipelines.fabric.FabricConstants.TBL_NEXT_ID_MAPPING_ID;
 import static org.onosproject.pipelines.fabric.FabricConstants.TBL_SIMPLE_ID;
 import static org.slf4j.LoggerFactory.getLogger;
 
@@ -59,18 +51,6 @@
 public class FabricNextPipeliner {
     private static final Logger log = getLogger(FabricNextPipeliner.class);
 
-    // Next types
-    private static final byte NXT_TYPE_SIMPLE = 0;
-    private static final byte NXT_TYPE_HASHED = 1;
-    private static final byte NXT_TYPE_BROADCAST = 2;
-    private static final byte NXT_TYPE_PUNT = 3;
-    private static final Map<NextObjective.Type, Byte> NEXT_TYPE_MAP =
-            ImmutableMap.<NextObjective.Type, Byte>builder()
-                    .put(NextObjective.Type.SIMPLE, NXT_TYPE_SIMPLE)
-                    .put(NextObjective.Type.HASHED, NXT_TYPE_HASHED)
-                    .put(NextObjective.Type.BROADCAST, NXT_TYPE_BROADCAST)
-                    .build();
-
     protected DeviceId deviceId;
 
     public FabricNextPipeliner(DeviceId deviceId) {
@@ -79,7 +59,6 @@
 
     public PipelinerTranslationResult next(NextObjective nextObjective) {
         PipelinerTranslationResult.Builder resultBuilder = PipelinerTranslationResult.builder();
-        processNextIdMapping(nextObjective, resultBuilder);
 
         switch (nextObjective.type()) {
             case SIMPLE:
@@ -97,23 +76,6 @@
         return resultBuilder.build();
     }
 
-    private void processNextIdMapping(NextObjective next,
-                                      PipelinerTranslationResult.Builder resultBuilder) {
-        // program the next id mapping table
-        TrafficSelector nextIdSelector = buildNextIdSelector(next.id());
-        TrafficTreatment setNextTypeTreatment = buildSetNextTypeTreatment(next.type());
-
-        resultBuilder.addFlowRule(DefaultFlowRule.builder()
-                                          .withSelector(nextIdSelector)
-                                          .withTreatment(setNextTypeTreatment)
-                                          .forDevice(deviceId)
-                                          .forTable(TBL_NEXT_ID_MAPPING_ID)
-                                          .makePermanent()
-                                          .withPriority(next.priority())
-                                          .fromApp(next.appId())
-                                          .build());
-    }
-
     private void processSimpleNext(NextObjective next,
                                    PipelinerTranslationResult.Builder resultBuilder) {
 
@@ -165,7 +127,7 @@
 
         GroupBuckets buckets = new GroupBuckets(bucketList);
         PiGroupKey groupKey = new PiGroupKey(TBL_HASHED_ID,
-                                             ACT_PRF_ECMP_SELECTOR_ID,
+                                             ACT_PRF_NEXT_ECMP_SELECTOR_ID,
                                              groupId);
 
         resultBuilder.addGroup(new DefaultGroupDescription(deviceId,
@@ -200,17 +162,4 @@
                 .matchPi(nextIdCriterion)
                 .build();
     }
-
-    private TrafficTreatment buildSetNextTypeTreatment(NextObjective.Type nextType) {
-        byte nextTypeVal = NEXT_TYPE_MAP.getOrDefault(nextType, NXT_TYPE_PUNT);
-        PiActionParam nextTypeParam = new PiActionParam(ACT_PRM_NEXT_TYPE_ID,
-                                                        copyFrom(nextTypeVal));
-        PiAction nextTypeAction = PiAction.builder()
-                .withId(ACT_SET_NEXT_TYPE_ID)
-                .withParameter(nextTypeParam)
-                .build();
-        return DefaultTrafficTreatment.builder()
-                .piTableAction(nextTypeAction)
-                .build();
-    }
 }
diff --git a/pipelines/fabric/src/main/resources/include/control/forwarding.p4 b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
index 62aeac7..5015e58 100644
--- a/pipelines/fabric/src/main/resources/include/control/forwarding.p4
+++ b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
@@ -50,7 +50,6 @@
     }
 
     action duplicate_to_controller() {
-        fabric_metadata.next_type = NEXT_TYPE_PUNT;
         standard_metadata.egress_spec = CPU_PORT;
     }
 
diff --git a/pipelines/fabric/src/main/resources/include/control/next.p4 b/pipelines/fabric/src/main/resources/include/control/next.p4
index 2b3019c..19d9308 100644
--- a/pipelines/fabric/src/main/resources/include/control/next.p4
+++ b/pipelines/fabric/src/main/resources/include/control/next.p4
@@ -24,16 +24,11 @@
     inout parsed_headers_t hdr,
     inout fabric_metadata_t fabric_metadata,
     inout standard_metadata_t standard_metadata) {
-    direct_counter(CounterType.packets_and_bytes) next_id_mapping_counter;
     direct_counter(CounterType.packets_and_bytes) simple_counter;
     direct_counter(CounterType.packets_and_bytes) hashed_counter;
     direct_counter(CounterType.packets_and_bytes) broadcast_counter;
     action_selector(HashAlgorithm.crc16, 32w64, 32w16) ecmp_selector;
 
-    action set_next_type(next_type_t next_type) {
-        fabric_metadata.next_type = next_type;
-    }
-
     action output(port_num_t port_num) {
         standard_metadata.egress_spec = port_num;
         if(!hdr.mpls.isValid()) {
@@ -95,17 +90,6 @@
         push_mpls(label, hdr.ipv6.traffic_class[7:5]);
     }
 
-    table next_id_mapping {
-        key = {
-            fabric_metadata.next_id: exact;
-        }
-
-        actions = {
-            set_next_type;
-        }
-        counters = next_id_mapping_counter;
-    }
-
     table simple {
         key = {
             fabric_metadata.next_id: exact;
@@ -156,11 +140,9 @@
     }
 
     apply {
-        next_id_mapping.apply();
-        if (fabric_metadata.next_type == NEXT_TYPE_SIMPLE) simple.apply();
-        else if (fabric_metadata.next_type == NEXT_TYPE_HASHED) hashed.apply();
-        else if (fabric_metadata.next_type == NEXT_TYPE_BROADCAST) broadcast.apply();
-        // next_type == PUNT, leave it to packet-io egress
+        simple.apply();
+        hashed.apply();
+        broadcast.apply();
     }
 }
 
diff --git a/pipelines/fabric/src/main/resources/include/define.p4 b/pipelines/fabric/src/main/resources/include/define.p4
index 1db958f..0ee3ff3 100644
--- a/pipelines/fabric/src/main/resources/include/define.p4
+++ b/pipelines/fabric/src/main/resources/include/define.p4
@@ -21,7 +21,6 @@
 
 typedef bit<3>  fwd_type_t;
 typedef bit<32> next_id_t;
-typedef bit<3>  next_type_t;
 typedef bit<20> mpls_label_t;
 typedef bit<9>  port_num_t;
 typedef bit<48> mac_addr_t;
@@ -55,11 +54,6 @@
 const fwd_type_t FWD_IPV6_UNICAST = 4;
 const fwd_type_t FWD_IPV6_MULTICAST = 5;
 
-const next_type_t NEXT_TYPE_SIMPLE = 0;
-const next_type_t NEXT_TYPE_HASHED = 1;
-const next_type_t NEXT_TYPE_BROADCAST = 2;
-const next_type_t NEXT_TYPE_PUNT = 3;
-
 const bit<8> DEFAULT_MPLS_TTL = 64;
 
 #endif
diff --git a/pipelines/fabric/src/main/resources/include/header.p4 b/pipelines/fabric/src/main/resources/include/header.p4
index c36f5a0..3b153be 100644
--- a/pipelines/fabric/src/main/resources/include/header.p4
+++ b/pipelines/fabric/src/main/resources/include/header.p4
@@ -117,7 +117,6 @@
 struct fabric_metadata_t {
     fwd_type_t fwd_type;
     next_id_t next_id;
-    next_type_t next_type;
     bool pop_vlan_at_egress;
     bit<8> ip_proto;
     bit<16> l4_src_port;
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 a683e8b..46b63a4 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
+++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
@@ -14,11 +14,11 @@
         ["tmp_2", 32, false],
         ["fabric_metadata_t.fwd_type", 3, false],
         ["fabric_metadata_t.next_id", 32, false],
-        ["fabric_metadata_t.next_type", 3, false],
         ["fabric_metadata_t.pop_vlan_at_egress", 1, false],
         ["fabric_metadata_t.ip_proto", 8, false],
         ["fabric_metadata_t.l4_src_port", 16, false],
-        ["fabric_metadata_t.l4_dst_port", 16, false]
+        ["fabric_metadata_t.l4_dst_port", 16, false],
+        ["_padding_2", 3, false]
       ]
     },
     {
@@ -1473,32 +1473,26 @@
       "binding" : "forwarding.acl"
     },
     {
-      "name" : "next.next_id_mapping_counter",
-      "id" : 9,
-      "is_direct" : true,
-      "binding" : "next.next_id_mapping"
-    },
-    {
       "name" : "next.simple_counter",
-      "id" : 10,
+      "id" : 9,
       "is_direct" : true,
       "binding" : "next.simple"
     },
     {
       "name" : "next.hashed_counter",
-      "id" : 11,
+      "id" : 10,
       "is_direct" : true,
       "binding" : "next.hashed"
     },
     {
       "name" : "next.broadcast_counter",
-      "id" : 12,
+      "id" : 11,
       "is_direct" : true,
       "binding" : "next.broadcast"
     },
     {
       "name" : "port_counters_control.egress_port_counter",
-      "id" : 13,
+      "id" : 12,
       "source_info" : {
         "filename" : "./include/control/port_counter.p4",
         "line" : 23,
@@ -1510,7 +1504,7 @@
     },
     {
       "name" : "port_counters_control.ingress_port_counter",
-      "id" : 14,
+      "id" : 13,
       "source_info" : {
         "filename" : "./include/control/port_counter.p4",
         "line" : 24,
@@ -1741,14 +1735,8 @@
       "primitives" : []
     },
     {
-      "name" : "NoAction",
-      "id" : 13,
-      "runtime_data" : [],
-      "primitives" : []
-    },
-    {
       "name" : "filtering.set_vlan",
-      "id" : 14,
+      "id" : 13,
       "runtime_data" : [
         {
           "name" : "new_vlan_id",
@@ -1779,7 +1767,7 @@
     },
     {
       "name" : "filtering.push_internal_vlan",
-      "id" : 15,
+      "id" : 14,
       "runtime_data" : [
         {
           "name" : "new_vlan_id",
@@ -1854,7 +1842,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/../define.p4",
-            "line" : 33,
+            "line" : 32,
             "column" : 31,
             "source_fragment" : "0x8100; ..."
           }
@@ -1911,7 +1899,7 @@
     },
     {
       "name" : "filtering.set_forwarding_type",
-      "id" : 16,
+      "id" : 15,
       "runtime_data" : [
         {
           "name" : "fwd_type",
@@ -1942,6 +1930,37 @@
     },
     {
       "name" : "forwarding.set_next_id",
+      "id" : 16,
+      "runtime_data" : [
+        {
+          "name" : "next_id",
+          "bitwidth" : 32
+        }
+      ],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["scalars", "fabric_metadata_t.next_id"]
+            },
+            {
+              "type" : "runtime_data",
+              "value" : 0
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/forwarding.p4",
+            "line" : 39,
+            "column" : 8,
+            "source_fragment" : "fabric_metadata.next_id = next_id"
+          }
+        }
+      ]
+    },
+    {
+      "name" : "forwarding.set_next_id",
       "id" : 17,
       "runtime_data" : [
         {
@@ -2096,39 +2115,8 @@
       ]
     },
     {
-      "name" : "forwarding.set_next_id",
-      "id" : 22,
-      "runtime_data" : [
-        {
-          "name" : "next_id",
-          "bitwidth" : 32
-        }
-      ],
-      "primitives" : [
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["scalars", "fabric_metadata_t.next_id"]
-            },
-            {
-              "type" : "runtime_data",
-              "value" : 0
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/forwarding.p4",
-            "line" : 39,
-            "column" : 8,
-            "source_fragment" : "fabric_metadata.next_id = next_id"
-          }
-        }
-      ]
-    },
-    {
       "name" : "forwarding.pop_mpls_and_next",
-      "id" : 23,
+      "id" : 22,
       "runtime_data" : [
         {
           "name" : "next_id",
@@ -2273,7 +2261,7 @@
     },
     {
       "name" : "forwarding.duplicate_to_controller",
-      "id" : 24,
+      "id" : 23,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -2281,25 +2269,6 @@
           "parameters" : [
             {
               "type" : "field",
-              "value" : ["scalars", "fabric_metadata_t.next_type"]
-            },
-            {
-              "type" : "hexstr",
-              "value" : "0x03"
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/../define.p4",
-            "line" : 61,
-            "column" : 35,
-            "source_fragment" : "3; ..."
-          }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
               "value" : ["standard_metadata", "egress_spec"]
             },
             {
@@ -2309,7 +2278,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/../define.p4",
-            "line" : 48,
+            "line" : 47,
             "column" : 28,
             "source_fragment" : "255; ..."
           }
@@ -2317,39 +2286,8 @@
       ]
     },
     {
-      "name" : "next.set_next_type",
-      "id" : 25,
-      "runtime_data" : [
-        {
-          "name" : "next_type",
-          "bitwidth" : 3
-        }
-      ],
-      "primitives" : [
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["scalars", "fabric_metadata_t.next_type"]
-            },
-            {
-              "type" : "runtime_data",
-              "value" : 0
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 34,
-            "column" : 8,
-            "source_fragment" : "fabric_metadata.next_type = next_type"
-          }
-        }
-      ]
-    },
-    {
       "name" : "next.output",
-      "id" : 26,
+      "id" : 24,
       "runtime_data" : [
         {
           "name" : "port_num",
@@ -2371,7 +2309,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 38,
+            "line" : 33,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num"
           }
@@ -2457,7 +2395,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 41,
+            "line" : 36,
             "column" : 16,
             "source_fragment" : "hdr.ipv4.ttl ="
           }
@@ -2570,7 +2508,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 44,
+            "line" : 39,
             "column" : 16,
             "source_fragment" : "hdr.ipv6.hop_limit ="
           }
@@ -2579,7 +2517,7 @@
     },
     {
       "name" : "next.set_vlan_output",
-      "id" : 27,
+      "id" : 25,
       "runtime_data" : [
         {
           "name" : "new_vlan_id",
@@ -2605,7 +2543,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 50,
+            "line" : 45,
             "column" : 8,
             "source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id"
           }
@@ -2634,7 +2572,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 53,
+            "line" : 48,
             "column" : 8,
             "source_fragment" : "fabric_metadata.pop_vlan_at_egress = false"
           }
@@ -2653,7 +2591,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 38,
+            "line" : 33,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num; ..."
           }
@@ -2739,7 +2677,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 41,
+            "line" : 36,
             "column" : 16,
             "source_fragment" : "hdr.ipv4.ttl ="
           }
@@ -2852,7 +2790,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 44,
+            "line" : 39,
             "column" : 16,
             "source_fragment" : "hdr.ipv6.hop_limit ="
           }
@@ -2861,7 +2799,7 @@
     },
     {
       "name" : "next.l3_routing",
-      "id" : 28,
+      "id" : 26,
       "runtime_data" : [
         {
           "name" : "port_num",
@@ -2891,7 +2829,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 58,
+            "line" : 53,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.src_addr = smac; ..."
           }
@@ -2910,7 +2848,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 62,
+            "line" : 57,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
           }
@@ -2929,7 +2867,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 38,
+            "line" : 33,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num; ..."
           }
@@ -3015,7 +2953,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 41,
+            "line" : 36,
             "column" : 16,
             "source_fragment" : "hdr.ipv4.ttl ="
           }
@@ -3128,7 +3066,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 44,
+            "line" : 39,
             "column" : 16,
             "source_fragment" : "hdr.ipv6.hop_limit ="
           }
@@ -3137,7 +3075,7 @@
     },
     {
       "name" : "next.l3_routing",
-      "id" : 29,
+      "id" : 27,
       "runtime_data" : [
         {
           "name" : "port_num",
@@ -3167,7 +3105,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 58,
+            "line" : 53,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.src_addr = smac; ..."
           }
@@ -3186,7 +3124,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 62,
+            "line" : 57,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
           }
@@ -3205,7 +3143,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 38,
+            "line" : 33,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num; ..."
           }
@@ -3291,7 +3229,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 41,
+            "line" : 36,
             "column" : 16,
             "source_fragment" : "hdr.ipv4.ttl ="
           }
@@ -3404,7 +3342,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 44,
+            "line" : 39,
             "column" : 16,
             "source_fragment" : "hdr.ipv6.hop_limit ="
           }
@@ -3413,7 +3351,7 @@
     },
     {
       "name" : "next.set_mcast_group",
-      "id" : 30,
+      "id" : 28,
       "runtime_data" : [
         {
           "name" : "gid",
@@ -3439,7 +3377,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 72,
+            "line" : 67,
             "column" : 8,
             "source_fragment" : "standard_metadata.mcast_grp = gid"
           }
@@ -3458,7 +3396,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 58,
+            "line" : 53,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.src_addr = smac; ..."
           }
@@ -3467,7 +3405,7 @@
     },
     {
       "name" : "next.mpls_routing_v4",
-      "id" : 31,
+      "id" : 29,
       "runtime_data" : [
         {
           "name" : "port_num",
@@ -3501,7 +3439,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 58,
+            "line" : 53,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.src_addr = smac; ..."
           }
@@ -3520,7 +3458,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 62,
+            "line" : 57,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
           }
@@ -3539,7 +3477,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 38,
+            "line" : 33,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num; ..."
           }
@@ -3625,7 +3563,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 41,
+            "line" : 36,
             "column" : 16,
             "source_fragment" : "hdr.ipv4.ttl ="
           }
@@ -3738,7 +3676,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 44,
+            "line" : 39,
             "column" : 16,
             "source_fragment" : "hdr.ipv6.hop_limit ="
           }
@@ -3753,7 +3691,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 78,
+            "line" : 73,
             "column" : 8,
             "source_fragment" : "hdr.mpls.setValid()"
           }
@@ -3772,7 +3710,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/../define.p4",
-            "line" : 34,
+            "line" : 33,
             "column" : 31,
             "source_fragment" : "0x8847; ..."
           }
@@ -3791,7 +3729,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 80,
+            "line" : 75,
             "column" : 8,
             "source_fragment" : "hdr.mpls.label = label; ..."
           }
@@ -3843,7 +3781,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 81,
+            "line" : 76,
             "column" : 8,
             "source_fragment" : "hdr.mpls.tc = tc; ..."
           }
@@ -3862,7 +3800,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 82,
+            "line" : 77,
             "column" : 8,
             "source_fragment" : "hdr.mpls.bos = 1"
           }
@@ -3890,7 +3828,7 @@
     },
     {
       "name" : "next.mpls_routing_v6",
-      "id" : 32,
+      "id" : 30,
       "runtime_data" : [
         {
           "name" : "port_num",
@@ -3924,7 +3862,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 58,
+            "line" : 53,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.src_addr = smac; ..."
           }
@@ -3943,7 +3881,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 62,
+            "line" : 57,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
           }
@@ -3962,7 +3900,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 38,
+            "line" : 33,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num; ..."
           }
@@ -4048,7 +3986,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 41,
+            "line" : 36,
             "column" : 16,
             "source_fragment" : "hdr.ipv4.ttl ="
           }
@@ -4161,7 +4099,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 44,
+            "line" : 39,
             "column" : 16,
             "source_fragment" : "hdr.ipv6.hop_limit ="
           }
@@ -4176,7 +4114,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 78,
+            "line" : 73,
             "column" : 8,
             "source_fragment" : "hdr.mpls.setValid()"
           }
@@ -4195,7 +4133,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/../define.p4",
-            "line" : 34,
+            "line" : 33,
             "column" : 31,
             "source_fragment" : "0x8847; ..."
           }
@@ -4214,7 +4152,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 80,
+            "line" : 75,
             "column" : 8,
             "source_fragment" : "hdr.mpls.label = label; ..."
           }
@@ -4266,7 +4204,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 81,
+            "line" : 76,
             "column" : 8,
             "source_fragment" : "hdr.mpls.tc = tc; ..."
           }
@@ -4285,7 +4223,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 82,
+            "line" : 77,
             "column" : 8,
             "source_fragment" : "hdr.mpls.bos = 1"
           }
@@ -4313,7 +4251,7 @@
     },
     {
       "name" : "act",
-      "id" : 33,
+      "id" : 31,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -4339,7 +4277,7 @@
     },
     {
       "name" : "act_0",
-      "id" : 34,
+      "id" : 32,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -4391,7 +4329,7 @@
     },
     {
       "name" : "act_1",
-      "id" : 35,
+      "id" : 33,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -4443,7 +4381,7 @@
     },
     {
       "name" : "act_2",
-      "id" : 36,
+      "id" : 34,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -4456,7 +4394,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 175,
+            "line" : 157,
             "column" : 12,
             "source_fragment" : "hdr.vlan_tag.setInvalid()"
           }
@@ -4465,7 +4403,7 @@
     },
     {
       "name" : "act_3",
-      "id" : 37,
+      "id" : 35,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -4506,7 +4444,7 @@
     },
     {
       "name" : "act_4",
-      "id" : 38,
+      "id" : 36,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -4549,14 +4487,14 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [33],
+          "action_ids" : [31],
           "actions" : ["act"],
           "base_default_next" : null,
           "next_tables" : {
             "act" : null
           },
           "default_entry" : {
-            "action_id" : 33,
+            "action_id" : 31,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
@@ -4593,7 +4531,7 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [15, 14, 0, 2],
+          "action_ids" : [14, 13, 0, 2],
           "actions" : ["filtering.push_internal_vlan", "filtering.set_vlan", "nop", "drop"],
           "base_default_next" : "filtering.fwd_classifier",
           "next_tables" : {
@@ -4640,14 +4578,14 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [16],
+          "action_ids" : [15],
           "actions" : ["filtering.set_forwarding_type"],
           "base_default_next" : "node_6",
           "next_tables" : {
             "filtering.set_forwarding_type" : "node_6"
           },
           "default_entry" : {
-            "action_id" : 16,
+            "action_id" : 15,
             "action_const" : true,
             "action_data" : ["0x0"],
             "action_entry_const" : true
@@ -4658,7 +4596,7 @@
           "id" : 3,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 57,
+            "line" : 56,
             "column" : 10,
             "source_fragment" : "bridging"
           },
@@ -4679,7 +4617,7 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [17, 4],
+          "action_ids" : [16, 4],
           "actions" : ["forwarding.set_next_id", "NoAction"],
           "base_default_next" : "forwarding.acl",
           "next_tables" : {
@@ -4698,7 +4636,7 @@
           "id" : 4,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 69,
+            "line" : 68,
             "column" : 10,
             "source_fragment" : "mpls"
           },
@@ -4714,7 +4652,7 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [23, 5],
+          "action_ids" : [22, 5],
           "actions" : ["forwarding.pop_mpls_and_next", "NoAction"],
           "base_default_next" : "forwarding.acl",
           "next_tables" : {
@@ -4733,7 +4671,7 @@
           "id" : 5,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 80,
+            "line" : 79,
             "column" : 10,
             "source_fragment" : "unicast_v4"
           },
@@ -4749,7 +4687,7 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [18, 6],
+          "action_ids" : [17, 6],
           "actions" : ["forwarding.set_next_id", "NoAction"],
           "base_default_next" : "forwarding.acl",
           "next_tables" : {
@@ -4768,7 +4706,7 @@
           "id" : 6,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 91,
+            "line" : 90,
             "column" : 10,
             "source_fragment" : "multicast_v4"
           },
@@ -4789,7 +4727,7 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [19, 7],
+          "action_ids" : [18, 7],
           "actions" : ["forwarding.set_next_id", "NoAction"],
           "base_default_next" : "forwarding.acl",
           "next_tables" : {
@@ -4808,7 +4746,7 @@
           "id" : 7,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 103,
+            "line" : 102,
             "column" : 10,
             "source_fragment" : "unicast_v6"
           },
@@ -4824,7 +4762,7 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [20, 8],
+          "action_ids" : [19, 8],
           "actions" : ["forwarding.set_next_id", "NoAction"],
           "base_default_next" : "forwarding.acl",
           "next_tables" : {
@@ -4843,7 +4781,7 @@
           "id" : 8,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 114,
+            "line" : 113,
             "column" : 10,
             "source_fragment" : "multicast_v6"
           },
@@ -4864,7 +4802,7 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [21, 9],
+          "action_ids" : [20, 9],
           "actions" : ["forwarding.set_next_id", "NoAction"],
           "base_default_next" : "forwarding.acl",
           "next_tables" : {
@@ -4883,7 +4821,7 @@
           "id" : 9,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 126,
+            "line" : 125,
             "column" : 10,
             "source_fragment" : "acl"
           },
@@ -5004,14 +4942,14 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [22, 24, 3, 1],
+          "action_ids" : [21, 23, 3, 1],
           "actions" : ["forwarding.set_next_id", "forwarding.duplicate_to_controller", "drop", "nop"],
-          "base_default_next" : "next.next_id_mapping",
+          "base_default_next" : "next.simple",
           "next_tables" : {
-            "forwarding.set_next_id" : "next.next_id_mapping",
-            "forwarding.duplicate_to_controller" : "next.next_id_mapping",
-            "drop" : "next.next_id_mapping",
-            "nop" : "next.next_id_mapping"
+            "forwarding.set_next_id" : "next.simple",
+            "forwarding.duplicate_to_controller" : "next.simple",
+            "drop" : "next.simple",
+            "nop" : "next.simple"
           },
           "default_entry" : {
             "action_id" : 1,
@@ -5021,46 +4959,11 @@
           }
         },
         {
-          "name" : "next.next_id_mapping",
+          "name" : "next.simple",
           "id" : 10,
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 98,
-            "column" : 10,
-            "source_fragment" : "next_id_mapping"
-          },
-          "key" : [
-            {
-              "match_type" : "exact",
-              "target" : ["scalars", "fabric_metadata_t.next_id"],
-              "mask" : null
-            }
-          ],
-          "match_type" : "exact",
-          "type" : "simple",
-          "max_size" : 1024,
-          "support_timeout" : false,
-          "direct_meters" : null,
-          "action_ids" : [25, 10],
-          "actions" : ["next.set_next_type", "NoAction"],
-          "base_default_next" : "node_20",
-          "next_tables" : {
-            "next.set_next_type" : "node_20",
-            "NoAction" : "node_20"
-          },
-          "default_entry" : {
-            "action_id" : 10,
-            "action_const" : false,
-            "action_data" : [],
-            "action_entry_const" : false
-          }
-        },
-        {
-          "name" : "next.simple",
-          "id" : 11,
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 109,
+            "line" : 93,
             "column" : 10,
             "source_fragment" : "simple"
           },
@@ -5076,17 +4979,17 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [26, 27, 28, 11],
+          "action_ids" : [24, 25, 26, 10],
           "actions" : ["next.output", "next.set_vlan_output", "next.l3_routing", "NoAction"],
-          "base_default_next" : "node_26",
+          "base_default_next" : "next.hashed",
           "next_tables" : {
-            "next.output" : "node_26",
-            "next.set_vlan_output" : "node_26",
-            "next.l3_routing" : "node_26",
-            "NoAction" : "node_26"
+            "next.output" : "next.hashed",
+            "next.set_vlan_output" : "next.hashed",
+            "next.l3_routing" : "next.hashed",
+            "NoAction" : "next.hashed"
           },
           "default_entry" : {
-            "action_id" : 11,
+            "action_id" : 10,
             "action_const" : false,
             "action_data" : [],
             "action_entry_const" : false
@@ -5094,10 +4997,10 @@
         },
         {
           "name" : "next.hashed",
-          "id" : 12,
+          "id" : 11,
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 122,
+            "line" : 106,
             "column" : 10,
             "source_fragment" : "hashed"
           },
@@ -5114,22 +5017,22 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [29, 31, 32, 12],
+          "action_ids" : [27, 29, 30, 11],
           "actions" : ["next.l3_routing", "next.mpls_routing_v4", "next.mpls_routing_v6", "NoAction"],
-          "base_default_next" : "node_26",
+          "base_default_next" : "next.broadcast",
           "next_tables" : {
-            "next.l3_routing" : "node_26",
-            "next.mpls_routing_v4" : "node_26",
-            "next.mpls_routing_v6" : "node_26",
-            "NoAction" : "node_26"
+            "next.l3_routing" : "next.broadcast",
+            "next.mpls_routing_v4" : "next.broadcast",
+            "next.mpls_routing_v6" : "next.broadcast",
+            "NoAction" : "next.broadcast"
           }
         },
         {
           "name" : "next.broadcast",
-          "id" : 13,
+          "id" : 12,
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 148,
+            "line" : 132,
             "column" : 10,
             "source_fragment" : "broadcast"
           },
@@ -5145,15 +5048,15 @@
           "max_size" : 1024,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [30, 13],
+          "action_ids" : [28, 12],
           "actions" : ["next.set_mcast_group", "NoAction"],
-          "base_default_next" : "node_26",
+          "base_default_next" : "node_22",
           "next_tables" : {
-            "next.set_mcast_group" : "node_26",
-            "NoAction" : "node_26"
+            "next.set_mcast_group" : "node_22",
+            "NoAction" : "node_22"
           },
           "default_entry" : {
-            "action_id" : 13,
+            "action_id" : 12,
             "action_const" : false,
             "action_data" : [],
             "action_entry_const" : false
@@ -5161,6 +5064,29 @@
         },
         {
           "name" : "tbl_act_0",
+          "id" : 13,
+          "key" : [],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [32],
+          "actions" : ["act_0"],
+          "base_default_next" : "node_24",
+          "next_tables" : {
+            "act_0" : "node_24"
+          },
+          "default_entry" : {
+            "action_id" : 32,
+            "action_const" : true,
+            "action_data" : [],
+            "action_entry_const" : true
+          }
+        },
+        {
+          "name" : "tbl_act_1",
           "id" : 14,
           "key" : [],
           "match_type" : "exact",
@@ -5169,37 +5095,14 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [34],
-          "actions" : ["act_0"],
-          "base_default_next" : "node_28",
-          "next_tables" : {
-            "act_0" : "node_28"
-          },
-          "default_entry" : {
-            "action_id" : 34,
-            "action_const" : true,
-            "action_data" : [],
-            "action_entry_const" : true
-          }
-        },
-        {
-          "name" : "tbl_act_1",
-          "id" : 15,
-          "key" : [],
-          "match_type" : "exact",
-          "type" : "simple",
-          "max_size" : 1024,
-          "with_counters" : false,
-          "support_timeout" : false,
-          "direct_meters" : null,
-          "action_ids" : [35],
+          "action_ids" : [33],
           "actions" : ["act_1"],
           "base_default_next" : null,
           "next_tables" : {
             "act_1" : null
           },
           "default_entry" : {
-            "action_id" : 35,
+            "action_id" : 33,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
@@ -5282,7 +5185,7 @@
           "id" : 1,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 164,
+            "line" : 163,
             "column" : 11,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_BRIDGING"
           },
@@ -5308,7 +5211,7 @@
           "id" : 2,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 165,
+            "line" : 164,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_MPLS"
           },
@@ -5334,7 +5237,7 @@
           "id" : 3,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 166,
+            "line" : 165,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_UNICAST"
           },
@@ -5360,7 +5263,7 @@
           "id" : 4,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 167,
+            "line" : 166,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_MULTICAST"
           },
@@ -5386,7 +5289,7 @@
           "id" : 5,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 168,
+            "line" : 167,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV6_UNICAST"
           },
@@ -5412,7 +5315,7 @@
           "id" : 6,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 169,
+            "line" : 168,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV6_MULTICAST"
           },
@@ -5434,86 +5337,8 @@
           "false_next" : "forwarding.acl"
         },
         {
-          "name" : "node_20",
-          "id" : 7,
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 160,
-            "column" : 12,
-            "source_fragment" : "fabric_metadata.next_type == NEXT_TYPE_SIMPLE"
-          },
-          "expression" : {
-            "type" : "expression",
-            "value" : {
-              "op" : "==",
-              "left" : {
-                "type" : "field",
-                "value" : ["scalars", "fabric_metadata_t.next_type"]
-              },
-              "right" : {
-                "type" : "hexstr",
-                "value" : "0x00"
-              }
-            }
-          },
-          "true_next" : "next.simple",
-          "false_next" : "node_22"
-        },
-        {
           "name" : "node_22",
-          "id" : 8,
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 161,
-            "column" : 17,
-            "source_fragment" : "fabric_metadata.next_type == NEXT_TYPE_HASHED"
-          },
-          "expression" : {
-            "type" : "expression",
-            "value" : {
-              "op" : "==",
-              "left" : {
-                "type" : "field",
-                "value" : ["scalars", "fabric_metadata_t.next_type"]
-              },
-              "right" : {
-                "type" : "hexstr",
-                "value" : "0x01"
-              }
-            }
-          },
-          "true_next" : "next.hashed",
-          "false_next" : "node_24"
-        },
-        {
-          "name" : "node_24",
-          "id" : 9,
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 162,
-            "column" : 17,
-            "source_fragment" : "fabric_metadata.next_type == NEXT_TYPE_BROADCAST"
-          },
-          "expression" : {
-            "type" : "expression",
-            "value" : {
-              "op" : "==",
-              "left" : {
-                "type" : "field",
-                "value" : ["scalars", "fabric_metadata_t.next_type"]
-              },
-              "right" : {
-                "type" : "hexstr",
-                "value" : "0x02"
-              }
-            }
-          },
-          "true_next" : "next.broadcast",
-          "false_next" : "node_26"
-        },
-        {
-          "name" : "node_26",
-          "id" : 10,
+          "id" : 7,
           "source_info" : {
             "filename" : "./include/control/port_counter.p4",
             "line" : 27,
@@ -5535,11 +5360,11 @@
             }
           },
           "true_next" : "tbl_act_0",
-          "false_next" : "node_28"
+          "false_next" : "node_24"
         },
         {
-          "name" : "node_28",
-          "id" : 11,
+          "name" : "node_24",
+          "id" : 8,
           "source_info" : {
             "filename" : "./include/control/port_counter.p4",
             "line" : 30,
@@ -5574,10 +5399,33 @@
         "column" : 8,
         "source_fragment" : "FabricEgress"
       },
-      "init_table" : "node_32",
+      "init_table" : "node_28",
       "tables" : [
         {
           "name" : "tbl_act_2",
+          "id" : 15,
+          "key" : [],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [34],
+          "actions" : ["act_2"],
+          "base_default_next" : "tbl_act_3",
+          "next_tables" : {
+            "act_2" : "tbl_act_3"
+          },
+          "default_entry" : {
+            "action_id" : 34,
+            "action_const" : true,
+            "action_data" : [],
+            "action_entry_const" : true
+          }
+        },
+        {
+          "name" : "tbl_act_3",
           "id" : 16,
           "key" : [],
           "match_type" : "exact",
@@ -5587,10 +5435,10 @@
           "support_timeout" : false,
           "direct_meters" : null,
           "action_ids" : [36],
-          "actions" : ["act_2"],
-          "base_default_next" : "tbl_act_3",
+          "actions" : ["act_4"],
+          "base_default_next" : "node_31",
           "next_tables" : {
-            "act_2" : "tbl_act_3"
+            "act_4" : "node_31"
           },
           "default_entry" : {
             "action_id" : 36,
@@ -5600,7 +5448,7 @@
           }
         },
         {
-          "name" : "tbl_act_3",
+          "name" : "tbl_act_4",
           "id" : 17,
           "key" : [],
           "match_type" : "exact",
@@ -5609,37 +5457,14 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [38],
-          "actions" : ["act_4"],
-          "base_default_next" : "node_35",
-          "next_tables" : {
-            "act_4" : "node_35"
-          },
-          "default_entry" : {
-            "action_id" : 38,
-            "action_const" : true,
-            "action_data" : [],
-            "action_entry_const" : true
-          }
-        },
-        {
-          "name" : "tbl_act_4",
-          "id" : 18,
-          "key" : [],
-          "match_type" : "exact",
-          "type" : "simple",
-          "max_size" : 1024,
-          "with_counters" : false,
-          "support_timeout" : false,
-          "direct_meters" : null,
-          "action_ids" : [37],
+          "action_ids" : [35],
           "actions" : ["act_3"],
           "base_default_next" : null,
           "next_tables" : {
             "act_3" : null
           },
           "default_entry" : {
-            "action_id" : 37,
+            "action_id" : 35,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
@@ -5649,11 +5474,11 @@
       "action_profiles" : [],
       "conditionals" : [
         {
-          "name" : "node_32",
-          "id" : 12,
+          "name" : "node_28",
+          "id" : 9,
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 174,
+            "line" : 156,
             "column" : 12,
             "source_fragment" : "fabric_metadata.pop_vlan_at_egress"
           },
@@ -5672,8 +5497,8 @@
           "false_next" : "tbl_act_3"
         },
         {
-          "name" : "node_35",
-          "id" : 13,
+          "name" : "node_31",
+          "id" : 10,
           "source_info" : {
             "filename" : "./include/control/packetio.p4",
             "line" : 38,
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 2ba127c..45cfb71 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
+++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
@@ -375,28 +375,6 @@
 }
 tables {
   preamble {
-    id: 33589605
-    name: "next.next_id_mapping"
-    alias: "next_id_mapping"
-  }
-  match_fields {
-    id: 1
-    name: "fabric_metadata.next_id"
-    bitwidth: 32
-    match_type: EXACT
-  }
-  action_refs {
-    id: 16800774
-  }
-  action_refs {
-    id: 16800567
-    annotations: "@defaultonly()"
-  }
-  direct_resource_ids: 302015538
-  size: 1024
-}
-tables {
-  preamble {
     id: 33615740
     name: "next.simple"
     alias: "simple"
@@ -564,18 +542,6 @@
 }
 actions {
   preamble {
-    id: 16800774
-    name: "next.set_next_type"
-    alias: "set_next_type"
-  }
-  params {
-    id: 1
-    name: "next_type"
-    bitwidth: 3
-  }
-}
-actions {
-  preamble {
     id: 16818315
     name: "next.output"
     alias: "output"
@@ -829,17 +795,6 @@
 }
 direct_counters {
   preamble {
-    id: 302015538
-    name: "next.next_id_mapping_counter"
-    alias: "next_id_mapping_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33589605
-}
-direct_counters {
-  preamble {
     id: 301991179
     name: "next.simple_counter"
     alias: "simple_counter"
diff --git a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipelinerTest.java b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipelinerTest.java
index 8493ca6..8446729 100644
--- a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipelinerTest.java
+++ b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricNextPipelinerTest.java
@@ -19,7 +19,6 @@
 import com.google.common.collect.ImmutableList;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.onlab.util.ImmutableByteSequence;
 import org.onosproject.net.flow.DefaultFlowRule;
 import org.onosproject.net.flow.DefaultTrafficSelector;
 import org.onosproject.net.flow.DefaultTrafficTreatment;
@@ -34,9 +33,7 @@
 import org.onosproject.net.group.GroupBucket;
 import org.onosproject.net.group.GroupBuckets;
 import org.onosproject.net.group.GroupDescription;
-import org.onosproject.net.pi.runtime.PiAction;
 import org.onosproject.net.pi.runtime.PiActionGroupId;
-import org.onosproject.net.pi.runtime.PiActionParam;
 import org.onosproject.net.pi.runtime.PiGroupKey;
 import org.onosproject.pipelines.fabric.FabricConstants;
 
@@ -45,7 +42,7 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.onosproject.pipelines.fabric.FabricConstants.ACT_PRF_ECMP_SELECTOR_ID;
+import static org.onosproject.pipelines.fabric.FabricConstants.ACT_PRF_NEXT_ECMP_SELECTOR_ID;
 import static org.onosproject.pipelines.fabric.FabricConstants.TBL_HASHED_ID;
 
 /**
@@ -103,11 +100,9 @@
 
         List<FlowRule> flowRulesInstalled = (List<FlowRule>) result.flowRules();
         List<GroupDescription> groupsInstalled = (List<GroupDescription>) result.groups();
-        assertEquals(2, flowRulesInstalled.size());
+        assertEquals(1, flowRulesInstalled.size());
         assertTrue(groupsInstalled.isEmpty());
 
-        verifyNextIdMapping(flowRulesInstalled.get(0), NEXT_TYPE_SIMPLE);
-
         // Simple table
         PiCriterion nextIdCriterion = PiCriterion.builder()
                 .matchExact(FabricConstants.HF_FABRIC_METADATA_NEXT_ID_ID, NEXT_ID_1)
@@ -115,7 +110,7 @@
         TrafficSelector nextIdSelector = DefaultTrafficSelector.builder()
                 .matchPi(nextIdCriterion)
                 .build();
-        FlowRule actualFlowRule = flowRulesInstalled.get(1);
+        FlowRule actualFlowRule = flowRulesInstalled.get(0);
         FlowRule expectedFlowRule = DefaultFlowRule.builder()
                 .forDevice(DEVICE_ID)
                 .fromApp(APP_ID)
@@ -129,36 +124,6 @@
         assertTrue(expectedFlowRule.exactMatch(actualFlowRule));
     }
 
-    private void verifyNextIdMapping(FlowRule flowRule, byte nextType) {
-        FlowRule expectedFlowRule;
-        PiCriterion nextIdCriterion = PiCriterion.builder()
-                .matchExact(FabricConstants.HF_FABRIC_METADATA_NEXT_ID_ID, NEXT_ID_1)
-                .build();
-        TrafficSelector nextIdSelector = DefaultTrafficSelector.builder()
-                .matchPi(nextIdCriterion)
-                .build();
-        PiActionParam setNextToSimpleParam = new PiActionParam(FabricConstants.ACT_PRM_NEXT_TYPE_ID,
-                                                               ImmutableByteSequence.copyFrom(nextType));
-        PiAction setNextToSimpleAction = PiAction.builder()
-                .withId(FabricConstants.ACT_SET_NEXT_TYPE_ID)
-                .withParameter(setNextToSimpleParam)
-                .build();
-        TrafficTreatment setNextTypeTreatment = DefaultTrafficTreatment.builder()
-                .piTableAction(setNextToSimpleAction)
-                .build();
-        expectedFlowRule = DefaultFlowRule.builder()
-                .forDevice(DEVICE_ID)
-                .fromApp(APP_ID)
-                .makePermanent()
-                // FIXME: currently next objective doesn't support priority, set priority to zero
-                .withPriority(0)
-                .forTable(FabricConstants.TBL_NEXT_ID_MAPPING_ID)
-                .withSelector(nextIdSelector)
-                .withTreatment(setNextTypeTreatment)
-                .build();
-        assertTrue(expectedFlowRule.exactMatch(flowRule));
-    }
-
     /**
      * Test program ecmp output group for Hashed table.
      */
@@ -190,11 +155,9 @@
         // Should generates 2 flows and 1 group
         List<FlowRule> flowRulesInstalled = (List<FlowRule>) result.flowRules();
         List<GroupDescription> groupsInstalled = (List<GroupDescription>) result.groups();
-        assertEquals(2, flowRulesInstalled.size());
+        assertEquals(1, flowRulesInstalled.size());
         assertEquals(1, groupsInstalled.size());
 
-        verifyNextIdMapping(flowRulesInstalled.get(0), NEXT_TYPE_HASHED);
-
         // Hashed table
         PiCriterion nextIdCriterion = PiCriterion.builder()
                 .matchExact(FabricConstants.HF_FABRIC_METADATA_NEXT_ID_ID, NEXT_ID_1)
@@ -206,7 +169,7 @@
         TrafficTreatment treatment = DefaultTrafficTreatment.builder()
                 .piTableAction(actionGroupId)
                 .build();
-        FlowRule actualFlowRule = flowRulesInstalled.get(1);
+        FlowRule actualFlowRule = flowRulesInstalled.get(0);
         FlowRule expectedFlowRule = DefaultFlowRule.builder()
                 .forDevice(DEVICE_ID)
                 .fromApp(APP_ID)
@@ -227,7 +190,7 @@
                 .map(DefaultGroupBucket::createSelectGroupBucket)
                 .collect(Collectors.toList());
         GroupBuckets groupBuckets = new GroupBuckets(buckets);
-        PiGroupKey groupKey = new PiGroupKey(TBL_HASHED_ID, ACT_PRF_ECMP_SELECTOR_ID, NEXT_ID_1);
+        PiGroupKey groupKey = new PiGroupKey(TBL_HASHED_ID, ACT_PRF_NEXT_ECMP_SELECTOR_ID, NEXT_ID_1);
         GroupDescription expectedGroup = new DefaultGroupDescription(
                 DEVICE_ID,
                 GroupDescription.Type.SELECT,