Commit eab52c6b authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

PathComp component:

- forced context/topology uuids in backend request for simplicity; to be elaborated
- improved formatting of request to be sent to backend in logs
parent 34374c82
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ class _Algorithm:
    def execute(self, dump_request_filename : Optional[str] = None, dump_reply_filename : Optional[str] = None) -> None:
        request = {'serviceList': self.service_list, 'deviceList': self.device_list, 'linkList': self.link_list}

        self.logger.debug('[execute] request={:s}'.format(str(request)))
        self.logger.debug('[execute] request={:s}'.format(json.dumps(request, sort_keys=True, indent=4)))
        if dump_request_filename is not None:
            with open(dump_request_filename, 'w', encoding='UTF-8') as f:
                f.write(json.dumps(request, sort_keys=True, indent=4))
+12 −6
Original line number Diff line number Diff line
@@ -24,18 +24,24 @@ LOGGER = logging.getLogger(__name__)

LOGGER = logging.getLogger(__name__)

def compose_topology_id(topology_id : TopologyId) -> Dict:
    context_uuid = topology_id.context_id.context_uuid.uuid
    topology_uuid = topology_id.topology_uuid.uuid
def compose_topology_id(topology_id : TopologyId) -> Dict: # pylint: disable=unused-argument
    # force context_uuid and topology_uuid to be always DEFAULT_CONTEXT_NAME and DEFAULT_TOPOLOGY_NAME for simplicity
    # for interdomain, contexts and topologies are managed in particular ways

    if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_NAME
    if len(topology_uuid) == 0: topology_uuid = DEFAULT_TOPOLOGY_NAME
    context_uuid = DEFAULT_CONTEXT_NAME
    #context_uuid = topology_id.context_id.context_uuid.uuid
    #if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_NAME

    topology_uuid = DEFAULT_TOPOLOGY_NAME
    #topology_uuid = topology_id.topology_uuid.uuid
    #if len(topology_uuid) == 0: topology_uuid = DEFAULT_TOPOLOGY_NAME

    return {'contextId': context_uuid, 'topology_uuid': topology_uuid}

def compose_service_id(service_id : ServiceId) -> Dict:
    # force context_uuid to be always DEFAULT_CONTEXT_NAME for simplicity
    # for interdomain contexts are managed in a particular way
    # for interdomain, contexts are managed in particular ways

    #context_uuid = service_id.context_id.context_uuid.uuid
    #if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_NAME
    context_uuid = DEFAULT_CONTEXT_NAME