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