Skip to content
Snippets Groups Projects
Commit 41befba7 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Service component:

- Added update of ServiceType during UpdateService
parent 7a612dd1
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!43CI pipeline and multiple module fixes
...@@ -16,7 +16,7 @@ import grpc, json, logging ...@@ -16,7 +16,7 @@ import grpc, json, logging
from typing import Optional from typing import Optional
from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method
from common.method_wrappers.ServiceExceptions import AlreadyExistsException, InvalidArgumentException from common.method_wrappers.ServiceExceptions import AlreadyExistsException, InvalidArgumentException
from common.proto.context_pb2 import Empty, Service, ServiceId, ServiceStatusEnum from common.proto.context_pb2 import Empty, Service, ServiceId, ServiceStatusEnum, ServiceTypeEnum
from common.proto.pathcomp_pb2 import PathCompRequest from common.proto.pathcomp_pb2 import PathCompRequest
from common.proto.service_pb2_grpc import ServiceServiceServicer from common.proto.service_pb2_grpc import ServiceServiceServicer
from common.tools.grpc.Tools import grpc_message_to_json, grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json, grpc_message_to_json_string
...@@ -93,6 +93,8 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): ...@@ -93,6 +93,8 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
_service : Optional[Service] = get_service(context_client, request.service_id) _service : Optional[Service] = get_service(context_client, request.service_id)
service = Service() service = Service()
service.CopyFrom(request if _service is None else _service) service.CopyFrom(request if _service is None else _service)
if service.service_type == ServiceTypeEnum.SERVICETYPE_UNKNOWN: # pylint: disable=no-member
service.service_type = request.service_type # pylint: disable=no-member
service.service_status.service_status = ServiceStatusEnum.SERVICESTATUS_PLANNED # pylint: disable=no-member service.service_status.service_status = ServiceStatusEnum.SERVICESTATUS_PLANNED # pylint: disable=no-member
del service.service_endpoint_ids[:] # pylint: disable=no-member del service.service_endpoint_ids[:] # pylint: disable=no-member
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment