Commit 8766c63b authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

PathComp component - Frontend:

- Pre-merge code polishing
- Restored default log level
parent a00c756c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ unit_test pathcomp-frontend:
    - docker logs ${IMAGE_NAME}-backend
    - >
      docker exec -i ${IMAGE_NAME}-frontend bash -c 
      "coverage run -m pytest --log-level=DEBUG --verbose $IMAGE_NAME/frontend/tests/test_unitary.py --junitxml=/opt/results/${IMAGE_NAME}-frontend_report.xml"
      "coverage run -m pytest --log-level=INFO --verbose $IMAGE_NAME/frontend/tests/test_unitary.py --junitxml=/opt/results/${IMAGE_NAME}-frontend_report.xml"
    - docker exec -i ${IMAGE_NAME}-frontend bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing"
  coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
  after_script:
+2 −55
Original line number Diff line number Diff line
@@ -14,11 +14,9 @@

import operator
from typing import Dict, List, Optional, Set, Tuple
from common.proto.context_pb2 import Connection, Link, Service
from common.proto.pathcomp_pb2 import Algorithm_KDisjointPath, Algorithm_KShortestPath, PathCompReply, PathCompRequest
from common.proto.context_pb2 import Link
from common.proto.pathcomp_pb2 import Algorithm_KDisjointPath, Algorithm_KShortestPath, PathCompRequest
from common.tools.grpc.Tools import grpc_message_to_json_string
from pathcomp.frontend.service.algorithms.tools.ComputeSubServices import convert_explicit_path_hops_to_connections
from pathcomp.frontend.service.algorithms.tools.EroPathToHops import eropath_to_hops
from ._Algorithm import _Algorithm, SRC_END
from .KShortestPathAlgorithm import KShortestPathAlgorithm

@@ -211,54 +209,3 @@ class KDisjointPathAlgorithm(_Algorithm):
            response_list.append(response)

        self.logger.debug('self.json_reply = {:s}'.format(str(self.json_reply)))

#    def get_reply(self) -> PathCompReply:
#        reply = PathCompReply()
#        grpc_services : Dict[Tuple[str, str], Service] = {}
#        grpc_connections : Dict[Tuple[int, str], Connection] = {}
#        for service_key,paths in self.json_reply.items():
#            context_uuid, service_uuid = service_key
#
#            grpc_services[service_key] = self.add_service_to_reply(reply, context_uuid, service_uuid)
#
#            for num_path,service_path_ero in enumerate(paths):
#                self.logger.warning('num_path={:d}'.format(num_path))
#                self.logger.warning('service_path_ero={:s}'.format(str(service_path_ero)))
#                if service_path_ero is None: continue
#                path_hops = eropath_to_hops(service_path_ero, self.endpoint_to_link_dict)
#                self.logger.warning('path_hops={:s}'.format(str(path_hops)))
#                connections = convert_explicit_path_hops_to_connections(path_hops, self.device_dict, service_uuid)
#                self.logger.warning('connections={:s}'.format(str(connections)))
#
#                for connection in connections:
#                    connection_uuid,device_layer,path_hops,_ = connection
#
#                    service_key = (context_uuid, connection_uuid)
#                    grpc_service = grpc_services.get(service_key)
#                    if grpc_service is not None: continue
#                    grpc_service = self.add_service_to_reply(
#                        reply, context_uuid, connection_uuid, device_layer=device_layer, path_hops=path_hops)
#                    grpc_services[service_key] = grpc_service
#
#                for connection in connections:
#                    connection_uuid,device_layer,path_hops,dependencies = connection
#
#                    service_key = (context_uuid, connection_uuid)
#                    grpc_service = grpc_services.get(service_key)
#                    if grpc_service is None: raise Exception('Service({:s}) not found'.format(str(service_key)))
#
#                    connection_uuid = '{:s}:{:d}'.format(connection_uuid, num_path)
#                    grpc_connection = grpc_connections.get(connection_uuid)
#                    if grpc_connection is not None: continue
#                    grpc_connection = self.add_connection_to_reply(reply, connection_uuid, grpc_service, path_hops)
#                    grpc_connections[connection_uuid] = grpc_connection
#
#                    for sub_service_uuid in dependencies:
#                        sub_service_key = (context_uuid, sub_service_uuid)
#                        grpc_sub_service = grpc_services.get(sub_service_key)
#                        if grpc_sub_service is None:
#                            raise Exception('Service({:s}) not found'.format(str(sub_service_key)))
#                        grpc_sub_service_id = grpc_connection.sub_service_ids.add()
#                        grpc_sub_service_id.CopyFrom(grpc_sub_service.service_id)
#
#        return reply