sssd_test_framework.hosts.ldap
LDAP multihost host.
Classes
|
LDAP host object. |
- class sssd_test_framework.hosts.ldap.LDAPHost(*args, **kwargs)
Bases:
BaseLDAPDomainHost,BaseLinuxHostLDAP host object.
Provides features specific to native directory server like 389ds.
Note
Full backup and restore is supported.
- Parameters:
tls (bool, optional) – Require TLS connection, defaults to True
- property features: dict[str, bool]
Features supported by the host.
- create_additional_instance(name: str, *, hostname: str, port: int, secure_port: int, suffix: str | None = None) None
Create, configure and start an additional 389ds instance on this host.
The primary instance is provisioned when the host image is built, this only ever adds further instances alongside it.
The instance shares the host’s bind credentials and TLS certificate, so it can be used as a second, distinct LDAP server in failover topologies. SSSD keys its failover server list on the hostname, therefore
hostnamemust differ from the primary instance’s name for the two to be treated as separate servers, even though they share an address.The operation is idempotent, an existing instance of the same name is left untouched.
Example usage in a topology controllerclass MultiLDAPTopologyController(ProvisionedBackupTopologyController): def topology_setup(self, client: ClientHost, ldap: LDAPHost) -> None: ldap.create_additional_instance( "master2", hostname="master2.ldap.test", port=2389, secure_port=2636 ) super().topology_setup() def topology_teardown(self, client: ClientHost, ldap: LDAPHost) -> None: ldap.remove_additional_instance("master2") super().topology_teardown()
The second server is then addressable from a test as
ldap://master2.ldap.test:2389, for example asldap_backup_uri.- Parameters:
name (str) – Instance name, the resulting unit is
dirsrv@<name>.service.hostname (str) – Fully qualified name the instance is reachable under.
port (int) – LDAP port.
secure_port (int) – LDAPS port.
suffix (str | None, optional) – Naming context, defaults to the primary instance’s suffix.
- remove_additional_instance(name: str) None
Stop and remove an instance created by
create_additional_instance().The operation is idempotent, removing a non existent instance is a no-op.
Example usageldap.remove_additional_instance("master2")
- Parameters:
name (str) – Instance name.
- remove_backup(backup_data: Any | None) None
Remove backup data from the host.
- Parameters:
backup_data (Any | None) – Backup data.
- start() None
Start required services.
- Raises:
NotImplementedError – If start operation is not supported.
- stop() None
Stop required services.
- Raises:
NotImplementedError – If stop operation is not supported.
- backup() Any
Backup all directory server data.
Full backup of
cn=configand default naming context is performed. This is done by simple LDAP search on given base dn and remembering the contents. The operation is usually very fast.- Returns:
Backup data.
- Return type:
Any
- restore(backup_data: Any | None) None
Restore directory server data.
Current directory server content in
cn=configand default naming context is modified to its original data. This is done by computing a difference between original data obtained bybackup()and then calling add, delete and modify operations to convert current state to the original state. This operation is usually very fast.- Returns:
Backup data.
- Return type:
Any