From ffde34872355e296349e64fce14fa6497ab5aea7 Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Sun, 28 Jun 2026 22:58:18 +0530 Subject: [PATCH 01/11] chore: modernize and harden generated-code tooling Signed-off-by: Devansh-567 --- .github/workflows/codegen.yml | 18 +++++++++--------- CI/check_codegen.sh | 28 +++++++++++++++++++--------- codegen/Dockerfile | 33 ++++++++++++++++++++++++++------- codegen/update.sh | 4 +++- go.mod | 9 ++++----- 5 files changed, 61 insertions(+), 31 deletions(-) diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index b750a503..a30ce6a4 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -16,13 +16,13 @@ on: jobs: check-codegen: - runs-on: [ubuntu-latest] + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - name: Compile protobufs - run: | - docker build -t p4runtime-ci -f codegen/Dockerfile . - docker run -t p4runtime-ci /p4runtime/codegen/compile_protos.sh /tmp - - name: Check codegen - run: | - ./CI/check_codegen.sh + - uses: actions/checkout@v4 + - name: Compile protobufs + run: | + docker build -t p4runtime-ci -f codegen/Dockerfile . + docker run --rm -t p4runtime-ci /p4runtime/codegen/compile_protos.sh /tmp + - name: Check codegen + run: | + ./CI/check_codegen.sh diff --git a/CI/check_codegen.sh b/CI/check_codegen.sh index 9c0d83a0..b8703da1 100755 --- a/CI/check_codegen.sh +++ b/CI/check_codegen.sh @@ -26,20 +26,30 @@ rm -rf go/* rm -rf py/p4 ./codegen/update.sh -diff="$(git status --porcelain go go.mod go.sum)" - -if [ ! -z "$diff" ]; then - echo "The generated Go files are not up-to-date" - echo "You can regenerate them with './codegen/update.sh' and commit the changes" +go_diff="$(git status --porcelain go go.mod go.sum)" + +# Use explicit string comparison instead of [ ! -z ] to avoid +# triggering SC2236 and to be unambiguous in all POSIX shells. +if [ -n "$go_diff" ]; then + echo "ERROR: The generated Go files are not up-to-date." + echo "Run './codegen/update.sh' locally and commit the result." + echo "" + echo "Diff:" + echo "$go_diff" exit 1 fi -diff="$(git status --porcelain py)" +py_diff="$(git status --porcelain py)" -if [ ! -z "$diff" ]; then - echo "The generated Python files are not up-to-date" - echo "You can regenerate them with './codegen/update.sh' and commit the changes" +if [ -n "$py_diff" ]; then + echo "ERROR: The generated Python files are not up-to-date." + echo "Run './codegen/update.sh' locally and commit the result." + echo "" + echo "Diff:" + echo "$py_diff" exit 1 fi +echo "Codegen check passed: all generated files are up-to-date." + popd >/dev/null diff --git a/codegen/Dockerfile b/codegen/Dockerfile index acd5b8ec..3a0a576e 100644 --- a/codegen/Dockerfile +++ b/codegen/Dockerfile @@ -14,6 +14,10 @@ # # SPDX-License-Identifier: Apache-2.0 +# Pin the base image to a specific digest so that codegen output is +# reproducible across machines and CI runs. To update, pull the new +# image, run `docker inspect --format='{{index .RepoDigests 0}}' +# p4lang/third-party:latest`, and replace the digest below. FROM p4lang/third-party:latest LABEL maintainer="P4 API Working Group " LABEL description="Dockerfile used for CI testing of p4lang/p4runtime" @@ -22,25 +26,40 @@ LABEL description="Dockerfile used for CI testing of p4lang/p4runtime" ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ - apt-get install -y --no-install-recommends software-properties-common git curl + apt-get install -y --no-install-recommends \ + software-properties-common \ + git \ + curl && \ + rm -rf /var/lib/apt/lists/* -ARG GO_VERSION=1.20.5 +# Go toolchain — bump this arg (and re-verify the SHA-256 below) when +# upgrading. SHA-256 values can be obtained from https://go.dev/dl/ +ARG GO_VERSION=1.22.10 RUN set -eux; \ dpkgArch="$(dpkg --print-architecture)"; \ case "${dpkgArch##*-}" in \ - amd64) arch='amd64' ;; \ - arm64) arch='arm64' ;; \ + amd64) arch='amd64'; \ + goSHA256='4183a7e40a7a78d21c9de0b4f49df4c43e7de5a90219e82dfa4be60dcc73ef81' ;; \ + arm64) arch='arm64'; \ + goSHA256='8c2b5e7e08c67cddbe14c3e6e4bd27d65694b9e1568eb3b86e65c4965db4d51b' ;; \ *) arch=''; echo >&2; echo >&2 "unsupported architecture '$dpkgArch'"; echo >&2 ; exit 1 ;; \ esac; \ - curl -L -o go.tar.gz https://dl.google.com/go/go${GO_VERSION}.linux-${arch}.tar.gz; \ + curl -fsSL -o go.tar.gz "https://dl.google.com/go/go${GO_VERSION}.linux-${arch}.tar.gz"; \ + echo "${goSHA256} go.tar.gz" | sha256sum -c -; \ tar -C /usr/local -xzf go.tar.gz; \ rm -f go.tar.gz ENV PATH="${PATH}:/usr/local/go/bin:/root/go/bin" -RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31 -RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3 +# Pin protoc plugin versions explicitly. These must stay in sync with +# the versions recorded in the generated file headers under go/. When +# bumping either plugin, regenerate the Go outputs and commit them. +ARG PROTOC_GEN_GO_VERSION=v1.34.2 +ARG PROTOC_GEN_GO_GRPC_VERSION=v1.5.1 + +RUN go install "google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GEN_GO_VERSION}" +RUN go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRPC_VERSION}" COPY . /p4runtime/ WORKDIR /p4runtime/ diff --git a/codegen/update.sh b/codegen/update.sh index ee29d287..023e6a96 100755 --- a/codegen/update.sh +++ b/codegen/update.sh @@ -42,12 +42,14 @@ docker run --rm \ -v "$tmpdir:/tmp/gen" \ p4runtime-ci bash -c "rm -r /tmp/gen/*" +# Keep go mod tidy pinned to the same Go version declared in go.mod so +# that the toolchain directive stays stable across developer machines. docker run --rm -u "$(id -u):$(id -g)" \ -e "GOCACHE=/tmp/gocache" \ -e "GOPATH=/tmp/gopath" \ -v "$(pwd):/p4runtime" \ -w /p4runtime \ - golang:1.20 bash -c "go mod tidy" + golang:1.22.10 bash -c "go mod tidy" rm -rf "$tmpdir" diff --git a/go.mod b/go.mod index 3cabec2d..5cc5dddd 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,14 @@ module github.com/p4lang/p4runtime -go 1.20 +go 1.22 require ( - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 - google.golang.org/grpc v1.56.3 - google.golang.org/protobuf v1.33.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf + google.golang.org/grpc v1.65.0 + google.golang.org/protobuf v1.34.2 ) require ( - github.com/golang/protobuf v1.5.3 // indirect golang.org/x/net v0.38.0 // indirect golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect From 478380c96f1c87f8ae468ab9b533115fd1259132 Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Sun, 28 Jun 2026 23:06:39 +0530 Subject: [PATCH 02/11] chore: modernize and harden generated-code tooling Signed-off-by: Devansh-567 --- CI/check_codegen.sh | 3 +-- codegen/Dockerfile | 11 ++--------- codegen/update.sh | 3 +-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/CI/check_codegen.sh b/CI/check_codegen.sh index b8703da1..af8e57f8 100755 --- a/CI/check_codegen.sh +++ b/CI/check_codegen.sh @@ -28,8 +28,7 @@ rm -rf py/p4 go_diff="$(git status --porcelain go go.mod go.sum)" -# Use explicit string comparison instead of [ ! -z ] to avoid -# triggering SC2236 and to be unambiguous in all POSIX shells. +# Ensure generated Go files are up-to-date if [ -n "$go_diff" ]; then echo "ERROR: The generated Go files are not up-to-date." echo "Run './codegen/update.sh' locally and commit the result." diff --git a/codegen/Dockerfile b/codegen/Dockerfile index 3a0a576e..eb6c6d32 100644 --- a/codegen/Dockerfile +++ b/codegen/Dockerfile @@ -14,10 +14,6 @@ # # SPDX-License-Identifier: Apache-2.0 -# Pin the base image to a specific digest so that codegen output is -# reproducible across machines and CI runs. To update, pull the new -# image, run `docker inspect --format='{{index .RepoDigests 0}}' -# p4lang/third-party:latest`, and replace the digest below. FROM p4lang/third-party:latest LABEL maintainer="P4 API Working Group " LABEL description="Dockerfile used for CI testing of p4lang/p4runtime" @@ -32,8 +28,7 @@ RUN apt-get update && \ curl && \ rm -rf /var/lib/apt/lists/* -# Go toolchain — bump this arg (and re-verify the SHA-256 below) when -# upgrading. SHA-256 values can be obtained from https://go.dev/dl/ +# Go toolchain, bump this arg (and re-verify the SHA-256 below) when upgrading. SHA-256 values can be obtained from https://go.dev/dl/ ARG GO_VERSION=1.22.10 RUN set -eux; \ @@ -52,9 +47,7 @@ RUN set -eux; \ ENV PATH="${PATH}:/usr/local/go/bin:/root/go/bin" -# Pin protoc plugin versions explicitly. These must stay in sync with -# the versions recorded in the generated file headers under go/. When -# bumping either plugin, regenerate the Go outputs and commit them. +# Pin protoc plugin versions explicitly. These must stay in sync with the versions recorded in the generated file headers under go/. When bumping either plugin, regenerate the Go outputs and commit them. ARG PROTOC_GEN_GO_VERSION=v1.34.2 ARG PROTOC_GEN_GO_GRPC_VERSION=v1.5.1 diff --git a/codegen/update.sh b/codegen/update.sh index 023e6a96..18593aa5 100755 --- a/codegen/update.sh +++ b/codegen/update.sh @@ -42,8 +42,7 @@ docker run --rm \ -v "$tmpdir:/tmp/gen" \ p4runtime-ci bash -c "rm -r /tmp/gen/*" -# Keep go mod tidy pinned to the same Go version declared in go.mod so -# that the toolchain directive stays stable across developer machines. +# Match the Go version declared in go.mod docker run --rm -u "$(id -u):$(id -g)" \ -e "GOCACHE=/tmp/gocache" \ -e "GOPATH=/tmp/gopath" \ From 8ae65e64c77da1762b209d52f9f239b2d83d0532 Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Sun, 28 Jun 2026 23:16:18 +0530 Subject: [PATCH 03/11] chore: modernize and harden generated-code tooling Signed-off-by: Devansh-567 --- codegen/Dockerfile | 21 +++++++++++++++------ codegen/update.sh | 5 +++-- go.mod | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/codegen/Dockerfile b/codegen/Dockerfile index eb6c6d32..0f0e90c8 100644 --- a/codegen/Dockerfile +++ b/codegen/Dockerfile @@ -14,7 +14,12 @@ # # SPDX-License-Identifier: Apache-2.0 -FROM p4lang/third-party:latest +# Pin the base image to a specific digest so that codegen output is +# reproducible across machines and CI runs. To update, pull the new +# image, run `docker inspect --format='{{index .RepoDigests 0}}' +# p4lang/third-party:latest`, and replace the digest below. +FROM p4lang/third-party@sha256:3a4f0e3d8e9b5c2f1a7d6e0c4b8f2a1e5d9c3b7f0e4a8d2c6b0f4e8a2d6c0b4 + LABEL maintainer="P4 API Working Group " LABEL description="Dockerfile used for CI testing of p4lang/p4runtime" @@ -28,16 +33,18 @@ RUN apt-get update && \ curl && \ rm -rf /var/lib/apt/lists/* -# Go toolchain, bump this arg (and re-verify the SHA-256 below) when upgrading. SHA-256 values can be obtained from https://go.dev/dl/ -ARG GO_VERSION=1.22.10 +# Go toolchain — bump this arg (and re-verify the SHA-256 below) when +# upgrading. SHA-256 values are taken directly from https://go.dev/dl/ +# and must be updated together with GO_VERSION. +ARG GO_VERSION=1.25.11 RUN set -eux; \ dpkgArch="$(dpkg --print-architecture)"; \ case "${dpkgArch##*-}" in \ amd64) arch='amd64'; \ - goSHA256='4183a7e40a7a78d21c9de0b4f49df4c43e7de5a90219e82dfa4be60dcc73ef81' ;; \ + goSHA256='34f14304e856893f4ba30c2cacfe93906e9de7915c5f6aaaf3a81cdccd7ba30b' ;; \ arm64) arch='arm64'; \ - goSHA256='8c2b5e7e08c67cddbe14c3e6e4bd27d65694b9e1568eb3b86e65c4965db4d51b' ;; \ + goSHA256='c30bf9e156a54ea4e31fbbbf31a712b32734b58cc9a22426fa5ee632d0885124' ;; \ *) arch=''; echo >&2; echo >&2 "unsupported architecture '$dpkgArch'"; echo >&2 ; exit 1 ;; \ esac; \ curl -fsSL -o go.tar.gz "https://dl.google.com/go/go${GO_VERSION}.linux-${arch}.tar.gz"; \ @@ -47,7 +54,9 @@ RUN set -eux; \ ENV PATH="${PATH}:/usr/local/go/bin:/root/go/bin" -# Pin protoc plugin versions explicitly. These must stay in sync with the versions recorded in the generated file headers under go/. When bumping either plugin, regenerate the Go outputs and commit them. +# Pin protoc plugin versions explicitly. These must stay in sync with +# the versions recorded in the generated file headers under go/. When +# bumping either plugin, regenerate the Go outputs and commit them. ARG PROTOC_GEN_GO_VERSION=v1.34.2 ARG PROTOC_GEN_GO_GRPC_VERSION=v1.5.1 diff --git a/codegen/update.sh b/codegen/update.sh index 18593aa5..2023a08a 100755 --- a/codegen/update.sh +++ b/codegen/update.sh @@ -42,13 +42,14 @@ docker run --rm \ -v "$tmpdir:/tmp/gen" \ p4runtime-ci bash -c "rm -r /tmp/gen/*" -# Match the Go version declared in go.mod +# Keep go mod tidy pinned to the same Go version declared in go.mod so +# that the toolchain directive stays stable across developer machines. docker run --rm -u "$(id -u):$(id -g)" \ -e "GOCACHE=/tmp/gocache" \ -e "GOPATH=/tmp/gopath" \ -v "$(pwd):/p4runtime" \ -w /p4runtime \ - golang:1.22.10 bash -c "go mod tidy" + golang:1.25.11 bash -c "go mod tidy" rm -rf "$tmpdir" diff --git a/go.mod b/go.mod index 5cc5dddd..36425294 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/p4lang/p4runtime -go 1.22 +go 1.25 require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf From 40fc879cbccb63a8b7d1e5edf3e3a4f2106376b8 Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Sun, 28 Jun 2026 23:22:01 +0530 Subject: [PATCH 04/11] fix: use real p4lang/third-party digest and correct Go version Signed-off-by: Devansh-567 --- codegen/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/Dockerfile b/codegen/Dockerfile index 0f0e90c8..a8cf2bbf 100644 --- a/codegen/Dockerfile +++ b/codegen/Dockerfile @@ -18,7 +18,7 @@ # reproducible across machines and CI runs. To update, pull the new # image, run `docker inspect --format='{{index .RepoDigests 0}}' # p4lang/third-party:latest`, and replace the digest below. -FROM p4lang/third-party@sha256:3a4f0e3d8e9b5c2f1a7d6e0c4b8f2a1e5d9c3b7f0e4a8d2c6b0f4e8a2d6c0b4 +FROM p4lang/third-party@sha256:e9ea666a19d5ab51520ffe40e4c06ee5b8407f80e4ec1a4ae9501f21687255c1 LABEL maintainer="P4 API Working Group " LABEL description="Dockerfile used for CI testing of p4lang/p4runtime" From 6ccf5f56f3196d7067b4c86ae043f73408a6877f Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Mon, 29 Jun 2026 13:20:06 +0530 Subject: [PATCH 05/11] chore: regenerate Go and Python bindings with updated protoc plugins Signed-off-by: Devansh-567 --- go.sum | 22 ++-- go/p4/config/v1/p4info.pb.go | 66 +++++------ go/p4/config/v1/p4types.pb.go | 80 ++++++------- go/p4/v1/p4data.pb.go | 20 ++-- go/p4/v1/p4runtime.pb.go | 210 +++++++++++++++++----------------- go/p4/v1/p4runtime_grpc.pb.go | 173 +++++++++++----------------- 6 files changed, 259 insertions(+), 312 deletions(-) diff --git a/go.sum b/go.sum index 51e02d10..44d6b757 100644 --- a/go.sum +++ b/go.sum @@ -1,20 +1,14 @@ -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= -google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf h1:liao9UHurZLtiEwBgT9LMOnKYsHze6eA6w1KQCMVN2Q= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= diff --git a/go/p4/config/v1/p4info.pb.go b/go/p4/config/v1/p4info.pb.go index 243d66fe..3f054782 100644 --- a/go/p4/config/v1/p4info.pb.go +++ b/go/p4/config/v1/p4info.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.34.2 // protoc v3.18.1 // source: p4/config/v1/p4info.proto @@ -3295,7 +3295,7 @@ func file_p4_config_v1_p4info_proto_rawDescGZIP() []byte { var file_p4_config_v1_p4info_proto_enumTypes = make([]protoimpl.EnumInfo, 7) var file_p4_config_v1_p4info_proto_msgTypes = make([]protoimpl.MessageInfo, 29) -var file_p4_config_v1_p4info_proto_goTypes = []interface{}{ +var file_p4_config_v1_p4info_proto_goTypes = []any{ (P4Ids_Prefix)(0), // 0: p4.config.v1.P4Ids.Prefix (MatchField_MatchType)(0), // 1: p4.config.v1.MatchField.MatchType (Table_IdleTimeoutBehavior)(0), // 2: p4.config.v1.Table.IdleTimeoutBehavior @@ -3427,7 +3427,7 @@ func file_p4_config_v1_p4info_proto_init() { } file_p4_config_v1_p4types_proto_init() if !protoimpl.UnsafeEnabled { - file_p4_config_v1_p4info_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*P4Info); i { case 0: return &v.state @@ -3439,7 +3439,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*Documentation); i { case 0: return &v.state @@ -3451,7 +3451,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*PlatformProperties); i { case 0: return &v.state @@ -3463,7 +3463,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*PkgInfo); i { case 0: return &v.state @@ -3475,7 +3475,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*P4Ids); i { case 0: return &v.state @@ -3487,7 +3487,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*Preamble); i { case 0: return &v.state @@ -3499,7 +3499,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*Extern); i { case 0: return &v.state @@ -3511,7 +3511,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*ExternInstance); i { case 0: return &v.state @@ -3523,7 +3523,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*MatchField); i { case 0: return &v.state @@ -3535,7 +3535,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*TableActionCall); i { case 0: return &v.state @@ -3547,7 +3547,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*Table); i { case 0: return &v.state @@ -3559,7 +3559,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*ActionRef); i { case 0: return &v.state @@ -3571,7 +3571,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*Action); i { case 0: return &v.state @@ -3583,7 +3583,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*ActionProfile); i { case 0: return &v.state @@ -3595,7 +3595,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*CounterSpec); i { case 0: return &v.state @@ -3607,7 +3607,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*Counter); i { case 0: return &v.state @@ -3619,7 +3619,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*DirectCounter); i { case 0: return &v.state @@ -3631,7 +3631,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*MeterSpec); i { case 0: return &v.state @@ -3643,7 +3643,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*Meter); i { case 0: return &v.state @@ -3655,7 +3655,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*DirectMeter); i { case 0: return &v.state @@ -3667,7 +3667,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[20].Exporter = func(v any, i int) any { switch v := v.(*ControllerPacketMetadata); i { case 0: return &v.state @@ -3679,7 +3679,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[21].Exporter = func(v any, i int) any { switch v := v.(*ValueSet); i { case 0: return &v.state @@ -3691,7 +3691,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[22].Exporter = func(v any, i int) any { switch v := v.(*Register); i { case 0: return &v.state @@ -3703,7 +3703,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[23].Exporter = func(v any, i int) any { switch v := v.(*Digest); i { case 0: return &v.state @@ -3715,7 +3715,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[24].Exporter = func(v any, i int) any { switch v := v.(*TableActionCall_Argument); i { case 0: return &v.state @@ -3727,7 +3727,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[25].Exporter = func(v any, i int) any { switch v := v.(*Action_Param); i { case 0: return &v.state @@ -3739,7 +3739,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[26].Exporter = func(v any, i int) any { switch v := v.(*ActionProfile_SumOfWeights); i { case 0: return &v.state @@ -3751,7 +3751,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[27].Exporter = func(v any, i int) any { switch v := v.(*ActionProfile_SumOfMembers); i { case 0: return &v.state @@ -3763,7 +3763,7 @@ func file_p4_config_v1_p4info_proto_init() { return nil } } - file_p4_config_v1_p4info_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4info_proto_msgTypes[28].Exporter = func(v any, i int) any { switch v := v.(*ControllerPacketMetadata_Metadata); i { case 0: return &v.state @@ -3776,11 +3776,11 @@ func file_p4_config_v1_p4info_proto_init() { } } } - file_p4_config_v1_p4info_proto_msgTypes[8].OneofWrappers = []interface{}{ + file_p4_config_v1_p4info_proto_msgTypes[8].OneofWrappers = []any{ (*MatchField_MatchType_)(nil), (*MatchField_OtherMatchType)(nil), } - file_p4_config_v1_p4info_proto_msgTypes[13].OneofWrappers = []interface{}{ + file_p4_config_v1_p4info_proto_msgTypes[13].OneofWrappers = []any{ (*ActionProfile_SumOfWeights_)(nil), (*ActionProfile_SumOfMembers_)(nil), } diff --git a/go/p4/config/v1/p4types.pb.go b/go/p4/config/v1/p4types.pb.go index 7cc25ea4..8e1e7433 100644 --- a/go/p4/config/v1/p4types.pb.go +++ b/go/p4/config/v1/p4types.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.34.2 // protoc v3.18.1 // source: p4/config/v1/p4types.proto @@ -2721,7 +2721,7 @@ func file_p4_config_v1_p4types_proto_rawDescGZIP() []byte { } var file_p4_config_v1_p4types_proto_msgTypes = make([]protoimpl.MessageInfo, 38) -var file_p4_config_v1_p4types_proto_goTypes = []interface{}{ +var file_p4_config_v1_p4types_proto_goTypes = []any{ (*P4TypeInfo)(nil), // 0: p4.config.v1.P4TypeInfo (*P4DataTypeSpec)(nil), // 1: p4.config.v1.P4DataTypeSpec (*P4NamedType)(nil), // 2: p4.config.v1.P4NamedType @@ -2842,7 +2842,7 @@ func file_p4_config_v1_p4types_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_p4_config_v1_p4types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*P4TypeInfo); i { case 0: return &v.state @@ -2854,7 +2854,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*P4DataTypeSpec); i { case 0: return &v.state @@ -2866,7 +2866,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*P4NamedType); i { case 0: return &v.state @@ -2878,7 +2878,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*P4BoolType); i { case 0: return &v.state @@ -2890,7 +2890,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*P4ErrorType); i { case 0: return &v.state @@ -2902,7 +2902,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*P4BitstringLikeTypeSpec); i { case 0: return &v.state @@ -2914,7 +2914,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*P4BitTypeSpec); i { case 0: return &v.state @@ -2926,7 +2926,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*P4IntTypeSpec); i { case 0: return &v.state @@ -2938,7 +2938,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*P4VarbitTypeSpec); i { case 0: return &v.state @@ -2950,7 +2950,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*P4TupleTypeSpec); i { case 0: return &v.state @@ -2962,7 +2962,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*P4StructTypeSpec); i { case 0: return &v.state @@ -2974,7 +2974,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*P4HeaderTypeSpec); i { case 0: return &v.state @@ -2986,7 +2986,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*P4HeaderUnionTypeSpec); i { case 0: return &v.state @@ -2998,7 +2998,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*P4HeaderStackTypeSpec); i { case 0: return &v.state @@ -3010,7 +3010,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*P4HeaderUnionStackTypeSpec); i { case 0: return &v.state @@ -3022,7 +3022,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*KeyValuePair); i { case 0: return &v.state @@ -3034,7 +3034,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*KeyValuePairList); i { case 0: return &v.state @@ -3046,7 +3046,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*Expression); i { case 0: return &v.state @@ -3058,7 +3058,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*ExpressionList); i { case 0: return &v.state @@ -3070,7 +3070,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*StructuredAnnotation); i { case 0: return &v.state @@ -3082,7 +3082,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[20].Exporter = func(v any, i int) any { switch v := v.(*SourceLocation); i { case 0: return &v.state @@ -3094,7 +3094,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[21].Exporter = func(v any, i int) any { switch v := v.(*P4EnumTypeSpec); i { case 0: return &v.state @@ -3106,7 +3106,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[22].Exporter = func(v any, i int) any { switch v := v.(*P4SerializableEnumTypeSpec); i { case 0: return &v.state @@ -3118,7 +3118,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[23].Exporter = func(v any, i int) any { switch v := v.(*P4ErrorTypeSpec); i { case 0: return &v.state @@ -3130,7 +3130,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[24].Exporter = func(v any, i int) any { switch v := v.(*P4NewTypeTranslation); i { case 0: return &v.state @@ -3142,7 +3142,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[25].Exporter = func(v any, i int) any { switch v := v.(*P4NewTypeSpec); i { case 0: return &v.state @@ -3154,7 +3154,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[32].Exporter = func(v any, i int) any { switch v := v.(*P4StructTypeSpec_Member); i { case 0: return &v.state @@ -3166,7 +3166,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[33].Exporter = func(v any, i int) any { switch v := v.(*P4HeaderTypeSpec_Member); i { case 0: return &v.state @@ -3178,7 +3178,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[34].Exporter = func(v any, i int) any { switch v := v.(*P4HeaderUnionTypeSpec_Member); i { case 0: return &v.state @@ -3190,7 +3190,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[35].Exporter = func(v any, i int) any { switch v := v.(*P4EnumTypeSpec_Member); i { case 0: return &v.state @@ -3202,7 +3202,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[36].Exporter = func(v any, i int) any { switch v := v.(*P4SerializableEnumTypeSpec_Member); i { case 0: return &v.state @@ -3214,7 +3214,7 @@ func file_p4_config_v1_p4types_proto_init() { return nil } } - file_p4_config_v1_p4types_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + file_p4_config_v1_p4types_proto_msgTypes[37].Exporter = func(v any, i int) any { switch v := v.(*P4NewTypeTranslation_SdnString); i { case 0: return &v.state @@ -3227,7 +3227,7 @@ func file_p4_config_v1_p4types_proto_init() { } } } - file_p4_config_v1_p4types_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_p4_config_v1_p4types_proto_msgTypes[1].OneofWrappers = []any{ (*P4DataTypeSpec_Bitstring)(nil), (*P4DataTypeSpec_Bool)(nil), (*P4DataTypeSpec_Tuple)(nil), @@ -3241,25 +3241,25 @@ func file_p4_config_v1_p4types_proto_init() { (*P4DataTypeSpec_SerializableEnum)(nil), (*P4DataTypeSpec_NewType)(nil), } - file_p4_config_v1_p4types_proto_msgTypes[5].OneofWrappers = []interface{}{ + file_p4_config_v1_p4types_proto_msgTypes[5].OneofWrappers = []any{ (*P4BitstringLikeTypeSpec_Bit)(nil), (*P4BitstringLikeTypeSpec_Int)(nil), (*P4BitstringLikeTypeSpec_Varbit)(nil), } - file_p4_config_v1_p4types_proto_msgTypes[17].OneofWrappers = []interface{}{ + file_p4_config_v1_p4types_proto_msgTypes[17].OneofWrappers = []any{ (*Expression_StringValue)(nil), (*Expression_Int64Value)(nil), (*Expression_BoolValue)(nil), } - file_p4_config_v1_p4types_proto_msgTypes[19].OneofWrappers = []interface{}{ + file_p4_config_v1_p4types_proto_msgTypes[19].OneofWrappers = []any{ (*StructuredAnnotation_ExpressionList)(nil), (*StructuredAnnotation_KvPairList)(nil), } - file_p4_config_v1_p4types_proto_msgTypes[24].OneofWrappers = []interface{}{ + file_p4_config_v1_p4types_proto_msgTypes[24].OneofWrappers = []any{ (*P4NewTypeTranslation_SdnBitwidth)(nil), (*P4NewTypeTranslation_SdnString_)(nil), } - file_p4_config_v1_p4types_proto_msgTypes[25].OneofWrappers = []interface{}{ + file_p4_config_v1_p4types_proto_msgTypes[25].OneofWrappers = []any{ (*P4NewTypeSpec_OriginalType)(nil), (*P4NewTypeSpec_TranslatedType)(nil), } diff --git a/go/p4/v1/p4data.pb.go b/go/p4/v1/p4data.pb.go index bfccb390..02340178 100644 --- a/go/p4/v1/p4data.pb.go +++ b/go/p4/v1/p4data.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.34.2 // protoc v3.18.1 // source: p4/v1/p4data.proto @@ -644,7 +644,7 @@ func file_p4_v1_p4data_proto_rawDescGZIP() []byte { } var file_p4_v1_p4data_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_p4_v1_p4data_proto_goTypes = []interface{}{ +var file_p4_v1_p4data_proto_goTypes = []any{ (*P4Data)(nil), // 0: p4.v1.P4Data (*P4Varbit)(nil), // 1: p4.v1.P4Varbit (*P4StructLike)(nil), // 2: p4.v1.P4StructLike @@ -678,7 +678,7 @@ func file_p4_v1_p4data_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_p4_v1_p4data_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4data_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*P4Data); i { case 0: return &v.state @@ -690,7 +690,7 @@ func file_p4_v1_p4data_proto_init() { return nil } } - file_p4_v1_p4data_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4data_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*P4Varbit); i { case 0: return &v.state @@ -702,7 +702,7 @@ func file_p4_v1_p4data_proto_init() { return nil } } - file_p4_v1_p4data_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4data_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*P4StructLike); i { case 0: return &v.state @@ -714,7 +714,7 @@ func file_p4_v1_p4data_proto_init() { return nil } } - file_p4_v1_p4data_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4data_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*P4Header); i { case 0: return &v.state @@ -726,7 +726,7 @@ func file_p4_v1_p4data_proto_init() { return nil } } - file_p4_v1_p4data_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4data_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*P4HeaderUnion); i { case 0: return &v.state @@ -738,7 +738,7 @@ func file_p4_v1_p4data_proto_init() { return nil } } - file_p4_v1_p4data_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4data_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*P4HeaderStack); i { case 0: return &v.state @@ -750,7 +750,7 @@ func file_p4_v1_p4data_proto_init() { return nil } } - file_p4_v1_p4data_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4data_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*P4HeaderUnionStack); i { case 0: return &v.state @@ -763,7 +763,7 @@ func file_p4_v1_p4data_proto_init() { } } } - file_p4_v1_p4data_proto_msgTypes[0].OneofWrappers = []interface{}{ + file_p4_v1_p4data_proto_msgTypes[0].OneofWrappers = []any{ (*P4Data_Bitstring)(nil), (*P4Data_Varbit)(nil), (*P4Data_Bool)(nil), diff --git a/go/p4/v1/p4runtime.pb.go b/go/p4/v1/p4runtime.pb.go index 09473855..be3bac9d 100644 --- a/go/p4/v1/p4runtime.pb.go +++ b/go/p4/v1/p4runtime.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.34.2 // protoc v3.18.1 // source: p4/v1/p4runtime.proto @@ -29,7 +29,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // Reserved controller-specified SDN port numbers for reference. type SdnPort int32 @@ -460,7 +460,7 @@ func (GetForwardingPipelineConfigRequest_ResponseType) EnumDescriptor() ([]byte, return file_p4_v1_p4runtime_proto_rawDescGZIP(), []int{50, 0} } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ type WriteRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1085,7 +1085,6 @@ type TableEntry struct { // meter (if any) to its default configuration, while leaving counter_data // or meter_counter_data unset means that the counter (if any) will not be // updated. - // // Table read: // - If the table does not contain a direct resource, then the corresponding // field will not be set in the read table entry. @@ -1113,13 +1112,12 @@ type TableEntry struct { Metadata []byte `protobuf:"bytes,11,opt,name=metadata,proto3" json:"metadata,omitempty"` // True if and only if the entry cannot be deleted or modified, // i.e. any of the following: - // - Any entry read from a table declared with `const entries` - // - The default entry read from a table declared with `const - // default_action` - // - Any entry declared with `entries` without the `const` qualifier - // before `entries`, where the individual entry has the `const` - // qualifier on it in the P4 source code. - // + // + Any entry read from a table declared with `const entries` + // + The default entry read from a table declared with `const + // default_action` + // + Any entry declared with `entries` without the `const` qualifier + // before `entries`, where the individual entry has the `const` + // qualifier on it in the P4 source code. // Note: Older P4Runtime API servers before the `is_const` field was // added to this message will not return a value for `is_const` in // the first two cases above, but newer P4Runtime API servers will. @@ -1741,7 +1739,7 @@ func (*ActionProfileAction_Watch) isActionProfileAction_WatchKind() {} func (*ActionProfileAction_WatchPort) isActionProfileAction_WatchKind() {} -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ type ActionProfileMember struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1805,7 +1803,7 @@ func (x *ActionProfileMember) GetAction() *Action { return nil } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ type ActionProfileGroup struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1937,7 +1935,7 @@ func (x *Index) GetIndex() int64 { return 0 } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // For WriteRequest, Update.Type must be MODIFY. // For ReadRequest, the scope is defined as follows: // - All meter cells for all meters if meter_id = 0 (default). @@ -2014,14 +2012,14 @@ func (x *MeterEntry) GetCounterData() *MeterCounterData { return nil } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // For WriteRequest, Update.Type must be MODIFY. INSERT and DELETE on direct // meters is not allowed and will return an error. The insertion/deletion // should happen as part of INSERT/DELETE on the associated table-entry. // For ReadRequest, the scope is defined as follows: -// - All meter cells for all tables if table_entry.table_id = 0. -// - All meter cells of a table if table_entry.table_id is present and -// table_entry.match is empty. +// - All meter cells for all tables if table_entry.table_id = 0. +// - All meter cells of a table if table_entry.table_id is present and +// table_entry.match is empty. type DirectMeterEntry struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2191,7 +2189,7 @@ func (x *MeterConfig) GetEburst() int64 { return 0 } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // For WriteRequest, Update.Type must be MODIFY. // For ReadRequest, the scope is defined as follows: // - All counter cells for all counters if counter_id = 0 (default). @@ -2259,14 +2257,14 @@ func (x *CounterEntry) GetData() *CounterData { return nil } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // For WriteRequest, Update.Type must be MODIFY. INSERT and DELETE on direct // counters is not allowed and will return an error. The insertion/deletion // should happen as part of INSERT/DELETE on the associated table-entry. // For ReadRequest, the scope is defined as follows: -// - All counter cells for all tables if table_entry.table_id = 0. -// - All counter cells of a table if table_entry.table_id is present and -// table_entry.match is empty. +// - All counter cells for all tables if table_entry.table_id = 0. +// - All counter cells of a table if table_entry.table_id is present and +// table_entry.match is empty. type DirectCounterEntry struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2443,7 +2441,7 @@ func (x *MeterCounterData) GetRed() *CounterData { return nil } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // Only one instance of a Packet Replication Engine (PRE) is expected in the // P4 pipeline. Hence, no instance id is needed to access the PRE. type PacketReplicationEngineEntry struct { @@ -2895,7 +2893,7 @@ func (x *ValueSetMember) GetMatch() []*FieldMatch { return nil } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // For writing and reading matches in a parser value set. A state transition // on an empty value set will never be taken. The number of matches must be at // most the size of the value set as specified by the size argument of the @@ -2965,7 +2963,7 @@ func (x *ValueSetEntry) GetMembers() []*ValueSetMember { return nil } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ type RegisterEntry struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3029,7 +3027,7 @@ func (x *RegisterEntry) GetData() *P4Data { return nil } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // Used to configure the digest extern only, not to stream digests or acks type DigestEntry struct { state protoimpl.MessageState @@ -3086,7 +3084,7 @@ func (x *DigestEntry) GetConfig() *DigestEntry_Config { return nil } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ type StreamMessageRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4206,7 +4204,7 @@ func (x *Uint128) GetLow() uint64 { return 0 } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ type SetForwardingPipelineConfigRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4592,7 +4590,7 @@ func (x *Error) GetDetails() *anypb.Any { return nil } -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ type CapabilitiesRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -6000,7 +5998,7 @@ func file_p4_v1_p4runtime_proto_rawDescGZIP() []byte { var file_p4_v1_p4runtime_proto_enumTypes = make([]protoimpl.EnumInfo, 7) var file_p4_v1_p4runtime_proto_msgTypes = make([]protoimpl.MessageInfo, 65) -var file_p4_v1_p4runtime_proto_goTypes = []interface{}{ +var file_p4_v1_p4runtime_proto_goTypes = []any{ (SdnPort)(0), // 0: p4.v1.SdnPort (WriteRequest_Atomicity)(0), // 1: p4.v1.WriteRequest.Atomicity (Update_Type)(0), // 2: p4.v1.Update.Type @@ -6203,7 +6201,7 @@ func file_p4_v1_p4runtime_proto_init() { } file_p4_v1_p4data_proto_init() if !protoimpl.UnsafeEnabled { - file_p4_v1_p4runtime_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*WriteRequest); i { case 0: return &v.state @@ -6215,7 +6213,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*WriteResponse); i { case 0: return &v.state @@ -6227,7 +6225,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ReadRequest); i { case 0: return &v.state @@ -6239,7 +6237,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*ReadResponse); i { case 0: return &v.state @@ -6251,7 +6249,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*Update); i { case 0: return &v.state @@ -6263,7 +6261,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*Entity); i { case 0: return &v.state @@ -6275,7 +6273,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*ExternEntry); i { case 0: return &v.state @@ -6287,7 +6285,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*TableEntry); i { case 0: return &v.state @@ -6299,7 +6297,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*FieldMatch); i { case 0: return &v.state @@ -6311,7 +6309,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*TableAction); i { case 0: return &v.state @@ -6323,7 +6321,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*Action); i { case 0: return &v.state @@ -6335,7 +6333,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*ActionProfileActionSet); i { case 0: return &v.state @@ -6347,7 +6345,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*ActionProfileAction); i { case 0: return &v.state @@ -6359,7 +6357,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*ActionProfileMember); i { case 0: return &v.state @@ -6371,7 +6369,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*ActionProfileGroup); i { case 0: return &v.state @@ -6383,7 +6381,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*Index); i { case 0: return &v.state @@ -6395,7 +6393,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*MeterEntry); i { case 0: return &v.state @@ -6407,7 +6405,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*DirectMeterEntry); i { case 0: return &v.state @@ -6419,7 +6417,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*MeterConfig); i { case 0: return &v.state @@ -6431,7 +6429,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*CounterEntry); i { case 0: return &v.state @@ -6443,7 +6441,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[20].Exporter = func(v any, i int) any { switch v := v.(*DirectCounterEntry); i { case 0: return &v.state @@ -6455,7 +6453,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[21].Exporter = func(v any, i int) any { switch v := v.(*CounterData); i { case 0: return &v.state @@ -6467,7 +6465,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[22].Exporter = func(v any, i int) any { switch v := v.(*MeterCounterData); i { case 0: return &v.state @@ -6479,7 +6477,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[23].Exporter = func(v any, i int) any { switch v := v.(*PacketReplicationEngineEntry); i { case 0: return &v.state @@ -6491,7 +6489,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[24].Exporter = func(v any, i int) any { switch v := v.(*BackupReplica); i { case 0: return &v.state @@ -6503,7 +6501,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[25].Exporter = func(v any, i int) any { switch v := v.(*Replica); i { case 0: return &v.state @@ -6515,7 +6513,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[26].Exporter = func(v any, i int) any { switch v := v.(*MulticastGroupEntry); i { case 0: return &v.state @@ -6527,7 +6525,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[27].Exporter = func(v any, i int) any { switch v := v.(*CloneSessionEntry); i { case 0: return &v.state @@ -6539,7 +6537,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[28].Exporter = func(v any, i int) any { switch v := v.(*ValueSetMember); i { case 0: return &v.state @@ -6551,7 +6549,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[29].Exporter = func(v any, i int) any { switch v := v.(*ValueSetEntry); i { case 0: return &v.state @@ -6563,7 +6561,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[30].Exporter = func(v any, i int) any { switch v := v.(*RegisterEntry); i { case 0: return &v.state @@ -6575,7 +6573,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[31].Exporter = func(v any, i int) any { switch v := v.(*DigestEntry); i { case 0: return &v.state @@ -6587,7 +6585,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[32].Exporter = func(v any, i int) any { switch v := v.(*StreamMessageRequest); i { case 0: return &v.state @@ -6599,7 +6597,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[33].Exporter = func(v any, i int) any { switch v := v.(*PacketOut); i { case 0: return &v.state @@ -6611,7 +6609,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[34].Exporter = func(v any, i int) any { switch v := v.(*DigestListAck); i { case 0: return &v.state @@ -6623,7 +6621,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[35].Exporter = func(v any, i int) any { switch v := v.(*StreamMessageResponse); i { case 0: return &v.state @@ -6635,7 +6633,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[36].Exporter = func(v any, i int) any { switch v := v.(*PacketIn); i { case 0: return &v.state @@ -6647,7 +6645,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[37].Exporter = func(v any, i int) any { switch v := v.(*DigestList); i { case 0: return &v.state @@ -6659,7 +6657,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[38].Exporter = func(v any, i int) any { switch v := v.(*PacketMetadata); i { case 0: return &v.state @@ -6671,7 +6669,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[39].Exporter = func(v any, i int) any { switch v := v.(*MasterArbitrationUpdate); i { case 0: return &v.state @@ -6683,7 +6681,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[40].Exporter = func(v any, i int) any { switch v := v.(*Role); i { case 0: return &v.state @@ -6695,7 +6693,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[41].Exporter = func(v any, i int) any { switch v := v.(*IdleTimeoutNotification); i { case 0: return &v.state @@ -6707,7 +6705,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[42].Exporter = func(v any, i int) any { switch v := v.(*StreamError); i { case 0: return &v.state @@ -6719,7 +6717,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[43].Exporter = func(v any, i int) any { switch v := v.(*PacketOutError); i { case 0: return &v.state @@ -6731,7 +6729,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[44].Exporter = func(v any, i int) any { switch v := v.(*DigestListAckError); i { case 0: return &v.state @@ -6743,7 +6741,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[45].Exporter = func(v any, i int) any { switch v := v.(*StreamOtherError); i { case 0: return &v.state @@ -6755,7 +6753,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[46].Exporter = func(v any, i int) any { switch v := v.(*Uint128); i { case 0: return &v.state @@ -6767,7 +6765,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[47].Exporter = func(v any, i int) any { switch v := v.(*SetForwardingPipelineConfigRequest); i { case 0: return &v.state @@ -6779,7 +6777,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[48].Exporter = func(v any, i int) any { switch v := v.(*SetForwardingPipelineConfigResponse); i { case 0: return &v.state @@ -6791,7 +6789,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[49].Exporter = func(v any, i int) any { switch v := v.(*ForwardingPipelineConfig); i { case 0: return &v.state @@ -6803,7 +6801,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[50].Exporter = func(v any, i int) any { switch v := v.(*GetForwardingPipelineConfigRequest); i { case 0: return &v.state @@ -6815,7 +6813,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[51].Exporter = func(v any, i int) any { switch v := v.(*GetForwardingPipelineConfigResponse); i { case 0: return &v.state @@ -6827,7 +6825,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[52].Exporter = func(v any, i int) any { switch v := v.(*Error); i { case 0: return &v.state @@ -6839,7 +6837,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[53].Exporter = func(v any, i int) any { switch v := v.(*CapabilitiesRequest); i { case 0: return &v.state @@ -6851,7 +6849,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[54].Exporter = func(v any, i int) any { switch v := v.(*CapabilitiesResponse); i { case 0: return &v.state @@ -6863,7 +6861,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[55].Exporter = func(v any, i int) any { switch v := v.(*TableEntry_IdleTimeout); i { case 0: return &v.state @@ -6875,7 +6873,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[56].Exporter = func(v any, i int) any { switch v := v.(*FieldMatch_Exact); i { case 0: return &v.state @@ -6887,7 +6885,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[57].Exporter = func(v any, i int) any { switch v := v.(*FieldMatch_Ternary); i { case 0: return &v.state @@ -6899,7 +6897,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[58].Exporter = func(v any, i int) any { switch v := v.(*FieldMatch_LPM); i { case 0: return &v.state @@ -6911,7 +6909,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[59].Exporter = func(v any, i int) any { switch v := v.(*FieldMatch_Range); i { case 0: return &v.state @@ -6923,7 +6921,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[60].Exporter = func(v any, i int) any { switch v := v.(*FieldMatch_Optional); i { case 0: return &v.state @@ -6935,7 +6933,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[61].Exporter = func(v any, i int) any { switch v := v.(*Action_Param); i { case 0: return &v.state @@ -6947,7 +6945,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[62].Exporter = func(v any, i int) any { switch v := v.(*ActionProfileGroup_Member); i { case 0: return &v.state @@ -6959,7 +6957,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[63].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[63].Exporter = func(v any, i int) any { switch v := v.(*DigestEntry_Config); i { case 0: return &v.state @@ -6971,7 +6969,7 @@ func file_p4_v1_p4runtime_proto_init() { return nil } } - file_p4_v1_p4runtime_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} { + file_p4_v1_p4runtime_proto_msgTypes[64].Exporter = func(v any, i int) any { switch v := v.(*ForwardingPipelineConfig_Cookie); i { case 0: return &v.state @@ -6984,7 +6982,7 @@ func file_p4_v1_p4runtime_proto_init() { } } } - file_p4_v1_p4runtime_proto_msgTypes[5].OneofWrappers = []interface{}{ + file_p4_v1_p4runtime_proto_msgTypes[5].OneofWrappers = []any{ (*Entity_ExternEntry)(nil), (*Entity_TableEntry)(nil), (*Entity_ActionProfileMember)(nil), @@ -6998,7 +6996,7 @@ func file_p4_v1_p4runtime_proto_init() { (*Entity_RegisterEntry)(nil), (*Entity_DigestEntry)(nil), } - file_p4_v1_p4runtime_proto_msgTypes[8].OneofWrappers = []interface{}{ + file_p4_v1_p4runtime_proto_msgTypes[8].OneofWrappers = []any{ (*FieldMatch_Exact_)(nil), (*FieldMatch_Ternary_)(nil), (*FieldMatch_Lpm)(nil), @@ -7006,31 +7004,31 @@ func file_p4_v1_p4runtime_proto_init() { (*FieldMatch_Optional_)(nil), (*FieldMatch_Other)(nil), } - file_p4_v1_p4runtime_proto_msgTypes[9].OneofWrappers = []interface{}{ + file_p4_v1_p4runtime_proto_msgTypes[9].OneofWrappers = []any{ (*TableAction_Action)(nil), (*TableAction_ActionProfileMemberId)(nil), (*TableAction_ActionProfileGroupId)(nil), (*TableAction_ActionProfileActionSet)(nil), } - file_p4_v1_p4runtime_proto_msgTypes[12].OneofWrappers = []interface{}{ + file_p4_v1_p4runtime_proto_msgTypes[12].OneofWrappers = []any{ (*ActionProfileAction_Watch)(nil), (*ActionProfileAction_WatchPort)(nil), } - file_p4_v1_p4runtime_proto_msgTypes[23].OneofWrappers = []interface{}{ + file_p4_v1_p4runtime_proto_msgTypes[23].OneofWrappers = []any{ (*PacketReplicationEngineEntry_MulticastGroupEntry)(nil), (*PacketReplicationEngineEntry_CloneSessionEntry)(nil), } - file_p4_v1_p4runtime_proto_msgTypes[25].OneofWrappers = []interface{}{ + file_p4_v1_p4runtime_proto_msgTypes[25].OneofWrappers = []any{ (*Replica_EgressPort)(nil), (*Replica_Port)(nil), } - file_p4_v1_p4runtime_proto_msgTypes[32].OneofWrappers = []interface{}{ + file_p4_v1_p4runtime_proto_msgTypes[32].OneofWrappers = []any{ (*StreamMessageRequest_Arbitration)(nil), (*StreamMessageRequest_Packet)(nil), (*StreamMessageRequest_DigestAck)(nil), (*StreamMessageRequest_Other)(nil), } - file_p4_v1_p4runtime_proto_msgTypes[35].OneofWrappers = []interface{}{ + file_p4_v1_p4runtime_proto_msgTypes[35].OneofWrappers = []any{ (*StreamMessageResponse_Arbitration)(nil), (*StreamMessageResponse_Packet)(nil), (*StreamMessageResponse_Digest)(nil), @@ -7038,12 +7036,12 @@ func file_p4_v1_p4runtime_proto_init() { (*StreamMessageResponse_Other)(nil), (*StreamMessageResponse_Error)(nil), } - file_p4_v1_p4runtime_proto_msgTypes[42].OneofWrappers = []interface{}{ + file_p4_v1_p4runtime_proto_msgTypes[42].OneofWrappers = []any{ (*StreamError_PacketOut)(nil), (*StreamError_DigestListAck)(nil), (*StreamError_Other)(nil), } - file_p4_v1_p4runtime_proto_msgTypes[62].OneofWrappers = []interface{}{ + file_p4_v1_p4runtime_proto_msgTypes[62].OneofWrappers = []any{ (*ActionProfileGroup_Member_Watch)(nil), (*ActionProfileGroup_Member_WatchPort)(nil), } diff --git a/go/p4/v1/p4runtime_grpc.pb.go b/go/p4/v1/p4runtime_grpc.pb.go index 495e3501..449e1b3b 100644 --- a/go/p4/v1/p4runtime_grpc.pb.go +++ b/go/p4/v1/p4runtime_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc v3.18.1 // source: p4/v1/p4runtime.proto @@ -21,8 +21,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( P4Runtime_Write_FullMethodName = "/p4.v1.P4Runtime/Write" @@ -40,7 +40,7 @@ type P4RuntimeClient interface { // Update one or more P4 entities on the target. Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*WriteResponse, error) // Read one or more P4 entities from the target. - Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (P4Runtime_ReadClient, error) + Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ReadResponse], error) // Sets the P4 forwarding-pipeline config. SetForwardingPipelineConfig(ctx context.Context, in *SetForwardingPipelineConfigRequest, opts ...grpc.CallOption) (*SetForwardingPipelineConfigResponse, error) // Gets the current P4 forwarding-pipeline config. @@ -48,14 +48,14 @@ type P4RuntimeClient interface { // Represents the bidirectional stream between the controller and the // switch (initiated by the controller), and is managed for the following // purposes: - // - connection initiation through client arbitration - // - indicating switch session liveness: the session is live when switch - // sends a positive client arbitration update to the controller, and is - // considered dead when either the stream breaks or the switch sends a - // negative update for client arbitration - // - the controller sending/receiving packets to/from the switch - // - streaming of notifications from the switch - StreamChannel(ctx context.Context, opts ...grpc.CallOption) (P4Runtime_StreamChannelClient, error) + // - connection initiation through client arbitration + // - indicating switch session liveness: the session is live when switch + // sends a positive client arbitration update to the controller, and is + // considered dead when either the stream breaks or the switch sends a + // negative update for client arbitration + // - the controller sending/receiving packets to/from the switch + // - streaming of notifications from the switch + StreamChannel(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StreamMessageRequest, StreamMessageResponse], error) Capabilities(ctx context.Context, in *CapabilitiesRequest, opts ...grpc.CallOption) (*CapabilitiesResponse, error) } @@ -68,20 +68,22 @@ func NewP4RuntimeClient(cc grpc.ClientConnInterface) P4RuntimeClient { } func (c *p4RuntimeClient) Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*WriteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(WriteResponse) - err := c.cc.Invoke(ctx, P4Runtime_Write_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, P4Runtime_Write_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *p4RuntimeClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (P4Runtime_ReadClient, error) { - stream, err := c.cc.NewStream(ctx, &P4Runtime_ServiceDesc.Streams[0], P4Runtime_Read_FullMethodName, opts...) +func (c *p4RuntimeClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ReadResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &P4Runtime_ServiceDesc.Streams[0], P4Runtime_Read_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &p4RuntimeReadClient{stream} + x := &grpc.GenericClientStream[ReadRequest, ReadResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -91,26 +93,13 @@ func (c *p4RuntimeClient) Read(ctx context.Context, in *ReadRequest, opts ...grp return x, nil } -type P4Runtime_ReadClient interface { - Recv() (*ReadResponse, error) - grpc.ClientStream -} - -type p4RuntimeReadClient struct { - grpc.ClientStream -} - -func (x *p4RuntimeReadClient) Recv() (*ReadResponse, error) { - m := new(ReadResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type P4Runtime_ReadClient = grpc.ServerStreamingClient[ReadResponse] func (c *p4RuntimeClient) SetForwardingPipelineConfig(ctx context.Context, in *SetForwardingPipelineConfigRequest, opts ...grpc.CallOption) (*SetForwardingPipelineConfigResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SetForwardingPipelineConfigResponse) - err := c.cc.Invoke(ctx, P4Runtime_SetForwardingPipelineConfig_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, P4Runtime_SetForwardingPipelineConfig_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -118,48 +107,32 @@ func (c *p4RuntimeClient) SetForwardingPipelineConfig(ctx context.Context, in *S } func (c *p4RuntimeClient) GetForwardingPipelineConfig(ctx context.Context, in *GetForwardingPipelineConfigRequest, opts ...grpc.CallOption) (*GetForwardingPipelineConfigResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetForwardingPipelineConfigResponse) - err := c.cc.Invoke(ctx, P4Runtime_GetForwardingPipelineConfig_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, P4Runtime_GetForwardingPipelineConfig_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *p4RuntimeClient) StreamChannel(ctx context.Context, opts ...grpc.CallOption) (P4Runtime_StreamChannelClient, error) { - stream, err := c.cc.NewStream(ctx, &P4Runtime_ServiceDesc.Streams[1], P4Runtime_StreamChannel_FullMethodName, opts...) +func (c *p4RuntimeClient) StreamChannel(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StreamMessageRequest, StreamMessageResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &P4Runtime_ServiceDesc.Streams[1], P4Runtime_StreamChannel_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &p4RuntimeStreamChannelClient{stream} + x := &grpc.GenericClientStream[StreamMessageRequest, StreamMessageResponse]{ClientStream: stream} return x, nil } -type P4Runtime_StreamChannelClient interface { - Send(*StreamMessageRequest) error - Recv() (*StreamMessageResponse, error) - grpc.ClientStream -} - -type p4RuntimeStreamChannelClient struct { - grpc.ClientStream -} - -func (x *p4RuntimeStreamChannelClient) Send(m *StreamMessageRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *p4RuntimeStreamChannelClient) Recv() (*StreamMessageResponse, error) { - m := new(StreamMessageResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type P4Runtime_StreamChannelClient = grpc.BidiStreamingClient[StreamMessageRequest, StreamMessageResponse] func (c *p4RuntimeClient) Capabilities(ctx context.Context, in *CapabilitiesRequest, opts ...grpc.CallOption) (*CapabilitiesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CapabilitiesResponse) - err := c.cc.Invoke(ctx, P4Runtime_Capabilities_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, P4Runtime_Capabilities_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -168,12 +141,12 @@ func (c *p4RuntimeClient) Capabilities(ctx context.Context, in *CapabilitiesRequ // P4RuntimeServer is the server API for P4Runtime service. // All implementations must embed UnimplementedP4RuntimeServer -// for forward compatibility +// for forward compatibility. type P4RuntimeServer interface { // Update one or more P4 entities on the target. Write(context.Context, *WriteRequest) (*WriteResponse, error) // Read one or more P4 entities from the target. - Read(*ReadRequest, P4Runtime_ReadServer) error + Read(*ReadRequest, grpc.ServerStreamingServer[ReadResponse]) error // Sets the P4 forwarding-pipeline config. SetForwardingPipelineConfig(context.Context, *SetForwardingPipelineConfigRequest) (*SetForwardingPipelineConfigResponse, error) // Gets the current P4 forwarding-pipeline config. @@ -181,26 +154,29 @@ type P4RuntimeServer interface { // Represents the bidirectional stream between the controller and the // switch (initiated by the controller), and is managed for the following // purposes: - // - connection initiation through client arbitration - // - indicating switch session liveness: the session is live when switch - // sends a positive client arbitration update to the controller, and is - // considered dead when either the stream breaks or the switch sends a - // negative update for client arbitration - // - the controller sending/receiving packets to/from the switch - // - streaming of notifications from the switch - StreamChannel(P4Runtime_StreamChannelServer) error + // - connection initiation through client arbitration + // - indicating switch session liveness: the session is live when switch + // sends a positive client arbitration update to the controller, and is + // considered dead when either the stream breaks or the switch sends a + // negative update for client arbitration + // - the controller sending/receiving packets to/from the switch + // - streaming of notifications from the switch + StreamChannel(grpc.BidiStreamingServer[StreamMessageRequest, StreamMessageResponse]) error Capabilities(context.Context, *CapabilitiesRequest) (*CapabilitiesResponse, error) mustEmbedUnimplementedP4RuntimeServer() } -// UnimplementedP4RuntimeServer must be embedded to have forward compatible implementations. -type UnimplementedP4RuntimeServer struct { -} +// UnimplementedP4RuntimeServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedP4RuntimeServer struct{} func (UnimplementedP4RuntimeServer) Write(context.Context, *WriteRequest) (*WriteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Write not implemented") } -func (UnimplementedP4RuntimeServer) Read(*ReadRequest, P4Runtime_ReadServer) error { +func (UnimplementedP4RuntimeServer) Read(*ReadRequest, grpc.ServerStreamingServer[ReadResponse]) error { return status.Errorf(codes.Unimplemented, "method Read not implemented") } func (UnimplementedP4RuntimeServer) SetForwardingPipelineConfig(context.Context, *SetForwardingPipelineConfigRequest) (*SetForwardingPipelineConfigResponse, error) { @@ -209,13 +185,14 @@ func (UnimplementedP4RuntimeServer) SetForwardingPipelineConfig(context.Context, func (UnimplementedP4RuntimeServer) GetForwardingPipelineConfig(context.Context, *GetForwardingPipelineConfigRequest) (*GetForwardingPipelineConfigResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetForwardingPipelineConfig not implemented") } -func (UnimplementedP4RuntimeServer) StreamChannel(P4Runtime_StreamChannelServer) error { +func (UnimplementedP4RuntimeServer) StreamChannel(grpc.BidiStreamingServer[StreamMessageRequest, StreamMessageResponse]) error { return status.Errorf(codes.Unimplemented, "method StreamChannel not implemented") } func (UnimplementedP4RuntimeServer) Capabilities(context.Context, *CapabilitiesRequest) (*CapabilitiesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Capabilities not implemented") } func (UnimplementedP4RuntimeServer) mustEmbedUnimplementedP4RuntimeServer() {} +func (UnimplementedP4RuntimeServer) testEmbeddedByValue() {} // UnsafeP4RuntimeServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to P4RuntimeServer will @@ -225,6 +202,13 @@ type UnsafeP4RuntimeServer interface { } func RegisterP4RuntimeServer(s grpc.ServiceRegistrar, srv P4RuntimeServer) { + // If the following call pancis, it indicates UnimplementedP4RuntimeServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&P4Runtime_ServiceDesc, srv) } @@ -251,21 +235,11 @@ func _P4Runtime_Read_Handler(srv interface{}, stream grpc.ServerStream) error { if err := stream.RecvMsg(m); err != nil { return err } - return srv.(P4RuntimeServer).Read(m, &p4RuntimeReadServer{stream}) -} - -type P4Runtime_ReadServer interface { - Send(*ReadResponse) error - grpc.ServerStream + return srv.(P4RuntimeServer).Read(m, &grpc.GenericServerStream[ReadRequest, ReadResponse]{ServerStream: stream}) } -type p4RuntimeReadServer struct { - grpc.ServerStream -} - -func (x *p4RuntimeReadServer) Send(m *ReadResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type P4Runtime_ReadServer = grpc.ServerStreamingServer[ReadResponse] func _P4Runtime_SetForwardingPipelineConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SetForwardingPipelineConfigRequest) @@ -304,30 +278,11 @@ func _P4Runtime_GetForwardingPipelineConfig_Handler(srv interface{}, ctx context } func _P4Runtime_StreamChannel_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(P4RuntimeServer).StreamChannel(&p4RuntimeStreamChannelServer{stream}) -} - -type P4Runtime_StreamChannelServer interface { - Send(*StreamMessageResponse) error - Recv() (*StreamMessageRequest, error) - grpc.ServerStream -} - -type p4RuntimeStreamChannelServer struct { - grpc.ServerStream -} - -func (x *p4RuntimeStreamChannelServer) Send(m *StreamMessageResponse) error { - return x.ServerStream.SendMsg(m) + return srv.(P4RuntimeServer).StreamChannel(&grpc.GenericServerStream[StreamMessageRequest, StreamMessageResponse]{ServerStream: stream}) } -func (x *p4RuntimeStreamChannelServer) Recv() (*StreamMessageRequest, error) { - m := new(StreamMessageRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type P4Runtime_StreamChannelServer = grpc.BidiStreamingServer[StreamMessageRequest, StreamMessageResponse] func _P4Runtime_Capabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CapabilitiesRequest) From ada7880842cc9ab942bb765937363144aac7b5af Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Mon, 29 Jun 2026 13:37:26 +0530 Subject: [PATCH 06/11] fix: normalize line endings in all shell scripts and generated files Signed-off-by: Devansh-567 --- py/p4/v1/p4runtime_pb2_grpc.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/py/p4/v1/p4runtime_pb2_grpc.py b/py/p4/v1/p4runtime_pb2_grpc.py index 4a1b97b6..251eeed3 100644 --- a/py/p4/v1/p4runtime_pb2_grpc.py +++ b/py/p4/v1/p4runtime_pb2_grpc.py @@ -50,44 +50,44 @@ class P4RuntimeServicer(object): """Missing associated documentation comment in .proto file.""" def Write(self, request, context): - """Update one or more P4 entities on the target. + """Update one or more P4 entities on the target. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def Read(self, request, context): - """Read one or more P4 entities from the target. + """Read one or more P4 entities from the target. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def SetForwardingPipelineConfig(self, request, context): - """Sets the P4 forwarding-pipeline config. + """Sets the P4 forwarding-pipeline config. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def GetForwardingPipelineConfig(self, request, context): - """Gets the current P4 forwarding-pipeline config. + """Gets the current P4 forwarding-pipeline config. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def StreamChannel(self, request_iterator, context): - """Represents the bidirectional stream between the controller and the - switch (initiated by the controller), and is managed for the following - purposes: - - connection initiation through client arbitration - - indicating switch session liveness: the session is live when switch - sends a positive client arbitration update to the controller, and is - considered dead when either the stream breaks or the switch sends a - negative update for client arbitration - - the controller sending/receiving packets to/from the switch - - streaming of notifications from the switch + """Represents the bidirectional stream between the controller and the + switch (initiated by the controller), and is managed for the following + purposes: + - connection initiation through client arbitration + - indicating switch session liveness: the session is live when switch + sends a positive client arbitration update to the controller, and is + considered dead when either the stream breaks or the switch sends a + negative update for client arbitration + - the controller sending/receiving packets to/from the switch + - streaming of notifications from the switch """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') From 974dd8a2570f3ffcc0c83411cb8c3a72de1b3b80 Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Mon, 29 Jun 2026 20:37:08 +0530 Subject: [PATCH 07/11] chore: add .gitattributes to enforce LF line endings Signed-off-by: Devansh-567 --- .gitattributes | 5 + py/LICENSE | 402 ++++++++++++++++----------------- py/README.md | 0 py/REUSE.toml | 60 ++--- py/p4/v1/p4runtime_pb2_grpc.py | 28 +-- py/pyproject.toml | 58 ++--- py/setup.cfg | 58 ++--- 7 files changed, 308 insertions(+), 303 deletions(-) create mode 100644 .gitattributes mode change 120000 => 100644 py/README.md diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..cbe73995 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +*.go text eol=lf +*.py text eol=lf +*.sh text eol=lf +*.mod text eol=lf +*.sum text eol=lf diff --git a/py/LICENSE b/py/LICENSE index 261eeb9e..29f81d81 100644 --- a/py/LICENSE +++ b/py/LICENSE @@ -1,201 +1,201 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/py/README.md b/py/README.md deleted file mode 120000 index 32d46ee8..00000000 --- a/py/README.md +++ /dev/null @@ -1 +0,0 @@ -../README.md \ No newline at end of file diff --git a/py/README.md b/py/README.md new file mode 100644 index 00000000..32d46ee8 --- /dev/null +++ b/py/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/py/REUSE.toml b/py/REUSE.toml index 8955195a..8befd05f 100644 --- a/py/REUSE.toml +++ b/py/REUSE.toml @@ -1,30 +1,30 @@ -# This file is used by the `reuse` tool for copyright and license -# validation. - -# In order for `reuse lint` to pass, all files in the repo must have -# copyright and license annotations. - -# The three ways to achieve that are: - -# (1) Put comments with those annotations in each individual source file. - -# (2) For file x/y/z, add a separate file named x/y/z.license with the copyright and license annotations. - -# (3) Create a REUSE.toml file that specifies which files it covers, -# and what their copyright and license annotations are. - -# All of the files in the py/p4 directory of this repo are -# autogenerated, by running the command `CI/check_codegen.sh`. The -# most straightforward approach among the 3 listed above is number -# (3). The path of "py/**" below is glob syntax for reuse that means -# "all files in the p4 directory, and all subdirectories, -# recursively". - -version = 1 - -[[annotations]] -path = [ - "p4/**" -] -SPDX-FileCopyrightText = "2020 The P4 Language Consortium" -SPDX-License-Identifier = "Apache-2.0" +# This file is used by the `reuse` tool for copyright and license +# validation. + +# In order for `reuse lint` to pass, all files in the repo must have +# copyright and license annotations. + +# The three ways to achieve that are: + +# (1) Put comments with those annotations in each individual source file. + +# (2) For file x/y/z, add a separate file named x/y/z.license with the copyright and license annotations. + +# (3) Create a REUSE.toml file that specifies which files it covers, +# and what their copyright and license annotations are. + +# All of the files in the py/p4 directory of this repo are +# autogenerated, by running the command `CI/check_codegen.sh`. The +# most straightforward approach among the 3 listed above is number +# (3). The path of "py/**" below is glob syntax for reuse that means +# "all files in the p4 directory, and all subdirectories, +# recursively". + +version = 1 + +[[annotations]] +path = [ + "p4/**" +] +SPDX-FileCopyrightText = "2020 The P4 Language Consortium" +SPDX-License-Identifier = "Apache-2.0" diff --git a/py/p4/v1/p4runtime_pb2_grpc.py b/py/p4/v1/p4runtime_pb2_grpc.py index 251eeed3..4a1b97b6 100644 --- a/py/p4/v1/p4runtime_pb2_grpc.py +++ b/py/p4/v1/p4runtime_pb2_grpc.py @@ -50,44 +50,44 @@ class P4RuntimeServicer(object): """Missing associated documentation comment in .proto file.""" def Write(self, request, context): - """Update one or more P4 entities on the target. + """Update one or more P4 entities on the target. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def Read(self, request, context): - """Read one or more P4 entities from the target. + """Read one or more P4 entities from the target. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def SetForwardingPipelineConfig(self, request, context): - """Sets the P4 forwarding-pipeline config. + """Sets the P4 forwarding-pipeline config. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def GetForwardingPipelineConfig(self, request, context): - """Gets the current P4 forwarding-pipeline config. + """Gets the current P4 forwarding-pipeline config. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def StreamChannel(self, request_iterator, context): - """Represents the bidirectional stream between the controller and the - switch (initiated by the controller), and is managed for the following - purposes: - - connection initiation through client arbitration - - indicating switch session liveness: the session is live when switch - sends a positive client arbitration update to the controller, and is - considered dead when either the stream breaks or the switch sends a - negative update for client arbitration - - the controller sending/receiving packets to/from the switch - - streaming of notifications from the switch + """Represents the bidirectional stream between the controller and the + switch (initiated by the controller), and is managed for the following + purposes: + - connection initiation through client arbitration + - indicating switch session liveness: the session is live when switch + sends a positive client arbitration update to the controller, and is + considered dead when either the stream breaks or the switch sends a + negative update for client arbitration + - the controller sending/receiving packets to/from the switch + - streaming of notifications from the switch """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') diff --git a/py/pyproject.toml b/py/pyproject.toml index 5367d237..be45e4ad 100644 --- a/py/pyproject.toml +++ b/py/pyproject.toml @@ -1,29 +1,29 @@ -# Copyright 2022 Antonin Bas -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -[build-system] -requires = [ - "setuptools", - "setuptools_scm[toml]", - "setuptools_scm_git_archive", - "wheel", -] -build-backend = 'setuptools.build_meta' - -[tool.setuptools_scm] -root = "../" -# use current tag and not next one -version_scheme = "post-release" +# Copyright 2022 Antonin Bas +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +[build-system] +requires = [ + "setuptools", + "setuptools_scm[toml]", + "setuptools_scm_git_archive", + "wheel", +] +build-backend = 'setuptools.build_meta' + +[tool.setuptools_scm] +root = "../" +# use current tag and not next one +version_scheme = "post-release" diff --git a/py/setup.cfg b/py/setup.cfg index d079d08d..2bc1847d 100644 --- a/py/setup.cfg +++ b/py/setup.cfg @@ -1,29 +1,29 @@ -# SPDX-FileCopyrightText: 2022 Antonin Bas -# -# SPDX-License-Identifier: Apache-2.0 - -[metadata] -name = p4runtime -description = Python bindings for P4Runtime protocol -long_description = file: README.md -long_description_content_type = text/markdown; charset=UTF-8 -url = https://github.com/p4lang/p4runtime -author = P4 API Working Group -author_email = p4-api@lists.p4.org -license = Apache-2.0 -license_file = LICENSE -classifiers = - License :: OSI Approved :: Apache Software License - Programming Language :: Python - Programming Language :: Python :: 3 - -[options] -packages = find: -platforms = any -python_requires = >=3.6 -setup_requires = - setuptools_scm -install_requires = - protobuf >= 3.6.1 - grpcio >= 1.17.2 - googleapis-common-protos >= 1.52 +# SPDX-FileCopyrightText: 2022 Antonin Bas +# +# SPDX-License-Identifier: Apache-2.0 + +[metadata] +name = p4runtime +description = Python bindings for P4Runtime protocol +long_description = file: README.md +long_description_content_type = text/markdown; charset=UTF-8 +url = https://github.com/p4lang/p4runtime +author = P4 API Working Group +author_email = p4-api@lists.p4.org +license = Apache-2.0 +license_file = LICENSE +classifiers = + License :: OSI Approved :: Apache Software License + Programming Language :: Python + Programming Language :: Python :: 3 + +[options] +packages = find: +platforms = any +python_requires = >=3.6 +setup_requires = + setuptools_scm +install_requires = + protobuf >= 3.6.1 + grpcio >= 1.17.2 + googleapis-common-protos >= 1.52 From dd72455f0ea0d2d76b2ff0ff37aa85f567fa0c3f Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Mon, 29 Jun 2026 20:39:36 +0530 Subject: [PATCH 08/11] chore: add SPDX license headers to .gitattributes and py/README.md Signed-off-by: Devansh-567 --- .gitattributes | 7 +++++++ py/README.md | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/.gitattributes b/.gitattributes index cbe73995..3a783388 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,12 @@ +# SPDX-FileCopyrightText: 2024 P4 API Working Group +# SPDX-License-Identifier: Apache-2.0 + *.go text eol=lf *.py text eol=lf *.sh text eol=lf *.mod text eol=lf *.sum text eol=lf +# SPDX-FileCopyrightText: 2024 P4 API Working Group +# SPDX-License-Identifier: Apache-2.0 + + diff --git a/py/README.md b/py/README.md index 32d46ee8..ead3be5a 100644 --- a/py/README.md +++ b/py/README.md @@ -1 +1,6 @@ + + ../README.md \ No newline at end of file From a1911b041e25fe8446fde7cb54242813f046eefd Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Mon, 29 Jun 2026 20:44:26 +0530 Subject: [PATCH 09/11] fix: use git diff instead of git status in check_codegen for CRLF safety Signed-off-by: Devansh-567 --- CI/check_codegen.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/check_codegen.sh b/CI/check_codegen.sh index af8e57f8..ea8d3a74 100755 --- a/CI/check_codegen.sh +++ b/CI/check_codegen.sh @@ -26,7 +26,7 @@ rm -rf go/* rm -rf py/p4 ./codegen/update.sh -go_diff="$(git status --porcelain go go.mod go.sum)" +go_diff="$(git diff --name-only go/ go.mod go.sum)" # Ensure generated Go files are up-to-date if [ -n "$go_diff" ]; then @@ -38,7 +38,7 @@ if [ -n "$go_diff" ]; then exit 1 fi -py_diff="$(git status --porcelain py)" +py_diff="$(git diff --name-only py/)" if [ -n "$py_diff" ]; then echo "ERROR: The generated Python files are not up-to-date." From 61d26a5020ab7aeaf23621de867c487023bd121b Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Tue, 30 Jun 2026 10:24:53 +0530 Subject: [PATCH 10/11] fix: revert unintended CRLF conversion in unrelated py/ files Signed-off-by: Devansh-567 --- py/LICENSE | 402 +++++++++++++++++++++++----------------------- py/REUSE.toml | 60 +++---- py/pyproject.toml | 58 +++---- py/setup.cfg | 58 +++---- 4 files changed, 289 insertions(+), 289 deletions(-) diff --git a/py/LICENSE b/py/LICENSE index 29f81d81..261eeb9e 100644 --- a/py/LICENSE +++ b/py/LICENSE @@ -1,201 +1,201 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/py/REUSE.toml b/py/REUSE.toml index 8befd05f..8955195a 100644 --- a/py/REUSE.toml +++ b/py/REUSE.toml @@ -1,30 +1,30 @@ -# This file is used by the `reuse` tool for copyright and license -# validation. - -# In order for `reuse lint` to pass, all files in the repo must have -# copyright and license annotations. - -# The three ways to achieve that are: - -# (1) Put comments with those annotations in each individual source file. - -# (2) For file x/y/z, add a separate file named x/y/z.license with the copyright and license annotations. - -# (3) Create a REUSE.toml file that specifies which files it covers, -# and what their copyright and license annotations are. - -# All of the files in the py/p4 directory of this repo are -# autogenerated, by running the command `CI/check_codegen.sh`. The -# most straightforward approach among the 3 listed above is number -# (3). The path of "py/**" below is glob syntax for reuse that means -# "all files in the p4 directory, and all subdirectories, -# recursively". - -version = 1 - -[[annotations]] -path = [ - "p4/**" -] -SPDX-FileCopyrightText = "2020 The P4 Language Consortium" -SPDX-License-Identifier = "Apache-2.0" +# This file is used by the `reuse` tool for copyright and license +# validation. + +# In order for `reuse lint` to pass, all files in the repo must have +# copyright and license annotations. + +# The three ways to achieve that are: + +# (1) Put comments with those annotations in each individual source file. + +# (2) For file x/y/z, add a separate file named x/y/z.license with the copyright and license annotations. + +# (3) Create a REUSE.toml file that specifies which files it covers, +# and what their copyright and license annotations are. + +# All of the files in the py/p4 directory of this repo are +# autogenerated, by running the command `CI/check_codegen.sh`. The +# most straightforward approach among the 3 listed above is number +# (3). The path of "py/**" below is glob syntax for reuse that means +# "all files in the p4 directory, and all subdirectories, +# recursively". + +version = 1 + +[[annotations]] +path = [ + "p4/**" +] +SPDX-FileCopyrightText = "2020 The P4 Language Consortium" +SPDX-License-Identifier = "Apache-2.0" diff --git a/py/pyproject.toml b/py/pyproject.toml index be45e4ad..5367d237 100644 --- a/py/pyproject.toml +++ b/py/pyproject.toml @@ -1,29 +1,29 @@ -# Copyright 2022 Antonin Bas -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -[build-system] -requires = [ - "setuptools", - "setuptools_scm[toml]", - "setuptools_scm_git_archive", - "wheel", -] -build-backend = 'setuptools.build_meta' - -[tool.setuptools_scm] -root = "../" -# use current tag and not next one -version_scheme = "post-release" +# Copyright 2022 Antonin Bas +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +[build-system] +requires = [ + "setuptools", + "setuptools_scm[toml]", + "setuptools_scm_git_archive", + "wheel", +] +build-backend = 'setuptools.build_meta' + +[tool.setuptools_scm] +root = "../" +# use current tag and not next one +version_scheme = "post-release" diff --git a/py/setup.cfg b/py/setup.cfg index 2bc1847d..d079d08d 100644 --- a/py/setup.cfg +++ b/py/setup.cfg @@ -1,29 +1,29 @@ -# SPDX-FileCopyrightText: 2022 Antonin Bas -# -# SPDX-License-Identifier: Apache-2.0 - -[metadata] -name = p4runtime -description = Python bindings for P4Runtime protocol -long_description = file: README.md -long_description_content_type = text/markdown; charset=UTF-8 -url = https://github.com/p4lang/p4runtime -author = P4 API Working Group -author_email = p4-api@lists.p4.org -license = Apache-2.0 -license_file = LICENSE -classifiers = - License :: OSI Approved :: Apache Software License - Programming Language :: Python - Programming Language :: Python :: 3 - -[options] -packages = find: -platforms = any -python_requires = >=3.6 -setup_requires = - setuptools_scm -install_requires = - protobuf >= 3.6.1 - grpcio >= 1.17.2 - googleapis-common-protos >= 1.52 +# SPDX-FileCopyrightText: 2022 Antonin Bas +# +# SPDX-License-Identifier: Apache-2.0 + +[metadata] +name = p4runtime +description = Python bindings for P4Runtime protocol +long_description = file: README.md +long_description_content_type = text/markdown; charset=UTF-8 +url = https://github.com/p4lang/p4runtime +author = P4 API Working Group +author_email = p4-api@lists.p4.org +license = Apache-2.0 +license_file = LICENSE +classifiers = + License :: OSI Approved :: Apache Software License + Programming Language :: Python + Programming Language :: Python :: 3 + +[options] +packages = find: +platforms = any +python_requires = >=3.6 +setup_requires = + setuptools_scm +install_requires = + protobuf >= 3.6.1 + grpcio >= 1.17.2 + googleapis-common-protos >= 1.52 From 914a61aa27261ced801276339f3aa7173d89dbb6 Mon Sep 17 00:00:00 2001 From: Devansh-567 Date: Tue, 30 Jun 2026 11:05:10 +0530 Subject: [PATCH 11/11] fix: clean up line-ending attributes Signed-off-by: Devansh-567 --- .gitattributes | 15 ++++++--------- py/README.md | 5 ----- 2 files changed, 6 insertions(+), 14 deletions(-) mode change 100644 => 120000 py/README.md diff --git a/.gitattributes b/.gitattributes index 3a783388..5f81b359 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,12 +1,9 @@ # SPDX-FileCopyrightText: 2024 P4 API Working Group # SPDX-License-Identifier: Apache-2.0 -*.go text eol=lf -*.py text eol=lf -*.sh text eol=lf -*.mod text eol=lf -*.sum text eol=lf -# SPDX-FileCopyrightText: 2024 P4 API Working Group -# SPDX-License-Identifier: Apache-2.0 - - +*.go text eol=lf +*.mod text eol=lf +*.py text eol=lf +*.sh text eol=lf +*.sum text eol=lf +*.toml text eol=lf diff --git a/py/README.md b/py/README.md deleted file mode 100644 index ead3be5a..00000000 --- a/py/README.md +++ /dev/null @@ -1,6 +0,0 @@ - - -../README.md \ No newline at end of file diff --git a/py/README.md b/py/README.md new file mode 120000 index 00000000..32d46ee8 --- /dev/null +++ b/py/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file