Skip to content

Commit 68fb8ee

Browse files
authored
[Thinkit]: Modifications for arbitration test (sonic-net#21716)
The set of changes required for the arbitration test to work. This goes with sonic-net/sonic-pins#1670 commited in sonic-pins. In pins_deps.bzl, the sonic-pins is upgraded to the latest. This required upgrading of a few packages. The arbitration test required the addition of the util files and the upgrade of googletest. The gutil directory has moved in the sonic-pins depo. The new path is updated in several files. Signed-off-by: Sree Iyer <sbiyer@google.com> Signed-off-by: Sreemoolanathan Iyer <sbiyer@google.com>
1 parent 017ba13 commit 68fb8ee

13 files changed

Lines changed: 138 additions & 50 deletions

sdn_tests/pins_ondatra/infrastructure/thinkit/BUILD.bazel

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ cc_library(
5454
hdrs = ["thinkit.h"],
5555
deps = [
5656
":thinkit_cgo.cc",
57-
"@com_github_sonic_net_sonic_pins//gutil:status",
57+
"@com_github_sonic_net_sonic_pins//gutil/gutil:status",
5858
"@com_github_openconfig_ondatra//proto:ondatra_cc_proto",
5959
"@com_github_openconfig_ondatra//proxy/proto:reservation_cc_proto",
6060
"@com_google_absl//absl/status",
@@ -88,7 +88,7 @@ cc_library(
8888
deps = [
8989
":cthinkit",
9090
":ondatra_generic_testbed",
91-
"@com_github_sonic_net_sonic_pins//gutil:status_matchers",
91+
"@com_github_sonic_net_sonic_pins//gutil/gutil:status_matchers",
9292
"@com_github_sonic_net_sonic_pins//lib:basic_switch",
9393
"@com_github_sonic_net_sonic_pins//lib:pins_control_device",
9494
"@com_github_sonic_net_sonic_pins//lib/gnmi:gnmi_helper",
@@ -117,10 +117,10 @@ cc_test(
117117
deps = [
118118
":cthinkit",
119119
":ondatra_generic_testbed_fixture",
120-
"@com_github_sonic_net_sonic_pins//gutil:proto_matchers",
121-
"@com_github_sonic_net_sonic_pins//gutil:status",
122-
"@com_github_sonic_net_sonic_pins//gutil:status_matchers",
123-
"@com_github_sonic_net_sonic_pins//gutil:testing",
120+
"@com_github_sonic_net_sonic_pins//gutil/gutil:proto_matchers",
121+
"@com_github_sonic_net_sonic_pins//gutil/gutil:status",
122+
"@com_github_sonic_net_sonic_pins//gutil/gutil:status_matchers",
123+
"@com_github_sonic_net_sonic_pins//gutil/gutil:testing",
124124
"@com_github_sonic_net_sonic_pins//thinkit:generic_testbed",
125125
"@com_github_sonic_net_sonic_pins//thinkit/proto:generic_testbed_cc_proto",
126126
"@com_github_gnmi//proto/gnmi:gnmi_cc_grpc_proto",
@@ -160,7 +160,7 @@ cc_library(
160160
deps = [
161161
":cthinkit",
162162
":ondatra_mirror_testbed",
163-
"@com_github_sonic_net_sonic_pins//gutil:status_matchers",
163+
"@com_github_sonic_net_sonic_pins//gutil/gutil:status_matchers",
164164
"@com_github_sonic_net_sonic_pins//lib:basic_switch",
165165
"@com_github_sonic_net_sonic_pins//lib/gnmi:gnmi_helper",
166166
"@com_github_sonic_net_sonic_pins//thinkit:mirror_testbed",

sdn_tests/pins_ondatra/infrastructure/thinkit/ondatra_generic_testbed_fixture.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
#include "github.com/openconfig/ondatra/proto/testbed.pb.h"
3333
#include "github.com/openconfig/ondatra/proxy/proto/reservation.pb.h"
3434
#include "gmock/gmock.h"
35-
#include "gutil/status.h"
36-
#include "gutil/status_matchers.h"
35+
#include "gutil/gutil/status.h"
36+
#include "gutil/gutil/status_matchers.h"
3737
#include "lib/basic_switch.h"
3838
#include "lib/gnmi/gnmi_helper.h"
3939
#include "lib/pins_control_device.h"

sdn_tests/pins_ondatra/infrastructure/thinkit/ondatra_generic_testbed_fixture_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
#include "grpcpp/support/status.h"
3636
#include "grpcpp/support/sync_stream.h"
3737
#include "gtest/gtest.h"
38-
#include "gutil/proto_matchers.h"
39-
#include "gutil/status.h"
40-
#include "gutil/status_matchers.h"
41-
#include "gutil/testing.h"
38+
#include "gutil/gutil/proto_matchers.h"
39+
#include "gutil/gutil/status.h"
40+
#include "gutil/gutil/status_matchers.h"
41+
#include "gutil/gutil/testing.h"
4242
#include "infrastructure/thinkit/thinkit.h"
4343
#include "p4/v1/p4runtime.grpc.pb.h"
4444
#include "p4/v1/p4runtime.pb.h"

sdn_tests/pins_ondatra/infrastructure/thinkit/ondatra_mirror_testbed_fixture.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
#include "github.com/openconfig/ondatra/proxy/proto/reservation.pb.h"
3131
#include "gmock/gmock.h"
3232
#include "gtest/gtest.h"
33-
#include "gutil/status.h"
34-
#include "gutil/status_matchers.h"
33+
#include "gutil/gutil/status.h"
34+
#include "gutil/gutil/status_matchers.h"
3535
#include "lib/basic_switch.h"
3636
#include "lib/gnmi/gnmi_helper.h"
3737
#include "infrastructure/thinkit/ondatra_mirror_testbed.h"

sdn_tests/pins_ondatra/infrastructure/thinkit/thinkit.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "github.com/openconfig/ondatra/proto/testbed.pb.h"
2525
#include "github.com/openconfig/ondatra/proxy/proto/reservation.pb.h"
2626
#include "google/protobuf/message.h"
27-
#include "gutil/status.h"
27+
#include "gutil/gutil/status.h"
2828
#include "infrastructure/thinkit/thinkit_cgo.h"
2929

3030
namespace pins_test {

sdn_tests/pins_ondatra/pins_deps.bzl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ def pins_deps():
66
git_repository(
77
name = "com_github_sonic_net_sonic_pins",
88
remote = "https://github.com/sonic-net/sonic-pins.git",
9-
commit = "356fd830c741ed0f377139534eac737c2aa56e59" # main as on march 27, 2025
9+
# Updates to December 9, 2025
10+
commit = "ce8d3b3d6d08298ba3b03614b2e29eb40729d734",
1011
)
1112
if not native.existing_rule("com_github_grpc_grpc"):
1213
http_archive(
@@ -30,9 +31,9 @@ def pins_deps():
3031
if not native.existing_rule("com_google_googletest"):
3132
http_archive(
3233
name = "com_google_googletest",
33-
urls = ["https://github.com/google/googletest/archive/release-1.11.0.tar.gz"],
34-
strip_prefix = "googletest-release-1.11.0",
35-
sha256 = "b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5",
34+
urls = ["https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz"],
35+
strip_prefix = "googletest-1.14.0",
36+
sha256 = "8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7",
3637
)
3738
if not native.existing_rule("com_google_benchmark"):
3839
http_archive(
@@ -118,17 +119,18 @@ def pins_deps():
118119
# rather than a release.
119120
http_archive(
120121
name = "com_github_p4lang_p4runtime",
121-
# 90553b9 is the newest commit on main as of 2023-10-09.
122-
urls = ["https://github.com/p4lang/p4runtime/archive/f0e9f33818b74f0009daa44160926e568f1eaa4d.zip"],
123-
strip_prefix = "p4runtime-f0e9f33818b74f0009daa44160926e568f1eaa4d/proto",
124-
sha256 = "97b43996ada83484bfa3f9be205d6b6fd75b9ed6985839414ee72110d369cd53",
122+
# Updates to https://github.com/p4lang/p4runtime/pull/566 on October 16, 2025
123+
urls = ["https://github.com/p4lang/p4runtime/archive/f5187a26cd8745cae1b8a48bcdddddc00ec85e22.zip"],
124+
strip_prefix = "p4runtime-f5187a26cd8745cae1b8a48bcdddddc00ec85e22/proto",
125+
sha256 = "ec894c1458a3a9504e98e4f6cc0683ddb2307d1aa229807819b2d8edab963b04",
125126
)
126127
if not native.existing_rule("com_github_p4lang_p4_constraints"):
127128
http_archive(
128129
name = "com_github_p4lang_p4_constraints",
129-
urls = ["https://github.com/p4lang/p4-constraints/archive/19be9f88dd843e9012a46e8e0e764d545d649f67.zip"],
130-
strip_prefix = "p4-constraints-19be9f88dd843e9012a46e8e0e764d545d649f67",
131-
sha256 = "48cbe4e5831a54d78b79f33ae41fc9648f0731f055572e3568845805eea01cfa",
130+
# Updates to https://github.com/p4lang/p4-constraints/pull/142 on April 29, 2024
131+
urls = ["https://github.com/p4lang/p4-constraints/archive/d26400c0061c6eca43f48309ccfcec750c313337.zip"],
132+
strip_prefix = "p4-constraints-d26400c0061c6eca43f48309ccfcec750c313337",
133+
sha256 = "8bb2954680ded0f21d405ae79c5c7e893fcfa96b0236f22047154e07e536c9bd",
132134
)
133135
if not native.existing_rule("com_github_nlohmann_json"):
134136
http_archive(

sdn_tests/pins_ondatra/tests/thinkit/BUILD.bazel

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ package(
55
licenses = ["notice"],
66
)
77

8+
cc_library(
9+
name = "util",
10+
testonly = 1,
11+
srcs = ["util.cc"],
12+
hdrs = ["util.h"],
13+
deps = [
14+
"@com_github_sonic_net_sonic_pins//gutil/gutil:testing",
15+
"@com_github_p4lang_p4runtime//:p4info_cc_proto",
16+
"@com_google_absl//absl/flags:flag",
17+
],
18+
)
19+
820
cc_test(
921
name = "random_blackbox_events_test",
1022
timeout = "long",
@@ -42,15 +54,13 @@ cc_test(
4254
"notap",
4355
],
4456
deps = [
45-
"@com_github_sonic_net_sonic_pins//gutil:testing",
57+
":util",
4658
"//infrastructure/thinkit:ondatra_params",
47-
"@com_github_sonic_net_sonic_pins//p4_pdpi:p4_runtime_session",
4859
"@com_github_sonic_net_sonic_pins//tests/forwarding:arbitration_test",
49-
"@com_github_sonic_net_sonic_pins//thinkit:mirror_testbed",
5060
"@com_github_sonic_net_sonic_pins//thinkit:mirror_testbed_fixture",
61+
"@com_github_google_glog//:glog",
5162
"@com_github_grpc_grpc//:grpc++",
5263
"@com_github_p4lang_p4runtime//:p4runtime_cc_proto",
53-
"@com_google_absl//absl/flags:flag",
5464
"@com_google_googletest//:gtest_main",
5565
],
5666
linkopts = ["-lresolv"],
@@ -71,7 +81,7 @@ cc_test(
7181
"notap",
7282
],
7383
deps = [
74-
"@com_github_sonic_net_sonic_pins//gutil:testing",
84+
"@com_github_sonic_net_sonic_pins//gutil/gutil:testing",
7585
"//infrastructure/thinkit:ondatra_params",
7686
"@com_github_sonic_net_sonic_pins//tests/forwarding:configure_mirror_testbed_test",
7787
"@com_github_sonic_net_sonic_pins//thinkit:mirror_testbed_fixture",
@@ -97,7 +107,7 @@ cc_test(
97107
],
98108
deps = [
99109
"@com_github_sonic_net_sonic_pins//dvaas:test_vector_cc_proto",
100-
"@com_github_sonic_net_sonic_pins//gutil:testing",
110+
"@com_github_sonic_net_sonic_pins//gutil/gutil:testing",
101111
"//infrastructure/thinkit:ondatra_params",
102112
"@com_github_sonic_net_sonic_pins//tests/forwarding:arriba_test",
103113
"@com_github_sonic_net_sonic_pins//thinkit:mirror_testbed_fixture",

sdn_tests/pins_ondatra/tests/thinkit/arbitration_test.cc

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
#include "tests/forwarding/arbitration_test.h"
22

33
#include <memory>
4-
#include <string>
54
#include <utility>
65

7-
#include "absl/flags/flag.h"
6+
#include "glog/logging.h"
87
#include "gtest/gtest.h"
98
#include "infrastructure/thinkit/ondatra_params.h"
109
#include "p4/v1/p4runtime.pb.h"
11-
#include "p4_pdpi/p4_runtime_session.h"
12-
#include "thinkit/mirror_testbed.h"
10+
#include "tests/thinkit/util.h"
1311
#include "thinkit/mirror_testbed_fixture.h"
1412

15-
ABSL_FLAG(
16-
std::string, p4info_file, "",
17-
"Path to the file containing the textproto of the P4Info to be pushed");
18-
1913
namespace pins {
2014
namespace {
2115

2216
INSTANTIATE_TEST_SUITE_P(
2317
pinsArbitrationTest, ArbitrationTestFixture, testing::Values([]() {
24-
thinkit::MirrorTestbedFixtureParams mirror_testbed_params =
25-
*pins::GetOndatraMirrorTestbedFixtureParams();
18+
absl::StatusOr<thinkit::MirrorTestbedFixtureParams> params =
19+
pins::GetOndatraMirrorTestbedFixtureParams();
20+
if (!params.ok()) {
21+
LOG(FATAL) << "Failed to fetch params, status: " // Crash OK
22+
<< params.status();
23+
}
2624
return ArbitrationTestParams{
2725
.mirror_testbed = std::shared_ptr<thinkit::MirrorTestbedInterface>(
28-
mirror_testbed_params.mirror_testbed),
29-
.gnmi_config = std::move(mirror_testbed_params.gnmi_config),
30-
.p4info = std::move(mirror_testbed_params.p4_info)};
26+
params->mirror_testbed),
27+
.gnmi_config = std::move(params->gnmi_config),
28+
.p4info = pins_test::GetP4InfoFromFlag()};
3129
}()));
3230

3331
} // namespace

sdn_tests/pins_ondatra/tests/thinkit/arriba_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "dvaas/test_vector.pb.h"
1010
#include "glog/logging.h"
1111
#include "gtest/gtest.h"
12-
#include "gutil/testing.h"
12+
#include "gutil/gutil/testing.h"
1313
#include "infrastructure/thinkit/ondatra_params.h"
1414
#include "thinkit/mirror_testbed_fixture.h"
1515

sdn_tests/pins_ondatra/tests/thinkit/configure_mirror_testbed_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "absl/flags/flag.h"
77
#include "gtest/gtest.h"
88
#include "absl/strings/string_view.h"
9-
#include "gutil/testing.h"
9+
#include "gutil/gutil/testing.h"
1010
#include "infrastructure/thinkit/ondatra_params.h"
1111
#include "p4/config/v1/p4info.pb.h"
1212
#include "thinkit/mirror_testbed_fixture.h"

0 commit comments

Comments
 (0)