Skip to content

Commit

Permalink
Initialize gNPSI repo.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 608751064
  • Loading branch information
RazorBach committed Feb 23, 2024
1 parent 63598e2 commit d68ab6f
Show file tree
Hide file tree
Showing 17 changed files with 692 additions and 802 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# absl supports only c++14
build --cxxopt=-std=c++14
build --host_cxxopt=-std=c++14
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
bazel-${{ runner.os }}-build-
- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.8.1/$BAZEL"
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/$BAZEL"
chmod +x $BAZEL
sudo mv $BAZEL /usr/local/bin/bazel
- name: Build
run: bazel build //...
run: bazel build //...
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
2 changes: 1 addition & 1 deletion WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
11 changes: 5 additions & 6 deletions compile_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -15,11 +15,10 @@
#

#!/bin/bash
set -euo pipefail


# Go
for p in gnpsi; do
protoc --go-grpc_out=. --go-grpc_opt=paths=source_relative --go_out=. --go_opt=paths=source_relative proto/$p/$p.proto
done
# Cpp
PROTO_DIR="proto/gnpsi"
protoc -I $PROTO_DIR --grpc_out=$PROTO_DIR --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` $PROTO_DIR/gnpsi.proto
protoc -I $PROTO_DIR --cpp_out=$PROTO_DIR $PROTO_DIR/gnpsi.proto

63 changes: 49 additions & 14 deletions gnpsi_deps.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -21,31 +21,66 @@ def gnpsi_deps():
if not native.existing_rule("com_github_grpc_grpc"):
http_archive(
name = "com_github_grpc_grpc",
url = "https://github.com/grpc/grpc/archive/refs/tags/v1.43.2.tar.gz",
strip_prefix = "grpc-1.43.2",
sha256 = "b74ce7d26fe187970d1d8e2c06a5d3391122f7bc1fdce569aff5e435fb8fe780",
url = "https://github.com/grpc/grpc/archive/v1.61.0.zip",
strip_prefix = "grpc-1.61.0",
sha256 = "ba6c53c3924a1d01c663352010e0f73736bad3d99d72108e0f2b1a6466f9be20",
patch_args = ["-p1"],
patches = [
"@com_github_google_pins_infra//:bazel/patches/grpc-001-fix_file_watcher_race_condition.patch",
"@com_github_google_pins_infra//:bazel/patches/grpc-003-fix_go_gazelle_register_toolchain.patch",
],
)
if not native.existing_rule("com_google_absl"):
http_archive(
name = "com_google_absl",
url = "https://github.com/abseil/abseil-cpp/archive/20230125.3.tar.gz",
strip_prefix = "abseil-cpp-20230125.3",
sha256 = "5366d7e7fa7ba0d915014d387b66d0d002c03236448e1ba9ef98122c13b35c36",
)
if not native.existing_rule("com_google_googletest"):
http_archive(
name = "com_google_googletest",
urls = ["https://github.com/google/googletest/archive/release-1.11.0.tar.gz"],
strip_prefix = "googletest-release-1.11.0",
sha256 = "b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5",
)
if not native.existing_rule("com_google_protobuf"):
http_archive(
name = "com_google_protobuf",
url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protobuf-all-3.19.4.tar.gz",
strip_prefix = "protobuf-3.19.4",
sha256 = "ba0650be1b169d24908eeddbe6107f011d8df0da5b1a5a4449a913b10e578faf",
url = "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v23.1.zip",
strip_prefix = "protobuf-23.1",
sha256 = "c0ea9f4d75b37ea8e9d78ce4c670d066bcb7cebdba190fa5fc8c57b1f00c0c2c",
)
if not native.existing_rule("com_google_googleapis"):
http_archive(
name = "com_google_googleapis",
url = "https://github.com/googleapis/googleapis/archive/ccb9d245ddac58b8d4ad918e6a914e841a64cc28.zip",
strip_prefix = "googleapis-ccb9d245ddac58b8d4ad918e6a914e841a64cc28",
sha256 = "feca5804fa0af2bc48d041a8b6e0356fb9e4848b3dd6ee74ab847022e90c69ff",
url = "https://github.com/googleapis/googleapis/archive/2f9af297c84c55c8b871ba4495e01ade42476c92.tar.gz",
sha256 = "5bb6b0253ccf64b53d6c7249625a7e3f6c3bc6402abd52d3778bfa48258703a0",
strip_prefix = "googleapis-2f9af297c84c55c8b871ba4495e01ade42476c92",
)
if not native.existing_rule("com_github_google_glog"):
http_archive(
name = "com_github_google_glog",
url = "https://github.com/google/glog/archive/v0.6.0.tar.gz",
strip_prefix = "glog-0.6.0",
sha256 = "8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6",
)

# Needed to make glog happy.
if not native.existing_rule("com_github_gflags_gflags"):
http_archive(
name = "com_github_gflags_gflags",
url = "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz",
strip_prefix = "gflags-2.2.2",
sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
)
if not native.existing_rule("rules_proto"):
http_archive(
name = "rules_proto",
sha256 = "66bfdf8782796239d3875d37e7de19b1d94301e8972b3cbd2446b332429b4df1",
strip_prefix = "rules_proto-4.0.0",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
],
strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
)
19 changes: 16 additions & 3 deletions proto/gnpsi/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,10 +13,12 @@
# limitations under the License.
#
# Supporting infrastructure for implementing and testing PINS.
#

load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")

# gnpsi defines a gRPC-based network packet sampling interface implemented on
# vendor network elements. It provides mechanisms for streaming packet
# samples/updates from the network element.
package(
default_visibility = ["//visibility:public"],
licenses = ["notice"],
Expand All @@ -25,10 +27,21 @@ package(
proto_library(
name = "gnpsi_proto",
srcs = ["gnpsi.proto"],
import_prefix = "github.com/openconfig/gnpsi",
deps = [
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
],
)

cc_proto_library(
name = "gnpsi_cc_proto",
deps = [":gnpsi_proto"],
)

cc_grpc_library(
name = "gnpsi_grpc_proto",
srcs = [":gnpsi_proto"],
generate_mocks = True,
grpc_only = ["True"],
deps = [":gnpsi_cc_proto"],
)
Loading

0 comments on commit d68ab6f

Please sign in to comment.