With this python snippet, I can get the list of all the available objectClasses in a LDAP server:
import ldap
conn = ldap.initialize("ldap://127.0.0.1:389")
conn.simple_bind_s("cn=admin,dc=mydomain,dc=tld", "mypassword")
res = conn.search_s("cn=subschema", ldap.SCOPE_BASE, "(objectclass=*)", ["*", "+"])
subschema_entry = res[0]
subschema_subentry = ldap.cidict.cidict(subschema_entry[1])
subschema = ldap.schema.SubSchema(subschema_subentry)
object_class_oids = subschema.listall(ldap.schema.models.ObjectClass)
object_classes = [subschema.get_obj(ldap.schema.models.ObjectClass, oid) for oid in object_class_oids]
From this point this is easy to get all the required and optional attributes with object_class.may and object_class.must, but how can I get the list of the operational attributes applicable on a given objectClass? For instance the memberof attribute brought by the memberof OpenLDAP overlay, or the pwdAccountLockedTime attribute brought by the ppolicy overlay.