'Concrete implementation of delete_connection.
Based on zoning policy and state of each I-T pair, list of zones
are created for deletion. The zones are either updated deleted based
on the policy and attach/detach state of each I-T pair.
:param fabric: Fabric name from cinder.conf file
:param initiator_target_map: Mapping of initiator to list of targets'

@lockutils.synchronized('cisco', 'fcfabric-', True)
def delete_connection(self, fabric, initiator_target_map, host_name=None, storage_system=None):

    LOG.debug('Delete    connection    for    fabric:    %s', fabric)
    LOG.info('CiscoFCZoneDriver    -    Delete    connection    for    I-T    map:    %s', initiator_target_map)
    fabric_ip = self.fabric_configs[fabric].safe_get('cisco_fc_fabric_address')
    fabric_user = self.fabric_configs[fabric].safe_get('cisco_fc_fabric_user')
    fabric_pwd = self.fabric_configs[fabric].safe_get('cisco_fc_fabric_password')
    fabric_port = self.fabric_configs[fabric].safe_get('cisco_fc_fabric_port')
    zoning_policy = self.configuration.zoning_policy
    zoning_policy_fab = self.fabric_configs[fabric].safe_get('cisco_zoning_policy')
    if zoning_policy_fab:
        zoning_policy = zoning_policy_fab
    zoning_vsan = self.fabric_configs[fabric].safe_get('cisco_zoning_vsan')
    LOG.info('Zoning    policy    for    fabric    %s', zoning_policy)
    statusmap_from_fabric = self.get_zoning_status(fabric_ip, fabric_user, fabric_pwd, fabric_port, zoning_vsan)
    if (statusmap_from_fabric.get('session') == 'none'):
        cfgmap_from_fabric = self.get_active_zone_set(fabric_ip, fabric_user, fabric_pwd, fabric_port, zoning_vsan)
        zone_names = []
        if cfgmap_from_fabric.get('zones'):
            zone_names = cfgmap_from_fabric['zones'].keys()
        LOG.debug('zone    config    from    Fabric:    %s', cfgmap_from_fabric)
        for initiator_key in initiator_target_map.keys():
            initiator = initiator_key.lower()
            formatted_initiator = zm_utils.get_formatted_wwn(initiator)
            zone_update_map = {}
            zones_to_delete = []
            t_list = initiator_target_map[initiator_key]
            if (zoning_policy == 'initiator-target'):
                for t in t_list:
                    target = t.lower()
                    zone_name = driver_utils.get_friendly_zone_name(zoning_policy, initiator, target, host_name, storage_system, self.configuration.cisco_zone_name_prefix, SUPPORTED_CHARS)
                    LOG.debug('Zone    name    to    del:    %s', zone_name)
                    if ((len(zone_names) > 0) and (zone_name in zone_names)):
                        LOG.debug('Added    zone    to    delete    to    list:    %s', zone_name)
                        zones_to_delete.append(zone_name)
            elif (zoning_policy == 'initiator'):
                zone_members = [formatted_initiator]
                for t in t_list:
                    target = t.lower()
                    zone_members.append(zm_utils.get_formatted_wwn(target))
                zone_name = driver_utils.get_friendly_zone_name(zoning_policy, initiator, target, host_name, storage_system, self.configuration.cisco_zone_name_prefix, SUPPORTED_CHARS)
                if (zone_names and (zone_name in zone_names)):
                    filtered_members = filter((lambda x: (x not in zone_members)), cfgmap_from_fabric['zones'][zone_name])
                    LOG.debug('Zone    delete    -    I    mode:    filtered    targets:    %s', filtered_members)
                    if filtered_members:
                        remove_members = filter((lambda x: (x in cfgmap_from_fabric['zones'][zone_name])), zone_members)
                        if remove_members:
                            remove_members.remove(formatted_initiator)
                            LOG.debug('Zone    members    to    remove:    %s', remove_members)
                            zone_update_map[zone_name] = remove_members
                            LOG.debug('Filtered    zone    Map    to    update:    %s', zone_update_map)
                    else:
                        zones_to_delete.append(zone_name)
            else:
                LOG.info('Zoning    Policy:    %s,    not    recognized', zoning_policy)
            LOG.debug('Zone    map    to    remove    update:    %s', zone_update_map)
            LOG.debug('Final    Zone    list    to    delete:    %s', zones_to_delete)
            conn = None
            try:
                conn = importutils.import_object(self.configuration.cisco_sb_connector, ipaddress=fabric_ip, username=fabric_user, password=fabric_pwd, port=fabric_port, vsan=zoning_vsan)
                if zone_update_map:
                    conn.update_zones(zone_update_map, self.configuration.cisco_zone_activate, zoning_vsan, ZoneConstant.ZONE_REMOVE, cfgmap_from_fabric, statusmap_from_fabric)
                if zones_to_delete:
                    zone_name_string = ''
                    num_zones = len(zones_to_delete)
                    for i in range(0, num_zones):
                        if (i == 0):
                            zone_name_string = ('%s%s' % (zone_name_string, zones_to_delete[i]))
                        else:
                            zone_name_string = ('%s%s%s' % (zone_name_string, ';', zones_to_delete[i]))
                    conn.delete_zones(zone_name_string, self.configuration.cisco_zone_activate, zoning_vsan, cfgmap_from_fabric, statusmap_from_fabric)
                conn.cleanup()
            except Exception:
                msg = _('Failed    to    update    or    delete    zoning    configuration')
                LOG.exception(msg)
                raise exception.FCZoneDriverException(msg)
            LOG.debug('Zones    deleted    successfully:    %s', zone_update_map)
        else:
            LOG.debug('Zoning    session    exists    VSAN:    %s', zoning_vsan)
