Previous Contents Index Next |
iPlanet Directory Server Resource Kit 5.1 Tools Reference |
Chapter 16 dbgen.pl
The dbgen.pl (database generator) tool is a Perl script that generates a sample database containing entries with random values. The output is LDIF (LDAP Data Interchange Format) text and can be loaded into a directory server and used to run performance tests.As in the ldifgen tool (see Chapter 17), generated entries follow a fixed format, but dbgen.pl uses the standard schema and provides more realistic output. For these reasons, dbgen.pl is the recommended tool for random database creation.
This chapter contains the following sections:
Command Usage
Command Usage
The dbgen.pl tool generates a directory hierarchy that mimics a simple corporate structure. The script has an option for specifying a suffix , which will be the root of the generated hierarchy. By default it is dc=siroe,dc=com.All of the leaf entries are inetOrgPerson objects by default, or you may specify the -O (the capital letter O) option to create all OrganizationalPerson objects. These object classes are used as templates, and the tool generates random values for their allowed attributes. See the "Examples and Sample Output" for examples of both object classes and the generated attribute values.
The tool also generates the root and organizational unit entries so that its output is a complete and valid LDAP directory hierarchy expressed in LDIF text. The organizational unit (ou) entries do not contain any attributes and are always the same. The root entry contains only simple aci attributes (Access Control Instructions), and these are also invariant.
The following diagram shows the directory tree representing the LDIF entries generated by the dbgen.pl tool.
Figure 16-1    LDAP Directory Tree Generated by dbgen.pl
The script relies on the following files in the installDir /data directory. You may edit the contents of these files to modify the output of the dbgen.pl tool (you will need root privileges to edit these files on UNIX systems):
dbgen-OrgUnits - Contains the name of five organizational units. One entry for each organizational unit will be created under the suffix root of the generated directory. Then, each person entry will be randomly placed in one of the organizational units.
Some attribute values such as email addresses are derived from the name and the suffix to create a plausible entry. Other data such as telephone numbers or titles are generated randomly or selected randomly from internal lists. These types of attribute values are not configurable.dbgen-GivenNames and dbgen-FamilyNames - Contain over 8600 plausible first names and 13400 plausible surnames, respectively. Each entry representing a person is based on a given name and family name, each randomly chosen from these files. A sequential integer is also appended to all names to ensure that no two entries and no two DNs are identical.
Syntax
The dbgen.pl tool has the following syntax:Where:
filename .ldif is a writable file that will contain the LDIF output.
Running the dbgen.pl script without any options or parameters will display the usage help text that briefly describes all options.number is the number of leaf entries that will be generated, in addition to the parent entries that are always present.
The dbgen.pl script requires Perl version 5.005_03 or later. See "Where to Find Additional Information" for links to Perl resources.
If you customize the dbgen.pl script for added functionality, we encourage you to share your work with other LDAP users. Please post a message to the iplanet.server.idsrk public newsgroup with your ideas or your code.
Options
The dbgen.pl options and parameters are described in the following table.
Examples and Sample Output
The examples in this section show the output of the dbgen.pl tool. To save space, only the first full leaf entry is shown in each case. These examples use the default data files in the installDir /data directory.
InetOrgPerson Entries
This example demonstrates how the dbgen.pl script generates random attribute values for entries of the inetOrgPerson object class. It uses the date command of the UNIX shell to generate a seed for the random number generator. It also demonstrates the verbose output that includes progress messages.$ perl dbgen.pl -o out1.ldif -n 3 -r `date +%S` -v
Loading Name Data...
Done
Ok, now generating 3 entries, please wait
.Generated 3 entries, 0 duplicates skippeddn: dc=siroe,dc=com
objectClass: top
objectClass: domain
dc: siroe
aci: (target=ldap:///dc=siroe,dc=com)(targetattr=*)
(version 3.0; acl "acl1"; allow(write) userdn = "ldap:///self";)
aci: (target=ldap:///dc=siroe,dc=com)(targetattr=*)
(version 3.0; acl "acl2"; allow(write) groupdn =
"ldap:///cn=Directory Administrators, dc=siroe,dc=com";)
aci: (target=ldap:///dc=siroe,dc=com)(targetattr=*)
(version 3.0; acl "acl3"; allow(read, search, compare) userdn =
"ldap:///anyone";)dn: ou=Accounting, dc=siroe,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Accountingdn: ou=Product Development, dc=siroe,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Product Developmentdn: ou=Product Testing, dc=siroe,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Product Testingdn: ou=Human Resources, dc=siroe,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Human Resourcesdn: ou=Payroll, dc=siroe,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Payrolldn: uid=HDiogo0, ou=Product Testing, dc=siroe,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Harry Diogo
sn: Diogo
uid: HDiogo0
givenName: Harry
description: This is Harry Diogo0's description
userPassword: HDiogo0
departmentNumber: 5083
employeeType: Manager
homePhone: +1 804 339-8183
initials: H. D.
telephoneNumber: +1 818 605-3216
facsimileTelephoneNumber: +1 206 768-6857
mobile: +1 408 194-1108
pager: +1 415 692-3053
manager: Pippy Mejdal0
secretary: Eden Yvon0
roomNumber: 2265
carLicense: ORHYA5I
l: Redwood Shores
ou: Product Testing
mail: Harry_Diogo@siroe.com
postalAddress: Product Testing Dept #441, Room#73
title: Senior Product Testing Gurudn: uid=MPlanta1, ou=Product Development, dc=siroe,dc=com
[...]dn: uid=GVela2, ou=Human Resources, dc=siroe,dc=com
[...]
OrganizationalPerson Entries
In this example we use the -O (capital letter O) option to generate entries of the organizationalPerson object class. We also use the -c and -s options to customize the DN of the generated entries.$ perl dbgen.pl -o out2.ldif -n 3 -O -r `date +%S` -q \
-c -s "o=Varrius Corp.,c=US"$ cat out2.ldif
dn: o=Varrius Corp.,c=US
objectClass: top
objectClass: organization
o: Varrius Corp.
aci: (target=ldap:///o=Varrius Corp.,c=US)(targetattr=*)
(version 3.0; acl "acl1"; allow(write) userdn = "ldap:///self";)
aci: (target=ldap:///o=Varrius Corp.,c=US)(targetattr=*)
(version 3.0; acl "acl2"; allow(write) groupdn =
"ldap:///cn=Directory Administrators, o=Varrius Corp.,c=US";)
aci: (target=ldap:///o=Varrius Corp.,c=US)(targetattr=*)
(version 3.0; acl "acl3"; allow(read, search, compare) userdn =
"ldap:///anyone";)dn: ou=Accounting, o=Varrius Corp.,c=US
objectClass: top
objectClass: organizationalUnit
ou: Accountingdn: ou=Product Development, o=Varrius Corp.,c=US
objectClass: top
objectClass: organizationalUnit
ou: Product Developmentdn: ou=Product Testing, o=Varrius Corp.,c=US
objectClass: top
objectClass: organizationalUnit
ou: Product Testingdn: ou=Human Resources, o=Varrius Corp.,c=US
objectClass: top
objectClass: organizationalUnit
ou: Human Resourcesdn: ou=Payroll, o=Varrius Corp.,c=US
objectClass: top
objectClass: organizationalUnit
ou: Payrolldn: cn=Mihaela Inman, ou=Accounting, o=Varrius Corp.,c=US
objectClass: top
objectClass: person
objectClass: organizationalPerson
cn: Mihaela Inman
sn: Inman
uid: MInman0
givenName: Mihaela
description: This is Mihaela Inman's description
userPassword: MInman0
telephoneNumber: +1 714 803-8455
facsimileTelephoneNumber: +1 714 371-9310
l: Santa Clara
ou: Accounting
mail: Mihaela_Inman@siroe.com
postalAddress: Accounting Dept #339, Room#98
title: Chief Accounting Directordn: cn=Randall Braddy,ou=Human Resources,o=Varrius Corp.,c=US
[...]dn: cn=Morley Cantwell,ou=Product Development,o=Varrius Corp.,c=US
[...]
Previous Contents Index Next
Copyright 2002 Sun Microsystems, Inc.. All rights reserved.Last Updated April 15, 2002