Loading src/service/service/ServiceServiceServicerImpl.py +6 −3 Original line number Diff line number Diff line Loading @@ -334,13 +334,16 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): reply_txt = "" # to get the reply form the optical module #multi-granular LOGGER.info(f'FLEEEEEEEEEX oc_type is {oc_type} alien is {alien}') if alien != 0: reply_txt = add_alien_flex_lightpath(src, ports[0], dst, ports[1], alien_band, alien_optical_band_id, bidir) else: if oc_type == 1: reply_txt = add_flex_lightpath(src, dst, bitrate, bidir, preferred, ob_band, dj_optical_band_id) elif oc_type == 2: LOGGER.info(f'FLEEEEEEEEEX oc_type is {oc_type} sending reply') reply_txt = add_lightpath(src, dst, bitrate, bidir) else: reply_txt = add_flex_lightpath(src, dst, bitrate, bidir, preferred, ob_band, dj_optical_band_id) #logging.info(f"TEEEEEEEEEEEEEEST {oc_type}") Loading @@ -348,7 +351,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): if reply_txt == None: return service_with_uuids.service_id reply_json = json.loads(reply_txt) LOGGER.debug('[optical] reply_json[{:s}]={:s}'.format(str(type(reply_json)), str(reply_json))) LOGGER.info('[optical] reply_json[{:s}]={:s}'.format(str(type(reply_json)), str(reply_json))) optical_band_txt = "" if "optical_band_id" in reply_json.keys(): Loading Loading @@ -663,7 +666,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): device_uuid = device.device_id.device_uuid.uuid device_names[device_uuid] = device.name if reply_txt is not "": if reply_txt != "": optical_reply = adapt_reply(devices, updated_service, reply_json, context_uuid_x, topology_uuid_x, "") new_connection = optical_reply.connections[0] #for candidate_new_connection in pathcomp_reply.connections: Loading Loading @@ -763,7 +766,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): device_uuid = device.device_id.device_uuid.uuid device_names[device_uuid] = device.name if reply_txt is not "": if reply_txt != "": optical_reply = adapt_reply(devices, updated_service, reply_json, context_uuid_x, topology_uuid_x, "") new_connection = optical_reply.connections[0] #for candidate_new_connection in pathcomp_reply.connections: Loading src/service/service/task_scheduler/TaskScheduler.py +8 −5 Original line number Diff line number Diff line Loading @@ -421,7 +421,6 @@ class TasksScheduler: break if isinstance(item, Service): str_item_key = grpc_message_to_json_string(item.service_id) if str_item_key in explored_items: continue connections = self._context_client.ListConnections(item.service_id) Loading @@ -432,6 +431,7 @@ class TasksScheduler: if "type" in constraint.custom.constraint_type: oc_type = OpticalServiceType(str(constraint.custom.constraint_value)) if oc_type == 2 : LOGGER.info('DEMOOFC service ------> {} '.format("AA")) reply,code = delete_lightpath( params['src'] , params ['dst'] Loading @@ -455,7 +455,8 @@ class TasksScheduler: for connection in connections.connections: self._add_connection_to_executor_cache(connection) LOGGER.info('DEMOOFC connection in service ------> {} '.format("AA")) #self._add_connection_to_executor_cache(connection) pending_items_to_explore.put(connection) explored_items.add(str_item_key) Loading @@ -476,8 +477,9 @@ class TasksScheduler: self._executor.get_service(item) for connection in connections.connections: LOGGER.info('DEMOOFC connection in serviceId ------> {} '.format("AA")) self._add_connection_to_executor_cache(connection) #self._add_connection_to_executor_cache(connection) pending_items_to_explore.put(connection) explored_items.add(str_item_key) Loading @@ -486,6 +488,7 @@ class TasksScheduler: if code == 400 and reply_not_allowed in reply:break str_item_key = grpc_message_to_json_string(item.connection_id) if str_item_key in explored_items: continue LOGGER.info('DEMOOFC connection in connection ------> {} '.format("AA")) connection_key = include_connection( item.connection_id Loading src/service/service/task_scheduler/tasks/Task_OpticalServiceDelete.py +2 −1 Original line number Diff line number Diff line Loading @@ -41,5 +41,6 @@ class Task_OpticalServiceDelete(_Task): def key(self) -> str: return self.build_key(self._service_id) def execute(self) -> None: if not self._has_media_channel or not self._has_optical_band: #if not self._has_media_channel or not self._has_optical_band: if self._has_media_channel or self._has_optical_band: self._task_executor.delete_service(self._service_id) src/service/service/tools/OpticalTools.py +8 −4 Original line number Diff line number Diff line Loading @@ -481,14 +481,18 @@ def adapt_reply(devices, service, reply_json, context_id, topology_id, optical_b connection_f = add_connection_to_reply(opt_reply) connection_f.connection_id.connection_uuid.uuid = str(uuid.uuid4()) connection_f.service_id.CopyFrom(service.service_id) in_end_point_f = "0" out_end_point_f = "0" for devx in r["flows"].keys(): log.debug("lightpath device {}".format(devx)) log.info("lightpath device {}".format(devx)) in_end_point_b = "0" out_end_point_b = "0" in_end_point_f = "0" out_end_point_f = "0" in_end_point_f = r["flows"][devx]["f"]["in"] out_end_point_f = r["flows"][devx]["f"]["out"] log.debug("lightpath ports {}, {}".format(in_end_point_f, out_end_point_f)) log.info("lightpath ports {}, {}".format(in_end_point_f, out_end_point_f)) if bidir_f: in_end_point_b = r["flows"][devx]["b"]["in"] out_end_point_b = r["flows"][devx]["b"]["out"] Loading @@ -500,7 +504,7 @@ def adapt_reply(devices, service, reply_json, context_id, topology_id, optical_b connection_f.path_hops_endpoint_ids.add().CopyFrom(end_point) else: log.info("no map device port for device {} port {}".format(devx, in_end_point_f)) if out_end_point_f != "0": if out_end_point_f != "0" and out_end_point_f != in_end_point_f: d, p = get_uuids_from_names(devices, devx, out_end_point_f) if d != "" and p != "": end_point = EndPointId(topology_id=topo, device_id=DeviceId(device_uuid=Uuid(uuid=d)), endpoint_uuid=Uuid(uuid=p)) Loading @@ -514,7 +518,7 @@ def adapt_reply(devices, service, reply_json, context_id, topology_id, optical_b connection_f.path_hops_endpoint_ids.add().CopyFrom(end_point) else: log.info("no map device port for device {} port {}".format(devx, in_end_point_b)) if out_end_point_b != "0": if out_end_point_b != "0" and out_end_point_b != in_end_point_b: d, p = get_uuids_from_names(devices, devx, out_end_point_b) if d != "" and p != "": end_point = EndPointId(topology_id=topo, device_id=DeviceId(device_uuid=Uuid(uuid=d)), endpoint_uuid=Uuid(uuid=p)) Loading src/service/tests/test_recon.py +6 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from device.client.DeviceClient import DeviceClient from service.client.ServiceClient import ServiceClient import time LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) Loading Loading @@ -76,6 +76,8 @@ def test_service_recompute_connection( print(name) if name == "optical-band-C1": t0 = time.time()*1000 print(f"start time {t0}") response = context_client.ListConnections(service_id) print("AAAAAAAAA") print(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( Loading @@ -90,6 +92,9 @@ def test_service_recompute_connection( del request.service_constraints[:] # pylint: disable=no-member del request.service_config.config_rules[:] # pylint: disable=no-member service_client.RecomputeConnections(request) t1 = time.time()*1000 print(f"end time {t1}") print(f"total time ={t1-t0}") response = context_client.ListConnections(service_id) print(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( Loading Loading
src/service/service/ServiceServiceServicerImpl.py +6 −3 Original line number Diff line number Diff line Loading @@ -334,13 +334,16 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): reply_txt = "" # to get the reply form the optical module #multi-granular LOGGER.info(f'FLEEEEEEEEEX oc_type is {oc_type} alien is {alien}') if alien != 0: reply_txt = add_alien_flex_lightpath(src, ports[0], dst, ports[1], alien_band, alien_optical_band_id, bidir) else: if oc_type == 1: reply_txt = add_flex_lightpath(src, dst, bitrate, bidir, preferred, ob_band, dj_optical_band_id) elif oc_type == 2: LOGGER.info(f'FLEEEEEEEEEX oc_type is {oc_type} sending reply') reply_txt = add_lightpath(src, dst, bitrate, bidir) else: reply_txt = add_flex_lightpath(src, dst, bitrate, bidir, preferred, ob_band, dj_optical_band_id) #logging.info(f"TEEEEEEEEEEEEEEST {oc_type}") Loading @@ -348,7 +351,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): if reply_txt == None: return service_with_uuids.service_id reply_json = json.loads(reply_txt) LOGGER.debug('[optical] reply_json[{:s}]={:s}'.format(str(type(reply_json)), str(reply_json))) LOGGER.info('[optical] reply_json[{:s}]={:s}'.format(str(type(reply_json)), str(reply_json))) optical_band_txt = "" if "optical_band_id" in reply_json.keys(): Loading Loading @@ -663,7 +666,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): device_uuid = device.device_id.device_uuid.uuid device_names[device_uuid] = device.name if reply_txt is not "": if reply_txt != "": optical_reply = adapt_reply(devices, updated_service, reply_json, context_uuid_x, topology_uuid_x, "") new_connection = optical_reply.connections[0] #for candidate_new_connection in pathcomp_reply.connections: Loading Loading @@ -763,7 +766,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): device_uuid = device.device_id.device_uuid.uuid device_names[device_uuid] = device.name if reply_txt is not "": if reply_txt != "": optical_reply = adapt_reply(devices, updated_service, reply_json, context_uuid_x, topology_uuid_x, "") new_connection = optical_reply.connections[0] #for candidate_new_connection in pathcomp_reply.connections: Loading
src/service/service/task_scheduler/TaskScheduler.py +8 −5 Original line number Diff line number Diff line Loading @@ -421,7 +421,6 @@ class TasksScheduler: break if isinstance(item, Service): str_item_key = grpc_message_to_json_string(item.service_id) if str_item_key in explored_items: continue connections = self._context_client.ListConnections(item.service_id) Loading @@ -432,6 +431,7 @@ class TasksScheduler: if "type" in constraint.custom.constraint_type: oc_type = OpticalServiceType(str(constraint.custom.constraint_value)) if oc_type == 2 : LOGGER.info('DEMOOFC service ------> {} '.format("AA")) reply,code = delete_lightpath( params['src'] , params ['dst'] Loading @@ -455,7 +455,8 @@ class TasksScheduler: for connection in connections.connections: self._add_connection_to_executor_cache(connection) LOGGER.info('DEMOOFC connection in service ------> {} '.format("AA")) #self._add_connection_to_executor_cache(connection) pending_items_to_explore.put(connection) explored_items.add(str_item_key) Loading @@ -476,8 +477,9 @@ class TasksScheduler: self._executor.get_service(item) for connection in connections.connections: LOGGER.info('DEMOOFC connection in serviceId ------> {} '.format("AA")) self._add_connection_to_executor_cache(connection) #self._add_connection_to_executor_cache(connection) pending_items_to_explore.put(connection) explored_items.add(str_item_key) Loading @@ -486,6 +488,7 @@ class TasksScheduler: if code == 400 and reply_not_allowed in reply:break str_item_key = grpc_message_to_json_string(item.connection_id) if str_item_key in explored_items: continue LOGGER.info('DEMOOFC connection in connection ------> {} '.format("AA")) connection_key = include_connection( item.connection_id Loading
src/service/service/task_scheduler/tasks/Task_OpticalServiceDelete.py +2 −1 Original line number Diff line number Diff line Loading @@ -41,5 +41,6 @@ class Task_OpticalServiceDelete(_Task): def key(self) -> str: return self.build_key(self._service_id) def execute(self) -> None: if not self._has_media_channel or not self._has_optical_band: #if not self._has_media_channel or not self._has_optical_band: if self._has_media_channel or self._has_optical_band: self._task_executor.delete_service(self._service_id)
src/service/service/tools/OpticalTools.py +8 −4 Original line number Diff line number Diff line Loading @@ -481,14 +481,18 @@ def adapt_reply(devices, service, reply_json, context_id, topology_id, optical_b connection_f = add_connection_to_reply(opt_reply) connection_f.connection_id.connection_uuid.uuid = str(uuid.uuid4()) connection_f.service_id.CopyFrom(service.service_id) in_end_point_f = "0" out_end_point_f = "0" for devx in r["flows"].keys(): log.debug("lightpath device {}".format(devx)) log.info("lightpath device {}".format(devx)) in_end_point_b = "0" out_end_point_b = "0" in_end_point_f = "0" out_end_point_f = "0" in_end_point_f = r["flows"][devx]["f"]["in"] out_end_point_f = r["flows"][devx]["f"]["out"] log.debug("lightpath ports {}, {}".format(in_end_point_f, out_end_point_f)) log.info("lightpath ports {}, {}".format(in_end_point_f, out_end_point_f)) if bidir_f: in_end_point_b = r["flows"][devx]["b"]["in"] out_end_point_b = r["flows"][devx]["b"]["out"] Loading @@ -500,7 +504,7 @@ def adapt_reply(devices, service, reply_json, context_id, topology_id, optical_b connection_f.path_hops_endpoint_ids.add().CopyFrom(end_point) else: log.info("no map device port for device {} port {}".format(devx, in_end_point_f)) if out_end_point_f != "0": if out_end_point_f != "0" and out_end_point_f != in_end_point_f: d, p = get_uuids_from_names(devices, devx, out_end_point_f) if d != "" and p != "": end_point = EndPointId(topology_id=topo, device_id=DeviceId(device_uuid=Uuid(uuid=d)), endpoint_uuid=Uuid(uuid=p)) Loading @@ -514,7 +518,7 @@ def adapt_reply(devices, service, reply_json, context_id, topology_id, optical_b connection_f.path_hops_endpoint_ids.add().CopyFrom(end_point) else: log.info("no map device port for device {} port {}".format(devx, in_end_point_b)) if out_end_point_b != "0": if out_end_point_b != "0" and out_end_point_b != in_end_point_b: d, p = get_uuids_from_names(devices, devx, out_end_point_b) if d != "" and p != "": end_point = EndPointId(topology_id=topo, device_id=DeviceId(device_uuid=Uuid(uuid=d)), endpoint_uuid=Uuid(uuid=p)) Loading
src/service/tests/test_recon.py +6 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from device.client.DeviceClient import DeviceClient from service.client.ServiceClient import ServiceClient import time LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) Loading Loading @@ -76,6 +76,8 @@ def test_service_recompute_connection( print(name) if name == "optical-band-C1": t0 = time.time()*1000 print(f"start time {t0}") response = context_client.ListConnections(service_id) print("AAAAAAAAA") print(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( Loading @@ -90,6 +92,9 @@ def test_service_recompute_connection( del request.service_constraints[:] # pylint: disable=no-member del request.service_config.config_rules[:] # pylint: disable=no-member service_client.RecomputeConnections(request) t1 = time.time()*1000 print(f"end time {t1}") print(f"total time ={t1-t0}") response = context_client.ListConnections(service_id) print(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( Loading