[ONOS-8037] Update basic makefile and gitignore and recompiled the pipeline, tested with reactive forwarding

Change-Id: I655de81382bb4d4688736dcb634bcf065de72ceb
diff --git a/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java b/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java
index a49ccef..ce13851 100644
--- a/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java
+++ b/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java
@@ -19,6 +19,7 @@
 import org.onosproject.net.pi.model.PiActionId;
 import org.onosproject.net.pi.model.PiActionParamId;
 import org.onosproject.net.pi.model.PiActionProfileId;
+import org.onosproject.net.pi.model.PiMeterId;
 import org.onosproject.net.pi.model.PiPacketMetadataId;
 import org.onosproject.net.pi.model.PiCounterId;
 import org.onosproject.net.pi.model.PiMatchFieldId;
@@ -92,10 +93,13 @@
     public static final PiActionProfileId INGRESS_WCMP_CONTROL_WCMP_SELECTOR =
             PiActionProfileId.of("ingress.wcmp_control.wcmp_selector");
     // Packet Metadata IDs
-    public static final PiPacketMetadataId PADDING =
-            PiPacketMetadataId.of("_padding");
     public static final PiPacketMetadataId INGRESS_PORT =
             PiPacketMetadataId.of("ingress_port");
     public static final PiPacketMetadataId EGRESS_PORT =
             PiPacketMetadataId.of("egress_port");
-}
+    // Meter IDs
+    public static final PiMeterId INGRESS_PORT_METERS_INGRESS_INGRESS_PORT_METER =
+            PiMeterId.of("ingress.port_meters_ingress.ingress_port_meter");
+    public static final PiMeterId EGRESS_PORT_METERS_EGRESS_EGRESS_PORT_METER =
+            PiMeterId.of("egress.port_meters_egress.egress_port_meter");
+}
\ No newline at end of file
diff --git a/pipelines/basic/src/main/resources/.gitignore b/pipelines/basic/src/main/resources/.gitignore
new file mode 100644
index 0000000..07603f3
--- /dev/null
+++ b/pipelines/basic/src/main/resources/.gitignore
@@ -0,0 +1,3 @@
+p4c-out/*/tofino
+p4c-out/**/graphs
+p4c-out/**/*_pp.p4
diff --git a/pipelines/basic/src/main/resources/Makefile b/pipelines/basic/src/main/resources/Makefile
index 64b3ea2..a9342a6 100644
--- a/pipelines/basic/src/main/resources/Makefile
+++ b/pipelines/basic/src/main/resources/Makefile
@@ -1,19 +1,16 @@
 all: basic int constants
 
 basic: basic.p4
-	p4c-bm2-ss --arch v1model -o p4c-out/bmv2/basic.json \
-		--p4runtime-files p4c-out/bmv2/basic_p4info.txt \
-		basic.p4
+	@./bmv2-compile.sh "basic" ""
 
 int: int.p4
-	p4c-bm2-ss --arch v1model -o p4c-out/bmv2/int.json "-DTARGET_BMV2" \
-		--p4runtime-files p4c-out/bmv2/int_p4info.txt \
-		int.p4
+	@./bmv2-compile.sh "int" "-DTARGET_BMV2"
 
 constants:
-	onos-gen-p4-constants \
-		-o $(ONOS_ROOT)/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java \
-		basic p4c-out/bmv2/basic_p4info.txt
+	docker run -v $(ONOS_ROOT):/onos -w /onos/tools/dev/bin \
+		--entrypoint ./onos-gen-p4-constants opennetworking/p4mn:stable \
+		-o /onos/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java \
+		basic /onos/pipelines/basic/src/main/resources/p4c-out/bmv2/basic_p4info.txt
 
 clean:
 	rm -rf p4c-out/bmv2/*
diff --git a/pipelines/basic/src/main/resources/bmv2-compile.sh b/pipelines/basic/src/main/resources/bmv2-compile.sh
new file mode 100755
index 0000000..56807d0
--- /dev/null
+++ b/pipelines/basic/src/main/resources/bmv2-compile.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+
+PROFILE=$1
+OTHER_FLAGS=$2
+
+SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+OUT_DIR=${SRC_DIR}/p4c-out/bmv2
+
+mkdir -p ${OUT_DIR}
+mkdir -p ${OUT_DIR}/graphs
+
+echo
+echo "## Compiling profile ${PROFILE} in ${OUT_DIR}..."
+
+dockerImage=opennetworking/p4c:stable
+dockerRun="docker run --rm -w ${SRC_DIR} -v ${SRC_DIR}:${SRC_DIR} -v ${OUT_DIR}:${OUT_DIR} ${dockerImage}"
+
+# Generate preprocessed P4 source (for debugging).
+(set -x; ${dockerRun} p4c-bm2-ss --arch v1model \
+        ${OTHER_FLAGS} \
+        --pp ${OUT_DIR}/${PROFILE}_pp.p4 ${PROFILE}.p4)
+
+# Generate BMv2 JSON and P4Info.
+(set -x; ${dockerRun} p4c-bm2-ss --arch v1model -o ${OUT_DIR}/${PROFILE}.json \
+        ${OTHER_FLAGS} \
+        --p4runtime-files ${OUT_DIR}/${PROFILE}_p4info.txt ${PROFILE}.p4)
diff --git a/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json b/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json
index fcc8ce9..d794bda 100644
--- a/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json
+++ b/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json
@@ -181,13 +181,13 @@
   "header_union_stacks" : [],
   "field_lists" : [],
   "errors" : [
-    ["NoError", 0],
-    ["PacketTooShort", 1],
-    ["NoMatch", 2],
-    ["StackOutOfBounds", 3],
-    ["HeaderTooShort", 4],
-    ["ParserTimeout", 5],
-    ["ParserInvalidArgument", 6]
+    ["NoError", 1],
+    ["PacketTooShort", 2],
+    ["NoMatch", 3],
+    ["StackOutOfBounds", 4],
+    ["HeaderTooShort", 5],
+    ["ParserTimeout", 6],
+    ["ParserInvalidArgument", 7]
   ],
   "enums" : [],
   "parsers" : [
diff --git a/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json b/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json
index 038ad74..c39f96b 100644
--- a/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json
+++ b/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json
@@ -566,13 +566,13 @@
     }
   ],
   "errors" : [
-    ["NoError", 0],
-    ["PacketTooShort", 1],
-    ["NoMatch", 2],
-    ["StackOutOfBounds", 3],
-    ["HeaderTooShort", 4],
-    ["ParserTimeout", 5],
-    ["ParserInvalidArgument", 6]
+    ["NoError", 1],
+    ["PacketTooShort", 2],
+    ["NoMatch", 3],
+    ["StackOutOfBounds", 4],
+    ["HeaderTooShort", 5],
+    ["ParserTimeout", 6],
+    ["ParserInvalidArgument", 7]
   ],
   "enums" : [],
   "parsers" : [