Sun Java logo     Previous      Contents      Index      Next     

Sun logo
Sun ONE Directory Server Resource Kit 5.2 Tools Reference 

Chapter 19
The Custom Schema LDIF Generator Tool

The ldifgen tool creates Lightweight Directory Access Protocol (LDAP) entries with randomly generated content. The entries can then be loaded into an LDAP server to create a test directory. This chapter provides instructions on how to use the command. It contains the following sections:


The ldifgen (LDIF generator) tool creates LDAP entries with randomly generated content. The output is generated as LDIF (LDAP Data Interchange Format) text that can be loaded into an LDAP server to create a test directory. As with the script (detailed in Chapter 18, "The Standard Schema LDIF Generator Tool"), this generated file can be used to run performance tests.


The difference between the two tools is that ldifgen uses a custom schema, creating a simple directory structure with leaf entries belonging to the xyzmember object class; dbgen uses a standard schema.

After generating the LDIF file, you may use the ldapmodify tool to import both the schema and the generated entries. (See Chapter 4, "The ldapmodify Tool" for information.)


The xyzmember schema defines this custom object class and is generated by one of the command-line options. See Options for more information.

The DNs of generated entries fit within the minimal hierarchy shown in Figure 19-1. The structure of this tree is not configurable although the number of leaf entries is determined by the -n option on the command-line.

Figure 19-1  LDAP Directory Hierarchy Created by ldifgen

The ldifgen tool generates the parent entries so that its output is a complete and valid LDAP directory hierarchy expressed in LDIF text. The three parent entries do not contain any attributes and are always the same.


The DNs of generated entries use sequential numbering to ensure that no two entries of the same invocation will be identical. However, due to the implementation of randomizing functions on certain platforms, the ldifgen tool may generate exactly the same attribute values every time it is invoked. While the values are seemingly random, they may in fact be identical to the other entries with the same DN created by different invocations of the command.

Command Usage

The ldifgen tool generates entries that are xyzmember objects. This custom object class acts as a template, and the tool generates random values for each of its attributes. If you do not already have the schema for this object class, use the -S option to generate the version corresponding to your directory. You will need to load this schema entry into the directory before loading the generated entries. (An example of this class and its attributes is shown in Sample Output.)


The syntax of the ldifgen tool on the command-line can take one of two forms:

ldifgen -n number > filename.ldif

ldifgen -S version > filename.ldif



The ldifgen options and parameters are described in Table 19-1. Running the ldifgen command without any options or parameters will display the brief usage help text.

Table 19-1  Command-Line Options for ldifgen 






Generates the version of the custom schema corresponding to your directory. The schema is given as an LDIF update statement that may be loaded using the ldapmodify command. See Chapter 4, "The ldapmodify Tool" for information.



Specifies the number of leaf entries.



Display the usage help text that briefly describes all options.

Sample Output

Code Example 19-1 shows a sample output of the ldifgen tool. Only the first leaf entry is shown in its entirety. Some attribute values have been shortened to fit on a single line.

Code Example 19-1  Sample Output From ldifgen 

$ ldifgen -n 3

dn: C=US

c: US

objectclass: top

objectclass: country

dn: O=XYZ,C=US

o: XYZ

objectclass: top

objectclass: organization

dn: OU=1,O=XYZ,C=US

ou: 1

objectclass: top

objectclass: organizationunit

dn: UID=0,OU=1,O=XYZ,C=US

objectclass: top

objectclass: xyzmember

uid: 0

sponsorId: 18080291083208191342756198584726724745154694425751126868

cn: fozepdkdnqlhfejdzksc cfykdxnlorwvfwavbmyq

login: cl1ldo51y5fam665jwlxvhpxdnyuj6z2y6dhl88p

userpassword: 00000000000000000000000000000000000000000000000000000

postalCode: 0080227

st: jq

cityCode: iwk

city: 49i0zztw1dsrvw3vvcb8siyhghio0aea921ys00z

cityIds: 3yw4lqpm870qv4d1clwi10ig9pk7gaw9zykquf2sc99x3c5l4rtvx22whs

l: tb3y0tuky2

signId: 33382363622400408168917651334147477905498730992720714579805

createTimestamp: 20000101000001Z

modifyTimestamp: 20000101000001Z


topics: gb1cuwjzi0083xogiyleo3kae3w841xaios2r27zsddlg77ovit9rjqvssu

searchFlag: jx2rblz8tddbgg2ndzhy7gep5aqosa0hdtefkjt3mxk93cmn19regb9

myPageTitle: 6wwavgv5qeei1ohbq9ox9l1fn1wohc4tyqtzdeutjy1qcpr8olvnx2

customization: xy01vjqy4qxde49wjrayivb5nalnvg9ykzplplpj1s2ln1nwyn0n

defBookmarks: wa7mz2eudtjkcbb5jornhi0bq5ie5jn7zkj4c3pvny55g6050xi7l

hints: ly8qoxl6r0rk42faell48ahkpvrfy3gp7u6mhxiyngoxotet4p3jpr9ksq5w

birthdate: zbcxbo9jbxn4j27y1bxc76lmnkx6g886qatr48gl

flags: buvl2tptucvr8mkmcnyjlwf1dyjnc5zdpkoh33h4li1kvbcx4gmgirn1vcfx

sourceAppId: 8khnubb4lyewm5m7n4bha3nzlhq6jbahlhbmysw9w0w8vom8j3wzwp

timeZone: 62

c: fo

pageRefresh: 3647

layout: ocra2dp3r1igak6wzkq2bgeo6d8zuog86xpegknebbkrlgtb7938f72rq0g

colors: u356qkqdu4hb5r8heryrrr5w4yu040h59ch62y92sgj3dhqxyeefbaile2c

givenName: fozepdkdnqlhfejdzksc

sn: cfykdxnlorwvfwavbmyq

address: 8jz817ktvj1t5a2ohjc53wrlczwg7evl30zux9tyykhtkqo7f638s0zv5m

phone: 63714139647-45991442

occupation: opsxdliwvjmemuapxydvewsddzwznyfcozztmjsi

householdIncome: 2620083169

gender: F

friend: uid=0,ou=1,o=xyz

dn: UID=1,OU=1,O=XYZ,C=US

objectclass: top

objectclass: xyzmember

uid: 1


dn: UID=2,OU=1,O=XYZ,C=US

objectclass: top

objectclass: xyzmember

uid: 2


Previous      Contents      Index      Next     

Copyright 2004 Sun Microsystems, Inc. All rights reserved.