'Filter FC ports and initiators connected to fabrics.'

def _filter_by_fabric(self, wwns, ports):

    ini_tgt_map = self.fcsan.get_device_mapping_from_network(wwns, ports)
    fabric_connected_ports = []
    fabric_connected_initiators = []
    for fabric in ini_tgt_map:
        fabric_connected_ports.extend(ini_tgt_map[fabric]['target_port_wwn_list'])
        fabric_connected_initiators.extend(ini_tgt_map[fabric]['initiator_port_wwn_list'])
    if (not fabric_connected_ports):
        msg = _('No    FC    port    connected    to    fabric.')
        raise exception.VolumeBackendAPIException(data=msg)
    if (not fabric_connected_initiators):
        msg = _('No    initiator    connected    to    fabric.')
        raise exception.VolumeBackendAPIException(data=msg)
    LOG.debug('Fabric    connected    ports:    %(ports)s,    Fabric    connected    initiators:    %(initiators)s.', {'ports': fabric_connected_ports, 'initiators': fabric_connected_initiators})
    return (fabric_connected_ports, fabric_connected_initiators)
