Skip to content

Commit

Permalink
testing with pinsondatra
Browse files Browse the repository at this point in the history
  • Loading branch information
VSuryaprasad-HCL committed Jan 7, 2025
1 parent 9785f58 commit 146f1d8
Show file tree
Hide file tree
Showing 73 changed files with 22,255 additions and 39 deletions.
4 changes: 4 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load("@bazel_gazelle//:def.bzl", "gazelle")

# gazelle:prefix github.com/sonic-net/sonic-mgmt/sdn_tests/pins_ondatra
gazelle(name = "gazelle")
68 changes: 29 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
# TestRepository

# branch1 change1
# Kavitha Branch1 change1

#Divya branch11 change1
#Divya branch11 change2

# Kavitha Branch2 change1
# Kavitha Branch3 change1
# Kavitha Branch3 change2
# Kavitha Branch3 change3
# Kavitha Branch3 change4
# Kavitha Branch3 change5
# Kavitha Branch3 change6
# Kavitha Branch3 change7
# Kavitha Branch4 change1
# Kavitha Branch4 change2
# Kavitha Branch5 change1
# Kavitha Branch5 change2
# Kavitha Branch5 change3
# Kavitha Branch5 change4

# Kavitha Branch6 change1

# Kavitha Branch7 change1

# Divya_branch1_change1


# Divya branch51 change1

# Divya branch52 change1

# Divya branch53 change1

# Divya branch61

# bibhu_branch1
# Dependencies:
- Linux (tested on ubuntu)
- Go (https://go.dev/doc/install)
- Bazel-5.4.0+ (https://bazel.build/install)
- Rest of the dependencies should be auto-installed on bazel run.

# Compilation:
```
bazel build ...
```

# Compile and Run Test:
```
bazel run //tests:test_name --test_strategy=exclusive --test_timeout=3600
```


# Debug code:
- Install Delve (https://github.com/go-delve/delve/tree/master/Documentation/installation)
- Compile repo in debug mode:
```
bazel build ... --strip=never --compilation_mode=dbg
```
- Run the test with dlv debugger:
```
dlv --wd=$PWD/tests/ exec bazel-bin/tests/test_name_/test_name -- --testbed=$PWD/testbeds/testbed.textproto
// inside dlv; map path for debugging:
config substitute-path external bazel-pins_ondatra/external
```
135 changes: 135 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# 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.
# You may obtain a copy of the License at
#
# 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,
# 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.

workspace(name = "com_github_sonic_net_sonic_mgmt_sdn_tests_pins_ondatra")

# -- Load buildifier -----------------------------------------------------------
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Bazel toolchain to build go-lang.
http_archive(
name = "io_bazel_rules_go",
sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
],
)

# Gazelle to auto generate go-lang BUILD rules.
http_archive(
name = "bazel_gazelle",
sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
],
)

load("pins_deps.bzl", "pins_deps")

pins_deps()

# -- Load Rules Foreign CC -----------------------------------------------------

load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

rules_foreign_cc_dependencies()

# -- Load GoLang Rules -----------------------------------------------------

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("//:infra_deps.bzl", "binding_deps")

binding_deps()

go_rules_dependencies()

go_register_toolchains(version = "1.21.1")

gazelle_dependencies(go_repository_default_config = "@//:WORKSPACE.bazel")

# -- Load GRPC -------------------------------------------------------------

load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")

switched_rules_by_language(
name = "com_google_googleapis_imports",
cc = True,
go = True,
grpc = True,
)

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

grpc_deps()

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

grpc_extra_deps()

# -- Load Protobuf -------------------------------------------------------------

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")

rules_proto_dependencies()

rules_proto_toolchains()

### Bazel rules for many languages to compile PROTO into gRPC libraries
http_archive(
name = "rules_proto_grpc",
sha256 = "f87d885ebfd6a1bdf02b4c4ba5bf6fb333f90d54561e4d520a8413c8d1fb7beb",
strip_prefix = "rules_proto_grpc-4.5.0",
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/4.5.0.tar.gz"],
patch_args = ["-p1"],
patches = [
"//:bazel/patches/rules_proto_grpc.patch",
],
)

load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")

rules_proto_grpc_toolchains()

rules_proto_grpc_repos()

# -- Load P4Runtime ------------------------------------------------------------

load("@com_github_p4lang_p4runtime//:p4runtime_deps.bzl", "p4runtime_deps")

p4runtime_deps()

# -- Load packaging rules ------------------------------------------------------

load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

rules_pkg_dependencies()

# == Dependencies needed for testing and formatting only =======================

# -- Load p4c ------------------------------------------------------------------

load("@com_github_p4lang_p4c//:bazel/p4c_deps.bzl", "p4c_deps")

p4c_deps()

load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")

boost_deps()
12 changes: 12 additions & 0 deletions bazel/patches/ghodss_yaml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/BUILD.bazel b/BUILD.bazel
index 4f4ecec..ee196e8 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -6,6 +6,7 @@ go_library(
"fields.go",
"yaml.go",
],
+ deps = ["@in_gopkg_yaml_v2//:yaml_v2"],
importpath = "github.com/ghodss/yaml",
visibility = ["//visibility:public"],
)
37 changes: 37 additions & 0 deletions bazel/patches/gnmi-001-fix_virtual_proto_import.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/proto/gnmi/BUILD.bazel b/proto/gnmi/BUILD.bazel
index f471488..14a242b 100755
--- a/proto/gnmi/BUILD.bazel
+++ b/proto/gnmi/BUILD.bazel
@@ -22,6 +22,17 @@ package(
licenses = ["notice"],
)

+proto_library(
+ name = "gnmi_internal_proto",
+ srcs = ["gnmi.proto"],
+ deps = [
+ "//proto/gnmi_ext:gnmi_ext_proto",
+ "@com_google_protobuf//:any_proto",
+ "@com_google_protobuf//:descriptor_proto",
+ ],
+ visibility = ["//visibility:private"],
+)
+
proto_library(
name = "gnmi_proto",
srcs = ["gnmi.proto"],
@@ -35,12 +46,12 @@ proto_library(

cc_proto_library(
name = "gnmi_cc_proto",
- deps = [":gnmi_proto"],
+ deps = [":gnmi_internal_proto"],
)

cc_grpc_library(
name = "gnmi_cc_grpc_proto",
- srcs = [":gnmi_proto"],
+ srcs = [":gnmi_internal_proto"],
generate_mocks = True,
grpc_only = True,
deps = [":gnmi_cc_proto"],
Loading

0 comments on commit 146f1d8

Please sign in to comment.