diff --git a/common_requirements.in b/common_requirements.in index e1bcad78bfc23217633fb28ef28a2d70d070644a..b277265768c9726f17ab046d8aa932167615f523 100644 --- a/common_requirements.in +++ b/common_requirements.in @@ -15,6 +15,7 @@ coverage==6.3 grpcio==1.47.* grpcio-health-checking==1.47.* +grpcio-reflection==1.47.* grpcio-tools==1.47.* grpclib==0.4.4 prettytable==3.5.0 diff --git a/scripts/grpcurl_inspect_context.sh b/scripts/grpcurl_inspect_context.sh new file mode 100755 index 0000000000000000000000000000000000000000..dda920a7a1899a9d8cdc3e1d1c7c576463c66fed --- /dev/null +++ b/scripts/grpcurl_inspect_context.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# +# 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. + +######################################################################################################################## +# Define your deployment settings here +######################################################################################################################## + +# If not already set, set the name of the Kubernetes namespace to deploy to. +export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"} + +######################################################################################################################## +# Automated steps start here +######################################################################################################################## + +# Ref: https://github.com/fullstorydev/grpcurl + +source tfs_runtime_env_vars.sh + +GRPC_ENDPOINT="$CONTEXTSERVICE_SERVICE_HOST:$CONTEXTSERVICE_SERVICE_PORT_GRPC" +GRP_CURL_CMD="docker run fullstorydev/grpcurl --plaintext $GRPC_ENDPOINT" + +GRPC_SERVICES=`$GRP_CURL_CMD list` +echo "gRPC Services found in $GRPC_ENDPOINT:" +printf "\n" + +for GRPC_SERVICE in $GRPC_SERVICES; do + echo "gRPC Service: $GRPC_SERVICE" + $GRP_CURL_CMD describe $GRPC_SERVICE + printf "\n" +done + +echo "Done!" diff --git a/scripts/grpcurl_inspect_device.sh b/scripts/grpcurl_inspect_device.sh new file mode 100755 index 0000000000000000000000000000000000000000..0e1202fb6ed3b0306f3dfe03cd60eeb55c7abe83 --- /dev/null +++ b/scripts/grpcurl_inspect_device.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# +# 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. + +######################################################################################################################## +# Define your deployment settings here +######################################################################################################################## + +# If not already set, set the name of the Kubernetes namespace to deploy to. +export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"} + +######################################################################################################################## +# Automated steps start here +######################################################################################################################## + +# Ref: https://github.com/fullstorydev/grpcurl + +source tfs_runtime_env_vars.sh + +GRPC_ENDPOINT="$DEVICESERVICE_SERVICE_HOST:$DEVICESERVICE_SERVICE_PORT_GRPC" +GRP_CURL_CMD="docker run fullstorydev/grpcurl --plaintext $GRPC_ENDPOINT" + +GRPC_SERVICES=`$GRP_CURL_CMD list` +echo "gRPC Services found in $GRPC_ENDPOINT:" +printf "\n" + +for GRPC_SERVICE in $GRPC_SERVICES; do + echo "gRPC Service: $GRPC_SERVICE" + $GRP_CURL_CMD describe $GRPC_SERVICE + printf "\n" +done + +echo "Done!" diff --git a/scripts/grpcurl_inspect_pathcomp_frontend.sh b/scripts/grpcurl_inspect_pathcomp_frontend.sh new file mode 100755 index 0000000000000000000000000000000000000000..686f7ae1e46aed2c60a33cd7fc7265ff1b5a3762 --- /dev/null +++ b/scripts/grpcurl_inspect_pathcomp_frontend.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# +# 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. + +######################################################################################################################## +# Define your deployment settings here +######################################################################################################################## + +# If not already set, set the name of the Kubernetes namespace to deploy to. +export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"} + +######################################################################################################################## +# Automated steps start here +######################################################################################################################## + +# Ref: https://github.com/fullstorydev/grpcurl + +source tfs_runtime_env_vars.sh + +GRPC_ENDPOINT="$PATHCOMPSERVICE_SERVICE_HOST:$PATHCOMPSERVICE_SERVICE_PORT_GRPC" +GRP_CURL_CMD="docker run fullstorydev/grpcurl --plaintext $GRPC_ENDPOINT" + +GRPC_SERVICES=`$GRP_CURL_CMD list` +echo "gRPC Services found in $GRPC_ENDPOINT:" +printf "\n" + +for GRPC_SERVICE in $GRPC_SERVICES; do + echo "gRPC Service: $GRPC_SERVICE" + $GRP_CURL_CMD describe $GRPC_SERVICE + printf "\n" +done + +echo "Done!" diff --git a/scripts/grpcurl_inspect_service.sh b/scripts/grpcurl_inspect_service.sh new file mode 100755 index 0000000000000000000000000000000000000000..f1b674ee5aa8d7f0a1878840cc1f674d61b51ea5 --- /dev/null +++ b/scripts/grpcurl_inspect_service.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# +# 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. + +######################################################################################################################## +# Define your deployment settings here +######################################################################################################################## + +# If not already set, set the name of the Kubernetes namespace to deploy to. +export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"} + +######################################################################################################################## +# Automated steps start here +######################################################################################################################## + +# Ref: https://github.com/fullstorydev/grpcurl + +source tfs_runtime_env_vars.sh + +GRPC_ENDPOINT="$SERVICESERVICE_SERVICE_HOST:$SERVICESERVICE_SERVICE_PORT_GRPC" +GRP_CURL_CMD="docker run fullstorydev/grpcurl --plaintext $GRPC_ENDPOINT" + +GRPC_SERVICES=`$GRP_CURL_CMD list` +echo "gRPC Services found in $GRPC_ENDPOINT:" +printf "\n" + +for GRPC_SERVICE in $GRPC_SERVICES; do + echo "gRPC Service: $GRPC_SERVICE" + $GRP_CURL_CMD describe $GRPC_SERVICE + printf "\n" +done + +echo "Done!" diff --git a/scripts/grpcurl_inspect_slice.sh b/scripts/grpcurl_inspect_slice.sh new file mode 100755 index 0000000000000000000000000000000000000000..170be7bf567c5f7adb0d84db62416ecc0d512f21 --- /dev/null +++ b/scripts/grpcurl_inspect_slice.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# +# 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. + +######################################################################################################################## +# Define your deployment settings here +######################################################################################################################## + +# If not already set, set the name of the Kubernetes namespace to deploy to. +export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"} + +######################################################################################################################## +# Automated steps start here +######################################################################################################################## + +# Ref: https://github.com/fullstorydev/grpcurl + +source tfs_runtime_env_vars.sh + +GRPC_ENDPOINT="$SLICESERVICE_SERVICE_HOST:$SLICESERVICE_SERVICE_PORT_GRPC" +GRP_CURL_CMD="docker run fullstorydev/grpcurl --plaintext $GRPC_ENDPOINT" + +GRPC_SERVICES=`$GRP_CURL_CMD list` +echo "gRPC Services found in $GRPC_ENDPOINT:" +printf "\n" + +for GRPC_SERVICE in $GRPC_SERVICES; do + echo "gRPC Service: $GRPC_SERVICE" + $GRP_CURL_CMD describe $GRPC_SERVICE + printf "\n" +done + +echo "Done!" diff --git a/src/common/tools/service/GenericGrpcService.py b/src/common/tools/service/GenericGrpcService.py index f29582fff87f4ca89ee44c78adbec33f321a9a39..453309127ccf49272d004740c1e3be52cba26779 100644 --- a/src/common/tools/service/GenericGrpcService.py +++ b/src/common/tools/service/GenericGrpcService.py @@ -12,18 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Union import grpc, logging from concurrent import futures +from typing import Any, List, Optional, Union from grpc_health.v1.health import HealthServicer, OVERALL_HEALTH from grpc_health.v1.health_pb2 import HealthCheckResponse from grpc_health.v1.health_pb2_grpc import add_HealthServicer_to_server +from grpc_reflection.v1alpha import reflection from common.Settings import get_grpc_bind_address, get_grpc_grace_period, get_grpc_max_workers class GenericGrpcService: def __init__( - self, bind_port : Union[str, int], bind_address : Optional[str] = None, max_workers : Optional[int] = None, - grace_period : Optional[int] = None, enable_health_servicer : bool = True, cls_name : str = __name__ + self, bind_port : Union[str, int], bind_address : Optional[str] = None, + max_workers : Optional[int] = None, grace_period : Optional[int] = None, + enable_health_servicer : bool = True, enable_reflection : bool = True, + cls_name : str = __name__ ) -> None: self.logger = logging.getLogger(cls_name) self.bind_port = bind_port @@ -31,6 +34,8 @@ class GenericGrpcService: self.max_workers = get_grpc_max_workers() if max_workers is None else max_workers self.grace_period = get_grpc_grace_period() if grace_period is None else grace_period self.enable_health_servicer = enable_health_servicer + self.enable_reflection = enable_reflection + self.reflection_service_names : List[str] = [reflection.SERVICE_NAME] self.endpoint = None self.health_servicer = None self.pool = None @@ -39,6 +44,11 @@ class GenericGrpcService: def install_servicers(self): pass + def add_reflection_service_name(self, service_descriptor : Any, service_name : str): + self.reflection_service_names.append( + service_descriptor.services_by_name[service_name].full_name + ) + def start(self): self.endpoint = '{:s}:{:s}'.format(str(self.bind_address), str(self.bind_port)) self.logger.info('Starting Service (tentative endpoint: {:s}, max_workers: {:s})...'.format( @@ -54,6 +64,9 @@ class GenericGrpcService: experimental_non_blocking=True, experimental_thread_pool=futures.ThreadPoolExecutor(max_workers=1)) add_HealthServicer_to_server(self.health_servicer, self.server) + if self.enable_reflection: + reflection.enable_server_reflection(self.reflection_service_names, self.server) + self.bind_port = self.server.add_insecure_port(self.endpoint) self.endpoint = '{:s}:{:s}'.format(str(self.bind_address), str(self.bind_port)) self.logger.info('Listening on {:s}...'.format(str(self.endpoint))) diff --git a/src/common/tools/service/GenericGrpcServiceAsync.py b/src/common/tools/service/GenericGrpcServiceAsync.py index 1d652deb79e1389e2403d1d13debcba7dbc43ecc..551a3d568612f59c2bc26f692ab8d1d27dc4f4b3 100644 --- a/src/common/tools/service/GenericGrpcServiceAsync.py +++ b/src/common/tools/service/GenericGrpcServiceAsync.py @@ -12,19 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Union -import grpc -import logging +import grpc, logging from concurrent import futures +from typing import Any, List, Optional, Union from grpc_health.v1.health import HealthServicer, OVERALL_HEALTH from grpc_health.v1.health_pb2 import HealthCheckResponse from grpc_health.v1.health_pb2_grpc import add_HealthServicer_to_server +from grpc_reflection.v1alpha import reflection from common.Settings import get_grpc_bind_address, get_grpc_grace_period, get_grpc_max_workers class GenericGrpcServiceAsync: def __init__( - self, bind_port: Union[str, int], bind_address: Optional[str] = None, max_workers: Optional[int] = None, - grace_period: Optional[int] = None, enable_health_servicer: bool = True, cls_name: str = __name__ + self, bind_port : Union[str, int], bind_address : Optional[str] = None, + max_workers : Optional[int] = None, grace_period : Optional[int] = None, + enable_health_servicer : bool = True, enable_reflection : bool = True, + cls_name : str = __name__ ) -> None: self.logger = logging.getLogger(cls_name) self.bind_port = bind_port @@ -32,6 +34,8 @@ class GenericGrpcServiceAsync: self.max_workers = get_grpc_max_workers() if max_workers is None else max_workers self.grace_period = get_grpc_grace_period() if grace_period is None else grace_period self.enable_health_servicer = enable_health_servicer + self.enable_reflection = enable_reflection + self.reflection_service_names : List[str] = [reflection.SERVICE_NAME] self.endpoint = None self.health_servicer = None self.pool = None @@ -40,7 +44,12 @@ class GenericGrpcServiceAsync: async def install_servicers(self): pass - async def start(self): + def add_reflection_service_name(self, service_descriptor : Any, service_name : str): + self.reflection_service_names.append( + service_descriptor.services_by_name[service_name].full_name + ) + + def start(self): self.endpoint = '{:s}:{:s}'.format(str(self.bind_address), str(self.bind_port)) self.logger.info('Starting Service (tentative endpoint: {:s}, max_workers: {:s})...'.format( str(self.endpoint), str(self.max_workers))) @@ -55,6 +64,9 @@ class GenericGrpcServiceAsync: experimental_non_blocking=True, experimental_thread_pool=futures.ThreadPoolExecutor(max_workers=1)) add_HealthServicer_to_server(self.health_servicer, self.server) + if self.enable_reflection: + reflection.enable_server_reflection(self.reflection_service_names, self.server) + self.bind_port = self.server.add_insecure_port(self.endpoint) self.endpoint = '{:s}:{:s}'.format(str(self.bind_address), str(self.bind_port)) self.logger.info('Listening on {:s}...'.format(str(self.endpoint))) diff --git a/src/context/service/ContextService.py b/src/context/service/ContextService.py index a385f4481ec022b475649b749f5206512fe216b2..d633dea15a1e00316c9e8eac9d31ca69829f180f 100644 --- a/src/context/service/ContextService.py +++ b/src/context/service/ContextService.py @@ -16,7 +16,9 @@ import logging, sqlalchemy from common.Constants import ServiceNameEnum from common.Settings import get_service_port_grpc from common.message_broker.MessageBroker import MessageBroker +from common.proto.context_pb2 import DESCRIPTOR as CONTEXT_DESCRIPTOR from common.proto.context_pb2_grpc import add_ContextServiceServicer_to_server +from common.proto.context_policy_pb2 import DESCRIPTOR as CONTEXT_POLICY_DESCRIPTOR from common.proto.context_policy_pb2_grpc import add_ContextPolicyServiceServicer_to_server from common.tools.service.GenericGrpcService import GenericGrpcService from .ContextServiceServicerImpl import ContextServiceServicerImpl @@ -36,3 +38,6 @@ class ContextService(GenericGrpcService): def install_servicers(self): add_ContextServiceServicer_to_server(self.context_servicer, self.server) add_ContextPolicyServiceServicer_to_server(self.context_servicer, self.server) + + self.add_reflection_service_name(CONTEXT_DESCRIPTOR, 'ContextService') + self.add_reflection_service_name(CONTEXT_POLICY_DESCRIPTOR, 'ContextPolicyService') diff --git a/src/device/service/DeviceService.py b/src/device/service/DeviceService.py index a94259471e76e40ddc5c6a1f2c109e8ada5075ae..a5a48e1bf80bce67fccd32316fa92935428d5b65 100644 --- a/src/device/service/DeviceService.py +++ b/src/device/service/DeviceService.py @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os from common.Constants import ServiceNameEnum from common.Settings import get_service_port_grpc +from common.proto.device_pb2 import DESCRIPTOR as DEVICE_DESCRIPTOR from common.proto.device_pb2_grpc import add_DeviceServiceServicer_to_server +from common.proto.optical_device_pb2 import DESCRIPTOR as OPTICAL_DEVICE_DESCRIPTOR from common.proto.optical_device_pb2_grpc import add_OpenConfigServiceServicer_to_server from common.tools.service.GenericGrpcService import GenericGrpcService from device.Config import LOAD_ALL_DEVICE_DRIVERS @@ -41,8 +42,11 @@ class DeviceService(GenericGrpcService): def install_servicers(self): self.monitoring_loops.start() add_DeviceServiceServicer_to_server(self.device_servicer, self.server) + self.add_reflection_service_name(DEVICE_DESCRIPTOR, 'DeviceService') + if LOAD_ALL_DEVICE_DRIVERS: add_OpenConfigServiceServicer_to_server(self.openconfig_device_servicer,self.server) + self.add_reflection_service_name(OPTICAL_DEVICE_DESCRIPTOR, 'OpenConfigService') def stop(self): super().stop() diff --git a/src/e2e_orchestrator/service/E2EOrchestratorService.py b/src/e2e_orchestrator/service/E2EOrchestratorService.py index 9fa7bf4bd82564c4158b5af77c0d69b0b9014289..3abef2777ba22cc63df3db1eb86ee411a4ea74c7 100644 --- a/src/e2e_orchestrator/service/E2EOrchestratorService.py +++ b/src/e2e_orchestrator/service/E2EOrchestratorService.py @@ -12,19 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging - from common.Constants import ServiceNameEnum -from common.proto.e2eorchestrator_pb2_grpc import add_E2EOrchestratorServiceServicer_to_server from common.Settings import get_service_port_grpc +from common.proto.e2eorchestrator_pb2 import DESCRIPTOR as E2EORCHESTRATOR_DESCRIPTOR +from common.proto.e2eorchestrator_pb2_grpc import add_E2EOrchestratorServiceServicer_to_server from common.tools.service.GenericGrpcService import GenericGrpcService from .E2EOrchestratorServiceServicerImpl import E2EOrchestratorServiceServicerImpl -LOGGER = logging.getLogger(__name__) - - class E2EOrchestratorService(GenericGrpcService): - def __init__(self, cls_name: str = __name__): + def __init__(self, cls_name: str = __name__) -> None: port = get_service_port_grpc(ServiceNameEnum.E2EORCHESTRATOR) super().__init__(port, cls_name=cls_name) self.e2eorchestrator_servicer = E2EOrchestratorServiceServicerImpl() @@ -33,3 +29,5 @@ class E2EOrchestratorService(GenericGrpcService): add_E2EOrchestratorServiceServicer_to_server( self.e2eorchestrator_servicer, self.server ) + + self.add_reflection_service_name(E2EORCHESTRATOR_DESCRIPTOR, 'E2EOrchestratorService') diff --git a/src/forecaster/service/ForecasterService.py b/src/forecaster/service/ForecasterService.py index 5f540cdc5bc628ae1a35e5f5ebf47ead276a413c..fedb5242d616eb8eef0a9b4e3fd5308925437acd 100644 --- a/src/forecaster/service/ForecasterService.py +++ b/src/forecaster/service/ForecasterService.py @@ -14,6 +14,7 @@ from common.Constants import ServiceNameEnum from common.Settings import get_service_port_grpc +from common.proto.forecaster_pb2 import DESCRIPTOR as FORECASTER_DESCRIPTOR from common.proto.forecaster_pb2_grpc import add_ForecasterServiceServicer_to_server from common.tools.service.GenericGrpcService import GenericGrpcService from .ForecasterServiceServicerImpl import ForecasterServiceServicerImpl @@ -26,3 +27,5 @@ class ForecasterService(GenericGrpcService): def install_servicers(self): add_ForecasterServiceServicer_to_server(self.forecaster_servicer, self.server) + + self.add_reflection_service_name(FORECASTER_DESCRIPTOR, 'ForecasterService') diff --git a/src/pathcomp/frontend/service/PathCompService.py b/src/pathcomp/frontend/service/PathCompService.py index c19e59e77b9b5f75f66eec07990691a76cdc36b7..6e413c14eb293f3073bfb1d80963dab58ba04308 100644 --- a/src/pathcomp/frontend/service/PathCompService.py +++ b/src/pathcomp/frontend/service/PathCompService.py @@ -14,8 +14,9 @@ from common.Constants import ServiceNameEnum from common.Settings import get_service_port_grpc -from common.tools.service.GenericGrpcService import GenericGrpcService +from common.proto.pathcomp_pb2 import DESCRIPTOR as PATHCOMP_DESCRIPTOR from common.proto.pathcomp_pb2_grpc import add_PathCompServiceServicer_to_server +from common.tools.service.GenericGrpcService import GenericGrpcService from .PathCompServiceServicerImpl import PathCompServiceServicerImpl class PathCompService(GenericGrpcService): @@ -26,3 +27,5 @@ class PathCompService(GenericGrpcService): def install_servicers(self): add_PathCompServiceServicer_to_server(self.pathcomp_servicer, self.server) + + self.add_reflection_service_name(PATHCOMP_DESCRIPTOR, 'PathCompService') diff --git a/src/service/service/ServiceService.py b/src/service/service/ServiceService.py index b99826e5b0f6ab8b228c32f4c7811181c83c7198..e088a99ebcc2e1b8258500df33ed8e319202d41c 100644 --- a/src/service/service/ServiceService.py +++ b/src/service/service/ServiceService.py @@ -14,6 +14,7 @@ from common.Constants import ServiceNameEnum from common.Settings import get_service_port_grpc +from common.proto.service_pb2 import DESCRIPTOR as SERVICE_DESCRIPTOR from common.proto.service_pb2_grpc import add_ServiceServiceServicer_to_server from common.tools.service.GenericGrpcService import GenericGrpcService from .ServiceServiceServicerImpl import ServiceServiceServicerImpl @@ -27,3 +28,5 @@ class ServiceService(GenericGrpcService): def install_servicers(self): add_ServiceServiceServicer_to_server(self.service_servicer, self.server) + + self.add_reflection_service_name(SERVICE_DESCRIPTOR, 'ServiceService') diff --git a/src/slice/service/SliceService.py b/src/slice/service/SliceService.py index dc2584f82d0704080f16e83aa958ba0db6f08fe2..ac4e809762c1ffb6097506f34d519056f2bd3426 100644 --- a/src/slice/service/SliceService.py +++ b/src/slice/service/SliceService.py @@ -14,9 +14,10 @@ from common.Constants import ServiceNameEnum from common.Settings import get_service_port_grpc +from common.proto.slice_pb2 import DESCRIPTOR as SLICE_DESCRIPTOR from common.proto.slice_pb2_grpc import add_SliceServiceServicer_to_server from common.tools.service.GenericGrpcService import GenericGrpcService -from slice.service.SliceServiceServicerImpl import SliceServiceServicerImpl +from .SliceServiceServicerImpl import SliceServiceServicerImpl class SliceService(GenericGrpcService): def __init__(self, cls_name: str = __name__) -> None: @@ -26,3 +27,5 @@ class SliceService(GenericGrpcService): def install_servicers(self): add_SliceServiceServicer_to_server(self.slice_servicer, self.server) + + self.add_reflection_service_name(SLICE_DESCRIPTOR, 'SliceService') diff --git a/src/vnt_manager/service/VNTManagerService.py b/src/vnt_manager/service/VNTManagerService.py index b95ad089a454e9d73e99d9f14cbe525a6c9ca8cb..3f44c4a510245fc2ab145e35b8ff1f35e4ac0f78 100644 --- a/src/vnt_manager/service/VNTManagerService.py +++ b/src/vnt_manager/service/VNTManagerService.py @@ -12,19 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging - from common.Constants import ServiceNameEnum -from common.proto.vnt_manager_pb2_grpc import add_VNTManagerServiceServicer_to_server from common.Settings import get_service_port_grpc +from common.proto.vnt_manager_pb2 import DESCRIPTOR as VNT_MANAGER_DESCRIPTOR +from common.proto.vnt_manager_pb2_grpc import add_VNTManagerServiceServicer_to_server from common.tools.service.GenericGrpcService import GenericGrpcService from .VNTManagerServiceServicerImpl import VNTManagerServiceServicerImpl -LOGGER = logging.getLogger(__name__) - - class VNTManagerService(GenericGrpcService): - def __init__(self, cls_name: str = __name__): + def __init__(self, cls_name: str = __name__) -> None: port = get_service_port_grpc(ServiceNameEnum.VNTMANAGER) super().__init__(port, cls_name=cls_name) self.vntmanager_servicer = VNTManagerServiceServicerImpl() @@ -33,3 +29,5 @@ class VNTManagerService(GenericGrpcService): add_VNTManagerServiceServicer_to_server( self.vntmanager_servicer, self.server ) + + self.add_reflection_service_name(VNT_MANAGER_DESCRIPTOR, 'VNTManagerService')