Do not compile with IPv6 support in fabric.p4 by default

Change-Id: I5194ccb0ab78ec4388106cea14c96884f5d16b0f
diff --git a/pipelines/fabric/src/main/resources/include/control/forwarding.p4 b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
index 2993191..de46115 100644
--- a/pipelines/fabric/src/main/resources/include/control/forwarding.p4
+++ b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
@@ -31,8 +31,6 @@
     direct_counter(CounterType.packets_and_bytes) mpls_counter;
     direct_counter(CounterType.packets_and_bytes) unicast_v4_counter;
     direct_counter(CounterType.packets_and_bytes) multicast_v4_counter;
-    direct_counter(CounterType.packets_and_bytes) unicast_v6_counter;
-    direct_counter(CounterType.packets_and_bytes) multicast_v6_counter;
     direct_counter(CounterType.packets_and_bytes) acl_counter;
 
     action drop() {
@@ -98,6 +96,10 @@
         counters = multicast_v4_counter;
     }
 
+#ifdef WITH_IPV6
+    direct_counter(CounterType.packets_and_bytes) unicast_v6_counter;
+    direct_counter(CounterType.packets_and_bytes) multicast_v6_counter;
+
     table unicast_v6 {
         key = {
             hdr.ipv6.dst_addr: lpm;
@@ -120,6 +122,7 @@
         }
         counters = multicast_v6_counter;
     }
+#endif // WITH_IPV6
 
     table acl {
         key = {
@@ -161,8 +164,10 @@
         }
         else if (fabric_metadata.fwd_type == FWD_IPV4_UNICAST) unicast_v4.apply();
         else if (fabric_metadata.fwd_type == FWD_IPV4_MULTICAST) multicast_v4.apply();
+#ifdef WITH_IPV6
         else if (fabric_metadata.fwd_type == FWD_IPV6_UNICAST) unicast_v6.apply();
         else if (fabric_metadata.fwd_type == FWD_IPV6_MULTICAST) multicast_v6.apply();
+#endif // WITH_IPV6
         acl.apply();
     }
 }
diff --git a/pipelines/fabric/src/main/resources/include/control/next.p4 b/pipelines/fabric/src/main/resources/include/control/next.p4
index 2fbb866..e0ebbe8 100644
--- a/pipelines/fabric/src/main/resources/include/control/next.p4
+++ b/pipelines/fabric/src/main/resources/include/control/next.p4
@@ -139,9 +139,11 @@
                 if(hdr.ipv4.isValid()) {
                     hdr.ipv4.ttl = hdr.ipv4.ttl - 1;
                 }
+#ifdef WITH_IPV6
                 else if (hdr.ipv6.isValid()) {
                     hdr.ipv6.hop_limit = hdr.ipv6.hop_limit - 1;
                 }
+#endif // WITH_IPV6
             }
         }
         hashed.apply();
diff --git a/pipelines/fabric/src/main/resources/include/parser.p4 b/pipelines/fabric/src/main/resources/include/parser.p4
index 8355c12..2b50505 100644
--- a/pipelines/fabric/src/main/resources/include/parser.p4
+++ b/pipelines/fabric/src/main/resources/include/parser.p4
@@ -45,7 +45,9 @@
             ETHERTYPE_MPLS: parse_mpls;
             ETHERTYPE_ARP: parse_arp;
             ETHERTYPE_IPV4: parse_ipv4;
+#ifdef WITH_IPV6
             ETHERTYPE_IPV6: parse_ipv6;
+#endif // WITH_IPV6
             default: accept;
         }
     }
@@ -55,7 +57,9 @@
         transition select(hdr.vlan_tag.ether_type){
             ETHERTYPE_ARP: parse_arp;
             ETHERTYPE_IPV4: parse_ipv4;
+#ifdef WITH_IPV6
             ETHERTYPE_IPV6: parse_ipv6;
+#endif // WITH_IPV6
             ETHERTYPE_MPLS: parse_mpls;
             default: accept;
         }
@@ -69,7 +73,9 @@
         transition select(packet.lookahead<bit<4>>()) {
             //The packet should be either IPv4 or IPv6.
             IP_VERSION_4: parse_ipv4;
+#ifdef WITH_IPV6
             IP_VERSION_6: parse_ipv6;
+#endif // WITH_IPV6
             default: parse_ethernet;
         }
     }
@@ -86,6 +92,7 @@
         }
     }
 
+#ifdef WITH_IPV6
     state parse_ipv6 {
         packet.extract(hdr.ipv6);
         fabric_metadata.ip_proto = hdr.ipv6.next_hdr;
@@ -96,6 +103,7 @@
             default: accept;
         }
     }
+#endif // WITH_IPV6
 
     state parse_arp {
         packet.extract(hdr.arp);
@@ -168,7 +176,9 @@
         packet.emit(hdr.gtpu);
 #endif // WITH_SPGW
         packet.emit(hdr.ipv4);
+#ifdef WITH_IPV6
         packet.emit(hdr.ipv6);
+#endif // WITH_IPV6
         packet.emit(hdr.tcp);
         packet.emit(hdr.udp);
         packet.emit(hdr.icmp);