// Copyright (c) 2017, Google Inc.
//
// P4_16 specification for a VRF classifier.
// Note: This code has not been tested and is expected to contain bugs.

#ifndef P4_SPEC_VRF_P4_
#define P4_SPEC_VRF_P4_

#include "headers.p4"
#include "parser.p4"

//------------------------------------------------------------------------------
// Global defines
//------------------------------------------------------------------------------

#define DEFAULT_VRF0 0

//------------------------------------------------------------------------------
// Map traffic to a particular VRF
//------------------------------------------------------------------------------

control vrf(inout parsed_packet_t hdr, inout local_metadata_t local_metadata,
            inout standard_metadata_t standard_metadata) {

  @proto_package("vrf")
  action set_vrf(@proto_tag(1) bit<32> vrf_id) {
    local_metadata.vrf_id = vrf_id;
  }

  @proto_package("vrf")
  table vrf_classifier_table {
    key = {
      hdr.ethernet.ether_type : exact @proto_tag(1);
      hdr.ethernet.src_addr : ternary @proto_tag(2);
      hdr.ipv4_base.diffserv : ternary @proto_tag(3);
      hdr.ipv4_base.dst_addr : ternary @proto_tag(4);
      standard_metadata.ingress_port: exact @proto_tag(5);
      hdr.ipv6_base.traffic_class : ternary @proto_tag(6);
      hdr.ipv6_base.dst_addr : ternary @proto_tag(7);
    }
    actions = {
      @proto_tag(1) set_vrf;
    }
    const default_action = set_vrf(DEFAULT_VRF0);
  }

  apply {
    vrf_classifier_table.apply();
  }
} // end vrf

#endif // P4_SPEC_VRF_P4_
