failover.xml revision d25372dc8e65a9ed019a88fdf659ca61313f1b31
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
<!--
! CDDL HEADER START
!
! The contents of this file are subject to the terms of the
! Common Development and Distribution License, Version 1.0 only
! (the "License"). You may not use this file except in compliance
! with the License.
!
! You can obtain a copy of the license at
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
! See the License for the specific language governing permissions
! and limitations under the License.
!
! When distributing Covered Code, include this CDDL HEADER in each
! file and include the License file at
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
! add the following below this CDDL HEADER, with the fields enclosed
! by brackets "[]" replaced with your own identifying information:
! Portions Copyright [yyyy] [name of copyright owner]
!
! CDDL HEADER END
!
! Copyright 2007-2008 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="replication_failover"/>
<function name="replication_failover">
<sequence>
<block name="'failover'">
<sequence>
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group']='replication'
CurrentTestPath['suite']=STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<!--- Test Suite information
#@TestSuiteName Replication Failover Tests
#@TestSuitePurpose Verify that the failover of a replication server does not affect replication.
#@TestSuiteID Failover Tests
#@TestSuiteGroup Failover
#@TestGroup Replication
#@TestScript replication_failover.xml
#@TestHTMLLink http://opends.dev.java.net/
-->
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/replication/replication_setup.xml' % (TESTS_DIR)"/>
<call function="'replication_setup'">
{ 'topologyFile' : '%s/config/replication/3server_topology.txt' % TESTS_DIR }
</call>
<script>
synchroSuffix = master.getSynchronizedSuffixList()[0].getSuffixDn()
</script>
<!-- Load entries into "master" server -->
<!-- Stop "master" Directory Server -->
<call function="'StopDsWithScript'">
{ 'location' : masterHost,
'dsPath' : masterPath,
'dsHost' : masterHost,
'dsAdminPort' : master.getAdminPort(),
'dsBindDN' : master.getRootDn(),
'dsBindPwd' : master.getRootPwd()
}
</call>
<!-- Import data into "master" Directory Server -->
<call function="'ImportLdifWithScript'">
{ 'location' : masterHost,
'dsPath' : masterPath,
'dsBackEnd' : DIRECTORY_INSTANCE_BE,
'dsLdifFile' : '%s/replication/Example.ldif' % masterDataDir
}
</call>
<!-- Start the Directory Server -->
<call function="'StartDsWithScript'">
{ 'location' : masterHost,
'dsPath' : masterPath
}
</call>
<!-- Wait for DS to start -->
<call function="'isAlive'">
{ 'location' : masterHost,
'dsPath' : masterPath,
'dsInstanceHost' : masterHost,
'dsInstancePort' : master.getPort() ,
'dsInstanceDn' : master.getRootDn() ,
'dsInstancePswd' : master.getRootPwd() ,
'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<!-- Initialise the servers in the topology -->
<!--
<call function="'initializeReplication'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'sourceInstanceHost' : masterHost,
'sourceInstanceAdminPort' : master.getAdminPort(),
'replicationDnList' : ['o=example']
}
</call>
-->
<iterate var="server" in="consumerList">
<!-- Perform the total update -->
<call function="'initializeReplication'">
{ 'location' : clientHost,
'dsPath' : clientPath,
'dsInstanceHost' : server.getHostname(),
'dsInstanceAdminPort' : server.getAdminPort(),
'sourceInstanceHost' : masterHost,
'sourceInstanceAdminPort' : master.getAdminPort(),
'replicationDnList' : ['o=example']
}
</call>
</iterate>
<!--- Test Case information
#@TestMarker Replication Failover Tests
#@TestName Replication: Failover: One server down (stopped)
#@TestID One server down (stopped)
#@TestPurpose Check replication when one server is off-line
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('One server down (stopped)')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Replication: Failover: One server down (stopped). Check replication when one server is off-line '
</message>
<iterate var="server" in="_topologyServerList" indexvar="i">
<sequence>
<script>
serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
nbOfServers = len(_topologyServerList)
nextServer = _topologyServerList[(i + 1) % nbOfServers]
nextServerPath = '%s/%s' % (nextServer.getDir(), OPENDSNAME)
userDn = 'uid=iabizen-%s, ou=People, %s' % (i, synchroSuffix)
</script>
<!-- Stop server (simulate failover?) -->
<call function="'StopDsWithScript'">
{ 'location' : server.getHostname(),
'dsPath' : serverPath,
'dsHost' : server.getHostname(),
'dsAdminPort' : server.getAdminPort(),
'dsBindDN' : server.getRootDn(),
'dsBindPwd' : server.getRootPwd()
}
</call>
<!-- Add entry to one of the other servers -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:Izen-%s' % i)
listAttr.append('sn:Abizen-%s' % i)
listAttr.append('cn:Izen-%s Abizen-%s' % (i, i))
</script>
<call function="'addAnEntry'">
{ 'location' : nextServer.getHostname(),
'dsPath' : nextServerPath,
'dsInstanceHost' : nextServer.getHostname(),
'dsInstancePort' : nextServer.getPort(),
'dsInstanceDn' : nextServer.getRootDn(),
'dsInstancePswd' : nextServer.getRootPwd(),
'DNToAdd' : userDn,
'listAttributes' : listAttr,
'expectedRC' : 0
}
</call>
<!-- Start the server again -->
<call function="'StartDsWithScript'">
{ 'location' : server.getHostname(),
'dsPath' : serverPath
}
</call>
</sequence>
</iterate>
<!-- Verify the synchronization of the trees among the servers in the topology -->
<call function="'verifyTrees'">
[ clientHost, clientPath, master, consumerList, synchroSuffix ]
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Replication Failover Tests
#@TestName Replication: Failover: All but one servers down (stopped)
#@TestID All but one servers down (stopped)
#@TestPurpose Check replication when all but one servers are off-line
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('All but one servers down (stopped)')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Replication: Failover: All but one servers down (stopped). Check replication when all but one servers are off-line'
</message>
<!-- Start the "consumer" servers -->
<call function="'stopServers'">
[consumerList]
</call>
<!-- Add entry to master servers -->
<script>
userDn = 'uid=iabizen-berri, ou=People, %s' % synchroSuffix
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:Izen-berri')
listAttr.append('sn:Abizen-berri')
listAttr.append('cn:Izen-berri Abizen-berri')
</script>
<call function="'addAnEntry'">
{ 'location' : masterHost,
'dsPath' : masterPath,
'dsInstanceHost' : masterHost,
'dsInstancePort' : master.getPort(),
'dsInstanceDn' : master.getRootDn(),
'dsInstancePswd' : master.getRootPwd(),
'DNToAdd' : userDn,
'listAttributes' : listAttr,
'expectedRC' : 0
}
</call>
<!-- Start the "consumer" servers -->
<call function="'startServers'">
[consumerList]
</call>
<!-- Verify the synchronization of the trees among the servers in the topology -->
<call function="'verifyTrees'">
[ clientHost, clientPath, master, consumerList, synchroSuffix ]
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Replication Failover Tests
#@TestName Replication: Failover: One server down (killed)
#@TestID One server down (killed)
#@TestPurpose Check replication when one server fails
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('One server down (killed)')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Replication: Failover: One server down (killed). Check replication when one server fails'
</message>
<iterate var="server" in="_topologyServerList" indexvar="i">
<sequence>
<script>
serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
nbOfServers = len(_topologyServerList)
nextServer = _topologyServerList[(i + 1) % nbOfServers]
nextServerPath = '%s/%s' % (nextServer.getDir(), OPENDSNAME)
userDn = 'uid=ideiturak-%s, ou=People, %s' % (i, synchroSuffix)
</script>
<!-- Kill server (simulate failover?) -->
<call function="'killDs'">
{ 'location' : server.getHostname(),
'dsPath' : serverPath
}
</call>
<!-- Add entry to one of the other servers -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:Izen-%s' % i)
listAttr.append('sn:Deiturak-%s' % i)
listAttr.append('cn:Izen-%s Deiturak-%s' % (i, i))
</script>
<call function="'addAnEntry'">
{ 'location' : nextServer.getHostname(),
'dsPath' : nextServerPath,
'dsInstanceHost' : nextServer.getHostname(),
'dsInstancePort' : nextServer.getPort(),
'dsInstanceDn' : nextServer.getRootDn(),
'dsInstancePswd' : nextServer.getRootPwd(),
'DNToAdd' : userDn,
'listAttributes' : listAttr,
'expectedRC' : 0
}
</call>
<!-- Start the server again -->
<call function="'StartDsWithScript'">
{ 'location' : server.getHostname(),
'dsPath' : serverPath
}
</call>
</sequence>
</iterate>
<!-- Verify the synchronization of the trees among the servers in the topology -->
<call function="'verifyTrees'">
[ clientHost, clientPath, master, consumerList, synchroSuffix ]
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Replication Failover Tests
#@TestName Replication: Failover: All but one servers down (killed)
#@TestID One server down (killed)
#@TestPurpose Check replication when all but one servers fail
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('All but one servers down (killed)')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Replication: Failover: All but one servers down (killed). Check replication when all but one servers fail'
</message>
<paralleliterate var="server" in="consumerList">
<sequence>
<script>
serverPath = '%s/%s' % (server.getDir(), OPENDSNAME)
</script>
<!-- Kill server (simulate failover?) -->
<call function="'killDs'">
{ 'location' : server.getHostname(),
'dsPath' : serverPath
}
</call>
</sequence>
</paralleliterate>
<!-- Add entry to master servers -->
<script>
userDn = 'uid=ideitura-berriak, ou=People, %s' % synchroSuffix
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:Izen-berri')
listAttr.append('sn:Deitura-berriak')
listAttr.append('cn:Izen-berri Deitura-berriak')
</script>
<call function="'addAnEntry'">
{ 'location' : masterHost,
'dsPath' : masterPath,
'dsInstanceHost' : masterHost,
'dsInstancePort' : master.getPort(),
'dsInstanceDn' : master.getRootDn(),
'dsInstancePswd' : master.getRootPwd(),
'DNToAdd' : userDn,
'listAttributes' : listAttr,
'expectedRC' : 0
}
</call>
<!-- Start the "consumer" servers -->
<call function="'startServers'">
[consumerList]
</call>
<!-- Verify the synchronization of the trees among the servers in the topology -->
<call function="'verifyTrees'">
[ clientHost, clientPath, master, consumerList, synchroSuffix ]
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/replication/replication_cleanup.xml' % (TESTS_DIR)"/>
<call function="'replication_cleanup'" />
<call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
</function>
</stax>