| // Copyright (c) 2017, Google Inc. |
| // |
| // P4_16 specification for a Spine switch. |
| // Status: WORK IN PROGRESS |
| // Note: This code has not been tested and is expected to contain bugs. |
| |
| #include "parser.p4" |
| #include "class_id.p4" |
| #include "l3_fwd.p4" |
| #include "packetio.p4" |
| #include "punt.p4" |
| #include "vrf.p4" |
| #include "ipv4_checksum.p4" |
| |
| |
| control ingress_spine(inout parsed_packet_t hdr, |
| inout local_metadata_t local_metadata, |
| inout standard_metadata_t standard_metadata) { |
| apply { |
| if (hdr.packet_out.isValid()) { |
| packetio_ingress.apply(hdr, local_metadata, standard_metadata); |
| } |
| vrf.apply(hdr, local_metadata, standard_metadata); |
| class_id.apply(hdr, local_metadata, standard_metadata); |
| l3_fwd.apply(hdr, local_metadata, standard_metadata); |
| punt.apply(hdr, local_metadata, standard_metadata); |
| } |
| } // end ingress_spine |
| |
| control egress_spine(inout parsed_packet_t hdr, |
| inout local_metadata_t local_metadata, |
| inout standard_metadata_t standard_metadata) { |
| apply { |
| packetio_egress.apply(hdr, local_metadata, standard_metadata); |
| } |
| } // end egress_spine |
| |
| V1Switch(pkt_parser(), verify_checksum(), ingress_spine(), egress_spine(), |
| compute_checksum(), pkt_deparser()) main; |