Chapter 17. Creating test entries
The dsctl ldifgen
command creates LDIF files with different types of test entries. For example, you can use this LDIF file to populate a test instance or a sub-tree to test the performance of Directory Server with the example entries.
17.1. Overview of testing entries you can create
You can pass one of the following entry type arguments to dsctl ldifgen
:
-
users
: Creates an LDIF file that contains user entries. -
groups
: Creates an LDIF file that contains static group and member entries. -
cos-def
: Creates an LDIF file that either contains a classic pointer or an indirect Class of Service (CoS) definition. -
cos-template
: Creates an LDIF file that contains a CoS template. -
roles
: Creates an LDIF file that contains managed, filtered, or indirect role entries. -
mod-load
: Creates an LDIF file that contains modify operations. Use theldapmodify
utility to load the file into the directory. -
nested
: Creates an LDIF file that contains heavily nested entries in a cascading or fractal tree design.
The dsctl ldifgen
command creates only the LDIF file. To load the file into your Directory Server instance, use the:
-
ldapmodify
utility after you created an LDIF file using themod-load
option -
ldapadd
utility for all other options
Except for the nested entry type, if you do not provide any command line options, the dsctl ldifgen
command uses an interactive mode:
# dsctl instance_name ldifgen entry_type
17.2. Creating an LDIF file with example user entries
Use the dsctl ldifgen users
command to create an LDIF file with example user entries.
Procedure
For example, to create an LDIF file named
/tmp/users.ldif
that adds 100,000 generic users to thedc=example,dc=com
suffix, enter:# dsctl instance_name ldifgen users --suffix "dc=example,dc=com" --number 100000 --generic --ldif-file=/tmp/users.ldif
Note that the command creates the following organizational units (OU) and randomly assigns the users to these OUs:
-
ou=accounting
-
ou=product development
-
ou=product testing
-
ou=human resources
-
ou=payroll
-
ou=people
ou=groups
For further details and other options you can use to create the LDIF file, enter:
# dsctl instance_name ldifgen users --help
-
Optional: Add the test entries to the directory:
# ldapadd -D "cn=Directory Manager" -W -H ldap://server.example.com -x -c -f /tmp/users.ldif
17.3. Creating an LDIF file with example group entries
Use the dsctl ldifgen groups
command to create an LDIF file with example user entries.
Procedure
For example, to create an LDIF file named
/tmp/groups.ldif
that adds 500 groups to theou=groups,dc=example,dc=com
entry, and each group has 100 members, enter:# dsctl instance_name ldifgen groups --number 500 --suffix "dc=example,dc=com" --parent "ou=groups,dc=example,dc=com" --num-members 100 --create-members --member-parent "ou=People,dc=example,dc=com" --ldif-file /tmp/groups.ldif example_group__
Note that the command also creates LDIF statements to add the user entries in
ou=People,dc=example,dc=com
.For further details and other options you can use to create the LDIF file, enter:
# dsctl instance_name ldifgen groups --help
Optional: Add the test entries to the directory:
# ldapadd -D "cn=Directory Manager" -W -H ldap://server.example.com -x -c -f /tmp/groups.ldif
17.4. Creating an LDIF file with an example CoS definition
Use the dsctl ldifgen cos-def
command to create an LDIF file with a Class of Service (CoS) definition.
Procedure
For example, to create an LDIF file named
/tmp/cos-definition.ldif
that adds a classic CoS definition to theou=cos-definitions,dc=example,dc=com
entry, enter:# dsctl instance_name ldifgen cos-def Postal_Def --type classic --parent "ou=cos definitions,dc=example,dc=com" --cos-specifier businessCatagory --cos-template "cn=sales,cn=classicCoS,dc=example,dc=com" --cos-attr postalcode telephonenumber --ldif-file /tmp/cos-definition.ldif
For further details and other options you can use to create the LDIF file, enter:
# dsctl instance_name ldifgen cos-def --help
Optional: Add the test entries to the directory:
# ldapadd -D "cn=Directory Manager" -W -H ldap://server.example.com -x -c -f /tmp/cos-definition.ldif
17.5. Creating an LDIF file with example modification statements
Use the dsctl ldifgen mod-load
command to create an LDIF file that contains update operations.
Procedure
For example, to create an LDIF file named
/tmp/modifications.ldif
:# dsctl instance_name ldifgen mod-load --num-users 1000 --create-users --parent="ou=People,dc=example,dc=com" --mod-attrs="sn" --add-users 10 --modrdn-users 100 --del-users 100 --delete-users --ldif-file=/tmp/modifications.ldif
This command creates a file named
/tmp/modifications.ldif
file with the statements that do the following:-
Create an LDIF file with 1000
ADD
operations to create user entries inou=People,dc=example,dc=com
. -
Modify all entries by changing their
sn
attributes. - Add additional 10 user entries.
-
Perform 100
MODRDN
operations. - Delete 100 entries
Delete all remaining entries at the end
For further details and other options you can use to create the LDIF file, enter:
# dsctl instance_name ldifgen mod-load --help
-
Create an LDIF file with 1000
Optional: Add the test entries to the directory:
# ldapadd -D "cn=Directory Manager" -W -H ldap://server.example.com -x -c -f /tmp/modifications.ldif
17.6. Creating an LDIF file with nested example entries
Use the dsctl ldifgen nested
command to create an LDIF file that contains a heavily nested cascading fractal structure.
Procedure
For example, to create an LDIF file named
/tmp/nested.ldif
that adds 600 users in total in different organizational units (OU) under thedc=example,dc=com
entry, with each OU containing a maximum number of 100 users, enter:# dsctl instance_name ldifgen nested --num-users 600 --node-limit 100 --suffix "dc=example,dc=com" --ldif-file /tmp/nested.ldif
For further details and other options you can use to create the LDIF file, enter:
# dsctl instance_name ldifgen nested --help
Optional: Add the test entries to the directory:
# ldapadd -D "cn=Directory Manager" -W -H ldap://server.example.com -x -c -f /tmp/nested.ldif