Skip to content

Add Bazel Build Support for simple_switch_grpc#1349

Open
Vineet1101 wants to merge 19 commits intop4lang:mainfrom
Vineet1101:bazel-migration
Open

Add Bazel Build Support for simple_switch_grpc#1349
Vineet1101 wants to merge 19 commits intop4lang:mainfrom
Vineet1101:bazel-migration

Conversation

@Vineet1101
Copy link
Copy Markdown
Contributor

This PR introduces support for building BMv2's simple_switch_grpc and its associated libraries using Bazel (v8.5.0), modernizing the build system alongside the existing CMake configuration.

Key Changes:

  • Workspace Configuration: Added MODULE.bazel and .bazelrc configured for Bazel 8.5.0, utilizing bzlmod for dependencies like rules_cc and googletest.
  • Third-Party Libraries: Created Bazel build definitions for internal dependencies like jsoncpp and spdlog.
  • Core Execution Engine: Added BUILD.bazel files for src/BMI, src/bm_sim (with dynamic version.cpp generation), and targets/simple_switch.
  • PI Integration: Integrated the PI submodule (bmpi) to link correctly against system-installed PI shared libraries (libpi.so, libpip4info.so, etc.).
  • gRPC Services: Migrated protobuf/gRPC codegen in services/BUILD.bazel to leverage the system's protoc and grpc_cpp_plugin, ensuring strict ABI compatibility with the system pi and grpc++ libraries.
  • Testing: Added build definitions for all 11 simple_switch_grpc unit tests. Structured them with tags = ["exclusive"] to prevent execution overlap on the shared gRPC port (0.0.0.0:50056).

@Vineet1101 Vineet1101 changed the title Add Bazel Build Support for `simple_switch_grpc Add Bazel Build Support for simple_switch_grpc Mar 9, 2026
@Vineet1101
Copy link
Copy Markdown
Contributor Author

Can someone review this

@matthewtlam
Copy link
Copy Markdown
Contributor

@Vineet1101 Please add the Github workflow CI test to this PR to show correctness of the build solution as well as testing

Vineet1101 and others added 14 commits March 9, 2026 21:12
… of CPU port in switch log

Signed-off-by: Vineet1101 <Vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
@Vineet1101
Copy link
Copy Markdown
Contributor Author

@matthewtlam the signing key for the OpenSUSE-hosted p4lang package repo has expired. What should I do??

Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>

Fix missing runner.h by exposing simple_switch headers

fixed failing linking errors

Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>

Apply successful pkgconfig_grpc linker fixes from testing branch
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
Signed-off-by: Vineet1101 <vineetgoel692@gmail.com>
@jafingerhut
Copy link
Copy Markdown
Contributor

@matthewtlam the signing key for the OpenSUSE-hosted p4lang package repo has expired. What should I do??

Ignore that test failure, but do please pay attention to any other test failures that occur that are unrelated to that one, which I believe you have one on this PR at this time (in the CI test named "Bazel / build-and-test (pull_request)"


apt-get update
# Add p4lang repo with trusted=yes to bypass expired GPG key
echo 'deb [trusted=yes] http://download.opensuse.org/repositories/home:/p4lang/xUbuntu_22.04/ /' \
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for now I have added this code to pass this test if its not required I will remove it

@Vineet1101
Copy link
Copy Markdown
Contributor Author

Vineet1101 commented Mar 10, 2026

@matthewtlam @smolkaj can you please review as it is passing all tests now and apologies for taking too many commits :)

@Vineet1101
Copy link
Copy Markdown
Contributor Author

Hey @matthewtlam can you please review it

@matthewtlam
Copy link
Copy Markdown
Contributor

Thanks for your PR @Vineet1101, it looks great.

None of the PRs will be carefully reviewed until Apr 1 (once the contributor deadline is over). Starting today (March 16th), the GSoC contributor application will open. Please make sure you submit your application before the deadline.

During the first week of April, after applications and PRs are reviewed, candidates who will be considered will be sent an interview. The contributor who gets admitted into GSoC will have their PR pushed to head

@Vineet1101
Copy link
Copy Markdown
Contributor Author

ok @matthewtlam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants