Skip to content

Commit

Permalink
[P4Testgen] Introduce a new Protobuf backend which uses P4 PDPI inste…
Browse files Browse the repository at this point in the history
…ad of P4Runtime (#4221)

* Implement the Protobuf IR BMv2 back end.

* Add Bazel rules for completeness.

* Review comments.
  • Loading branch information
fruffy-g committed Nov 30, 2023
1 parent ecc08c5 commit 4fe8934
Show file tree
Hide file tree
Showing 14 changed files with 1,336 additions and 124 deletions.
35 changes: 35 additions & 0 deletions backends/p4tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,41 @@ filegroup(
visibility = ["//visibility:public"], # So p4c can compile these.
)

proto_library(
name = "ir_proto",
srcs = ["modules/testgen/targets/bmv2/proto/ir.proto"],
deps = [
"@com_github_p4lang_p4runtime//:p4info_proto",
"@com_github_p4lang_p4runtime//:p4runtime_proto",
"@com_google_googleapis//google/rpc:code_proto",
"@com_google_googleapis//google/rpc:status_proto",
],
)

proto_library(
name = "p4testgen_proto",
srcs = ["modules/testgen/targets/bmv2/proto/p4testgen.proto"],
deps = ["@com_github_p4lang_p4runtime//:p4runtime_proto"],
)

proto_library(
name = "p4testgen_ir_proto",
srcs = ["modules/testgen/targets/bmv2/proto/p4testgen_ir.proto"],
deps = [":ir_proto"],
)

cc_proto_library(
name = "p4testgen_cc_proto",
visibility = ["//visibility:public"],
deps = [":p4testgen_proto"],
)

cc_proto_library(
name = "p4testgen_ir_cc_proto",
visibility = ["//visibility:public"],
deps = [":p4testgen_ir_proto"],
)

genrule(
name = "version",
srcs = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set(
${TESTGEN_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/test_backend/common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_backend/protobuf.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_backend/protobuf_ir.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_backend/metadata.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_backend/ptf.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_backend/stf.cpp
Expand Down
Loading

0 comments on commit 4fe8934

Please sign in to comment.