Exemple #1
0
def setup():
    # uses an existing 389 instance
    # add a suffix
    # add an agreement
    # This setup is quite verbose but to test dsadmin method we should
    # do things manually. A better solution would be to use an LDIF.
    global conn
    conn = DSAdmin(**config.auth)
    conn.verbose = True
    conn.added_entries = []
    conn.added_backends = set(["o=mockbe1"])
    conn.added_replicas = []

    # add a backend for testing ruv and agreements
    addbackend_harn(conn, "testReplica")

    # add another backend for testing replica.add()
    addbackend_harn(conn, "testReplicaCreation")
Exemple #2
0
def setup():
    # uses an existing 389 instance
    # add a suffix
    # add an agreement
    # This setup is quite verbose but to test dsadmin method we should
    # do things manually. A better solution would be to use an LDIF.
    global conn
    conn = DSAdmin(**config.auth)
    conn.verbose = True
    conn.added_entries = []
    conn.added_backends = set(['o=mockbe1'])
    conn.added_replicas = []

    # add a backend for testing ruv and agreements
    addbackend_harn(conn, 'testReplica')

    # add another backend for testing replica.add()
    addbackend_harn(conn, 'testReplicaCreation')
Exemple #3
0
def setup():
    # uses an existing 389 instance
    # add a suffix
    # add an agreement
    # This setup is quite verbose but to test dsadmin method we should
    # do things manually. A better solution would be to use an LDIF.
    global conn
    conn = DSAdmin(**config.auth)
    conn.verbose = True
    conn.added_entries = []
    conn.added_backends = set(['o=mockbe1'])
    conn.added_replicas = []

    # add a backend for testing ruv and agreements
    addbackend_harn(conn, 'testReplica')

    # add another backend for testing replica.add()
    addbackend_harn(conn, 'testReplicaCreation')

    # replication needs changelog
    conn.replica.changelog()
    # add rmanager entry
    try:
        conn.add_s(
            Entry((DN_RMANAGER, {
                'objectclass': "top person inetOrgPerson".split(),
                'sn': ["bind dn pseudo user"],
                'cn': 'replication manager',
                'uid': 'rmanager'
            })))
        conn.added_entries.append(DN_RMANAGER)
    except ldap.ALREADY_EXISTS:
        pass

    # add a master replica entry
    # to test ruv and agreements
    replica_dn = ','.join(
        ['cn=replica', 'cn="o=testReplica"', DN_MAPPING_TREE])
    replica_e = Entry(replica_dn)
    replica_e.update({
        'objectclass': ["top", "nsds5replica", "extensibleobject"],
        'cn': "replica",
        'nsds5replicaroot': 'o=testReplica',
        'nsds5replicaid': MOCK_REPLICA_ID,
        'nsds5replicatype': '3',
        'nsds5flags': '1',
        'nsds5replicabinddn': DN_RMANAGER
    })
    try:
        conn.add_s(replica_e)
    except ldap.ALREADY_EXISTS:
        pass
    conn.added_entries.append(replica_dn)

    agreement_dn = ','.join(('cn=testAgreement', replica_dn))
    agreement_e = Entry(agreement_dn)
    agreement_e.update({
        'objectclass': ["top", "nsds5replicationagreement"],
        'cn': 'testAgreement',
        'nsds5replicahost': 'localhost',
        'nsds5replicaport': '22389',
        'nsds5replicatimeout': '120',
        'nsds5replicabinddn': DN_RMANAGER,
        'nsds5replicacredentials': 'password',
        'nsds5replicabindmethod': 'simple',
        'nsds5replicaroot': 'o=testReplica',
        'nsds5replicaupdateschedule': '0000-2359 0123456',
        'description': 'testAgreement'
    })
    try:
        conn.add_s(agreement_e)
    except ldap.ALREADY_EXISTS:
        pass
    conn.added_entries.append(agreement_dn)
    conn.agreement_dn = agreement_dn
Exemple #4
0
def setup():
    # uses an existing 389 instance
    # add a suffix
    # add an agreement
    # This setup is quite verbose but to test dsadmin method we should
    # do things manually. A better solution would be to use an LDIF.
    global conn
    conn = DSAdmin(**config.auth)
    conn.verbose = True
    conn.added_entries = []
    conn.added_backends = set(['o=mockbe1'])
    conn.added_replicas = []

    # add a backend for testing ruv and agreements
    addbackend_harn(conn, 'testReplica')

    # add another backend for testing replica.add()
    addbackend_harn(conn, 'testReplicaCreation')

    # replication needs changelog
    conn.replica.changelog()
    # add rmanager entry
    try:
        conn.add_s(Entry((DN_RMANAGER, {
            'objectclass': "top person inetOrgPerson".split(),
            'sn': ["bind dn pseudo user"],
            'cn': 'replication manager',
            'uid': 'rmanager'
        }))
        )
        conn.added_entries.append(DN_RMANAGER)
    except ldap.ALREADY_EXISTS:
        pass

    # add a master replica entry
    # to test ruv and agreements
    replica_dn = ','.join(
        ['cn=replica', 'cn="o=testReplica"', DN_MAPPING_TREE])
    replica_e = Entry(replica_dn)
    replica_e.update({
                     'objectclass': ["top", "nsds5replica", "extensibleobject"],
                     'cn': "replica",
                     'nsds5replicaroot': 'o=testReplica',
                     'nsds5replicaid': MOCK_REPLICA_ID,
                     'nsds5replicatype': '3',
                     'nsds5flags': '1',
                     'nsds5replicabinddn': DN_RMANAGER
                     })
    try:
        conn.add_s(replica_e)
    except ldap.ALREADY_EXISTS:
        pass
    conn.added_entries.append(replica_dn)

    agreement_dn = ','.join(('cn=testAgreement', replica_dn))
    agreement_e = Entry(agreement_dn)
    agreement_e.update({
                       'objectclass': ["top", "nsds5replicationagreement"],
                       'cn': 'testAgreement',
                       'nsds5replicahost': 'localhost',
                       'nsds5replicaport': '22389',
                       'nsds5replicatimeout': '120',
                       'nsds5replicabinddn': DN_RMANAGER,
                       'nsds5replicacredentials': 'password',
                       'nsds5replicabindmethod': 'simple',
                       'nsds5replicaroot': 'o=testReplica',
                       'nsds5replicaupdateschedule': '0000-2359 0123456',
                       'description': 'testAgreement'
                       })
    try:
        conn.add_s(agreement_e)
    except ldap.ALREADY_EXISTS:
        pass
    conn.added_entries.append(agreement_dn)
    conn.agreement_dn = agreement_dn