Loading src/simap_connector/service/simap_updater/SimapUpdater.py +43 −46 Original line number Diff line number Diff line Loading @@ -35,6 +35,14 @@ LOGGER = logging.getLogger(__name__) RESTCONF_LOGGER = logging.getLogger(__name__ + '.RestConfClient') SKIPPED_DEVICE_TYPES = { DeviceTypeEnum.EMULATED_IP_SDN_CONTROLLER.value, DeviceTypeEnum.IP_SDN_CONTROLLER.value, DeviceTypeEnum.NCE.value, DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value, } class EventDispatcher(BaseEventDispatcher): def __init__( self, events_queue : queue.PriorityQueue, Loading Loading @@ -127,12 +135,6 @@ class EventDispatcher(BaseEventDispatcher): device = self._object_cache.get(CachedEntities.DEVICE, device_uuid) device_type = device.device_type SKIPPED_DEVICE_TYPES = { DeviceTypeEnum.EMULATED_IP_SDN_CONTROLLER.value, DeviceTypeEnum.IP_SDN_CONTROLLER.value, DeviceTypeEnum.NCE.value, DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value, } if device_type in SKIPPED_DEVICE_TYPES: self._add_skipped_device(device) MSG = ( Loading @@ -144,21 +146,21 @@ class EventDispatcher(BaseEventDispatcher): LOGGER.warning(MSG.format(str_device_event, str_device)) return device_controller_uuid = device.controller_id.device_uuid.uuid if len(device_controller_uuid) > 0: self._add_skipped_device(device) MSG = ( 'DeviceEvent({:s}) skipped, is a remotely-managed device. ' 'SIMAP should be populated by remote controller: {:s}' ) str_device_event = grpc_message_to_json_string(device_event) str_device = grpc_message_to_json_string(device) LOGGER.warning(MSG.format(str_device_event, str_device)) return #device_controller_uuid = device.controller_id.device_uuid.uuid #if len(device_controller_uuid) > 0: # self._add_skipped_device(device) # MSG = ( # 'DeviceEvent({:s}) skipped, is a remotely-managed device. ' # 'SIMAP should be populated by remote controller: {:s}' # ) # str_device_event = grpc_message_to_json_string(device_event) # str_device = grpc_message_to_json_string(device) # LOGGER.warning(MSG.format(str_device_event, str_device)) # return topology_uuid, endpoint_names = get_device_endpoint(device) if topology_uuid is None: self._add_skipped_device(device) #self._add_skipped_device(device) MSG = 'DeviceEvent({:s}) skipped, no endpoints to identify topology: {:s}' str_device_event = grpc_message_to_json_string(device_event) str_device = grpc_message_to_json_string(device) Loading @@ -172,8 +174,13 @@ class EventDispatcher(BaseEventDispatcher): te_topo.update() device_name = device.name te_topo.node(device_name).create(termination_point_ids=endpoint_names) self._remove_skipped_device(device) te_device = te_topo.node(device_name) te_device.update() for endpoint_name in endpoint_names: te_device.termination_point(endpoint_name).update() #self._remove_skipped_device(device) MSG = 'Device Created: {:s}' LOGGER.info(MSG.format(grpc_message_to_json_string(device_event))) Loading @@ -187,12 +194,6 @@ class EventDispatcher(BaseEventDispatcher): device = self._object_cache.get(CachedEntities.DEVICE, device_uuid) device_type = device.device_type SKIPPED_DEVICE_TYPES = { DeviceTypeEnum.EMULATED_IP_SDN_CONTROLLER.value, DeviceTypeEnum.IP_SDN_CONTROLLER.value, DeviceTypeEnum.NCE.value, DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value, } if device_type in SKIPPED_DEVICE_TYPES: self._add_skipped_device(device) MSG = ( Loading @@ -204,21 +205,21 @@ class EventDispatcher(BaseEventDispatcher): LOGGER.warning(MSG.format(str_device_event, str_device)) return device_controller_uuid = device.controller_id.device_uuid.uuid if len(device_controller_uuid) > 0: self._add_skipped_device(device) MSG = ( 'DeviceEvent({:s}) skipped, is a remotely-managed device. ' 'SIMAP should be updated by remote controller: {:s}' ) str_device_event = grpc_message_to_json_string(device_event) str_device = grpc_message_to_json_string(device) LOGGER.warning(MSG.format(str_device_event, str_device)) return #device_controller_uuid = device.controller_id.device_uuid.uuid #if len(device_controller_uuid) > 0: # self._add_skipped_device(device) # MSG = ( # 'DeviceEvent({:s}) skipped, is a remotely-managed device. ' # 'SIMAP should be updated by remote controller: {:s}' # ) # str_device_event = grpc_message_to_json_string(device_event) # str_device = grpc_message_to_json_string(device) # LOGGER.warning(MSG.format(str_device_event, str_device)) # return topology_uuid, endpoint_names = get_device_endpoint(device) if topology_uuid is None: self._add_skipped_device(device) #self._add_skipped_device(device) MSG = 'DeviceEvent({:s}) skipped, no endpoints to identify topology: {:s}' str_device_event = grpc_message_to_json_string(device_event) str_device = grpc_message_to_json_string(device) Loading @@ -238,7 +239,7 @@ class EventDispatcher(BaseEventDispatcher): for endpoint_name in endpoint_names: te_device.termination_point(endpoint_name).update() self._remove_skipped_device(device) #self._remove_skipped_device(device) MSG = 'Device Updated: {:s}' LOGGER.info(MSG.format(grpc_message_to_json_string(device_event))) Loading @@ -252,12 +253,6 @@ class EventDispatcher(BaseEventDispatcher): device = self._object_cache.get(CachedEntities.DEVICE, device_uuid) device_type = device.device_type SKIPPED_DEVICE_TYPES = { DeviceTypeEnum.EMULATED_IP_SDN_CONTROLLER.value, DeviceTypeEnum.IP_SDN_CONTROLLER.value, DeviceTypeEnum.NCE.value, DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value, } if device_type in SKIPPED_DEVICE_TYPES: self._add_skipped_device(device) MSG = ( Loading @@ -271,7 +266,9 @@ class EventDispatcher(BaseEventDispatcher): device_controller_uuid = device.controller_id.device_uuid.uuid if len(device_controller_uuid) > 0: self._add_skipped_device(device) # if it is a delete of a remotely-managed device, # should be managed by owner controller #self._add_skipped_device(device) MSG = ( 'DeviceEvent({:s}) skipped, is a remotely-managed device. ' 'SIMAP should be updated by remote controller: {:s}' Loading Loading
src/simap_connector/service/simap_updater/SimapUpdater.py +43 −46 Original line number Diff line number Diff line Loading @@ -35,6 +35,14 @@ LOGGER = logging.getLogger(__name__) RESTCONF_LOGGER = logging.getLogger(__name__ + '.RestConfClient') SKIPPED_DEVICE_TYPES = { DeviceTypeEnum.EMULATED_IP_SDN_CONTROLLER.value, DeviceTypeEnum.IP_SDN_CONTROLLER.value, DeviceTypeEnum.NCE.value, DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value, } class EventDispatcher(BaseEventDispatcher): def __init__( self, events_queue : queue.PriorityQueue, Loading Loading @@ -127,12 +135,6 @@ class EventDispatcher(BaseEventDispatcher): device = self._object_cache.get(CachedEntities.DEVICE, device_uuid) device_type = device.device_type SKIPPED_DEVICE_TYPES = { DeviceTypeEnum.EMULATED_IP_SDN_CONTROLLER.value, DeviceTypeEnum.IP_SDN_CONTROLLER.value, DeviceTypeEnum.NCE.value, DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value, } if device_type in SKIPPED_DEVICE_TYPES: self._add_skipped_device(device) MSG = ( Loading @@ -144,21 +146,21 @@ class EventDispatcher(BaseEventDispatcher): LOGGER.warning(MSG.format(str_device_event, str_device)) return device_controller_uuid = device.controller_id.device_uuid.uuid if len(device_controller_uuid) > 0: self._add_skipped_device(device) MSG = ( 'DeviceEvent({:s}) skipped, is a remotely-managed device. ' 'SIMAP should be populated by remote controller: {:s}' ) str_device_event = grpc_message_to_json_string(device_event) str_device = grpc_message_to_json_string(device) LOGGER.warning(MSG.format(str_device_event, str_device)) return #device_controller_uuid = device.controller_id.device_uuid.uuid #if len(device_controller_uuid) > 0: # self._add_skipped_device(device) # MSG = ( # 'DeviceEvent({:s}) skipped, is a remotely-managed device. ' # 'SIMAP should be populated by remote controller: {:s}' # ) # str_device_event = grpc_message_to_json_string(device_event) # str_device = grpc_message_to_json_string(device) # LOGGER.warning(MSG.format(str_device_event, str_device)) # return topology_uuid, endpoint_names = get_device_endpoint(device) if topology_uuid is None: self._add_skipped_device(device) #self._add_skipped_device(device) MSG = 'DeviceEvent({:s}) skipped, no endpoints to identify topology: {:s}' str_device_event = grpc_message_to_json_string(device_event) str_device = grpc_message_to_json_string(device) Loading @@ -172,8 +174,13 @@ class EventDispatcher(BaseEventDispatcher): te_topo.update() device_name = device.name te_topo.node(device_name).create(termination_point_ids=endpoint_names) self._remove_skipped_device(device) te_device = te_topo.node(device_name) te_device.update() for endpoint_name in endpoint_names: te_device.termination_point(endpoint_name).update() #self._remove_skipped_device(device) MSG = 'Device Created: {:s}' LOGGER.info(MSG.format(grpc_message_to_json_string(device_event))) Loading @@ -187,12 +194,6 @@ class EventDispatcher(BaseEventDispatcher): device = self._object_cache.get(CachedEntities.DEVICE, device_uuid) device_type = device.device_type SKIPPED_DEVICE_TYPES = { DeviceTypeEnum.EMULATED_IP_SDN_CONTROLLER.value, DeviceTypeEnum.IP_SDN_CONTROLLER.value, DeviceTypeEnum.NCE.value, DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value, } if device_type in SKIPPED_DEVICE_TYPES: self._add_skipped_device(device) MSG = ( Loading @@ -204,21 +205,21 @@ class EventDispatcher(BaseEventDispatcher): LOGGER.warning(MSG.format(str_device_event, str_device)) return device_controller_uuid = device.controller_id.device_uuid.uuid if len(device_controller_uuid) > 0: self._add_skipped_device(device) MSG = ( 'DeviceEvent({:s}) skipped, is a remotely-managed device. ' 'SIMAP should be updated by remote controller: {:s}' ) str_device_event = grpc_message_to_json_string(device_event) str_device = grpc_message_to_json_string(device) LOGGER.warning(MSG.format(str_device_event, str_device)) return #device_controller_uuid = device.controller_id.device_uuid.uuid #if len(device_controller_uuid) > 0: # self._add_skipped_device(device) # MSG = ( # 'DeviceEvent({:s}) skipped, is a remotely-managed device. ' # 'SIMAP should be updated by remote controller: {:s}' # ) # str_device_event = grpc_message_to_json_string(device_event) # str_device = grpc_message_to_json_string(device) # LOGGER.warning(MSG.format(str_device_event, str_device)) # return topology_uuid, endpoint_names = get_device_endpoint(device) if topology_uuid is None: self._add_skipped_device(device) #self._add_skipped_device(device) MSG = 'DeviceEvent({:s}) skipped, no endpoints to identify topology: {:s}' str_device_event = grpc_message_to_json_string(device_event) str_device = grpc_message_to_json_string(device) Loading @@ -238,7 +239,7 @@ class EventDispatcher(BaseEventDispatcher): for endpoint_name in endpoint_names: te_device.termination_point(endpoint_name).update() self._remove_skipped_device(device) #self._remove_skipped_device(device) MSG = 'Device Updated: {:s}' LOGGER.info(MSG.format(grpc_message_to_json_string(device_event))) Loading @@ -252,12 +253,6 @@ class EventDispatcher(BaseEventDispatcher): device = self._object_cache.get(CachedEntities.DEVICE, device_uuid) device_type = device.device_type SKIPPED_DEVICE_TYPES = { DeviceTypeEnum.EMULATED_IP_SDN_CONTROLLER.value, DeviceTypeEnum.IP_SDN_CONTROLLER.value, DeviceTypeEnum.NCE.value, DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value, } if device_type in SKIPPED_DEVICE_TYPES: self._add_skipped_device(device) MSG = ( Loading @@ -271,7 +266,9 @@ class EventDispatcher(BaseEventDispatcher): device_controller_uuid = device.controller_id.device_uuid.uuid if len(device_controller_uuid) > 0: self._add_skipped_device(device) # if it is a delete of a remotely-managed device, # should be managed by owner controller #self._add_skipped_device(device) MSG = ( 'DeviceEvent({:s}) skipped, is a remotely-managed device. ' 'SIMAP should be updated by remote controller: {:s}' Loading