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

Pre-release code cleanup, addition of headers and CI/CD pipeline fixes

parent 3200e789
No related branches found
No related tags found
2 merge requests!142Release TeraFlowSDN 2.1,!137Pre-release CI/CD fixes - Service - PathComp
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.
import logging import logging
from typing import Any, Dict, List, Tuple from typing import Any, Dict, List, Tuple
#from common.proto.context_pb2 import Link #from common.proto.context_pb2 import Link
......
...@@ -136,7 +136,6 @@ unit_test service: ...@@ -136,7 +136,6 @@ unit_test service:
# Service preparation # Service preparation
- > - >
docker run --name $IMAGE_NAME -d -p 3030:3030 docker run --name $IMAGE_NAME -d -p 3030:3030
--env "LOG_LEVEL=DEBUG"
--env "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}" --env "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}"
--env "DEVICESERVICE_SERVICE_HOST=${DEVICESERVICE_SERVICE_HOST}" --env "DEVICESERVICE_SERVICE_HOST=${DEVICESERVICE_SERVICE_HOST}"
--env "PATHCOMPSERVICE_SERVICE_HOST=${PATHCOMPSERVICE_SERVICE_HOST}" --env "PATHCOMPSERVICE_SERVICE_HOST=${PATHCOMPSERVICE_SERVICE_HOST}"
......
...@@ -102,9 +102,9 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): ...@@ -102,9 +102,9 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
if constraint.WhichOneof('constraint') != 'endpoint_location': continue if constraint.WhichOneof('constraint') != 'endpoint_location': continue
location_aware = True location_aware = True
LOGGER.warning('location_aware={:s}'.format(str(location_aware))) LOGGER.debug('location_aware={:s}'.format(str(location_aware)))
if _service is not None and location_aware: if _service is not None and location_aware:
LOGGER.warning('removing previous service') LOGGER.debug(' Removing previous service')
tasks_scheduler = TasksScheduler(self.service_handler_factory) tasks_scheduler = TasksScheduler(self.service_handler_factory)
tasks_scheduler.compose_from_service(_service, is_delete=True) tasks_scheduler.compose_from_service(_service, is_delete=True)
tasks_scheduler.execute_all() tasks_scheduler.execute_all()
...@@ -122,7 +122,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): ...@@ -122,7 +122,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
device_list = context_client.ListDevices(Empty()) device_list = context_client.ListDevices(Empty())
LOGGER.warning('[before] request={:s}'.format(grpc_message_to_json_string(request))) LOGGER.debug('[before] request={:s}'.format(grpc_message_to_json_string(request)))
for constraint in request.service_constraints: for constraint in request.service_constraints:
if constraint.action == ConstraintActionEnum.CONSTRAINTACTION_UNDEFINED: if constraint.action == ConstraintActionEnum.CONSTRAINTACTION_UNDEFINED:
# Field action is new; assume if not set, it means SET # Field action is new; assume if not set, it means SET
...@@ -150,8 +150,8 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): ...@@ -150,8 +150,8 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
if closer_endpoint_id not in service_endpoint_ids: if closer_endpoint_id not in service_endpoint_ids:
service.service_endpoint_ids.append(closer_endpoint_id) service.service_endpoint_ids.append(closer_endpoint_id)
LOGGER.warning('[after] request={:s}'.format(grpc_message_to_json_string(request))) LOGGER.debug('[after] request={:s}'.format(grpc_message_to_json_string(request)))
LOGGER.warning('[after] service={:s}'.format(grpc_message_to_json_string(service))) LOGGER.debug('[after] service={:s}'.format(grpc_message_to_json_string(service)))
del service.service_constraints[:] # pylint: disable=no-member del service.service_constraints[:] # pylint: disable=no-member
for constraint in request.service_constraints: for constraint in request.service_constraints:
...@@ -187,11 +187,11 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): ...@@ -187,11 +187,11 @@ class ServiceServiceServicerImpl(ServiceServiceServicer):
else: else:
pathcomp_request.k_disjoint_path.num_disjoint = num_disjoint_paths # pylint: disable=no-member pathcomp_request.k_disjoint_path.num_disjoint = num_disjoint_paths # pylint: disable=no-member
LOGGER.warning('pathcomp_request={:s}'.format(grpc_message_to_json_string(pathcomp_request))) LOGGER.debug('pathcomp_request={:s}'.format(grpc_message_to_json_string(pathcomp_request)))
pathcomp = PathCompClient() pathcomp = PathCompClient()
pathcomp_reply = pathcomp.Compute(pathcomp_request) pathcomp_reply = pathcomp.Compute(pathcomp_request)
pathcomp.close() pathcomp.close()
LOGGER.warning('pathcomp_reply={:s}'.format(grpc_message_to_json_string(pathcomp_reply))) LOGGER.debug('pathcomp_reply={:s}'.format(grpc_message_to_json_string(pathcomp_reply)))
# Feed TaskScheduler with this path computation reply. TaskScheduler identifies inter-dependencies among # Feed TaskScheduler with this path computation reply. TaskScheduler identifies inter-dependencies among
# the services and connections retrieved and produces a schedule of tasks (an ordered list of tasks to be # the services and connections retrieved and produces a schedule of tasks (an ordered list of tasks to be
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# 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.
import copy, grpc, json, logging, pytest import copy, grpc, logging, pytest
from common.proto.context_pb2 import ( from common.proto.context_pb2 import (
Context, ContextId, Device, DeviceId, Link, LinkId, Service, ServiceId, Topology, TopologyId) Context, ContextId, Device, DeviceId, Link, LinkId, Service, ServiceId, Topology, TopologyId)
from common.tests.PytestGenerateTests import pytest_generate_tests # (required) pylint: disable=unused-import from common.tests.PytestGenerateTests import pytest_generate_tests # (required) pylint: disable=unused-import
...@@ -47,9 +47,7 @@ class TestServiceHandlers: ...@@ -47,9 +47,7 @@ class TestServiceHandlers:
for context in contexts: context_client.SetContext(Context(**context)) for context in contexts: context_client.SetContext(Context(**context))
for topology in topologies: context_client.SetTopology(Topology(**topology)) for topology in topologies: context_client.SetTopology(Topology(**topology))
for device in devices: for device in devices: device_client.AddDevice(Device(**device))
LOGGER.warning('device: {:s}'.format(json.dumps(device)))
device_client.AddDevice(Device(**device))
for link in links: context_client.SetLink(Link(**link)) for link in links: context_client.SetLink(Link(**link))
......
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