failover.xml revision 9a9928c51161eb0aa64dea4bd8759470e26783d0
0N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1879N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
0N/A<!--
0N/A ! CDDL HEADER START
0N/A !
0N/A ! The contents of this file are subject to the terms of the
0N/A ! Common Development and Distribution License, Version 1.0 only
0N/A ! (the "License"). You may not use this file except in compliance
0N/A ! with the License.
0N/A !
0N/A ! You can obtain a copy of the license at
0N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
0N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
0N/A ! See the License for the specific language governing permissions
0N/A ! and limitations under the License.
0N/A !
0N/A ! When distributing Covered Code, include this CDDL HEADER in each
0N/A ! file and include the License file at
1472N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1472N/A ! add the following below this CDDL HEADER, with the fields enclosed
1472N/A ! by brackets "[]" replaced with your own identifying information:
0N/A ! Portions Copyright [yyyy] [name of copyright owner]
0N/A !
0N/A ! CDDL HEADER END
1879N/A !
1879N/A ! Copyright 2007-2009 Sun Microsystems, Inc.
1879N/A ! -->
1879N/A<stax>
1879N/A
1879N/A <defaultcall function="replication_failover"/>
1879N/A
1879N/A <function name="replication_failover">
1879N/A
1879N/A <sequence>
0N/A
0N/A <block name="'failover'">
0N/A
0N/A <sequence>
0N/A
0N/A <script>
0N/A if not CurrentTestPath.has_key('group'):
0N/A CurrentTestPath['group']='replication'
0N/A CurrentTestPath['suite']=STAXCurrentBlock
0N/A </script>
0N/A
0N/A <call function="'testSuite_Preamble'"/>
0N/A
0N/A <!--- Test Suite information
0N/A #@TestSuiteName Replication Failover Tests
0N/A #@TestSuitePurpose Verify that the failover of a replication server does not affect replication.
0N/A #@TestSuiteID Failover Tests
0N/A #@TestSuiteGroup Failover
0N/A #@TestGroup Replication
0N/A #@TestScript replication_failover.xml
0N/A #@TestHTMLLink http://opends.dev.java.net/
0N/A -->
0N/A
0N/A
0N/A <import machine="STAF_LOCAL_HOSTNAME"
0N/A file="'%s/testcases/replication/replication_setup.xml' % (TESTS_DIR)"/>
0N/A <call function="'replication_setup'">
0N/A { 'topologyFile' : '%s/3server_topology.txt' % TESTS_TOPOLOGY_DIR }
0N/A </call>
0N/A
0N/A <script>
0N/A synchroSuffix = master.getSynchronizedSuffixList()[0].getSuffixDn()
0N/A </script>
0N/A
0N/A
0N/A <!-- Load entries into "master" server -->
0N/A <!-- Stop "master" Directory Server -->
0N/A <call function="'StopDsWithScript'">
0N/A { 'location' : masterHost,
0N/A 'dsPath' : masterPath,
0N/A 'dsHost' : masterHost,
0N/A 'dsAdminPort' : master.getAdminPort(),
0N/A 'dsBindDN' : master.getRootDn(),
0N/A 'dsBindPwd' : master.getRootPwd()
0N/A }
0N/A </call>
0N/A
0N/A <!-- Import data into "master" Directory Server -->
0N/A <call function="'ImportLdifWithScript'">
0N/A { 'location' : masterHost,
0N/A 'dsPath' : masterPath,
0N/A 'dsBackEnd' : DIRECTORY_INSTANCE_BE,
0N/A 'dsLdifFile' : '%s/replication/Example.ldif' % masterDataDir
0N/A }
0N/A </call>
0N/A
0N/A <!-- Start the Directory Server -->
0N/A <call function="'StartDsWithScript'">
0N/A { 'location' : masterHost,
0N/A 'dsPath' : masterPath
0N/A }
0N/A </call>
0N/A
0N/A <!-- Wait for DS to start -->
0N/A <call function="'isAlive'">
0N/A { 'location' : masterHost,
0N/A 'dsPath' : masterPath,
0N/A 'dsInstanceHost' : masterHost,
0N/A 'dsInstancePort' : master.getPort() ,
1879N/A 'dsInstanceDn' : master.getRootDn() ,
1879N/A 'dsInstancePswd' : master.getRootPwd() ,
1879N/A 'noOfLoops' : 10 ,
1879N/A 'noOfMilliSeconds' : 2000
1879N/A }
1879N/A </call>
1879N/A
1879N/A <!-- Initialise the servers in the topology -->
1879N/A<!--
1879N/A <call function="'initializeReplication'">
0N/A { 'location' : clientHost,
0N/A 'dsPath' : clientPath,
0N/A 'sourceInstanceHost' : masterHost,
0N/A 'sourceInstanceAdminPort' : master.getAdminPort(),
0N/A 'replicationDnList' : ['o=example']
0N/A }
0N/A </call>
0N/A-->
0N/A <iterate var="server" in="consumerList">
0N/A <!-- Perform the total update -->
0N/A <call function="'initializeReplication'">
0N/A { 'location' : clientHost,
0N/A 'dsPath' : clientPath,
0N/A 'dsInstanceHost' : server.getHostname(),
0N/A 'dsInstanceAdminPort' : server.getAdminPort(),
0N/A 'sourceInstanceHost' : masterHost,
0N/A 'sourceInstanceAdminPort' : master.getAdminPort(),
0N/A 'replicationDnList' : ['o=example']
0N/A }
0N/A </call>
0N/A </iterate>
0N/A
0N/A
0N/A <!--- Test Case information
0N/A #@TestMarker Replication Failover Tests
0N/A #@TestName Replication: Failover: One server down (stopped)
0N/A #@TestID One server down (stopped)
0N/A #@TestPurpose Check replication when one server is off-line
0N/A #@TestPreamble
0N/A #@TestSteps
0N/A #@TestPostamble
0N/A #@TestResult
0N/A -->
0N/A <testcase name="getTestCaseName('One server down (stopped)')">
0N/A <sequence>
0N/A <call function="'testCase_Preamble'"/>
0N/A <message>
1879N/A 'Replication: Failover: One server down (stopped). Check replication when one server is off-line '
1879N/A </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>