Loading src/service/service/service_handlers/l2nm_ietfl2vpn/L2NM_IETFL2VPN_ServiceHandler.py +20 −11 Original line number Diff line number Diff line Loading @@ -53,26 +53,35 @@ class L2NM_IETFL2VPN_ServiceHandler(_ServiceHandler): results = [] try: src_device_uuid, src_endpoint_uuid = get_device_endpoint_uuids(endpoints[0]) src_device = self.__task_executor.get_device(DeviceId(**json_device_id(src_device_uuid))) src_endpoint = get_endpoint_matching(src_device, src_endpoint_uuid) src_manager = self.__task_executor.get_device_manager(src_device) dst_device_uuid, dst_endpoint_uuid = get_device_endpoint_uuids(endpoints[1]) dst_device = self.__task_executor.get_device(DeviceId(**json_device_id(dst_device_uuid))) dst_endpoint = get_endpoint_matching(dst_device, dst_endpoint_uuid) dst_manager = self.__task_executor.get_device_manager(dst_device) if src_device_uuid != dst_device_uuid: if src_manager.device_id.device_uuid.uuid != dst_manager.device_id.device_uuid.uuid: raise Exception('Different Src-Dst devices not supported by now') device_uuid = src_device_uuid device_obj = self.__task_executor.get_device(DeviceId(**json_device_id(device_uuid))) manager = src_manager json_config_rule = json_config_rule_set('/services/service[{:s}]'.format(service_uuid), { 'uuid' : service_uuid, 'src_device_uuid' : src_device_uuid, 'src_endpoint_uuid' : src_endpoint_uuid, 'dst_device_uuid' : dst_device_uuid, 'dst_endpoint_uuid' : dst_endpoint_uuid, 'encapsulation_type': encap_type, 'vlan_id' : vlan_id, 'src': { 'device' : {'uuid': src_device_uuid, 'name': src_device.name }, 'endpoint': {'uuid': src_endpoint_uuid, 'name': src_endpoint.name}, }, 'dst': { 'device' : {'uuid': dst_device_uuid, 'name': dst_device.name }, 'endpoint': {'uuid': dst_endpoint_uuid, 'name': dst_endpoint.name}, }, }) del device_obj.device_config.config_rules[:] device_obj.device_config.config_rules.append(ConfigRule(**json_config_rule)) self.__task_executor.configure_device(device_obj) del manager.device_config.config_rules[:] manager.device_config.config_rules.append(ConfigRule(**json_config_rule)) self.__task_executor.configure_device(manager) results.append(True) except Exception as e: # pylint: disable=broad-except LOGGER.exception('Unable to SetEndpoint for Service({:s})'.format(str(service_uuid))) Loading Loading
src/service/service/service_handlers/l2nm_ietfl2vpn/L2NM_IETFL2VPN_ServiceHandler.py +20 −11 Original line number Diff line number Diff line Loading @@ -53,26 +53,35 @@ class L2NM_IETFL2VPN_ServiceHandler(_ServiceHandler): results = [] try: src_device_uuid, src_endpoint_uuid = get_device_endpoint_uuids(endpoints[0]) src_device = self.__task_executor.get_device(DeviceId(**json_device_id(src_device_uuid))) src_endpoint = get_endpoint_matching(src_device, src_endpoint_uuid) src_manager = self.__task_executor.get_device_manager(src_device) dst_device_uuid, dst_endpoint_uuid = get_device_endpoint_uuids(endpoints[1]) dst_device = self.__task_executor.get_device(DeviceId(**json_device_id(dst_device_uuid))) dst_endpoint = get_endpoint_matching(dst_device, dst_endpoint_uuid) dst_manager = self.__task_executor.get_device_manager(dst_device) if src_device_uuid != dst_device_uuid: if src_manager.device_id.device_uuid.uuid != dst_manager.device_id.device_uuid.uuid: raise Exception('Different Src-Dst devices not supported by now') device_uuid = src_device_uuid device_obj = self.__task_executor.get_device(DeviceId(**json_device_id(device_uuid))) manager = src_manager json_config_rule = json_config_rule_set('/services/service[{:s}]'.format(service_uuid), { 'uuid' : service_uuid, 'src_device_uuid' : src_device_uuid, 'src_endpoint_uuid' : src_endpoint_uuid, 'dst_device_uuid' : dst_device_uuid, 'dst_endpoint_uuid' : dst_endpoint_uuid, 'encapsulation_type': encap_type, 'vlan_id' : vlan_id, 'src': { 'device' : {'uuid': src_device_uuid, 'name': src_device.name }, 'endpoint': {'uuid': src_endpoint_uuid, 'name': src_endpoint.name}, }, 'dst': { 'device' : {'uuid': dst_device_uuid, 'name': dst_device.name }, 'endpoint': {'uuid': dst_endpoint_uuid, 'name': dst_endpoint.name}, }, }) del device_obj.device_config.config_rules[:] device_obj.device_config.config_rules.append(ConfigRule(**json_config_rule)) self.__task_executor.configure_device(device_obj) del manager.device_config.config_rules[:] manager.device_config.config_rules.append(ConfigRule(**json_config_rule)) self.__task_executor.configure_device(manager) results.append(True) except Exception as e: # pylint: disable=broad-except LOGGER.exception('Unable to SetEndpoint for Service({:s})'.format(str(service_uuid))) Loading