[xDS Proto] Remove Python's usage of copied proto files (#29516)

pull/29790/head
Lidi Zheng 3 years ago committed by GitHub
parent 3f5931294e
commit 8d83842c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      requirements.bazel.txt
  2. 8
      src/python/grpcio_csds/grpc_csds/BUILD.bazel
  3. 11
      src/python/grpcio_csds/grpc_csds/__init__.py
  4. 9
      src/python/grpcio_tests/tests/csds/test_csds.py

@ -17,3 +17,4 @@ googleapis-common-protos==1.5.5
gevent==21.1.2 gevent==21.1.2
zope.event==4.5.0 zope.event==4.5.0
setuptools==44.1.1 setuptools==44.1.1
xds-protos==0.0.11

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
py_library( py_library(
@ -19,11 +21,7 @@ py_library(
srcs = glob(["*.py"]), srcs = glob(["*.py"]),
imports = ["../"], imports = ["../"],
deps = [ deps = [
"//src/proto/grpc/testing/xds/v3:base_py_pb2", requirement("xds-protos"),
"//src/proto/grpc/testing/xds/v3:config_dump_py_pb2",
"//src/proto/grpc/testing/xds/v3:csds_py_pb2",
"//src/proto/grpc/testing/xds/v3:csds_py_pb2_grpc",
"//src/proto/grpc/testing/xds/v3:percent_py_pb2",
"//src/python/grpcio/grpc:grpcio", "//src/python/grpcio/grpc:grpcio",
], ],
) )

@ -13,16 +13,11 @@
# limitations under the License. # limitations under the License.
"""Channelz debug service implementation in gRPC Python.""" """Channelz debug service implementation in gRPC Python."""
from envoy.service.status.v3 import csds_pb2
from envoy.service.status.v3 import csds_pb2_grpc
from google.protobuf import json_format from google.protobuf import json_format
from grpc._cython import cygrpc from grpc._cython import cygrpc
try:
from envoy.service.status.v3 import csds_pb2
from envoy.service.status.v3 import csds_pb2_grpc
except ImportError:
from src.proto.grpc.testing.xds.v3 import csds_pb2
from src.proto.grpc.testing.xds.v3 import csds_pb2_grpc
class ClientStatusDiscoveryServiceServicer( class ClientStatusDiscoveryServiceServicer(
csds_pb2_grpc.ClientStatusDiscoveryServiceServicer): csds_pb2_grpc.ClientStatusDiscoveryServiceServicer):
@ -49,7 +44,7 @@ def add_csds_servicer(server):
CSDS is part of xDS protocol used to expose in-effective traffic CSDS is part of xDS protocol used to expose in-effective traffic
configuration (or xDS resources). It focuses on simplify the debugging of configuration (or xDS resources). It focuses on simplify the debugging of
unexpected routing behaviors, which could be due to a misconfiguration, unexpected routing behaviors, which could be due to a misconfiguration,
unhealthy backends or issues in the control or data plane. unhealthy backends or issues in the control or data plane.
Args: Args:
server: A gRPC server to which the CSDS service will be added. server: A gRPC server to which the CSDS service will be added.

@ -20,18 +20,13 @@ import sys
import time import time
import unittest import unittest
from envoy.service.status.v3 import csds_pb2
from envoy.service.status.v3 import csds_pb2_grpc
from google.protobuf import json_format from google.protobuf import json_format
import grpc import grpc
import grpc_csds import grpc_csds
from six.moves import queue from six.moves import queue
try:
from envoy.service.status.v3 import csds_pb2
from envoy.service.status.v3 import csds_pb2_grpc
except ImportError:
from src.proto.grpc.testing.xds.v3 import csds_pb2
from src.proto.grpc.testing.xds.v3 import csds_pb2_grpc
_DUMMY_XDS_ADDRESS = 'xds:///foo.bar' _DUMMY_XDS_ADDRESS = 'xds:///foo.bar'
_DUMMY_BOOTSTRAP_FILE = """ _DUMMY_BOOTSTRAP_FILE = """
{ {

Loading…
Cancel
Save