Added tor.p4 to p4src

Change-Id: I8c3a02dee76cbe45e0f9a4f7ca1f93a6f1d8a016
diff --git a/tools/test/p4src/tor/vrf.p4 b/tools/test/p4src/tor/vrf.p4
new file mode 100644
index 0000000..0441f1c
--- /dev/null
+++ b/tools/test/p4src/tor/vrf.p4
@@ -0,0 +1,52 @@
+// 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_