Sun Java logo     Previous      Contents      Index      Next     

Sun logo
Sun ONE Directory Server Resource Kit 5.2 Tools Reference 

Chapter 18
The Standard Schema LDIF Generator Tool

The dbgen.pl tool generates a sample database containing entries with random values. The entries can then be loaded into a directory server and used to run performance tests. This chapter provides instructions on how to use the script. It contains the following sections:


Overview

The dbgen.pl (database generator) tool is a Perl script that generates a database containing entries with random attribute values. The output is an LDAP Data Interchange Format (LDIF) text file which can be loaded into a directory server and used to run performance tests. Generated entries follow the standard schema to provide more realistic output.


Note

The ldifgen tool, detailed in Chapter 19, "The Custom Schema LDIF Generator Tool," generates entries using a custom schema. For this reasons, dbgen.pl is the recommended tool for random database creation.


The DSRK includes the tool in the DSRK_base/perl directory.


Note

This script requires Perl version 5.005_03 or later. See Third-Party Sources of Information for links to Perl resources.


Accompanying Data Files

The script relies on the following files in the DSRK_base/data directory:

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.


Note

You may edit the contents of these data files to modify the output of the dbgen.pl tool. (You will need root privileges to edit these files on UNIX®-based systems.)


Customizing the Script

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.


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. The tool generates random values for either object class’s allowed attributes. (See the Sample Output for examples of both object classes and the generated attribute values.)

The tool also generates the root and ou entries so that its output is a complete and valid LDAP directory hierarchy expressed in LDIF text. The ou entries do not contain any attributes and are always the same. The root entry contains only simple aci (Access Control Instructions) attributes that are also invariant.

Syntax

The syntax of the dbgen.pl tool on the command-line takes the following form:

dbgen.pl -o filename.ldif -n number [options]

Where:

Options

The dbgen.pl options and parameters are described in Table 18-1. Running the dbgen.pl script from the command-line without any options or parameters will display the usage help text that briefly describes all options.

Table 18-1  Command-Line Options for dbgen.pl 

Option

Parameter

Purpose

-o

outputFile

Specify the output file for the generated database. The output file is a complete directory hierarchy in LDIF text. This parameter is required.

-n

number

Specify the number of leaf entries in the generated database. This parameter is required.

-s

suffix

Specify the root of the generated hierarchy. The tool will create an entry of class top with a DN equal to the suffix, and the DN of all other generated entries will contain this suffix. The suffix must begin with either dc=DomainComponent or o=Organization. When this option is omitted, the default suffix is dc=siroe,dc=com.

-c

 

Use the cn (common name) attribute and value in the RDN. When this option is ommited, the uid attribte will be used.

-O

(capital letter O)

Generate all leaf entries as OrganizationalPerson objects and create only the corresponding attributes. When this option is omitted, all leaf entries will have the object class inetOrgPerson and the additional attributes of this class.

-r

seed

Specify a seed integer for the random number generator. The data generated by the tool will be different from one execution to the next only if the seed is different. A common way to ensure the seed is different with every execution is to use a timestamp.

-p

 

This option is mentioned in the online help, but it is deprecated.

-q

 

Quiet output mode: dbgen.pl will not display any measure of progress while running. When this flag is omitted, the tool will display a line of dots, one dot for every 10,000 entries generated.

-v

 

Verbose output mode: dbgen.pl will display additional messages about its progress.


Sample Output

The examples in this section show the output of the dbgen.pl tool. These examples use the default data files found in the DSRK_base/data directory. To save space, only the first full leaf entry is shown in each case.

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.

Code Example 18-1  InetOrgPerson Generated Entry 

$ 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 skipped

$ cat out1.ldif

dn: 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: Accounting

dn: ou=Product Development, dc=siroe,dc=com

objectClass: top

objectClass: organizationalUnit

ou: Product Development

dn: ou=Product Testing, dc=siroe,dc=com

objectClass: top

objectClass: organizationalUnit

ou: Product Testing

dn: ou=Human Resources, dc=siroe,dc=com

objectClass: top

objectClass: organizationalUnit

ou: Human Resources

dn: ou=Payroll, dc=siroe,dc=com

objectClass: top

objectClass: organizationalUnit

ou: Payroll

dn: 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 Guru

dn: 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.

Code Example 18-2  OrganizationalPerson Generated Entry 

$ 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: Accounting

dn: ou=Product Development, o=Varrius Corp.,c=US

objectClass: top

objectClass: organizationalUnit

ou: Product Development

dn: ou=Product Testing, o=Varrius Corp.,c=US

objectClass: top

objectClass: organizationalUnit

ou: Product Testing

dn: ou=Human Resources, o=Varrius Corp.,c=US

objectClass: top

objectClass: organizationalUnit

ou: Human Resources

dn: ou=Payroll, o=Varrius Corp.,c=US

objectClass: top

objectClass: organizationalUnit

ou: Payroll

dn: 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 Director

dn: 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 2004 Sun Microsystems, Inc. All rights reserved.