Exemplo n.º 1
0
def test_migrate_openldap_slapdd(topology_st):
    """

    :id: e9748040-90a0-4d69-bdde-007104f75cc5
    :setup: Data directory with an openldap config directory.
    :steps:
        1. Parse the configuration
        2. Execute a full migration plan

    :expectedresults:
        1. Success
        2. Success
    """

    inst = topology_st.standalone
    config_path = os.path.join(DATADIR1, 'slapd.d')
    config = olConfig(config_path)
    ldifs = {
        "dc=example,dc=com": os.path.join(DATADIR1,
                                          'example_com.slapcat.ldif'),
        "dc=example,dc=net": os.path.join(DATADIR1,
                                          'example_net.slapcat.ldif'),
    }

    migration = Migration(inst, config.schema, config.databases, ldifs)

    print("==== migration plan ====")
    print(migration.__unicode__())
    print("==== end migration plan ====")

    migration.execute_plan()
Exemplo n.º 2
0
def test_migrate_openldap_hdb(topology_st):
    """Attempt a migration with HDB and no overlay configuration folder.

    :id: 377dbdee-7138-47d9-a518-9e0b0f4d8622
    :setup: Data directory with an openldap config with HDB database.
    :steps:
        1. Parse the configuration
        2. Execute a full migration plan

    :expectedresults:
        1. Success
        2. Success
    """

    inst = topology_st.standalone
    config_path = os.path.join(DATADIR1, 'slapd.d')
    config = olConfig(config_path)
    ldifs = {}

    migration = Migration(config, inst, ldifs)

    print("==== migration plan ====")
    print(migration.__unicode__())
    print("==== end migration plan ====")

    migration.execute_plan()
Exemplo n.º 3
0
def test_parse_openldap_slapdd():
    """Test parsing an example openldap configuration. We should be able to
    at least determine the backends, what overlays they have, and some other
    minimal amount.

    :id: b0061ab0-fff4-45c6-b6c6-171ca3d2dfbc
    :setup: Data directory with an openldap config directory.
    :steps:
        1. Parse the openldap configuration

    :expectedresults:
        1. Success
    """
    config_path = os.path.join(DATADIR1, 'slapd.d')
    config = olConfig(config_path)

    # Do we have databases?
    assert len(config.databases) == 2
    # Check that we unpacked uid eq,pres,sub correctly.
    assert len(config.databases[0].index) == 4
    assert ('objectClass', 'eq') in config.databases[0].index
    assert ('uid', 'eq') in config.databases[0].index
    assert ('uid', 'pres') in config.databases[0].index
    assert ('uid', 'sub') in config.databases[0].index

    # Did our schema parse?
    assert any(
        ['suseModuleConfiguration' in x.names for x in config.schema.classes])
Exemplo n.º 4
0
def test_migrate_openldap_memberof(topology_st):
    """Attempt a migration with memberof configured, and ensure it migrates

    :id: f59f4c6a-7c85-40d1-91ee-dccbc0bd7ef8
    :setup: Data directory with an openldap config with memberof
    :steps:
        1. Parse the configuration
        2. Execute a full migration plan
        3. Assert memberof was configured

    :expectedresults:
        1. Success
        2. Success
        3. Success
    """

    inst = topology_st.standalone
    config_path = os.path.join(DATADIR1, 'slapd.d')
    config = olConfig(config_path)

    for overlay in config.databases[0].overlays:
        print("==================================================")
        print("%s" % overlay.otype)
        print("==================================================")
        assert overlay.otype != olOverlayType.UNKNOWN

    ldifs = {}

    migration = Migration(inst, config.schema, config.databases, ldifs)

    print("==== migration plan ====")
    print(migration.__unicode__())
    print("==== end migration plan ====")

    migration.execute_plan()
    # End test, should suceed with no exceptions.

    memberof = MemberOfPlugin(inst)
    assert memberof.status()
Exemplo n.º 5
0
def test_migrate_openldap_slapdd_skip_elements(topology_st):
    """

    :id: d5e16aeb-6810-423b-b5e0-f89e0596292e
    :setup: Data directory with an openldap config directory.
    :steps:
        1. Parse the configuration
        2. Execute a migration with skipped elements

    :expectedresults:
        1. Success
        2. Success
    """

    inst = topology_st.standalone
    config_path = os.path.join(DATADIR1, 'slapd.d')
    config = olConfig(config_path)
    ldifs = {
        "dc=example,dc=com": os.path.join(DATADIR1,
                                          'example_com.slapcat.ldif'),
    }

    # 1.3.6.1.4.1.5322.13.1.1 is namedObject, so check that isn't there

    migration = Migration(
        inst,
        config.schema,
        config.databases,
        ldifs,
        skip_schema_oids=['1.3.6.1.4.1.5322.13.1.1'],
        skip_overlays=[olOverlayType.UNIQUE],
    )

    print("==== migration plan ====")
    print(migration.__unicode__())
    print("==== end migration plan ====")

    migration.execute_plan()