ONOS-7059 Port counters in tor.p4 and bmv2/tofino compiler output

Tested on BMv2 and working.

Change-Id: Ia6e4b3c823b0bdfd1671419558e8a350b1d99990
diff --git a/tools/test/p4src/tor/p4c-out/tor.p4info b/tools/test/p4src/tor/p4c-out/tor.p4info
new file mode 100644
index 0000000..44c994b
--- /dev/null
+++ b/tools/test/p4src/tor/p4c-out/tor.p4info
@@ -0,0 +1,672 @@
+tables {
+  preamble {
+    id: 33619357
+    name: "vrf.vrf_classifier_table"
+    alias: "vrf_classifier_table"
+    annotations: "@proto_package(\"vrf\")"
+  }
+  match_fields {
+    id: 1
+    name: "hdr.ethernet.ether_type"
+    annotations: "@proto_tag(1)"
+    bitwidth: 16
+    match_type: EXACT
+  }
+  match_fields {
+    id: 2
+    name: "hdr.ethernet.src_addr"
+    annotations: "@proto_tag(2)"
+    bitwidth: 48
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 3
+    name: "hdr.ipv4_base.diffserv"
+    annotations: "@proto_tag(3)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 4
+    name: "hdr.ipv4_base.dst_addr"
+    annotations: "@proto_tag(4)"
+    bitwidth: 32
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 5
+    name: "standard_metadata.ingress_port"
+    annotations: "@proto_tag(5)"
+    bitwidth: 9
+    match_type: EXACT
+  }
+  match_fields {
+    id: 6
+    name: "hdr.ipv6_base.traffic_class"
+    annotations: "@proto_tag(6)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 7
+    name: "hdr.ipv6_base.dst_addr"
+    annotations: "@proto_tag(7)"
+    bitwidth: 128
+    match_type: TERNARY
+  }
+  action_refs {
+    id: 16793447
+    annotations: "@proto_tag(1)"
+  }
+  const_default_action_id: 16793447
+  size: 1024
+}
+tables {
+  preamble {
+    id: 33592054
+    name: "class_id.class_id_assignment_table"
+    alias: "class_id_assignment_table"
+    annotations: "@proto_package(\"class_id\")"
+  }
+  match_fields {
+    id: 1
+    name: "hdr.ethernet.ether_type"
+    annotations: "@proto_tag(1)"
+    bitwidth: 16
+    match_type: EXACT
+  }
+  match_fields {
+    id: 2
+    name: "hdr.ipv4_base.ttl"
+    annotations: "@proto_tag(2)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 3
+    name: "hdr.ipv6_base.hop_limit"
+    annotations: "@proto_tag(3)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 4
+    name: "hdr.ipv4_base.dst_addr"
+    annotations: "@proto_tag(4)"
+    bitwidth: 32
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 5
+    name: "hdr.ipv6_base.dst_addr"
+    annotations: "@proto_tag(5)"
+    bitwidth: 128
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 6
+    name: "hdr.ipv4_base.protocol"
+    annotations: "@proto_tag(6)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 7
+    name: "hdr.ipv6_base.next_header"
+    annotations: "@proto_tag(7)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 8
+    name: "local_metadata.l4_src_port"
+    annotations: "@proto_tag(8)"
+    bitwidth: 16
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 9
+    name: "local_metadata.l4_dst_port"
+    annotations: "@proto_tag(9)"
+    bitwidth: 16
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 10
+    name: "hdr.vlan_tag[0].vid"
+    annotations: "@proto_tag(10)"
+    bitwidth: 12
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 11
+    name: "hdr.vlan_tag[0].pcp"
+    annotations: "@proto_tag(11)"
+    bitwidth: 3
+    match_type: TERNARY
+  }
+  action_refs {
+    id: 16778630
+    annotations: "@proto_tag(1)"
+  }
+  const_default_action_id: 16778630
+  size: 1024
+}
+tables {
+  preamble {
+    id: 33568218
+    name: "l3_fwd.l3_routing_classifier_table"
+    alias: "l3_routing_classifier_table"
+    annotations: "@proto_package(\"l3_fwd\")"
+  }
+  match_fields {
+    id: 1
+    name: "hdr.ethernet.dst_addr"
+    annotations: "@proto_tag(1)"
+    bitwidth: 48
+    match_type: EXACT
+  }
+  action_refs {
+    id: 16800567
+    annotations: "@proto_tag(1)"
+  }
+  const_default_action_id: 16800567
+  size: 1024
+}
+tables {
+  preamble {
+    id: 33575570
+    name: "l3_fwd.l3_ipv4_override_table"
+    alias: "l3_ipv4_override_table"
+    annotations: "@proto_package(\"l3_fwd\")"
+  }
+  match_fields {
+    id: 1
+    name: "hdr.ipv4_base.dst_addr"
+    annotations: "@proto_tag(1)"
+    bitwidth: 32
+    match_type: LPM
+  }
+  action_refs {
+    id: 16779406
+    annotations: "@proto_tag(1)"
+  }
+  action_refs {
+    id: 16800567
+    annotations: "@proto_tag(2)"
+  }
+  const_default_action_id: 16800567
+  implementation_id: 285270769
+  size: 1024
+}
+tables {
+  preamble {
+    id: 33581631
+    name: "l3_fwd.l3_ipv4_vrf_table"
+    alias: "l3_ipv4_vrf_table"
+    annotations: "@proto_package(\"l3_fwd\")"
+  }
+  match_fields {
+    id: 1
+    name: "local_metadata.vrf_id"
+    annotations: "@proto_tag(1)"
+    bitwidth: 32
+    match_type: EXACT
+  }
+  match_fields {
+    id: 2
+    name: "hdr.ipv4_base.dst_addr"
+    annotations: "@proto_tag(2)"
+    bitwidth: 32
+    match_type: LPM
+  }
+  action_refs {
+    id: 16779406
+    annotations: "@proto_tag(1)"
+  }
+  action_refs {
+    id: 16800567
+    annotations: "@proto_tag(2)"
+  }
+  const_default_action_id: 16800567
+  implementation_id: 285270769
+  size: 1024
+}
+tables {
+  preamble {
+    id: 33572896
+    name: "l3_fwd.l3_ipv4_fallback_table"
+    alias: "l3_ipv4_fallback_table"
+    annotations: "@proto_package(\"l3_fwd\")"
+  }
+  match_fields {
+    id: 1
+    name: "hdr.ipv4_base.dst_addr"
+    annotations: "@proto_tag(1)"
+    bitwidth: 32
+    match_type: LPM
+  }
+  action_refs {
+    id: 16779406
+    annotations: "@proto_tag(1)"
+  }
+  action_refs {
+    id: 16800567
+    annotations: "@proto_tag(2)"
+  }
+  const_default_action_id: 16800567
+  implementation_id: 285270769
+  size: 1024
+}
+tables {
+  preamble {
+    id: 33613201
+    name: "punt.punt_table"
+    alias: "punt_table"
+    annotations: "@proto_package(\"punt\")"
+  }
+  match_fields {
+    id: 1
+    name: "standard_metadata.ingress_port"
+    annotations: "@proto_tag(1)"
+    bitwidth: 9
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 2
+    name: "standard_metadata.egress_spec"
+    annotations: "@proto_tag(2)"
+    bitwidth: 9
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 3
+    name: "hdr.ethernet.ether_type"
+    annotations: "@proto_tag(3)"
+    bitwidth: 16
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 4
+    name: "hdr.ipv4_base.diffserv"
+    annotations: "@proto_tag(4)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 5
+    name: "hdr.ipv6_base.traffic_class"
+    annotations: "@proto_tag(5)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 6
+    name: "hdr.ipv4_base.ttl"
+    annotations: "@proto_tag(6)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 7
+    name: "hdr.ipv6_base.hop_limit"
+    annotations: "@proto_tag(7)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 8
+    name: "hdr.ipv4_base.src_addr"
+    annotations: "@proto_tag(8)"
+    bitwidth: 32
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 9
+    name: "hdr.ipv4_base.dst_addr"
+    annotations: "@proto_tag(9)"
+    bitwidth: 32
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 10
+    name: "hdr.ipv6_base.src_addr"
+    annotations: "@proto_tag(10)"
+    bitwidth: 128
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 11
+    name: "hdr.ipv6_base.dst_addr"
+    annotations: "@proto_tag(11)"
+    bitwidth: 128
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 12
+    name: "hdr.ipv4_base.protocol"
+    annotations: "@proto_tag(12)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 13
+    name: "hdr.ipv6_base.next_header"
+    annotations: "@proto_tag(13)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 14
+    name: "hdr.arp.target_proto_addr"
+    annotations: "@proto_tag(14)"
+    bitwidth: 32
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 15
+    name: "local_metadata.icmp_code"
+    annotations: "@proto_tag(15)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 16
+    name: "hdr.vlan_tag[0].vid"
+    annotations: "@proto_tag(16)"
+    bitwidth: 12
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 17
+    name: "hdr.vlan_tag[0].pcp"
+    annotations: "@proto_tag(17)"
+    bitwidth: 3
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 18
+    name: "local_metadata.class_id"
+    annotations: "@proto_tag(18)"
+    bitwidth: 8
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 19
+    name: "local_metadata.vrf_id"
+    annotations: "@proto_tag(19)"
+    bitwidth: 32
+    match_type: TERNARY
+  }
+  action_refs {
+    id: 16819104
+    annotations: "@proto_tag(1)"
+  }
+  action_refs {
+    id: 16784911
+    annotations: "@proto_tag(2)"
+  }
+  action_refs {
+    id: 16800567
+    annotations: "@defaultonly()"
+  }
+  direct_resource_ids: 302050023
+  direct_resource_ids: 318814206
+  size: 1024
+}
+tables {
+  preamble {
+    id: 33594375
+    name: "spoof_protection.dhcp_spoof_protection_table"
+    alias: "dhcp_spoof_protection_table"
+    annotations: "@proto_package(\"spoof_protection\")"
+  }
+  match_fields {
+    id: 1
+    name: "local_metadata.l4_dst_port"
+    annotations: "@proto_tag(1)"
+    bitwidth: 16
+    match_type: EXACT
+  }
+  match_fields {
+    id: 2
+    name: "standard_metadata.egress_spec"
+    annotations: "@proto_tag(2)"
+    bitwidth: 9
+    match_type: EXACT
+  }
+  action_refs {
+    id: 16827294
+    annotations: "@proto_tag(1)"
+  }
+  action_refs {
+    id: 16800567
+    annotations: "@defaultonly()"
+  }
+  size: 1024
+}
+actions {
+  preamble {
+    id: 16800567
+    name: "NoAction"
+    alias: "NoAction"
+  }
+}
+actions {
+  preamble {
+    id: 16793447
+    name: "vrf.set_vrf"
+    alias: "set_vrf"
+    annotations: "@proto_package(\"vrf\")"
+  }
+  params {
+    id: 1
+    name: "vrf_id"
+    annotations: "@proto_tag(1)"
+    bitwidth: 32
+  }
+}
+actions {
+  preamble {
+    id: 16778630
+    name: "class_id.set_class_id"
+    alias: "set_class_id"
+    annotations: "@proto_package(\"class_id\")"
+  }
+  params {
+    id: 1
+    name: "class_id_value"
+    annotations: "@proto_tag(1)"
+    bitwidth: 8
+  }
+}
+actions {
+  preamble {
+    id: 16779406
+    name: "l3_fwd.set_nexthop"
+    alias: "set_nexthop"
+    annotations: "@proto_package(\"l3_fwd\")"
+  }
+  params {
+    id: 1
+    name: "port"
+    annotations: "@proto_tag(1)"
+    bitwidth: 9
+  }
+  params {
+    id: 2
+    name: "smac"
+    annotations: "@proto_tag(2)"
+    bitwidth: 48
+  }
+  params {
+    id: 3
+    name: "dmac"
+    annotations: "@proto_tag(3)"
+    bitwidth: 48
+  }
+}
+actions {
+  preamble {
+    id: 16819104
+    name: "punt.set_queue_and_clone_to_cpu"
+    alias: "set_queue_and_clone_to_cpu"
+    annotations: "@proto_package(\"punt\")"
+  }
+  params {
+    id: 1
+    name: "queue_id"
+    annotations: "@proto_tag(1)"
+    bitwidth: 5
+  }
+}
+actions {
+  preamble {
+    id: 16784911
+    name: "punt.set_queue_and_send_to_cpu"
+    alias: "set_queue_and_send_to_cpu"
+    annotations: "@proto_package(\"punt\")"
+  }
+  params {
+    id: 1
+    name: "queue_id"
+    annotations: "@proto_tag(1)"
+    bitwidth: 5
+  }
+}
+actions {
+  preamble {
+    id: 16792485
+    name: "packetio_egress.encap_packet_in_header"
+    alias: "encap_packet_in_header"
+  }
+}
+actions {
+  preamble {
+    id: 16827294
+    name: "spoof_protection.drop_packet"
+    alias: "drop_packet"
+    annotations: "@proto_package(\"spoof_protection\")"
+  }
+}
+action_profiles {
+  preamble {
+    id: 285270769
+    name: "l3_fwd.wcmp_action_profile"
+    alias: "wcmp_action_profile"
+  }
+  table_ids: 33572896
+  table_ids: 33575570
+  table_ids: 33581631
+  with_selector: true
+  size: 1024
+}
+counters {
+  preamble {
+    id: 302001476
+    name: "packetio_egress.egress_port_counter"
+    alias: "egress_port_counter"
+  }
+  spec {
+    unit: BYTES
+  }
+  size: 510
+}
+counters {
+  preamble {
+    id: 302037457
+    name: "packetio_egress.ingress_port_counter"
+    alias: "ingress_port_counter"
+  }
+  spec {
+    unit: BYTES
+  }
+  size: 510
+}
+direct_counters {
+  preamble {
+    id: 302050023
+    name: "punt.punt_packet_counter"
+    alias: "punt_packet_counter"
+    annotations: "@proto_package(\"punt\")"
+  }
+  spec {
+    unit: PACKETS
+  }
+  direct_table_id: 33613201
+}
+direct_meters {
+  preamble {
+    id: 318814206
+    name: "punt.ingress_port_meter"
+    alias: "ingress_port_meter"
+    annotations: "@proto_package(\"punt\")"
+  }
+  spec {
+    unit: BYTES
+  }
+  direct_table_id: 33613201
+}
+controller_packet_metadata {
+  preamble {
+    id: 2868941301
+    name: "packet_in"
+    annotations: "@controller_header(\"packet_in\")"
+  }
+  metadata {
+    id: 1
+    name: "ingress_physical_port"
+    annotations: "@proto_tag(1)"
+    bitwidth: 9
+  }
+  metadata {
+    id: 2
+    name: "padding1"
+    annotations: "@proto_tag(4)"
+    bitwidth: 7
+  }
+  metadata {
+    id: 3
+    name: "ingress_logical_port"
+    annotations: "@proto_tag(2)"
+    bitwidth: 32
+  }
+  metadata {
+    id: 4
+    name: "target_egress_port"
+    annotations: "@proto_tag(3)"
+    bitwidth: 9
+  }
+  metadata {
+    id: 5
+    name: "padding2"
+    annotations: "@proto_tag(5)"
+    bitwidth: 7
+  }
+}
+controller_packet_metadata {
+  preamble {
+    id: 2868916615
+    name: "packet_out"
+    annotations: "@not_extracted_in_egress()"
+    annotations: "@controller_header(\"packet_out\")"
+  }
+  metadata {
+    id: 1
+    name: "egress_physical_port"
+    annotations: "@proto_tag(1)"
+    bitwidth: 9
+  }
+  metadata {
+    id: 2
+    name: "submit_to_ingress"
+    annotations: "@proto_tag(2)"
+    bitwidth: 1
+  }
+  metadata {
+    id: 3
+    name: "padding"
+    annotations: "@proto_tag(3)"
+    bitwidth: 6
+  }
+}