Commit 9dd7b10b authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Slice component:

- Removed unneeded log messages/reduced log levels
parent 41f314a8
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ from common.tools.grpc.ConfigRules import copy_config_rules
from common.tools.grpc.Constraints import copy_constraints
from common.tools.grpc.EndPointIds import copy_endpoint_ids
from common.tools.grpc.ServiceIds import update_service_ids
from common.tools.grpc.Tools import grpc_message_to_json_string
#from common.tools.grpc.Tools import grpc_message_to_json_string
from context.client.ContextClient import ContextClient
from interdomain.client.InterdomainClient import InterdomainClient
from service.client.ServiceClient import ServiceClient
@@ -109,13 +109,13 @@ class SliceServiceServicerImpl(SliceServiceServicer):

        service_request.service_type = ServiceTypeEnum.SERVICETYPE_UNKNOWN
        for config_rule in request.slice_config.config_rules:
            LOGGER.info('config_rule: {:s}'.format(grpc_message_to_json_string(config_rule)))
            #LOGGER.debug('config_rule: {:s}'.format(grpc_message_to_json_string(config_rule)))
            config_rule_kind = config_rule.WhichOneof('config_rule')
            LOGGER.info('config_rule_kind: {:s}'.format(str(config_rule_kind)))
            #LOGGER.debug('config_rule_kind: {:s}'.format(str(config_rule_kind)))
            if config_rule_kind != 'custom': continue
            custom = config_rule.custom
            resource_key = custom.resource_key
            LOGGER.info('resource_key: {:s}'.format(str(resource_key)))
            #LOGGER.debug('resource_key: {:s}'.format(str(resource_key)))

            # TODO: parse resource key with regular expression, e.g.:
            #    m = re.match('\/device\[[^\]]\]\/endpoint\[[^\]]\]\/settings', s)
@@ -123,21 +123,21 @@ class SliceServiceServicerImpl(SliceServiceServicer):
            if not resource_key.endswith('/settings'): continue

            resource_value = json.loads(custom.resource_value)
            LOGGER.info('resource_value: {:s}'.format(str(resource_value)))
            #LOGGER.debug('resource_value: {:s}'.format(str(resource_value)))

            if service_request.service_type == ServiceTypeEnum.SERVICETYPE_UNKNOWN:
                if (resource_value.get('address_ip') is not None and \
                    resource_value.get('address_prefix') is not None):
                    service_request.service_type = ServiceTypeEnum.SERVICETYPE_L3NM
                    LOGGER.info('is L3')
                    #LOGGER.debug('is L3')
                else:
                    service_request.service_type = ServiceTypeEnum.SERVICETYPE_L2NM
                    LOGGER.info('is L2')
                    #LOGGER.debug('is L2')
                break

        if service_request.service_type == ServiceTypeEnum.SERVICETYPE_UNKNOWN:
            service_request.service_type = ServiceTypeEnum.SERVICETYPE_L2NM
            LOGGER.info('assume L2')
            #LOGGER.debug('assume L2')

        service_client.UpdateService(service_request)