<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
! 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 ! You can obtain a copy of the license at ! 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 ! 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] ! Copyright 2007-2010 Sun Microsystems, Inc. ! Portions Copyright 2011-2013 ForgeRock AS. <
function name="createTopology">
This function creates the topology required by the Test
Group/
Suite.
<
function-
arg-
def name="topologyDescFile" <
function-
arg-
description>
Topology Description file
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filePath"/>
<
function-
arg-
def name="initialiseInstance" <
function-
arg-
description>
Specifies whether the instance should be initialised with
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="sharedDataFolder" <
function-
arg-
description>
Specifies a relative folder that holds the shared data for the tests
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="fileExtensions" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="splitReplicationServers" <
function-
arg-
description>
Specifies whether the replication servers should be split from the
ldap servers and be configured on separate instances.
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
sharedDataFolder=CurrentTestPath['group']
_topologyReplServerList = []
<
call function="'prepareInstanceCreation'">
{ 'groupDataDir' : sharedDataFolder,
'fileExtensions' : fileExtensions
<
if expr="topologyDescFile == None">
<!-- SINGLE instance deployment: read parameters from config.py (done 'SINGLE instance deployment: read parameters from
config.py'
<
call function="'createInstance'" />
<
if expr="RC == 0 and initialiseInstance == True">
<!-- Load the server with default data --> <
import machine="STAF_LOCAL_HOSTNAME" <
call function="'main_quickstart'"/>
<!-- MULTIPLE instance deployment: read parameters from 'MULTIPLE instance deployment: read parameters from %s' \
<!-- Parse the topology description file and set <
call function="'readTopology'">
{ 'file' : topologyDescFile }
<
if expr="splitReplicationServers">
'Replication servers will be split from ldap servers.'
<
iterate var="server" in="_topologyServerList" indexvar="i">
_splitServerList = _topologyServerList
'Number of server instances required by the deployment: %s' \
<
iterate var="server" in="_splitServerList">
<!-- Create the instance--> <
call function="'createInstance'">
<
function name="prepareInstanceCreation">
This function prepares locally the necessary
files to create an instance: data zip file and OpenDS zip file.
<
function-
arg-
def name="groupDataDir" <
function-
arg-
description>
Specifies a relative folder that holds the shared data for the test
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="fileExtensions" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="list"/>
<
function-
arg-
def name="javaProjects" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="list"/>
<!-- ON LOCAL HOST: get data ready to copy to remote host --> # Original source location of the data files
sourceTestsGroupDir='%s/%s' % (
source.data,groupDataDir)
# Location of data files are staged locally before transit to SUT
localTestsGroupDir ='%s/%s' % (
local.data, groupDataDir)
# Location of data files are copied to on the remote SUT
remoteTestsGroupDir='%s/%s' % (
remote.data,groupDataDir)
<!-- Stage static data--> <
call function="'stageStaticDataFiles'">
{ 'customFileExtensions' : fileExtensions,
'testGroupDirName' : groupDataDir }
<!-- Stage (*/.java) files --> <
call function="'stageJavaFiles'">
{ 'customJavaProjects' : javaProjects }
<
call function="'stageSNMPFiles'"/>
<!-- Delete the any existing testdata archive --> <
call function="'deleteFile'">
{ 'location' : STAXServiceMachine,
<!-- Zip up local testdata files for transit to SUT --> <
call function="'zipUpFile'">
{ 'location' : STAXServiceMachine,
<
function name="createInstance">
This function creates an instance on a given host.
It copies both data and OpenDS zip files onto the host,
unzips them, and configures OpenDS.
<
function-
arg-
def name="dsHost" default="DIRECTORY_INSTANCE_HOST">
<
function-
arg-
description>
Hostname where the instance is to be created
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsDir" default="DIRECTORY_INSTANCE_DIR">
<
function-
arg-
description>
Directory where OpenDS will be installed
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
function-
arg-
def name="dsPort" 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="dsAdminPort" 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 name="dsSslPort" <
function-
arg-
description>
Directory Server SSL port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsJmxPort" <
function-
arg-
description>
Directory Server JMX port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number"/>
<
function-
arg-
def name="dsBindDN" default="DIRECTORY_INSTANCE_DN">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN"/>
<
function-
arg-
def name="dsBindPwd" default="DIRECTORY_INSTANCE_PSWD">
<
function-
arg-
description>
Directory Server SSL port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="dsBaseDN" default="DIRECTORY_INSTANCE_SFX">
<
function-
arg-
description>
Directory Server base suffix dn
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN"/>
'Create an instance on remote host %s' % dsHost
<!-- ON REMOTE HOST: copy files, unzip, configure instance --> <!--- Delete folder if it exists on remote host--> 'Delete existing instance folder %s on remote host %s' % (dsDir,dsHost)
<
call function="'deleteFolder'">
'foldername' : '%s' % (dsDir)
<!--- Create folder on remote host --> 'Create new instance folder %s on remote host %s' % (dsDir,dsHost)
<
call function="'createFolder'">
'foldername' : '%s' % dsDir
<!--- Create folder on remote host --> 'Create new instance temp folder %
s/
temp on remote host %s' % (dsDir,dsHost)
<
call function="'createFolder'">
'foldername' : '%
s/
temp' % dsDir
<!--- Copy staging data to remote host --> <
call function="'copyFile'">
<!--- Unzip contents of staging data on remote host --> 'Extract contents of test data %s on %s on remote host' \
<
call function="'unZipFile'">
<!-- Check if DS Copy zip exists --> <
call function="'GetEntry'">
'entry' : '%s/%s' % (dsDir,ZIPNAME),
<!--- Copy DS Copy zip file --> 'Copy DS zip archive %s/%s to %s' % (ZIPPATH,ZIPNAME,dsHost)
<
call function="'copyFile'">
{ 'srcfile' : '%s/%s' % (ZIPPATH,ZIPNAME),
'destfile' : '%s/%s' % (dsDir,ZIPNAME),
'DS zip archive %s/%s already exists, nothing to do' % (dsDir,ZIPNAME)
<!--- Install DS Extract zip file --> 'Extract DS zip archive to %s on %s' % (dsDir,dsHost)
<
call function="'unZipFile'">
'zipfile' : '%s/%s' % (dsDir,ZIPNAME),
<!-- fixMe: Windows Services are not enabled --> <
if expr="is_windows_platform(dsHost)">
<!--- In IPS mode, at this point we need to overwrite dsDir --> <
if expr="IPS_PKG == True">
dsDir = DIRECTORY_INSTANCE_BIN
'Set up DS on %s : %s/%s' % (dsHost,dsDir,OPENDSNAME)
<
call function="'SetUpDsWithScript'">
'dsPath' : '%s/%s' % (dsDir, OPENDSNAME),
'dsAdminPort' : dsAdminPort,
'dsEnableWindowsService' : enableWindowsService,
<
call function="'checkRC'">
<
if expr="returncode == 0">
'Failed to create instance.'
<
function name="DEPRECATEDconfigureReplication">
This function configures replication in a given server.
<
function-
arg-
def name="syncserverMap" type="required">
<
function-
arg-
description>
Map containing a Server class instance representing the server to
</
function-
arg-
description>
<
function-
arg-
property name="type" value="map"/>
syncserver = syncserverMap['instance']
write_replication_conf_ldif_file(filePath, syncserver)
'Configure replication on server on host %s at directory %s' \
<!-- Copy the replication_conf ldif to remote host --> <
call function="'copyFile'">
'destfile' : '%s/%s' % (dataDir,filename),
<!--- Add replication configuration entries to config.ldif in server --> remoteFilePath = '%s/%s' % (dataDir, filename)
<
call function="'StartDsWithScript'">
'dsPath' : syncserverPath
<
call function="'checkRC'">
'Add replication configuration entries in %s' % remoteFilePath
<
call function="'addEntry'">
'dsPath' : syncserverPath,
'entryToBeAdded' : remoteFilePath
<
call function="'checkRC'">
<
call function="'StopDsWithScript'">
'dsPath' : syncserverPath,
<
call function="'checkRC'">
<
function name="configureReplication">
This function configures replication in a given server.
<
function-
arg-
def name="syncserver" type="required">
<
function-
arg-
description>
Server class instance representing the server to configure.
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Server"/>
<!--- Configure replication using dsconfig --> 'Configure replication on server on host %s at directory %s' \
<
call function="'StartDsWithScript'">
'dsPath' : syncserverPath
'List synchronization providers'
<
call function="'listSyncProviders'">
'dsPath' : syncserverPath,
<
if expr="replicationServer">
'Create replication server listening on port: %s' \
<
call function="'createReplicationServer'">
'dsPath' : syncserverPath,
<
iterate var="suffix" in="replicatedSuffixList" indexvar="i">
<
call function="'createMultimasterDomain'">
'dsPath' : syncserverPath,
'domainName' : 'SUFFIX-%s' % i,
<
call function="'StopDsWithScript'">
'dsPath' : syncserverPath,
<!-- Enable replication between servers using dsreplication --> <
function name="enableReplication">
This function enables replication between servers using dsreplication.
<
function-
arg-
def name="location" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsPath" 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 name="dsInstanceHost" 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 name="dsInstanceAdminPort" type="required">
<
function-
arg-
description>
Directory server admin port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="dsInstanceDn" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN" />
<
function-
arg-
def name="dsInstancePswd" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
<
function-
arg-
def name="dsReplicationPort" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="dsSecureReplication" <
function-
arg-
description>
Encrypt communications over dsReplicationPort (secure replication)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
function-
arg-
def name="dsOnlyLdapServer" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
function-
arg-
def name="dsOnlyReplServer" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
function-
arg-
def name="refInstanceHost" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
Reference Directory server hostname or IP address
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="refInstanceAdminPort" type="required">
<
function-
arg-
description>
Reference Directory server admin port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="refInstanceDn" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN" />
<
function-
arg-
def name="refInstancePswd" type="required">
<
function-
arg-
description>
Reference server Bind password
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
<
function-
arg-
def name="refReplicationPort" <
function-
arg-
description>
Reference server Replication port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="refSecureReplication" <
function-
arg-
description>
Encrypt communications over refReplicationPort (secure replication)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
function-
arg-
def name="refOnlyLdapServer" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
function-
arg-
def name="refOnlyReplServer" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
function-
arg-
def name="replicationDnList" type="required">
<
function-
arg-
description>
DN of the replicated suffix
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN list" />
<
function-
arg-
def name="adminUID" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="UID" />
<
function-
arg-
def name="adminPswd" <
function-
arg-
description>
Global Administrator password
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
<
function-
arg-
def name="noSchemaReplication" <
function-
arg-
description>
Do not enable schema replication
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
function-
arg-
def name="useSecondServerAsSchemaSource" <
function-
arg-
description>
Take the refInstanceHost as the source for the schema initialisation
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
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" />
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/%s%s' % (dsBinPath,DSREPLICATION,fileExt)
for dn in replicationDnList:
if useSecondServerAsSchemaSource:
STAFCmdParams=' '.join(STAFCmdParamsList)
<
call function="'runCommand'">
{ 'name' : 'Enable Replication',
'arguments' : STAFCmdParams,
<!-- Initialize replicated suffix with the contents of a source server using <
function name="initializeReplication">
This function initializes replicated suffixes with the contents
of a source server using dsreplication.
<
function-
arg-
def name="location" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsPath" 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 name="dsInstanceHost" <
function-
arg-
description>
Directory server hostname or IP address
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsInstanceAdminPort" <
function-
arg-
description>
Directory server admin port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="sourceInstanceHost" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
Source Directory server hostname or IP address
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="sourceInstanceAdminPort" type="required">
<
function-
arg-
description>
Source Directory server admin port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="replicationDnList" type="required">
<
function-
arg-
description>
DN of the replicated suffix
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN list" />
<
function-
arg-
def name="adminUID" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="UID" />
<
function-
arg-
def name="adminPswd" <
function-
arg-
description>
Global Administrator password
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
<
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" />
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/%s%s' % (dsBinPath,DSREPLICATION,fileExt)
if sourceInstanceAdminPort:
for dn in replicationDnList:
STAFCmdParams=' '.join(STAFCmdParamsList)
<
call function="'runCommand'">
{ 'name' : 'Initialize Replication',
'arguments' : STAFCmdParams,
'expectedRC' : expectedRC
<!-- Disable replication for given baseDN on server using dsreplication --> <
function name="disableReplication">
This function disables replication for a given baseDN on a server using
<
function-
arg-
def name="location" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsPath" 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 name="dsInstanceHost" 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 name="dsInstanceAdminPort" type="required">
<
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="replicationDnList" <
function-
arg-
description>
DN of the replicated suffix
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN list" />
<
function-
arg-
def name="disableReplServer" <
function-
arg-
description>
Disable replication server (remove configuration, changelot and port)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
function-
arg-
def name="disableAll" <
function-
arg-
description>
Disable replication completely (domain, repl-server, changelog and
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
function-
arg-
def name="adminUID" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="UID" />
<
function-
arg-
def name="adminPswd" <
function-
arg-
description>
Global Administrator password
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
<
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" />
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/%s%s' % (dsBinPath,DSREPLICATION,fileExt)
for dn in replicationDnList:
STAFCmdParams=' '.join(STAFCmdParamsList)
<
call function="'runCommand'">
{ 'name' : 'Disable Replication',
'arguments' : STAFCmdParams,
<
function name="readTopology">
This function reads the topology from a given file.
It parses the topology description file and sets _topologyServerList, a
list of the servers that form the topology.
<
function-
arg-
def name="file" type="required">
<
function-
arg-
description>
File containing the topology description.
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filePath"/>
'Parse file %s for topology parameters' % file
hostname = line[
line.find('Hostname') + 9:].strip()
dir = line[
line.find('Directory') + 10:].strip()
adminport = line[
line.find('Adminport') + 10:].strip()
sslport = line[
line.find('Sslport') + 8:].strip()
jmxport = line[
line.find('Jmxport') + 8:].strip()
rootDn = line[
line.find('RootDn') + 7:].strip()
rootPwd = line[
line.find('RootPwd') + 8:].strip()
baseDn = line[
line.find('BaseDn') + 7:].strip()
changelogport = line[
line.find('Changelogport') + 14:].strip()
server = Server(hostname, dir, port, adminport, sslport, jmxport,
if changelogport != None:
changelogServer = ChangelogServer(changelogport, serverId)
for item in changelogList:
for suffix in suffixList:
synchroSuffix = SynchronizedSuffix(suffix, serverId)
for item in changelogList:
server = Server(hostname, dir, port, adminport, sslport, jmxport,
if changelogport != None:
changelogServer = ChangelogServer(changelogport, serverId)
for item in changelogList:
for suffix in suffixList:
synchroSuffix = SynchronizedSuffix(suffix, serverId)
for item in changelogList:
<
function name="removeInstance">
This function removes an instance on a given host.
<
function-
arg-
def name="dsHost" default="DIRECTORY_INSTANCE_HOST">
<
function-
arg-
description>
Hostname where the instance is to be created
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="dsDir" default="DIRECTORY_INSTANCE_DIR">
<
function-
arg-
description>
Directory where OpenDS will be installed
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
'Removing instance %s/%s on host %s' % (dsDir,OPENDSNAME,dsHost)
<!-- ON REMOTE HOST: remove files and folders --> <!--- Delete staging data file on remote host--> <
call function="'deleteFile'">
<
function name="removeTopology">
This function removes the topology created for the Test
Group/
Suite.
<
function-
arg-
def name="multipleInstanceTopology" <
function-
arg-
description>
Tells whether it is a single (
i.e. parameters read from
config.py) or
a multiple-instance topology (
i.e. parameters read from topology desc
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
if expr="multipleInstanceTopology == False">
<!-- SINGLE instance deployment: parameters read from config.py (done by <
call function="'removeInstance'" />
<!-- MULTIPLE instance deployment: parameters read from <
iterate var="server" in="_splitServerList">
<
call function="'removeInstance'">
<!-- Prepare instance(s) for external re-initialisation of replicated suffix <
function name="preInitializeReplication">
This function prepares one or all instances in a topology for the external
re-initialisation of replicated suffixes using dsreplication.
<
function-
arg-
def name="location" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsPath" 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 name="dsInstanceHost" <
function-
arg-
description>
Directory server hostname or IP address
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsInstanceAdminPort" <
function-
arg-
description>
Directory server admin port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="localOnly" <
function-
arg-
description>
Only the contents of the specified server will be initialised.
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean" />
<
function-
arg-
def name="replicationDnList" type="required">
<
function-
arg-
description>
DN of the replicated suffix
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN list" />
<
function-
arg-
def name="adminUID" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="UID" />
<
function-
arg-
def name="adminPswd" <
function-
arg-
description>
Global Administrator password
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
<
function-
arg-
def name="expectedRC" type="optional" default="0">
<
function-
arg-
description>
Expected return code value. Default value is 0
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
'Preparing instance %s:%s for external initialization' \
% (dsInstanceHost,dsInstanceAdminPort)
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/%s%s' % (dsBinPath,DSREPLICATION,fileExt)
for dn in replicationDnList:
STAFCmdParams=' '.join(STAFCmdParamsList)
<
call function="'runCommand'">
{ 'name' : 'Pre-Initialize Replication',
'arguments' : STAFCmdParams
<
call function="'checktestRC'">
{ 'returncode' : STAXCode,
<!-- End process of instance(s) external re-initialisation of replicated suffix using dsreplication --> <
function name="postInitializeReplication">
This function ends the process of the external re-initialisation of
replicated suffixes in one or all instances in a topology using
<
function-
arg-
def name="location" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsPath" 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 name="dsInstanceHost" <
function-
arg-
description>
Directory server hostname or IP address
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsInstanceAdminPort" <
function-
arg-
description>
Directory server admin port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="replicationDnList" type="required">
<
function-
arg-
description>
DN of the replicated suffix
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN list" />
<
function-
arg-
def name="adminUID" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="UID" />
<
function-
arg-
def name="adminPswd" <
function-
arg-
description>
Global Administrator password
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
<
function-
arg-
def name="expectedRC" type="optional" default="0">
<
function-
arg-
description>
Expected return code value. Default value is 0
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
'Post-processing external initialization of instance %s:%s' \
% (dsInstanceHost,dsInstanceAdminPort)
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/%s%s' % (dsBinPath,DSREPLICATION,fileExt)
for dn in replicationDnList:
STAFCmdParams=' '.join(STAFCmdParamsList)
<
call function="'runCommand'">
{ 'name' : 'Post-Initialize Replication',
'arguments' : STAFCmdParams
<
call function="'checktestRC'">
{ 'returncode' : STAXCode,
<!-- Reset replicated suffix with the backup of a source server using <
function name="resetReplicationData">
This function resets the data in a replicated suffix with the backup
of a source server and re-initialises the topology using dsreplication.
<
function-
arg-
def name="location" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsPath" 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 name="sourceInstanceHost" <
function-
arg-
description>
Directory server hostname or IP address
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="sourceInstancePort" <
function-
arg-
description>
Directory server port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="sourceInstanceAdminPort" <
function-
arg-
description>
Directory server admin port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="sourceInstanceDn" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN" />
<
function-
arg-
def name="sourceInstancePswd" type="required">
<
function-
arg-
description>
</
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="suffixDn" type="required">
<
function-
arg-
description>
DN of the replicated suffix
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN" />
<
function-
arg-
def name="adminUID" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="UID" />
<
function-
arg-
def name="adminPswd" <
function-
arg-
description>
Global Administrator password
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
<
function-
arg-
def name="expectedRC" <
function-
arg-
description>
Expected return code value. Default value is 0
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
'Resetting %s data in replication topology using backup %s on instance \
%s:%s' % (suffixDn,backupDir,sourceInstanceHost,sourceInstanceAdminPort)
<!-- Pre-initialise the servers in the topology --> <
call function="'preInitializeReplication'">
'dsInstanceHost' : sourceInstanceHost,
'dsInstanceAdminPort' : sourceInstanceAdminPort,
'replicationDnList' : [suffixDn],
<!-- Restore the data in the server --> <
call function="'restoreTask'">
'dsInstanceHost' : sourceInstanceHost,
'dsInstancePort' : sourceInstancePort,
'dsInstanceDn' : sourceInstanceDn,
'dsInstancePswd' : sourceInstancePswd,
'taskID' : 'restore task - %s' % resetCounter,
<!-- Post-initialise the servers in the topology --> <
call function="'postInitializeReplication'">
'dsInstanceHost' : sourceInstanceHost,
'dsInstanceAdminPort' : sourceInstanceAdminPort,
'replicationDnList' : [suffixDn],
<!-- Initialise the servers in the topology --> <
call function="'initializeReplication'">
'sourceInstanceHost' : sourceInstanceHost,
'sourceInstanceAdminPort' : sourceInstanceAdminPort,
'replicationDnList' : [suffixDn],
<
call function="'checktestRC'">
{ 'returncode' : STAXCode,
<
function name="common_setup" scope="local">
This function helps to perform a common setup and data load of directory server.
<
function-
arg-
def name="directoryServer" type="optional" default="server">
<
function-
arg-
description>
The directory server object instance
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="quickStart" type="optional" default="True">
<
function-
arg-
description>
Perform a quick start of the server with preloaded data
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="loadData" type="optional" default="True">
<
function-
arg-
description>
Load data into the server
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="startServer" type="optional" default="True">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="stopServer" type="optional" default="True">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="ldifFile" type="optional" default="''">
<
function-
arg-
description>
Path and name of the ldif file to be used to add entries
</
function-
arg-
description>
<
function-
arg-
property name="type" value="structure"/>
<
function-
arg-
def name="allowPreEncodePassword" type="optional" default="False">
<
function-
arg-
description>
Allow pre-encoded passwords to be added
</
function-
arg-
description>
<
function-
arg-
property name="boolean" value="True|False"/>
<
function-
arg-
def name="generateLDIF" type="optional" default="False">
<
function-
arg-
description>
Generate with makeldif the ldif file to be imported
</
function-
arg-
description>
<
function-
arg-
property name="boolean" value="True|False"/>
<
function-
arg-
def name="ldifTemplate" type="optional" default="''">
<
function-
arg-
description>
Path and name of the ldif template to be used to generate entries
</
function-
arg-
description>
<
function-
arg-
property name="type" value="structure"/>
<
function-
arg-
def name="friendlyName" type="optional" default="'Common'">
<
function-
arg-
description>
Friendly name for the common setup launcher
</
function-
arg-
description>
<
function-
arg-
property name="type" value="structure"/>
<
block name="'common-setup'">
<
testcase name="getTestCaseName('%s Setup' % friendlyName)">
<
call function="'testCase_Preamble'"/>
<!-- Create the topology necessary to the test group/suite --> <
call function="'runFunction'">
{ 'functionName' : 'createTopology' ,
'functionMessage' : 'Create DS topology' ,
'functionArguments' : { 'initialiseInstance' : quickStart }
<
if expr="startServer == True">
<!-- Start the OpenDS Server --> <
call function="'runFunction'">
{ 'functionName' : 'StartDsWithScript' ,
'functionMessage' : 'Start the Directory Server.' ,
<!--- Check that DS started --> <
call function="'runFunction'">
{ 'functionName' : 'isAlive' ,
'functionMessage' : 'Start the Directory Server.' ,
'functionArguments' : { 'noOfLoops' : 100 ,
'noOfMilliSeconds' : 3000 }
<!-- TODO: generate ldif file --> <
if expr="generateLDIF == True and ldifTemplate and ldifFile">
'Generating ldif file (%s) from template (%s)' % (ldifFile,ldifTemplate)
<
if expr="loadData == True and ldifFile and startServer == True">
<
if expr="allowPreEncodePassword == True">
<
call function="'dsconfigSet'">
'objectName' : 'password-policy',
'propertyType' : 'policy',
'propertyName' : 'Default Password Policy',
'attributeName' : 'allow-pre-encoded-passwords',
'attributeValue' : 'true'
<!-- Load the data needed by the test suite --> <
call function="'runFunction'">
{ 'functionName' : 'ldapModifyWithScript' ,
'functionMessage' : 'Adding Initial Entries' ,
'functionArguments' : { 'dsAdd' : 'TRUE' ,
'dsFilename' : ldifFile }
<
if expr="loadData == True and ldifFile and startServer == False">
<
call function="'runFunction'">
{ 'functionName' : 'ImportLdifWithScript' ,
'functionMessage' : 'Off-line Import LDIF.' ,
<
call function="'runFunction'">
{ 'functionName' : 'StartDsWithScript' ,
'functionMessage' : 'Start the Directory Server.' ,
<
call function="'runFunction'">
{ 'functionName' : 'isAlive' ,
'functionMessage' : 'Check the Directory Server has started.' ,
'noOfMilliSeconds' : 2000 }
<
if expr="stopServer == True">
<!-- Stop the OpenDS Server --> <
call function="'runFunction'">
{ 'functionName' : 'StartDsWithScript' ,
'functionMessage' : 'Stop the Directory Server.' ,
<
message log="1" level="'fatal'">
'%s: Create topology failed. eInfo(%s)' % (eType,eInfo)
<
message log="1" level="'fatal'">
'%s: Failed to start Directory Server. eInfo(%s)' % (eType,eInfo)
<
message log="1" level="'fatal'">
'%s: Failed to import ldif file. eInfo(%s)' % (eType,eInfo)
<
message log="1" level="'fatal'">
'%s: Failed to stop Directory Server. eInfo(%s)' % (eType,eInfo)
<
message log="1" level="'fatal'">
'%s: LDAPModify failed. eInfo(%s)' % (eType,eInfo)
<!-- Test Group postamble --> <
call function="'testCase_Postamble'"/>
<
function name="common_cleanup" scope="local">
This function helps to perform a common cleanup of directory server and its data.
<
function-
arg-
def name="directoryServer" type="optional" default="server">
<
function-
arg-
description>
The directory server object instance
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="deleteSuffix" type="optional" default="True">
<
function-
arg-
description>
Delete the suffix that holds the directory data
</
function-
arg-
description>
<
function-
arg-
property name="type" value="boolean"/>
<
function-
arg-
def name="friendlyName" type="optional" default="'Common'">
<
function-
arg-
description>
Friendly name for the common cleanup launcher
</
function-
arg-
description>
<
function-
arg-
property name="type" value="structure"/>
<
block name="'common-cleanup'">
<
testcase name="getTestCaseName('%s Cleanup' % friendlyName)">
<
call function="'testCase_Preamble'"/>
<
call function="'runFunction'">
{ 'functionName' : 'ldapSearchWithScript' ,
'functionMessage' : 'Check Server is Alive.' ,
'dsBaseDN' : 'cn=config' ,
'dsFilter' : 'objectclass=*' ,
_returncode=int(STAXResult[0])
<
if expr="deleteSuffix == True">
<!-- If directoryServer is not running we have to restart it --> <
if expr="_returncode == 91">
<
call function="'runFunction'">
{ 'functionName' : 'StartDsWithScript' ,
'functionMessage' : 'Start the Directory Server.' ,
'functionArguments' : { 'expectedRC' : 'noCheck' }
<
call function="'runFunction'">
{ 'functionName' : 'ldapDeleteWithScript' ,
'functionMessage' : 'Recursive delete of suffix.' ,
'functionArguments' : { 'dsDeleteSubtree' : 'TRUE' ,
'expectedRC' : 'noCheck' }
<
call function="'runFunction'">
{ 'functionName' : 'StopDsWithScript' ,
'functionMessage' : 'Stop the Directory Server.' ,
'expectedRC' : 'noCheck' }
<
call function="'runFunction'">
{ 'functionName' : 'removeTopology' ,
'functionMessage' : 'Remove DS topology.' ,
<
tcstatus result="'pass'"></
tcstatus>
<
message log="1" level="'fatal'">
'%s: LDAPDelete failed. eInfo(%s)' % (eType,eInfo)
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Failed to cleanup. eInfo(%s)' % (eType,eInfo)
<!-- Test Group postamble --> <
call function="'testCase_Postamble'"/>
<!-- Get replication status using dsreplication, and check for missing changes or inconsistencies in the number of entries across the topology --> <
function name="getReplicationStatus">
This function gets the replication status of a topology using
<
function-
arg-
def name="location" default="STAF_REMOTE_HOSTNAME">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsPath" 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 name="dsInstanceHost" <
function-
arg-
description>
Directory server hostname or IP address
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname" />
<
function-
arg-
def name="dsInstanceAdminPort" <
function-
arg-
description>
Directory server admin port number
</
function-
arg-
description>
<
function-
arg-
property name="type" value="Port number" />
<
function-
arg-
def name="replicationDnList" type="required">
<
function-
arg-
description>
DN of the replicated suffix
</
function-
arg-
description>
<
function-
arg-
property name="type" value="DN list" />
<
function-
arg-
def name="adminUID" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="UID" />
<
function-
arg-
def name="adminPswd" <
function-
arg-
description>
Global Administrator password
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
<
function-
arg-
def name="noOfLoops" <
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
<
function-
arg-
def name="noOfMilliSeconds" <
function-
arg-
description>
Number of milliseconds to wait between iterations
</
function-
arg-
description>
<
function-
arg-
property name="type" value="seconds"/>
<
function-
arg-
def name="expectedRC" type="optional" default="0">
<
function-
arg-
description>
Expected return code value. Default value is 0
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string" />
'Getting replication status from server %s:%s' \
% (dsInstanceHost,dsInstanceAdminPort)
dsBinPath='%s/%s' % (dsPath,fileFolder)
STAFCmd='%s/%s%s' % (dsBinPath,DSREPLICATION,fileExt)
# option for getting status in script-friendly format
for dn in replicationDnList:
STAFCmdParams=' '.join(STAFCmdParamsList)
refNbOfEntries = 'Unknown'
refServername = 'Unknown'
<
loop from="1" to="noOfLoops" while="missingRC == True">
<
call function="'runCommand'">
{ 'name' : 'Get Replication Status',
'arguments' : STAFCmdParams
commandResult = STAXResult
<
call function="'checktestRC'">
{ 'returncode' : commandRC,
'result' : commandResult,
<
if expr="commandRC != expectedRC">
<
return> commandResult </
return>
replStatusRC = commandResult[0][0]
replStatusResult = commandResult[0][1]
resultLength = len(replStatusResult) > 0
<
if expr="(replStatusRC == 0) and (resultLength != 0)">
server = line[
line.find('Server:') + 7:].strip()
entries = line[
line.find('Entries:') + 8:].strip()
missingChanges = line[
line.find('Missing') + 16:].strip()
age = line[
line.find('Age of') + 29:].strip()
<
iterate var="missing" in="missingChangesList">
<
if expr="(missing != '0') and (missing != '--')">
'getReplicationStatus LOOP %s => missingChanges? \
(True=
1/
False=0) : %s' % (myLoop, missingRC)
<
if expr="missingRC == True">
<!-- If there are still missing changes, wait for some more time and ! give the servers a chance to synchronise --> <
call function="'Sleep'">
{ 'sleepForMilliSeconds' : noOfMilliSeconds }
<
if expr="(replStatusRC == 0) and (resultLength != 0)">
'getReplicationStatus: Replication status retrieved from server \
(dsInstanceHost, dsInstanceAdminPort, replStatusResult)
<
iterate var="entries" in="entriesList" indexvar="i">
refServername = servernameList[i]
<
iterate var="server" in="servernameList" indexvar="i">
missingChanges = missingChangesList[i]
anyMissChg = (missingChanges != '0' and missingChanges != '--')
anyOldAge = (age != 'N/A' and age != '--')
entriesDiff = (entries != refNbOfEntries)
<
if expr="anyMissChg or anyOldAge">
<
message log="1" level="'Error'">
'getReplicationStatus: Server %s is missing %s changes. \
Entries: %s - Age of the oldest missing change: %s ' % \
(server, missingChanges, entries, age)
<
tcstatus result="'fail'"/>
<
if expr="anyEntries and entriesDiff">
<
message log="1" level="'Error'">
'getReplicationStatus: Different number of entries.\n\
Server %s : %s entries\n\
Reference server %s : %s entries\n' % \
(server, entries, refServername, refNbOfEntries)
<
tcstatus result="'fail'"/>
<
function name="stageStaticDataFiles">
This function stages locally the static data files
<
function-
arg-
def name="customFileExtensions" <
function-
arg-
description>
Non default file extensions for specific tests
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="testGroupDirName" <
function-
arg-
description>
Name of the test group directory that holds the
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<!-- If remote host is local loopback then no need to stage static data files --> from socket import gethostbyname
<
if expr="host_is_localhost(STAF_REMOTE_HOSTNAME)">
'Not staging static data files as remote host %s (%s) is local.' % (STAF_REMOTE_HOSTNAME,gethostbyname(STAF_REMOTE_HOSTNAME))
<
message>'Will creating stub folder in testdata.'</
message>
<
call function="'createStubFolders'"/>
'Remote host %s (%s) is not local.' % (STAF_REMOTE_HOSTNAME,gethostbyname(STAF_REMOTE_HOSTNAME))
<!-- Check to see if local tests static data directory is already created--> <
call function="'GetEntry'">
{ 'location' : STAXServiceMachine,
'entry' : localTestsGroupDir,
<!-- If the static test data is already created then don't redo it --> <
message>'Not staging static data files as they already exist.'</
message>
<!-- Locally copy static data files to temporary staging area --> 'Staging static data files on local machine.'
<!-- All LDIF (.ldif) files for quickinstall are needed for each suite --> 'Copy quickstart ldif data files locally from %s to %s.' % \
(quickStartGroupDir,quickStartLocalTestsGroupDir)
<
call function="'CopyFolderByExtension'">
{ 'location' : STAXServiceMachine,
'srcfolder' : quickStartGroupDir,
'destfolder' : quickStartLocalTestsGroupDir,
<!-- Default static data files --> defaultFileExtensions=["ldif","pwd","gz","ref","security"]
<
iterate var="fExt" in="defaultFileExtensions + customFileExtensions">
'Copy %s data files locally from %s to %s.' % \
(fExt,sourceTestsGroupDir,localTestsGroupDir)
<
call function="'CopyFolderByExtension'">
{ 'location' : STAXServiceMachine,
'srcfolder' : sourceTestsGroupDir,
'destfolder' : localTestsGroupDir,
'extension' : '%s' % fExt
<
function name="stageJavaFiles">
This function stages locally and builds the java class files
<
function-
arg-
def name="customJavaProjects" <
function-
arg-
description>
Name of the custom java based project (should be folder name)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
defaultJavaProjects=["ldapjndi","ldapjdk"]
<!-- Archive (*/.java) files --> <
iterate var="javaProject" in="defaultJavaProjects + customJavaProjects">
<!-- Check to see if local java data directory is already created--> <
call function="'GetEntry'">
{ 'location' : STAXServiceMachine,
'Staging %s java files on local machine.' % javaProject
'Copy %s java files locally from %s to %s.' % \
(javaProject,javaSharedDir,javaLocalDir)
<
call function="'CopyFolderByExtension'">
'location' : STAXServiceMachine,
'srcfolder' : javaSharedDir,
'destfolder' : javaLocalDir,
'Copy any jar files locally from %s to %s.' % \
(javaSharedDir,javaLocalDir)
<
call function="'CopyFolderByExtension'">
'location' : STAXServiceMachine,
'srcfolder' : javaSharedDir,
'destfolder' : javaLocalDir,
<!--- Check if these java files are already compiled --> <
call function="'listFolderByExtension'" >
'location' : STAXServiceMachine,
'foldername' : javaLocalDir,
<
if expr="len(STAXResult) == 0">
<!-- Build Java CLASSPATH if needed--> <!-- Build CLASSPATH for ldapjdk--> <
if expr="javaProject == 'ldapjdk'">
if is_windows_platform(STAXServiceMachine):
jstaf_jarfile='%s\\bin\\
JSTAF.jar' % LOCAL_STAF_ROOT
java_classpath ='%s%s%s' \
% (ldapjdk_jarfile,separator,jstaf_jarfile)
<!-- Compile these java files on controler host --> 'Compile Java files under %s on %s' \
% (javaLocalDir, STAXServiceMachine)
<
call function="'compileJava'" >
'location' : STAXServiceMachine,
'foldername' : '%s' % javaLocalDir,
'classpath' : java_classpath
'Not Staging %s java files as they already exist.' % javaProject
<
function name="stageSNMPFiles">
This function stages locally and builds the java class files
<
function-
arg-
def name="customSNMPProjects" <
function-
arg-
description>
Name of the custom SNMP based project (should be folder name)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<!-- Check to see if local java data directory is already created--> <
call function="'GetEntry'">
{ 'location' : STAXServiceMachine,
<
message>'Not Staging SNMP files as they already exist.'</
message>
'Staging SNMP files on local machine.'
'Copy java files locally from %s to %s.' % \
(javaSharedDir,javaLocalDir)
<
call function="'CopyFolderByExtension'">
'location' : STAXServiceMachine,
'srcfolder' : javaSharedDir,
'destfolder' : javaLocalDir,
<!-- Check if 'SNMP_OPENDMK_JARFILE' exists --> <
call function="'GetEntry'">
'location' : STAXServiceMachine,
'entry' : SNMP_OPENDMK_JARFILE,
'OpenDMK jar %s not found.' % SNMP_OPENDMK_JARFILE
<!-- 'SNMP_OPENDMK_JARFILE' exists so we can continue with SNMP --> <!--- Check if snmp java files are already compiled --> <
call function="'listFolderByExtension'" >
'location' : STAXServiceMachine,
'foldername' : javaLocalDir,
<
if expr="len(STAXResult) == 0">
<!--- Install DS Copy zip file --> 'Copy DS zip archive locally from %s to %s.' % \
<
call function="'copyFile'">
'srcfile' : '%s/%s' % (ZIPPATH, ZIPNAME),
'remotehost' : STAXServiceMachine
<!--- Install DS Extract zip file --> 'Extract locally DS zip archive to %s' %
local.temp <
call function="'unZipFile'">
'location' : STAXServiceMachine,
<!-- The jdmkrt.jar can be included in the OpenDS archive --> if is_windows_platform(STAXServiceMachine):
jstaf_jarfile='%s\\bin\\
JSTAF.jar' % LOCAL_STAF_ROOT
<
if expr="IPS_PKG == True">
<
call function="'copyFile'">
'location' : STAF_REMOTE_HOSTNAME,
'srcfile' : '%s/%s' % (DIRECTORY_INSTANCE_BIN,SNMP_OPENDS_JARFILE),
'destfile' : '%s/%s' % (
local.temp,SNMP_OPENDS_JARFILE),
'remotehost' : STAXServiceMachine
<!--- Compile snmp java files on controler host --> 'Compile Java files under %s on %s' \
% (javaLocalDir, STAXServiceMachine)
opends_jarfile='%s/%s' % (
local.temp,SNMP_OPENDS_JARFILE)
if is_windows_platform(STAXServiceMachine):
<
call function="'compileJava'" >
'location' : STAXServiceMachine,
'foldername' : javaLocalDir,
'classpath' : '%s%s%s%s%s' \
% (opends_jarfile,separator,SNMP_OPENDMK_JARFILE,separator,jstaf_jarfile)
<!-- Archive SNMP_OPENDMK_JARFILE file --> 'Copy OpenDMK jar file %s locally to %s.' \
% (SNMP_OPENDMK_JARFILE,javaLocalDir)
<
call function="'copyFile'">
'remotehost' : STAXServiceMachine,
'srcfile' : SNMP_OPENDMK_JARFILE,
'remotehost' : STAXServiceMachine
<!-- Delete the DS zip archive --> <
call function="'deleteFile'">
'location' : STAXServiceMachine,
<!-- Delete the DS install dir --> <
call function="'deleteFolder'">
'location' : STAXServiceMachine,
<
function name="createStubFolders">
This function creates some stub folders in testdata
<
call function="'createFolder'">
{ 'location' : STAF_LOCAL_HOSTNAME,