<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<!DOCTYPE stax SYSTEM "../stax.dtd">
|
<!--
|
! CDDL HEADER START
|
!
|
! The contents of this file are subject to the terms of the
|
! Common Development and Distribution License, Version 1.0 only
|
! (the "License"). You may not use this file except in compliance
|
! with the License.
|
!
|
! You can obtain a copy of the license at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
|
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
|
! See the License for the specific language governing permissions
|
! and limitations under the License.
|
!
|
! When distributing Covered Code, include this CDDL HEADER in each
|
! file and include the License file at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
|
! add the following below this CDDL HEADER, with the fields enclosed
|
! by brackets "[]" replaced with your own identifying information:
|
! Portions Copyright [yyyy] [name of copyright owner]
|
!
|
! CDDL HEADER END
|
!
|
! Copyright 2007-2010 Sun Microsystems, Inc.
|
! -->
|
<stax>
|
<!-- This function uses make ldif to generate LDIF data files -->
|
<function name="MakeLdifWithScript">
|
<function-prolog>
|
This function uses make ldif to generate LDIF data files
|
</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="string"/>
|
</function-arg-def>
|
|
<function-arg-def name="templateFile" type="optional">
|
<function-arg-description>
|
Path to the template file
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
|
<function-arg-def name="ldifFile" type="optional">
|
<function-arg-description>
|
Path to the LDIF file
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
|
<function-arg-def name="randomSeed" type="optional">
|
<function-arg-description>
|
The seed to use to initialize the random number generator
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</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-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-map-args>
|
<sequence>
|
<!-- Build the Command -->
|
<script>
|
foldersToCreate = []
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/make-ldif%s' % (dsBinPath,fileExt)
|
|
if version:
|
STAFCmdParamsList.append('-V')
|
|
if templateFile:
|
STAFCmdParamsList.append('-t %s' % templateFile)
|
|
if ldifFile:
|
foldersToCreate.append(os.path.dirname(ldifFile))
|
STAFCmdParamsList.append('-o %s' % ldifFile)
|
|
if randomSeed:
|
STAFCmdParamsList.append('-s "%s"' % randomSeed)
|
|
if Help:
|
STAFCmdParamsList.append('-H')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<call function="'createMultiFolders'">
|
{ 'location' : location,
|
'folderslist' : foldersToCreate
|
}
|
</call>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'">
|
{ 'name' : 'Make Ldif Script',
|
'location' : location,
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
<return>STAXResult</return>
|
</sequence>
|
</function>
|
|
|
<!-- This function uses make ldif to generate LDIF data files -->
|
<function name="MakeAMakeLdifTemplate">
|
<function-prolog>
|
This function makes a make-ldif template file
|
</function-prolog>
|
|
<function-map-args>
|
<function-arg-def name="numEntries" type="required">
|
<function-arg-description>
|
Number of entries
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="startFrom"
|
type="optional"
|
default="0">
|
<function-arg-description>
|
Start entries number
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="suffix"
|
type="optional"
|
default="DIRECTORY_INSTANCE_SFX">
|
<function-arg-description>
|
Suffix
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="templateFile" type="required">
|
<function-arg-description>
|
Template file name
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="templateLocation"
|
type="optional"
|
default="STAXServiceMachine">
|
<function-arg-description>
|
Template file location
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="additionalAttributes"
|
type="optional"
|
default="False">
|
<function-arg-description>
|
Add (or not) additional attributes
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="extraLine" type="optional">
|
<function-arg-description>
|
Extra line to add to the mkae-ldif template
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
</function-map-args>
|
<sequence>
|
<!-- Build the import task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('define suffix=%s' % suffix)
|
ldifLines.append('define maildomain=example.com')
|
ldifLines.append('define numusers=%s' % numEntries )
|
ldifLines.append('')
|
|
ldifLines.append('branch: [suffix]')
|
ldifLines.append('')
|
|
ldifLines.append('branch: ou=People,[suffix]')
|
ldifLines.append('subordinateTemplate: person:[numusers]')
|
ldifLines.append('')
|
|
ldifLines.append('template: person')
|
ldifLines.append('rdnAttr: uid')
|
ldifLines.append('objectClass: top')
|
ldifLines.append('objectClass: person')
|
ldifLines.append('objectClass: organizationalPerson')
|
ldifLines.append('objectClass: inetOrgPerson')
|
ldifLines.append('givenName: <first>')
|
ldifLines.append('sn: <last>')
|
ldifLines.append('employeeNumber: <sequential:%s>' % startFrom)
|
ldifLines.append('cn: {givenName} {sn} {employeeNumber}')
|
ldifLines.append('uid: user.{employeeNumber}')
|
ldifLines.append('mail: {uid}@[maildomain]')
|
ldifLines.append('telephoneNumber: <random:telephone>')
|
ldifLines.append('description: This is the description for user.{employeeNumber}.')
|
|
if additionalAttributes == True:
|
ldifLines.append('initials: {givenName:1}<random:chars:ABCDEFGHIJKLMNOPQRSTUVWXYZ:1>{sn:1}')
|
ldifLines.append('homePhone: <random:telephone>')
|
ldifLines.append('mobile: <random:telephone>')
|
ldifLines.append('street: <random:numeric:5> <file:streets> Street')
|
ldifLines.append('l: <file:cities>')
|
ldifLines.append('st: <file:states>')
|
ldifLines.append('postalCode: <random:numeric:5>')
|
ldifLines.append('postalAddress: {cn}${street}${l}, {st} {postalCode}')
|
ldifLines.append('jpegPhoto:: <random:base64:10000>')
|
|
if extraLine:
|
ldifLines.append('%s' % extraLine)
|
</script>
|
|
<!-- Write out the make-ldif template file -->
|
<script>
|
RC=0
|
</script>
|
<script>
|
tmpTemplateFile = '%s/tempLdifTemplateFile' % local.temp
|
outfile = open(tmpTemplateFile,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
<script>
|
STAXCode=RC
|
STAXReason=STAXResult
|
</script>
|
<if expr="STAXCode != 0">
|
<sequence>
|
<message level="'error'">
|
'creation of a make-ldif template failed (Code=%s,Reason=%s).' % (STAXCode,STAXReason)
|
</message>
|
</sequence>
|
</if>
|
<call function="'checktestRC'">
|
{ 'returncode' : STAXCode ,
|
'result' : STAXReason }
|
</call>
|
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTemplateFile,
|
'destfile' : templateFile,
|
'remotehost' : templateLocation }
|
</call>
|
|
<call function="'checktestRC'">
|
{
|
'returncode' : RC ,
|
'result' : STAXResult
|
}
|
</call>
|
|
<return>[RC, STAXResult]</return>
|
|
</sequence>
|
</function>
|
|
<!-- This function compares two LDIF files using the ldif-diff script -->
|
<function name="LdifDiffWithScript">
|
<function-prolog>
|
This function compares two LDIF files and reports the differences in LDIF format
|
</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="string"/>
|
</function-arg-def>
|
|
<function-arg-def name="sourceLdif" type="required">
|
<function-arg-description>
|
LDIF file to use as the source data
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
|
<function-arg-def name="targetLdif" type="required">
|
<function-arg-description>
|
LDIF file to use as the target data
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
|
<function-arg-def name="outputLdif" type="required">
|
<function-arg-description>
|
File to which the diffs should be written
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
|
<function-arg-def name="ignoreAttrsFile"
|
type="optional"
|
default="None">
|
<function-arg-description>
|
File containing a list of attributes to ignore when computing the
|
difference
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
|
<function-arg-def name="overwriteExisting" type="optional" default="True">
|
<function-arg-description>
|
Overwrite existing output file rather than append to it
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
|
<function-arg-def name="singleValueChanges" type="optional">
|
<function-arg-description>
|
Write each attribute-level change as a separate modification
|
per attribute value rather than one modification per entry
|
</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-map-args>
|
<sequence>
|
<!-- Build the Command -->
|
<script>
|
foldersToCreate = []
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/ldif-diff%s' % (dsBinPath,fileExt)
|
|
if version:
|
STAFCmdParamsList.append('-V')
|
|
if sourceLdif:
|
STAFCmdParamsList.append('-s %s' % sourceLdif)
|
|
if targetLdif:
|
STAFCmdParamsList.append('-t %s' % targetLdif)
|
|
if outputLdif:
|
foldersToCreate.append(os.path.dirname(outputLdif))
|
STAFCmdParamsList.append('-o %s' % outputLdif)
|
|
if ignoreAttrsFile:
|
STAFCmdParamsList.append('-a %s' % ignoreAttrsFile)
|
|
if overwriteExisting:
|
STAFCmdParamsList.append('-O')
|
|
if singleValueChanges:
|
STAFCmdParamsList.append('-S')
|
|
if Help:
|
STAFCmdParamsList.append('-H')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<call function="'createMultiFolders'">
|
{ 'location' : location,
|
'folderslist' : foldersToCreate
|
}
|
</call>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<process name="'LDIF Diff Script'">
|
<location>location</location>
|
<command>STAFCmd</command>
|
<parms>STAFCmdParams</parms>
|
<workdir>dsBinPath</workdir>
|
<envs>
|
['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
|
</envs>
|
<console use="'same'"/>
|
<stderr mode="'stdout'"/>
|
<returnstdout/>
|
</process>
|
|
<script>
|
STAXCode=RC
|
</script>
|
<if expr="STAXCode == 0">
|
<sequence>
|
<!-- Check the size of the diff file, and avoid reading its
|
content with getFile if the file is too big to prevent
|
the staf process from running out of memory -->
|
<call function="'GetEntry'">
|
{
|
'location' : location,
|
'entry' : outputLdif,
|
'attribute' : 'SIZE'
|
}
|
</call>
|
<script>
|
# GetEntry returns: STAXResult = [cmdRC, cmdResult]
|
if RC == 0:
|
diffsFileSize = int(STAXResult[1]['lowerSize'])
|
msg = 'File: %s Size (bytes): %s' % (outputLdif, diffsFileSize)
|
else:
|
diffsFileSize = MAX_READABLE_SIZE
|
msg = 'Could not retrieve the size of file %s' % outputLdif
|
</script>
|
<message log="1"> 'LdifDiffWithScript: %s' % msg </message>
|
<if expr="diffsFileSize < MAX_READABLE_SIZE">
|
<sequence>
|
<call function="'getFile'">
|
{ 'location' : location,
|
'filename' : outputLdif
|
}
|
</call>
|
<script>
|
# getFile returns: STAXResult = [cmdRC, cmdResult]
|
diffsFileContent = STAXResult[1]
|
|
if diffsFileContent.startswith("# No differences were detected between the source and target LDIF files") :
|
diffRC = 0
|
else:
|
diffRC = 1
|
</script>
|
</sequence>
|
<else>
|
<script>
|
# diffs file to big to be read
|
diffsFileContent = 'File too big to be read.'
|
|
# if the diff file is too big, it means that there ARE
|
# actually some diffs, so we may deduce diffRC = 1
|
diffRC = 1
|
</script>
|
</else>
|
</if>
|
</sequence>
|
<else>
|
<sequence>
|
<message log="1" level="'Error'">
|
'LdifDiffWithScript: command run FAILED.'
|
</message>
|
<return> -1 </return>
|
</sequence>
|
</else>
|
</if>
|
|
<if expr="diffRC == 0">
|
<message log="1">
|
'NO DIFFERENCES were detected between the source and the target \
|
LDIF files.'
|
</message>
|
<else>
|
<message log="1" level="'Error'">
|
'Source and target LDIF files are DIFFERENT: \n\n%s' % \
|
diffsFileContent
|
</message>
|
</else>
|
</if>
|
|
<return> diffRC </return>
|
</sequence>
|
</function>
|
|
<!-- This function modifies an LDIF file using ldifmodify script -->
|
<function name="LdifModifyWithScript">
|
<function-prolog>
|
This function modifies an LDIF file with the changes contained in another LDIF file
|
</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="string"/>
|
</function-arg-def>
|
|
<function-arg-def name="sourceLdif" type="required">
|
<function-arg-description>
|
LDIF file containing the data to be updated
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
|
<function-arg-def name="targetLdif" type="required">
|
<function-arg-description>
|
LDIF file that will contain the updated data
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
|
<function-arg-def name="changesLdif" type="required">
|
<function-arg-description>
|
LDIF file containing the changes to apply
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</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-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-map-args>
|
<sequence>
|
<!-- Build the Command -->
|
<script>
|
foldersToCreate = []
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/ldifmodify%s' % (dsBinPath,fileExt)
|
|
if version:
|
STAFCmdParamsList.append('-V')
|
|
if sourceLdif:
|
STAFCmdParamsList.append('-s %s' % sourceLdif)
|
|
if targetLdif:
|
foldersToCreate.append(os.path.dirname(targetLdif))
|
STAFCmdParamsList.append('-t %s' % targetLdif)
|
|
if changesLdif:
|
STAFCmdParamsList.append('-m %s' % changesLdif)
|
|
if Help:
|
STAFCmdParamsList.append('-H')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<call function="'createMultiFolders'">
|
{ 'location' : location,
|
'folderslist' : foldersToCreate
|
}
|
</call>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'">
|
{ 'name' : 'LDIF Modify Script',
|
'location' : location,
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
<return>STAXResult</return>
|
</sequence>
|
</function>
|
|
|
<function name="verifyTrees">
|
<function-prolog>
|
This function verifies that the trees in a group of ldap servers are
|
synchronized.
|
</function-prolog>
|
<function-list-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="referenceServer" type="required">
|
<function-arg-description>
|
Server that should be taken as reference.
|
</function-arg-description>
|
<function-arg-property name="type" value="Server"/>
|
</function-arg-def>
|
|
<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="treeSuffix" 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-arg-def name="ignoreAttrsFile"
|
type="optional"
|
default="None">
|
<function-arg-description>
|
File containing a list of attributes to ignore when computing the
|
difference
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
</function-list-args>
|
<sequence>
|
<script>
|
myRC = 0
|
myKnownIssue = knownIssue
|
failedServers = []
|
failingServerList = ''
|
referenceServerPath = '%s/%s' % (referenceServer.getDir(), OPENDSNAME)
|
referenceTree = 'referenceTree.ldif'
|
sampleTree = 'sampleTree.ldif'
|
treeDiffs = 'treeDiffs.ldif'
|
</script>
|
|
<!-- Verify the synchronization of the trees among the servers in
|
the topology -->
|
<call function="'getReplicationStatus'">
|
{ 'location' : location,
|
'dsPath' : dsPath,
|
'dsInstanceHost' : referenceServer.getHostname(),
|
'dsInstanceAdminPort' : referenceServer.getAdminPort(),
|
'replicationDnList' : [treeSuffix],
|
'noOfLoops' : 10,
|
'noOfMilliSeconds' : 6000
|
}
|
</call>
|
|
<message>
|
'Verify tree %s taking %s as reference.' \
|
% (treeSuffix, referenceServerPath)
|
</message>
|
<!-- Retrieve the tree from the reference server -->
|
<call function="'exportLdifWithScript'">
|
{ 'location' : location,
|
'dsPath' : dsPath,
|
'dsInstanceHost' : referenceServer.getHostname(),
|
'dsInstanceAdminPort' : referenceServer.getAdminPort(),
|
'dsInstanceDn' : referenceServer.getRootDn(),
|
'dsInstancePswd' : referenceServer.getRootPwd(),
|
'ldifFile' : '%s/../%s' % (dsPath, referenceTree),
|
'includeBranches' : [treeSuffix]
|
}
|
</call>
|
|
<if expr="RC != 0">
|
<!-- If the reference tree could not be retrieved, return an error -->
|
<return> [1, None] </return>
|
</if>
|
<iterate var="server" in="serverList">
|
<sequence>
|
<!-- Retrieve the same tree for every other server in the list -->
|
<if expr="server.getHostname() == location">
|
<script>
|
filePath = dsPath
|
isSameLocation = True
|
</script>
|
<else>
|
<script>
|
filePath = '%s/%s' % (server.getDir(), OPENDSNAME)
|
isSameLocation = False
|
</script>
|
</else>
|
</if>
|
<call function="'exportLdifWithScript'">
|
{ 'location' : location,
|
'dsPath' : dsPath,
|
'dsInstanceHost' : server.getHostname(),
|
'dsInstanceAdminPort' : server.getAdminPort(),
|
'dsInstanceDn' : server.getRootDn(),
|
'dsInstancePswd' : server.getRootPwd(),
|
'ldifFile' : '%s/../%s' % (filePath, sampleTree),
|
'includeBranches' : [treeSuffix]
|
}
|
</call>
|
|
<if expr="RC == 0">
|
<sequence>
|
|
<if expr="not isSameLocation">
|
<!-- Copy sample tree file to reference server -->
|
<call function="'copyFile'">
|
{ 'location' : server.getHostname(),
|
'remotehost' : location,
|
'srcfile' : '%s/../%s' % (filePath, sampleTree),
|
'destfile' : '%s/../%s' % (dsPath, sampleTree)
|
}
|
</call>
|
</if>
|
|
<!-- Compare this tree to the reference one -->
|
<call function="'LdifDiffWithScript'">
|
{ 'location' : location,
|
'dsPath' : dsPath,
|
'sourceLdif' : '%s/../%s' % (dsPath, sampleTree),
|
'targetLdif' : '%s/../%s' % (dsPath, referenceTree),
|
'outputLdif' : '%s/../%s' % (dsPath, treeDiffs),
|
'ignoreAttrsFile' : ignoreAttrsFile
|
}
|
</call>
|
<if expr="STAXResult != 0">
|
<sequence>
|
<script>
|
failedServers.append('%s:%s' % \
|
(server.getHostname(), server.getPort()))
|
</script>
|
<message log="1" level="'Error'">
|
'Tree is DIFFERENT for %s:%s compared to %s:%s' % \
|
(server.getHostname(), server.getPort(),
|
referenceServer.getHostname(), referenceServer.getPort())
|
</message>
|
</sequence>
|
</if>
|
</sequence>
|
<else>
|
<script>
|
failedServers.append('%s:%s' % \
|
(server.getHostname(), server.getPort()))
|
</script>
|
</else>
|
</if>
|
</sequence>
|
</iterate>
|
<if expr="len(failedServers) > 0">
|
<!-- If at least one server failed to successfully compare to the
|
! reference tree, 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 (tree verify FAILED): %s ' \
|
% comma.join(failedServers)
|
</script>
|
<else>
|
<message>
|
'All servers synchronized (tree verify SUCCEEDED).'
|
</message>
|
</else>
|
</if>
|
<call function="'checktestRC'">
|
{ 'returncode' : myRC,
|
'result' : failingServerList,
|
'expected' : 0,
|
'issue' : myKnownIssue
|
}
|
</call>
|
<return>[myRC, failedServers]</return>
|
</sequence>
|
</function>
|
|
|
<function name="verifySchemas">
|
<function-prolog>
|
This function verifies that a schema file is synchronized all over a group of servers.
|
</function-prolog>
|
<function-list-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="referenceServer" type="required">
|
<function-arg-description>
|
Server that should be taken as reference.
|
</function-arg-description>
|
<function-arg-property name="type" value="Server"/>
|
</function-arg-def>
|
|
<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="schemaFile" type="required">
|
<function-arg-description>
|
Schema file to verify.
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</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>
|
<script>
|
myRC = 0
|
myKnownIssue = knownIssue
|
failedServers = []
|
failingServerList = ''
|
referenceServerPath = '%s/%s' % (referenceServer.getDir(), OPENDSNAME)
|
referenceSchema = '%s/config/schema/%s' % (referenceServerPath, schemaFile)
|
schemaDiffs = 'schemaDiffs.ldif'
|
</script>
|
|
<message>
|
'Verify schema file %s taking %s as reference.' % (schemaFile, referenceServerPath)
|
</message>
|
|
<iterate var="server" in="serverList">
|
<sequence>
|
<!-- Copy reference schema file to other server -->
|
<call function="'copyFile'">
|
{ 'location' : referenceServer.getHostname(),
|
'remotehost' : server.getHostname(),
|
'srcfile' : referenceSchema,
|
'destfile' : '%s/reference_%s' % (server.getDir(),schemaFile)
|
}
|
</call>
|
<script>
|
serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
|
</script>
|
|
<!-- Compare this schema to the reference one -->
|
<call function="'LdifDiffWithScript'">
|
{ 'location' : location,
|
'dsPath' : dsPath,
|
'sourceLdif' : '%s/config/schema/%s' % (serverPath, schemaFile),
|
'targetLdif' : '%s/reference_%s' % (server.getDir(), schemaFile),
|
'outputLdif' : '%s/%s' % (server.getDir(), schemaDiffs)
|
}
|
</call>
|
<script>
|
if STAXResult != 0 :
|
failedServers.append('%s:%s' % (server.getHostname(), server.getPort()))
|
</script>
|
</sequence>
|
</iterate>
|
<if expr="len(failedServers) > 0">
|
<!-- If at least one server failed to successfully compare to the reference tree,
|
! 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 (schema verify FAILED): %s ' % comma.join(failedServers)
|
</script>
|
<else>
|
<message>
|
'All servers synchronized (schema verify SUCCEEDED).'
|
</message>
|
</else>
|
</if>
|
<call function="'checktestRC'">
|
{ 'returncode' : myRC,
|
'result' : failingServerList ,
|
'expected' : 0,
|
'issue' : myKnownIssue
|
}
|
</call>
|
<return>[myRC, failedServers]</return>
|
</sequence>
|
</function>
|
|
|
<function name="deleteTrees">
|
<function-prolog>
|
This function deletes a (sub)tree from a list of servers.
|
</function-prolog>
|
<function-list-args>
|
<function-arg-def name="serverList" type="required">
|
<function-arg-description>
|
List of the servers (instances of "Server" class) where the tree will be deleted.
|
</function-arg-description>
|
<function-arg-property name="type" value="Server-list"/>
|
</function-arg-def>
|
|
<function-arg-def name="treeSuffix" type="required">
|
<function-arg-description>
|
Suffix of the tree to delete.
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
|
<function-arg-def name="startDS" type="optional" default="True">
|
<function-arg-description>
|
Need to start the Directory Servers before deleting.
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
</function-list-args>
|
<sequence>
|
<if expr="startDS">
|
<!-- Start the servers in the list -->
|
<call function="'startServers'">
|
[serverList]
|
</call>
|
</if>
|
|
<!-- Delete the tree in every server in the list -->
|
<paralleliterate var="server" in="serverList">
|
<sequence>
|
<message>
|
'Delete suffix %s on server running on host %s on port %s' % (treeSuffix, server.getHostname(), server.getPort())
|
</message>
|
|
<!-- Delete suffix and subtree -->
|
<call function="'ldapDeleteWithScript'">
|
{ 'location' : server.getHostname(),
|
'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
|
'dsInstanceHost' : server.getHostname(),
|
'dsInstancePort' : server.getPort(),
|
'dsInstanceDn' : server.getRootDn(),
|
'dsInstancePswd' : server.getRootPwd(),
|
'dsDn' : [treeSuffix],
|
'dsDeleteSubtree' : True
|
}
|
</call>
|
</sequence>
|
</paralleliterate>
|
|
<if expr="startDS">
|
<!-- Stop the servers in the list -->
|
<call function="'stopServers'">
|
[serverList]
|
</call>
|
</if>
|
</sequence>
|
</function>
|
|
|
<function name="startServers">
|
<function-prolog>
|
This function starts a list of servers.
|
</function-prolog>
|
<function-list-args>
|
<function-arg-def name="serverList" type="required">
|
<function-arg-description>
|
List of the servers (instances of "Server" class) to be started.
|
</function-arg-description>
|
<function-arg-property name="type" value="Server-list"/>
|
</function-arg-def>
|
</function-list-args>
|
|
<sequence>
|
|
<!-- Check if using coverage in which case we'll avoid doing parallele iterate -->
|
<!-- Check if 'emma.jar' exists -->
|
<call function="'GetEntry'">
|
{
|
'location' : STAF_REMOTE_HOSTNAME ,
|
'entry' : '%s/%s/lib/emma.jar' % (serverList[0].getDir(),OPENDSNAME) ,
|
'attribute' : 'TYPE'
|
}
|
</call>
|
<if expr="RC != 48">
|
<!-- 'emma.jar' exists -->
|
<script>coverage = True</script>
|
<else>
|
<script>coverage = False</script>
|
</else>
|
</if>
|
<message>'tools.xml - coverage=%s' % coverage</message>
|
|
<!-- Start the servers in the list -->
|
<if expr="coverage == True">
|
<sequence>
|
<message>'starting servers in sequence using "iterate"'</message>
|
<iterate var="server" in="serverList">
|
<sequence>
|
<message>
|
'Start DS on host %s to run on port %s' % (server.getHostname(),server.getPort())
|
</message>
|
|
<!--- Start DS -->
|
<call function="'StartDsWithScript'">
|
{ 'location' : server.getHostname(),
|
'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME)
|
}
|
</call>
|
|
<!--- Check that DS started -->
|
<call function="'isAlive'">
|
{ 'location' : server.getHostname(),
|
'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
|
'dsInstanceHost' : server.getHostname(),
|
'dsInstancePort' : server.getPort(),
|
'dsInstanceDn' : server.getRootDn(),
|
'dsInstancePswd' : server.getRootPwd(),
|
'noOfLoops' : 10 ,
|
'noOfMilliSeconds' : 2000
|
}
|
</call>
|
</sequence>
|
</iterate>
|
</sequence>
|
<else>
|
<sequence>
|
<message>'starting servers in parallel using "paralleliterate"'</message>
|
<paralleliterate var="server" in="serverList">
|
<sequence>
|
<message>
|
'Start DS on host %s to run on port %s' % (server.getHostname(),server.getPort())
|
</message>
|
|
<!--- Start DS -->
|
<call function="'StartDsWithScript'">
|
{ 'location' : server.getHostname(),
|
'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME)
|
}
|
</call>
|
|
<!--- Check that DS started -->
|
<call function="'isAlive'">
|
{ 'location' : server.getHostname(),
|
'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
|
'dsInstanceHost' : server.getHostname(),
|
'dsInstancePort' : server.getPort(),
|
'dsInstanceDn' : server.getRootDn(),
|
'dsInstancePswd' : server.getRootPwd(),
|
'noOfLoops' : 10 ,
|
'noOfMilliSeconds' : 2000
|
}
|
</call>
|
</sequence>
|
</paralleliterate>
|
</sequence>
|
</else>
|
</if>
|
</sequence>
|
</function>
|
|
|
<function name="stopServers">
|
<function-prolog>
|
This function stops a list of servers.
|
</function-prolog>
|
<function-list-args>
|
<function-arg-def name="serverList" type="required">
|
<function-arg-description>
|
List of the servers (instances of "Server" class) to be stopped.
|
</function-arg-description>
|
<function-arg-property name="type" value="Server-list"/>
|
</function-arg-def>
|
<function-arg-def name="noOfLoops"
|
type="optional"
|
default="10">
|
<function-arg-description>
|
Number of iterations (for isStopped())
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="noOfMilliSeconds"
|
type="optional"
|
default="2000">
|
<function-arg-description>
|
Number of seconds to wait between iterations (for isStopped())
|
</function-arg-description>
|
<function-arg-property name="type" value="seconds"/>
|
</function-arg-def>
|
</function-list-args>
|
|
<sequence>
|
<!-- Stop the servers in the list -->
|
<paralleliterate var="server" in="serverList">
|
<sequence>
|
<message>
|
'Stop DS on host %s running on port %s' % (server.getHostname(),server.getPort())
|
</message>
|
|
<!--- Stop DS -->
|
<call function="'StopDsWithScript'">
|
{ 'location' : server.getHostname(),
|
'dsHost' : server.getHostname(),
|
'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME),
|
'dsAdminPort' : server.getAdminPort(),
|
'dsBindDN' : server.getRootDn(),
|
'dsBindPwd' : server.getRootPwd(),
|
'noOfLoops' : noOfLoops,
|
'noOfMilliSeconds' : noOfMilliSeconds
|
}
|
</call>
|
</sequence>
|
</paralleliterate>
|
</sequence>
|
</function>
|
|
<!-- This function perform a search operation in a LDIF file -->
|
<function name="ldifSearchWithScript" scope="local">
|
<function-prolog>
|
This function perform a search operation in a LDIF file
|
</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="dsBaseDN" type="optional">
|
<function-arg-description>
|
The baseDN for the search operation
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsFilterFile" type="optional">
|
<function-arg-description>
|
File containing a list of search filter strings
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsLdifFile" type="required">
|
<function-arg-description>
|
LDIF file to use as the source data
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsOutputFile" type="optional">
|
<function-arg-description>
|
File to which the search results should be written
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsOverwriteExisting"
|
type="optional"
|
default="True">
|
<function-arg-description>
|
Overwrite the output file specified
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsSearchScope" type="optional">
|
<function-arg-description>
|
The scope of the search operation
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsTimeLimit" type="optional">
|
<function-arg-description>
|
Maximum length of time in seconds to allow for the search
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsSizeLimit" type="optional">
|
<function-arg-description>
|
Maximum number of entries to return from the search
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsDontWrap" type="optional">
|
<function-arg-description>
|
Do not wrap long lines
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Display this usage information
|
</function-arg-description>
|
<function-arg-property name="type" 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="dsFilter" type="optional">
|
<function-arg-description>
|
The filter for the search operation
|
</function-arg-description>
|
<function-arg-property name="type" value="filter"/>
|
</function-arg-def>
|
<function-arg-def name="dsAttributes" type="optional">
|
<function-arg-description>
|
Only return these attributes
|
</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="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
<sequence>
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/ldifsearch%s' % (dsBinPath,fileExt)
|
|
if dsBaseDN:
|
STAFCmdParamsList.append('-b "%s"' % dsBaseDN)
|
|
if dsFilterFile:
|
STAFCmdParamsList.append('-f %s' % dsFilterFile)
|
|
if dsLdifFile:
|
STAFCmdParamsList.append('-l %s' % dsLdifFile)
|
|
if dsOutputFile:
|
STAFCmdParamsList.append('-o %s' % dsOutputFile)
|
|
if dsOverwriteExisting:
|
STAFCmdParamsList.append('-O')
|
|
if dsSearchScope:
|
STAFCmdParamsList.append('-s %s' % dsSearchScope)
|
|
if dsTimeLimit:
|
STAFCmdParamsList.append('-t %s' % dsTimeLimit)
|
|
if dsSizeLimit:
|
STAFCmdParamsList.append('-z %s' % dsSizeLimit)
|
|
if dsDontWrap:
|
STAFCmdParamsList.append('-T')
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
if dsVersion:
|
STAFCmdParamsList.append('-V')
|
|
if dsFilter:
|
STAFCmdParamsList.append('"%s"' % dsFilter)
|
|
if dsAttributes:
|
STAFCmdParamsList.append('%s' % dsAttributes)
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<call function="'runCommand'" >
|
{
|
'name' : 'LDIF Search Script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'location' : location,
|
'expectedRC' : expectedRC
|
}
|
</call>
|
|
<return>STAXResult</return>
|
</sequence>
|
</function>
|
|
<!-- This function execute the encode-password tool -->
|
<function name="encodePasswordWithScript" scope="local">
|
<function-prolog>
|
This function execute the encode-password 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="authPwdSyntax" type="optional">
|
<function-arg-description>
|
Use the authentication password syntax.
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="clearPwd" type="optional">
|
<function-arg-description>
|
Specify the clear-text password.
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="encodedPwd" type="optional">
|
<function-arg-description>
|
Specify the encoded password.
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="encodedPwdFile" type="optional">
|
<function-arg-description>
|
Use the encoded password from the specified file.
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="clearPwdFile" type="optional">
|
<function-arg-description>
|
Use the clear-text password from the specified file.
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="listSchemes" type="optional">
|
<function-arg-description>
|
Display a list of the password storage schemes that are available
|
for use in the OpenDS server.
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="useCmpRC" type="optional">
|
<function-arg-description>
|
Use an exit code that indicates whether a given clear-text password
|
matched a provided encoded password.
|
Results are an exit code of 6 (COMPARE_TRUE) or
|
an exit code of 5 (COMPARE_FALSE).
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="storageScheme" type="optional">
|
<function-arg-description>
|
Specify the name of the password storage scheme to use when
|
encoding a clear-text password.
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Display this usage information
|
</function-arg-description>
|
<function-arg-property name="type" 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="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-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-map-args>
|
<sequence>
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/encode-password%s' % (dsBinPath,fileExt)
|
|
if authPwdSyntax:
|
STAFCmdParamsList.append('-a')
|
|
if clearPwd:
|
STAFCmdParamsList.append('-c %s' % clearPwd)
|
|
if encodedPwd:
|
STAFCmdParamsList.append('-e %s' % encodedPwd)
|
|
if encodedPwdFile:
|
STAFCmdParamsList.append('-E %s' % encodedPwdFile)
|
|
if clearPwdFile:
|
STAFCmdParamsList.append('-f %s' % clearPwdFile)
|
|
if listSchemes:
|
STAFCmdParamsList.append('-l')
|
|
if useCmpRC:
|
STAFCmdParamsList.append('-r')
|
|
if storageScheme:
|
STAFCmdParamsList.append('-s %s' % storageScheme)
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
if dsVersion:
|
STAFCmdParamsList.append('-V')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<call function="'runCommand'">
|
{
|
'name' : 'Encode password script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'location' : location,
|
'expectedRC' : expectedRC,
|
'knownIssue' : knownIssue
|
}
|
</call>
|
|
<return>STAXResult</return>
|
</sequence>
|
</function>
|
|
|
<!-- This function check task execution-->
|
<function name="checkTaskExecution" scope="local">
|
<function-prolog>
|
This functioncheck task execution
|
</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="outputToCheck" type="required">
|
<function-arg-description>
|
The output result of the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</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="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="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="dsInstancePswd" type="required">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
|
</function-map-args>
|
<sequence>
|
<script>
|
resultString = outputToCheck
|
resultSplitted = resultString.split()
|
taskId = None
|
for str in resultSplitted:
|
if len(str) == 17:
|
taskId = str
|
</script>
|
|
<message>
|
'Command task Id : %s' % taskId
|
</message>
|
|
<message>
|
'Check ldif command successfully completed with manage-task'
|
</message>
|
|
<script>checkRC=9999</script>
|
<loop from="1" to="10" var="loop" while="checkRC != 0">
|
<sequence>
|
<message>'LOOP %s' % loop</message>
|
<call function="'manage-tasks'">
|
{
|
'dsPath' : dsPath,
|
'dsInstanceHost' : dsInstanceHost ,
|
'dsInstanceAdminPort' : dsInstanceAdminPort,
|
'dsInstanceDn' : dsInstanceDn ,
|
'dsInstancePswd' : dsInstancePswd ,
|
'dsInfo' : taskId ,
|
'dsQuiet' : 'True' ,
|
'expectedRC' : 'noCheck'
|
}
|
</call>
|
|
<script>
|
returnString = STAXResult[0][1]
|
msg = 'Status Completed successfully'
|
</script>
|
|
<call function="'searchString'">
|
{
|
'expectedString' : msg ,
|
'returnString' : returnString ,
|
'expectedRC' : 'noCheck'
|
}
|
</call>
|
|
<script>
|
checkRC = STAXResult[0]
|
</script>
|
|
<call function="'Sleep'">
|
{ 'sleepForMilliSeconds' : 2000 }
|
</call>
|
|
</sequence>
|
</loop>
|
|
<call function="'checktestRC'">
|
{ 'returncode' : checkRC ,
|
'result' : "Task succeeds" ,
|
'expected' : 0
|
}
|
</call>
|
</sequence>
|
</function>
|
|
<!-- This function compares two LDIF files using the ldif-diff script -->
|
<function name="LdifDiffWithScript-new" scope="local">
|
<function-prolog>
|
This function compares two LDIF files and reports the differences
|
in LDIF format
|
</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="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="sourceLdif" type="required">
|
<function-arg-description>
|
LDIF file to use as the source data
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
<function-arg-def name="targetLdif" type="required">
|
<function-arg-description>
|
LDIF file to use as the target data
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
<function-arg-def name="outputLdif" type="required">
|
<function-arg-description>
|
File to which the diffs should be written
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
<function-arg-def name="overwriteExisting" type="optional" default="True">
|
<function-arg-description>
|
Overwrite existing output file rather than append to it
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="singleValueChanges" type="optional">
|
<function-arg-description>
|
Write each attribute-level change as a separate modification
|
per attribute value rather than one modification per entry
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</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="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-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-map-args>
|
<sequence>
|
<!-- Build the Command -->
|
<script>
|
foldersToCreate = []
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/ldif-diff%s' % (dsBinPath,fileExt)
|
|
if dsVersion:
|
STAFCmdParamsList.append('-V')
|
|
if sourceLdif:
|
STAFCmdParamsList.append('-s %s' % sourceLdif)
|
|
if targetLdif:
|
STAFCmdParamsList.append('-t %s' % targetLdif)
|
|
if outputLdif:
|
foldersToCreate.append(os.path.dirname(outputLdif))
|
STAFCmdParamsList.append('-o %s' % outputLdif)
|
|
if overwriteExisting:
|
STAFCmdParamsList.append('-O')
|
|
if singleValueChanges:
|
STAFCmdParamsList.append('-S')
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<call function="'createMultiFolders'">
|
{ 'location' : location,
|
'folderslist' : foldersToCreate
|
}
|
</call>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'">
|
{
|
'name' : 'Ldif diff script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'location' : location,
|
'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>
|