private Set<LdapGroupDto> getFilteredLdapGroups(String baseDn, Filter filter) {
    final Set<LdapGroupDto> groups = new HashSet<>();
    final LdapTemplate ldapTemplate = loadLdapTemplate();
    LdapServerProperties ldapServerProperties = getLdapProperties();
    LOG.trace("LDAP Group Query - Base DN: '{}' ; Filter: '{}'", baseDn, filter.encode());
    ldapTemplate.search(baseDn, filter.encode(),
        new LdapGroupContextMapper(groups, ldapServerProperties));
    return groups;
  }
Retrieves groups from external LDAP server.

@return set of info about LDAP groups
ambari-server/src/main/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulator.java