From 24ab6bba152043529ae9da4b88339b63c99c6d84 Mon Sep 17 00:00:00 2001 From: fruffy Date: Tue, 31 Jan 2023 15:16:53 -0500 Subject: [PATCH 1/6] Add DASH to the tested programs. --- backends/bmv2/CMakeLists.txt | 3 +- backends/p4test/CMakeLists.txt | 3 +- .../testgen/targets/bmv2/test/P4Tests.cmake | 5 +- testdata/p4_16_samples/dash/README.md | 4 + testdata/p4_16_samples/dash/dash-pipeline.p4 | 780 ++++++++++++++++++ testdata/p4_16_samples/omec/README.md | 2 +- 6 files changed, 792 insertions(+), 5 deletions(-) create mode 100644 testdata/p4_16_samples/dash/README.md create mode 100644 testdata/p4_16_samples/dash/dash-pipeline.p4 diff --git a/backends/bmv2/CMakeLists.txt b/backends/bmv2/CMakeLists.txt index 21625392308..fe82f6e10e8 100644 --- a/backends/bmv2/CMakeLists.txt +++ b/backends/bmv2/CMakeLists.txt @@ -129,9 +129,10 @@ p4c_find_tests("${P4TESTS_FOR_V1MODEL}" v1tests INCLUDE "${V1_INCLUDE_PATTERNS}" set (BMV2_V1MODEL_TEST_SUITES "${P4C_SOURCE_DIR}/testdata/p4_16_bmv_errors/*-bmv2.p4" + "${P4C_SOURCE_DIR}/testdata/p4_16_samples/dash/*.p4" "${P4C_SOURCE_DIR}/testdata/p4_16_samples/fabric_*/fabric.p4" - "${P4C_SOURCE_DIR}/testdata/p4_16_samples/pins/*.p4" "${P4C_SOURCE_DIR}/testdata/p4_16_samples/omec/*.p4" + "${P4C_SOURCE_DIR}/testdata/p4_16_samples/pins/*.p4" "${P4C_SOURCE_DIR}/testdata/p4_14_samples/switch_*/switch.p4" "${P4C_SOURCE_DIR}/testdata/p4_14_samples/*.p4" ${v1tests} diff --git a/backends/p4test/CMakeLists.txt b/backends/p4test/CMakeLists.txt index 6673f68efba..cf4966d2852 100644 --- a/backends/p4test/CMakeLists.txt +++ b/backends/p4test/CMakeLists.txt @@ -61,9 +61,10 @@ set(P4TEST_DRIVER ${P4C_SOURCE_DIR}/backends/p4test/run-p4-sample.py) set (P4TEST_SUITES "${P4C_SOURCE_DIR}/testdata/p4_16_samples/*.p4" + "${P4C_SOURCE_DIR}/testdata/p4_16_samples/dash/*.p4" "${P4C_SOURCE_DIR}/testdata/p4_16_samples/fabric_*/fabric.p4" - "${P4C_SOURCE_DIR}/testdata/p4_16_samples/pins/*.p4" "${P4C_SOURCE_DIR}/testdata/p4_16_samples/omec/*.p4" + "${P4C_SOURCE_DIR}/testdata/p4_16_samples/pins/*.p4" ) # Builds a list of tests for which P4Info generation is not supported. It makes diff --git a/backends/p4tools/modules/testgen/targets/bmv2/test/P4Tests.cmake b/backends/p4tools/modules/testgen/targets/bmv2/test/P4Tests.cmake index 1af45630561..a12fedfcde9 100644 --- a/backends/p4tools/modules/testgen/targets/bmv2/test/P4Tests.cmake +++ b/backends/p4tools/modules/testgen/targets/bmv2/test/P4Tests.cmake @@ -28,9 +28,10 @@ p4tools_find_tests("${P4_16_V1_TESTS}" v1tests EXCLUDE "") set( TESTGEN_BMV2_P416_TESTS "${CMAKE_CURRENT_LIST_DIR}/p4-programs/*.p4" - "${P4C_SOURCE_DIR}/testdata/p4_16_samples/pins/*.p4" - "${P4C_SOURCE_DIR}/testdata/p4_16_samples/omec/*.p4" + "${P4C_SOURCE_DIR}/testdata/p4_16_samples/dash/*.p4" "${P4C_SOURCE_DIR}/testdata/p4_16_samples/fabric_*/fabric.p4" + "${P4C_SOURCE_DIR}/testdata/p4_16_samples/omec/*.p4" + "${P4C_SOURCE_DIR}/testdata/p4_16_samples/pins/*.p4" ) p4c_find_tests("${TESTGEN_BMV2_P416_TESTS}" BMV2_P4_16_V1_TESTS INCLUDE "${V1_SEARCH_PATTERNS}" EXCLUDE "") diff --git a/testdata/p4_16_samples/dash/README.md b/testdata/p4_16_samples/dash/README.md new file mode 100644 index 00000000000..59c67b19ec5 --- /dev/null +++ b/testdata/p4_16_samples/dash/README.md @@ -0,0 +1,4 @@ +# DASH P4 Programs +The Disaggregated API for SONiC Hosts (DASH) defines a behavioral model for conformance testing of network devices. The P4 programs contained here model various network architecture scenarios related to the DASH project. + +They are sourced from https://github.com/sonic-net/DASH. For more information, please see https://github.com/sonic-net/DASH/blob/main/documentation/general/dash-high-level-design.md. diff --git a/testdata/p4_16_samples/dash/dash-pipeline.p4 b/testdata/p4_16_samples/dash/dash-pipeline.p4 new file mode 100644 index 00000000000..f853d4d234d --- /dev/null +++ b/testdata/p4_16_samples/dash/dash-pipeline.p4 @@ -0,0 +1,780 @@ +error { + IPv4IncorrectVersion, + IPv4OptionsNotSupported, + InvalidIPv4Header +} +#include +#define V1MODEL_VERSION 20180101 +#include + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +typedef bit<128> IPv6Address; +typedef bit<128> IPv4ORv6Address; +header ethernet_t { + EthernetAddress dst_addr; + EthernetAddress src_addr; + bit<16> ether_type; +} + +const bit<16> ETHER_HDR_SIZE = 112 / 8; +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> total_len; + bit<16> identification; + bit<3> flags; + bit<13> frag_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + IPv4Address src_addr; + IPv4Address dst_addr; +} + +const bit<16> IPV4_HDR_SIZE = 160 / 8; +header ipv4options_t { + varbit<320> options; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +const bit<16> UDP_HDR_SIZE = 64 / 8; +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved_2; +} + +const bit<16> VXLAN_HDR_SIZE = 64 / 8; +header tcp_t { + bit<16> src_port; + bit<16> dst_port; + bit<32> seq_no; + bit<32> ack_no; + bit<4> data_offset; + bit<3> res; + bit<3> ecn; + bit<6> flags; + bit<16> window; + bit<16> checksum; + bit<16> urgent_ptr; +} + +const bit<16> TCP_HDR_SIZE = 160 / 8; +header ipv6_t { + bit<4> version; + bit<8> traffic_class; + bit<20> flow_label; + bit<16> payload_length; + bit<8> next_header; + bit<8> hop_limit; + IPv6Address src_addr; + IPv6Address dst_addr; +} + +const bit<16> IPV6_HDR_SIZE = 320 / 8; +struct headers_t { + ethernet_t ethernet; + ipv4_t ipv4; + ipv4options_t ipv4options; + ipv6_t ipv6; + udp_t udp; + tcp_t tcp; + vxlan_t vxlan; + ethernet_t inner_ethernet; + ipv4_t inner_ipv4; + ipv6_t inner_ipv6; + udp_t inner_udp; + tcp_t inner_tcp; +} + +struct encap_data_t { + bit<24> vni; + bit<24> dest_vnet_vni; + IPv4Address underlay_sip; + IPv4Address underlay_dip; + EthernetAddress underlay_smac; + EthernetAddress underlay_dmac; + EthernetAddress overlay_dmac; +} + +enum bit<16> direction_t { + INVALID = 0, + OUTBOUND = 1, + INBOUND = 2 +} + +struct conntrack_data_t { + bool allow_in; + bool allow_out; +} + +struct eni_data_t { + bit<32> cps; + bit<32> pps; + bit<32> flows; + bit<1> admin_state; +} + +struct metadata_t { + bool dropped; + direction_t direction; + encap_data_t encap_data; + EthernetAddress eni_addr; + bit<16> vnet_id; + bit<16> dst_vnet_id; + bit<16> eni_id; + eni_data_t eni_data; + bit<16> inbound_vm_id; + bit<8> appliance_id; + bit<1> is_overlay_ip_v6; + bit<1> is_lkup_dst_ip_v6; + bit<8> ip_protocol; + IPv4ORv6Address dst_ip_addr; + IPv4ORv6Address src_ip_addr; + IPv4ORv6Address lkup_dst_ip_addr; + conntrack_data_t conntrack_data; + bit<16> src_l4_port; + bit<16> dst_l4_port; + bit<16> stage1_dash_acl_group_id; + bit<16> stage2_dash_acl_group_id; + bit<16> stage3_dash_acl_group_id; + bit<16> stage4_dash_acl_group_id; + bit<16> stage5_dash_acl_group_id; +} + +parser dash_parser(packet_in packet, out headers_t hd, inout metadata_t meta, inout standard_metadata_t standard_meta) { + state start { + packet.extract(hd.ethernet); + transition select(hd.ethernet.ether_type) { + 0x800: parse_ipv4; + 0x86dd: parse_ipv6; + default: accept; + } + } + state parse_ipv4 { + packet.extract(hd.ipv4); + verify(hd.ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.ipv4.ihl >= 5, error.InvalidIPv4Header); + transition select(hd.ipv4.ihl) { + 5: dispatch_on_protocol; + default: parse_ipv4options; + } + } + state parse_ipv4options { + packet.extract(hd.ipv4options, (bit<32>)(((bit<16>)hd.ipv4.ihl - 5) * 32)); + transition dispatch_on_protocol; + } + state dispatch_on_protocol { + transition select(hd.ipv4.protocol) { + 17: parse_udp; + 6: parse_tcp; + default: accept; + } + } + state parse_ipv6 { + packet.extract(hd.ipv6); + transition select(hd.ipv6.next_header) { + 17: parse_udp; + 6: parse_tcp; + default: accept; + } + } + state parse_udp { + packet.extract(hd.udp); + transition select(hd.udp.dst_port) { + 4789: parse_vxlan; + default: accept; + } + } + state parse_tcp { + packet.extract(hd.tcp); + transition accept; + } + state parse_vxlan { + packet.extract(hd.vxlan); + transition parse_inner_ethernet; + } + state parse_inner_ethernet { + packet.extract(hd.inner_ethernet); + transition select(hd.inner_ethernet.ether_type) { + 0x800: parse_inner_ipv4; + 0x86dd: parse_inner_ipv6; + default: accept; + } + } + state parse_inner_ipv4 { + packet.extract(hd.inner_ipv4); + verify(hd.inner_ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.inner_ipv4.ihl == 4w5, error.IPv4OptionsNotSupported); + transition select(hd.inner_ipv4.protocol) { + 17: parse_inner_udp; + 6: parse_inner_tcp; + default: accept; + } + } + state parse_inner_ipv6 { + packet.extract(hd.inner_ipv6); + transition select(hd.inner_ipv6.next_header) { + 17: parse_inner_udp; + 6: parse_inner_tcp; + default: accept; + } + } + state parse_inner_tcp { + packet.extract(hd.inner_tcp); + transition accept; + } + state parse_inner_udp { + packet.extract(hd.inner_udp); + transition accept; + } +} + +control dash_deparser(packet_out packet, in headers_t hdr) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + packet.emit(hdr.ipv4options); + packet.emit(hdr.ipv6); + packet.emit(hdr.udp); + packet.emit(hdr.tcp); + packet.emit(hdr.vxlan); + packet.emit(hdr.inner_ethernet); + packet.emit(hdr.inner_ipv4); + packet.emit(hdr.inner_ipv6); + packet.emit(hdr.inner_tcp); + packet.emit(hdr.inner_udp); + } +} + +action vxlan_encap(inout headers_t hdr, in EthernetAddress underlay_dmac, in EthernetAddress underlay_smac, in IPv4Address underlay_dip, in IPv4Address underlay_sip, in EthernetAddress overlay_dmac, in bit<24> vni) { + hdr.inner_ethernet = hdr.ethernet; + hdr.inner_ethernet.dst_addr = overlay_dmac; + hdr.ethernet.setInvalid(); + hdr.inner_ipv4 = hdr.ipv4; + hdr.ipv4.setInvalid(); + hdr.inner_ipv6 = hdr.ipv6; + hdr.ipv6.setInvalid(); + hdr.inner_tcp = hdr.tcp; + hdr.tcp.setInvalid(); + hdr.inner_udp = hdr.udp; + hdr.udp.setInvalid(); + hdr.ethernet.setValid(); + hdr.ethernet.dst_addr = underlay_dmac; + hdr.ethernet.src_addr = underlay_smac; + hdr.ethernet.ether_type = 0x800; + hdr.ipv4.setValid(); + hdr.ipv4.version = 4; + hdr.ipv4.ihl = 5; + hdr.ipv4.diffserv = 0; + hdr.ipv4.total_len = hdr.inner_ipv4.total_len * (bit<16>)(bit<1>)hdr.inner_ipv4.isValid() + hdr.inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + IPV6_HDR_SIZE * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + ETHER_HDR_SIZE + IPV4_HDR_SIZE + UDP_HDR_SIZE + VXLAN_HDR_SIZE; + hdr.ipv4.identification = 1; + hdr.ipv4.flags = 0; + hdr.ipv4.frag_offset = 0; + hdr.ipv4.ttl = 64; + hdr.ipv4.protocol = 17; + hdr.ipv4.dst_addr = underlay_dip; + hdr.ipv4.src_addr = underlay_sip; + hdr.ipv4.hdr_checksum = 0; + hdr.udp.setValid(); + hdr.udp.src_port = 0; + hdr.udp.dst_port = 4789; + hdr.udp.length = hdr.inner_ipv4.total_len * (bit<16>)(bit<1>)hdr.inner_ipv4.isValid() + hdr.inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + IPV6_HDR_SIZE * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + UDP_HDR_SIZE + VXLAN_HDR_SIZE + ETHER_HDR_SIZE; + hdr.udp.checksum = 0; + hdr.vxlan.setValid(); + hdr.vxlan.reserved = 0; + hdr.vxlan.reserved_2 = 0; + hdr.vxlan.flags = 0; + hdr.vxlan.vni = vni; +} +action vxlan_decap(inout headers_t hdr) { + hdr.ethernet = hdr.inner_ethernet; + hdr.inner_ethernet.setInvalid(); + hdr.ipv4 = hdr.inner_ipv4; + hdr.inner_ipv4.setInvalid(); + hdr.ipv6 = hdr.inner_ipv6; + hdr.inner_ipv6.setInvalid(); + hdr.vxlan.setInvalid(); + hdr.udp.setInvalid(); + hdr.tcp = hdr.inner_tcp; + hdr.inner_tcp.setInvalid(); + hdr.udp = hdr.inner_udp; + hdr.inner_udp.setInvalid(); +} +match_kind { + list, + range_list +} + +control acl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + action permit() { + } + action permit_and_continue() { + } + action deny() { + meta.dropped = true; + } + action deny_and_continue() { + meta.dropped = true; + } + direct_counter(CounterType.packets_and_bytes) stage1_counter; + @name("stage1:dash_acl_rule|dash_acl") table stage1 { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + permit; + permit_and_continue; + deny; + deny_and_continue; + } + default_action = deny; + counters = stage1_counter; + } + direct_counter(CounterType.packets_and_bytes) stage2_counter; + @name("stage2:dash_acl_rule|dash_acl") table stage2 { + key = { + meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + permit; + permit_and_continue; + deny; + deny_and_continue; + } + default_action = deny; + counters = stage2_counter; + } + direct_counter(CounterType.packets_and_bytes) stage3_counter; + @name("stage3:dash_acl_rule|dash_acl") table stage3 { + key = { + meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + permit; + permit_and_continue; + deny; + deny_and_continue; + } + default_action = deny; + counters = stage3_counter; + } + apply { + if (meta.stage1_dash_acl_group_id != 0) { + switch (stage1.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + } + } + if (meta.stage2_dash_acl_group_id != 0) { + switch (stage2.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + } + } + if (meta.stage3_dash_acl_group_id != 0) { + switch (stage3.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + } + } + } +} + +control outbound(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + action route_vnet(bit<16> dst_vnet_id) { + meta.dst_vnet_id = dst_vnet_id; + } + action route_vnet_direct(bit<16> dst_vnet_id, bit<1> is_overlay_ip_v4_or_v6, IPv4ORv6Address overlay_ip) { + meta.dst_vnet_id = dst_vnet_id; + meta.lkup_dst_ip_addr = overlay_ip; + meta.is_lkup_dst_ip_v6 = is_overlay_ip_v4_or_v6; + } + action route_direct() { + } + action drop() { + meta.dropped = true; + } + direct_counter(CounterType.packets_and_bytes) routing_counter; + @name("outbound_routing|dash_outbound_routing") table routing { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + meta.is_overlay_ip_v6: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); + meta.dst_ip_addr : lpm @name("meta.dst_ip_addr:destination"); + } + actions = { + route_vnet; + route_vnet_direct; + route_direct; + drop; + } + const default_action = drop; + counters = routing_counter; + } + action set_tunnel_mapping(IPv4Address underlay_dip, EthernetAddress overlay_dmac, bit<1> use_dst_vnet_vni) { + if (use_dst_vnet_vni == 1) { + meta.vnet_id = meta.dst_vnet_id; + } + meta.encap_data.overlay_dmac = overlay_dmac; + meta.encap_data.underlay_dip = underlay_dip; + } + direct_counter(CounterType.packets_and_bytes) ca_to_pa_counter; + @name("outbound_ca_to_pa|dash_outbound_ca_to_pa") table ca_to_pa { + key = { + meta.dst_vnet_id : exact @name("meta.dst_vnet_id:dst_vnet_id"); + meta.is_lkup_dst_ip_v6: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); + meta.lkup_dst_ip_addr : exact @name("meta.lkup_dst_ip_addr:dip"); + } + actions = { + set_tunnel_mapping; + @defaultonly drop; + } + const default_action = drop; + counters = ca_to_pa_counter; + } + action set_vnet_attrs(bit<24> vni) { + meta.encap_data.vni = vni; + } + @name("vnet|dash_vnet") table vnet { + key = { + meta.vnet_id: exact @name("meta.vnet_id:vnet_id"); + } + actions = { + set_vnet_attrs; + } + } + apply { + if (!meta.conntrack_data.allow_out) { + acl.apply(hdr, meta, standard_metadata); + } + meta.lkup_dst_ip_addr = meta.dst_ip_addr; + meta.is_lkup_dst_ip_v6 = meta.is_overlay_ip_v6; + switch (routing.apply().action_run) { + route_vnet_direct: + route_vnet: { + ca_to_pa.apply(); + vnet.apply(); + vxlan_encap(hdr, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.overlay_dmac, meta.encap_data.vni); + } + } + } +} + +action service_tunnel_encode(inout headers_t hdr, in IPv6Address st_dst_prefix, in IPv6Address st_src_prefix) { + hdr.ipv6.setValid(); + hdr.ipv6.version = 6; + hdr.ipv6.traffic_class = 0; + hdr.ipv6.flow_label = 0; + hdr.ipv6.payload_length = hdr.ipv4.total_len - IPV4_HDR_SIZE; + hdr.ipv6.next_header = hdr.ipv4.protocol; + hdr.ipv6.hop_limit = hdr.ipv4.ttl; + hdr.ipv6.dst_addr = (IPv6Address)hdr.ipv4.dst_addr + st_dst_prefix; + hdr.ipv6.src_addr = (IPv6Address)hdr.ipv4.src_addr + st_src_prefix; + hdr.ipv4.setInvalid(); + hdr.ethernet.ether_type = 0x86dd; +} +action service_tunnel_decode(inout headers_t hdr) { + hdr.ipv4.setValid(); + hdr.ipv4.version = 4; + hdr.ipv4.ihl = 5; + hdr.ipv4.diffserv = 0; + hdr.ipv4.total_len = hdr.ipv6.payload_length + IPV4_HDR_SIZE; + hdr.ipv4.identification = 1; + hdr.ipv4.flags = 0; + hdr.ipv4.frag_offset = 0; + hdr.ipv4.protocol = hdr.ipv6.next_header; + hdr.ipv4.ttl = hdr.ipv6.hop_limit; + hdr.ipv4.hdr_checksum = 0; + hdr.ipv6.setInvalid(); + hdr.ethernet.ether_type = 0x800; +} +control inbound(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + apply { + if (!meta.conntrack_data.allow_in) { + acl.apply(hdr, meta, standard_metadata); + } + vxlan_encap(hdr, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, hdr.ethernet.dst_addr, meta.encap_data.vni); + } +} + +control dash_verify_checksum(inout headers_t hdr, inout metadata_t meta) { + apply { + } +} + +control dash_compute_checksum(inout headers_t hdr, inout metadata_t meta) { + apply { + } +} + +control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + action drop_action() { + mark_to_drop(standard_metadata); + } + action deny() { + meta.dropped = true; + } + action accept() { + } + @name("vip|dash_vip") table vip { + key = { + hdr.ipv4.dst_addr: exact @name("hdr.ipv4.dst_addr:VIP"); + } + actions = { + accept; + @defaultonly deny; + } + const default_action = deny; + } + action set_outbound_direction() { + meta.direction = direction_t.OUTBOUND; + } + action set_inbound_direction() { + meta.direction = direction_t.INBOUND; + } + @name("direction_lookup|dash_direction_lookup") table direction_lookup { + key = { + hdr.vxlan.vni: exact @name("hdr.vxlan.vni:VNI"); + } + actions = { + set_outbound_direction; + @defaultonly set_inbound_direction; + } + const default_action = set_inbound_direction; + } + action set_appliance(EthernetAddress neighbor_mac, EthernetAddress mac) { + meta.encap_data.underlay_dmac = neighbor_mac; + meta.encap_data.underlay_smac = mac; + } + table appliance { + key = { + meta.appliance_id: ternary @name("meta.appliance_id:appliance_id"); + } + actions = { + set_appliance; + } + } + action set_eni_attrs(bit<32> cps, bit<32> pps, bit<32> flows, bit<1> admin_state, IPv4Address vm_underlay_dip, bit<24> vm_vni, bit<16> vnet_id, bit<16> inbound_v4_stage1_dash_acl_group_id, bit<16> inbound_v4_stage2_dash_acl_group_id, bit<16> inbound_v4_stage3_dash_acl_group_id, bit<16> inbound_v4_stage4_dash_acl_group_id, bit<16> inbound_v4_stage5_dash_acl_group_id, bit<16> inbound_v6_stage1_dash_acl_group_id, bit<16> inbound_v6_stage2_dash_acl_group_id, bit<16> inbound_v6_stage3_dash_acl_group_id, bit<16> inbound_v6_stage4_dash_acl_group_id, bit<16> inbound_v6_stage5_dash_acl_group_id, bit<16> outbound_v4_stage1_dash_acl_group_id, bit<16> outbound_v4_stage2_dash_acl_group_id, bit<16> outbound_v4_stage3_dash_acl_group_id, bit<16> outbound_v4_stage4_dash_acl_group_id, bit<16> outbound_v4_stage5_dash_acl_group_id, bit<16> outbound_v6_stage1_dash_acl_group_id, bit<16> outbound_v6_stage2_dash_acl_group_id, bit<16> outbound_v6_stage3_dash_acl_group_id, bit<16> outbound_v6_stage4_dash_acl_group_id, bit<16> outbound_v6_stage5_dash_acl_group_id) { + meta.eni_data.cps = cps; + meta.eni_data.pps = pps; + meta.eni_data.flows = flows; + meta.eni_data.admin_state = admin_state; + meta.encap_data.underlay_dip = vm_underlay_dip; + meta.encap_data.vni = vm_vni; + meta.vnet_id = vnet_id; + if (meta.is_overlay_ip_v6 == 1) { + if (meta.direction == direction_t.OUTBOUND) { + meta.stage1_dash_acl_group_id = outbound_v6_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = outbound_v6_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = outbound_v6_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = outbound_v6_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = outbound_v6_stage5_dash_acl_group_id; + ; + } else { + meta.stage1_dash_acl_group_id = inbound_v6_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = inbound_v6_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = inbound_v6_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = inbound_v6_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = inbound_v6_stage5_dash_acl_group_id; + ; + } + } else { + if (meta.direction == direction_t.OUTBOUND) { + meta.stage1_dash_acl_group_id = outbound_v4_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = outbound_v4_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = outbound_v4_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = outbound_v4_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = outbound_v4_stage5_dash_acl_group_id; + ; + } else { + meta.stage1_dash_acl_group_id = inbound_v4_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = inbound_v4_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = inbound_v4_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = inbound_v4_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = inbound_v4_stage5_dash_acl_group_id; + ; + } + } + } + @name("eni|dash_eni") table eni { + key = { + meta.eni_id: exact @name("meta.eni_id:eni_id"); + } + actions = { + set_eni_attrs; + @defaultonly deny; + } + const default_action = deny; + } + direct_counter(CounterType.packets_and_bytes) eni_counter; + table eni_meter { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + meta.direction: exact @name("meta.direction:direction"); + meta.dropped : exact @name("meta.dropped:dropped"); + } + actions = { + NoAction; + } + counters = eni_counter; + } + action permit() { + } + action vxlan_decap_pa_validate(bit<16> src_vnet_id) { + meta.vnet_id = src_vnet_id; + } + @name("pa_validation|dash_pa_validation") table pa_validation { + key = { + meta.vnet_id : exact @name("meta.vnet_id:vnet_id"); + hdr.ipv4.src_addr: exact @name("hdr.ipv4.src_addr:sip"); + } + actions = { + permit; + @defaultonly deny; + } + const default_action = deny; + } + @name("inbound_routing|dash_inbound_routing") table inbound_routing { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + hdr.vxlan.vni : exact @name("hdr.vxlan.vni:VNI"); + hdr.ipv4.src_addr: ternary @name("hdr.ipv4.src_addr:sip"); + } + actions = { + vxlan_decap(hdr); + vxlan_decap_pa_validate; + @defaultonly deny; + } + const default_action = deny; + } + action set_eni(bit<16> eni_id) { + meta.eni_id = eni_id; + } + @name("eni_ether_address_map|dash_eni") table eni_ether_address_map { + key = { + meta.eni_addr: exact @name("meta.eni_addr:address"); + } + actions = { + set_eni; + @defaultonly deny; + } + const default_action = deny; + } + action set_acl_group_attrs(bit<32> ip_addr_family) { + if (ip_addr_family == 0) { + if (meta.is_overlay_ip_v6 == 1) { + meta.dropped = true; + } + } else { + if (meta.is_overlay_ip_v6 == 0) { + meta.dropped = true; + } + } + } + @name("dash_acl_group|dash_acl") table acl_group { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.stage1_dash_acl_group_id:dash_acl_group_id"); + } + actions = { + set_acl_group_attrs(); + } + } + apply { + standard_metadata.egress_spec = standard_metadata.ingress_port; + if (vip.apply().hit) { + meta.encap_data.underlay_sip = hdr.ipv4.dst_addr; + } + direction_lookup.apply(); + appliance.apply(); + if (meta.direction == direction_t.OUTBOUND) { + vxlan_decap(hdr); + } else if (meta.direction == direction_t.INBOUND) { + switch (inbound_routing.apply().action_run) { + vxlan_decap_pa_validate: { + pa_validation.apply(); + vxlan_decap(hdr); + } + } + } + meta.is_overlay_ip_v6 = 0; + meta.ip_protocol = 0; + meta.dst_ip_addr = 0; + meta.src_ip_addr = 0; + if (hdr.ipv6.isValid()) { + meta.ip_protocol = hdr.ipv6.next_header; + meta.src_ip_addr = hdr.ipv6.src_addr; + meta.dst_ip_addr = hdr.ipv6.dst_addr; + meta.is_overlay_ip_v6 = 1; + } else if (hdr.ipv4.isValid()) { + meta.ip_protocol = hdr.ipv4.protocol; + meta.src_ip_addr = (bit<128>)hdr.ipv4.src_addr; + meta.dst_ip_addr = (bit<128>)hdr.ipv4.dst_addr; + } + if (hdr.tcp.isValid()) { + meta.src_l4_port = hdr.tcp.src_port; + meta.dst_l4_port = hdr.tcp.dst_port; + } else if (hdr.udp.isValid()) { + meta.src_l4_port = hdr.udp.src_port; + meta.dst_l4_port = hdr.udp.dst_port; + } + meta.eni_addr = (meta.direction == direction_t.OUTBOUND ? hdr.ethernet.src_addr : hdr.ethernet.dst_addr); + eni_ether_address_map.apply(); + eni.apply(); + if (meta.eni_data.admin_state == 0) { + deny(); + } + acl_group.apply(); + if (meta.direction == direction_t.OUTBOUND) { + outbound.apply(hdr, meta, standard_metadata); + } else if (meta.direction == direction_t.INBOUND) { + inbound.apply(hdr, meta, standard_metadata); + } + eni_meter.apply(); + if (meta.dropped) { + drop_action(); + } + } +} + +control dash_egress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + apply { + } +} + +V1Switch(dash_parser(), dash_verify_checksum(), dash_ingress(), dash_egress(), dash_compute_checksum(), dash_deparser()) main; diff --git a/testdata/p4_16_samples/omec/README.md b/testdata/p4_16_samples/omec/README.md index d41e64a339c..beab96012ec 100644 --- a/testdata/p4_16_samples/omec/README.md +++ b/testdata/p4_16_samples/omec/README.md @@ -1,3 +1,3 @@ # OMEC P4 Programs The P4 programs contained here model a virtual User Plane Function (UPF) pipeline as part of the SD-Fabric project. up4.p4 is a One-Big-UPF abstraction, a program that doesn't run on switches, but is used as the schema to define the content of the P4Runtime messages that can be exchanged with the UP4 app. -These P4 programs define . They are sourced from https://github.com/omec-project/up4. For more information, please see https://docs.sd-fabric.org/master/advanced/p4-upf.html. +They are sourced from https://github.com/omec-project/up4. For more information, please see https://docs.sd-fabric.org/master/advanced/p4-upf.html. From 706e1c796fae3b8d4d3ba372058960a3f35f3df1 Mon Sep 17 00:00:00 2001 From: fruffy Date: Mon, 13 Feb 2023 08:29:19 -0500 Subject: [PATCH 2/6] Reference files. --- .../dash/dash-pipeline-first.p4 | 797 ++++++++++ .../dash/dash-pipeline-frontend.p4 | 1029 +++++++++++++ .../dash/dash-pipeline-midend.p4 | 1339 +++++++++++++++++ .../dash/dash-pipeline.p4 | 780 ++++++++++ .../dash/dash-pipeline.p4-stderr | 0 .../dash/dash-pipeline.p4.entries.txt | 0 .../dash/dash-pipeline.p4.p4info.txt | 1194 +++++++++++++++ 7 files changed, 5139 insertions(+) create mode 100644 testdata/p4_16_samples_outputs/dash/dash-pipeline-first.p4 create mode 100644 testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 create mode 100644 testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 create mode 100644 testdata/p4_16_samples_outputs/dash/dash-pipeline.p4 create mode 100644 testdata/p4_16_samples_outputs/dash/dash-pipeline.p4-stderr create mode 100644 testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.entries.txt create mode 100644 testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.p4info.txt diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline-first.p4 b/testdata/p4_16_samples_outputs/dash/dash-pipeline-first.p4 new file mode 100644 index 00000000000..daa30e61ff8 --- /dev/null +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline-first.p4 @@ -0,0 +1,797 @@ +error { + IPv4IncorrectVersion, + IPv4OptionsNotSupported, + InvalidIPv4Header +} +#include +#define V1MODEL_VERSION 20180101 +#include + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +typedef bit<128> IPv6Address; +typedef bit<128> IPv4ORv6Address; +header ethernet_t { + EthernetAddress dst_addr; + EthernetAddress src_addr; + bit<16> ether_type; +} + +const bit<16> ETHER_HDR_SIZE = 16w14; +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> total_len; + bit<16> identification; + bit<3> flags; + bit<13> frag_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + IPv4Address src_addr; + IPv4Address dst_addr; +} + +const bit<16> IPV4_HDR_SIZE = 16w20; +header ipv4options_t { + varbit<320> options; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +const bit<16> UDP_HDR_SIZE = 16w8; +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved_2; +} + +const bit<16> VXLAN_HDR_SIZE = 16w8; +header tcp_t { + bit<16> src_port; + bit<16> dst_port; + bit<32> seq_no; + bit<32> ack_no; + bit<4> data_offset; + bit<3> res; + bit<3> ecn; + bit<6> flags; + bit<16> window; + bit<16> checksum; + bit<16> urgent_ptr; +} + +const bit<16> TCP_HDR_SIZE = 16w20; +header ipv6_t { + bit<4> version; + bit<8> traffic_class; + bit<20> flow_label; + bit<16> payload_length; + bit<8> next_header; + bit<8> hop_limit; + IPv6Address src_addr; + IPv6Address dst_addr; +} + +const bit<16> IPV6_HDR_SIZE = 16w40; +struct headers_t { + ethernet_t ethernet; + ipv4_t ipv4; + ipv4options_t ipv4options; + ipv6_t ipv6; + udp_t udp; + tcp_t tcp; + vxlan_t vxlan; + ethernet_t inner_ethernet; + ipv4_t inner_ipv4; + ipv6_t inner_ipv6; + udp_t inner_udp; + tcp_t inner_tcp; +} + +struct encap_data_t { + bit<24> vni; + bit<24> dest_vnet_vni; + IPv4Address underlay_sip; + IPv4Address underlay_dip; + EthernetAddress underlay_smac; + EthernetAddress underlay_dmac; + EthernetAddress overlay_dmac; +} + +enum bit<16> direction_t { + INVALID = 16w0, + OUTBOUND = 16w1, + INBOUND = 16w2 +} + +struct conntrack_data_t { + bool allow_in; + bool allow_out; +} + +struct eni_data_t { + bit<32> cps; + bit<32> pps; + bit<32> flows; + bit<1> admin_state; +} + +struct metadata_t { + bool dropped; + direction_t direction; + encap_data_t encap_data; + EthernetAddress eni_addr; + bit<16> vnet_id; + bit<16> dst_vnet_id; + bit<16> eni_id; + eni_data_t eni_data; + bit<16> inbound_vm_id; + bit<8> appliance_id; + bit<1> is_overlay_ip_v6; + bit<1> is_lkup_dst_ip_v6; + bit<8> ip_protocol; + IPv4ORv6Address dst_ip_addr; + IPv4ORv6Address src_ip_addr; + IPv4ORv6Address lkup_dst_ip_addr; + conntrack_data_t conntrack_data; + bit<16> src_l4_port; + bit<16> dst_l4_port; + bit<16> stage1_dash_acl_group_id; + bit<16> stage2_dash_acl_group_id; + bit<16> stage3_dash_acl_group_id; + bit<16> stage4_dash_acl_group_id; + bit<16> stage5_dash_acl_group_id; +} + +parser dash_parser(packet_in packet, out headers_t hd, inout metadata_t meta, inout standard_metadata_t standard_meta) { + state start { + packet.extract(hd.ethernet); + transition select(hd.ethernet.ether_type) { + 16w0x800: parse_ipv4; + 16w0x86dd: parse_ipv6; + default: accept; + } + } + state parse_ipv4 { + packet.extract(hd.ipv4); + verify(hd.ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.ipv4.ihl >= 4w5, error.InvalidIPv4Header); + transition select(hd.ipv4.ihl) { + 4w5: dispatch_on_protocol; + default: parse_ipv4options; + } + } + state parse_ipv4options { + packet.extract(hd.ipv4options, (bit<32>)((bit<16>)hd.ipv4.ihl + 16w65531 << 5)); + transition dispatch_on_protocol; + } + state dispatch_on_protocol { + transition select(hd.ipv4.protocol) { + 8w17: parse_udp; + 8w6: parse_tcp; + default: accept; + } + } + state parse_ipv6 { + packet.extract(hd.ipv6); + transition select(hd.ipv6.next_header) { + 8w17: parse_udp; + 8w6: parse_tcp; + default: accept; + } + } + state parse_udp { + packet.extract(hd.udp); + transition select(hd.udp.dst_port) { + 16w4789: parse_vxlan; + default: accept; + } + } + state parse_tcp { + packet.extract(hd.tcp); + transition accept; + } + state parse_vxlan { + packet.extract(hd.vxlan); + transition parse_inner_ethernet; + } + state parse_inner_ethernet { + packet.extract(hd.inner_ethernet); + transition select(hd.inner_ethernet.ether_type) { + 16w0x800: parse_inner_ipv4; + 16w0x86dd: parse_inner_ipv6; + default: accept; + } + } + state parse_inner_ipv4 { + packet.extract(hd.inner_ipv4); + verify(hd.inner_ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.inner_ipv4.ihl == 4w5, error.IPv4OptionsNotSupported); + transition select(hd.inner_ipv4.protocol) { + 8w17: parse_inner_udp; + 8w6: parse_inner_tcp; + default: accept; + } + } + state parse_inner_ipv6 { + packet.extract(hd.inner_ipv6); + transition select(hd.inner_ipv6.next_header) { + 8w17: parse_inner_udp; + 8w6: parse_inner_tcp; + default: accept; + } + } + state parse_inner_tcp { + packet.extract(hd.inner_tcp); + transition accept; + } + state parse_inner_udp { + packet.extract(hd.inner_udp); + transition accept; + } +} + +control dash_deparser(packet_out packet, in headers_t hdr) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + packet.emit(hdr.ipv4options); + packet.emit(hdr.ipv6); + packet.emit(hdr.udp); + packet.emit(hdr.tcp); + packet.emit(hdr.vxlan); + packet.emit(hdr.inner_ethernet); + packet.emit(hdr.inner_ipv4); + packet.emit(hdr.inner_ipv6); + packet.emit(hdr.inner_tcp); + packet.emit(hdr.inner_udp); + } +} + +action vxlan_encap(inout headers_t hdr, in EthernetAddress underlay_dmac, in EthernetAddress underlay_smac, in IPv4Address underlay_dip, in IPv4Address underlay_sip, in EthernetAddress overlay_dmac, in bit<24> vni) { + hdr.inner_ethernet = hdr.ethernet; + hdr.inner_ethernet.dst_addr = overlay_dmac; + hdr.ethernet.setInvalid(); + hdr.inner_ipv4 = hdr.ipv4; + hdr.ipv4.setInvalid(); + hdr.inner_ipv6 = hdr.ipv6; + hdr.ipv6.setInvalid(); + hdr.inner_tcp = hdr.tcp; + hdr.tcp.setInvalid(); + hdr.inner_udp = hdr.udp; + hdr.udp.setInvalid(); + hdr.ethernet.setValid(); + hdr.ethernet.dst_addr = underlay_dmac; + hdr.ethernet.src_addr = underlay_smac; + hdr.ethernet.ether_type = 16w0x800; + hdr.ipv4.setValid(); + hdr.ipv4.version = 4w4; + hdr.ipv4.ihl = 4w5; + hdr.ipv4.diffserv = 8w0; + hdr.ipv4.total_len = hdr.inner_ipv4.total_len * (bit<16>)(bit<1>)hdr.inner_ipv4.isValid() + hdr.inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + 16w40 * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + 16w50; + hdr.ipv4.identification = 16w1; + hdr.ipv4.flags = 3w0; + hdr.ipv4.frag_offset = 13w0; + hdr.ipv4.ttl = 8w64; + hdr.ipv4.protocol = 8w17; + hdr.ipv4.dst_addr = underlay_dip; + hdr.ipv4.src_addr = underlay_sip; + hdr.ipv4.hdr_checksum = 16w0; + hdr.udp.setValid(); + hdr.udp.src_port = 16w0; + hdr.udp.dst_port = 16w4789; + hdr.udp.length = hdr.inner_ipv4.total_len * (bit<16>)(bit<1>)hdr.inner_ipv4.isValid() + hdr.inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + 16w40 * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + 16w30; + hdr.udp.checksum = 16w0; + hdr.vxlan.setValid(); + hdr.vxlan.reserved = 24w0; + hdr.vxlan.reserved_2 = 8w0; + hdr.vxlan.flags = 8w0; + hdr.vxlan.vni = vni; +} +action vxlan_decap(inout headers_t hdr) { + hdr.ethernet = hdr.inner_ethernet; + hdr.inner_ethernet.setInvalid(); + hdr.ipv4 = hdr.inner_ipv4; + hdr.inner_ipv4.setInvalid(); + hdr.ipv6 = hdr.inner_ipv6; + hdr.inner_ipv6.setInvalid(); + hdr.vxlan.setInvalid(); + hdr.udp.setInvalid(); + hdr.tcp = hdr.inner_tcp; + hdr.inner_tcp.setInvalid(); + hdr.udp = hdr.inner_udp; + hdr.inner_udp.setInvalid(); +} +match_kind { + list, + range_list +} + +control acl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + action permit() { + } + action permit_and_continue() { + } + action deny() { + meta.dropped = true; + } + action deny_and_continue() { + meta.dropped = true; + } + direct_counter(CounterType.packets_and_bytes) stage1_counter; + @name("stage1:dash_acl_rule|dash_acl") table stage1 { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + permit(); + permit_and_continue(); + deny(); + deny_and_continue(); + } + default_action = deny(); + counters = stage1_counter; + } + direct_counter(CounterType.packets_and_bytes) stage2_counter; + @name("stage2:dash_acl_rule|dash_acl") table stage2 { + key = { + meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + permit(); + permit_and_continue(); + deny(); + deny_and_continue(); + } + default_action = deny(); + counters = stage2_counter; + } + direct_counter(CounterType.packets_and_bytes) stage3_counter; + @name("stage3:dash_acl_rule|dash_acl") table stage3 { + key = { + meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + permit(); + permit_and_continue(); + deny(); + deny_and_continue(); + } + default_action = deny(); + counters = stage3_counter; + } + apply { + if (meta.stage1_dash_acl_group_id != 16w0) { + switch (stage1.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + default: { + } + } + } + if (meta.stage2_dash_acl_group_id != 16w0) { + switch (stage2.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + default: { + } + } + } + if (meta.stage3_dash_acl_group_id != 16w0) { + switch (stage3.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + default: { + } + } + } + } +} + +control outbound(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + @name("acl") acl() acl_inst; + action route_vnet(bit<16> dst_vnet_id) { + meta.dst_vnet_id = dst_vnet_id; + } + action route_vnet_direct(bit<16> dst_vnet_id, bit<1> is_overlay_ip_v4_or_v6, IPv4ORv6Address overlay_ip) { + meta.dst_vnet_id = dst_vnet_id; + meta.lkup_dst_ip_addr = overlay_ip; + meta.is_lkup_dst_ip_v6 = is_overlay_ip_v4_or_v6; + } + action route_direct() { + } + action drop() { + meta.dropped = true; + } + direct_counter(CounterType.packets_and_bytes) routing_counter; + @name("outbound_routing|dash_outbound_routing") table routing { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + meta.is_overlay_ip_v6: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); + meta.dst_ip_addr : lpm @name("meta.dst_ip_addr:destination"); + } + actions = { + route_vnet(); + route_vnet_direct(); + route_direct(); + drop(); + } + const default_action = drop(); + counters = routing_counter; + } + action set_tunnel_mapping(IPv4Address underlay_dip, EthernetAddress overlay_dmac, bit<1> use_dst_vnet_vni) { + if (use_dst_vnet_vni == 1w1) { + meta.vnet_id = meta.dst_vnet_id; + } + meta.encap_data.overlay_dmac = overlay_dmac; + meta.encap_data.underlay_dip = underlay_dip; + } + direct_counter(CounterType.packets_and_bytes) ca_to_pa_counter; + @name("outbound_ca_to_pa|dash_outbound_ca_to_pa") table ca_to_pa { + key = { + meta.dst_vnet_id : exact @name("meta.dst_vnet_id:dst_vnet_id"); + meta.is_lkup_dst_ip_v6: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); + meta.lkup_dst_ip_addr : exact @name("meta.lkup_dst_ip_addr:dip"); + } + actions = { + set_tunnel_mapping(); + @defaultonly drop(); + } + const default_action = drop(); + counters = ca_to_pa_counter; + } + action set_vnet_attrs(bit<24> vni) { + meta.encap_data.vni = vni; + } + @name("vnet|dash_vnet") table vnet { + key = { + meta.vnet_id: exact @name("meta.vnet_id:vnet_id"); + } + actions = { + set_vnet_attrs(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + apply { + if (meta.conntrack_data.allow_out) { + ; + } else { + acl_inst.apply(hdr, meta, standard_metadata); + } + meta.lkup_dst_ip_addr = meta.dst_ip_addr; + meta.is_lkup_dst_ip_v6 = meta.is_overlay_ip_v6; + switch (routing.apply().action_run) { + route_vnet_direct: + route_vnet: { + ca_to_pa.apply(); + vnet.apply(); + vxlan_encap(hdr, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.overlay_dmac, meta.encap_data.vni); + } + default: { + } + } + } +} + +action service_tunnel_encode(inout headers_t hdr, in IPv6Address st_dst_prefix, in IPv6Address st_src_prefix) { + hdr.ipv6.setValid(); + hdr.ipv6.version = 4w6; + hdr.ipv6.traffic_class = 8w0; + hdr.ipv6.flow_label = 20w0; + hdr.ipv6.payload_length = hdr.ipv4.total_len + 16w65516; + hdr.ipv6.next_header = hdr.ipv4.protocol; + hdr.ipv6.hop_limit = hdr.ipv4.ttl; + hdr.ipv6.dst_addr = (IPv6Address)hdr.ipv4.dst_addr + st_dst_prefix; + hdr.ipv6.src_addr = (IPv6Address)hdr.ipv4.src_addr + st_src_prefix; + hdr.ipv4.setInvalid(); + hdr.ethernet.ether_type = 16w0x86dd; +} +action service_tunnel_decode(inout headers_t hdr) { + hdr.ipv4.setValid(); + hdr.ipv4.version = 4w4; + hdr.ipv4.ihl = 4w5; + hdr.ipv4.diffserv = 8w0; + hdr.ipv4.total_len = hdr.ipv6.payload_length + 16w20; + hdr.ipv4.identification = 16w1; + hdr.ipv4.flags = 3w0; + hdr.ipv4.frag_offset = 13w0; + hdr.ipv4.protocol = hdr.ipv6.next_header; + hdr.ipv4.ttl = hdr.ipv6.hop_limit; + hdr.ipv4.hdr_checksum = 16w0; + hdr.ipv6.setInvalid(); + hdr.ethernet.ether_type = 16w0x800; +} +control inbound(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + @name("acl") acl() acl_inst_0; + apply { + if (meta.conntrack_data.allow_in) { + ; + } else { + acl_inst_0.apply(hdr, meta, standard_metadata); + } + vxlan_encap(hdr, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, hdr.ethernet.dst_addr, meta.encap_data.vni); + } +} + +control dash_verify_checksum(inout headers_t hdr, inout metadata_t meta) { + apply { + } +} + +control dash_compute_checksum(inout headers_t hdr, inout metadata_t meta) { + apply { + } +} + +control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + @name("outbound") outbound() outbound_inst; + @name("inbound") inbound() inbound_inst; + action drop_action() { + mark_to_drop(standard_metadata); + } + action deny() { + meta.dropped = true; + } + action accept() { + } + @name("vip|dash_vip") table vip { + key = { + hdr.ipv4.dst_addr: exact @name("hdr.ipv4.dst_addr:VIP"); + } + actions = { + accept(); + @defaultonly deny(); + } + const default_action = deny(); + } + action set_outbound_direction() { + meta.direction = direction_t.OUTBOUND; + } + action set_inbound_direction() { + meta.direction = direction_t.INBOUND; + } + @name("direction_lookup|dash_direction_lookup") table direction_lookup { + key = { + hdr.vxlan.vni: exact @name("hdr.vxlan.vni:VNI"); + } + actions = { + set_outbound_direction(); + @defaultonly set_inbound_direction(); + } + const default_action = set_inbound_direction(); + } + action set_appliance(EthernetAddress neighbor_mac, EthernetAddress mac) { + meta.encap_data.underlay_dmac = neighbor_mac; + meta.encap_data.underlay_smac = mac; + } + table appliance { + key = { + meta.appliance_id: ternary @name("meta.appliance_id:appliance_id"); + } + actions = { + set_appliance(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + action set_eni_attrs(bit<32> cps, bit<32> pps, bit<32> flows, bit<1> admin_state, IPv4Address vm_underlay_dip, bit<24> vm_vni, bit<16> vnet_id, bit<16> inbound_v4_stage1_dash_acl_group_id, bit<16> inbound_v4_stage2_dash_acl_group_id, bit<16> inbound_v4_stage3_dash_acl_group_id, bit<16> inbound_v4_stage4_dash_acl_group_id, bit<16> inbound_v4_stage5_dash_acl_group_id, bit<16> inbound_v6_stage1_dash_acl_group_id, bit<16> inbound_v6_stage2_dash_acl_group_id, bit<16> inbound_v6_stage3_dash_acl_group_id, bit<16> inbound_v6_stage4_dash_acl_group_id, bit<16> inbound_v6_stage5_dash_acl_group_id, bit<16> outbound_v4_stage1_dash_acl_group_id, bit<16> outbound_v4_stage2_dash_acl_group_id, bit<16> outbound_v4_stage3_dash_acl_group_id, bit<16> outbound_v4_stage4_dash_acl_group_id, bit<16> outbound_v4_stage5_dash_acl_group_id, bit<16> outbound_v6_stage1_dash_acl_group_id, bit<16> outbound_v6_stage2_dash_acl_group_id, bit<16> outbound_v6_stage3_dash_acl_group_id, bit<16> outbound_v6_stage4_dash_acl_group_id, bit<16> outbound_v6_stage5_dash_acl_group_id) { + meta.eni_data.cps = cps; + meta.eni_data.pps = pps; + meta.eni_data.flows = flows; + meta.eni_data.admin_state = admin_state; + meta.encap_data.underlay_dip = vm_underlay_dip; + meta.encap_data.vni = vm_vni; + meta.vnet_id = vnet_id; + if (meta.is_overlay_ip_v6 == 1w1) { + if (meta.direction == direction_t.OUTBOUND) { + meta.stage1_dash_acl_group_id = outbound_v6_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = outbound_v6_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = outbound_v6_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = outbound_v6_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = outbound_v6_stage5_dash_acl_group_id; + } else { + meta.stage1_dash_acl_group_id = inbound_v6_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = inbound_v6_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = inbound_v6_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = inbound_v6_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = inbound_v6_stage5_dash_acl_group_id; + } + } else if (meta.direction == direction_t.OUTBOUND) { + meta.stage1_dash_acl_group_id = outbound_v4_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = outbound_v4_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = outbound_v4_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = outbound_v4_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = outbound_v4_stage5_dash_acl_group_id; + } else { + meta.stage1_dash_acl_group_id = inbound_v4_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = inbound_v4_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = inbound_v4_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = inbound_v4_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = inbound_v4_stage5_dash_acl_group_id; + } + } + @name("eni|dash_eni") table eni { + key = { + meta.eni_id: exact @name("meta.eni_id:eni_id"); + } + actions = { + set_eni_attrs(); + @defaultonly deny(); + } + const default_action = deny(); + } + direct_counter(CounterType.packets_and_bytes) eni_counter; + table eni_meter { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + meta.direction: exact @name("meta.direction:direction"); + meta.dropped : exact @name("meta.dropped:dropped"); + } + actions = { + NoAction(); + } + counters = eni_counter; + default_action = NoAction(); + } + action permit() { + } + action vxlan_decap_pa_validate(bit<16> src_vnet_id) { + meta.vnet_id = src_vnet_id; + } + @name("pa_validation|dash_pa_validation") table pa_validation { + key = { + meta.vnet_id : exact @name("meta.vnet_id:vnet_id"); + hdr.ipv4.src_addr: exact @name("hdr.ipv4.src_addr:sip"); + } + actions = { + permit(); + @defaultonly deny(); + } + const default_action = deny(); + } + @name("inbound_routing|dash_inbound_routing") table inbound_routing { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + hdr.vxlan.vni : exact @name("hdr.vxlan.vni:VNI"); + hdr.ipv4.src_addr: ternary @name("hdr.ipv4.src_addr:sip"); + } + actions = { + vxlan_decap(hdr); + vxlan_decap_pa_validate(); + @defaultonly deny(); + } + const default_action = deny(); + } + action set_eni(bit<16> eni_id) { + meta.eni_id = eni_id; + } + @name("eni_ether_address_map|dash_eni") table eni_ether_address_map { + key = { + meta.eni_addr: exact @name("meta.eni_addr:address"); + } + actions = { + set_eni(); + @defaultonly deny(); + } + const default_action = deny(); + } + action set_acl_group_attrs(bit<32> ip_addr_family) { + if (ip_addr_family == 32w0) { + if (meta.is_overlay_ip_v6 == 1w1) { + meta.dropped = true; + } + } else if (meta.is_overlay_ip_v6 == 1w0) { + meta.dropped = true; + } + } + @name("dash_acl_group|dash_acl") table acl_group { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.stage1_dash_acl_group_id:dash_acl_group_id"); + } + actions = { + set_acl_group_attrs(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + apply { + standard_metadata.egress_spec = standard_metadata.ingress_port; + if (vip.apply().hit) { + meta.encap_data.underlay_sip = hdr.ipv4.dst_addr; + } + direction_lookup.apply(); + appliance.apply(); + if (meta.direction == direction_t.OUTBOUND) { + vxlan_decap(hdr); + } else if (meta.direction == direction_t.INBOUND) { + switch (inbound_routing.apply().action_run) { + vxlan_decap_pa_validate: { + pa_validation.apply(); + vxlan_decap(hdr); + } + default: { + } + } + } + meta.is_overlay_ip_v6 = 1w0; + meta.ip_protocol = 8w0; + meta.dst_ip_addr = 128w0; + meta.src_ip_addr = 128w0; + if (hdr.ipv6.isValid()) { + meta.ip_protocol = hdr.ipv6.next_header; + meta.src_ip_addr = hdr.ipv6.src_addr; + meta.dst_ip_addr = hdr.ipv6.dst_addr; + meta.is_overlay_ip_v6 = 1w1; + } else if (hdr.ipv4.isValid()) { + meta.ip_protocol = hdr.ipv4.protocol; + meta.src_ip_addr = (bit<128>)hdr.ipv4.src_addr; + meta.dst_ip_addr = (bit<128>)hdr.ipv4.dst_addr; + } + if (hdr.tcp.isValid()) { + meta.src_l4_port = hdr.tcp.src_port; + meta.dst_l4_port = hdr.tcp.dst_port; + } else if (hdr.udp.isValid()) { + meta.src_l4_port = hdr.udp.src_port; + meta.dst_l4_port = hdr.udp.dst_port; + } + meta.eni_addr = (meta.direction == direction_t.OUTBOUND ? hdr.ethernet.src_addr : hdr.ethernet.dst_addr); + eni_ether_address_map.apply(); + eni.apply(); + if (meta.eni_data.admin_state == 1w0) { + deny(); + } + acl_group.apply(); + if (meta.direction == direction_t.OUTBOUND) { + outbound_inst.apply(hdr, meta, standard_metadata); + } else if (meta.direction == direction_t.INBOUND) { + inbound_inst.apply(hdr, meta, standard_metadata); + } + eni_meter.apply(); + if (meta.dropped) { + drop_action(); + } + } +} + +control dash_egress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + apply { + } +} + +V1Switch(dash_parser(), dash_verify_checksum(), dash_ingress(), dash_egress(), dash_compute_checksum(), dash_deparser()) main; diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 b/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 new file mode 100644 index 00000000000..77f6085af63 --- /dev/null +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 @@ -0,0 +1,1029 @@ +error { + IPv4IncorrectVersion, + IPv4OptionsNotSupported, + InvalidIPv4Header +} +#include +#define V1MODEL_VERSION 20180101 +#include + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +typedef bit<128> IPv6Address; +typedef bit<128> IPv4ORv6Address; +header ethernet_t { + EthernetAddress dst_addr; + EthernetAddress src_addr; + bit<16> ether_type; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> total_len; + bit<16> identification; + bit<3> flags; + bit<13> frag_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + IPv4Address src_addr; + IPv4Address dst_addr; +} + +header ipv4options_t { + varbit<320> options; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved_2; +} + +header tcp_t { + bit<16> src_port; + bit<16> dst_port; + bit<32> seq_no; + bit<32> ack_no; + bit<4> data_offset; + bit<3> res; + bit<3> ecn; + bit<6> flags; + bit<16> window; + bit<16> checksum; + bit<16> urgent_ptr; +} + +header ipv6_t { + bit<4> version; + bit<8> traffic_class; + bit<20> flow_label; + bit<16> payload_length; + bit<8> next_header; + bit<8> hop_limit; + IPv6Address src_addr; + IPv6Address dst_addr; +} + +struct headers_t { + ethernet_t ethernet; + ipv4_t ipv4; + ipv4options_t ipv4options; + ipv6_t ipv6; + udp_t udp; + tcp_t tcp; + vxlan_t vxlan; + ethernet_t inner_ethernet; + ipv4_t inner_ipv4; + ipv6_t inner_ipv6; + udp_t inner_udp; + tcp_t inner_tcp; +} + +struct encap_data_t { + bit<24> vni; + bit<24> dest_vnet_vni; + IPv4Address underlay_sip; + IPv4Address underlay_dip; + EthernetAddress underlay_smac; + EthernetAddress underlay_dmac; + EthernetAddress overlay_dmac; +} + +enum bit<16> direction_t { + INVALID = 16w0, + OUTBOUND = 16w1, + INBOUND = 16w2 +} + +struct conntrack_data_t { + bool allow_in; + bool allow_out; +} + +struct eni_data_t { + bit<32> cps; + bit<32> pps; + bit<32> flows; + bit<1> admin_state; +} + +struct metadata_t { + bool dropped; + direction_t direction; + encap_data_t encap_data; + EthernetAddress eni_addr; + bit<16> vnet_id; + bit<16> dst_vnet_id; + bit<16> eni_id; + eni_data_t eni_data; + bit<16> inbound_vm_id; + bit<8> appliance_id; + bit<1> is_overlay_ip_v6; + bit<1> is_lkup_dst_ip_v6; + bit<8> ip_protocol; + IPv4ORv6Address dst_ip_addr; + IPv4ORv6Address src_ip_addr; + IPv4ORv6Address lkup_dst_ip_addr; + conntrack_data_t conntrack_data; + bit<16> src_l4_port; + bit<16> dst_l4_port; + bit<16> stage1_dash_acl_group_id; + bit<16> stage2_dash_acl_group_id; + bit<16> stage3_dash_acl_group_id; + bit<16> stage4_dash_acl_group_id; + bit<16> stage5_dash_acl_group_id; +} + +parser dash_parser(packet_in packet, out headers_t hd, inout metadata_t meta, inout standard_metadata_t standard_meta) { + state start { + packet.extract(hd.ethernet); + transition select(hd.ethernet.ether_type) { + 16w0x800: parse_ipv4; + 16w0x86dd: parse_ipv6; + default: accept; + } + } + state parse_ipv4 { + packet.extract(hd.ipv4); + verify(hd.ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.ipv4.ihl >= 4w5, error.InvalidIPv4Header); + transition select(hd.ipv4.ihl) { + 4w5: dispatch_on_protocol; + default: parse_ipv4options; + } + } + state parse_ipv4options { + packet.extract(hd.ipv4options, (bit<32>)((bit<16>)hd.ipv4.ihl + 16w65531 << 5)); + transition dispatch_on_protocol; + } + state dispatch_on_protocol { + transition select(hd.ipv4.protocol) { + 8w17: parse_udp; + 8w6: parse_tcp; + default: accept; + } + } + state parse_ipv6 { + packet.extract(hd.ipv6); + transition select(hd.ipv6.next_header) { + 8w17: parse_udp; + 8w6: parse_tcp; + default: accept; + } + } + state parse_udp { + packet.extract(hd.udp); + transition select(hd.udp.dst_port) { + 16w4789: parse_vxlan; + default: accept; + } + } + state parse_tcp { + packet.extract(hd.tcp); + transition accept; + } + state parse_vxlan { + packet.extract(hd.vxlan); + packet.extract(hd.inner_ethernet); + transition select(hd.inner_ethernet.ether_type) { + 16w0x800: parse_inner_ipv4; + 16w0x86dd: parse_inner_ipv6; + default: accept; + } + } + state parse_inner_ipv4 { + packet.extract(hd.inner_ipv4); + verify(hd.inner_ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.inner_ipv4.ihl == 4w5, error.IPv4OptionsNotSupported); + transition select(hd.inner_ipv4.protocol) { + 8w17: parse_inner_udp; + 8w6: parse_inner_tcp; + default: accept; + } + } + state parse_inner_ipv6 { + packet.extract(hd.inner_ipv6); + transition select(hd.inner_ipv6.next_header) { + 8w17: parse_inner_udp; + 8w6: parse_inner_tcp; + default: accept; + } + } + state parse_inner_tcp { + packet.extract(hd.inner_tcp); + transition accept; + } + state parse_inner_udp { + packet.extract(hd.inner_udp); + transition accept; + } +} + +control dash_deparser(packet_out packet, in headers_t hdr) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + packet.emit(hdr.ipv4options); + packet.emit(hdr.ipv6); + packet.emit(hdr.udp); + packet.emit(hdr.tcp); + packet.emit(hdr.vxlan); + packet.emit(hdr.inner_ethernet); + packet.emit(hdr.inner_ipv4); + packet.emit(hdr.inner_ipv6); + packet.emit(hdr.inner_tcp); + packet.emit(hdr.inner_udp); + } +} + +match_kind { + list, + range_list +} + +control dash_verify_checksum(inout headers_t hdr, inout metadata_t meta) { + apply { + } +} + +control dash_compute_checksum(inout headers_t hdr, inout metadata_t meta) { + apply { + } +} + +control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + @name("dash_ingress.tmp_0") bit<48> tmp_0; + @name("dash_ingress.inbound.tmp") bit<48> inbound_tmp; + @name("dash_ingress.outbound.acl.hasReturned") bool outbound_acl_hasReturned; + @name("dash_ingress.inbound.acl.hasReturned") bool inbound_acl_hasReturned; + @name("dash_ingress.hdr") headers_t hdr_0; + @name("dash_ingress.hdr") headers_t hdr_1; + @name("dash_ingress.hdr") headers_t hdr_7; + @name("dash_ingress.hdr") headers_t hdr_8; + @name("dash_ingress.underlay_dmac") EthernetAddress underlay_dmac_0; + @name("dash_ingress.underlay_smac") EthernetAddress underlay_smac_0; + @name("dash_ingress.underlay_dip") IPv4Address underlay_dip_0; + @name("dash_ingress.underlay_sip") IPv4Address underlay_sip_0; + @name("dash_ingress.overlay_dmac") EthernetAddress overlay_dmac_0; + @name("dash_ingress.vni") bit<24> vni_0; + @name("dash_ingress.hdr") headers_t hdr_9; + @name("dash_ingress.underlay_dmac") EthernetAddress underlay_dmac_3; + @name("dash_ingress.underlay_smac") EthernetAddress underlay_smac_3; + @name("dash_ingress.underlay_dip") IPv4Address underlay_dip_1; + @name("dash_ingress.underlay_sip") IPv4Address underlay_sip_3; + @name("dash_ingress.overlay_dmac") EthernetAddress overlay_dmac_1; + @name("dash_ingress.vni") bit<24> vni_1; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @noWarn("unused") @name(".NoAction") action NoAction_2() { + } + @noWarn("unused") @name(".NoAction") action NoAction_3() { + } + @noWarn("unused") @name(".NoAction") action NoAction_4() { + } + @name(".vxlan_decap") action vxlan_decap_1() { + hdr_0 = hdr; + hdr_0.ethernet = hdr_0.inner_ethernet; + hdr_0.inner_ethernet.setInvalid(); + hdr_0.ipv4 = hdr_0.inner_ipv4; + hdr_0.inner_ipv4.setInvalid(); + hdr_0.ipv6 = hdr_0.inner_ipv6; + hdr_0.inner_ipv6.setInvalid(); + hdr_0.vxlan.setInvalid(); + hdr_0.udp.setInvalid(); + hdr_0.tcp = hdr_0.inner_tcp; + hdr_0.inner_tcp.setInvalid(); + hdr_0.udp = hdr_0.inner_udp; + hdr_0.inner_udp.setInvalid(); + hdr = hdr_0; + } + @name(".vxlan_decap") action vxlan_decap_2() { + hdr_1 = hdr; + hdr_1.ethernet = hdr_1.inner_ethernet; + hdr_1.inner_ethernet.setInvalid(); + hdr_1.ipv4 = hdr_1.inner_ipv4; + hdr_1.inner_ipv4.setInvalid(); + hdr_1.ipv6 = hdr_1.inner_ipv6; + hdr_1.inner_ipv6.setInvalid(); + hdr_1.vxlan.setInvalid(); + hdr_1.udp.setInvalid(); + hdr_1.tcp = hdr_1.inner_tcp; + hdr_1.inner_tcp.setInvalid(); + hdr_1.udp = hdr_1.inner_udp; + hdr_1.inner_udp.setInvalid(); + hdr = hdr_1; + } + @name(".vxlan_decap") action vxlan_decap_3() { + hdr_7 = hdr; + hdr_7.ethernet = hdr_7.inner_ethernet; + hdr_7.inner_ethernet.setInvalid(); + hdr_7.ipv4 = hdr_7.inner_ipv4; + hdr_7.inner_ipv4.setInvalid(); + hdr_7.ipv6 = hdr_7.inner_ipv6; + hdr_7.inner_ipv6.setInvalid(); + hdr_7.vxlan.setInvalid(); + hdr_7.udp.setInvalid(); + hdr_7.tcp = hdr_7.inner_tcp; + hdr_7.inner_tcp.setInvalid(); + hdr_7.udp = hdr_7.inner_udp; + hdr_7.inner_udp.setInvalid(); + hdr = hdr_7; + } + @name(".vxlan_encap") action vxlan_encap_1() { + hdr_8 = hdr; + underlay_dmac_0 = meta.encap_data.underlay_dmac; + underlay_smac_0 = meta.encap_data.underlay_smac; + underlay_dip_0 = meta.encap_data.underlay_dip; + underlay_sip_0 = meta.encap_data.underlay_sip; + overlay_dmac_0 = meta.encap_data.overlay_dmac; + vni_0 = meta.encap_data.vni; + hdr_8.inner_ethernet = hdr_8.ethernet; + hdr_8.inner_ethernet.dst_addr = overlay_dmac_0; + hdr_8.ethernet.setInvalid(); + hdr_8.inner_ipv4 = hdr_8.ipv4; + hdr_8.ipv4.setInvalid(); + hdr_8.inner_ipv6 = hdr_8.ipv6; + hdr_8.ipv6.setInvalid(); + hdr_8.inner_tcp = hdr_8.tcp; + hdr_8.tcp.setInvalid(); + hdr_8.inner_udp = hdr_8.udp; + hdr_8.udp.setInvalid(); + hdr_8.ethernet.setValid(); + hdr_8.ethernet.dst_addr = underlay_dmac_0; + hdr_8.ethernet.src_addr = underlay_smac_0; + hdr_8.ethernet.ether_type = 16w0x800; + hdr_8.ipv4.setValid(); + hdr_8.ipv4.version = 4w4; + hdr_8.ipv4.ihl = 4w5; + hdr_8.ipv4.diffserv = 8w0; + hdr_8.ipv4.total_len = hdr_8.inner_ipv4.total_len * (bit<16>)(bit<1>)hdr_8.inner_ipv4.isValid() + hdr_8.inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr_8.inner_ipv6.isValid() + 16w40 * (bit<16>)(bit<1>)hdr_8.inner_ipv6.isValid() + 16w50; + hdr_8.ipv4.identification = 16w1; + hdr_8.ipv4.flags = 3w0; + hdr_8.ipv4.frag_offset = 13w0; + hdr_8.ipv4.ttl = 8w64; + hdr_8.ipv4.protocol = 8w17; + hdr_8.ipv4.dst_addr = underlay_dip_0; + hdr_8.ipv4.src_addr = underlay_sip_0; + hdr_8.ipv4.hdr_checksum = 16w0; + hdr_8.udp.setValid(); + hdr_8.udp.src_port = 16w0; + hdr_8.udp.dst_port = 16w4789; + hdr_8.udp.length = hdr_8.inner_ipv4.total_len * (bit<16>)(bit<1>)hdr_8.inner_ipv4.isValid() + hdr_8.inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr_8.inner_ipv6.isValid() + 16w40 * (bit<16>)(bit<1>)hdr_8.inner_ipv6.isValid() + 16w30; + hdr_8.udp.checksum = 16w0; + hdr_8.vxlan.setValid(); + hdr_8.vxlan.reserved = 24w0; + hdr_8.vxlan.reserved_2 = 8w0; + hdr_8.vxlan.flags = 8w0; + hdr_8.vxlan.vni = vni_0; + hdr = hdr_8; + } + @name(".vxlan_encap") action vxlan_encap_2() { + hdr_9 = hdr; + underlay_dmac_3 = meta.encap_data.underlay_dmac; + underlay_smac_3 = meta.encap_data.underlay_smac; + underlay_dip_1 = meta.encap_data.underlay_dip; + underlay_sip_3 = meta.encap_data.underlay_sip; + overlay_dmac_1 = inbound_tmp; + vni_1 = meta.encap_data.vni; + hdr_9.inner_ethernet = hdr_9.ethernet; + hdr_9.inner_ethernet.dst_addr = overlay_dmac_1; + hdr_9.ethernet.setInvalid(); + hdr_9.inner_ipv4 = hdr_9.ipv4; + hdr_9.ipv4.setInvalid(); + hdr_9.inner_ipv6 = hdr_9.ipv6; + hdr_9.ipv6.setInvalid(); + hdr_9.inner_tcp = hdr_9.tcp; + hdr_9.tcp.setInvalid(); + hdr_9.inner_udp = hdr_9.udp; + hdr_9.udp.setInvalid(); + hdr_9.ethernet.setValid(); + hdr_9.ethernet.dst_addr = underlay_dmac_3; + hdr_9.ethernet.src_addr = underlay_smac_3; + hdr_9.ethernet.ether_type = 16w0x800; + hdr_9.ipv4.setValid(); + hdr_9.ipv4.version = 4w4; + hdr_9.ipv4.ihl = 4w5; + hdr_9.ipv4.diffserv = 8w0; + hdr_9.ipv4.total_len = hdr_9.inner_ipv4.total_len * (bit<16>)(bit<1>)hdr_9.inner_ipv4.isValid() + hdr_9.inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr_9.inner_ipv6.isValid() + 16w40 * (bit<16>)(bit<1>)hdr_9.inner_ipv6.isValid() + 16w50; + hdr_9.ipv4.identification = 16w1; + hdr_9.ipv4.flags = 3w0; + hdr_9.ipv4.frag_offset = 13w0; + hdr_9.ipv4.ttl = 8w64; + hdr_9.ipv4.protocol = 8w17; + hdr_9.ipv4.dst_addr = underlay_dip_1; + hdr_9.ipv4.src_addr = underlay_sip_3; + hdr_9.ipv4.hdr_checksum = 16w0; + hdr_9.udp.setValid(); + hdr_9.udp.src_port = 16w0; + hdr_9.udp.dst_port = 16w4789; + hdr_9.udp.length = hdr_9.inner_ipv4.total_len * (bit<16>)(bit<1>)hdr_9.inner_ipv4.isValid() + hdr_9.inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr_9.inner_ipv6.isValid() + 16w40 * (bit<16>)(bit<1>)hdr_9.inner_ipv6.isValid() + 16w30; + hdr_9.udp.checksum = 16w0; + hdr_9.vxlan.setValid(); + hdr_9.vxlan.reserved = 24w0; + hdr_9.vxlan.reserved_2 = 8w0; + hdr_9.vxlan.flags = 8w0; + hdr_9.vxlan.vni = vni_1; + hdr = hdr_9; + } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_0() { + } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_1() { + } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_2() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_0() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_1() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_2() { + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_0() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_1() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_2() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_0() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_1() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_2() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage1_counter; + @name("dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl") table outbound_acl_stage1:dash_acl_rule|dash_acl { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_0(); + outbound_acl_permit_and_continue_0(); + outbound_acl_deny_0(); + outbound_acl_deny_and_continue_0(); + } + default_action = outbound_acl_deny_0(); + counters = outbound_acl_stage1_counter; + } + @name("dash_ingress.outbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage2_counter; + @name("dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl") table outbound_acl_stage2:dash_acl_rule|dash_acl { + key = { + meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_1(); + outbound_acl_permit_and_continue_1(); + outbound_acl_deny_1(); + outbound_acl_deny_and_continue_1(); + } + default_action = outbound_acl_deny_1(); + counters = outbound_acl_stage2_counter; + } + @name("dash_ingress.outbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage3_counter; + @name("dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl") table outbound_acl_stage3:dash_acl_rule|dash_acl { + key = { + meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_2(); + outbound_acl_permit_and_continue_2(); + outbound_acl_deny_2(); + outbound_acl_deny_and_continue_2(); + } + default_action = outbound_acl_deny_2(); + counters = outbound_acl_stage3_counter; + } + @name("dash_ingress.outbound.route_vnet") action outbound_route_vnet_0(@name("dst_vnet_id") bit<16> dst_vnet_id_2) { + meta.dst_vnet_id = dst_vnet_id_2; + } + @name("dash_ingress.outbound.route_vnet_direct") action outbound_route_vnet_direct_0(@name("dst_vnet_id") bit<16> dst_vnet_id_3, @name("is_overlay_ip_v4_or_v6") bit<1> is_overlay_ip_v4_or_v6, @name("overlay_ip") IPv4ORv6Address overlay_ip) { + meta.dst_vnet_id = dst_vnet_id_3; + meta.lkup_dst_ip_addr = overlay_ip; + meta.is_lkup_dst_ip_v6 = is_overlay_ip_v4_or_v6; + } + @name("dash_ingress.outbound.route_direct") action outbound_route_direct_0() { + } + @name("dash_ingress.outbound.drop") action outbound_drop_0() { + meta.dropped = true; + } + @name("dash_ingress.outbound.drop") action outbound_drop_1() { + meta.dropped = true; + } + @name("dash_ingress.outbound.routing_counter") direct_counter(CounterType.packets_and_bytes) outbound_routing_counter; + @name("dash_ingress.outbound.outbound_routing|dash_outbound_routing") table outbound_outbound_routing|dash_outbound_routing { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + meta.is_overlay_ip_v6: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); + meta.dst_ip_addr : lpm @name("meta.dst_ip_addr:destination"); + } + actions = { + outbound_route_vnet_0(); + outbound_route_vnet_direct_0(); + outbound_route_direct_0(); + outbound_drop_0(); + } + const default_action = outbound_drop_0(); + counters = outbound_routing_counter; + } + @name("dash_ingress.outbound.set_tunnel_mapping") action outbound_set_tunnel_mapping_0(@name("underlay_dip") IPv4Address underlay_dip_4, @name("overlay_dmac") EthernetAddress overlay_dmac_4, @name("use_dst_vnet_vni") bit<1> use_dst_vnet_vni) { + if (use_dst_vnet_vni == 1w1) { + meta.vnet_id = meta.dst_vnet_id; + } + meta.encap_data.overlay_dmac = overlay_dmac_4; + meta.encap_data.underlay_dip = underlay_dip_4; + } + @name("dash_ingress.outbound.ca_to_pa_counter") direct_counter(CounterType.packets_and_bytes) outbound_ca_to_pa_counter; + @name("dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa") table outbound_outbound_ca_to_pa|dash_outbound_ca_to_pa { + key = { + meta.dst_vnet_id : exact @name("meta.dst_vnet_id:dst_vnet_id"); + meta.is_lkup_dst_ip_v6: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); + meta.lkup_dst_ip_addr : exact @name("meta.lkup_dst_ip_addr:dip"); + } + actions = { + outbound_set_tunnel_mapping_0(); + @defaultonly outbound_drop_1(); + } + const default_action = outbound_drop_1(); + counters = outbound_ca_to_pa_counter; + } + @name("dash_ingress.outbound.set_vnet_attrs") action outbound_set_vnet_attrs_0(@name("vni") bit<24> vni_4) { + meta.encap_data.vni = vni_4; + } + @name("dash_ingress.outbound.vnet|dash_vnet") table outbound_vnet|dash_vnet { + key = { + meta.vnet_id: exact @name("meta.vnet_id:vnet_id"); + } + actions = { + outbound_set_vnet_attrs_0(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_0() { + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_1() { + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_2() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_0() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_1() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_2() { + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_0() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_1() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_2() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_0() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_1() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_2() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage1_counter; + @name("dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl") table inbound_acl_stage1:dash_acl_rule|dash_acl { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_0(); + inbound_acl_permit_and_continue_0(); + inbound_acl_deny_0(); + inbound_acl_deny_and_continue_0(); + } + default_action = inbound_acl_deny_0(); + counters = inbound_acl_stage1_counter; + } + @name("dash_ingress.inbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage2_counter; + @name("dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl") table inbound_acl_stage2:dash_acl_rule|dash_acl { + key = { + meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_1(); + inbound_acl_permit_and_continue_1(); + inbound_acl_deny_1(); + inbound_acl_deny_and_continue_1(); + } + default_action = inbound_acl_deny_1(); + counters = inbound_acl_stage2_counter; + } + @name("dash_ingress.inbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage3_counter; + @name("dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl") table inbound_acl_stage3:dash_acl_rule|dash_acl { + key = { + meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_2(); + inbound_acl_permit_and_continue_2(); + inbound_acl_deny_2(); + inbound_acl_deny_and_continue_2(); + } + default_action = inbound_acl_deny_2(); + counters = inbound_acl_stage3_counter; + } + @name("dash_ingress.drop_action") action drop_action() { + mark_to_drop(standard_metadata); + } + @name("dash_ingress.deny") action deny() { + meta.dropped = true; + } + @name("dash_ingress.deny") action deny_0() { + meta.dropped = true; + } + @name("dash_ingress.deny") action deny_2() { + meta.dropped = true; + } + @name("dash_ingress.deny") action deny_3() { + meta.dropped = true; + } + @name("dash_ingress.deny") action deny_4() { + meta.dropped = true; + } + @name("dash_ingress.deny") action deny_5() { + meta.dropped = true; + } + @name("dash_ingress.accept") action accept_1() { + } + @name("dash_ingress.vip|dash_vip") table vip_0 { + key = { + hdr.ipv4.dst_addr: exact @name("hdr.ipv4.dst_addr:VIP"); + } + actions = { + accept_1(); + @defaultonly deny(); + } + const default_action = deny(); + } + @name("dash_ingress.set_outbound_direction") action set_outbound_direction() { + meta.direction = direction_t.OUTBOUND; + } + @name("dash_ingress.set_inbound_direction") action set_inbound_direction() { + meta.direction = direction_t.INBOUND; + } + @name("dash_ingress.direction_lookup|dash_direction_lookup") table direction_lookup_0 { + key = { + hdr.vxlan.vni: exact @name("hdr.vxlan.vni:VNI"); + } + actions = { + set_outbound_direction(); + @defaultonly set_inbound_direction(); + } + const default_action = set_inbound_direction(); + } + @name("dash_ingress.set_appliance") action set_appliance(@name("neighbor_mac") EthernetAddress neighbor_mac, @name("mac") EthernetAddress mac) { + meta.encap_data.underlay_dmac = neighbor_mac; + meta.encap_data.underlay_smac = mac; + } + @name("dash_ingress.appliance") table appliance_0 { + key = { + meta.appliance_id: ternary @name("meta.appliance_id:appliance_id"); + } + actions = { + set_appliance(); + @defaultonly NoAction_2(); + } + default_action = NoAction_2(); + } + @name("dash_ingress.set_eni_attrs") action set_eni_attrs(@name("cps") bit<32> cps_1, @name("pps") bit<32> pps_1, @name("flows") bit<32> flows_1, @name("admin_state") bit<1> admin_state_1, @name("vm_underlay_dip") IPv4Address vm_underlay_dip, @name("vm_vni") bit<24> vm_vni, @name("vnet_id") bit<16> vnet_id_1, @name("inbound_v4_stage1_dash_acl_group_id") bit<16> inbound_v4_stage1_dash_acl_group_id, @name("inbound_v4_stage2_dash_acl_group_id") bit<16> inbound_v4_stage2_dash_acl_group_id, @name("inbound_v4_stage3_dash_acl_group_id") bit<16> inbound_v4_stage3_dash_acl_group_id, @name("inbound_v4_stage4_dash_acl_group_id") bit<16> inbound_v4_stage4_dash_acl_group_id, @name("inbound_v4_stage5_dash_acl_group_id") bit<16> inbound_v4_stage5_dash_acl_group_id, @name("inbound_v6_stage1_dash_acl_group_id") bit<16> inbound_v6_stage1_dash_acl_group_id, @name("inbound_v6_stage2_dash_acl_group_id") bit<16> inbound_v6_stage2_dash_acl_group_id, @name("inbound_v6_stage3_dash_acl_group_id") bit<16> inbound_v6_stage3_dash_acl_group_id, @name("inbound_v6_stage4_dash_acl_group_id") bit<16> inbound_v6_stage4_dash_acl_group_id, @name("inbound_v6_stage5_dash_acl_group_id") bit<16> inbound_v6_stage5_dash_acl_group_id, @name("outbound_v4_stage1_dash_acl_group_id") bit<16> outbound_v4_stage1_dash_acl_group_id, @name("outbound_v4_stage2_dash_acl_group_id") bit<16> outbound_v4_stage2_dash_acl_group_id, @name("outbound_v4_stage3_dash_acl_group_id") bit<16> outbound_v4_stage3_dash_acl_group_id, @name("outbound_v4_stage4_dash_acl_group_id") bit<16> outbound_v4_stage4_dash_acl_group_id, @name("outbound_v4_stage5_dash_acl_group_id") bit<16> outbound_v4_stage5_dash_acl_group_id, @name("outbound_v6_stage1_dash_acl_group_id") bit<16> outbound_v6_stage1_dash_acl_group_id, @name("outbound_v6_stage2_dash_acl_group_id") bit<16> outbound_v6_stage2_dash_acl_group_id, @name("outbound_v6_stage3_dash_acl_group_id") bit<16> outbound_v6_stage3_dash_acl_group_id, @name("outbound_v6_stage4_dash_acl_group_id") bit<16> outbound_v6_stage4_dash_acl_group_id, @name("outbound_v6_stage5_dash_acl_group_id") bit<16> outbound_v6_stage5_dash_acl_group_id) { + meta.eni_data.cps = cps_1; + meta.eni_data.pps = pps_1; + meta.eni_data.flows = flows_1; + meta.eni_data.admin_state = admin_state_1; + meta.encap_data.underlay_dip = vm_underlay_dip; + meta.encap_data.vni = vm_vni; + meta.vnet_id = vnet_id_1; + if (meta.is_overlay_ip_v6 == 1w1) { + if (meta.direction == direction_t.OUTBOUND) { + meta.stage1_dash_acl_group_id = outbound_v6_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = outbound_v6_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = outbound_v6_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = outbound_v6_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = outbound_v6_stage5_dash_acl_group_id; + } else { + meta.stage1_dash_acl_group_id = inbound_v6_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = inbound_v6_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = inbound_v6_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = inbound_v6_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = inbound_v6_stage5_dash_acl_group_id; + } + } else if (meta.direction == direction_t.OUTBOUND) { + meta.stage1_dash_acl_group_id = outbound_v4_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = outbound_v4_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = outbound_v4_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = outbound_v4_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = outbound_v4_stage5_dash_acl_group_id; + } else { + meta.stage1_dash_acl_group_id = inbound_v4_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = inbound_v4_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = inbound_v4_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = inbound_v4_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = inbound_v4_stage5_dash_acl_group_id; + } + } + @name("dash_ingress.eni|dash_eni") table eni_0 { + key = { + meta.eni_id: exact @name("meta.eni_id:eni_id"); + } + actions = { + set_eni_attrs(); + @defaultonly deny_0(); + } + const default_action = deny_0(); + } + @name("dash_ingress.eni_counter") direct_counter(CounterType.packets_and_bytes) eni_counter_0; + @name("dash_ingress.eni_meter") table eni_meter_0 { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + meta.direction: exact @name("meta.direction:direction"); + meta.dropped : exact @name("meta.dropped:dropped"); + } + actions = { + NoAction_3(); + } + counters = eni_counter_0; + default_action = NoAction_3(); + } + @name("dash_ingress.permit") action permit() { + } + @name("dash_ingress.vxlan_decap_pa_validate") action vxlan_decap_pa_validate(@name("src_vnet_id") bit<16> src_vnet_id) { + meta.vnet_id = src_vnet_id; + } + @name("dash_ingress.pa_validation|dash_pa_validation") table pa_validation_0 { + key = { + meta.vnet_id : exact @name("meta.vnet_id:vnet_id"); + hdr.ipv4.src_addr: exact @name("hdr.ipv4.src_addr:sip"); + } + actions = { + permit(); + @defaultonly deny_2(); + } + const default_action = deny_2(); + } + @name("dash_ingress.inbound_routing|dash_inbound_routing") table inbound_routing_0 { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + hdr.vxlan.vni : exact @name("hdr.vxlan.vni:VNI"); + hdr.ipv4.src_addr: ternary @name("hdr.ipv4.src_addr:sip"); + } + actions = { + vxlan_decap_1(); + vxlan_decap_pa_validate(); + @defaultonly deny_3(); + } + const default_action = deny_3(); + } + @name("dash_ingress.set_eni") action set_eni(@name("eni_id") bit<16> eni_id_1) { + meta.eni_id = eni_id_1; + } + @name("dash_ingress.eni_ether_address_map|dash_eni") table eni_ether_address_map_0 { + key = { + meta.eni_addr: exact @name("meta.eni_addr:address"); + } + actions = { + set_eni(); + @defaultonly deny_4(); + } + const default_action = deny_4(); + } + @name("dash_ingress.set_acl_group_attrs") action set_acl_group_attrs(@name("ip_addr_family") bit<32> ip_addr_family) { + if (ip_addr_family == 32w0) { + if (meta.is_overlay_ip_v6 == 1w1) { + meta.dropped = true; + } + } else if (meta.is_overlay_ip_v6 == 1w0) { + meta.dropped = true; + } + } + @name("dash_ingress.dash_acl_group|dash_acl") table acl_group_0 { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.stage1_dash_acl_group_id:dash_acl_group_id"); + } + actions = { + set_acl_group_attrs(); + @defaultonly NoAction_4(); + } + default_action = NoAction_4(); + } + apply { + standard_metadata.egress_spec = standard_metadata.ingress_port; + if (vip_0.apply().hit) { + meta.encap_data.underlay_sip = hdr.ipv4.dst_addr; + } + direction_lookup_0.apply(); + appliance_0.apply(); + if (meta.direction == direction_t.OUTBOUND) { + vxlan_decap_2(); + } else if (meta.direction == direction_t.INBOUND) { + switch (inbound_routing_0.apply().action_run) { + vxlan_decap_pa_validate: { + pa_validation_0.apply(); + vxlan_decap_3(); + } + default: { + } + } + } + meta.is_overlay_ip_v6 = 1w0; + meta.ip_protocol = 8w0; + meta.dst_ip_addr = 128w0; + meta.src_ip_addr = 128w0; + if (hdr.ipv6.isValid()) { + meta.ip_protocol = hdr.ipv6.next_header; + meta.src_ip_addr = hdr.ipv6.src_addr; + meta.dst_ip_addr = hdr.ipv6.dst_addr; + meta.is_overlay_ip_v6 = 1w1; + } else if (hdr.ipv4.isValid()) { + meta.ip_protocol = hdr.ipv4.protocol; + meta.src_ip_addr = (bit<128>)hdr.ipv4.src_addr; + meta.dst_ip_addr = (bit<128>)hdr.ipv4.dst_addr; + } + if (hdr.tcp.isValid()) { + meta.src_l4_port = hdr.tcp.src_port; + meta.dst_l4_port = hdr.tcp.dst_port; + } else if (hdr.udp.isValid()) { + meta.src_l4_port = hdr.udp.src_port; + meta.dst_l4_port = hdr.udp.dst_port; + } + if (meta.direction == direction_t.OUTBOUND) { + tmp_0 = hdr.ethernet.src_addr; + } else { + tmp_0 = hdr.ethernet.dst_addr; + } + meta.eni_addr = tmp_0; + eni_ether_address_map_0.apply(); + eni_0.apply(); + if (meta.eni_data.admin_state == 1w0) { + deny_5(); + } + acl_group_0.apply(); + if (meta.direction == direction_t.OUTBOUND) { + if (meta.conntrack_data.allow_out) { + ; + } else { + outbound_acl_hasReturned = false; + if (meta.stage1_dash_acl_group_id != 16w0) { + switch (outbound_acl_stage1:dash_acl_rule|dash_acl.apply().action_run) { + outbound_acl_permit_0: { + outbound_acl_hasReturned = true; + } + outbound_acl_deny_0: { + outbound_acl_hasReturned = true; + } + default: { + } + } + } + if (outbound_acl_hasReturned) { + ; + } else if (meta.stage2_dash_acl_group_id != 16w0) { + switch (outbound_acl_stage2:dash_acl_rule|dash_acl.apply().action_run) { + outbound_acl_permit_1: { + outbound_acl_hasReturned = true; + } + outbound_acl_deny_1: { + outbound_acl_hasReturned = true; + } + default: { + } + } + } + if (outbound_acl_hasReturned) { + ; + } else if (meta.stage3_dash_acl_group_id != 16w0) { + switch (outbound_acl_stage3:dash_acl_rule|dash_acl.apply().action_run) { + outbound_acl_permit_2: { + } + outbound_acl_deny_2: { + } + default: { + } + } + } + } + meta.lkup_dst_ip_addr = meta.dst_ip_addr; + meta.is_lkup_dst_ip_v6 = meta.is_overlay_ip_v6; + switch (outbound_outbound_routing|dash_outbound_routing.apply().action_run) { + outbound_route_vnet_direct_0: + outbound_route_vnet_0: { + outbound_outbound_ca_to_pa|dash_outbound_ca_to_pa.apply(); + outbound_vnet|dash_vnet.apply(); + vxlan_encap_1(); + } + default: { + } + } + } else if (meta.direction == direction_t.INBOUND) { + if (meta.conntrack_data.allow_in) { + ; + } else { + inbound_acl_hasReturned = false; + if (meta.stage1_dash_acl_group_id != 16w0) { + switch (inbound_acl_stage1:dash_acl_rule|dash_acl.apply().action_run) { + inbound_acl_permit_0: { + inbound_acl_hasReturned = true; + } + inbound_acl_deny_0: { + inbound_acl_hasReturned = true; + } + default: { + } + } + } + if (inbound_acl_hasReturned) { + ; + } else if (meta.stage2_dash_acl_group_id != 16w0) { + switch (inbound_acl_stage2:dash_acl_rule|dash_acl.apply().action_run) { + inbound_acl_permit_1: { + inbound_acl_hasReturned = true; + } + inbound_acl_deny_1: { + inbound_acl_hasReturned = true; + } + default: { + } + } + } + if (inbound_acl_hasReturned) { + ; + } else if (meta.stage3_dash_acl_group_id != 16w0) { + switch (inbound_acl_stage3:dash_acl_rule|dash_acl.apply().action_run) { + inbound_acl_permit_2: { + } + inbound_acl_deny_2: { + } + default: { + } + } + } + } + inbound_tmp = hdr.ethernet.dst_addr; + vxlan_encap_2(); + } + eni_meter_0.apply(); + if (meta.dropped) { + drop_action(); + } + } +} + +control dash_egress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + apply { + } +} + +V1Switch(dash_parser(), dash_verify_checksum(), dash_ingress(), dash_egress(), dash_compute_checksum(), dash_deparser()) main; diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 b/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 new file mode 100644 index 00000000000..5c2d21e15b6 --- /dev/null +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 @@ -0,0 +1,1339 @@ +error { + IPv4IncorrectVersion, + IPv4OptionsNotSupported, + InvalidIPv4Header +} +#include +#define V1MODEL_VERSION 20180101 +#include + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> ether_type; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> total_len; + bit<16> identification; + bit<3> flags; + bit<13> frag_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + bit<32> src_addr; + bit<32> dst_addr; +} + +header ipv4options_t { + varbit<320> options; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved_2; +} + +header tcp_t { + bit<16> src_port; + bit<16> dst_port; + bit<32> seq_no; + bit<32> ack_no; + bit<4> data_offset; + bit<3> res; + bit<3> ecn; + bit<6> flags; + bit<16> window; + bit<16> checksum; + bit<16> urgent_ptr; +} + +header ipv6_t { + bit<4> version; + bit<8> traffic_class; + bit<20> flow_label; + bit<16> payload_length; + bit<8> next_header; + bit<8> hop_limit; + bit<128> src_addr; + bit<128> dst_addr; +} + +struct headers_t { + ethernet_t ethernet; + ipv4_t ipv4; + ipv4options_t ipv4options; + ipv6_t ipv6; + udp_t udp; + tcp_t tcp; + vxlan_t vxlan; + ethernet_t inner_ethernet; + ipv4_t inner_ipv4; + ipv6_t inner_ipv6; + udp_t inner_udp; + tcp_t inner_tcp; +} + +struct encap_data_t { + bit<24> vni; + bit<24> dest_vnet_vni; + bit<32> underlay_sip; + bit<32> underlay_dip; + bit<48> underlay_smac; + bit<48> underlay_dmac; + bit<48> overlay_dmac; +} + +struct conntrack_data_t { + bool allow_in; + bool allow_out; +} + +struct eni_data_t { + bit<32> cps; + bit<32> pps; + bit<32> flows; + bit<1> admin_state; +} + +struct metadata_t { + bool _dropped0; + bit<16> _direction1; + bit<24> _encap_data_vni2; + bit<24> _encap_data_dest_vnet_vni3; + bit<32> _encap_data_underlay_sip4; + bit<32> _encap_data_underlay_dip5; + bit<48> _encap_data_underlay_smac6; + bit<48> _encap_data_underlay_dmac7; + bit<48> _encap_data_overlay_dmac8; + bit<48> _eni_addr9; + bit<16> _vnet_id10; + bit<16> _dst_vnet_id11; + bit<16> _eni_id12; + bit<32> _eni_data_cps13; + bit<32> _eni_data_pps14; + bit<32> _eni_data_flows15; + bit<1> _eni_data_admin_state16; + bit<16> _inbound_vm_id17; + bit<8> _appliance_id18; + bit<1> _is_overlay_ip_v619; + bit<1> _is_lkup_dst_ip_v620; + bit<8> _ip_protocol21; + bit<128> _dst_ip_addr22; + bit<128> _src_ip_addr23; + bit<128> _lkup_dst_ip_addr24; + bool _conntrack_data_allow_in25; + bool _conntrack_data_allow_out26; + bit<16> _src_l4_port27; + bit<16> _dst_l4_port28; + bit<16> _stage1_dash_acl_group_id29; + bit<16> _stage2_dash_acl_group_id30; + bit<16> _stage3_dash_acl_group_id31; + bit<16> _stage4_dash_acl_group_id32; + bit<16> _stage5_dash_acl_group_id33; +} + +parser dash_parser(packet_in packet, out headers_t hd, inout metadata_t meta, inout standard_metadata_t standard_meta) { + state start { + packet.extract(hd.ethernet); + transition select(hd.ethernet.ether_type) { + 16w0x800: parse_ipv4; + 16w0x86dd: parse_ipv6; + default: accept; + } + } + state parse_ipv4 { + packet.extract(hd.ipv4); + verify(hd.ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.ipv4.ihl >= 4w5, error.InvalidIPv4Header); + transition select(hd.ipv4.ihl) { + 4w5: dispatch_on_protocol; + default: parse_ipv4options; + } + } + state parse_ipv4options { + packet.extract(hd.ipv4options, (bit<32>)((bit<16>)hd.ipv4.ihl + 16w65531 << 5)); + transition dispatch_on_protocol; + } + state dispatch_on_protocol { + transition select(hd.ipv4.protocol) { + 8w17: parse_udp; + 8w6: parse_tcp; + default: accept; + } + } + state parse_ipv6 { + packet.extract(hd.ipv6); + transition select(hd.ipv6.next_header) { + 8w17: parse_udp; + 8w6: parse_tcp; + default: accept; + } + } + state parse_udp { + packet.extract(hd.udp); + transition select(hd.udp.dst_port) { + 16w4789: parse_vxlan; + default: accept; + } + } + state parse_tcp { + packet.extract(hd.tcp); + transition accept; + } + state parse_vxlan { + packet.extract(hd.vxlan); + packet.extract(hd.inner_ethernet); + transition select(hd.inner_ethernet.ether_type) { + 16w0x800: parse_inner_ipv4; + 16w0x86dd: parse_inner_ipv6; + default: accept; + } + } + state parse_inner_ipv4 { + packet.extract(hd.inner_ipv4); + verify(hd.inner_ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.inner_ipv4.ihl == 4w5, error.IPv4OptionsNotSupported); + transition select(hd.inner_ipv4.protocol) { + 8w17: parse_inner_udp; + 8w6: parse_inner_tcp; + default: accept; + } + } + state parse_inner_ipv6 { + packet.extract(hd.inner_ipv6); + transition select(hd.inner_ipv6.next_header) { + 8w17: parse_inner_udp; + 8w6: parse_inner_tcp; + default: accept; + } + } + state parse_inner_tcp { + packet.extract(hd.inner_tcp); + transition accept; + } + state parse_inner_udp { + packet.extract(hd.inner_udp); + transition accept; + } +} + +control dash_deparser(packet_out packet, in headers_t hdr) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + packet.emit(hdr.ipv4options); + packet.emit(hdr.ipv6); + packet.emit(hdr.udp); + packet.emit(hdr.tcp); + packet.emit(hdr.vxlan); + packet.emit(hdr.inner_ethernet); + packet.emit(hdr.inner_ipv4); + packet.emit(hdr.inner_ipv6); + packet.emit(hdr.inner_tcp); + packet.emit(hdr.inner_udp); + } +} + +match_kind { + list, + range_list +} + +control dash_verify_checksum(inout headers_t hdr, inout metadata_t meta) { + apply { + } +} + +control dash_compute_checksum(inout headers_t hdr, inout metadata_t meta) { + apply { + } +} + +control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + @name("dash_ingress.tmp_0") bit<48> tmp_0; + @name("dash_ingress.inbound.tmp") bit<48> inbound_tmp; + @name("dash_ingress.outbound.acl.hasReturned") bool outbound_acl_hasReturned; + @name("dash_ingress.inbound.acl.hasReturned") bool inbound_acl_hasReturned; + udp_t hdr_0_udp; + vxlan_t hdr_0_vxlan; + ethernet_t hdr_0_inner_ethernet; + ipv4_t hdr_0_inner_ipv4; + ipv6_t hdr_0_inner_ipv6; + udp_t hdr_0_inner_udp; + tcp_t hdr_0_inner_tcp; + udp_t hdr_1_udp; + vxlan_t hdr_1_vxlan; + ethernet_t hdr_1_inner_ethernet; + ipv4_t hdr_1_inner_ipv4; + ipv6_t hdr_1_inner_ipv6; + udp_t hdr_1_inner_udp; + tcp_t hdr_1_inner_tcp; + udp_t hdr_7_udp; + vxlan_t hdr_7_vxlan; + ethernet_t hdr_7_inner_ethernet; + ipv4_t hdr_7_inner_ipv4; + ipv6_t hdr_7_inner_ipv6; + udp_t hdr_7_inner_udp; + tcp_t hdr_7_inner_tcp; + ethernet_t hdr_8_ethernet; + ipv4_t hdr_8_ipv4; + ipv6_t hdr_8_ipv6; + udp_t hdr_8_udp; + tcp_t hdr_8_tcp; + vxlan_t hdr_8_vxlan; + ethernet_t hdr_8_inner_ethernet; + ipv4_t hdr_8_inner_ipv4; + ipv6_t hdr_8_inner_ipv6; + udp_t hdr_8_inner_udp; + tcp_t hdr_8_inner_tcp; + ethernet_t hdr_9_ethernet; + ipv4_t hdr_9_ipv4; + ipv6_t hdr_9_ipv6; + udp_t hdr_9_udp; + tcp_t hdr_9_tcp; + vxlan_t hdr_9_vxlan; + ethernet_t hdr_9_inner_ethernet; + ipv4_t hdr_9_inner_ipv4; + ipv6_t hdr_9_inner_ipv6; + udp_t hdr_9_inner_udp; + tcp_t hdr_9_inner_tcp; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @noWarn("unused") @name(".NoAction") action NoAction_2() { + } + @noWarn("unused") @name(".NoAction") action NoAction_3() { + } + @noWarn("unused") @name(".NoAction") action NoAction_4() { + } + @name(".vxlan_decap") action vxlan_decap_1() { + hdr_0_udp = hdr.udp; + hdr_0_vxlan = hdr.vxlan; + hdr_0_inner_ethernet = hdr.inner_ethernet; + hdr_0_inner_ipv4 = hdr.inner_ipv4; + hdr_0_inner_ipv6 = hdr.inner_ipv6; + hdr_0_inner_udp = hdr.inner_udp; + hdr_0_inner_tcp = hdr.inner_tcp; + hdr_0_inner_ethernet.setInvalid(); + hdr_0_inner_ipv4.setInvalid(); + hdr_0_inner_ipv6.setInvalid(); + hdr_0_vxlan.setInvalid(); + hdr_0_udp.setInvalid(); + hdr_0_inner_tcp.setInvalid(); + hdr_0_udp = hdr.inner_udp; + hdr_0_inner_udp.setInvalid(); + hdr.ethernet = hdr.inner_ethernet; + hdr.ipv4 = hdr.inner_ipv4; + hdr.ipv6 = hdr.inner_ipv6; + hdr.udp = hdr.inner_udp; + hdr.tcp = hdr.inner_tcp; + hdr.vxlan = hdr_0_vxlan; + hdr.inner_ethernet = hdr_0_inner_ethernet; + hdr.inner_ipv4 = hdr_0_inner_ipv4; + hdr.inner_ipv6 = hdr_0_inner_ipv6; + hdr.inner_udp = hdr_0_inner_udp; + hdr.inner_tcp = hdr_0_inner_tcp; + } + @name(".vxlan_decap") action vxlan_decap_2() { + hdr_1_udp = hdr.udp; + hdr_1_vxlan = hdr.vxlan; + hdr_1_inner_ethernet = hdr.inner_ethernet; + hdr_1_inner_ipv4 = hdr.inner_ipv4; + hdr_1_inner_ipv6 = hdr.inner_ipv6; + hdr_1_inner_udp = hdr.inner_udp; + hdr_1_inner_tcp = hdr.inner_tcp; + hdr_1_inner_ethernet.setInvalid(); + hdr_1_inner_ipv4.setInvalid(); + hdr_1_inner_ipv6.setInvalid(); + hdr_1_vxlan.setInvalid(); + hdr_1_udp.setInvalid(); + hdr_1_inner_tcp.setInvalid(); + hdr_1_udp = hdr.inner_udp; + hdr_1_inner_udp.setInvalid(); + hdr.ethernet = hdr.inner_ethernet; + hdr.ipv4 = hdr.inner_ipv4; + hdr.ipv6 = hdr.inner_ipv6; + hdr.udp = hdr.inner_udp; + hdr.tcp = hdr.inner_tcp; + hdr.vxlan = hdr_1_vxlan; + hdr.inner_ethernet = hdr_1_inner_ethernet; + hdr.inner_ipv4 = hdr_1_inner_ipv4; + hdr.inner_ipv6 = hdr_1_inner_ipv6; + hdr.inner_udp = hdr_1_inner_udp; + hdr.inner_tcp = hdr_1_inner_tcp; + } + @name(".vxlan_decap") action vxlan_decap_3() { + hdr_7_udp = hdr.udp; + hdr_7_vxlan = hdr.vxlan; + hdr_7_inner_ethernet = hdr.inner_ethernet; + hdr_7_inner_ipv4 = hdr.inner_ipv4; + hdr_7_inner_ipv6 = hdr.inner_ipv6; + hdr_7_inner_udp = hdr.inner_udp; + hdr_7_inner_tcp = hdr.inner_tcp; + hdr_7_inner_ethernet.setInvalid(); + hdr_7_inner_ipv4.setInvalid(); + hdr_7_inner_ipv6.setInvalid(); + hdr_7_vxlan.setInvalid(); + hdr_7_udp.setInvalid(); + hdr_7_inner_tcp.setInvalid(); + hdr_7_udp = hdr.inner_udp; + hdr_7_inner_udp.setInvalid(); + hdr.ethernet = hdr.inner_ethernet; + hdr.ipv4 = hdr.inner_ipv4; + hdr.ipv6 = hdr.inner_ipv6; + hdr.udp = hdr.inner_udp; + hdr.tcp = hdr.inner_tcp; + hdr.vxlan = hdr_7_vxlan; + hdr.inner_ethernet = hdr_7_inner_ethernet; + hdr.inner_ipv4 = hdr_7_inner_ipv4; + hdr.inner_ipv6 = hdr_7_inner_ipv6; + hdr.inner_udp = hdr_7_inner_udp; + hdr.inner_tcp = hdr_7_inner_tcp; + } + @name(".vxlan_encap") action vxlan_encap_1() { + hdr_8_ethernet = hdr.ethernet; + hdr_8_ipv4 = hdr.ipv4; + hdr_8_ipv6 = hdr.ipv6; + hdr_8_udp = hdr.udp; + hdr_8_tcp = hdr.tcp; + hdr_8_vxlan = hdr.vxlan; + hdr_8_inner_ethernet = hdr.inner_ethernet; + hdr_8_inner_ipv4 = hdr.inner_ipv4; + hdr_8_inner_ipv6 = hdr.inner_ipv6; + hdr_8_inner_udp = hdr.inner_udp; + hdr_8_inner_tcp = hdr.inner_tcp; + hdr_8_inner_ethernet = hdr.ethernet; + hdr_8_inner_ethernet.dst_addr = meta._encap_data_overlay_dmac8; + hdr_8_ethernet.setInvalid(); + hdr_8_inner_ipv4 = hdr.ipv4; + hdr_8_ipv4.setInvalid(); + hdr_8_inner_ipv6 = hdr.ipv6; + hdr_8_ipv6.setInvalid(); + hdr_8_inner_tcp = hdr.tcp; + hdr_8_tcp.setInvalid(); + hdr_8_inner_udp = hdr.udp; + hdr_8_udp.setInvalid(); + hdr_8_ethernet.setValid(); + hdr_8_ethernet.dst_addr = meta._encap_data_underlay_dmac7; + hdr_8_ethernet.src_addr = meta._encap_data_underlay_smac6; + hdr_8_ethernet.ether_type = 16w0x800; + hdr_8_ipv4.setValid(); + hdr_8_ipv4.version = 4w4; + hdr_8_ipv4.ihl = 4w5; + hdr_8_ipv4.diffserv = 8w0; + hdr_8_ipv4.total_len = hdr_8_inner_ipv4.total_len * (bit<16>)(bit<1>)hdr_8_inner_ipv4.isValid() + hdr_8_inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr_8_inner_ipv6.isValid() + 16w40 * (bit<16>)(bit<1>)hdr_8_inner_ipv6.isValid() + 16w50; + hdr_8_ipv4.identification = 16w1; + hdr_8_ipv4.flags = 3w0; + hdr_8_ipv4.frag_offset = 13w0; + hdr_8_ipv4.ttl = 8w64; + hdr_8_ipv4.protocol = 8w17; + hdr_8_ipv4.dst_addr = meta._encap_data_underlay_dip5; + hdr_8_ipv4.src_addr = meta._encap_data_underlay_sip4; + hdr_8_ipv4.hdr_checksum = 16w0; + hdr_8_udp.setValid(); + hdr_8_udp.src_port = 16w0; + hdr_8_udp.dst_port = 16w4789; + hdr_8_udp.length = hdr_8_inner_ipv4.total_len * (bit<16>)(bit<1>)hdr_8_inner_ipv4.isValid() + hdr_8_inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr_8_inner_ipv6.isValid() + 16w40 * (bit<16>)(bit<1>)hdr_8_inner_ipv6.isValid() + 16w30; + hdr_8_udp.checksum = 16w0; + hdr_8_vxlan.setValid(); + hdr_8_vxlan.reserved = 24w0; + hdr_8_vxlan.reserved_2 = 8w0; + hdr_8_vxlan.flags = 8w0; + hdr_8_vxlan.vni = meta._encap_data_vni2; + hdr.ethernet = hdr_8_ethernet; + hdr.ipv4 = hdr_8_ipv4; + hdr.ipv6 = hdr_8_ipv6; + hdr.udp = hdr_8_udp; + hdr.tcp = hdr_8_tcp; + hdr.vxlan = hdr_8_vxlan; + hdr.inner_ethernet = hdr_8_inner_ethernet; + hdr.inner_ipv4 = hdr_8_inner_ipv4; + hdr.inner_ipv6 = hdr_8_inner_ipv6; + hdr.inner_udp = hdr_8_inner_udp; + hdr.inner_tcp = hdr_8_inner_tcp; + } + @name(".vxlan_encap") action vxlan_encap_2() { + hdr_9_ethernet = hdr.ethernet; + hdr_9_ipv4 = hdr.ipv4; + hdr_9_ipv6 = hdr.ipv6; + hdr_9_udp = hdr.udp; + hdr_9_tcp = hdr.tcp; + hdr_9_vxlan = hdr.vxlan; + hdr_9_inner_ethernet = hdr.inner_ethernet; + hdr_9_inner_ipv4 = hdr.inner_ipv4; + hdr_9_inner_ipv6 = hdr.inner_ipv6; + hdr_9_inner_udp = hdr.inner_udp; + hdr_9_inner_tcp = hdr.inner_tcp; + hdr_9_inner_ethernet = hdr.ethernet; + hdr_9_inner_ethernet.dst_addr = inbound_tmp; + hdr_9_ethernet.setInvalid(); + hdr_9_inner_ipv4 = hdr.ipv4; + hdr_9_ipv4.setInvalid(); + hdr_9_inner_ipv6 = hdr.ipv6; + hdr_9_ipv6.setInvalid(); + hdr_9_inner_tcp = hdr.tcp; + hdr_9_tcp.setInvalid(); + hdr_9_inner_udp = hdr.udp; + hdr_9_udp.setInvalid(); + hdr_9_ethernet.setValid(); + hdr_9_ethernet.dst_addr = meta._encap_data_underlay_dmac7; + hdr_9_ethernet.src_addr = meta._encap_data_underlay_smac6; + hdr_9_ethernet.ether_type = 16w0x800; + hdr_9_ipv4.setValid(); + hdr_9_ipv4.version = 4w4; + hdr_9_ipv4.ihl = 4w5; + hdr_9_ipv4.diffserv = 8w0; + hdr_9_ipv4.total_len = hdr_9_inner_ipv4.total_len * (bit<16>)(bit<1>)hdr_9_inner_ipv4.isValid() + hdr_9_inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr_9_inner_ipv6.isValid() + 16w40 * (bit<16>)(bit<1>)hdr_9_inner_ipv6.isValid() + 16w50; + hdr_9_ipv4.identification = 16w1; + hdr_9_ipv4.flags = 3w0; + hdr_9_ipv4.frag_offset = 13w0; + hdr_9_ipv4.ttl = 8w64; + hdr_9_ipv4.protocol = 8w17; + hdr_9_ipv4.dst_addr = meta._encap_data_underlay_dip5; + hdr_9_ipv4.src_addr = meta._encap_data_underlay_sip4; + hdr_9_ipv4.hdr_checksum = 16w0; + hdr_9_udp.setValid(); + hdr_9_udp.src_port = 16w0; + hdr_9_udp.dst_port = 16w4789; + hdr_9_udp.length = hdr_9_inner_ipv4.total_len * (bit<16>)(bit<1>)hdr_9_inner_ipv4.isValid() + hdr_9_inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr_9_inner_ipv6.isValid() + 16w40 * (bit<16>)(bit<1>)hdr_9_inner_ipv6.isValid() + 16w30; + hdr_9_udp.checksum = 16w0; + hdr_9_vxlan.setValid(); + hdr_9_vxlan.reserved = 24w0; + hdr_9_vxlan.reserved_2 = 8w0; + hdr_9_vxlan.flags = 8w0; + hdr_9_vxlan.vni = meta._encap_data_vni2; + hdr.ethernet = hdr_9_ethernet; + hdr.ipv4 = hdr_9_ipv4; + hdr.ipv6 = hdr_9_ipv6; + hdr.udp = hdr_9_udp; + hdr.tcp = hdr_9_tcp; + hdr.vxlan = hdr_9_vxlan; + hdr.inner_ethernet = hdr_9_inner_ethernet; + hdr.inner_ipv4 = hdr_9_inner_ipv4; + hdr.inner_ipv6 = hdr_9_inner_ipv6; + hdr.inner_udp = hdr_9_inner_udp; + hdr.inner_tcp = hdr_9_inner_tcp; + } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_0() { + } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_1() { + } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_2() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_0() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_1() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_2() { + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_0() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_1() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_2() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_0() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_1() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_2() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage1_counter; + @name("dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl") table outbound_acl_stage1:dash_acl_rule|dash_acl { + key = { + meta._stage1_dash_acl_group_id29: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_0(); + outbound_acl_permit_and_continue_0(); + outbound_acl_deny_0(); + outbound_acl_deny_and_continue_0(); + } + default_action = outbound_acl_deny_0(); + counters = outbound_acl_stage1_counter; + } + @name("dash_ingress.outbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage2_counter; + @name("dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl") table outbound_acl_stage2:dash_acl_rule|dash_acl { + key = { + meta._stage2_dash_acl_group_id30: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_1(); + outbound_acl_permit_and_continue_1(); + outbound_acl_deny_1(); + outbound_acl_deny_and_continue_1(); + } + default_action = outbound_acl_deny_1(); + counters = outbound_acl_stage2_counter; + } + @name("dash_ingress.outbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage3_counter; + @name("dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl") table outbound_acl_stage3:dash_acl_rule|dash_acl { + key = { + meta._stage3_dash_acl_group_id31: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_2(); + outbound_acl_permit_and_continue_2(); + outbound_acl_deny_2(); + outbound_acl_deny_and_continue_2(); + } + default_action = outbound_acl_deny_2(); + counters = outbound_acl_stage3_counter; + } + @name("dash_ingress.outbound.route_vnet") action outbound_route_vnet_0(@name("dst_vnet_id") bit<16> dst_vnet_id_2) { + meta._dst_vnet_id11 = dst_vnet_id_2; + } + @name("dash_ingress.outbound.route_vnet_direct") action outbound_route_vnet_direct_0(@name("dst_vnet_id") bit<16> dst_vnet_id_3, @name("is_overlay_ip_v4_or_v6") bit<1> is_overlay_ip_v4_or_v6, @name("overlay_ip") bit<128> overlay_ip) { + meta._dst_vnet_id11 = dst_vnet_id_3; + meta._lkup_dst_ip_addr24 = overlay_ip; + meta._is_lkup_dst_ip_v620 = is_overlay_ip_v4_or_v6; + } + @name("dash_ingress.outbound.route_direct") action outbound_route_direct_0() { + } + @name("dash_ingress.outbound.drop") action outbound_drop_0() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.drop") action outbound_drop_1() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.routing_counter") direct_counter(CounterType.packets_and_bytes) outbound_routing_counter; + @name("dash_ingress.outbound.outbound_routing|dash_outbound_routing") table outbound_outbound_routing|dash_outbound_routing { + key = { + meta._eni_id12 : exact @name("meta.eni_id:eni_id"); + meta._is_overlay_ip_v619: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); + meta._dst_ip_addr22 : lpm @name("meta.dst_ip_addr:destination"); + } + actions = { + outbound_route_vnet_0(); + outbound_route_vnet_direct_0(); + outbound_route_direct_0(); + outbound_drop_0(); + } + const default_action = outbound_drop_0(); + counters = outbound_routing_counter; + } + @name("dash_ingress.outbound.set_tunnel_mapping") action outbound_set_tunnel_mapping_0(@name("underlay_dip") bit<32> underlay_dip_4, @name("overlay_dmac") bit<48> overlay_dmac_4, @name("use_dst_vnet_vni") bit<1> use_dst_vnet_vni) { + meta._vnet_id10 = (use_dst_vnet_vni == 1w1 ? meta._dst_vnet_id11 : meta._vnet_id10); + meta._encap_data_overlay_dmac8 = overlay_dmac_4; + meta._encap_data_underlay_dip5 = underlay_dip_4; + } + @name("dash_ingress.outbound.ca_to_pa_counter") direct_counter(CounterType.packets_and_bytes) outbound_ca_to_pa_counter; + @name("dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa") table outbound_outbound_ca_to_pa|dash_outbound_ca_to_pa { + key = { + meta._dst_vnet_id11 : exact @name("meta.dst_vnet_id:dst_vnet_id"); + meta._is_lkup_dst_ip_v620: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); + meta._lkup_dst_ip_addr24 : exact @name("meta.lkup_dst_ip_addr:dip"); + } + actions = { + outbound_set_tunnel_mapping_0(); + @defaultonly outbound_drop_1(); + } + const default_action = outbound_drop_1(); + counters = outbound_ca_to_pa_counter; + } + @name("dash_ingress.outbound.set_vnet_attrs") action outbound_set_vnet_attrs_0(@name("vni") bit<24> vni_4) { + meta._encap_data_vni2 = vni_4; + } + @name("dash_ingress.outbound.vnet|dash_vnet") table outbound_vnet|dash_vnet { + key = { + meta._vnet_id10: exact @name("meta.vnet_id:vnet_id"); + } + actions = { + outbound_set_vnet_attrs_0(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_0() { + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_1() { + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_2() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_0() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_1() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_2() { + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_0() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_1() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_2() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_0() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_1() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_2() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage1_counter; + @name("dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl") table inbound_acl_stage1:dash_acl_rule|dash_acl { + key = { + meta._stage1_dash_acl_group_id29: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_0(); + inbound_acl_permit_and_continue_0(); + inbound_acl_deny_0(); + inbound_acl_deny_and_continue_0(); + } + default_action = inbound_acl_deny_0(); + counters = inbound_acl_stage1_counter; + } + @name("dash_ingress.inbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage2_counter; + @name("dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl") table inbound_acl_stage2:dash_acl_rule|dash_acl { + key = { + meta._stage2_dash_acl_group_id30: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_1(); + inbound_acl_permit_and_continue_1(); + inbound_acl_deny_1(); + inbound_acl_deny_and_continue_1(); + } + default_action = inbound_acl_deny_1(); + counters = inbound_acl_stage2_counter; + } + @name("dash_ingress.inbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage3_counter; + @name("dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl") table inbound_acl_stage3:dash_acl_rule|dash_acl { + key = { + meta._stage3_dash_acl_group_id31: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_2(); + inbound_acl_permit_and_continue_2(); + inbound_acl_deny_2(); + inbound_acl_deny_and_continue_2(); + } + default_action = inbound_acl_deny_2(); + counters = inbound_acl_stage3_counter; + } + @name("dash_ingress.drop_action") action drop_action() { + mark_to_drop(standard_metadata); + } + @name("dash_ingress.deny") action deny() { + meta._dropped0 = true; + } + @name("dash_ingress.deny") action deny_0() { + meta._dropped0 = true; + } + @name("dash_ingress.deny") action deny_2() { + meta._dropped0 = true; + } + @name("dash_ingress.deny") action deny_3() { + meta._dropped0 = true; + } + @name("dash_ingress.deny") action deny_4() { + meta._dropped0 = true; + } + @name("dash_ingress.deny") action deny_5() { + meta._dropped0 = true; + } + @name("dash_ingress.accept") action accept_1() { + } + @name("dash_ingress.vip|dash_vip") table vip_0 { + key = { + hdr.ipv4.dst_addr: exact @name("hdr.ipv4.dst_addr:VIP"); + } + actions = { + accept_1(); + @defaultonly deny(); + } + const default_action = deny(); + } + @name("dash_ingress.set_outbound_direction") action set_outbound_direction() { + meta._direction1 = 16w1; + } + @name("dash_ingress.set_inbound_direction") action set_inbound_direction() { + meta._direction1 = 16w2; + } + @name("dash_ingress.direction_lookup|dash_direction_lookup") table direction_lookup_0 { + key = { + hdr.vxlan.vni: exact @name("hdr.vxlan.vni:VNI"); + } + actions = { + set_outbound_direction(); + @defaultonly set_inbound_direction(); + } + const default_action = set_inbound_direction(); + } + @name("dash_ingress.set_appliance") action set_appliance(@name("neighbor_mac") bit<48> neighbor_mac, @name("mac") bit<48> mac) { + meta._encap_data_underlay_dmac7 = neighbor_mac; + meta._encap_data_underlay_smac6 = mac; + } + @name("dash_ingress.appliance") table appliance_0 { + key = { + meta._appliance_id18: ternary @name("meta.appliance_id:appliance_id"); + } + actions = { + set_appliance(); + @defaultonly NoAction_2(); + } + default_action = NoAction_2(); + } + @name("dash_ingress.set_eni_attrs") action set_eni_attrs(@name("cps") bit<32> cps_1, @name("pps") bit<32> pps_1, @name("flows") bit<32> flows_1, @name("admin_state") bit<1> admin_state_1, @name("vm_underlay_dip") bit<32> vm_underlay_dip, @name("vm_vni") bit<24> vm_vni, @name("vnet_id") bit<16> vnet_id_1, @name("inbound_v4_stage1_dash_acl_group_id") bit<16> inbound_v4_stage1_dash_acl_group_id, @name("inbound_v4_stage2_dash_acl_group_id") bit<16> inbound_v4_stage2_dash_acl_group_id, @name("inbound_v4_stage3_dash_acl_group_id") bit<16> inbound_v4_stage3_dash_acl_group_id, @name("inbound_v4_stage4_dash_acl_group_id") bit<16> inbound_v4_stage4_dash_acl_group_id, @name("inbound_v4_stage5_dash_acl_group_id") bit<16> inbound_v4_stage5_dash_acl_group_id, @name("inbound_v6_stage1_dash_acl_group_id") bit<16> inbound_v6_stage1_dash_acl_group_id, @name("inbound_v6_stage2_dash_acl_group_id") bit<16> inbound_v6_stage2_dash_acl_group_id, @name("inbound_v6_stage3_dash_acl_group_id") bit<16> inbound_v6_stage3_dash_acl_group_id, @name("inbound_v6_stage4_dash_acl_group_id") bit<16> inbound_v6_stage4_dash_acl_group_id, @name("inbound_v6_stage5_dash_acl_group_id") bit<16> inbound_v6_stage5_dash_acl_group_id, @name("outbound_v4_stage1_dash_acl_group_id") bit<16> outbound_v4_stage1_dash_acl_group_id, @name("outbound_v4_stage2_dash_acl_group_id") bit<16> outbound_v4_stage2_dash_acl_group_id, @name("outbound_v4_stage3_dash_acl_group_id") bit<16> outbound_v4_stage3_dash_acl_group_id, @name("outbound_v4_stage4_dash_acl_group_id") bit<16> outbound_v4_stage4_dash_acl_group_id, @name("outbound_v4_stage5_dash_acl_group_id") bit<16> outbound_v4_stage5_dash_acl_group_id, @name("outbound_v6_stage1_dash_acl_group_id") bit<16> outbound_v6_stage1_dash_acl_group_id, @name("outbound_v6_stage2_dash_acl_group_id") bit<16> outbound_v6_stage2_dash_acl_group_id, @name("outbound_v6_stage3_dash_acl_group_id") bit<16> outbound_v6_stage3_dash_acl_group_id, @name("outbound_v6_stage4_dash_acl_group_id") bit<16> outbound_v6_stage4_dash_acl_group_id, @name("outbound_v6_stage5_dash_acl_group_id") bit<16> outbound_v6_stage5_dash_acl_group_id) { + meta._eni_data_cps13 = cps_1; + meta._eni_data_pps14 = pps_1; + meta._eni_data_flows15 = flows_1; + meta._eni_data_admin_state16 = admin_state_1; + meta._encap_data_underlay_dip5 = vm_underlay_dip; + meta._encap_data_vni2 = vm_vni; + meta._vnet_id10 = vnet_id_1; + meta._stage1_dash_acl_group_id29 = (meta._is_overlay_ip_v619 == 1w1 ? (meta._direction1 == 16w1 ? outbound_v6_stage1_dash_acl_group_id : meta._stage1_dash_acl_group_id29) : meta._stage1_dash_acl_group_id29); + meta._stage2_dash_acl_group_id30 = (meta._is_overlay_ip_v619 == 1w1 ? (meta._direction1 == 16w1 ? outbound_v6_stage2_dash_acl_group_id : meta._stage2_dash_acl_group_id30) : meta._stage2_dash_acl_group_id30); + meta._stage3_dash_acl_group_id31 = (meta._is_overlay_ip_v619 == 1w1 ? (meta._direction1 == 16w1 ? outbound_v6_stage3_dash_acl_group_id : meta._stage3_dash_acl_group_id31) : meta._stage3_dash_acl_group_id31); + meta._stage4_dash_acl_group_id32 = (meta._is_overlay_ip_v619 == 1w1 ? (meta._direction1 == 16w1 ? outbound_v6_stage4_dash_acl_group_id : meta._stage4_dash_acl_group_id32) : meta._stage4_dash_acl_group_id32); + meta._stage5_dash_acl_group_id33 = (meta._is_overlay_ip_v619 == 1w1 ? (meta._direction1 == 16w1 ? outbound_v6_stage5_dash_acl_group_id : meta._stage5_dash_acl_group_id33) : meta._stage5_dash_acl_group_id33); + meta._stage1_dash_acl_group_id29 = (meta._is_overlay_ip_v619 == 1w1 ? (meta._direction1 == 16w1 ? outbound_v6_stage1_dash_acl_group_id : inbound_v6_stage1_dash_acl_group_id) : meta._stage1_dash_acl_group_id29); + meta._stage2_dash_acl_group_id30 = (meta._is_overlay_ip_v619 == 1w1 ? (meta._direction1 == 16w1 ? outbound_v6_stage2_dash_acl_group_id : inbound_v6_stage2_dash_acl_group_id) : meta._stage2_dash_acl_group_id30); + meta._stage3_dash_acl_group_id31 = (meta._is_overlay_ip_v619 == 1w1 ? (meta._direction1 == 16w1 ? outbound_v6_stage3_dash_acl_group_id : inbound_v6_stage3_dash_acl_group_id) : meta._stage3_dash_acl_group_id31); + meta._stage4_dash_acl_group_id32 = (meta._is_overlay_ip_v619 == 1w1 ? (meta._direction1 == 16w1 ? outbound_v6_stage4_dash_acl_group_id : inbound_v6_stage4_dash_acl_group_id) : meta._stage4_dash_acl_group_id32); + meta._stage5_dash_acl_group_id33 = (meta._is_overlay_ip_v619 == 1w1 ? (meta._direction1 == 16w1 ? outbound_v6_stage5_dash_acl_group_id : inbound_v6_stage5_dash_acl_group_id) : meta._stage5_dash_acl_group_id33); + meta._stage1_dash_acl_group_id29 = (meta._is_overlay_ip_v619 == 1w1 ? meta._stage1_dash_acl_group_id29 : (meta._direction1 == 16w1 ? outbound_v4_stage1_dash_acl_group_id : meta._stage1_dash_acl_group_id29)); + meta._stage2_dash_acl_group_id30 = (meta._is_overlay_ip_v619 == 1w1 ? meta._stage2_dash_acl_group_id30 : (meta._direction1 == 16w1 ? outbound_v4_stage2_dash_acl_group_id : meta._stage2_dash_acl_group_id30)); + meta._stage3_dash_acl_group_id31 = (meta._is_overlay_ip_v619 == 1w1 ? meta._stage3_dash_acl_group_id31 : (meta._direction1 == 16w1 ? outbound_v4_stage3_dash_acl_group_id : meta._stage3_dash_acl_group_id31)); + meta._stage4_dash_acl_group_id32 = (meta._is_overlay_ip_v619 == 1w1 ? meta._stage4_dash_acl_group_id32 : (meta._direction1 == 16w1 ? outbound_v4_stage4_dash_acl_group_id : meta._stage4_dash_acl_group_id32)); + meta._stage5_dash_acl_group_id33 = (meta._is_overlay_ip_v619 == 1w1 ? meta._stage5_dash_acl_group_id33 : (meta._direction1 == 16w1 ? outbound_v4_stage5_dash_acl_group_id : meta._stage5_dash_acl_group_id33)); + meta._stage1_dash_acl_group_id29 = (meta._is_overlay_ip_v619 == 1w1 ? meta._stage1_dash_acl_group_id29 : (meta._direction1 == 16w1 ? outbound_v4_stage1_dash_acl_group_id : inbound_v4_stage1_dash_acl_group_id)); + meta._stage2_dash_acl_group_id30 = (meta._is_overlay_ip_v619 == 1w1 ? meta._stage2_dash_acl_group_id30 : (meta._direction1 == 16w1 ? outbound_v4_stage2_dash_acl_group_id : inbound_v4_stage2_dash_acl_group_id)); + meta._stage3_dash_acl_group_id31 = (meta._is_overlay_ip_v619 == 1w1 ? meta._stage3_dash_acl_group_id31 : (meta._direction1 == 16w1 ? outbound_v4_stage3_dash_acl_group_id : inbound_v4_stage3_dash_acl_group_id)); + meta._stage4_dash_acl_group_id32 = (meta._is_overlay_ip_v619 == 1w1 ? meta._stage4_dash_acl_group_id32 : (meta._direction1 == 16w1 ? outbound_v4_stage4_dash_acl_group_id : inbound_v4_stage4_dash_acl_group_id)); + meta._stage5_dash_acl_group_id33 = (meta._is_overlay_ip_v619 == 1w1 ? meta._stage5_dash_acl_group_id33 : (meta._direction1 == 16w1 ? outbound_v4_stage5_dash_acl_group_id : inbound_v4_stage5_dash_acl_group_id)); + } + @name("dash_ingress.eni|dash_eni") table eni_0 { + key = { + meta._eni_id12: exact @name("meta.eni_id:eni_id"); + } + actions = { + set_eni_attrs(); + @defaultonly deny_0(); + } + const default_action = deny_0(); + } + @name("dash_ingress.eni_counter") direct_counter(CounterType.packets_and_bytes) eni_counter_0; + @name("dash_ingress.eni_meter") table eni_meter_0 { + key = { + meta._eni_id12 : exact @name("meta.eni_id:eni_id"); + meta._direction1: exact @name("meta.direction:direction"); + meta._dropped0 : exact @name("meta.dropped:dropped"); + } + actions = { + NoAction_3(); + } + counters = eni_counter_0; + default_action = NoAction_3(); + } + @name("dash_ingress.permit") action permit() { + } + @name("dash_ingress.vxlan_decap_pa_validate") action vxlan_decap_pa_validate(@name("src_vnet_id") bit<16> src_vnet_id) { + meta._vnet_id10 = src_vnet_id; + } + @name("dash_ingress.pa_validation|dash_pa_validation") table pa_validation_0 { + key = { + meta._vnet_id10 : exact @name("meta.vnet_id:vnet_id"); + hdr.ipv4.src_addr: exact @name("hdr.ipv4.src_addr:sip"); + } + actions = { + permit(); + @defaultonly deny_2(); + } + const default_action = deny_2(); + } + @name("dash_ingress.inbound_routing|dash_inbound_routing") table inbound_routing_0 { + key = { + meta._eni_id12 : exact @name("meta.eni_id:eni_id"); + hdr.vxlan.vni : exact @name("hdr.vxlan.vni:VNI"); + hdr.ipv4.src_addr: ternary @name("hdr.ipv4.src_addr:sip"); + } + actions = { + vxlan_decap_1(); + vxlan_decap_pa_validate(); + @defaultonly deny_3(); + } + const default_action = deny_3(); + } + @name("dash_ingress.set_eni") action set_eni(@name("eni_id") bit<16> eni_id_1) { + meta._eni_id12 = eni_id_1; + } + @name("dash_ingress.eni_ether_address_map|dash_eni") table eni_ether_address_map_0 { + key = { + tmp_0: exact @name("meta.eni_addr:address"); + } + actions = { + set_eni(); + @defaultonly deny_4(); + } + const default_action = deny_4(); + } + @name("dash_ingress.set_acl_group_attrs") action set_acl_group_attrs(@name("ip_addr_family") bit<32> ip_addr_family) { + meta._dropped0 = (ip_addr_family == 32w0 ? (meta._is_overlay_ip_v619 == 1w1 ? true : meta._dropped0) : meta._dropped0); + meta._dropped0 = (ip_addr_family == 32w0 ? meta._dropped0 : (meta._is_overlay_ip_v619 == 1w0 ? true : meta._dropped0)); + } + @name("dash_ingress.dash_acl_group|dash_acl") table acl_group_0 { + key = { + meta._stage1_dash_acl_group_id29: exact @name("meta.stage1_dash_acl_group_id:dash_acl_group_id"); + } + actions = { + set_acl_group_attrs(); + @defaultonly NoAction_4(); + } + default_action = NoAction_4(); + } + @hidden action dashpipeline721() { + meta._encap_data_underlay_sip4 = hdr.ipv4.dst_addr; + } + @hidden action dashpipeline719() { + standard_metadata.egress_spec = standard_metadata.ingress_port; + } + @hidden action dashpipeline740() { + meta._ip_protocol21 = hdr.ipv6.next_header; + meta._src_ip_addr23 = hdr.ipv6.src_addr; + meta._dst_ip_addr22 = hdr.ipv6.dst_addr; + meta._is_overlay_ip_v619 = 1w1; + } + @hidden action dashpipeline745() { + meta._ip_protocol21 = hdr.ipv4.protocol; + meta._src_ip_addr23 = (bit<128>)hdr.ipv4.src_addr; + meta._dst_ip_addr22 = (bit<128>)hdr.ipv4.dst_addr; + } + @hidden action dashpipeline735() { + meta._is_overlay_ip_v619 = 1w0; + meta._ip_protocol21 = 8w0; + meta._dst_ip_addr22 = 128w0; + meta._src_ip_addr23 = 128w0; + } + @hidden action dashpipeline750() { + meta._src_l4_port27 = hdr.tcp.src_port; + meta._dst_l4_port28 = hdr.tcp.dst_port; + } + @hidden action dashpipeline753() { + meta._src_l4_port27 = hdr.udp.src_port; + meta._dst_l4_port28 = hdr.udp.dst_port; + } + @hidden action dashpipeline756() { + tmp_0 = hdr.ethernet.src_addr; + } + @hidden action dashpipeline756_0() { + tmp_0 = hdr.ethernet.dst_addr; + } + @hidden action dashpipeline756_1() { + meta._eni_addr9 = tmp_0; + } + @hidden action dashpipeline390() { + outbound_acl_hasReturned = true; + } + @hidden action dashpipeline393() { + outbound_acl_hasReturned = true; + } + @hidden action act() { + outbound_acl_hasReturned = false; + } + @hidden action dashpipeline400() { + outbound_acl_hasReturned = true; + } + @hidden action dashpipeline403() { + outbound_acl_hasReturned = true; + } + @hidden action dashpipeline486() { + meta._lkup_dst_ip_addr24 = meta._dst_ip_addr22; + meta._is_lkup_dst_ip_v620 = meta._is_overlay_ip_v619; + } + @hidden action dashpipeline390_0() { + inbound_acl_hasReturned = true; + } + @hidden action dashpipeline393_0() { + inbound_acl_hasReturned = true; + } + @hidden action act_0() { + inbound_acl_hasReturned = false; + } + @hidden action dashpipeline400_0() { + inbound_acl_hasReturned = true; + } + @hidden action dashpipeline403_0() { + inbound_acl_hasReturned = true; + } + @hidden action act_1() { + inbound_tmp = hdr.ethernet.dst_addr; + } + @hidden table tbl_dashpipeline719 { + actions = { + dashpipeline719(); + } + const default_action = dashpipeline719(); + } + @hidden table tbl_dashpipeline721 { + actions = { + dashpipeline721(); + } + const default_action = dashpipeline721(); + } + @hidden table tbl_vxlan_decap { + actions = { + vxlan_decap_2(); + } + const default_action = vxlan_decap_2(); + } + @hidden table tbl_vxlan_decap_0 { + actions = { + vxlan_decap_3(); + } + const default_action = vxlan_decap_3(); + } + @hidden table tbl_dashpipeline735 { + actions = { + dashpipeline735(); + } + const default_action = dashpipeline735(); + } + @hidden table tbl_dashpipeline740 { + actions = { + dashpipeline740(); + } + const default_action = dashpipeline740(); + } + @hidden table tbl_dashpipeline745 { + actions = { + dashpipeline745(); + } + const default_action = dashpipeline745(); + } + @hidden table tbl_dashpipeline750 { + actions = { + dashpipeline750(); + } + const default_action = dashpipeline750(); + } + @hidden table tbl_dashpipeline753 { + actions = { + dashpipeline753(); + } + const default_action = dashpipeline753(); + } + @hidden table tbl_dashpipeline756 { + actions = { + dashpipeline756(); + } + const default_action = dashpipeline756(); + } + @hidden table tbl_dashpipeline756_0 { + actions = { + dashpipeline756_0(); + } + const default_action = dashpipeline756_0(); + } + @hidden table tbl_dashpipeline756_1 { + actions = { + dashpipeline756_1(); + } + const default_action = dashpipeline756_1(); + } + @hidden table tbl_deny { + actions = { + deny_5(); + } + const default_action = deny_5(); + } + @hidden table tbl_act { + actions = { + act(); + } + const default_action = act(); + } + @hidden table tbl_dashpipeline390 { + actions = { + dashpipeline390(); + } + const default_action = dashpipeline390(); + } + @hidden table tbl_dashpipeline393 { + actions = { + dashpipeline393(); + } + const default_action = dashpipeline393(); + } + @hidden table tbl_dashpipeline400 { + actions = { + dashpipeline400(); + } + const default_action = dashpipeline400(); + } + @hidden table tbl_dashpipeline403 { + actions = { + dashpipeline403(); + } + const default_action = dashpipeline403(); + } + @hidden table tbl_dashpipeline486 { + actions = { + dashpipeline486(); + } + const default_action = dashpipeline486(); + } + @hidden table tbl_vxlan_encap { + actions = { + vxlan_encap_1(); + } + const default_action = vxlan_encap_1(); + } + @hidden table tbl_act_0 { + actions = { + act_0(); + } + const default_action = act_0(); + } + @hidden table tbl_dashpipeline390_0 { + actions = { + dashpipeline390_0(); + } + const default_action = dashpipeline390_0(); + } + @hidden table tbl_dashpipeline393_0 { + actions = { + dashpipeline393_0(); + } + const default_action = dashpipeline393_0(); + } + @hidden table tbl_dashpipeline400_0 { + actions = { + dashpipeline400_0(); + } + const default_action = dashpipeline400_0(); + } + @hidden table tbl_dashpipeline403_0 { + actions = { + dashpipeline403_0(); + } + const default_action = dashpipeline403_0(); + } + @hidden table tbl_act_1 { + actions = { + act_1(); + } + const default_action = act_1(); + } + @hidden table tbl_vxlan_encap_0 { + actions = { + vxlan_encap_2(); + } + const default_action = vxlan_encap_2(); + } + @hidden table tbl_drop_action { + actions = { + drop_action(); + } + const default_action = drop_action(); + } + apply { + tbl_dashpipeline719.apply(); + if (vip_0.apply().hit) { + tbl_dashpipeline721.apply(); + } + direction_lookup_0.apply(); + appliance_0.apply(); + if (meta._direction1 == 16w1) { + tbl_vxlan_decap.apply(); + } else if (meta._direction1 == 16w2) { + switch (inbound_routing_0.apply().action_run) { + vxlan_decap_pa_validate: { + pa_validation_0.apply(); + tbl_vxlan_decap_0.apply(); + } + default: { + } + } + } + tbl_dashpipeline735.apply(); + if (hdr.ipv6.isValid()) { + tbl_dashpipeline740.apply(); + } else if (hdr.ipv4.isValid()) { + tbl_dashpipeline745.apply(); + } + if (hdr.tcp.isValid()) { + tbl_dashpipeline750.apply(); + } else if (hdr.udp.isValid()) { + tbl_dashpipeline753.apply(); + } + if (meta._direction1 == 16w1) { + tbl_dashpipeline756.apply(); + } else { + tbl_dashpipeline756_0.apply(); + } + tbl_dashpipeline756_1.apply(); + eni_ether_address_map_0.apply(); + eni_0.apply(); + if (meta._eni_data_admin_state16 == 1w0) { + tbl_deny.apply(); + } + acl_group_0.apply(); + if (meta._direction1 == 16w1) { + if (meta._conntrack_data_allow_out26) { + ; + } else { + tbl_act.apply(); + if (meta._stage1_dash_acl_group_id29 != 16w0) { + switch (outbound_acl_stage1:dash_acl_rule|dash_acl.apply().action_run) { + outbound_acl_permit_0: { + tbl_dashpipeline390.apply(); + } + outbound_acl_deny_0: { + tbl_dashpipeline393.apply(); + } + default: { + } + } + } + if (outbound_acl_hasReturned) { + ; + } else if (meta._stage2_dash_acl_group_id30 != 16w0) { + switch (outbound_acl_stage2:dash_acl_rule|dash_acl.apply().action_run) { + outbound_acl_permit_1: { + tbl_dashpipeline400.apply(); + } + outbound_acl_deny_1: { + tbl_dashpipeline403.apply(); + } + default: { + } + } + } + if (outbound_acl_hasReturned) { + ; + } else if (meta._stage3_dash_acl_group_id31 != 16w0) { + switch (outbound_acl_stage3:dash_acl_rule|dash_acl.apply().action_run) { + outbound_acl_permit_2: { + } + outbound_acl_deny_2: { + } + default: { + } + } + } + } + tbl_dashpipeline486.apply(); + switch (outbound_outbound_routing|dash_outbound_routing.apply().action_run) { + outbound_route_vnet_direct_0: + outbound_route_vnet_0: { + outbound_outbound_ca_to_pa|dash_outbound_ca_to_pa.apply(); + outbound_vnet|dash_vnet.apply(); + tbl_vxlan_encap.apply(); + } + default: { + } + } + } else if (meta._direction1 == 16w2) { + if (meta._conntrack_data_allow_in25) { + ; + } else { + tbl_act_0.apply(); + if (meta._stage1_dash_acl_group_id29 != 16w0) { + switch (inbound_acl_stage1:dash_acl_rule|dash_acl.apply().action_run) { + inbound_acl_permit_0: { + tbl_dashpipeline390_0.apply(); + } + inbound_acl_deny_0: { + tbl_dashpipeline393_0.apply(); + } + default: { + } + } + } + if (inbound_acl_hasReturned) { + ; + } else if (meta._stage2_dash_acl_group_id30 != 16w0) { + switch (inbound_acl_stage2:dash_acl_rule|dash_acl.apply().action_run) { + inbound_acl_permit_1: { + tbl_dashpipeline400_0.apply(); + } + inbound_acl_deny_1: { + tbl_dashpipeline403_0.apply(); + } + default: { + } + } + } + if (inbound_acl_hasReturned) { + ; + } else if (meta._stage3_dash_acl_group_id31 != 16w0) { + switch (inbound_acl_stage3:dash_acl_rule|dash_acl.apply().action_run) { + inbound_acl_permit_2: { + } + inbound_acl_deny_2: { + } + default: { + } + } + } + } + tbl_act_1.apply(); + tbl_vxlan_encap_0.apply(); + } + eni_meter_0.apply(); + if (meta._dropped0) { + tbl_drop_action.apply(); + } + } +} + +control dash_egress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + apply { + } +} + +V1Switch(dash_parser(), dash_verify_checksum(), dash_ingress(), dash_egress(), dash_compute_checksum(), dash_deparser()) main; diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4 b/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4 new file mode 100644 index 00000000000..54665f30a19 --- /dev/null +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4 @@ -0,0 +1,780 @@ +error { + IPv4IncorrectVersion, + IPv4OptionsNotSupported, + InvalidIPv4Header +} +#include +#define V1MODEL_VERSION 20180101 +#include + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +typedef bit<128> IPv6Address; +typedef bit<128> IPv4ORv6Address; +header ethernet_t { + EthernetAddress dst_addr; + EthernetAddress src_addr; + bit<16> ether_type; +} + +const bit<16> ETHER_HDR_SIZE = 112 / 8; +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> total_len; + bit<16> identification; + bit<3> flags; + bit<13> frag_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + IPv4Address src_addr; + IPv4Address dst_addr; +} + +const bit<16> IPV4_HDR_SIZE = 160 / 8; +header ipv4options_t { + varbit<320> options; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +const bit<16> UDP_HDR_SIZE = 64 / 8; +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved_2; +} + +const bit<16> VXLAN_HDR_SIZE = 64 / 8; +header tcp_t { + bit<16> src_port; + bit<16> dst_port; + bit<32> seq_no; + bit<32> ack_no; + bit<4> data_offset; + bit<3> res; + bit<3> ecn; + bit<6> flags; + bit<16> window; + bit<16> checksum; + bit<16> urgent_ptr; +} + +const bit<16> TCP_HDR_SIZE = 160 / 8; +header ipv6_t { + bit<4> version; + bit<8> traffic_class; + bit<20> flow_label; + bit<16> payload_length; + bit<8> next_header; + bit<8> hop_limit; + IPv6Address src_addr; + IPv6Address dst_addr; +} + +const bit<16> IPV6_HDR_SIZE = 320 / 8; +struct headers_t { + ethernet_t ethernet; + ipv4_t ipv4; + ipv4options_t ipv4options; + ipv6_t ipv6; + udp_t udp; + tcp_t tcp; + vxlan_t vxlan; + ethernet_t inner_ethernet; + ipv4_t inner_ipv4; + ipv6_t inner_ipv6; + udp_t inner_udp; + tcp_t inner_tcp; +} + +struct encap_data_t { + bit<24> vni; + bit<24> dest_vnet_vni; + IPv4Address underlay_sip; + IPv4Address underlay_dip; + EthernetAddress underlay_smac; + EthernetAddress underlay_dmac; + EthernetAddress overlay_dmac; +} + +enum bit<16> direction_t { + INVALID = 0, + OUTBOUND = 1, + INBOUND = 2 +} + +struct conntrack_data_t { + bool allow_in; + bool allow_out; +} + +struct eni_data_t { + bit<32> cps; + bit<32> pps; + bit<32> flows; + bit<1> admin_state; +} + +struct metadata_t { + bool dropped; + direction_t direction; + encap_data_t encap_data; + EthernetAddress eni_addr; + bit<16> vnet_id; + bit<16> dst_vnet_id; + bit<16> eni_id; + eni_data_t eni_data; + bit<16> inbound_vm_id; + bit<8> appliance_id; + bit<1> is_overlay_ip_v6; + bit<1> is_lkup_dst_ip_v6; + bit<8> ip_protocol; + IPv4ORv6Address dst_ip_addr; + IPv4ORv6Address src_ip_addr; + IPv4ORv6Address lkup_dst_ip_addr; + conntrack_data_t conntrack_data; + bit<16> src_l4_port; + bit<16> dst_l4_port; + bit<16> stage1_dash_acl_group_id; + bit<16> stage2_dash_acl_group_id; + bit<16> stage3_dash_acl_group_id; + bit<16> stage4_dash_acl_group_id; + bit<16> stage5_dash_acl_group_id; +} + +parser dash_parser(packet_in packet, out headers_t hd, inout metadata_t meta, inout standard_metadata_t standard_meta) { + state start { + packet.extract(hd.ethernet); + transition select(hd.ethernet.ether_type) { + 0x800: parse_ipv4; + 0x86dd: parse_ipv6; + default: accept; + } + } + state parse_ipv4 { + packet.extract(hd.ipv4); + verify(hd.ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.ipv4.ihl >= 5, error.InvalidIPv4Header); + transition select(hd.ipv4.ihl) { + 5: dispatch_on_protocol; + default: parse_ipv4options; + } + } + state parse_ipv4options { + packet.extract(hd.ipv4options, (bit<32>)(((bit<16>)hd.ipv4.ihl - 5) * 32)); + transition dispatch_on_protocol; + } + state dispatch_on_protocol { + transition select(hd.ipv4.protocol) { + 17: parse_udp; + 6: parse_tcp; + default: accept; + } + } + state parse_ipv6 { + packet.extract(hd.ipv6); + transition select(hd.ipv6.next_header) { + 17: parse_udp; + 6: parse_tcp; + default: accept; + } + } + state parse_udp { + packet.extract(hd.udp); + transition select(hd.udp.dst_port) { + 4789: parse_vxlan; + default: accept; + } + } + state parse_tcp { + packet.extract(hd.tcp); + transition accept; + } + state parse_vxlan { + packet.extract(hd.vxlan); + transition parse_inner_ethernet; + } + state parse_inner_ethernet { + packet.extract(hd.inner_ethernet); + transition select(hd.inner_ethernet.ether_type) { + 0x800: parse_inner_ipv4; + 0x86dd: parse_inner_ipv6; + default: accept; + } + } + state parse_inner_ipv4 { + packet.extract(hd.inner_ipv4); + verify(hd.inner_ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.inner_ipv4.ihl == 4w5, error.IPv4OptionsNotSupported); + transition select(hd.inner_ipv4.protocol) { + 17: parse_inner_udp; + 6: parse_inner_tcp; + default: accept; + } + } + state parse_inner_ipv6 { + packet.extract(hd.inner_ipv6); + transition select(hd.inner_ipv6.next_header) { + 17: parse_inner_udp; + 6: parse_inner_tcp; + default: accept; + } + } + state parse_inner_tcp { + packet.extract(hd.inner_tcp); + transition accept; + } + state parse_inner_udp { + packet.extract(hd.inner_udp); + transition accept; + } +} + +control dash_deparser(packet_out packet, in headers_t hdr) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + packet.emit(hdr.ipv4options); + packet.emit(hdr.ipv6); + packet.emit(hdr.udp); + packet.emit(hdr.tcp); + packet.emit(hdr.vxlan); + packet.emit(hdr.inner_ethernet); + packet.emit(hdr.inner_ipv4); + packet.emit(hdr.inner_ipv6); + packet.emit(hdr.inner_tcp); + packet.emit(hdr.inner_udp); + } +} + +action vxlan_encap(inout headers_t hdr, in EthernetAddress underlay_dmac, in EthernetAddress underlay_smac, in IPv4Address underlay_dip, in IPv4Address underlay_sip, in EthernetAddress overlay_dmac, in bit<24> vni) { + hdr.inner_ethernet = hdr.ethernet; + hdr.inner_ethernet.dst_addr = overlay_dmac; + hdr.ethernet.setInvalid(); + hdr.inner_ipv4 = hdr.ipv4; + hdr.ipv4.setInvalid(); + hdr.inner_ipv6 = hdr.ipv6; + hdr.ipv6.setInvalid(); + hdr.inner_tcp = hdr.tcp; + hdr.tcp.setInvalid(); + hdr.inner_udp = hdr.udp; + hdr.udp.setInvalid(); + hdr.ethernet.setValid(); + hdr.ethernet.dst_addr = underlay_dmac; + hdr.ethernet.src_addr = underlay_smac; + hdr.ethernet.ether_type = 0x800; + hdr.ipv4.setValid(); + hdr.ipv4.version = 4; + hdr.ipv4.ihl = 5; + hdr.ipv4.diffserv = 0; + hdr.ipv4.total_len = hdr.inner_ipv4.total_len * (bit<16>)(bit<1>)hdr.inner_ipv4.isValid() + hdr.inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + IPV6_HDR_SIZE * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + ETHER_HDR_SIZE + IPV4_HDR_SIZE + UDP_HDR_SIZE + VXLAN_HDR_SIZE; + hdr.ipv4.identification = 1; + hdr.ipv4.flags = 0; + hdr.ipv4.frag_offset = 0; + hdr.ipv4.ttl = 64; + hdr.ipv4.protocol = 17; + hdr.ipv4.dst_addr = underlay_dip; + hdr.ipv4.src_addr = underlay_sip; + hdr.ipv4.hdr_checksum = 0; + hdr.udp.setValid(); + hdr.udp.src_port = 0; + hdr.udp.dst_port = 4789; + hdr.udp.length = hdr.inner_ipv4.total_len * (bit<16>)(bit<1>)hdr.inner_ipv4.isValid() + hdr.inner_ipv6.payload_length * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + IPV6_HDR_SIZE * (bit<16>)(bit<1>)hdr.inner_ipv6.isValid() + UDP_HDR_SIZE + VXLAN_HDR_SIZE + ETHER_HDR_SIZE; + hdr.udp.checksum = 0; + hdr.vxlan.setValid(); + hdr.vxlan.reserved = 0; + hdr.vxlan.reserved_2 = 0; + hdr.vxlan.flags = 0; + hdr.vxlan.vni = vni; +} +action vxlan_decap(inout headers_t hdr) { + hdr.ethernet = hdr.inner_ethernet; + hdr.inner_ethernet.setInvalid(); + hdr.ipv4 = hdr.inner_ipv4; + hdr.inner_ipv4.setInvalid(); + hdr.ipv6 = hdr.inner_ipv6; + hdr.inner_ipv6.setInvalid(); + hdr.vxlan.setInvalid(); + hdr.udp.setInvalid(); + hdr.tcp = hdr.inner_tcp; + hdr.inner_tcp.setInvalid(); + hdr.udp = hdr.inner_udp; + hdr.inner_udp.setInvalid(); +} +match_kind { + list, + range_list +} + +control acl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + action permit() { + } + action permit_and_continue() { + } + action deny() { + meta.dropped = true; + } + action deny_and_continue() { + meta.dropped = true; + } + direct_counter(CounterType.packets_and_bytes) stage1_counter; + @name("stage1:dash_acl_rule|dash_acl") table stage1 { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + permit; + permit_and_continue; + deny; + deny_and_continue; + } + default_action = deny; + counters = stage1_counter; + } + direct_counter(CounterType.packets_and_bytes) stage2_counter; + @name("stage2:dash_acl_rule|dash_acl") table stage2 { + key = { + meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + permit; + permit_and_continue; + deny; + deny_and_continue; + } + default_action = deny; + counters = stage2_counter; + } + direct_counter(CounterType.packets_and_bytes) stage3_counter; + @name("stage3:dash_acl_rule|dash_acl") table stage3 { + key = { + meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + permit; + permit_and_continue; + deny; + deny_and_continue; + } + default_action = deny; + counters = stage3_counter; + } + apply { + if (meta.stage1_dash_acl_group_id != 0) { + switch (stage1.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + } + } + if (meta.stage2_dash_acl_group_id != 0) { + switch (stage2.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + } + } + if (meta.stage3_dash_acl_group_id != 0) { + switch (stage3.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + } + } + } +} + +control outbound(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + action route_vnet(bit<16> dst_vnet_id) { + meta.dst_vnet_id = dst_vnet_id; + } + action route_vnet_direct(bit<16> dst_vnet_id, bit<1> is_overlay_ip_v4_or_v6, IPv4ORv6Address overlay_ip) { + meta.dst_vnet_id = dst_vnet_id; + meta.lkup_dst_ip_addr = overlay_ip; + meta.is_lkup_dst_ip_v6 = is_overlay_ip_v4_or_v6; + } + action route_direct() { + } + action drop() { + meta.dropped = true; + } + direct_counter(CounterType.packets_and_bytes) routing_counter; + @name("outbound_routing|dash_outbound_routing") table routing { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + meta.is_overlay_ip_v6: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); + meta.dst_ip_addr : lpm @name("meta.dst_ip_addr:destination"); + } + actions = { + route_vnet; + route_vnet_direct; + route_direct; + drop; + } + const default_action = drop; + counters = routing_counter; + } + action set_tunnel_mapping(IPv4Address underlay_dip, EthernetAddress overlay_dmac, bit<1> use_dst_vnet_vni) { + if (use_dst_vnet_vni == 1) { + meta.vnet_id = meta.dst_vnet_id; + } + meta.encap_data.overlay_dmac = overlay_dmac; + meta.encap_data.underlay_dip = underlay_dip; + } + direct_counter(CounterType.packets_and_bytes) ca_to_pa_counter; + @name("outbound_ca_to_pa|dash_outbound_ca_to_pa") table ca_to_pa { + key = { + meta.dst_vnet_id : exact @name("meta.dst_vnet_id:dst_vnet_id"); + meta.is_lkup_dst_ip_v6: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); + meta.lkup_dst_ip_addr : exact @name("meta.lkup_dst_ip_addr:dip"); + } + actions = { + set_tunnel_mapping; + @defaultonly drop; + } + const default_action = drop; + counters = ca_to_pa_counter; + } + action set_vnet_attrs(bit<24> vni) { + meta.encap_data.vni = vni; + } + @name("vnet|dash_vnet") table vnet { + key = { + meta.vnet_id: exact @name("meta.vnet_id:vnet_id"); + } + actions = { + set_vnet_attrs; + } + } + apply { + if (!meta.conntrack_data.allow_out) { + acl.apply(hdr, meta, standard_metadata); + } + meta.lkup_dst_ip_addr = meta.dst_ip_addr; + meta.is_lkup_dst_ip_v6 = meta.is_overlay_ip_v6; + switch (routing.apply().action_run) { + route_vnet_direct: + route_vnet: { + ca_to_pa.apply(); + vnet.apply(); + vxlan_encap(hdr, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.overlay_dmac, meta.encap_data.vni); + } + } + } +} + +action service_tunnel_encode(inout headers_t hdr, in IPv6Address st_dst_prefix, in IPv6Address st_src_prefix) { + hdr.ipv6.setValid(); + hdr.ipv6.version = 6; + hdr.ipv6.traffic_class = 0; + hdr.ipv6.flow_label = 0; + hdr.ipv6.payload_length = hdr.ipv4.total_len - IPV4_HDR_SIZE; + hdr.ipv6.next_header = hdr.ipv4.protocol; + hdr.ipv6.hop_limit = hdr.ipv4.ttl; + hdr.ipv6.dst_addr = (IPv6Address)hdr.ipv4.dst_addr + st_dst_prefix; + hdr.ipv6.src_addr = (IPv6Address)hdr.ipv4.src_addr + st_src_prefix; + hdr.ipv4.setInvalid(); + hdr.ethernet.ether_type = 0x86dd; +} +action service_tunnel_decode(inout headers_t hdr) { + hdr.ipv4.setValid(); + hdr.ipv4.version = 4; + hdr.ipv4.ihl = 5; + hdr.ipv4.diffserv = 0; + hdr.ipv4.total_len = hdr.ipv6.payload_length + IPV4_HDR_SIZE; + hdr.ipv4.identification = 1; + hdr.ipv4.flags = 0; + hdr.ipv4.frag_offset = 0; + hdr.ipv4.protocol = hdr.ipv6.next_header; + hdr.ipv4.ttl = hdr.ipv6.hop_limit; + hdr.ipv4.hdr_checksum = 0; + hdr.ipv6.setInvalid(); + hdr.ethernet.ether_type = 0x800; +} +control inbound(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + apply { + if (!meta.conntrack_data.allow_in) { + acl.apply(hdr, meta, standard_metadata); + } + vxlan_encap(hdr, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, hdr.ethernet.dst_addr, meta.encap_data.vni); + } +} + +control dash_verify_checksum(inout headers_t hdr, inout metadata_t meta) { + apply { + } +} + +control dash_compute_checksum(inout headers_t hdr, inout metadata_t meta) { + apply { + } +} + +control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + action drop_action() { + mark_to_drop(standard_metadata); + } + action deny() { + meta.dropped = true; + } + action accept() { + } + @name("vip|dash_vip") table vip { + key = { + hdr.ipv4.dst_addr: exact @name("hdr.ipv4.dst_addr:VIP"); + } + actions = { + accept; + @defaultonly deny; + } + const default_action = deny; + } + action set_outbound_direction() { + meta.direction = direction_t.OUTBOUND; + } + action set_inbound_direction() { + meta.direction = direction_t.INBOUND; + } + @name("direction_lookup|dash_direction_lookup") table direction_lookup { + key = { + hdr.vxlan.vni: exact @name("hdr.vxlan.vni:VNI"); + } + actions = { + set_outbound_direction; + @defaultonly set_inbound_direction; + } + const default_action = set_inbound_direction; + } + action set_appliance(EthernetAddress neighbor_mac, EthernetAddress mac) { + meta.encap_data.underlay_dmac = neighbor_mac; + meta.encap_data.underlay_smac = mac; + } + table appliance { + key = { + meta.appliance_id: ternary @name("meta.appliance_id:appliance_id"); + } + actions = { + set_appliance; + } + } + action set_eni_attrs(bit<32> cps, bit<32> pps, bit<32> flows, bit<1> admin_state, IPv4Address vm_underlay_dip, bit<24> vm_vni, bit<16> vnet_id, bit<16> inbound_v4_stage1_dash_acl_group_id, bit<16> inbound_v4_stage2_dash_acl_group_id, bit<16> inbound_v4_stage3_dash_acl_group_id, bit<16> inbound_v4_stage4_dash_acl_group_id, bit<16> inbound_v4_stage5_dash_acl_group_id, bit<16> inbound_v6_stage1_dash_acl_group_id, bit<16> inbound_v6_stage2_dash_acl_group_id, bit<16> inbound_v6_stage3_dash_acl_group_id, bit<16> inbound_v6_stage4_dash_acl_group_id, bit<16> inbound_v6_stage5_dash_acl_group_id, bit<16> outbound_v4_stage1_dash_acl_group_id, bit<16> outbound_v4_stage2_dash_acl_group_id, bit<16> outbound_v4_stage3_dash_acl_group_id, bit<16> outbound_v4_stage4_dash_acl_group_id, bit<16> outbound_v4_stage5_dash_acl_group_id, bit<16> outbound_v6_stage1_dash_acl_group_id, bit<16> outbound_v6_stage2_dash_acl_group_id, bit<16> outbound_v6_stage3_dash_acl_group_id, bit<16> outbound_v6_stage4_dash_acl_group_id, bit<16> outbound_v6_stage5_dash_acl_group_id) { + meta.eni_data.cps = cps; + meta.eni_data.pps = pps; + meta.eni_data.flows = flows; + meta.eni_data.admin_state = admin_state; + meta.encap_data.underlay_dip = vm_underlay_dip; + meta.encap_data.vni = vm_vni; + meta.vnet_id = vnet_id; + if (meta.is_overlay_ip_v6 == 1) { + if (meta.direction == direction_t.OUTBOUND) { + meta.stage1_dash_acl_group_id = outbound_v6_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = outbound_v6_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = outbound_v6_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = outbound_v6_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = outbound_v6_stage5_dash_acl_group_id; + ; + } else { + meta.stage1_dash_acl_group_id = inbound_v6_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = inbound_v6_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = inbound_v6_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = inbound_v6_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = inbound_v6_stage5_dash_acl_group_id; + ; + } + } else { + if (meta.direction == direction_t.OUTBOUND) { + meta.stage1_dash_acl_group_id = outbound_v4_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = outbound_v4_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = outbound_v4_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = outbound_v4_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = outbound_v4_stage5_dash_acl_group_id; + ; + } else { + meta.stage1_dash_acl_group_id = inbound_v4_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = inbound_v4_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = inbound_v4_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = inbound_v4_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = inbound_v4_stage5_dash_acl_group_id; + ; + } + } + } + @name("eni|dash_eni") table eni { + key = { + meta.eni_id: exact @name("meta.eni_id:eni_id"); + } + actions = { + set_eni_attrs; + @defaultonly deny; + } + const default_action = deny; + } + direct_counter(CounterType.packets_and_bytes) eni_counter; + table eni_meter { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + meta.direction: exact @name("meta.direction:direction"); + meta.dropped : exact @name("meta.dropped:dropped"); + } + actions = { + NoAction; + } + counters = eni_counter; + } + action permit() { + } + action vxlan_decap_pa_validate(bit<16> src_vnet_id) { + meta.vnet_id = src_vnet_id; + } + @name("pa_validation|dash_pa_validation") table pa_validation { + key = { + meta.vnet_id : exact @name("meta.vnet_id:vnet_id"); + hdr.ipv4.src_addr: exact @name("hdr.ipv4.src_addr:sip"); + } + actions = { + permit; + @defaultonly deny; + } + const default_action = deny; + } + @name("inbound_routing|dash_inbound_routing") table inbound_routing { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + hdr.vxlan.vni : exact @name("hdr.vxlan.vni:VNI"); + hdr.ipv4.src_addr: ternary @name("hdr.ipv4.src_addr:sip"); + } + actions = { + vxlan_decap(hdr); + vxlan_decap_pa_validate; + @defaultonly deny; + } + const default_action = deny; + } + action set_eni(bit<16> eni_id) { + meta.eni_id = eni_id; + } + @name("eni_ether_address_map|dash_eni") table eni_ether_address_map { + key = { + meta.eni_addr: exact @name("meta.eni_addr:address"); + } + actions = { + set_eni; + @defaultonly deny; + } + const default_action = deny; + } + action set_acl_group_attrs(bit<32> ip_addr_family) { + if (ip_addr_family == 0) { + if (meta.is_overlay_ip_v6 == 1) { + meta.dropped = true; + } + } else { + if (meta.is_overlay_ip_v6 == 0) { + meta.dropped = true; + } + } + } + @name("dash_acl_group|dash_acl") table acl_group { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.stage1_dash_acl_group_id:dash_acl_group_id"); + } + actions = { + set_acl_group_attrs(); + } + } + apply { + standard_metadata.egress_spec = standard_metadata.ingress_port; + if (vip.apply().hit) { + meta.encap_data.underlay_sip = hdr.ipv4.dst_addr; + } + direction_lookup.apply(); + appliance.apply(); + if (meta.direction == direction_t.OUTBOUND) { + vxlan_decap(hdr); + } else if (meta.direction == direction_t.INBOUND) { + switch (inbound_routing.apply().action_run) { + vxlan_decap_pa_validate: { + pa_validation.apply(); + vxlan_decap(hdr); + } + } + } + meta.is_overlay_ip_v6 = 0; + meta.ip_protocol = 0; + meta.dst_ip_addr = 0; + meta.src_ip_addr = 0; + if (hdr.ipv6.isValid()) { + meta.ip_protocol = hdr.ipv6.next_header; + meta.src_ip_addr = hdr.ipv6.src_addr; + meta.dst_ip_addr = hdr.ipv6.dst_addr; + meta.is_overlay_ip_v6 = 1; + } else if (hdr.ipv4.isValid()) { + meta.ip_protocol = hdr.ipv4.protocol; + meta.src_ip_addr = (bit<128>)hdr.ipv4.src_addr; + meta.dst_ip_addr = (bit<128>)hdr.ipv4.dst_addr; + } + if (hdr.tcp.isValid()) { + meta.src_l4_port = hdr.tcp.src_port; + meta.dst_l4_port = hdr.tcp.dst_port; + } else if (hdr.udp.isValid()) { + meta.src_l4_port = hdr.udp.src_port; + meta.dst_l4_port = hdr.udp.dst_port; + } + meta.eni_addr = (meta.direction == direction_t.OUTBOUND ? hdr.ethernet.src_addr : hdr.ethernet.dst_addr); + eni_ether_address_map.apply(); + eni.apply(); + if (meta.eni_data.admin_state == 0) { + deny(); + } + acl_group.apply(); + if (meta.direction == direction_t.OUTBOUND) { + outbound.apply(hdr, meta, standard_metadata); + } else if (meta.direction == direction_t.INBOUND) { + inbound.apply(hdr, meta, standard_metadata); + } + eni_meter.apply(); + if (meta.dropped) { + drop_action(); + } + } +} + +control dash_egress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { + apply { + } +} + +V1Switch(dash_parser(), dash_verify_checksum(), dash_ingress(), dash_egress(), dash_compute_checksum(), dash_deparser()) main; diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4-stderr b/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.entries.txt b/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.p4info.txt b/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.p4info.txt new file mode 100644 index 00000000000..24cb1b3c374 --- /dev/null +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.p4info.txt @@ -0,0 +1,1194 @@ +pkg_info { + arch: "v1model" +} +tables { + preamble { + id: 33810473 + name: "dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl" + alias: "outbound.acl.stage1:dash_acl_rule|dash_acl" + } + match_fields { + id: 1 + name: "meta.dash_acl_group_id:dash_acl_group_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "meta.dst_ip_addr:dip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 3 + name: "meta.src_ip_addr:sip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 4 + name: "meta.ip_protocol:protocol" + bitwidth: 8 + match_type: OPTIONAL + } + match_fields { + id: 5 + name: "meta.src_l4_port:src_port" + bitwidth: 16 + match_type: OPTIONAL + } + match_fields { + id: 6 + name: "meta.dst_l4_port:dst_port" + bitwidth: 16 + match_type: OPTIONAL + } + action_refs { + id: 18858683 + } + action_refs { + id: 24263137 + } + action_refs { + id: 29962337 + } + action_refs { + id: 26077229 + } + direct_resource_ids: 324963620 + size: 1024 +} +tables { + preamble { + id: 49812549 + name: "dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl" + alias: "outbound.acl.stage2:dash_acl_rule|dash_acl" + } + match_fields { + id: 1 + name: "meta.dash_acl_group_id:dash_acl_group_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "meta.dst_ip_addr:dip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 3 + name: "meta.src_ip_addr:sip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 4 + name: "meta.ip_protocol:protocol" + bitwidth: 8 + match_type: OPTIONAL + } + match_fields { + id: 5 + name: "meta.src_l4_port:src_port" + bitwidth: 16 + match_type: OPTIONAL + } + match_fields { + id: 6 + name: "meta.dst_l4_port:dst_port" + bitwidth: 16 + match_type: OPTIONAL + } + action_refs { + id: 18858683 + } + action_refs { + id: 24263137 + } + action_refs { + id: 29962337 + } + action_refs { + id: 26077229 + } + direct_resource_ids: 334749261 + size: 1024 +} +tables { + preamble { + id: 40782112 + name: "dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl" + alias: "outbound.acl.stage3:dash_acl_rule|dash_acl" + } + match_fields { + id: 1 + name: "meta.dash_acl_group_id:dash_acl_group_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "meta.dst_ip_addr:dip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 3 + name: "meta.src_ip_addr:sip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 4 + name: "meta.ip_protocol:protocol" + bitwidth: 8 + match_type: OPTIONAL + } + match_fields { + id: 5 + name: "meta.src_l4_port:src_port" + bitwidth: 16 + match_type: OPTIONAL + } + match_fields { + id: 6 + name: "meta.dst_l4_port:dst_port" + bitwidth: 16 + match_type: OPTIONAL + } + action_refs { + id: 18858683 + } + action_refs { + id: 24263137 + } + action_refs { + id: 29962337 + } + action_refs { + id: 26077229 + } + direct_resource_ids: 320450761 + size: 1024 +} +tables { + preamble { + id: 42788937 + name: "dash_ingress.outbound.outbound_routing|dash_outbound_routing" + alias: "outbound_routing|dash_outbound_routing" + } + match_fields { + id: 1 + name: "meta.eni_id:eni_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "meta.is_overlay_ip_v6:is_destination_v4_or_v6" + bitwidth: 1 + match_type: EXACT + } + match_fields { + id: 3 + name: "meta.dst_ip_addr:destination" + bitwidth: 128 + match_type: LPM + } + action_refs { + id: 25364446 + } + action_refs { + id: 31116088 + } + action_refs { + id: 22900588 + } + action_refs { + id: 33407636 + } + const_default_action_id: 33407636 + direct_resource_ids: 329571213 + size: 1024 +} +tables { + preamble { + id: 48860231 + name: "dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa" + alias: "outbound_ca_to_pa|dash_outbound_ca_to_pa" + } + match_fields { + id: 1 + name: "meta.dst_vnet_id:dst_vnet_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6" + bitwidth: 1 + match_type: EXACT + } + match_fields { + id: 3 + name: "meta.lkup_dst_ip_addr:dip" + bitwidth: 128 + match_type: EXACT + } + action_refs { + id: 25450412 + } + action_refs { + id: 33407636 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 33407636 + direct_resource_ids: 321828795 + size: 1024 +} +tables { + preamble { + id: 34579306 + name: "dash_ingress.outbound.vnet|dash_vnet" + alias: "vnet|dash_vnet" + } + match_fields { + id: 1 + name: "meta.vnet_id:vnet_id" + bitwidth: 16 + match_type: EXACT + } + action_refs { + id: 17187022 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +tables { + preamble { + id: 33901322 + name: "dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl" + alias: "inbound.acl.stage1:dash_acl_rule|dash_acl" + } + match_fields { + id: 1 + name: "meta.dash_acl_group_id:dash_acl_group_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "meta.dst_ip_addr:dip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 3 + name: "meta.src_ip_addr:sip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 4 + name: "meta.ip_protocol:protocol" + bitwidth: 8 + match_type: OPTIONAL + } + match_fields { + id: 5 + name: "meta.src_l4_port:src_port" + bitwidth: 16 + match_type: OPTIONAL + } + match_fields { + id: 6 + name: "meta.dst_l4_port:dst_port" + bitwidth: 16 + match_type: OPTIONAL + } + action_refs { + id: 32161567 + } + action_refs { + id: 20706700 + } + action_refs { + id: 28146588 + } + action_refs { + id: 31424218 + } + direct_resource_ids: 320981527 + size: 1024 +} +tables { + preamble { + id: 44184066 + name: "dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl" + alias: "inbound.acl.stage2:dash_acl_rule|dash_acl" + } + match_fields { + id: 1 + name: "meta.dash_acl_group_id:dash_acl_group_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "meta.dst_ip_addr:dip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 3 + name: "meta.src_ip_addr:sip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 4 + name: "meta.ip_protocol:protocol" + bitwidth: 8 + match_type: OPTIONAL + } + match_fields { + id: 5 + name: "meta.src_l4_port:src_port" + bitwidth: 16 + match_type: OPTIONAL + } + match_fields { + id: 6 + name: "meta.dst_l4_port:dst_port" + bitwidth: 16 + match_type: OPTIONAL + } + action_refs { + id: 32161567 + } + action_refs { + id: 20706700 + } + action_refs { + id: 28146588 + } + action_refs { + id: 31424218 + } + direct_resource_ids: 322865948 + size: 1024 +} +tables { + preamble { + id: 46150034 + name: "dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl" + alias: "inbound.acl.stage3:dash_acl_rule|dash_acl" + } + match_fields { + id: 1 + name: "meta.dash_acl_group_id:dash_acl_group_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "meta.dst_ip_addr:dip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 3 + name: "meta.src_ip_addr:sip" + bitwidth: 128 + match_type: OPTIONAL + } + match_fields { + id: 4 + name: "meta.ip_protocol:protocol" + bitwidth: 8 + match_type: OPTIONAL + } + match_fields { + id: 5 + name: "meta.src_l4_port:src_port" + bitwidth: 16 + match_type: OPTIONAL + } + match_fields { + id: 6 + name: "meta.dst_l4_port:dst_port" + bitwidth: 16 + match_type: OPTIONAL + } + action_refs { + id: 32161567 + } + action_refs { + id: 20706700 + } + action_refs { + id: 28146588 + } + action_refs { + id: 31424218 + } + direct_resource_ids: 328370481 + size: 1024 +} +tables { + preamble { + id: 38937816 + name: "dash_ingress.vip|dash_vip" + alias: "vip|dash_vip" + } + match_fields { + id: 1 + name: "hdr.ipv4.dst_addr:VIP" + bitwidth: 32 + match_type: EXACT + } + action_refs { + id: 26041632 + } + action_refs { + id: 23563653 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 23563653 + size: 1024 +} +tables { + preamble { + id: 38960243 + name: "dash_ingress.direction_lookup|dash_direction_lookup" + alias: "direction_lookup|dash_direction_lookup" + } + match_fields { + id: 1 + name: "hdr.vxlan.vni:VNI" + bitwidth: 24 + match_type: EXACT + } + action_refs { + id: 21912829 + } + action_refs { + id: 20977739 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 20977739 + size: 1024 +} +tables { + preamble { + id: 42701762 + name: "dash_ingress.appliance" + alias: "appliance" + } + match_fields { + id: 1 + name: "meta.appliance_id:appliance_id" + bitwidth: 8 + match_type: TERNARY + } + action_refs { + id: 21793905 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +tables { + preamble { + id: 47336097 + name: "dash_ingress.eni|dash_eni" + alias: "eni|dash_eni" + } + match_fields { + id: 1 + name: "meta.eni_id:eni_id" + bitwidth: 16 + match_type: EXACT + } + action_refs { + id: 27167550 + } + action_refs { + id: 23563653 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 23563653 + size: 1024 +} +tables { + preamble { + id: 40418231 + name: "dash_ingress.eni_meter" + alias: "eni_meter" + } + match_fields { + id: 1 + name: "meta.eni_id:eni_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "meta.direction:direction" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 3 + name: "meta.dropped:dropped" + bitwidth: 1 + match_type: EXACT + } + action_refs { + id: 21257015 + } + direct_resource_ids: 322696367 + size: 1024 +} +tables { + preamble { + id: 48948181 + name: "dash_ingress.pa_validation|dash_pa_validation" + alias: "pa_validation|dash_pa_validation" + } + match_fields { + id: 1 + name: "meta.vnet_id:vnet_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "hdr.ipv4.src_addr:sip" + bitwidth: 32 + match_type: EXACT + } + action_refs { + id: 32591400 + } + action_refs { + id: 23563653 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 23563653 + size: 1024 +} +tables { + preamble { + id: 42758350 + name: "dash_ingress.inbound_routing|dash_inbound_routing" + alias: "inbound_routing|dash_inbound_routing" + } + match_fields { + id: 1 + name: "meta.eni_id:eni_id" + bitwidth: 16 + match_type: EXACT + } + match_fields { + id: 2 + name: "hdr.vxlan.vni:VNI" + bitwidth: 24 + match_type: EXACT + } + match_fields { + id: 3 + name: "hdr.ipv4.src_addr:sip" + bitwidth: 32 + match_type: TERNARY + } + action_refs { + id: 28528336 + } + action_refs { + id: 22711915 + } + action_refs { + id: 23563653 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 23563653 + size: 1024 +} +tables { + preamble { + id: 38612462 + name: "dash_ingress.eni_ether_address_map|dash_eni" + alias: "eni_ether_address_map|dash_eni" + } + match_fields { + id: 1 + name: "meta.eni_addr:address" + bitwidth: 48 + match_type: EXACT + } + action_refs { + id: 18228884 + } + action_refs { + id: 23563653 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 23563653 + size: 1024 +} +tables { + preamble { + id: 45323240 + name: "dash_ingress.dash_acl_group|dash_acl" + alias: "dash_acl_group|dash_acl" + } + match_fields { + id: 1 + name: "meta.stage1_dash_acl_group_id:dash_acl_group_id" + bitwidth: 16 + match_type: EXACT + } + action_refs { + id: 25655048 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 28528336 + name: "vxlan_decap" + alias: "vxlan_decap" + } +} +actions { + preamble { + id: 29669127 + name: "vxlan_encap" + alias: "vxlan_encap" + } +} +actions { + preamble { + id: 18858683 + name: "dash_ingress.outbound.acl.permit" + alias: "outbound.acl.permit" + } +} +actions { + preamble { + id: 24263137 + name: "dash_ingress.outbound.acl.permit_and_continue" + alias: "outbound.acl.permit_and_continue" + } +} +actions { + preamble { + id: 29962337 + name: "dash_ingress.outbound.acl.deny" + alias: "outbound.acl.deny" + } +} +actions { + preamble { + id: 26077229 + name: "dash_ingress.outbound.acl.deny_and_continue" + alias: "outbound.acl.deny_and_continue" + } +} +actions { + preamble { + id: 25364446 + name: "dash_ingress.outbound.route_vnet" + alias: "route_vnet" + } + params { + id: 1 + name: "dst_vnet_id" + bitwidth: 16 + } +} +actions { + preamble { + id: 31116088 + name: "dash_ingress.outbound.route_vnet_direct" + alias: "route_vnet_direct" + } + params { + id: 1 + name: "dst_vnet_id" + bitwidth: 16 + } + params { + id: 2 + name: "is_overlay_ip_v4_or_v6" + bitwidth: 1 + } + params { + id: 3 + name: "overlay_ip" + bitwidth: 128 + } +} +actions { + preamble { + id: 22900588 + name: "dash_ingress.outbound.route_direct" + alias: "route_direct" + } +} +actions { + preamble { + id: 33407636 + name: "dash_ingress.outbound.drop" + alias: "drop" + } +} +actions { + preamble { + id: 25450412 + name: "dash_ingress.outbound.set_tunnel_mapping" + alias: "set_tunnel_mapping" + } + params { + id: 1 + name: "underlay_dip" + bitwidth: 32 + } + params { + id: 2 + name: "overlay_dmac" + bitwidth: 48 + } + params { + id: 3 + name: "use_dst_vnet_vni" + bitwidth: 1 + } +} +actions { + preamble { + id: 17187022 + name: "dash_ingress.outbound.set_vnet_attrs" + alias: "set_vnet_attrs" + } + params { + id: 1 + name: "vni" + bitwidth: 24 + } +} +actions { + preamble { + id: 32161567 + name: "dash_ingress.inbound.acl.permit" + alias: "inbound.acl.permit" + } +} +actions { + preamble { + id: 20706700 + name: "dash_ingress.inbound.acl.permit_and_continue" + alias: "inbound.acl.permit_and_continue" + } +} +actions { + preamble { + id: 28146588 + name: "dash_ingress.inbound.acl.deny" + alias: "inbound.acl.deny" + } +} +actions { + preamble { + id: 31424218 + name: "dash_ingress.inbound.acl.deny_and_continue" + alias: "inbound.acl.deny_and_continue" + } +} +actions { + preamble { + id: 17483495 + name: "dash_ingress.drop_action" + alias: "drop_action" + } +} +actions { + preamble { + id: 23563653 + name: "dash_ingress.deny" + alias: "dash_ingress.deny" + } +} +actions { + preamble { + id: 26041632 + name: "dash_ingress.accept" + alias: "accept" + } +} +actions { + preamble { + id: 21912829 + name: "dash_ingress.set_outbound_direction" + alias: "set_outbound_direction" + } +} +actions { + preamble { + id: 20977739 + name: "dash_ingress.set_inbound_direction" + alias: "set_inbound_direction" + } +} +actions { + preamble { + id: 21793905 + name: "dash_ingress.set_appliance" + alias: "set_appliance" + } + params { + id: 1 + name: "neighbor_mac" + bitwidth: 48 + } + params { + id: 2 + name: "mac" + bitwidth: 48 + } +} +actions { + preamble { + id: 27167550 + name: "dash_ingress.set_eni_attrs" + alias: "set_eni_attrs" + } + params { + id: 1 + name: "cps" + bitwidth: 32 + } + params { + id: 2 + name: "pps" + bitwidth: 32 + } + params { + id: 3 + name: "flows" + bitwidth: 32 + } + params { + id: 4 + name: "admin_state" + bitwidth: 1 + } + params { + id: 5 + name: "vm_underlay_dip" + bitwidth: 32 + } + params { + id: 6 + name: "vm_vni" + bitwidth: 24 + } + params { + id: 7 + name: "vnet_id" + bitwidth: 16 + } + params { + id: 8 + name: "inbound_v4_stage1_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 9 + name: "inbound_v4_stage2_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 10 + name: "inbound_v4_stage3_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 11 + name: "inbound_v4_stage4_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 12 + name: "inbound_v4_stage5_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 13 + name: "inbound_v6_stage1_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 14 + name: "inbound_v6_stage2_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 15 + name: "inbound_v6_stage3_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 16 + name: "inbound_v6_stage4_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 17 + name: "inbound_v6_stage5_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 18 + name: "outbound_v4_stage1_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 19 + name: "outbound_v4_stage2_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 20 + name: "outbound_v4_stage3_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 21 + name: "outbound_v4_stage4_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 22 + name: "outbound_v4_stage5_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 23 + name: "outbound_v6_stage1_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 24 + name: "outbound_v6_stage2_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 25 + name: "outbound_v6_stage3_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 26 + name: "outbound_v6_stage4_dash_acl_group_id" + bitwidth: 16 + } + params { + id: 27 + name: "outbound_v6_stage5_dash_acl_group_id" + bitwidth: 16 + } +} +actions { + preamble { + id: 32591400 + name: "dash_ingress.permit" + alias: "dash_ingress.permit" + } +} +actions { + preamble { + id: 22711915 + name: "dash_ingress.vxlan_decap_pa_validate" + alias: "vxlan_decap_pa_validate" + } + params { + id: 1 + name: "src_vnet_id" + bitwidth: 16 + } +} +actions { + preamble { + id: 18228884 + name: "dash_ingress.set_eni" + alias: "set_eni" + } + params { + id: 1 + name: "eni_id" + bitwidth: 16 + } +} +actions { + preamble { + id: 25655048 + name: "dash_ingress.set_acl_group_attrs" + alias: "set_acl_group_attrs" + } + params { + id: 1 + name: "ip_addr_family" + bitwidth: 32 + } +} +direct_counters { + preamble { + id: 324963620 + name: "dash_ingress.outbound.acl.stage1_counter" + alias: "outbound.acl.stage1_counter" + } + spec { + unit: BOTH + } + direct_table_id: 33810473 +} +direct_counters { + preamble { + id: 334749261 + name: "dash_ingress.outbound.acl.stage2_counter" + alias: "outbound.acl.stage2_counter" + } + spec { + unit: BOTH + } + direct_table_id: 49812549 +} +direct_counters { + preamble { + id: 320450761 + name: "dash_ingress.outbound.acl.stage3_counter" + alias: "outbound.acl.stage3_counter" + } + spec { + unit: BOTH + } + direct_table_id: 40782112 +} +direct_counters { + preamble { + id: 329571213 + name: "dash_ingress.outbound.routing_counter" + alias: "routing_counter" + } + spec { + unit: BOTH + } + direct_table_id: 42788937 +} +direct_counters { + preamble { + id: 321828795 + name: "dash_ingress.outbound.ca_to_pa_counter" + alias: "ca_to_pa_counter" + } + spec { + unit: BOTH + } + direct_table_id: 48860231 +} +direct_counters { + preamble { + id: 320981527 + name: "dash_ingress.inbound.acl.stage1_counter" + alias: "inbound.acl.stage1_counter" + } + spec { + unit: BOTH + } + direct_table_id: 33901322 +} +direct_counters { + preamble { + id: 322865948 + name: "dash_ingress.inbound.acl.stage2_counter" + alias: "inbound.acl.stage2_counter" + } + spec { + unit: BOTH + } + direct_table_id: 44184066 +} +direct_counters { + preamble { + id: 328370481 + name: "dash_ingress.inbound.acl.stage3_counter" + alias: "inbound.acl.stage3_counter" + } + spec { + unit: BOTH + } + direct_table_id: 46150034 +} +direct_counters { + preamble { + id: 322696367 + name: "dash_ingress.eni_counter" + alias: "eni_counter" + } + spec { + unit: BOTH + } + direct_table_id: 40418231 +} +type_info { + serializable_enums { + key: "direction_t" + value { + underlying_type { + bitwidth: 16 + } + members { + name: "INVALID" + value: "\000\000" + } + members { + name: "OUTBOUND" + value: "\000\001" + } + members { + name: "INBOUND" + value: "\000\002" + } + } + } +} From 64c1df67166f06955426ec2bc267b14f4fe69c10 Mon Sep 17 00:00:00 2001 From: fruffy Date: Mon, 13 Feb 2023 08:29:26 -0500 Subject: [PATCH 3/6] Xfails. --- .../modules/testgen/targets/bmv2/test/BMV2PTFXfail.cmake | 2 ++ .../p4tools/modules/testgen/targets/bmv2/test/BMV2Xfail.cmake | 2 ++ 2 files changed, 4 insertions(+) diff --git a/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2PTFXfail.cmake b/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2PTFXfail.cmake index 6b4f94ca318..829821ce3bc 100644 --- a/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2PTFXfail.cmake +++ b/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2PTFXfail.cmake @@ -265,6 +265,8 @@ p4tools_add_xfail_reason( # At index 0: INVALID_ARGUMENT, 'Bytestring provided does not fit within 0 bits' pins_middleblock.p4 issue2283_1-bmv2.p4 + # INVALID_ARGUMENT, 'Zero priority for ternary match' + dash-pipeline.p4 ) p4tools_add_xfail_reason( diff --git a/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2Xfail.cmake b/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2Xfail.cmake index 0f93fbfd713..513fba87610 100644 --- a/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2Xfail.cmake +++ b/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2Xfail.cmake @@ -56,6 +56,8 @@ p4tools_add_xfail_reason( "Exception" # Running simple_switch_CLI: Exception Unexpected key field & match-on-exprs2-bmv2.p4 + # Running simple_switch_CLI: Exception Unexpected key field : + dash-pipeline.p4 ) p4tools_add_xfail_reason( From b921bbde8e7627af2974031d27a2d9ea27bd6e65 Mon Sep 17 00:00:00 2001 From: fruffy Date: Thu, 16 Feb 2023 12:06:39 -0500 Subject: [PATCH 4/6] Simple approach? --- frontends/p4/inlining.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontends/p4/inlining.cpp b/frontends/p4/inlining.cpp index 390518adb6a..e54ee0ec8a2 100644 --- a/frontends/p4/inlining.cpp +++ b/frontends/p4/inlining.cpp @@ -203,7 +203,10 @@ class ComputeNewNames : public Inspector { extName = name; else extName = prefix + "." + name; + // Replace illegal characters with an underscore. cstring baseName = extName.replace('.', '_'); + baseName = baseName.replace(':', '_'); + baseName = baseName.replace('|', '_'); cstring newName = refMap->newName(baseName); renameMap->setNewName(decl, newName, extName); } From 3ba48e6fba88ef4df698a6e7355aa58465a91976 Mon Sep 17 00:00:00 2001 From: fruffy Date: Fri, 24 Feb 2023 15:11:43 -0500 Subject: [PATCH 5/6] Fix. --- frontends/p4/inlining.cpp | 17 ++++----- .../dash/dash-pipeline-frontend.p4 | 36 +++++++++---------- .../dash/dash-pipeline-midend.p4 | 36 +++++++++---------- 3 files changed, 45 insertions(+), 44 deletions(-) diff --git a/frontends/p4/inlining.cpp b/frontends/p4/inlining.cpp index e54ee0ec8a2..e36f222d7f1 100644 --- a/frontends/p4/inlining.cpp +++ b/frontends/p4/inlining.cpp @@ -198,17 +198,18 @@ class ComputeNewNames : public Inspector { BUG_CHECK(decl->is(), "%1%: no annotations", decl); cstring name = decl->externalName(); cstring extName; - if (name.startsWith(".")) + if (name.startsWith(".")) { // Do not change the external name of objects starting with a leading dot extName = name; - else + } else { extName = prefix + "." + name; - // Replace illegal characters with an underscore. - cstring baseName = extName.replace('.', '_'); - baseName = baseName.replace(':', '_'); - baseName = baseName.replace('|', '_'); - cstring newName = refMap->newName(baseName); - renameMap->setNewName(decl, newName, extName); + } + // Replace non-alphanumeric characters with an underscore. + std::string baseName = extName.c_str(); + std::replace_if( + baseName.begin(), baseName.end(), + [](char ch) { return (::isalnum(ch) == 0) && ch != '_'; }, '_'); + renameMap->setNewName(decl, refMap->newName(baseName), extName); } void postorder(const IR::P4Table *table) override { rename(table); } void postorder(const IR::P4ValueSet *set) override { rename(set); } diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 b/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 index 77f6085af63..24646a834a1 100644 --- a/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 @@ -467,7 +467,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ meta.dropped = true; } @name("dash_ingress.outbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage1_counter; - @name("dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl") table outbound_acl_stage1:dash_acl_rule|dash_acl { + @name("dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl") table outbound_acl_stage1_dash_acl_rule_dash_acl { key = { meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); @@ -486,7 +486,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ counters = outbound_acl_stage1_counter; } @name("dash_ingress.outbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage2_counter; - @name("dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl") table outbound_acl_stage2:dash_acl_rule|dash_acl { + @name("dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl") table outbound_acl_stage2_dash_acl_rule_dash_acl { key = { meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); @@ -505,7 +505,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ counters = outbound_acl_stage2_counter; } @name("dash_ingress.outbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage3_counter; - @name("dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl") table outbound_acl_stage3:dash_acl_rule|dash_acl { + @name("dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl") table outbound_acl_stage3_dash_acl_rule_dash_acl { key = { meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); @@ -540,7 +540,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ meta.dropped = true; } @name("dash_ingress.outbound.routing_counter") direct_counter(CounterType.packets_and_bytes) outbound_routing_counter; - @name("dash_ingress.outbound.outbound_routing|dash_outbound_routing") table outbound_outbound_routing|dash_outbound_routing { + @name("dash_ingress.outbound.outbound_routing|dash_outbound_routing") table outbound_outbound_routing_dash_outbound_routing { key = { meta.eni_id : exact @name("meta.eni_id:eni_id"); meta.is_overlay_ip_v6: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); @@ -563,7 +563,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ meta.encap_data.underlay_dip = underlay_dip_4; } @name("dash_ingress.outbound.ca_to_pa_counter") direct_counter(CounterType.packets_and_bytes) outbound_ca_to_pa_counter; - @name("dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa") table outbound_outbound_ca_to_pa|dash_outbound_ca_to_pa { + @name("dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa") table outbound_outbound_ca_to_pa_dash_outbound_ca_to_pa { key = { meta.dst_vnet_id : exact @name("meta.dst_vnet_id:dst_vnet_id"); meta.is_lkup_dst_ip_v6: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); @@ -579,7 +579,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ @name("dash_ingress.outbound.set_vnet_attrs") action outbound_set_vnet_attrs_0(@name("vni") bit<24> vni_4) { meta.encap_data.vni = vni_4; } - @name("dash_ingress.outbound.vnet|dash_vnet") table outbound_vnet|dash_vnet { + @name("dash_ingress.outbound.vnet|dash_vnet") table outbound_vnet_dash_vnet { key = { meta.vnet_id: exact @name("meta.vnet_id:vnet_id"); } @@ -620,7 +620,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ meta.dropped = true; } @name("dash_ingress.inbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage1_counter; - @name("dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl") table inbound_acl_stage1:dash_acl_rule|dash_acl { + @name("dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl") table inbound_acl_stage1_dash_acl_rule_dash_acl { key = { meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); @@ -639,7 +639,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ counters = inbound_acl_stage1_counter; } @name("dash_ingress.inbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage2_counter; - @name("dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl") table inbound_acl_stage2:dash_acl_rule|dash_acl { + @name("dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl") table inbound_acl_stage2_dash_acl_rule_dash_acl { key = { meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); @@ -658,7 +658,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ counters = inbound_acl_stage2_counter; } @name("dash_ingress.inbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage3_counter; - @name("dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl") table inbound_acl_stage3:dash_acl_rule|dash_acl { + @name("dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl") table inbound_acl_stage3_dash_acl_rule_dash_acl { key = { meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); @@ -917,7 +917,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } else { outbound_acl_hasReturned = false; if (meta.stage1_dash_acl_group_id != 16w0) { - switch (outbound_acl_stage1:dash_acl_rule|dash_acl.apply().action_run) { + switch (outbound_acl_stage1_dash_acl_rule_dash_acl.apply().action_run) { outbound_acl_permit_0: { outbound_acl_hasReturned = true; } @@ -931,7 +931,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ if (outbound_acl_hasReturned) { ; } else if (meta.stage2_dash_acl_group_id != 16w0) { - switch (outbound_acl_stage2:dash_acl_rule|dash_acl.apply().action_run) { + switch (outbound_acl_stage2_dash_acl_rule_dash_acl.apply().action_run) { outbound_acl_permit_1: { outbound_acl_hasReturned = true; } @@ -945,7 +945,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ if (outbound_acl_hasReturned) { ; } else if (meta.stage3_dash_acl_group_id != 16w0) { - switch (outbound_acl_stage3:dash_acl_rule|dash_acl.apply().action_run) { + switch (outbound_acl_stage3_dash_acl_rule_dash_acl.apply().action_run) { outbound_acl_permit_2: { } outbound_acl_deny_2: { @@ -957,11 +957,11 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } meta.lkup_dst_ip_addr = meta.dst_ip_addr; meta.is_lkup_dst_ip_v6 = meta.is_overlay_ip_v6; - switch (outbound_outbound_routing|dash_outbound_routing.apply().action_run) { + switch (outbound_outbound_routing_dash_outbound_routing.apply().action_run) { outbound_route_vnet_direct_0: outbound_route_vnet_0: { - outbound_outbound_ca_to_pa|dash_outbound_ca_to_pa.apply(); - outbound_vnet|dash_vnet.apply(); + outbound_outbound_ca_to_pa_dash_outbound_ca_to_pa.apply(); + outbound_vnet_dash_vnet.apply(); vxlan_encap_1(); } default: { @@ -973,7 +973,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } else { inbound_acl_hasReturned = false; if (meta.stage1_dash_acl_group_id != 16w0) { - switch (inbound_acl_stage1:dash_acl_rule|dash_acl.apply().action_run) { + switch (inbound_acl_stage1_dash_acl_rule_dash_acl.apply().action_run) { inbound_acl_permit_0: { inbound_acl_hasReturned = true; } @@ -987,7 +987,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ if (inbound_acl_hasReturned) { ; } else if (meta.stage2_dash_acl_group_id != 16w0) { - switch (inbound_acl_stage2:dash_acl_rule|dash_acl.apply().action_run) { + switch (inbound_acl_stage2_dash_acl_rule_dash_acl.apply().action_run) { inbound_acl_permit_1: { inbound_acl_hasReturned = true; } @@ -1001,7 +1001,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ if (inbound_acl_hasReturned) { ; } else if (meta.stage3_dash_acl_group_id != 16w0) { - switch (inbound_acl_stage3:dash_acl_rule|dash_acl.apply().action_run) { + switch (inbound_acl_stage3_dash_acl_rule_dash_acl.apply().action_run) { inbound_acl_permit_2: { } inbound_acl_deny_2: { diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 b/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 index 5c2d21e15b6..cd31a871990 100644 --- a/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 @@ -557,7 +557,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ meta._dropped0 = true; } @name("dash_ingress.outbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage1_counter; - @name("dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl") table outbound_acl_stage1:dash_acl_rule|dash_acl { + @name("dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl") table outbound_acl_stage1_dash_acl_rule_dash_acl { key = { meta._stage1_dash_acl_group_id29: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); @@ -576,7 +576,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ counters = outbound_acl_stage1_counter; } @name("dash_ingress.outbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage2_counter; - @name("dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl") table outbound_acl_stage2:dash_acl_rule|dash_acl { + @name("dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl") table outbound_acl_stage2_dash_acl_rule_dash_acl { key = { meta._stage2_dash_acl_group_id30: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); @@ -595,7 +595,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ counters = outbound_acl_stage2_counter; } @name("dash_ingress.outbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage3_counter; - @name("dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl") table outbound_acl_stage3:dash_acl_rule|dash_acl { + @name("dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl") table outbound_acl_stage3_dash_acl_rule_dash_acl { key = { meta._stage3_dash_acl_group_id31: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); @@ -630,7 +630,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ meta._dropped0 = true; } @name("dash_ingress.outbound.routing_counter") direct_counter(CounterType.packets_and_bytes) outbound_routing_counter; - @name("dash_ingress.outbound.outbound_routing|dash_outbound_routing") table outbound_outbound_routing|dash_outbound_routing { + @name("dash_ingress.outbound.outbound_routing|dash_outbound_routing") table outbound_outbound_routing_dash_outbound_routing { key = { meta._eni_id12 : exact @name("meta.eni_id:eni_id"); meta._is_overlay_ip_v619: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); @@ -651,7 +651,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ meta._encap_data_underlay_dip5 = underlay_dip_4; } @name("dash_ingress.outbound.ca_to_pa_counter") direct_counter(CounterType.packets_and_bytes) outbound_ca_to_pa_counter; - @name("dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa") table outbound_outbound_ca_to_pa|dash_outbound_ca_to_pa { + @name("dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa") table outbound_outbound_ca_to_pa_dash_outbound_ca_to_pa { key = { meta._dst_vnet_id11 : exact @name("meta.dst_vnet_id:dst_vnet_id"); meta._is_lkup_dst_ip_v620: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); @@ -667,7 +667,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ @name("dash_ingress.outbound.set_vnet_attrs") action outbound_set_vnet_attrs_0(@name("vni") bit<24> vni_4) { meta._encap_data_vni2 = vni_4; } - @name("dash_ingress.outbound.vnet|dash_vnet") table outbound_vnet|dash_vnet { + @name("dash_ingress.outbound.vnet|dash_vnet") table outbound_vnet_dash_vnet { key = { meta._vnet_id10: exact @name("meta.vnet_id:vnet_id"); } @@ -708,7 +708,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ meta._dropped0 = true; } @name("dash_ingress.inbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage1_counter; - @name("dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl") table inbound_acl_stage1:dash_acl_rule|dash_acl { + @name("dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl") table inbound_acl_stage1_dash_acl_rule_dash_acl { key = { meta._stage1_dash_acl_group_id29: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); @@ -727,7 +727,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ counters = inbound_acl_stage1_counter; } @name("dash_ingress.inbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage2_counter; - @name("dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl") table inbound_acl_stage2:dash_acl_rule|dash_acl { + @name("dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl") table inbound_acl_stage2_dash_acl_rule_dash_acl { key = { meta._stage2_dash_acl_group_id30: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); @@ -746,7 +746,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ counters = inbound_acl_stage2_counter; } @name("dash_ingress.inbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage3_counter; - @name("dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl") table inbound_acl_stage3:dash_acl_rule|dash_acl { + @name("dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl") table inbound_acl_stage3_dash_acl_rule_dash_acl { key = { meta._stage3_dash_acl_group_id31: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); @@ -1228,7 +1228,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } else { tbl_act.apply(); if (meta._stage1_dash_acl_group_id29 != 16w0) { - switch (outbound_acl_stage1:dash_acl_rule|dash_acl.apply().action_run) { + switch (outbound_acl_stage1_dash_acl_rule_dash_acl.apply().action_run) { outbound_acl_permit_0: { tbl_dashpipeline390.apply(); } @@ -1242,7 +1242,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ if (outbound_acl_hasReturned) { ; } else if (meta._stage2_dash_acl_group_id30 != 16w0) { - switch (outbound_acl_stage2:dash_acl_rule|dash_acl.apply().action_run) { + switch (outbound_acl_stage2_dash_acl_rule_dash_acl.apply().action_run) { outbound_acl_permit_1: { tbl_dashpipeline400.apply(); } @@ -1256,7 +1256,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ if (outbound_acl_hasReturned) { ; } else if (meta._stage3_dash_acl_group_id31 != 16w0) { - switch (outbound_acl_stage3:dash_acl_rule|dash_acl.apply().action_run) { + switch (outbound_acl_stage3_dash_acl_rule_dash_acl.apply().action_run) { outbound_acl_permit_2: { } outbound_acl_deny_2: { @@ -1267,11 +1267,11 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } } tbl_dashpipeline486.apply(); - switch (outbound_outbound_routing|dash_outbound_routing.apply().action_run) { + switch (outbound_outbound_routing_dash_outbound_routing.apply().action_run) { outbound_route_vnet_direct_0: outbound_route_vnet_0: { - outbound_outbound_ca_to_pa|dash_outbound_ca_to_pa.apply(); - outbound_vnet|dash_vnet.apply(); + outbound_outbound_ca_to_pa_dash_outbound_ca_to_pa.apply(); + outbound_vnet_dash_vnet.apply(); tbl_vxlan_encap.apply(); } default: { @@ -1283,7 +1283,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } else { tbl_act_0.apply(); if (meta._stage1_dash_acl_group_id29 != 16w0) { - switch (inbound_acl_stage1:dash_acl_rule|dash_acl.apply().action_run) { + switch (inbound_acl_stage1_dash_acl_rule_dash_acl.apply().action_run) { inbound_acl_permit_0: { tbl_dashpipeline390_0.apply(); } @@ -1297,7 +1297,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ if (inbound_acl_hasReturned) { ; } else if (meta._stage2_dash_acl_group_id30 != 16w0) { - switch (inbound_acl_stage2:dash_acl_rule|dash_acl.apply().action_run) { + switch (inbound_acl_stage2_dash_acl_rule_dash_acl.apply().action_run) { inbound_acl_permit_1: { tbl_dashpipeline400_0.apply(); } @@ -1311,7 +1311,7 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ if (inbound_acl_hasReturned) { ; } else if (meta._stage3_dash_acl_group_id31 != 16w0) { - switch (inbound_acl_stage3:dash_acl_rule|dash_acl.apply().action_run) { + switch (inbound_acl_stage3_dash_acl_rule_dash_acl.apply().action_run) { inbound_acl_permit_2: { } inbound_acl_deny_2: { From 40862ad5fe68477a366281564fbdfd15a4f77a39 Mon Sep 17 00:00:00 2001 From: fruffy Date: Tue, 28 Feb 2023 15:46:48 -0500 Subject: [PATCH 6/6] Add an example P4 program with unusual table name annotations. --- .git-blame-ignore-revs | 2 + .../testgen/targets/bmv2/test/BMV2Xfail.cmake | 6 +- .../nonstandard_table_names-bmv2.p4 | 113 +++++++++++++++ .../nonstandard_table_names-bmv2-first.p4 | 119 ++++++++++++++++ .../nonstandard_table_names-bmv2-frontend.p4 | 131 ++++++++++++++++++ .../nonstandard_table_names-bmv2-midend.p4 | 131 ++++++++++++++++++ .../nonstandard_table_names-bmv2.p4 | 113 +++++++++++++++ .../nonstandard_table_names-bmv2.p4-stderr | 0 ...onstandard_table_names-bmv2.p4.entries.txt | 0 ...nonstandard_table_names-bmv2.p4.p4info.txt | 120 ++++++++++++++++ 10 files changed, 733 insertions(+), 2 deletions(-) create mode 100644 testdata/p4_16_samples/nonstandard_table_names-bmv2.p4 create mode 100644 testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-first.p4 create mode 100644 testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-frontend.p4 create mode 100644 testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-midend.p4 create mode 100644 testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4 create mode 100644 testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4-stderr create mode 100644 testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4.entries.txt create mode 100644 testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4.p4info.txt diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 99d28696884..adcb750e9c1 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -5,3 +5,5 @@ e26a49dbf5749ee92585cec9e95ca781d377ebfd # clang-format ir and lib folder. 7a722a3fb8205c57d7e9554fc7c62c2629720d5a +# Switched from left to right pointer alignment. +f1181a071844f759b618ed3c894cf56e2df1dd05 diff --git a/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2Xfail.cmake b/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2Xfail.cmake index 513fba87610..a517f3bddf4 100644 --- a/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2Xfail.cmake +++ b/backends/p4tools/modules/testgen/targets/bmv2/test/BMV2Xfail.cmake @@ -54,10 +54,12 @@ p4tools_add_xfail_reason( p4tools_add_xfail_reason( "testgen-p4c-bmv2" "Exception" - # Running simple_switch_CLI: Exception Unexpected key field & + # Running simple_switch_CLI: Exception Unexpected key field & match-on-exprs2-bmv2.p4 - # Running simple_switch_CLI: Exception Unexpected key field : + # Running simple_switch_CLI: Exception Unexpected key field : dash-pipeline.p4 + # Could not find table + nonstandard_table_names-bmv2.p4 ) p4tools_add_xfail_reason( diff --git a/testdata/p4_16_samples/nonstandard_table_names-bmv2.p4 b/testdata/p4_16_samples/nonstandard_table_names-bmv2.p4 new file mode 100644 index 00000000000..decbcbb6845 --- /dev/null +++ b/testdata/p4_16_samples/nonstandard_table_names-bmv2.p4 @@ -0,0 +1,113 @@ +#include +#include + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta {} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, inout standard_metadata_t sm) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + + +control tables(inout Headers h, inout Meta m, inout standard_metadata_t s) { + action increment() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 1; + } + + @name("prefix|simple_table_1") + table simple_table_1 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction; + increment; + } + } + @name("@prefix@simple_table_2") + table simple_table_2 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name") ; + } + actions = { + NoAction; + increment; + } + } + @name("<>]{]prefix/simple_table_3") + table simple_table_3 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name") ; + } + actions = { + NoAction; + increment; + } + } + @name("!@#$%^&*()_+=-prefix^simple_table_1") + table simple_table_4 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name") ; + } + actions = { + NoAction; + increment; + } + } + @name("prefix◕‿◕😀ツsimple_table_1") + table simple_table_5 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name") ; + } + actions = { + NoAction; + increment; + } + } + + apply { + simple_table_1.apply(); + simple_table_2.apply(); + simple_table_3.apply(); + simple_table_4.apply(); + simple_table_5.apply(); + } +} + + +control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { + + apply { + tables.apply(h, m, sm); + } +} + +control vrfy(inout Headers h, inout Meta m) { apply {} } + +control update(inout Headers h, inout Meta m) { apply {} } + +control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { apply {} } + +control deparser(packet_out pkt, in Headers h) { + apply { + pkt.emit(h); + } +} + +V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; + diff --git a/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-first.p4 b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-first.p4 new file mode 100644 index 00000000000..bf4f00cf4e4 --- /dev/null +++ b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-first.p4 @@ -0,0 +1,119 @@ +#include +#define V1MODEL_VERSION 20180101 +#include + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, inout standard_metadata_t sm) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +control tables(inout Headers h, inout Meta m, inout standard_metadata_t s) { + action increment() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("prefix|simple_table_1") table simple_table_1 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction(); + increment(); + } + default_action = NoAction(); + } + @name("@prefix@simple_table_2") table simple_table_2 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction(); + increment(); + } + default_action = NoAction(); + } + @name("<>]{]prefix/simple_table_3") table simple_table_3 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction(); + increment(); + } + default_action = NoAction(); + } + @name("!@#$%^&*()_+=-prefix^simple_table_1") table simple_table_4 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction(); + increment(); + } + default_action = NoAction(); + } + @name("prefix◕‿◕😀ツsimple_table_1") table simple_table_5 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction(); + increment(); + } + default_action = NoAction(); + } + apply { + simple_table_1.apply(); + simple_table_2.apply(); + simple_table_3.apply(); + simple_table_4.apply(); + simple_table_5.apply(); + } +} + +control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { + @name("tables") tables() tables_inst; + apply { + tables_inst.apply(h, m, sm); + } +} + +control vrfy(inout Headers h, inout Meta m) { + apply { + } +} + +control update(inout Headers h, inout Meta m) { + apply { + } +} + +control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { + apply { + } +} + +control deparser(packet_out pkt, in Headers h) { + apply { + pkt.emit(h); + } +} + +V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; diff --git a/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-frontend.p4 b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-frontend.p4 new file mode 100644 index 00000000000..dba8cc8f42c --- /dev/null +++ b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-frontend.p4 @@ -0,0 +1,131 @@ +#include +#define V1MODEL_VERSION 20180101 +#include + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, inout standard_metadata_t sm) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @noWarn("unused") @name(".NoAction") action NoAction_2() { + } + @noWarn("unused") @name(".NoAction") action NoAction_3() { + } + @noWarn("unused") @name(".NoAction") action NoAction_4() { + } + @noWarn("unused") @name(".NoAction") action NoAction_5() { + } + @name("ingress.tables.increment") action tables_increment_0() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("ingress.tables.increment") action tables_increment_1() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("ingress.tables.increment") action tables_increment_2() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("ingress.tables.increment") action tables_increment_3() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("ingress.tables.increment") action tables_increment_4() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("ingress.tables.prefix|simple_table_1") table tables_prefix_simple_table { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction_1(); + tables_increment_0(); + } + default_action = NoAction_1(); + } + @name("ingress.tables.@prefix@simple_table_2") table tables__prefix_simple_table { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction_2(); + tables_increment_1(); + } + default_action = NoAction_2(); + } + @name("ingress.tables.<>]{]prefix/simple_table_3") table tables______prefix_simple_table { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction_3(); + tables_increment_2(); + } + default_action = NoAction_3(); + } + @name("ingress.tables.!@#$%^&*()_+=-prefix^simple_table_1") table tables_______________prefix_simple_table { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction_4(); + tables_increment_3(); + } + default_action = NoAction_4(); + } + @name("ingress.tables.prefix◕‿◕😀ツsimple_table_1") table tables_prefix________________simple_table { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction_5(); + tables_increment_4(); + } + default_action = NoAction_5(); + } + apply { + tables_prefix_simple_table.apply(); + tables__prefix_simple_table.apply(); + tables______prefix_simple_table.apply(); + tables_______________prefix_simple_table.apply(); + tables_prefix________________simple_table.apply(); + } +} + +control vrfy(inout Headers h, inout Meta m) { + apply { + } +} + +control update(inout Headers h, inout Meta m) { + apply { + } +} + +control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { + apply { + } +} + +control deparser(packet_out pkt, in Headers h) { + apply { + pkt.emit(h); + } +} + +V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; diff --git a/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-midend.p4 b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-midend.p4 new file mode 100644 index 00000000000..3f35b7844dd --- /dev/null +++ b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2-midend.p4 @@ -0,0 +1,131 @@ +#include +#define V1MODEL_VERSION 20180101 +#include + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, inout standard_metadata_t sm) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @noWarn("unused") @name(".NoAction") action NoAction_2() { + } + @noWarn("unused") @name(".NoAction") action NoAction_3() { + } + @noWarn("unused") @name(".NoAction") action NoAction_4() { + } + @noWarn("unused") @name(".NoAction") action NoAction_5() { + } + @name("ingress.tables.increment") action tables_increment_0() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("ingress.tables.increment") action tables_increment_1() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("ingress.tables.increment") action tables_increment_2() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("ingress.tables.increment") action tables_increment_3() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("ingress.tables.increment") action tables_increment_4() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 48w1; + } + @name("ingress.tables.prefix|simple_table_1") table tables_prefix_simple_table { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction_1(); + tables_increment_0(); + } + default_action = NoAction_1(); + } + @name("ingress.tables.@prefix@simple_table_2") table tables__prefix_simple_table { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction_2(); + tables_increment_1(); + } + default_action = NoAction_2(); + } + @name("ingress.tables.<>]{]prefix/simple_table_3") table tables______prefix_simple_table { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction_3(); + tables_increment_2(); + } + default_action = NoAction_3(); + } + @name("ingress.tables.!@#$%^&*()_+=-prefix^simple_table_1") table tables_______________prefix_simple_table { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction_4(); + tables_increment_3(); + } + default_action = NoAction_4(); + } + @name("ingress.tables.prefix◕‿◕😀ツsimple_table_1") table tables_prefix________________simple_table { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction_5(); + tables_increment_4(); + } + default_action = NoAction_5(); + } + apply { + tables_prefix_simple_table.apply(); + tables__prefix_simple_table.apply(); + tables______prefix_simple_table.apply(); + tables_______________prefix_simple_table.apply(); + tables_prefix________________simple_table.apply(); + } +} + +control vrfy(inout Headers h, inout Meta m) { + apply { + } +} + +control update(inout Headers h, inout Meta m) { + apply { + } +} + +control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { + apply { + } +} + +control deparser(packet_out pkt, in Headers h) { + apply { + pkt.emit(h.eth_hdr); + } +} + +V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; diff --git a/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4 b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4 new file mode 100644 index 00000000000..2bbaed5249d --- /dev/null +++ b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4 @@ -0,0 +1,113 @@ +#include +#define V1MODEL_VERSION 20180101 +#include + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, inout standard_metadata_t sm) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +control tables(inout Headers h, inout Meta m, inout standard_metadata_t s) { + action increment() { + h.eth_hdr.dst_addr = h.eth_hdr.dst_addr + 1; + } + @name("prefix|simple_table_1") table simple_table_1 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction; + increment; + } + } + @name("@prefix@simple_table_2") table simple_table_2 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction; + increment; + } + } + @name("<>]{]prefix/simple_table_3") table simple_table_3 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction; + increment; + } + } + @name("!@#$%^&*()_+=-prefix^simple_table_1") table simple_table_4 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction; + increment; + } + } + @name("prefix◕‿◕😀ツsimple_table_1") table simple_table_5 { + key = { + h.eth_hdr.eth_type: exact @name("dummy_name"); + } + actions = { + NoAction; + increment; + } + } + apply { + simple_table_1.apply(); + simple_table_2.apply(); + simple_table_3.apply(); + simple_table_4.apply(); + simple_table_5.apply(); + } +} + +control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { + apply { + tables.apply(h, m, sm); + } +} + +control vrfy(inout Headers h, inout Meta m) { + apply { + } +} + +control update(inout Headers h, inout Meta m) { + apply { + } +} + +control egress(inout Headers h, inout Meta m, inout standard_metadata_t sm) { + apply { + } +} + +control deparser(packet_out pkt, in Headers h) { + apply { + pkt.emit(h); + } +} + +V1Switch(p(), vrfy(), ingress(), egress(), update(), deparser()) main; diff --git a/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4-stderr b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4.entries.txt b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4.p4info.txt b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4.p4info.txt new file mode 100644 index 00000000000..4ae855c293a --- /dev/null +++ b/testdata/p4_16_samples_outputs/nonstandard_table_names-bmv2.p4.p4info.txt @@ -0,0 +1,120 @@ +pkg_info { + arch: "v1model" +} +tables { + preamble { + id: 44010113 + name: "ingress.tables.prefix|simple_table_1" + alias: "prefix|simple_table_1" + } + match_fields { + id: 1 + name: "dummy_name" + bitwidth: 16 + match_type: EXACT + } + action_refs { + id: 21257015 + } + action_refs { + id: 24698652 + } + size: 1024 +} +tables { + preamble { + id: 46184800 + name: "ingress.tables.@prefix@simple_table_2" + alias: "@prefix@simple_table_2" + } + match_fields { + id: 1 + name: "dummy_name" + bitwidth: 16 + match_type: EXACT + } + action_refs { + id: 21257015 + } + action_refs { + id: 24698652 + } + size: 1024 +} +tables { + preamble { + id: 45435893 + name: "ingress.tables.<>]{]prefix/simple_table_3" + alias: "<>]{]prefix/simple_table_3" + } + match_fields { + id: 1 + name: "dummy_name" + bitwidth: 16 + match_type: EXACT + } + action_refs { + id: 21257015 + } + action_refs { + id: 24698652 + } + size: 1024 +} +tables { + preamble { + id: 35450577 + name: "ingress.tables.!@#$%^&*()_+=-prefix^simple_table_1" + alias: "!@#$%^&*()_+=-prefix^simple_table_1" + } + match_fields { + id: 1 + name: "dummy_name" + bitwidth: 16 + match_type: EXACT + } + action_refs { + id: 21257015 + } + action_refs { + id: 24698652 + } + size: 1024 +} +tables { + preamble { + id: 41307018 + name: "ingress.tables.prefix\342\227\225\342\200\277\342\227\225\360\237\230\200\343\203\204simple_table_1" + alias: "prefix\342\227\225\342\200\277\342\227\225\360\237\230\200\343\203\204simple_table_1" + } + match_fields { + id: 1 + name: "dummy_name" + bitwidth: 16 + match_type: EXACT + } + action_refs { + id: 21257015 + } + action_refs { + id: 24698652 + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 24698652 + name: "ingress.tables.increment" + alias: "increment" + } +} +type_info { +}