tools.xml revision 5976
342N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1472N/A<!DOCTYPE stax SYSTEM "/stax.dtd">
342N/A<!--
342N/A ! CDDL HEADER START
342N/A !
342N/A ! The contents of this file are subject to the terms of the
342N/A ! Common Development and Distribution License, Version 1.0 only
342N/A ! (the "License"). You may not use this file except in compliance
342N/A ! with the License.
342N/A !
342N/A ! You can obtain a copy of the license at
342N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
342N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
342N/A ! See the License for the specific language governing permissions
342N/A ! and limitations under the License.
342N/A !
342N/A ! When distributing Covered Code, include this CDDL HEADER in each
342N/A ! file and include the License file at
1472N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1472N/A ! add the following below this CDDL HEADER, with the fields enclosed
1472N/A ! by brackets "[]" replaced with your own identifying information:
342N/A ! Portions Copyright [yyyy] [name of copyright owner]
342N/A !
342N/A ! CDDL HEADER END
1879N/A !
1879N/A ! Copyright 2007-2010 Sun Microsystems, Inc.
1879N/A ! -->
1879N/A<stax>
1879N/A <!-- This function uses make ldif to generate LDIF data files -->
1879N/A <function name="MakeLdifWithScript">
1879N/A <function-prolog>
1879N/A This function uses make ldif to generate LDIF data files
1879N/A </function-prolog>
1879N/A
1879N/A <function-map-args>
342N/A <function-arg-def name="location"
342N/A type="optional"
342N/A default="STAF_REMOTE_HOSTNAME">
342N/A <function-arg-description>
342N/A Location of target host
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="hostname"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="dsPath"
342N/A type="optional"
342N/A default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
342N/A <function-arg-description>
342N/A Pathname to installation root
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="version" type="optional">
342N/A <function-arg-description>
342N/A Display Directory Server version information
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="string"/>
342N/A </function-arg-def>
1629N/A
1311N/A <function-arg-def name="templateFile" type="optional">
342N/A <function-arg-description>
807N/A Path to the template file
807N/A </function-arg-description>
807N/A <function-arg-property name="type" value="filename"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="ldifFile" type="optional">
342N/A <function-arg-description>
342N/A Path to the LDIF file
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filename"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="randomSeed" type="optional">
342N/A <function-arg-description>
342N/A The seed to use to initialize the random number generator
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="integer"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="Help" type="optional">
342N/A <function-arg-description>
342N/A Help option
1394N/A </function-arg-description>
1394N/A <function-arg-property name="help" value="option"/>
1394N/A </function-arg-def>
1394N/A
1394N/A <function-arg-def name="expectedRC" type="optional" default="0">
342N/A <function-arg-description>
1394N/A Expected return code value. Default value is 0.
342N/A Wildcard 'noCheck' to not check the RC
342N/A </function-arg-description>
342N/A </function-arg-def>
342N/A
1394N/A <function-arg-def name="knownIssue" type="optional" default="None">
342N/A <function-arg-description>
342N/A Known issue. Corresponds to an issue number.
342N/A </function-arg-description>
342N/A </function-arg-def>
1394N/A
1394N/A </function-map-args>
1394N/A <sequence>
1394N/A <!-- Build the Command -->
1394N/A <script>
1394N/A foldersToCreate = []
1394N/A STAFCmdParamsList=[]
342N/A STAFCmdParams=''
342N/A
342N/A if dsPath:
342N/A dsBinPath='%s/%s' % (dsPath,fileFolder)
342N/A STAFCmd='%s/make-ldif%s' % (dsBinPath,fileExt)
342N/A
342N/A if version:
342N/A STAFCmdParamsList.append('-V')
342N/A
342N/A if templateFile:
342N/A STAFCmdParamsList.append('-t %s' % templateFile)
342N/A
1394N/A if ldifFile:
1394N/A foldersToCreate.append(os.path.dirname(ldifFile))
1394N/A STAFCmdParamsList.append('-o %s' % ldifFile)
1394N/A
1394N/A if randomSeed:
1394N/A STAFCmdParamsList.append('-s "%s"' % randomSeed)
1394N/A
1394N/A if Help:
342N/A STAFCmdParamsList.append('-H')
342N/A
545N/A STAFCmdParams=' '.join(STAFCmdParamsList)
342N/A </script>
342N/A
342N/A <call function="'createMultiFolders'">
1394N/A { 'location' : location,
342N/A 'folderslist' : foldersToCreate
342N/A }
342N/A </call>
342N/A
342N/A <message>
342N/A '%s %s' % (STAFCmd, STAFCmdParams)
342N/A </message>
342N/A
342N/A <call function="'runCommand'">
342N/A { 'name' : 'Make Ldif Script',
342N/A 'location' : location,
342N/A 'command' : STAFCmd,
342N/A 'arguments' : STAFCmdParams,
342N/A 'expectedRC': expectedRC,
342N/A 'knownIssue': knownIssue
342N/A }
342N/A </call>
342N/A <return>STAXResult</return>
342N/A </sequence>
342N/A </function>
342N/A
342N/A
342N/A <!-- This function uses make ldif to generate LDIF data files -->
342N/A <function name="MakeAMakeLdifTemplate">
342N/A <function-prolog>
796N/A This function makes a make-ldif template file
342N/A </function-prolog>
342N/A
342N/A <function-map-args>
342N/A <function-arg-def name="numEntries" type="required">
342N/A <function-arg-description>
342N/A Number of entries
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="string"/>
942N/A </function-arg-def>
942N/A <function-arg-def name="startFrom"
342N/A type="optional"
342N/A default="0">
342N/A <function-arg-description>
342N/A Start entries number
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="string"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="suffix"
342N/A type="optional"
342N/A default="DIRECTORY_INSTANCE_SFX">
342N/A <function-arg-description>
342N/A Suffix
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="string"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="templateFile" type="required">
342N/A <function-arg-description>
342N/A Template file name
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filename"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="templateLocation"
342N/A type="optional"
342N/A default="STAXServiceMachine">
342N/A <function-arg-description>
342N/A Template file location
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filename"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="additionalAttributes"
342N/A type="optional"
342N/A default="False">
342N/A <function-arg-description>
342N/A Add (or not) additional attributes
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="integer"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="extraLine" type="optional">
342N/A <function-arg-description>
342N/A Extra line to add to the mkae-ldif template
342N/A </function-arg-description>
636N/A <function-arg-property name="type" value="string"/>
342N/A </function-arg-def>
342N/A </function-map-args>
342N/A <sequence>
342N/A <!-- Build the import task configuration object -->
545N/A <script>
636N/A ldifLines=[]
636N/A ldifLines.append('define suffix=%s' % suffix)
636N/A ldifLines.append('define maildomain=example.com')
636N/A ldifLines.append('define numusers=%s' % numEntries )
636N/A ldifLines.append('')
636N/A
636N/A ldifLines.append('branch: [suffix]')
636N/A ldifLines.append('')
342N/A
342N/A ldifLines.append('branch: ou=People,[suffix]')
342N/A ldifLines.append('subordinateTemplate: person:[numusers]')
342N/A ldifLines.append('')
342N/A
1391N/A ldifLines.append('template: person')
1391N/A ldifLines.append('rdnAttr: uid')
1391N/A ldifLines.append('objectClass: top')
342N/A ldifLines.append('objectClass: person')
342N/A ldifLines.append('objectClass: organizationalPerson')
342N/A ldifLines.append('objectClass: inetOrgPerson')
342N/A ldifLines.append('givenName: &lt;first&gt;')
342N/A ldifLines.append('sn: &lt;last&gt;')
342N/A ldifLines.append('employeeNumber: &lt;sequential:%s&gt;' % startFrom)
342N/A ldifLines.append('cn: {givenName} {sn} {employeeNumber}')
342N/A ldifLines.append('uid: user.{employeeNumber}')
342N/A ldifLines.append('mail: {uid}@[maildomain]')
342N/A ldifLines.append('telephoneNumber: &lt;random:telephone&gt;')
342N/A ldifLines.append('description: This is the description for user.{employeeNumber}.')
342N/A
342N/A if additionalAttributes == True:
342N/A ldifLines.append('initials: {givenName:1}&lt;random:chars:ABCDEFGHIJKLMNOPQRSTUVWXYZ:1>{sn:1}')
342N/A ldifLines.append('homePhone: &lt;random:telephone>')
342N/A ldifLines.append('mobile: &lt;random:telephone>')
342N/A ldifLines.append('street: &lt;random:numeric:5> &lt;file:streets> Street')
342N/A ldifLines.append('l: &lt;file:cities>')
526N/A ldifLines.append('st: &lt;file:states>')
526N/A ldifLines.append('postalCode: &lt;random:numeric:5>')
526N/A ldifLines.append('postalAddress: {cn}${street}${l}, {st} {postalCode}')
526N/A ldifLines.append('jpegPhoto:: &lt;random:base64:10000&gt;')
526N/A
526N/A if extraLine:
526N/A ldifLines.append('%s' % extraLine)
526N/A </script>
526N/A
526N/A <!-- Write out the make-ldif template file -->
526N/A <script>
526N/A RC=0
526N/A </script>
526N/A <script>
526N/A tmpTemplateFile = '%s/tempLdifTemplateFile' % local.temp
526N/A outfile = open(tmpTemplateFile,"w")
526N/A
526N/A for line in ldifLines:
526N/A outfile.write("%s\n" % line)
526N/A
526N/A outfile.close()
353N/A </script>
342N/A <script>
342N/A STAXCode=RC
342N/A STAXReason=STAXResult
342N/A </script>
342N/A <if expr="STAXCode != 0">
342N/A <sequence>
342N/A <message level="'error'">
1576N/A 'creation of a make-ldif template failed (Code=%s,Reason=%s).' % (STAXCode,STAXReason)
1576N/A </message>
1576N/A </sequence>
1576N/A </if>
1576N/A <call function="'checktestRC'">
1576N/A { 'returncode' : STAXCode ,
1576N/A 'result' : STAXReason }
1576N/A </call>
1576N/A
1576N/A <call function="'copyFile'">
1576N/A { 'location' : STAXServiceMachine,
1576N/A 'srcfile' : tmpTemplateFile,
342N/A 'destfile' : templateFile,
342N/A 'remotehost' : templateLocation }
342N/A </call>
342N/A
342N/A <call function="'checktestRC'">
545N/A {
545N/A 'returncode' : RC ,
342N/A 'result' : STAXResult
342N/A }
342N/A </call>
342N/A
342N/A <return>[RC, STAXResult]</return>
342N/A
342N/A </sequence>
342N/A </function>
342N/A
342N/A <!-- This function compares two LDIF files using the ldif-diff script -->
342N/A <function name="LdifDiffWithScript">
342N/A <function-prolog>
342N/A This function compares two LDIF files and reports the differences in LDIF format
342N/A </function-prolog>
342N/A <function-map-args>
342N/A <function-arg-def name="location"
342N/A type="optional"
342N/A default="STAF_REMOTE_HOSTNAME">
342N/A <function-arg-description>
342N/A Location of target host
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="hostname"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="dsPath"
342N/A type="optional"
342N/A default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
342N/A <function-arg-description>
342N/A Pathname to installation root
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="version" type="optional">
342N/A <function-arg-description>
342N/A Display Directory Server version information
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="string"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="sourceLdif" type="required">
342N/A <function-arg-description>
342N/A LDIF file to use as the source data
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="targetLdif" type="required">
342N/A <function-arg-description>
342N/A LDIF file to use as the target data
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="outputLdif" type="required">
342N/A <function-arg-description>
342N/A File to which the diffs should be written
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="ignoreAttrsFile"
342N/A type="optional"
342N/A default="None">
342N/A <function-arg-description>
342N/A File containing a list of attributes to ignore when computing the
342N/A difference
342N/A </function-arg-description>
545N/A <function-arg-property name="type" value="filepath"/>
545N/A </function-arg-def>
545N/A
545N/A <function-arg-def name="overwriteExisting" type="optional" default="True">
1576N/A <function-arg-description>
1576N/A Overwrite existing output file rather than append to it
1576N/A </function-arg-description>
1576N/A <function-arg-property name="type" value="option"/>
1576N/A </function-arg-def>
1576N/A
1576N/A <function-arg-def name="singleValueChanges" type="optional">
1576N/A <function-arg-description>
342N/A Write each attribute-level change as a separate modification
342N/A per attribute value rather than one modification per entry
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="option"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="Help" type="optional">
342N/A <function-arg-description>
342N/A Help option
342N/A </function-arg-description>
342N/A <function-arg-property name="help" value="option"/>
342N/A </function-arg-def>
342N/A
342N/A </function-map-args>
342N/A <sequence>
342N/A <!-- Build the Command -->
342N/A <script>
342N/A foldersToCreate = []
342N/A STAFCmdParamsList=[]
342N/A STAFCmdParams=''
342N/A
342N/A if dsPath:
342N/A dsBinPath='%s/%s' % (dsPath,fileFolder)
342N/A STAFCmd='%s/ldif-diff%s' % (dsBinPath,fileExt)
342N/A
342N/A if version:
342N/A STAFCmdParamsList.append('-V')
342N/A
342N/A if sourceLdif:
342N/A STAFCmdParamsList.append('-s %s' % sourceLdif)
342N/A
526N/A if targetLdif:
526N/A STAFCmdParamsList.append('-t %s' % targetLdif)
526N/A
526N/A if outputLdif:
526N/A foldersToCreate.append(os.path.dirname(outputLdif))
526N/A STAFCmdParamsList.append('-o %s' % outputLdif)
1394N/A
526N/A if ignoreAttrsFile:
526N/A STAFCmdParamsList.append('-a %s' % ignoreAttrsFile)
526N/A
526N/A if overwriteExisting:
526N/A STAFCmdParamsList.append('-O')
526N/A
526N/A if singleValueChanges:
526N/A STAFCmdParamsList.append('-S')
526N/A
526N/A if Help:
526N/A STAFCmdParamsList.append('-H')
526N/A
526N/A STAFCmdParams=' '.join(STAFCmdParamsList)
526N/A </script>
526N/A
526N/A <call function="'createMultiFolders'">
526N/A { 'location' : location,
526N/A 'folderslist' : foldersToCreate
526N/A }
526N/A </call>
526N/A
526N/A <message>
526N/A '%s %s' % (STAFCmd, STAFCmdParams)
526N/A </message>
1394N/A
1394N/A <process name="'LDIF Diff Script'">
1394N/A <location>location</location>
1394N/A <command>STAFCmd</command>
1394N/A <parms>STAFCmdParams</parms>
1394N/A <workdir>dsBinPath</workdir>
1576N/A <envs>
1576N/A ['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
1576N/A </envs>
1576N/A <console use="'same'"/>
1576N/A <stderr mode="'stdout'"/>
1576N/A <returnstdout/>
1576N/A </process>
1576N/A
1576N/A <script>
1576N/A STAXCode=RC
1576N/A </script>
1576N/A <if expr="STAXCode == 0">
1576N/A <sequence>
1576N/A <!-- Check the size of the diff file, and avoid reading its
1576N/A content with getFile if the file is too big to prevent
1576N/A the staf process from running out of memory -->
1576N/A <call function="'GetEntry'">
1576N/A {
1576N/A 'location' : location,
1576N/A 'entry' : outputLdif,
342N/A 'attribute' : 'SIZE'
342N/A }
342N/A </call>
342N/A <script>
342N/A # GetEntry returns: STAXResult = [cmdRC, cmdResult]
342N/A if RC == 0:
342N/A diffsFileSize = int(STAXResult[1]['lowerSize'])
1629N/A msg = 'File: %s Size (bytes): %s' % (outputLdif, diffsFileSize)
1629N/A else:
1629N/A diffsFileSize = MAX_READABLE_SIZE
1629N/A msg = 'Could not retrieve the size of file %s' % outputLdif
1629N/A </script>
1629N/A <message log="1"> 'LdifDiffWithScript: %s' % msg </message>
342N/A <if expr="diffsFileSize &lt; MAX_READABLE_SIZE">
342N/A <sequence>
342N/A <call function="'getFile'">
342N/A { 'location' : location,
342N/A 'filename' : outputLdif
677N/A }
1576N/A </call>
342N/A <script>
342N/A # getFile returns: STAXResult = [cmdRC, cmdResult]
342N/A diffsFileContent = STAXResult[1]
342N/A
342N/A if diffsFileContent.startswith("# No differences were detected between the source and target LDIF files") :
342N/A diffRC = 0
342N/A else:
342N/A diffRC = 1
342N/A </script>
342N/A </sequence>
342N/A <else>
342N/A <script>
342N/A # diffs file to big to be read
342N/A diffsFileContent = 'File too big to be read.'
616N/A
616N/A # if the diff file is too big, it means that there ARE
616N/A # actually some diffs, so we may deduce diffRC = 1
616N/A diffRC = 1
342N/A </script>
342N/A </else>
342N/A </if>
342N/A </sequence>
342N/A <else>
342N/A <sequence>
342N/A <message log="1" level="'Error'">
342N/A 'LdifDiffWithScript: command run FAILED.'
342N/A </message>
1625N/A <return> -1 </return>
1625N/A </sequence>
1625N/A </else>
1625N/A </if>
1625N/A
1625N/A <if expr="diffRC == 0">
342N/A <message log="1">
342N/A 'NO DIFFERENCES were detected between the source and the target \
342N/A LDIF files.'
342N/A </message>
1394N/A <else>
1394N/A <message log="1" level="'Error'">
1394N/A 'Source and target LDIF files are DIFFERENT: \n\n%s' % \
1394N/A diffsFileContent
342N/A </message>
342N/A </else>
342N/A </if>
342N/A
342N/A <return> diffRC </return>
342N/A </sequence>
342N/A </function>
342N/A
342N/A <!-- This function modifies an LDIF file using ldifmodify script -->
342N/A <function name="LdifModifyWithScript">
342N/A <function-prolog>
342N/A This function modifies an LDIF file with the changes contained in another LDIF file
342N/A </function-prolog>
342N/A <function-map-args>
342N/A <function-arg-def name="location"
342N/A type="optional"
342N/A default="STAF_REMOTE_HOSTNAME">
342N/A <function-arg-description>
342N/A Location of target host
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="hostname"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="dsPath"
342N/A type="optional"
342N/A default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
342N/A <function-arg-description>
342N/A Pathname to installation root
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="version" type="optional">
342N/A <function-arg-description>
342N/A Display Directory Server version information
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="string"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="sourceLdif" type="required">
342N/A <function-arg-description>
342N/A LDIF file containing the data to be updated
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="targetLdif" type="required">
342N/A <function-arg-description>
342N/A LDIF file that will contain the updated data
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="changesLdif" type="required">
342N/A <function-arg-description>
342N/A LDIF file containing the changes to apply
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="Help" type="optional">
342N/A <function-arg-description>
342N/A Help option
342N/A </function-arg-description>
342N/A <function-arg-property name="help" value="option"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="expectedRC" type="optional" default="0">
342N/A <function-arg-description>
342N/A Expected return code value. Default value is 0.
342N/A Wildcard 'noCheck' to not check the RC
342N/A </function-arg-description>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="knownIssue" type="optional" default="None">
342N/A <function-arg-description>
342N/A Known issue. Corresponds to an issue number.
342N/A </function-arg-description>
342N/A </function-arg-def>
342N/A
342N/A </function-map-args>
342N/A <sequence>
342N/A <!-- Build the Command -->
342N/A <script>
342N/A foldersToCreate = []
342N/A STAFCmdParamsList=[]
342N/A STAFCmdParams=''
342N/A
342N/A if dsPath:
342N/A dsBinPath='%s/%s' % (dsPath,fileFolder)
342N/A STAFCmd='%s/ldifmodify%s' % (dsBinPath,fileExt)
342N/A
342N/A if version:
342N/A STAFCmdParamsList.append('-V')
342N/A
342N/A if sourceLdif:
342N/A STAFCmdParamsList.append('-s %s' % sourceLdif)
342N/A
342N/A if targetLdif:
342N/A foldersToCreate.append(os.path.dirname(targetLdif))
342N/A STAFCmdParamsList.append('-t %s' % targetLdif)
342N/A
342N/A if changesLdif:
342N/A STAFCmdParamsList.append('-m %s' % changesLdif)
342N/A
342N/A if Help:
342N/A STAFCmdParamsList.append('-H')
342N/A
636N/A STAFCmdParams=' '.join(STAFCmdParamsList)
636N/A </script>
636N/A
636N/A <call function="'createMultiFolders'">
636N/A { 'location' : location,
636N/A 'folderslist' : foldersToCreate
636N/A }
636N/A </call>
636N/A
636N/A <message>
636N/A '%s %s' % (STAFCmd, STAFCmdParams)
636N/A </message>
636N/A
636N/A <call function="'runCommand'">
636N/A { 'name' : 'LDIF Modify Script',
342N/A 'location' : location,
342N/A 'command' : STAFCmd,
342N/A 'arguments' : STAFCmdParams,
342N/A 'expectedRC': expectedRC,
342N/A 'knownIssue': knownIssue
342N/A }
342N/A </call>
342N/A <return>STAXResult</return>
342N/A </sequence>
342N/A </function>
342N/A
342N/A
342N/A <function name="verifyTrees">
342N/A <function-prolog>
342N/A This function verifies that the trees in a group of ldap servers are
342N/A synchronized.
342N/A </function-prolog>
342N/A <function-list-args>
1753N/A <function-arg-def name="location"
1753N/A type="optional"
1753N/A default="STAF_REMOTE_HOSTNAME">
342N/A <function-arg-description>
342N/A Location of target host
1629N/A </function-arg-description>
342N/A <function-arg-property name="type" value="hostname"/>
616N/A </function-arg-def>
616N/A <function-arg-def name="dsPath"
616N/A type="optional"
1625N/A default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
1625N/A <function-arg-description>
1625N/A Pathname to installation root
1625N/A </function-arg-description>
1625N/A <function-arg-property name="type" value="filepath"/>
1625N/A </function-arg-def>
1625N/A
342N/A <function-arg-def name="referenceServer" type="required">
342N/A <function-arg-description>
342N/A Server that should be taken as reference.
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="Server"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="serverList" type="required">
342N/A <function-arg-description>
342N/A List of the servers to verify against the referenceServer.
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="Server-list"/>
342N/A </function-arg-def>
342N/A
1753N/A <function-arg-def name="treeSuffix" type="required">
342N/A <function-arg-description>
342N/A Suffix of the tree to verify.
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="DN"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="knownIssue" type="optional" default="None">
342N/A <function-arg-description>
342N/A Known issue. Corresponds to an issue number.
342N/A </function-arg-description>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="ignoreAttrsFile"
342N/A type="optional"
342N/A default="None">
342N/A <function-arg-description>
342N/A File containing a list of attributes to ignore when computing the
342N/A difference
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A </function-list-args>
342N/A <sequence>
342N/A <script>
342N/A myRC = 0
342N/A myKnownIssue = knownIssue
342N/A failedServers = []
342N/A failingServerList = ''
342N/A referenceServerPath = '%s/%s' % (referenceServer.getDir(), OPENDSNAME)
342N/A referenceTree = 'referenceTree.ldif'
342N/A sampleTree = 'sampleTree.ldif'
353N/A treeDiffs = 'treeDiffs.ldif'
353N/A </script>
353N/A
353N/A <!-- Verify the synchronization of the trees among the servers in
353N/A the topology -->
353N/A <call function="'getReplicationStatus'">
342N/A { 'location' : location,
342N/A 'dsPath' : dsPath,
1625N/A 'dsInstanceHost' : referenceServer.getHostname(),
1625N/A 'dsInstanceAdminPort' : referenceServer.getAdminPort(),
1625N/A 'replicationDnList' : [treeSuffix],
342N/A 'noOfLoops' : 10,
342N/A 'noOfMilliSeconds' : 6000
342N/A }
342N/A </call>
342N/A
342N/A <message>
342N/A 'Verify tree %s taking %s as reference.' \
342N/A % (treeSuffix, referenceServerPath)
342N/A </message>
1092N/A <!-- Retrieve the tree from the reference server -->
342N/A <call function="'exportLdifWithScript'">
342N/A { 'location' : location,
846N/A 'dsPath' : dsPath,
846N/A 'dsInstanceHost' : referenceServer.getHostname(),
846N/A 'dsInstanceAdminPort' : referenceServer.getAdminPort(),
342N/A 'dsInstanceDn' : referenceServer.getRootDn(),
342N/A 'dsInstancePswd' : referenceServer.getRootPwd(),
342N/A 'ldifFile' : '%s/../%s' % (dsPath, referenceTree),
342N/A 'includeBranches' : [treeSuffix]
342N/A }
342N/A </call>
342N/A
342N/A <if expr="RC != 0">
342N/A <!-- If the reference tree could not be retrieved, return an error -->
342N/A <return> [1, None] </return>
342N/A </if>
342N/A <iterate var="server" in="serverList">
342N/A <sequence>
342N/A <!-- Retrieve the same tree for every other server in the list -->
342N/A <if expr="server.getHostname() == location">
342N/A <script>
342N/A filePath = dsPath
342N/A isSameLocation = True
342N/A </script>
342N/A <else>
342N/A <script>
342N/A filePath = '%s/%s' % (server.getDir(), OPENDSNAME)
342N/A isSameLocation = False
342N/A </script>
342N/A </else>
342N/A </if>
342N/A <call function="'exportLdifWithScript'">
342N/A { 'location' : location,
342N/A 'dsPath' : dsPath,
342N/A 'dsInstanceHost' : server.getHostname(),
342N/A 'dsInstanceAdminPort' : server.getAdminPort(),
342N/A 'dsInstanceDn' : server.getRootDn(),
342N/A 'dsInstancePswd' : server.getRootPwd(),
342N/A 'ldifFile' : '%s/../%s' % (filePath, sampleTree),
342N/A 'includeBranches' : [treeSuffix]
342N/A }
342N/A </call>
342N/A
342N/A <if expr="RC == 0">
342N/A <sequence>
342N/A
342N/A <if expr="not isSameLocation">
342N/A <!-- Copy sample tree file to reference server -->
342N/A <call function="'copyFile'">
342N/A { 'location' : server.getHostname(),
342N/A 'remotehost' : location,
342N/A 'srcfile' : '%s/../%s' % (filePath, sampleTree),
342N/A 'destfile' : '%s/../%s' % (dsPath, sampleTree)
342N/A }
342N/A </call>
342N/A </if>
342N/A
342N/A <!-- Compare this tree to the reference one -->
342N/A <call function="'LdifDiffWithScript'">
342N/A { 'location' : location,
342N/A 'dsPath' : dsPath,
342N/A 'sourceLdif' : '%s/../%s' % (dsPath, sampleTree),
342N/A 'targetLdif' : '%s/../%s' % (dsPath, referenceTree),
342N/A 'outputLdif' : '%s/../%s' % (dsPath, treeDiffs),
342N/A 'ignoreAttrsFile' : ignoreAttrsFile
342N/A }
342N/A </call>
342N/A <if expr="STAXResult != 0">
342N/A <sequence>
342N/A <script>
342N/A failedServers.append('%s:%s' % \
342N/A (server.getHostname(), server.getPort()))
342N/A </script>
342N/A <message log="1" level="'Error'">
342N/A 'Tree is DIFFERENT for %s:%s compared to %s:%s' % \
342N/A (server.getHostname(), server.getPort(),
342N/A referenceServer.getHostname(), referenceServer.getPort())
342N/A </message>
342N/A </sequence>
342N/A </if>
342N/A </sequence>
342N/A <else>
342N/A <script>
342N/A failedServers.append('%s:%s' % \
342N/A (server.getHostname(), server.getPort()))
342N/A </script>
342N/A </else>
342N/A </if>
342N/A </sequence>
342N/A </iterate>
342N/A <if expr="len(failedServers) > 0">
342N/A <!-- If at least one server failed to successfully compare to the
342N/A ! reference tree, return an error, along with the list of the
342N/A ! servers that failed to do so -->
342N/A <script>
342N/A myRC = 1
342N/A comma = ','
342N/A failingServerList = \
342N/A 'List of non-synchronized servers (tree verify FAILED): %s ' \
342N/A % comma.join(failedServers)
342N/A </script>
342N/A <else>
342N/A <message>
342N/A 'All servers synchronized (tree verify SUCCEEDED).'
342N/A </message>
342N/A </else>
342N/A </if>
342N/A <call function="'checktestRC'">
342N/A { 'returncode' : myRC,
342N/A 'result' : failingServerList,
342N/A 'expected' : 0,
342N/A 'issue' : myKnownIssue
342N/A }
342N/A </call>
342N/A <return>[myRC, failedServers]</return>
342N/A </sequence>
342N/A </function>
342N/A
342N/A
342N/A <function name="verifySchemas">
342N/A <function-prolog>
342N/A This function verifies that a schema file is synchronized all over a group of servers.
342N/A </function-prolog>
342N/A <function-list-args>
342N/A <function-arg-def name="location"
342N/A type="optional"
342N/A default="STAF_REMOTE_HOSTNAME">
342N/A <function-arg-description>
342N/A Location of target host
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="hostname"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="dsPath"
342N/A type="optional"
342N/A default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
342N/A <function-arg-description>
342N/A Pathname to installation root
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="referenceServer" type="required">
342N/A <function-arg-description>
342N/A Server that should be taken as reference.
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="Server"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="serverList" type="required">
342N/A <function-arg-description>
342N/A List of the servers to verify against the referenceServer.
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="Server-list"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="schemaFile" type="required">
342N/A <function-arg-description>
342N/A Schema file to verify.
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filename"/>
941N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="knownIssue" type="optional" default="None">
342N/A <function-arg-description>
342N/A Known issue. Corresponds to an issue number.
342N/A </function-arg-description>
342N/A </function-arg-def>
342N/A
342N/A </function-list-args>
342N/A <sequence>
342N/A <script>
342N/A myRC = 0
342N/A myKnownIssue = knownIssue
678N/A failedServers = []
678N/A failingServerList = ''
678N/A referenceServerPath = '%s/%s' % (referenceServer.getDir(), OPENDSNAME)
678N/A referenceSchema = '%s/config/schema/%s' % (referenceServerPath, schemaFile)
342N/A schemaDiffs = 'schemaDiffs.ldif'
342N/A </script>
678N/A
678N/A <message>
678N/A 'Verify schema file %s taking %s as reference.' % (schemaFile, referenceServerPath)
678N/A </message>
342N/A
342N/A <iterate var="server" in="serverList">
678N/A <sequence>
678N/A <!-- Copy reference schema file to other server -->
678N/A <call function="'copyFile'">
678N/A { 'location' : referenceServer.getHostname(),
678N/A 'remotehost' : server.getHostname(),
678N/A 'srcfile' : referenceSchema,
678N/A 'destfile' : '%s/reference_%s' % (server.getDir(),schemaFile)
342N/A }
342N/A </call>
342N/A <script>
342N/A serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
342N/A </script>
342N/A
342N/A <!-- Compare this schema to the reference one -->
342N/A <call function="'LdifDiffWithScript'">
342N/A { 'location' : location,
342N/A 'dsPath' : dsPath,
342N/A 'sourceLdif' : '%s/config/schema/%s' % (serverPath, schemaFile),
342N/A 'targetLdif' : '%s/reference_%s' % (server.getDir(), schemaFile),
342N/A 'outputLdif' : '%s/%s' % (server.getDir(), schemaDiffs)
342N/A }
342N/A </call>
342N/A <script>
342N/A if STAXResult != 0 :
342N/A failedServers.append('%s:%s' % (server.getHostname(), server.getPort()))
342N/A </script>
342N/A </sequence>
342N/A </iterate>
342N/A <if expr="len(failedServers) > 0">
342N/A <!-- If at least one server failed to successfully compare to the reference tree,
342N/A ! return an error, along with the list of the servers that failed to do so -->
342N/A <script>
342N/A myRC = 1
342N/A comma = ','
342N/A failingServerList = 'List of non-synchronized servers (schema verify FAILED): %s ' % comma.join(failedServers)
342N/A </script>
342N/A <else>
342N/A <message>
342N/A 'All servers synchronized (schema verify SUCCEEDED).'
342N/A </message>
342N/A </else>
342N/A </if>
342N/A <call function="'checktestRC'">
342N/A { 'returncode' : myRC,
342N/A 'result' : failingServerList ,
342N/A 'expected' : 0,
342N/A 'issue' : myKnownIssue
390N/A }
390N/A </call>
390N/A <return>[myRC, failedServers]</return>
355N/A </sequence>
355N/A </function>
355N/A
355N/A
342N/A <function name="deleteTrees">
342N/A <function-prolog>
342N/A This function deletes a (sub)tree from a list of servers.
342N/A </function-prolog>
342N/A <function-list-args>
342N/A <function-arg-def name="serverList" type="required">
342N/A <function-arg-description>
342N/A List of the servers (instances of "Server" class) where the tree will be deleted.
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="Server-list"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="treeSuffix" type="required">
342N/A <function-arg-description>
342N/A Suffix of the tree to delete.
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="DN"/>
342N/A </function-arg-def>
342N/A
342N/A <function-arg-def name="startDS" type="optional" default="True">
342N/A <function-arg-description>
342N/A Need to start the Directory Servers before deleting.
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="boolean"/>
342N/A </function-arg-def>
342N/A </function-list-args>
342N/A <sequence>
342N/A <if expr="startDS">
342N/A <!-- Start the servers in the list -->
342N/A <call function="'startServers'">
342N/A [serverList]
342N/A </call>
342N/A </if>
342N/A
342N/A <!-- Delete the tree in every server in the list -->
342N/A <paralleliterate var="server" in="serverList">
342N/A <sequence>
342N/A <message>
342N/A 'Delete suffix %s on server running on host %s on port %s' % (treeSuffix, server.getHostname(), server.getPort())
342N/A </message>
342N/A
342N/A <!-- Delete suffix and subtree -->
342N/A <call function="'ldapDeleteWithScript'">
342N/A { 'location' : server.getHostname(),
342N/A 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
342N/A 'dsInstanceHost' : server.getHostname(),
342N/A 'dsInstancePort' : server.getPort(),
342N/A 'dsInstanceDn' : server.getRootDn(),
342N/A 'dsInstancePswd' : server.getRootPwd(),
342N/A 'dsDn' : [treeSuffix],
342N/A 'dsDeleteSubtree' : True
342N/A }
342N/A </call>
342N/A </sequence>
342N/A </paralleliterate>
1638N/A
342N/A <if expr="startDS">
342N/A <!-- Stop the servers in the list -->
342N/A <call function="'stopServers'">
1027N/A [serverList]
1027N/A </call>
1027N/A </if>
1027N/A </sequence>
1027N/A </function>
1027N/A
1027N/A
1027N/A <function name="startServers">
1027N/A <function-prolog>
1027N/A This function starts a list of servers.
1027N/A </function-prolog>
342N/A <function-list-args>
1194N/A <function-arg-def name="serverList" type="required">
1194N/A <function-arg-description>
1194N/A List of the servers (instances of "Server" class) to be started.
1194N/A </function-arg-description>
1194N/A <function-arg-property name="type" value="Server-list"/>
1194N/A </function-arg-def>
1027N/A </function-list-args>
1027N/A
1166N/A <sequence>
1166N/A
1166N/A <!-- Check if using coverage in which case we'll avoid doing parallele iterate -->
1166N/A <!-- Check if 'emma.jar' exists -->
1027N/A <call function="'GetEntry'">
1027N/A {
1027N/A 'location' : STAF_REMOTE_HOSTNAME ,
1027N/A 'entry' : '%s/%s/lib/emma.jar' % (serverList[0].getDir(),OPENDSNAME) ,
1027N/A 'attribute' : 'TYPE'
1027N/A }
1027N/A </call>
1027N/A <if expr="RC != 48">
1027N/A <!-- 'emma.jar' exists -->
1027N/A <script>coverage = True</script>
1027N/A <else>
1027N/A <script>coverage = False</script>
1027N/A </else>
1027N/A </if>
1027N/A <message>'tools.xml - coverage=%s' % coverage</message>
1194N/A
1194N/A <!-- Start the servers in the list -->
1027N/A <if expr="coverage == True">
1027N/A <sequence>
1027N/A <message>'starting servers in sequence using "iterate"'</message>
342N/A <iterate var="server" in="serverList">
342N/A <sequence>
342N/A <message>
342N/A 'Start DS on host %s to run on port %s' % (server.getHostname(),server.getPort())
342N/A </message>
342N/A
342N/A <!--- Start DS -->
342N/A <call function="'StartDsWithScript'">
342N/A { 'location' : server.getHostname(),
342N/A 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME)
342N/A }
342N/A </call>
342N/A
342N/A <!--- Check that DS started -->
342N/A <call function="'isAlive'">
342N/A { 'location' : server.getHostname(),
342N/A 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
342N/A 'dsInstanceHost' : server.getHostname(),
342N/A 'dsInstancePort' : server.getPort(),
1313N/A 'dsInstanceDn' : server.getRootDn(),
1313N/A 'dsInstancePswd' : server.getRootPwd(),
1313N/A 'noOfLoops' : 10 ,
1313N/A 'noOfMilliSeconds' : 2000
1313N/A }
1313N/A </call>
342N/A </sequence>
342N/A </iterate>
342N/A </sequence>
342N/A <else>
342N/A <sequence>
342N/A <message>'starting servers in parallel using "paralleliterate"'</message>
342N/A <paralleliterate var="server" in="serverList">
342N/A <sequence>
342N/A <message>
342N/A 'Start DS on host %s to run on port %s' % (server.getHostname(),server.getPort())
342N/A </message>
342N/A
342N/A <!--- Start DS -->
342N/A <call function="'StartDsWithScript'">
342N/A { 'location' : server.getHostname(),
342N/A 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME)
342N/A }
342N/A </call>
342N/A
342N/A <!--- Check that DS started -->
342N/A <call function="'isAlive'">
342N/A { 'location' : server.getHostname(),
342N/A 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
342N/A 'dsInstanceHost' : server.getHostname(),
342N/A 'dsInstancePort' : server.getPort(),
342N/A 'dsInstanceDn' : server.getRootDn(),
342N/A 'dsInstancePswd' : server.getRootPwd(),
342N/A 'noOfLoops' : 10 ,
342N/A 'noOfMilliSeconds' : 2000
342N/A }
811N/A </call>
811N/A </sequence>
811N/A </paralleliterate>
811N/A </sequence>
811N/A </else>
811N/A </if>
811N/A </sequence>
811N/A </function>
811N/A
811N/A
811N/A <function name="stopServers">
342N/A <function-prolog>
838N/A This function stops a list of servers.
342N/A </function-prolog>
838N/A <function-list-args>
342N/A <function-arg-def name="serverList" type="required">
838N/A <function-arg-description>
838N/A List of the servers (instances of "Server" class) to be stopped.
838N/A </function-arg-description>
838N/A <function-arg-property name="type" value="Server-list"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="noOfLoops"
342N/A type="optional"
342N/A default="10">
342N/A <function-arg-description>
342N/A Number of iterations (for isStopped())
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="integer"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="noOfMilliSeconds"
342N/A type="optional"
342N/A default="2000">
342N/A <function-arg-description>
342N/A Number of seconds to wait between iterations (for isStopped())
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="seconds"/>
342N/A </function-arg-def>
342N/A </function-list-args>
342N/A
342N/A <sequence>
342N/A <!-- Stop the servers in the list -->
342N/A <paralleliterate var="server" in="serverList">
1394N/A <sequence>
342N/A <message>
342N/A 'Stop DS on host %s running on port %s' % (server.getHostname(),server.getPort())
342N/A </message>
342N/A
342N/A <!--- Stop DS -->
1394N/A <call function="'StopDsWithScript'">
1394N/A { 'location' : server.getHostname(),
342N/A 'dsHost' : server.getHostname(),
342N/A 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
342N/A 'dsAdminPort' : server.getAdminPort(),
342N/A 'dsBindDN' : server.getRootDn(),
342N/A 'dsBindPwd' : server.getRootPwd(),
342N/A 'noOfLoops' : noOfLoops,
342N/A 'noOfMilliSeconds' : noOfMilliSeconds
342N/A }
342N/A </call>
342N/A </sequence>
342N/A </paralleliterate>
342N/A </sequence>
342N/A </function>
342N/A
342N/A <!-- This function perform a search operation in a LDIF file -->
342N/A <function name="ldifSearchWithScript" scope="local">
342N/A <function-prolog>
342N/A This function perform a search operation in a LDIF file
342N/A </function-prolog>
342N/A <function-map-args>
342N/A <function-arg-def name="location"
811N/A type="optional"
811N/A default="STAF_REMOTE_HOSTNAME">
811N/A <function-arg-description>
811N/A Location of target host
811N/A </function-arg-description>
811N/A <function-arg-property name="type" value="hostname"/>
811N/A </function-arg-def>
811N/A <function-arg-def name="dsPath"
811N/A type="optional"
811N/A default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
811N/A <function-arg-description>
811N/A Pathname to installation root
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filepath"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="dsBaseDN" type="optional">
342N/A <function-arg-description>
342N/A The baseDN for the search operation
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="dn"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="dsFilterFile" type="optional">
342N/A <function-arg-description>
342N/A File containing a list of search filter strings
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filename"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="dsLdifFile" type="required">
342N/A <function-arg-description>
342N/A LDIF file to use as the source data
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filename"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="dsOutputFile" type="optional">
342N/A <function-arg-description>
342N/A File to which the search results should be written
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filename"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="dsOverwriteExisting"
342N/A type="optional"
342N/A default="True">
342N/A <function-arg-description>
342N/A Overwrite the output file specified
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filename"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="dsSearchScope" type="optional">
342N/A <function-arg-description>
811N/A The scope of the search operation
811N/A </function-arg-description>
811N/A <function-arg-property name="type" value="option"/>
811N/A </function-arg-def>
811N/A <function-arg-def name="dsTimeLimit" type="optional">
811N/A <function-arg-description>
811N/A Maximum length of time in seconds to allow for the search
811N/A </function-arg-description>
811N/A <function-arg-property name="type" value="integer"/>
811N/A </function-arg-def>
811N/A <function-arg-def name="dsSizeLimit" type="optional">
811N/A <function-arg-description>
811N/A Maximum number of entries to return from the search
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="integer"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="dsDontWrap" type="optional">
342N/A <function-arg-description>
342N/A Do not wrap long lines
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="option"/>
342N/A </function-arg-def>
811N/A <function-arg-def name="dsHelp" type="optional">
811N/A <function-arg-description>
342N/A Display this usage information
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="option"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="dsVersion" type="optional">
342N/A <function-arg-description>
342N/A Display Directory Server version information
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="option"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="dsFilter" type="optional">
342N/A <function-arg-description>
342N/A The filter for the search operation
342N/A </function-arg-description>
342N/A <function-arg-property name="type" value="filter"/>
342N/A </function-arg-def>
342N/A <function-arg-def name="dsAttributes" type="optional">
342N/A <function-arg-description>
342N/A Only return these attributes
342N/A </function-arg-description>
796N/A <function-arg-property name="type" value="string"/>
796N/A </function-arg-def>
796N/A <function-arg-def name="expectedRC" type="optional" default="0">
796N/A <function-arg-description>
796N/A Expected return code value. Default value is 0
796N/A Wildcard 'noCheck' to not check the RC
796N/A </function-arg-description>
796N/A <function-arg-property name="type" value="integer"/>
796N/A </function-arg-def>
796N/A </function-map-args>
342N/A <sequence>
342N/A <!-- Build the Command -->
342N/A <script>
342N/A STAFCmdParamsList=[]
342N/A STAFCmdParams=''
342N/A
342N/A if dsPath:
342N/A dsBinPath='%s/%s' % (dsPath,fileFolder)
342N/A STAFCmd='%s/ldifsearch%s' % (dsBinPath,fileExt)
342N/A
342N/A if dsBaseDN:
342N/A STAFCmdParamsList.append('-b "%s"' % dsBaseDN)
342N/A
342N/A if dsFilterFile:
342N/A STAFCmdParamsList.append('-f %s' % dsFilterFile)
342N/A
342N/A if dsLdifFile:
342N/A STAFCmdParamsList.append('-l %s' % dsLdifFile)
342N/A
342N/A if dsOutputFile:
342N/A STAFCmdParamsList.append('-o %s' % dsOutputFile)
342N/A
342N/A if dsOverwriteExisting:
342N/A STAFCmdParamsList.append('-O')
342N/A
342N/A if dsSearchScope:
845N/A STAFCmdParamsList.append('-s %s' % dsSearchScope)
845N/A
845N/A if dsTimeLimit:
845N/A STAFCmdParamsList.append('-t %s' % dsTimeLimit)
845N/A
845N/A if dsSizeLimit:
845N/A STAFCmdParamsList.append('-z %s' % dsSizeLimit)
845N/A
845N/A if dsDontWrap:
845N/A STAFCmdParamsList.append('-T')
845N/A
845N/A if dsHelp:
845N/A STAFCmdParamsList.append('-H')
845N/A
845N/A if dsVersion:
845N/A STAFCmdParamsList.append('-V')
845N/A
845N/A if dsFilter:
845N/A STAFCmdParamsList.append('"%s"' % dsFilter)
845N/A
845N/A if dsAttributes:
845N/A STAFCmdParamsList.append('%s' % dsAttributes)
845N/A
845N/A STAFCmdParams=' '.join(STAFCmdParamsList)
845N/A </script>
845N/A
845N/A <call function="'runCommand'" >
845N/A {
845N/A 'name' : 'LDIF Search Script',
845N/A 'command' : STAFCmd,
845N/A 'arguments' : STAFCmdParams,
845N/A 'location' : location,
845N/A 'expectedRC' : expectedRC
845N/A }
845N/A </call>
845N/A
845N/A <return>STAXResult</return>
845N/A </sequence>
845N/A </function>
845N/A
845N/A <!-- This function execute the encode-password tool -->
845N/A <function name="encodePasswordWithScript" scope="local">
845N/A <function-prolog>
845N/A This function execute the encode-password tool
845N/A </function-prolog>
845N/A <function-map-args>
845N/A <function-arg-def name="location"
845N/A type="optional"
845N/A default="STAF_REMOTE_HOSTNAME">
845N/A <function-arg-description>
845N/A Location of target host
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="hostname"/>
845N/A </function-arg-def>
1391N/A <function-arg-def name="dsPath"
1391N/A type="optional"
845N/A default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
845N/A <function-arg-description>
1391N/A Pathname to installation root
1391N/A </function-arg-description>
1391N/A <function-arg-property name="type" value="filepath"/>
1391N/A </function-arg-def>
1391N/A <function-arg-def name="authPwdSyntax" type="optional">
1391N/A <function-arg-description>
1391N/A Use the authentication password syntax.
1391N/A </function-arg-description>
845N/A <function-arg-property name="type" value="option"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="clearPwd" type="optional">
845N/A <function-arg-description>
845N/A Specify the clear-text password.
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="string"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="encodedPwd" type="optional">
1391N/A <function-arg-description>
1391N/A Specify the encoded password.
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="string"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="encodedPwdFile" type="optional">
1391N/A <function-arg-description>
845N/A Use the encoded password from the specified file.
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="filename"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="clearPwdFile" type="optional">
845N/A <function-arg-description>
845N/A Use the clear-text password from the specified file.
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="filename"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="listSchemes" type="optional">
845N/A <function-arg-description>
845N/A Display a list of the password storage schemes that are available
845N/A for use in the OpenDS server.
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="option"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="useCmpRC" type="optional">
845N/A <function-arg-description>
845N/A Use an exit code that indicates whether a given clear-text password
845N/A matched a provided encoded password.
845N/A Results are an exit code of 6 (COMPARE_TRUE) or
845N/A an exit code of 5 (COMPARE_FALSE).
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="option"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="storageScheme" type="optional">
845N/A <function-arg-description>
845N/A Specify the name of the password storage scheme to use when
845N/A encoding a clear-text password.
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="option"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="dsHelp" type="optional">
845N/A <function-arg-description>
845N/A Display this usage information
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="option"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="dsVersion" type="optional">
845N/A <function-arg-description>
845N/A Display Directory Server version information
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="option"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="expectedRC" type="optional" default="0">
845N/A <function-arg-description>
845N/A Expected return code value. Default value is 0.
845N/A Wildcard 'noCheck' to not check the RC
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="integer"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="knownIssue" type="optional" default="None">
845N/A <function-arg-description>
845N/A Known issue. Corresponds to an issue number.
845N/A </function-arg-description>
845N/A </function-arg-def>
845N/A </function-map-args>
845N/A <sequence>
845N/A <!-- Build the Command -->
845N/A <script>
845N/A STAFCmdParamsList=[]
845N/A STAFCmdParams=''
845N/A
845N/A if dsPath:
845N/A dsBinPath='%s/%s' % (dsPath,fileFolder)
845N/A STAFCmd='%s/encode-password%s' % (dsBinPath,fileExt)
845N/A
845N/A if authPwdSyntax:
845N/A STAFCmdParamsList.append('-a')
845N/A
845N/A if clearPwd:
845N/A STAFCmdParamsList.append('-c %s' % clearPwd)
845N/A
845N/A if encodedPwd:
845N/A STAFCmdParamsList.append('-e %s' % encodedPwd)
845N/A
845N/A if encodedPwdFile:
845N/A STAFCmdParamsList.append('-E %s' % encodedPwdFile)
845N/A
845N/A if clearPwdFile:
845N/A STAFCmdParamsList.append('-f %s' % clearPwdFile)
845N/A
845N/A if listSchemes:
845N/A STAFCmdParamsList.append('-l')
845N/A
845N/A if useCmpRC:
845N/A STAFCmdParamsList.append('-r')
845N/A
845N/A if storageScheme:
845N/A STAFCmdParamsList.append('-s %s' % storageScheme)
845N/A
845N/A if dsHelp:
845N/A STAFCmdParamsList.append('-H')
1391N/A
845N/A if dsVersion:
845N/A STAFCmdParamsList.append('-V')
845N/A
845N/A STAFCmdParams=' '.join(STAFCmdParamsList)
845N/A </script>
845N/A
845N/A <call function="'runCommand'">
845N/A {
845N/A 'name' : 'Encode password script',
845N/A 'command' : STAFCmd,
845N/A 'arguments' : STAFCmdParams,
1391N/A 'location' : location,
1391N/A 'expectedRC' : expectedRC,
845N/A 'knownIssue' : knownIssue
1391N/A }
845N/A </call>
845N/A
845N/A <return>STAXResult</return>
845N/A </sequence>
845N/A </function>
845N/A
845N/A
845N/A <!-- This function check task execution-->
845N/A <function name="checkTaskExecution" scope="local">
1391N/A <function-prolog>
1391N/A This functioncheck task execution
845N/A </function-prolog>
1391N/A <function-map-args>
845N/A <function-arg-def name="location"
845N/A type="optional"
845N/A default="STAF_REMOTE_HOSTNAME">
845N/A <function-arg-description>
845N/A Location of target host
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="hostname"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="dsPath"
845N/A type="optional"
845N/A default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
845N/A <function-arg-description>
845N/A Pathname to installation root
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="filepath"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="outputToCheck" type="required">
845N/A <function-arg-description>
845N/A The output result of the task
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="string"/>
845N/A </function-arg-def>
845N/A
845N/A <function-arg-def name="dsInstanceDn" type="required">
845N/A <function-arg-description>
845N/A Bind DN
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="DN" />
845N/A </function-arg-def>
845N/A
845N/A <function-arg-def name="dsInstanceAdminPort"
845N/A type="optional"
845N/A default="DIRECTORY_INSTANCE_ADMIN_PORT">
845N/A <function-arg-description>
845N/A Directory server admin port number
1391N/A </function-arg-description>
1391N/A <function-arg-property name="type" value="Port number" />
1391N/A </function-arg-def>
1391N/A
845N/A <function-arg-def name="dsInstanceHost"
845N/A type="optional"
845N/A default="STAF_REMOTE_HOSTNAME">
845N/A <function-arg-description>
845N/A Directory server hostname or IP address
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="hostname" />
845N/A </function-arg-def>
845N/A
845N/A <function-arg-def name="dsInstancePswd" type="required">
845N/A <function-arg-description>
1531N/A Bind password
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="string" />
845N/A </function-arg-def>
845N/A
845N/A </function-map-args>
845N/A <sequence>
845N/A <script>
845N/A resultString = outputToCheck
845N/A resultSplitted = resultString.split()
845N/A taskId = None
845N/A for str in resultSplitted:
845N/A if len(str) == 17:
845N/A taskId = str
1629N/A </script>
845N/A
845N/A <message>
845N/A 'Command task Id : %s' % taskId
845N/A </message>
845N/A
845N/A <message>
845N/A 'Check ldif command successfully completed with manage-task'
845N/A </message>
845N/A
845N/A <script>checkRC=9999</script>
845N/A <loop from="1" to="10" var="loop" while="checkRC != 0">
845N/A <sequence>
845N/A <message>'LOOP %s' % loop</message>
845N/A <call function="'manage-tasks'">
845N/A {
845N/A 'dsPath' : dsPath,
845N/A 'dsInstanceHost' : dsInstanceHost ,
845N/A 'dsInstanceAdminPort' : dsInstanceAdminPort,
845N/A 'dsInstanceDn' : dsInstanceDn ,
845N/A 'dsInstancePswd' : dsInstancePswd ,
845N/A 'dsInfo' : taskId ,
845N/A 'dsQuiet' : 'True' ,
845N/A 'expectedRC' : 'noCheck'
845N/A }
845N/A </call>
845N/A
845N/A <script>
845N/A returnString = STAXResult[0][1]
845N/A msg = 'Status Completed successfully'
845N/A </script>
845N/A
845N/A <call function="'searchString'">
845N/A {
845N/A 'expectedString' : msg ,
845N/A 'returnString' : returnString ,
845N/A 'expectedRC' : 'noCheck'
845N/A }
1391N/A </call>
845N/A
845N/A <script>
1629N/A checkRC = STAXResult[0]
1629N/A </script>
845N/A
1782N/A <call function="'Sleep'">
1782N/A { 'sleepForMilliSeconds' : 2000 }
1782N/A </call>
1782N/A
1782N/A </sequence>
1782N/A </loop>
845N/A
1782N/A <call function="'checktestRC'">
1629N/A { 'returncode' : checkRC ,
845N/A 'result' : "Task succeeds" ,
845N/A 'expected' : 0
845N/A }
845N/A </call>
845N/A </sequence>
845N/A </function>
845N/A
845N/A <!-- This function compares two LDIF files using the ldif-diff script -->
845N/A <function name="LdifDiffWithScript-new" scope="local">
845N/A <function-prolog>
845N/A This function compares two LDIF files and reports the differences
845N/A in LDIF format
845N/A </function-prolog>
1391N/A <function-map-args>
1391N/A <function-arg-def name="location"
845N/A type="optional"
1391N/A default="STAF_REMOTE_HOSTNAME">
1391N/A <function-arg-description>
845N/A Location of target host
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="hostname"/>
1391N/A </function-arg-def>
845N/A <function-arg-def name="dsPath"
845N/A type="optional"
845N/A default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
845N/A <function-arg-description>
845N/A Pathname to installation root
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="filepath"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="dsVersion" type="optional">
845N/A <function-arg-description>
845N/A Display Directory Server version information
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="option"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="sourceLdif" type="required">
845N/A <function-arg-description>
845N/A LDIF file to use as the source data
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="filepath"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="targetLdif" type="required">
845N/A <function-arg-description>
845N/A LDIF file to use as the target data
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="filepath"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="outputLdif" type="required">
845N/A <function-arg-description>
845N/A File to which the diffs should be written
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="filepath"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="overwriteExisting" type="optional" default="True">
845N/A <function-arg-description>
845N/A Overwrite existing output file rather than append to it
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="option"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="singleValueChanges" type="optional">
845N/A <function-arg-description>
845N/A Write each attribute-level change as a separate modification
845N/A per attribute value rather than one modification per entry
845N/A </function-arg-description>
845N/A <function-arg-property name="type" value="option"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="dsHelp" type="optional">
845N/A <function-arg-description>
1629N/A Help option
1531N/A </function-arg-description>
845N/A <function-arg-property name="help" value="option"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="expectedRC" type="optional" default="0">
845N/A <function-arg-description>
845N/A Expected return code value. Default value is 0.
845N/A Wildcard 'noCheck' to not check the RC
845N/A </function-arg-description>
1629N/A <function-arg-property name="type" value="integer"/>
845N/A </function-arg-def>
845N/A <function-arg-def name="knownIssue" type="optional" default="None">
845N/A <function-arg-description>
845N/A Known issue. Corresponds to an issue number.
845N/A </function-arg-description>
845N/A </function-arg-def>
845N/A </function-map-args>
845N/A <sequence>
1629N/A <!-- Build the Command -->
845N/A <script>
1629N/A foldersToCreate = []
845N/A STAFCmdParamsList=[]
845N/A STAFCmdParams=''
845N/A
1629N/A if dsPath:
1629N/A dsBinPath='%s/%s' % (dsPath,fileFolder)
1629N/A STAFCmd='%s/ldif-diff%s' % (dsBinPath,fileExt)
1629N/A
1629N/A if dsVersion:
845N/A STAFCmdParamsList.append('-V')
845N/A
845N/A if sourceLdif:
845N/A STAFCmdParamsList.append('-s %s' % sourceLdif)
845N/A
845N/A if targetLdif:
845N/A STAFCmdParamsList.append('-t %s' % targetLdif)
845N/A
1391N/A if outputLdif:
845N/A foldersToCreate.append(os.path.dirname(outputLdif))
1391N/A STAFCmdParamsList.append('-o %s' % outputLdif)
845N/A
845N/A if overwriteExisting:
845N/A STAFCmdParamsList.append('-O')
845N/A
845N/A if singleValueChanges:
845N/A STAFCmdParamsList.append('-S')
845N/A
845N/A if dsHelp:
845N/A STAFCmdParamsList.append('-H')
845N/A
845N/A STAFCmdParams=' '.join(STAFCmdParamsList)
845N/A </script>
845N/A
845N/A <call function="'createMultiFolders'">
845N/A { 'location' : location,
845N/A 'folderslist' : foldersToCreate
1782N/A }
1782N/A </call>
1782N/A
1782N/A <message>
1782N/A '%s %s' % (STAFCmd, STAFCmdParams)
1782N/A </message>
845N/A
845N/A <call function="'runCommand'">
1782N/A {
1782N/A 'name' : 'Ldif diff script',
1782N/A 'command' : STAFCmd,
845N/A 'arguments' : STAFCmdParams,
1879N/A 'location' : location,
1879N/A 'expectedRC' : expectedRC ,
'knownIssue' : knownIssue
}
</call>
<return>STAXResult</return>
</sequence>
</function>
<!-- This function execute the dsjavaproperties tool -->
<function name="dsJavaPropertiesWithScript" scope="local">
<function-prolog>
This function execute the dsjavaproperties tool
</function-prolog>
<function-map-args>
<function-arg-def name="location"
type="optional"
default="STAF_REMOTE_HOSTNAME">
<function-arg-description>
Location of target host
</function-arg-description>
<function-arg-property name="type" value="hostname"/>
</function-arg-def>
<function-arg-def name="dsPath"
type="optional"
default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
<function-arg-description>
Pathname to installation root
</function-arg-description>
<function-arg-property name="type" value="filepath"/>
</function-arg-def>
<function-arg-def name="Version" type="optional">
<function-arg-description>
Display Directory Server version information
</function-arg-description>
<function-arg-property name="type" value="option"/>
</function-arg-def>
<function-arg-def name="Quiet" type="optional">
<function-arg-description>
Run dsjavaproperties in quiet mode
Quiet mode does not output progress information to standard output
</function-arg-description>
<function-arg-property name="type" value="option"/>
</function-arg-def>
<function-arg-def name="Help" type="optional">
<function-arg-description>
Help option
</function-arg-description>
<function-arg-property name="help" value="option"/>
</function-arg-def>
<function-arg-def name="expectedRC" type="optional" default="0">
<function-arg-description>
Expected return code value. Default value is 0.
Wildcard 'noCheck' to not check the RC
</function-arg-description>
<function-arg-property name="type" value="integer"/>
</function-arg-def>
</function-map-args>
<sequence>
<!-- Build the Command -->
<script>
STAFCmdParamsList=[]
STAFCmdParams=''
if dsPath:
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/dsjavaproperties%s' % (dsBinPath,fileExt)
if Version:
STAFCmdParamsList.append('-V')
if Quiet:
STAFCmdParamsList.append('-Q')
if Help:
STAFCmdParamsList.append('-H')
STAFCmdParams=' '.join(STAFCmdParamsList)
</script>
<call function="'runCommand'">
{
'name' : 'dsjavaproperties script',
'command' : STAFCmd,
'arguments' : STAFCmdParams,
'location' : location,
'expectedRC' : expectedRC
}
</call>
<return>STAXResult</return>
</sequence>
</function>
<!-- This function uses manage-account to manage users account-->
<function name="manageAccountWithScript">
<function-prolog>
This function uses manage-account to manage users account
</function-prolog>
<function-map-args>
<function-arg-def name="location"
type="optional"
default="STAF_REMOTE_HOSTNAME">
<function-arg-description>
Location of target host
</function-arg-description>
<function-arg-property name="type" value="hostname" />
</function-arg-def>
<function-arg-def name="dsPath"
type="optional"
default="'%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME)">
<function-arg-description>
Pathname to installation root
</function-arg-description>
<function-arg-property name="type" value="filepath" />
</function-arg-def>
<function-arg-def name="dsInstanceHost"
type="optional"
default="STAF_REMOTE_HOSTNAME">
<function-arg-description>
Directory server hostname or IP address
</function-arg-description>
<function-arg-property name="type" value="hostname" />
</function-arg-def>
<function-arg-def name="dsInstanceAdminPort"
type="optional"
default="DIRECTORY_INSTANCE_ADMIN_PORT">
<function-arg-description>
Directory server admin port number
</function-arg-description>
<function-arg-property name="type" value="Port number" />
</function-arg-def>
<function-arg-def name="dsInstanceDn" type="required">
<function-arg-description>
Bind DN
</function-arg-description>
<function-arg-property name="type" value="DN" />
</function-arg-def>
<function-arg-def name="targetDn" type="required">
<function-arg-description>
Specifies the DN of the user entry for which to get and set password
policy state information
</function-arg-description>
<function-arg-property name="type" value="dn"/>
</function-arg-def>
<function-arg-def name="dsInstancePswd" type="required">
<function-arg-description>
Bind password
</function-arg-description>
<function-arg-property name="type" value="string" />
</function-arg-def>
<function-arg-def name="dsBindPasswordFile" type="optional">
<function-arg-description>
Bind password file
</function-arg-description>
<function-arg-property name="type" value="filename"/>
</function-arg-def>
<function-arg-def name="subcommand" type="required">
<function-arg-description>
manage-account subcommand to execute
</function-arg-description>
<function-arg-property name="type" value="string" />
</function-arg-def>
<function-arg-def name="expectedRC" type="optional" default="0">
<function-arg-description>
Expected return code value. Default value is 0.
Wildcard 'noCheck' to not check the RC
</function-arg-description>
<function-arg-property name="type" value="string" />
</function-arg-def>
<function-arg-def name="dsHelp" type="optional">
<function-arg-description>
Help option
</function-arg-description>
<function-arg-property name="help" value="option"/>
</function-arg-def>
<function-arg-def name="dsVersion" type="optional">
<function-arg-description>
Display Directory Server version information
</function-arg-description>
<function-arg-property name="type" value="option"/>
</function-arg-def>
<function-arg-def name="dsCertNickname" type="optional">
<function-arg-description>
Nickname of certificate for SSL client authentication
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="dsKeyStorePath" type="optional">
<function-arg-description>
Certificate keystore path
</function-arg-description>
<function-arg-property name="type" value="filename"/>
</function-arg-def>
<function-arg-def name="dsSaslOption" type="optional">
<function-arg-description>
SASL bind options
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="dsTrustStorePath" type="optional">
<function-arg-description>
Certificate trust store path
</function-arg-description>
<function-arg-property name="type" value="filename"/>
</function-arg-def>
<function-arg-def name="dsUseStartTLS" type="optional">
<function-arg-description>
Use StartTLS to secure communication with the server
</function-arg-description>
<function-arg-property name="type" value="option"/>
</function-arg-def>
<function-arg-def name="dsTrustStorePassword" type="optional">
<function-arg-description>
Certificate trust store PIN
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="dsTrustStorePasswordFile" type="optional">
<function-arg-description>
Certificate trust store PIN file
</function-arg-description>
<function-arg-property name="type" value="filename"/>
</function-arg-def>
<function-arg-def name="dsKeyStorePasswordFile" type="optional">
<function-arg-description>
Certificate keystore PIN file
</function-arg-description>
<function-arg-property name="type" value="filename"/>
</function-arg-def>
<function-arg-def name="dsKeyStorePassword" type="optional">
<function-arg-description>
Certificate keystore PIN
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
<function-arg-def name="dsUseSSL" type="optional">
<function-arg-description>
Use SSL for secure communication with the server
</function-arg-description>
<function-arg-property name="type" value="option"/>
</function-arg-def>
<function-arg-def name="dsTrustAll" type="optional">
<function-arg-description>
Trust all server SSL certificates
</function-arg-description>
<function-arg-property name="type" value="option"/>
</function-arg-def>
<function-arg-def name="dsOperationValue" type="optional">
<function-arg-description>
dsOperationValue is true or false
</function-arg-description>
<function-arg-property name="type" value="boolean"/>
</function-arg-def>
</function-map-args>
<sequence>
<!-- Build the Command -->
<script>
STAFCmdParamsList=[]
STAFCmdParams=''
if dsPath:
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/manage-account%s' % (dsBinPath,fileExt)
STAFCmdParamsList.append(subcommand)
if targetDn:
STAFCmdParamsList.append('-b "%s"' % targetDn)
if dsInstanceHost:
STAFCmdParamsList.append('-h %s' % dsInstanceHost)
if dsInstanceDn:
STAFCmdParamsList.append('-D "%s"' % dsInstanceDn)
if dsInstancePswd:
STAFCmdParamsList.append('-w %s' % dsInstancePswd)
if dsHelp:
STAFCmdParamsList.append('-H')
if dsBindPasswordFile:
STAFCmdParamsList.append('-j %s' % dsBindPasswordFile)
if dsKeyStorePath:
STAFCmdParamsList.append('-K %s' % dsKeyStorePath)
if dsCertNickname:
STAFCmdParamsList.append('-N %s' % dsCertNickname)
if dsSaslOption:
STAFCmdParamsList.append('-o %s' % dsSaslOption)
if dsInstanceAdminPort:
STAFCmdParamsList.append('-p %s' % dsInstanceAdminPort)
STAFCmdParamsList.append('-X')
if dsTrustStorePath:
STAFCmdParamsList.append('-P %s' % dsTrustStorePath)
if dsUseStartTLS:
STAFCmdParamsList.append('-q')
if dsTrustStorePassword:
STAFCmdParamsList.append('--trustStorePassword %s' % dsTrustStorePassword)
if dsTrustStorePasswordFile:
STAFCmdParamsList.append('-U %s' % dsTrustStorePasswordFile)
if dsKeyStorePasswordFile:
STAFCmdParamsList.append('-u %s' % dsKeyStorePasswordFile)
if dsVersion:
STAFCmdParamsList.append('-V')
if dsKeyStorePassword:
STAFCmdParamsList.append('-W %s' % dsKeyStorePassword)
if dsUseSSL:
STAFCmdParamsList.append('-Z')
if dsOperationValue:
STAFCmdParamsList.append('-O %s' % dsOperationValue)
STAFCmdParams=' '.join(STAFCmdParamsList)
</script>
<call function="'runCommand'" >
{ 'name' : 'Manage-account script',
'command' : STAFCmd,
'arguments' : STAFCmdParams,
'location' : location,
'expectedRC': expectedRC
}
</call>
<return>
STAXResult
</return>
</sequence>
</function>
<function name="verifyReplication">
<function-prolog>
This function verifies that replication is working, that is, the updates
done on any of the servers in the topology are being pushed to the other
servers.
</function-prolog>
<function-list-args>
<function-arg-def name="serverList" type="required">
<function-arg-description>
List of the servers to verify against the referenceServer.
</function-arg-description>
<function-arg-property name="type" value="Server-list"/>
</function-arg-def>
<function-arg-def name="replicatedSuffix" type="required">
<function-arg-description>
Suffix of the tree to verify.
</function-arg-description>
<function-arg-property name="type" value="DN"/>
</function-arg-def>
<function-arg-def name="knownIssue" type="optional" default="None">
<function-arg-description>
Known issue. Corresponds to an issue number.
</function-arg-description>
</function-arg-def>
</function-list-args>
<sequence>
<message>
'verifyReplication: Verify updates on the suffix %s are being \
replicated.' % replicatedSuffix
</message>
<iterate var="server" in="serverList" indexvar="i">
<sequence>
<script>
serverHost = server.getHostname()
serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
otherServersList = serverList[:i] + serverList[i+1:]
entryDn = 'uid=testentry-%s, %s' % (i, replicatedSuffix)
myRC = 0
myKnownIssue = knownIssue
failedServers = STAXGlobal( [] )
failingServerList = ''
</script>
<!-- Add entry to one of the other servers -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:Test-%s' % i)
listAttr.append('sn:Entry-%s' % i)
listAttr.append('cn:Test Entry - %s' % i)
</script>
<message>
'verifyReplication: Add entry %s to server %s:%s' % \
(entryDn, serverHost, server.getPort())
</message>
<call function="'addAnEntry'">
{ 'location' : serverHost,
'dsPath' : serverPath,
'dsInstanceHost' : serverHost,
'dsInstancePort' : server.getPort(),
'dsInstanceDn' : server.getRootDn(),
'dsInstancePswd' : server.getRootPwd(),
'DNToAdd' : entryDn,
'listAttributes' : listAttr
}
</call>
<call function="'Sleep'">
{ 'sleepForMilliSeconds' : 2000 }
</call>
<!-- Check the update has been propagated -->
<paralleliterate var="otherServer" in="otherServersList">
<sequence>
<call function="'ldapSearchWithScript'">
{ 'location' : otherServer.getHostname(),
'dsPath' : '%s/%s' \
% (otherServer.getDir(), OPENDSNAME),
'dsInstanceHost' : otherServer.getHostname(),
'dsInstancePort' : otherServer.getPort(),
'dsInstanceDn' : otherServer.getRootDn(),
'dsInstancePswd' : otherServer.getRootPwd(),
'dsBaseDN' : entryDn,
'dsFilter' : 'objectclass=*',
'logStderr' : False
}
</call>
<script>
searchRC = RC
searchResult = STAXResult[0][1]
resultLength = len(searchResult) > 0
</script>
<if expr="resultLength != 0">
<sequence>
<message>
'+++++++++++ LDAPSEARCH RESULT for %s:%s ++++++++\n%s' \
% (otherServer.getHostname(), otherServer.getPort(),
searchResult)
</message>
</sequence>
<else>
<sequence>
<message>
'verifyReplication: Entry %s NOT found in server %s:%s' % \
(entryDn, otherServer.getHostname(), otherServer.getPort())
</message>
<script>
failedServers.append('%s:%s' % \
(otherServer.getHostname(), otherServer.getPort()))
</script>
</sequence>
</else>
</if>
</sequence>
</paralleliterate>
<if expr="len(failedServers) > 0">
<!-- If at least one server failed to receive the update return an
! error, along with the list of the servers that failed to do so
-->
<script>
myRC = 1
comma = ','
failingServerList = \
'List of non-synchronized servers (replication verify FAILED \
for entry %s): %s ' % (entryDn, comma.join(failedServers))
</script>
<else>
<message>
'All servers synchronized (replication verify SUCCEEDED for \
entry %s)' % entryDn
</message>
</else>
</if>
<call function="'checktestRC'">
{ 'returncode' : myRC,
'result' : failingServerList,
'expected' : 0,
'issue' : myKnownIssue
}
</call>
<!-- Remove footprint: delete the entry just added -->
<call function="'ldapDeleteWithScript'">
{ 'location' : serverHost,
'dsPath' : serverPath,
'dsInstanceHost' : serverHost,
'dsInstancePort' : server.getPort(),
'dsInstanceDn' : server.getRootDn(),
'dsInstancePswd' : server.getRootPwd(),
'dsDn' : [entryDn]
}
</call>
</sequence>
</iterate>
</sequence>
</function>
</stax>