Improve fabric.p4 to reduce pipeline resources and refactor pipeconf impl

This patch affects both the P4 pipeline implementation and the
Java pipeconf.

P4 PIPELINE
- Less tables and smarter use of metadata to reduce inter-tables
dependencies and favor parallel execution of tables.
- Removed unused actions / renamed existing ones to make forwarding
behavior clearer (e.g. ingress_port_vlan table)
- Remove co-existence of simple and hansed table. Hashed should be the
default one, but implementations that do not support action profiles
might compile fabric.p4 to use the simple one.
- Use @name annotations for match fields to make control plane
independent of table implementation.
- Use @hidden to avoid showing actions and table on the p4info that
cannot be controlled at runtime.
- First attempt to support double VLAN cross-connect (xconnect table).
- New design has been tested with "fabric-refactoring" branch of
fabric-p4test:
github.com/opennetworkinglab/fabric-p4test/tree/fabric-refactoring

JAVA PIPECONF
This patch brings a major refactoring that reflects the experience
gathered in the past months of working on fabric.p4 and reasoning on its
pipeconf implementation. Indeed, the FlowObjective API is
under-specified and sometimes ambiguous which makes the process of
creating and maintaining a pipeliner implementation tedious. This
refactoring brings a simplified implementation by removing unused/
unnecessary functionalities and by recognizing commonality when possible
(e.g. by means of abstract and utility classes). It also makes design
patterns more explicit and consistent. Overall, the goal is to reduce
technical debt and to make it easier to support new features as we
evolve fabric.p4

Changes include:
- Changes in pipeliner/interpreter to reflect new pipeline design.
- By default translate objective treatment to PiAction. This favors
debuggability of flow rules in ONOS.
- Support new NextObjective’s NextTreatment class.
- Remove lots of unused/unnecessary code (e.g. async callback handling
for pending objective install status in pipeliner as current
implementation was always returning success)
- Gather commonality in abstract classes and simplify implementation
for objective translator (filtering, forwarding, next)
- New implementation of ForwardingFunctionTypes (FFT) that looks at
criterion instance values along with their types (to avoid relying on
case-specific if-else conditions to recognize variants of an FFT)
- Adaptive translation of NextObjective based on presence of simple or
hashed table.
- Support DENY FilteringObjective

Also:
- Fix onos-p4-gen-constants to avoid generating conflicting
PiMatchFieldId variable names.
- Install Graphviz tools in p4vm to generate p4c graphs
- Generate p4c graphs by default when compiling fabric.p4
- Use more compact Hex string when printing PI values

Change-Id: Ife79e44054dc5bc48833f95d0551a7370150eac5
diff --git a/pipelines/fabric/src/main/resources/fabric.p4 b/pipelines/fabric/src/main/resources/fabric.p4
index 95b9bc8..6c60d52 100644
--- a/pipelines/fabric/src/main/resources/fabric.p4
+++ b/pipelines/fabric/src/main/resources/fabric.p4
@@ -19,6 +19,7 @@
 
 #include "include/control/filtering.p4"
 #include "include/control/forwarding.p4"
+#include "include/control/acl.p4"
 #include "include/control/next.p4"
 #include "include/control/packetio.p4"
 #include "include/header.p4"
@@ -37,13 +38,14 @@
 #include "include/int/int_main.p4"
 #endif // WITH_INT
 
-control FabricIngress (
-inout parsed_headers_t hdr,
-inout fabric_metadata_t fabric_metadata,
-inout standard_metadata_t standard_metadata) {
+control FabricIngress (inout parsed_headers_t hdr,
+                       inout fabric_metadata_t fabric_metadata,
+                       inout standard_metadata_t standard_metadata) {
+
     PacketIoIngress() pkt_io_ingress;
     Filtering() filtering;
     Forwarding() forwarding;
+    Acl() acl;
     Next() next;
 #ifdef WITH_PORT_COUNTER
     PortCountersControl() port_counters_control;
@@ -56,30 +58,33 @@
                               hdr.ipv4, hdr.udp, hdr.inner_ipv4, hdr.inner_udp);
 #endif // WITH_SPGW
         pkt_io_ingress.apply(hdr, fabric_metadata, standard_metadata);
-#ifdef WITH_SPGW
-#ifdef WITH_SPGW_PCC_GATING
-        fabric_metadata.spgw.l4_src_port = fabric_metadata.l4_src_port;
-        fabric_metadata.spgw.l4_dst_port = fabric_metadata.l4_dst_port;
-#endif // WITH_SPGW_PCC_GATING
-        spgw_ingress.apply(hdr.gtpu_ipv4, hdr.gtpu_udp, hdr.gtpu,
-                           hdr.ipv4, hdr.udp, fabric_metadata.spgw);
-#endif // WITH_SPGW
         filtering.apply(hdr, fabric_metadata, standard_metadata);
-        forwarding.apply(hdr, fabric_metadata, standard_metadata);
-        next.apply(hdr, fabric_metadata, standard_metadata);
+#ifdef WITH_SPGW
+        spgw_ingress.apply(hdr.gtpu_ipv4, hdr.gtpu_udp, hdr.gtpu,
+                           hdr.ipv4, hdr.udp, fabric_metadata);
+#endif // WITH_SPGW
+        if (fabric_metadata.skip_forwarding == _FALSE) {
+            forwarding.apply(hdr, fabric_metadata, standard_metadata);
+        }
+        acl.apply(hdr, fabric_metadata, standard_metadata);
+        if (fabric_metadata.skip_next == _FALSE) {
+            next.apply(hdr, fabric_metadata, standard_metadata);
 #ifdef WITH_PORT_COUNTER
-        // FIXME: we're not counting pkts punted to cpu or forwarded via multicast groups.
-        port_counters_control.apply(hdr, fabric_metadata, standard_metadata);
+            // FIXME: we're not counting pkts punted to cpu or forwarded via
+            // multicast groups. Remove when gNMI support will be there.
+            port_counters_control.apply(hdr, fabric_metadata, standard_metadata);
 #endif // WITH_PORT_COUNTER
 #if defined(WITH_INT_SOURCE) || defined(WITH_INT_SINK)
-        process_set_source_sink.apply(hdr, fabric_metadata, standard_metadata);
+            process_set_source_sink.apply(hdr, fabric_metadata, standard_metadata);
 #endif
+        }
     }
 }
 
 control FabricEgress (inout parsed_headers_t hdr,
                       inout fabric_metadata_t fabric_metadata,
                       inout standard_metadata_t standard_metadata) {
+
     PacketIoEgress() pkt_io_egress;
     EgressNextControl() egress_next;
 
@@ -89,7 +94,7 @@
         egress_next.apply(hdr, fabric_metadata, standard_metadata);
 #ifdef WITH_SPGW
         spgw_egress.apply(hdr.ipv4, hdr.gtpu_ipv4, hdr.gtpu_udp, hdr.gtpu,
-                          fabric_metadata.spgw, standard_metadata);
+                          fabric_metadata, standard_metadata);
 #endif // WITH_SPGW
 #ifdef WITH_INT
         process_int_main.apply(hdr, fabric_metadata, standard_metadata);