STAFCmd='%
s/
setup%s' % (dsPath,fileExt)
if dsEnableWindowsService:
STAFCmdParams=' '.join(STAFCmdParamsList)
'%s %s' % (STAFCmd, STAFCmdParams)
<
call function="'runCommand'">
'name' : 'Setup DS Script',
'arguments' : STAFCmdParams,
<
call function="'checkRC'">
<!-- This function configures DS using the configure-ds script --> <
function name="ConfigureDsWithScript">
This function configures a Directory Server using a script
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
function-
arg-
def name="dsVersion" type="optional">
<
function-
arg-
description>
Display Directory Server version information
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsLdapPort" type="optional">
<
function-
arg-
description>
Directory server LDAP port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsLdapsPort" type="optional">
<
function-
arg-
description>
Directory server LDAPS port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsEnableStartTLS" type="optional">
<
function-
arg-
description>
Specifies whether to enable or not StartTLS
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsJmxPort" type="optional">
<
function-
arg-
description>
Directory server JMX port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsKeyManagerProviderDN" type="optional">
<
function-
arg-
description>
DN of the key manager provider to use for SSL
and/
or StartTLS
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsTrustManagerProviderDN" type="optional">
<
function-
arg-
description>
DN of the trust manager provider to use for SSL
and/
or StartTLS
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsKeyManagerPath" type="optional">
<
function-
arg-
description>
Path of the keystore to be used by the key manager provider
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsCertNickName" type="optional">
<
function-
arg-
description>
Nickname of the certificate
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsBaseDN" type="optional">
<
function-
arg-
description>
Base DN (only single base DN supported).
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN"/>
<
function-
arg-
def name="dsRootUserDN" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN"/>
<
function-
arg-
def name="dsRootPassword" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="dsRootPasswordFile" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="dsHelp" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="help" value="option"/>
<!-- Build the Command --> dsBinPath='%s/%s' % (dsPath,fileFolder)
if dsKeyManagerProviderDN:
if dsTrustManagerProviderDN:
STAFCmdParams=' '.join(STAFCmdParamsList)
'%s %s' % (STAFCmd, STAFCmdParams)
<
call function="'runCommand'">
'name' : 'Setup DS Script',
'arguments' : STAFCmdParams
<
call function="'checkRC'">
<!-- This function starts DS using the start-ds script --> <
function name="StartDsWithScript">
This function starts a Directory Server
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsVersion" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsSystemInfo" type="optional">
<
function-
arg-
description>
Directory server system info
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsNoDetach" type="optional">
<
function-
arg-
description>
Do not detach directory server from process
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsHelp" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsBuildInfo" type="optional">
<
function-
arg-
description>
Directory server build information
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<!-- Build the Command --> dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%
s/
start-ds%s' % (dsBinPath,fileExt)
STAFCmdParams=' '.join(STAFCmdParamsList)
'%s %s' % (STAFCmd, STAFCmdParams)
<
call function="'runCommand'">
'arguments' : STAFCmdParams,
<
call function="'checkRC'">
{ 'returncode' : startRC ,
<
return>startResult</
return>
<!-- This function stops DS using the stop-ds script --> <
function name="StopDsWithScript">
This function starts a Directory Server using the script
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsHost" type="optional">
<
function-
arg-
description>
Directory server hostname or IP address
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
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 name="dsUseStartTLS" type="optional">
<
function-
arg-
description>
Use StartTLS for secure communication with the server
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsBindDN" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN"/>
<
function-
arg-
def name="dsBindPwd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="dsBindPwdFile" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
function-
arg-
def name="dsSaslOption" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsProxyAuthZID" type="optional">
<
function-
arg-
description>
Use the proxied authorization control with the given authorization ID
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsStopReason" type="optional">
<
function-
arg-
description>
Reason the server is being stopped or restarted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="dsRestart" type="optional">
<
function-
arg-
description>
Attempt to automatically restart the server once it has stopped
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsStopTime" type="optional">
<
function-
arg-
description>
Time to begin the shutdown in YYYYMMDDhhmmss format (local time)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="timestamp"/>
<
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 name="dsKeyStoreFile" type="optional">
<
function-
arg-
description>
Certificate keystore path
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="dsKeyStorePwd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="dsKeyStorePwdFile" type="optional">
<
function-
arg-
description>
Certificate keystore PIN file
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="dsTrustStoreFile" type="optional">
<
function-
arg-
description>
Certificate trust store path
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="dsTrustStorePwd" type="optional">
<
function-
arg-
description>
Certificate trust store PIN
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="dsTrustStorePwdFile" type="optional">
<
function-
arg-
description>
Certificate trust store PIN file
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="dsHelp" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<!-- Build the Command --> dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%
s/
stop-ds%s' % (dsBinPath,fileExt)
STAFCmdParams=' '.join(STAFCmdParamsList)
'%s %s' % (STAFCmd, STAFCmdParams)
<
call function="'runCommand'">
'name' : 'Stop DS Script',
'arguments' : STAFCmdParams
<
call function="'checkRC'">
<
call function="'Sleep'">
{ 'sleepForMilliSeconds' : 3000 }
<!-- This function restart DS using the stop-ds script --> <
function name="RestartDs">
This function restarts a Directory Server
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsHost" type="optional" default="'%s' % DIRECTORY_INSTANCE_HOST">
<
function-
arg-
description>
Directory server hostname or IP address
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPort" type="optional" default="'%s' % DIRECTORY_INSTANCE_PORT">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="port"/>
<
function-
arg-
def name="dsBindDN" type="optional" default="'%s' % DIRECTORY_INSTANCE_DN">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN"/>
<
function-
arg-
def name="dsBindPwd" type="optional" default="'%s' % DIRECTORY_INSTANCE_PSWD">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="dsBindPwdFile" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="extraParams" type="optional" default="''">
<
function-
arg-
description>
Optional extra parameters for specific test cases
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<!-- Build the Command --> dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%
s/
stop-ds%s' % (dsBinPath,fileExt)
STAFCmdParams=' '.join(STAFCmdParamsList)
'%s %s' % (STAFCmd, STAFCmdParams)
<
message>'******************************'</
message>
<
message>'*** Restarting the Server ***'</
message>
<
message>'******************************'</
message>
<
process name="'restart DS'">
<
location>'%s' % (location)</
location>
<
command>'%s' % (STAFCmd)</
command>
<
parms>'%s' % (STAFCmdParams)</
parms>
<
workdir>'%s' % dsBinPath</
workdir>
['PATH=/bin:/
usr/
bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
<
stderr mode="'stdout'"/>
<!-- Wait for DS to start --> <
call function="'isAlive'">
'dsInstanceHost' : dsHost ,
'dsInstancePort' : dsPort ,
'dsInstanceDn' : dsBindDN ,
'dsInstancePswd' : dsBindPwd ,
'noOfMilliSeconds' : 6000 }
<
message>'*** Restarting the Server is completed ***'</
message>
<
message>'***************************************'</
message>
<!-- Import LDIF file Function --> <
function name="importLdif">
This function performs an offline import of an ldif file
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="ldifFile" type="required">
<
function-
arg-
description>
Path to the LDIF file to be imported
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
<
function-
arg-
description>
Backend ID for the backend to import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="extraParams" type="optional" default="''">
<
function-
arg-
description>
Optional extra parameters for specific test cases
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
dsBinPath='%s/%s' % (dsPath,fileFolder)
'%
s/
import-ldif%s -l %s -n %s %s' % (dsBinPath,fileExt,ldifFile,backEnd,extraParams)
<
call function="'runCommand'">
'name' : 'Offline Import',
'arguments' : '-l %s -n %s %s' % (ldifFile,backEnd,extraParams)
<
call function="'checkRC'">
{ 'returncode' : importRC ,
'result' : importResult }
<
return>importRC</
return>
<!-- Import Function With Script--> <
function name="ImportLdifWithScript">
This function performs an offline import of an ldif file using the script
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsLdifFile" type="required">
<
function-
arg-
description>
Path to the LDIF file to be imported
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="dsTemplateFile" type="optional">
<
function-
arg-
description>
Path to a MakeLDIF template to use to generate the import data
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="dsAppend" type="optional">
<
function-
arg-
description>
Append to an existing database rather than overwriting it
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsReplaceExisting" type="optional">
<
function-
arg-
description>
Replace existing entries when appending to the database
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsBackEnd" type="optional">
<
function-
arg-
description>
Backend ID for the backend to import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="dsBranchDN" type="optional">
<
function-
arg-
description>
Base DN of a branch to include in the LDIF import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsIncludeBranch" type="optional">
<
function-
arg-
description>
Base DN of a branch to include in the LDIF import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsExcludeBranch" type="optional">
<
function-
arg-
description>
Base DN of a branch to exclude from the LDIF import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsIncludeAttribute" type="optional">
<
function-
arg-
description>
Attribute to include in the LDIF import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="attribute"/>
<
function-
arg-
def name="dsExcludeAttribute" type="optional">
<
function-
arg-
description>
Attribute to exclude in the LDIF import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="attribute"/>
<
function-
arg-
def name="dsIncludeFilter" type="optional">
<
function-
arg-
description>
Filter to identify entries to include in the LDIF import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filter"/>
<
function-
arg-
def name="dsExcludeFilter" type="optional">
<
function-
arg-
description>
Filter to identify entries to exclude from the LDIF import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filter"/>
<
function-
arg-
def name="dsRejectFile" type="optional">
<
function-
arg-
description>
Write rejected entries to the specified file
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="dsOverWriteRejects" type="optional">
<
function-
arg-
description>
Overwrite an existing rejects file rather than appending to it
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsRandomSeed" type="optional">
<
function-
arg-
description>
Seed for the MakeLDIF random number generator
</
function-
arg-
description>
<
function-
arg-
property name="type" value="seed"/>
<
function-
arg-
def name="dsSkipSchemaValidation" type="optional">
<
function-
arg-
description>
Skip schema validation during the LDIF import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsIsCompressed" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsIsEncrypted" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsQuiet" type="optional">
<
function-
arg-
description>
Use quiet mode (no output)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="dsHelp" type="optional">
<
function-
arg-
description>
Display usage information
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<!-- Build the Command --> dsBinPath='%s/%s' % (dsPath,fileFolder)
for InBranch in dsIncludeBranch:
for ExBranch in dsExcludeBranch:
for InAttr in dsIncludeAttribute:
for ExAttr in dsExcludeAttribute:
for InFilter in dsIncludeFilter:
for ExFilter in dsExcludeFilter:
if dsSkipSchemaValidation:
STAFCmdParams=' '.join(STAFCmdParamsList)
'%s %s' % (STAFCmd, STAFCmdParams)
<
call function="'runCommand'">
'name' : 'Offline Import Script',
'arguments' : STAFCmdParams
<
call function="'checkRC'">
<!-- Import Task Function --> <
function name="importLdifTask">
This function performs an on line import task of an ldif file
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsInstanceHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstancePort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstanceDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsInstancePswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="taskID" type="optional">
<
function-
arg-
description>
The identifier for the task
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="ldifFile" type="optional">
<
function-
arg-
description>
The name of the ldif file
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
<
function-
arg-
description>
Optional the name of the database backend
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="isCompressed" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional imported ldif data file compressed
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="isEncrypted" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional imported ldif data file encrypted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="rejectsFile" type="optional">
<
function-
arg-
description>
Optional name of rejects file
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="overwriteRejectsFile" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional name of rejects file
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="append" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional append imported ldif data
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="skipSchemaValidation" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional don't do schema validation on import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="replaceExisting" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional replace existing data
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="excludeBranches" type="optional" default="''">
<
function-
arg-
description>
Optional exclude branches
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="includeBranches" type="optional" default="''">
<
function-
arg-
description>
Optional include branches
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="excludeAttributes" type="optional" default="''">
<
function-
arg-
description>
Optional exclude attributes
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="includeAttributes" type="optional" default="''">
<
function-
arg-
description>
Optional include attributes
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="excludeFilters" type="optional" default="''">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="includeFilters" type="optional" default="''">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
taskLdif='%s/../%s/%s' % (dsPath,relativeDataDir,taskLdifFile)
tmpTaskLdif='%s/%s' % (logsTempDir,taskLdifFile)
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
<!-- Build the import task configuration object --> ldifLines.append('ds-task-import-overwrite-rejects: %s' % overwriteRejectsFile )
ldifLines.append('ds-task-import-skip-schema-validation: %s' % skipSchemaValidation )
for branch in excludeBranches:
for branch in includeBranches:
for attribute in excludeAttributes:
for attribute in includeAttributes:
for filter in excludeFilters:
for filter in includeFilters:
<!-- Write out the import-task ldif --> outfile = open(tmpTaskLdif,"w")
<!-- Copy the import-task ldif to remote host --> <
message>'Copy import task ldif (%s) to %s' % (tmpTaskLdif,taskLdif)</
message>
<
call function="'copyFile'">
{ 'location' : STAXServiceMachine,
'remotehost' : myLocation }
<!-- Start the task using ldap task interface --> <
call function="'StartLdapTask'">
{ 'location' : myLocation,
'taskLabel' : 'Online Import Task',
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd,
'dsTaskLdif' : taskLdif }
<!-- Check that the ldap task is completed --> <
if expr="STAFCmdRC == 0">
<
call function="'CheckLdapTask'">
{ 'location' : myLocation,
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd }
<!-- Check Import Function --> <
function name="checkImport">
This function verifies an import of an ldif file
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsHost" type="optional" default="DIRECTORY_INSTANCE_HOST">
<
function-
arg-
description>
Directory server hostname or IP address
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPort" type="optional" default="DIRECTORY_INSTANCE_PORT">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsDn" type="optional" default="DIRECTORY_INSTANCE_DN">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN"/>
<
function-
arg-
def name="dsPswd" type="optional" default="DIRECTORY_INSTANCE_PSWD">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="expectedEntries" type="required">
<
function-
arg-
description>
Entries expected to be present after import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="list"/>
<
function-
arg-
def name="missingEntries" type="optional" default="'NULL'">
<
function-
arg-
description>
Optional entries expected to be missing after import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="list"/>
<
function-
arg-
def name="expectedAttributes" type="optional" default="'NULL'">
<
function-
arg-
description>
Optional attributes expected to be present after import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="list"/>
<
function-
arg-
def name="missingAttributes" type="optional" default="'NULL'">
<
function-
arg-
description>
Optional attributes expected to be missing after import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="list"/>
<
function-
arg-
def name="suffix" type="optional" default="DIRECTORY_INSTANCE_SFX">
<
function-
arg-
description>
Optional main suffix for the import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="list"/>
<
function-
arg-
def name="startDS" type="optional" default="'yes'">
<
function-
arg-
description>
Optional start the Directory Server after import
</
function-
arg-
description>
<
function-
arg-
property name="type" value="list"/>
<!-- Assume that if DS is not started then there is no need to stop it --> <!-- Do we need to start the DS --> <
if expr="startDS == 'yes'">
<
call function="'StartDsWithScript'">
{ 'location' : myLocation,
<!-- Wait for DS to start --> <
call function="'isAlive'">
{ 'location' : myLocation,
'dsInstanceHost' : myhost ,
'dsInstancePort' : myport ,
'dsInstancePswd' : mypswd ,
'noOfMilliSeconds' : 2000 }
<!-- Search for expected entries --> <
iterate var="expectedEntry" in="expectedEntries">
<
call function="'SearchObject'">
{ 'location' : myLocation ,
'dsInstanceHost' : myhost ,
'dsInstancePort' : myport ,
'dsInstancePswd' : mypswd ,
'dsBaseDN' : '%s' % expectedEntry ,
'dsFilter' : 'objectclass=*'
<
call function="'checktestRC'">
<!-- Search for missing entries --> <
iterate var="missingEntry" in="missingEntries">
<
if expr="missingEntry == 'NULL'">
<
call function="'SearchObject'">
{ 'location' : myLocation ,
'dsInstanceHost' : myhost ,
'dsInstancePort' : myport ,
'dsInstancePswd' : mypswd ,
'dsBaseDN' : '%s' % missingEntry ,
'dsFilter' : 'objectclass=*' ,
<!-- Do we need to stop the Directory Server --> <
if expr="stopDS == 'yes'">
<
call function="'StopDsWithScript'">
{ 'location' : myLocation ,
<!-- Export LDIF Function --> <
function name="exportLdif">
This function performs an export to an ldif file on or off line
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="ldifFile" type="required">
<
function-
arg-
description>
The name of the ldif file to be written
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
<
function-
arg-
description>
The name of the database backend
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="extraParams" type="optional" default="''">
<
function-
arg-
description>
Optional extra parameters for specific test cases
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
dsBinPath='%s/%s' % (dsPath,fileFolder)
'%
s/
export-ldif%s -l %s -n %s %s' % (dsBinPath,fileExt,ldifFile,backEnd,extraParams)
<
call function="'runCommand'">
'arguments' : '-l %s -n %s %s' % (ldifFile,backEnd,extraParams)
<
call function="'checkRC'">
{ 'returncode' : exportRC ,
'result' : exportResult }
<
return>exportRC</
return>
<!-- Export Task Function --> <
function name="exportLdifTask">
This function performs an on line export task of an ldif file
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsInstanceHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstancePort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstanceDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsInstancePswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="taskID" type="optional">
<
function-
arg-
description>
The identifier for the task
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="ldifFile" type="optional">
<
function-
arg-
description>
The name of the ldif file
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
<
function-
arg-
description>
Optional the name of the database backend
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="isCompressed" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional exported ldif data file compressed
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="isEncrypted" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional exported ldif data file encrypted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="append" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional append exported ldif data
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="excludeBranches" type="optional" default="''">
<
function-
arg-
description>
Optional exclude branches
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="includeBranches" type="optional" default="''">
<
function-
arg-
description>
Optional include branches
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="excludeAttributes" type="optional" default="''">
<
function-
arg-
description>
Optional exclude attributes
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="includeAttributes" type="optional" default="''">
<
function-
arg-
description>
Optional include attributes
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="excludeFilters" type="optional" default="''">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="includeFilters" type="optional" default="''">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
<
function-
arg-
def name="isSignedHash" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional generate a signed hash of the export data
</
function-
arg-
description>
<
function-
arg-
property name="type" value="option"/>
taskLdif='%s/../%s/%s' % (dsPath,relativeDataDir,taskLdifFile)
tmpTaskLdif='%s/%s' % (logsTempDir,taskLdifFile)
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
<!-- Build the export task configuration object --> for branch in excludeBranches:
for branch in includeBranches:
for attribute in excludeAttributes:
for attribute in includeAttributes:
for filter in excludeFilters:
for filter in includeFilters:
<!-- Write out the export-task ldif --> outfile = open(tmpTaskLdif,"w")
<!-- Copy the export-task ldif to remote host --> <
message>'Copy export task ldif (%s) to %s' % (tmpTaskLdif,taskLdif)</
message>
<
call function="'copyFile'">
{ 'location' : STAXServiceMachine,
'remotehost' : myLocation }
<!-- Start the task using ldap task interface --> <
call function="'StartLdapTask'">
{ 'location' : myLocation,
'taskLabel' : 'Online Export Task',
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd,
'dsTaskLdif' : taskLdif }
<!-- Check that the task is completed --> <
if expr="STAFCmdRC == 0">
<
call function="'CheckLdapTask'">
{ 'location' : myLocation,
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd }
This function performs an off line backup
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
<
function-
arg-
description>
Optional the name of the database backend
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="backupDir" type="required">
<
function-
arg-
description>
The directory where the backup files will be placed
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="extraParams" type="optional" default="''">
<
function-
arg-
description>
Optional extra parameters for specific test cases
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
dsBinPath='%s/%s' % (dsPath,fileFolder)
'backup%s -n %s -d %s %s' % (fileExt,backEnd,backupDir,extraParams)
<
call function="'runCommand'">
{ 'name' : 'Offline Backup',
'command' : '%
s/
backup%s' % (dsBinPath,fileExt),
'arguments' : '-d %s -n %s %s' % (backupDir,backEnd,extraParams)
<
call function="'checkRC'">
{ 'returncode' : backupRC ,
'result' : backupResult }
<
return>backupRC</
return>
<!-- Backup Task Function --> <
function name="backupTask">
This function performs an on line backup task
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsInstanceHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstancePort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstanceDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsInstancePswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
def name="taskID" type="optional">
<
function-
arg-
description>
The identifier for the task
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="backupDir" type="required">
<
function-
arg-
description>
Path to the target directory for the backup file(s)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
function-
arg-
def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
<
function-
arg-
description>
Optional the name of the database backend
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="backupAll" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional back up all backends in the server
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="backupIncremental" type="optional">
<
function-
arg-
description>
Optional perform an incremental backup rather than a full backup
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="backupIncrementalId" type="optional">
<
function-
arg-
description>
Optional use the provided identifier for the backup
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="Compress" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional backup contents compressed
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="Encrypt" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional backup contents encrypted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="signHash" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional generate a signed hash of the backup data
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="hash" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional generate a hash of the backup data
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
taskLdif='%s/../%s/%s' % (dsPath,relativeDataDir,taskLdifFile)
tmpTaskLdif='%s/%s' % (logsTempDir,taskLdifFile)
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
<!-- Build the backup task configuration object --> ldifLines.append('ds-task-backup-incremental-base-id: %s' % backupIncrementalId )
<!-- Write out the backup-task ldif --> outfile = open(tmpTaskLdif,"w")
<!-- Copy the backup-task ldif to remote host --> <
message>'Copy backup task ldif file.'</
message>
<
call function="'copyFile'">
{ 'location' : STAXServiceMachine,
'remotehost' : myLocation }
<!-- Start the task using ldap task interface --> <
call function="'StartLdapTask'">
{ 'location' : myLocation,
'taskLabel' : 'Online Backup Task',
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd,
'dsTaskLdif' : taskLdif }
<!-- Check that the ldap task is completed --> <
if expr="STAFCmdRC == 0">
<
call function="'CheckLdapTask'">
{ 'location' : myLocation,
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd }
<!-- Restore Function --> <
function name="restore">
This function performs an off line restore
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="backupDir" type="required">
<
function-
arg-
description>
The directory where the backup files will be placed
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="extraParams" type="optional" default="''">
<
function-
arg-
description>
Optional extra parameters for specific test cases
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
dsBinPath='%s/%s' % (dsPath,fileFolder)
'restore%s -d %s %s' % (fileExt,backupDir,extraParams)
<
call function="'runCommand'">
{ 'name' : 'Offline Restore',
'command' : '%
s/
restore%s' % (dsBinPath,fileExt),
'arguments' : '-d %s %s' % (backupDir,extraParams)
<
call function="'checkRC'">
{ 'returncode' : restoreRC ,
'result' : restoreResult }
<
return>restoreRC</
return>
<!-- Restore Task Function --> <
function name="restoreTask">
This function performs an on line restore task of a backup file
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsInstanceHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstancePort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstanceDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsInstancePswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
def name="taskID" type="optional">
<
function-
arg-
description>
The identifier for the task
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="backupDir" type="required">
<
function-
arg-
description>
The name of the backup directory
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="backupId" type="optional">
<
function-
arg-
description>
Optional the name of the backupId
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="verify" type="optional" default="'FALSE'">
<
function-
arg-
description>
Optional verify the contents of the backup but do not restore it
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
taskLdif='%s/../%s/%s' % (dsPath,relativeDataDir,taskLdifFile)
tmpTaskLdif='%s/%s' % (logsTempDir,taskLdifFile)
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
<!-- Build the restore task configuration object --> <!-- Write out the restore-task ldif --> outfile = open(tmpTaskLdif,"w")
<!-- Copy the restore-task ldif to remote host --> <
message>'Copy restore task ldif file.'</
message>
<
call function="'copyFile'">
{ 'location' : STAXServiceMachine,
'remotehost' : myLocation }
<!-- Start the task using ldap task interface --> <
call function="'StartLdapTask'">
{ 'location' : myLocation,
'taskLabel' : 'Online Restore Task',
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd,
'dsTaskLdif' : taskLdif }
<!-- Check that the ldap task is completed --> <
if expr="STAFCmdRC == 0">
<
call function="'CheckLdapTask'">
{ 'location' : myLocation,
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd }
<!-- Shutdown Task Function --> <
function name="shutdownTask">
This function performs an on line export task for shutdown of the directory
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsInstanceHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstancePort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstanceDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsInstancePswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="taskID" type="optional">
<
function-
arg-
description>
The identifier for the task
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
taskLdif='%s/../%s/%s' % (dsPath,relativeDataDir,taskLdifFile)
tmpTaskLdif='%s/%s' % (logsTempDir,taskLdifFile)
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
<!-- Build the shutdown task configuration object --> <!-- Write out the shutdown-task ldif --> outfile = open(tmpTaskLdif,"w")
<!-- Copy the shutdown-task ldif to remote host --> <
message>'Copy shutdown task ldif (%s) to %s' % (tmpTaskLdif,taskLdif)</
message>
<
call function="'copyFile'">
{ 'location' : STAXServiceMachine,
'remotehost' : myLocation }
<!-- Start the task using ldap task interface --> <
call function="'StartLdapTask'">
{ 'location' : myLocation,
'taskLabel' : 'Online Export Task',
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd,
'dsTaskLdif' : taskLdif }
<
return>STAFCmdRC</
return>
<!-- Restart Task Function --> <
function name="restartTask">
This function performs an on line export task for restart of the directory
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsInstanceHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstancePort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstanceDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsInstancePswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="taskID" type="optional">
<
function-
arg-
description>
The identifier for the task
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
taskLdif='%s/../%s/%s' % (dsPath,relativeDataDir,taskLdifFile)
tmpTaskLdif='%s/%s' % (logsTempDir,taskLdifFile)
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
<!-- Build the restart task configuration object --> <!-- Write out the restart-task ldif --> outfile = open(tmpTaskLdif,"w")
<!-- Copy the restart-task ldif to remote host --> <
message>'Copy restart task ldif (%s) to %s' % (tmpTaskLdif,taskLdif)</
message>
<
call function="'copyFile'">
{ 'location' : STAXServiceMachine,
'remotehost' : myLocation }
<!-- Start the task using ldap task interface --> <
call function="'StartLdapTask'">
{ 'location' : myLocation,
'taskLabel' : 'Online Export Task',
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd,
'dsTaskLdif' : taskLdif }
<!--- Check that DS started --> <
if expr="STAFCmdRC == 0">
<
call function="'isAlive'">
'noOfMilliSeconds' : 2000 }
<
return>STAFCmdRC</
return>
<!-- Add Schema Task Function --> <
function name="addSchemaTask">
This function performs a dynamic schema add task
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsInstanceHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstancePort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstanceDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsInstancePswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
def name="taskID" type="optional">
<
function-
arg-
description>
The identifier for the task
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="ldifFile" type="required">
<
function-
arg-
description>
The name of the ldif file that contains the schema updates
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
taskLdif='%s/../%s/%s' % (dsPath,relativeDataDir,taskLdifFile)
tmpTaskLdif='%s/%s' % (logsTempDir,taskLdifFile)
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
<!-- Build the schema task configuration object --> <!-- Write out the schema-task ldif --> outfile = open(tmpTaskLdif,"w")
<!-- Copy the schema-task ldif to remote host --> <
message>'Copy schema task ldif file.'</
message>
<
call function="'copyFile'">
{ 'location' : STAXServiceMachine,
'remotehost' : myLocation }
<!-- Copy the schema update ldif to remote host's config/schema directory --> <
message>'Copy schema update ldif file.'</
message>
<
call function="'copyFile'">
{ 'location' : myLocation,
'srcfile' : '%
s/
schema/
ldifs/%s' % (logsRemoteDataDir,ldifFile),
'destfile' : '%s/%
s/
config/
schema/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME,ldifFile),
'remotehost' : myLocation }
<!-- Start the task using ldap task interface --> <
call function="'StartLdapTask'">
{ 'location' : myLocation,
'taskLabel' : 'Online Schema Task',
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd,
'dsTaskLdif' : taskLdif }
<!-- Check that the ldap task is completed --> <
call function="'CheckLdapTask'">
{ 'location' : myLocation,
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd }
<!-- Add Leave Lockdown Task Function --> <
function name="leaveLockdownTask">
This function performs a leave lockdown task
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsInstanceHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstancePort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstanceDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsInstancePswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
def name="taskID" type="optional">
<
function-
arg-
description>
The identifier for the task
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
taskLdif='%s/../%s/%s' % (dsPath,relativeDataDir,taskLdifFile)
tmpTaskLdif='%s/%s' % (logsTempDir,taskLdifFile)
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
<!-- Build the schema task configuration object --> <!-- Write out the task ldif --> outfile = open(tmpTaskLdif,"w")
<!-- Copy the task ldif to remote host --> <
message>'Copy task ldif file.'</
message>
<
call function="'copyFile'">
{ 'location' : STAXServiceMachine,
'remotehost' : myLocation }
<!-- Copy the schema update ldif to remote host's config/schema directory --> <message>'Copy update ldif file.'</message> <call function="'copyFile'"> { 'location' : myLocation, 'srcfile' : '%s/schema/ldifs/%s' % (logsRemoteDataDir,ldifFile), 'destfile' : '%s/%s/config/schema/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME,ldifFile), 'remotehost' : myLocation } <!-- Start the task using ldap task interface --> <
call function="'StartLdapTask'">
{ 'location' : myLocation,
'taskLabel' : 'Online Schema Task',
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd,
'dsTaskLdif' : taskLdif }
<!-- Check that the ldap task is completed --> <
call function="'CheckLdapTask'">
{ 'location' : myLocation,
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd }
<!-- Total Update Task Function --> <
function name="TotalUpdateTask">
This function performs a total update of a replication domain
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsInstanceHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstancePort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsInstanceDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsInstancePswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
def name="taskID" type="optional">
<
function-
arg-
description>
The identifier for the task
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="domainDN" type="required">
<
function-
arg-
description>
The dn of the domain to be replicated
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="replicaServerID" type="required">
<
function-
arg-
description>
The id of the replica server
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
taskLdif='%s/../%s/%s' % (dsPath,relativeDataDir,taskLdifFile)
tmpTaskLdif='%s/%s' % (logsTempDir,taskLdifFile)
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
<!-- Build the total update task configuration object --> <!-- Write out the totalupdate-task ldif --> outfile = open(tmpTaskLdif,"w")
<!-- Copy the totalupdate-task ldif to remote host --> <
message>'Copy totalupdate task ldif file.'</
message>
<
call function="'copyFile'">
{ 'location' : STAXServiceMachine,
'remotehost' : myLocation }
STAXCode, STAXReason=STAXResult
<
if expr="STAXCode != 0">
<
message level="'error'">
'Copy of totalupdate task failed (STAXCode=%s)' % STAXCode
<
return>[STAXCode, STAXReason]</
return>
<!-- Start the task using ldap task interface --> <
call function="'StartLdapTask'">
{ 'location' : myLocation,
'taskLabel' : 'Online Total Update Task',
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd,
'dsTaskLdif' : taskLdif }
STAXCode, STAXReason=STAXResult
<
if expr="STAXCode != 0">
'Start of totalupdate task failed (Code=%s)' % STAXCode
<
return>[STAXCode, STAXReason]</
return>
<!-- Check that the ldap task is completed --> <
call function="'CheckLdapTask'">
{ 'location' : myLocation,
'dsHost' : dsInstanceHost,
'dsPort' : dsInstancePort,
'dsBindDn' : dsInstanceDn,
'dsBindPswd' : dsInstancePswd }
STAXCode, STAXReason=STAXResult
<
if expr="STAXCode != 0">
'Check of totalupdate task failed (Code=%s)' % STAXCode
<
return>[STAXCode, STAXReason]</
return>
STAXReason='%s: Success' % STAXCurrentFunction
<
return>[STAXCode, STAXReason]</
return>
<
function name="StartLdapTask">
This function starts a task using the ldap task interface
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="taskLabel" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsPort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsBindDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsBindPswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="dsTaskLdif" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<!-- Build the Modify Command --> dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmdParams=' '.join(STAFCmdParamsList)
'%s %s' % (STAFCmd, STAFCmdParams)
<!-- Perform Task with ldapmodify --> <
process name="taskLabel">
<
location>'%s' % myLocation</
location>
<
command>'%s' % STAFCmd</
command>
<
parms>'%s' % STAFCmdParams</
parms>
<
workdir>'%s' % dsBinPath</
workdir>
['PATH=/bin:/
usr/
bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
<
stdin>'%s' % dsTaskLdif</
stdin>
<
stderr mode="'stdout'"/>
<
call function="'checkRC'">
{ 'returncode' : STAFCmdRC ,
'result' : STAFCmdResult }
<
return>[STAFCmdRC, STAFCmdResult[0][1]]</
return>
<
function name="CheckLdapTask">
This function checks a task using the ldap task interface
<
function-
arg-
def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsTaskDn" type="required">
<
function-
arg-
description>
Dn of the task to be performed
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
<
function-
arg-
description>
Pathname to installation root
</
function-
arg-
description>
<
function-
arg-
property name="type" value="pathname"/>
<
function-
arg-
def name="dsHost" type="optional">
<
function-
arg-
description>
Directory server host name
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsPort" type="optional">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="dsBindDn" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="dn"/>
<
function-
arg-
def name="dsBindPswd" type="optional">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
dsBinPath='%s/%s' % (dsPath,fileFolder)
dsFilter='"objectclass=*"'
dsAttribute='ds-task-state'
dsAttribute='ds-task-log-message'
STAFCmdParams=' '.join(STAFCmdParamsList)
successPattern =
re.compile('ds-task-state: COMPLETED_SUCCESSFULLY')
stopErrPattern =
re.compile('ds-task-state: STOPPED_BY_ERROR')
<!-- Wait for the task to be COMPLETED_SUCCESSFULLY --> <
script>taskRC=1</
script>
<
loop from="1" to="10" while="taskRC != 0">
'%s %s' % (STAFCmd, STAFCmdParams)
<!-- Search for task status --> <
call function="'runCommand'">
{ 'name' : 'Search On line Import Task',
'arguments' : STAFCmdParams,
<
if expr='re.search(successPattern, STAFCmdResult[0][1]) != None'>
<
script>taskRC=0</
script>
<
return>[taskRC, STAFCmdResult[0][1]]</
return>
<
elseif expr='re.search(stopErrPattern, STAFCmdResult[0][1]) != None'>
<
message level="'error'">
<
return>[taskRC, STAFCmdResult[0][1]]</
return>
<
message level="'Warning'">
<
call function="'checkRC'">
{ 'returncode' : STAFCmdRC ,
'result' : STAFCmdResult }
<
call function="'Sleep'">
{ 'sleepForMilliSeconds' : '2000' }
<
return>[taskRC, STAFCmdResult[0][1]]</
return>