6330N/A<?xml version="1.0" encoding="UTF-8"?>
6330N/A<!--
6330N/A ! CCPL HEADER START
6330N/A !
6330N/A ! This work is licensed under the Creative Commons
6330N/A ! Attribution-NonCommercial-NoDerivs 3.0 Unported License.
6330N/A ! To view a copy of this license, visit
6330N/A ! http://creativecommons.org/licenses/by-nc-nd/3.0/
6330N/A ! or send a letter to Creative Commons, 444 Castro Street,
6330N/A ! Suite 900, Mountain View, California, 94041, USA.
6330N/A !
6330N/A ! You can also obtain a copy of the license at
6330N/A ! trunk/opendj3/legal-notices/CC-BY-NC-ND.txt.
6330N/A ! See the License for the specific language governing permissions
6330N/A ! and limitations under the License.
6330N/A !
6330N/A ! If applicable, add the following below this CCPL HEADER, with the fields
6330N/A ! enclosed by brackets "[]" replaced with your own identifying information:
6330N/A ! Portions Copyright [yyyy] [name of copyright owner]
6330N/A !
6330N/A ! CCPL HEADER END
6330N/A !
6330N/A ! Copyright 2012 ForgeRock AS
6330N/A ! Portions Copyright 2013 Jens Elkner
6330N/A !
6330N/A-->
6330N/A<refentry xml:id="make-ldif-template-5" xmlns="http://docbook.org/ns/docbook"
6330N/A version="5.0" xml:lang="en"
6330N/A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6330N/A xsi:schemaLocation="http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd"
6330N/A xmlns:xlink="http://www.w3.org/1999/xlink"
6330N/A xmlns:xi="http://www.w3.org/2001/XInclude">
6330N/A <xi:include href="common.xml" xpointer='xpointer(//info[@name="info"])'/>
6330N/A <refmeta>
6330N/A <refentrytitle>make-ldif-template</refentrytitle>
6330N/A <xi:include href="common.xml" xpointer='xpointer(//manvolnum[@name="v5"])'/>
6330N/A </refmeta>
6330N/A <refnamediv>
6330N/A <refname>make-ldif-template</refname>
6330N/A <refpurpose>template file for the make-ldif command</refpurpose>
6330N/A </refnamediv>
6330N/A <refsynopsisdiv>
6330N/A <synopsis>
6330N/A# Comment lines start with #.
6330N/A
6330N/A# Optionally include classes that define custom tags.
6330N/A# Custom tag classes extend org.opends.server.tools.makeldif.Tag and
6330N/A# must be on the class path when you run make-ldif.
6330N/A#
6330N/Ainclude <replaceable>custom.makeldif.tag.ClassName</replaceable>
6330N/A...
6330N/A
6330N/A# Optionally define constants used in the template.
6330N/A# To reference constants later, put brackets around the name:
6330N/A# [constant-name]
6330N/A#
6330N/Adefine <replaceable>constant-name</replaceable>=<replaceable>value</replaceable>
6330N/A...
6330N/A
6330N/A# Define branches by suffix DN, such as such as the following
6330N/A#
6330N/A# dc=example,dc=com
6330N/A# ou=People,dc=example,dc=com
6330N/A# ou=Groups,dc=example,dc=com
6330N/A#
6330N/A# make-ldif generates the necessary object class definitions and RDNs.
6330N/A#
6330N/A# A branch can have subordinateTemplates that define templates to use for
6330N/A# the branch entry.
6330N/A#
6330N/A# A branch can have additional attributes generated on the branch entry.
6330N/A# See the Description below for more information on specifying attribute
6330N/A# values.
6330N/A#
6330N/Abranch: <replaceable>suffix-dn</replaceable>
6330N/A[subordinateTemplate: <replaceable>template-name</replaceable>:<replaceable>number</replaceable>
6330N/A...]
6330N/A[<replaceable>attribute</replaceable>: <replaceable>attr-value</replaceable>
6330N/A...]
6330N/A
6330N/A...
6330N/A
6330N/A# Define entries using templates.
6330N/A#
6330N/A# A template can extend another template.
6330N/A# A template defines the RDN attribute(s) used for generated entries.
6330N/A# A template can have a subordinateTemplate that defines a template to use
6330N/A# for the generated entries.
6330N/A#
6330N/A# A template then defines attributes. See the Description below for more
6330N/A# information on specifying attribute values.
6330N/A#
6330N/Atemplate: <replaceable>template-name</replaceable>
6330N/A[extends: <replaceable>template-name</replaceable>]
6330N/ArdnAttr: <replaceable>attribute</replaceable>[+<replaceable>attribute</replaceable> ...]
6330N/A[subordinateTemplate: <replaceable>template-name</replaceable>:<replaceable>number</replaceable>]
6330N/A[<replaceable>attribute</replaceable>: <replaceable>attr-value</replaceable>
6330N/A...]
6330N/A
6330N/A...
6330N/A</synopsis>
6330N/A </refsynopsisdiv>
6330N/A <refsection>
6330N/A <title>Description</title>
6330N/A
6330N/A <para>
6330N/ATemplate files specify how to build LDIF. They allow you to define variables,
6330N/Ainsert random values from other files, and generally build arbitrarily large
6330N/ALDIF files for testing purposes. You pass template files to the
6330N/A<command>make-ldif</command> command when generating LDIF.
6330N/A </para>
6330N/A <para>
6330N/AThe Synopsis above shows the layout for a <command>make-ldif</command> template
6330N/Afile. This section focuses on what you can do to specify entry attribute values,
6330N/Acalled <replaceable>attr-value</replaceable> in the Synopsis section.
6330N/A </para>
6330N/A
6330N/A <variablelist>
6330N/A <title>Specifying Attribute Values</title>
6330N/A
6330N/A <para>
6330N/AWhen specifying attribute values in <command>make-ldif</command> templates, you
6330N/Acan use static text and constants that you have defined, enclosing names for
6330N/Aconstants in brackets, <literal>[myConstant]</literal>. You can use more than
6330N/Aone constant per line, as in the following example.
6330N/A </para>
6330N/A <programlisting>description: Description for [org] under [suffix]</programlisting>
6330N/A
6330N/A <para>
6330N/AYou can also use two kinds of tags when specifying attribute values. One kind of
6330N/Atag gets replaced with the value of another attribute in the generated entry.
6330N/ASuch tags are delimited with braces, <literal>{ }</literal>. For example, if
6330N/Ayour template includes definitions for first name and last name attributes:
6330N/A </para>
6330N/A
6330N/A <programlisting>givenName: &lt;first&gt;
6330N/Asn: &lt;last&gt;</programlisting>
6330N/A
6330N/A <para>
6330N/AThen you can define a mail attribute that uses the values of both attributes,
6330N/Aand an initials attribute that takes the first character of each.
6330N/A </para>
6330N/A
6330N/A <programlisting>mail: {givenName}.{sn}@[myDomain]
6330N/Ainitials: {givenName:1}{sn:1}</programlisting>
6330N/A
6330N/A <para>
6330N/AThe other kind of tag is delimited with <literal>&lt;</literal> and
6330N/A<literal>&gt;</literal>, as shown above in the example with
6330N/A<literal>&lt;first&gt;</literal> and <literal>&lt;last&gt;</literal>. Tag names
6330N/Aare not case sensitive. Many tags can take arguments separated by colons
6330N/A(<literal>:</literal>) from the tag names within the tag.
6330N/A </para>
6330N/A
6330N/A <para>
6330N/AUse backslashes to escape literal start tag characters
6330N/A(<literal>&lt; [ {</literal>) as shown in the following example, and to escape
6330N/Aliteral end tag characters within tags (<literal>&gt; ] }</literal>).
6330N/A </para>
6330N/A <programlisting>scimMail: \{"emails": \[\{"value": "{mail}", "primary": true\}\]\}
6330N/Axml: \&lt;id\&gt;{uid}\&lt;/id\&gt;</programlisting>
6330N/A
6330N/A <para>
6330N/AOpenDJ supports the following tags:
6330N/A </para>
6330N/A <varlistentry>
6330N/A <term>&lt;DN&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe DN tag gets replaced by the distinguished name of the current entry. An
6330N/Aoptional integer argument specifies the subcomponents of the DN to generate. For
6330N/Aexample, if the DN of the entry is
6330N/A<literal>uid=bjensen,ou=People,dc=example,dc=com</literal>
6330N/A<literal>&lt;DN:1&gt;</literal> gets replaced by
6330N/A<literal>uid=bjensen</literal>, and <literal>&lt;DN:-2&gt;</literal> gets
6330N/Areplaced by <literal>dc=example,dc=com</literal>.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;File&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe File tag gets replaced by a line from a text file you specify. The File tag
6330N/Atakes a required argument, the path to the text file, and an optional second
6330N/Aargument, either <literal>random</literal> or <literal>sequential</literal>. For
6330N/Athe file argument, either you specify an absolute path to the file such as
6330N/A<literal>&lt;file:/path/to/myDescriptions&gt;</literal>, or you specify a path
6330N/Arelative to the <filename>$INSTANCE_ROOT/config/MakeLDIF/</filename> directory
6330N/Asuch as <literal>&lt;file:streets&gt;</literal>. For the second argument, if you
6330N/Aspecify <literal>sequential</literal> then lines from the file are read in
6330N/Asequential order. Otherwise, lines from the file are read in random order.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;First&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe first name tag gets replaced by a random line from
6330N/A<filename>$INSTANCE_ROOT/config/MakeLDIF/first.names</filename>. Combinations
6330N/Aof generated first and last names are unique, with integers appended to the
6330N/Aname strings if not enough combinations are available.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;GUID&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe GUID tag gets replaced by a 128-bit, type 4 (random) universally unique
6330N/Aidentifier, such as <literal>f47ac10b-58cc-4372-a567-0e02b2c3d479</literal>.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;IfAbsent&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe IfAbsent tag takes as its first argument the name of another attribute, and
6330N/Aoptionally as its second argument a value to use. This tag causes the attribute
6330N/Ato be generated only if the named attribute is not present on the generated
6330N/Aentry. Use this tag when you have used <literal>&lt;Presence&gt;</literal> to
6330N/Adefine another attribute that is not always present on generated entries.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;IfPresent&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe IfPresent takes as its first argument the name of another attribute, and
6330N/Aoptionally as its second argument a value to use. This tag causes the attribute
6330N/Ato be generated only if the named attribute is also present on the generated
6330N/Aentry. Use this tag when you have used <literal>&lt;Presence&gt;</literal> to
6330N/Adefine another attribute that is sometimes present on generated entries.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;Last&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe last name tag gets replaced by a random line from
6330N/A<filename>$INSTANCE_ROOT/config/MakeLDIF/last.names</filename>. Combinations of
6330N/Agenerated first and last names are unique, with integers appended to the name
6330N/Astrings if not enough combinations are available.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;List&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe List tag gets replaced by one of the values from the list of arguments you
6330N/Aprovide. For example, <literal>&lt;List:bronze:silver:gold&gt;</literal> gets
6330N/Areplaced with <literal>bronze</literal>, <literal>silver</literal>, or
6330N/A<literal>gold</literal>.
6330N/A </para>
6330N/A <para>
6330N/AYou can weight arguments to ensure some arguments are selected more often than
6330N/Aothers. For example, if you want two bronze for one silver and one gold, use
6330N/A<literal>&lt;List:bronze;2:silver;1:gold;1&gt;</literal>.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;ParentDN&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe ParentDN tag gets replaced by the distinguished name of the parent entry.
6330N/AFor example, if the DN of the entry is
6330N/A<literal>uid=bjensen,ou=People,dc=example,dc=com</literal>,
6330N/A<literal>&lt;ParentDN&gt;</literal> gets replaced by
6330N/A<literal>ou=People,dc=example,dc=com</literal>.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;Presence&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe Presence tag takes a percent argument. It does not get replaced by a value
6330N/Aitself, but instead results in the attribute being generated on the percentage
6330N/Aof entries you specify in the argument. For example,
6330N/A<literal>description: &lt;Presence:50&gt;A description</literal> generates
6330N/A<literal>description: A description</literal> on half the entries.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;Random&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe Random tag lets you generate a variety of random numbers and strings. The
6330N/ARandom tag has the following subtypes, which you include as arguments, that is
6330N/A<literal>&lt;Random:<replaceable>subtype</replaceable>&gt;</literal>.
6330N/A </para>
6330N/A
6330N/A <itemizedlist>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>alpha:<replaceable>length</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>alpha:<replaceable>minlength</replaceable>:<replaceable
6330N/A>maxlength</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>numeric:<replaceable>length</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>numeric:<replaceable>minvalue</replaceable>:<replaceable
6330N/A>maxvalue</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>numeric:<replaceable>minvalue</replaceable>:<replaceable
6330N/A>maxvalue</replaceable>:<replaceable>format</replaceable></literal>, where
6330N/A<replaceable>format</replaceable> is a <literal>java.text.DecimalFormat</literal>
6330N/Apattern.
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>alphanumeric:<replaceable>length</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>alphanumeric:<replaceable>minlength</replaceable>:<replaceable
6330N/A>maxlength</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>chars:<replaceable>characters</replaceable>:<replaceable
6330N/A>length</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>chars:<replaceable>characters</replaceable>:<replaceable
6330N/A>minlength</replaceable>:<replaceable>maxlength</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>hex:<replaceable>length</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>hex:<replaceable>minlength</replaceable>:<replaceable
6330N/A>maxlength</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>base64:<replaceable>length</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>base64:<replaceable>minlength</replaceable>:<replaceable
6330N/A>maxlength</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>month</literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>month:<replaceable>maxlength</replaceable></literal>
6330N/A </para>
6330N/A </listitem>
6330N/A <listitem>
6330N/A <para>
6330N/A<literal>telephone</literal>, a telephone number starting with the country code
6330N/A<literal>+1</literal>
6330N/A </para>
6330N/A </listitem>
6330N/A </itemizedlist>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;RDN&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe RDN tag gets replaced with the RDN of the entry. Use this in the template
6330N/Aafter you have specified <literal>rdnAttr</literal> so that the RDN has already
6330N/Abeen generated when this tag is replaced.
6330N/A </para>
6330N/A
6330N/A <para>
6330N/AAn optional integer argument specifies the subcomponents of the RDN to generate.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;Sequential&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe Sequential tag gets replaced by a sequentially increasing generated integer.
6330N/AThe first optional integer argument specifies the starting number. The second
6330N/Aoptional boolean argument specifies whether to start over when generating
6330N/Aentries for a new parent entry. For example,
6330N/A<literal>&lt;Sequential&gt;:42:true</literal> starts counting from 42, and
6330N/Astarts over when the parent entry changes from <literal>o=Engineering</literal>
6330N/Ato <literal>o=Marketing</literal>.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;_DN&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe _DN tag gets replaced by the DN of the current entry with underscores in the
6330N/Aplace of commas.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A
6330N/A <varlistentry>
6330N/A <term>&lt;_ParentDN&gt;</term>
6330N/A <listitem>
6330N/A <para>
6330N/AThe _ParentDN tag gets replaced by the DN the parent entry with underscores in
6330N/Athe place of commas.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A </variablelist>
6330N/A </refsection>
6330N/A <refsection>
6330N/A <title>Examples</title>
6330N/A <informalexample>
6330N/A <para>
6330N/AThe following example generates 10 organization units, each containing 50
6330N/Aentries.
6330N/A </para>
6330N/A
6330N/A <programlisting language="ldif"><![CDATA[
6330N/Adefine suffix=dc=example,dc=com
6330N/Adefine maildomain=example.com
6330N/Adefine numusers=50
6330N/Adefine numorgs=10
6330N/A
6330N/Abranch: [suffix]
6330N/A
6330N/Abranch: ou=People,[suffix]
6330N/AsubordinateTemplate: orgunit:[numorgs]
6330N/Adescription: This is the People container
6330N/AtelephoneNumber: +33 00010002
6330N/A
6330N/Atemplate: orgunit
6330N/AsubordinateTemplate: person:[numusers]
6330N/ArdnAttr: ou
6330N/Aou: Org-<sequential:0>
6330N/AobjectClass: top
6330N/AobjectClass: organizationalUnit
6330N/Adescription: This is the {ou} organizational unit
6330N/A
6330N/Atemplate: person
6330N/ArdnAttr: uid
6330N/AobjectClass: top
6330N/AobjectClass: person
6330N/AobjectClass: organizationalPerson
6330N/AobjectClass: inetOrgPerson
6330N/AgivenName: <first>
6330N/Asn: <last>
6330N/Acn: {givenName} {sn}
6330N/Ainitials: {givenName:1}<random:chars:ABCDEFGHIJKLMNOPQRSTUVWXYZ:1>{sn:1}
6330N/AemployeeNumber: <sequential:0>
6330N/Auid: user.{employeeNumber}
6330N/Amail: {uid}@[maildomain]
6330N/AuserPassword: password
6330N/AtelephoneNumber: <random:telephone>
6330N/AhomePhone: <random:telephone>
6330N/Apager: <random:telephone>
6330N/Amobile: <random:telephone>
6330N/Astreet: <random:numeric:5> <file:streets> Street
6330N/Al: <file:cities>
6330N/Ast: <file:states>
6330N/ApostalCode: <random:numeric:5>
6330N/ApostalAddress: {cn}${street}${l}, {st} {postalCode}
6330N/Adescription: This is the description for {cn}.
6330N/A]]></programlisting>
6330N/A </informalexample>
6330N/A </refsection>
6330N/A <refsection name='files'>
6330N/A <title>Files</title>
6330N/A <variablelist>
6330N/A <varlistentry>
6331N/A <term><varname>$INSTANCE_ROOT</varname><filename>/config/MakeLDIF/example.template</filename></term>
6330N/A <listitem>
6330N/A <para>
6330N/AAn example for an ldif template.
6330N/A </para>
6330N/A </listitem>
6330N/A </varlistentry>
6330N/A </variablelist>
6330N/A </refsection>
6330N/A
6330N/A <refsection>
6330N/A <title>See Also</title>
6330N/A <para>
6330N/A<citerefentry>
6330N/A <refentrytitle>make-ldif</refentrytitle>
6330N/A <xi:include href="common.xml" xpointer='xpointer(//manvolnum[@name="v1m"])'/>
6330N/A</citerefentry>,
6330N/A<citerefentry>
6330N/A <refentrytitle>opendj</refentrytitle>
6330N/A <xi:include href="common.xml" xpointer='xpointer(//manvolnum[@name="v5"])'/>
6330N/A</citerefentry>
6330N/A </para>
6330N/A </refsection>
6330N/A
6330N/A</refentry>