Rich Megginson, the 389 Keymaster, created this wonderful python library https://github.com/richm/scripts
To create a new root suffix just
credential = {
'host': 'localhost,
'port': 10389,
'binddn':
'cn=directory manager',
'bindpw': 'secret'
}
Connect to an already-existing instance passing our dict variable as function arguments
conn = DA(**credential)
Create a backend database
backend_name = conn.setupBackend('o=addressbook1')
Bind it to an entry
conn.setupSuffix(suffix='o=addressbook1', bename=backend_name)
And create the entry
e = Entry('o=addressbook1')
e.setValue('objectclass', ['top','organization'])
e.setValue('o','addressbook1')
conn.add(e)
Easy, isn’t it?