<?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 2008 Sun Microsystems, Inc.
|
! -->
|
<stax>
|
|
<defaultcall function="verdict"/>
|
|
|
<!-- ************************************************************ -->
|
<function name="verdict" scope="local">
|
<function-map-args>
|
<function-arg-def name="phase" type="required">
|
<function-arg-description>
|
phase object
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="instances" type="required">
|
<function-arg-description>
|
list of instance objects
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="suffix" type="required">
|
<function-arg-description>
|
suffix object
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="runConfiguration" type="required">
|
<function-arg-description>
|
boolean : configuration phase has been run or not
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="runScheduler" type="required">
|
<function-arg-description>
|
boolean : scheduler phase has been run or not
|
</function-arg-description>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<!--========== Call preambule =========-->
|
<call function="'phasePreamble'">
|
{ 'phase' : phase,
|
'fileFd' : LOG_MAIN_FD }
|
</call>
|
|
<script>
|
items = STAXGlobal([])
|
</script>
|
<!--== Check if previous phases raised some errors ==-->
|
<!-- installation -->
|
<call function="'checkPhaseResult'">
|
{ 'phase' : PHASE_INSTALLATION }
|
</call>
|
<if expr="STAXResult != []">
|
<script> items.append(STAXResult) </script>
|
</if>
|
<!-- pre-configuration -->
|
<call function="'checkPhaseResult'">
|
{ 'phase' : PHASE_PRE_CONFIGURATION }
|
</call>
|
<if expr="STAXResult != []">
|
<script> items.append(STAXResult) </script>
|
</if>
|
<!-- gen-ldif -->
|
<call function="'checkPhaseResult'">
|
{ 'phase' : PHASE_GEN_LDIF }
|
</call>
|
<if expr="STAXResult != []">
|
<script> items.append(STAXResult) </script>
|
</if>
|
<!-- configuration -->
|
<call function="'checkPhaseResult'">
|
{ 'phase' : PHASE_CONFIGURATION }
|
</call>
|
<if expr="STAXResult != []">
|
<script> items.append(STAXResult) </script>
|
</if>
|
<!-- post-configuration -->
|
<call function="'checkPhaseResult'">
|
{ 'phase' : PHASE_POST_CONFIGURATION }
|
</call>
|
<if expr="STAXResult != []">
|
<script> items.append(STAXResult) </script>
|
</if>
|
<!-- scheduler -->
|
<call function="'checkPhaseResult'">
|
{ 'phase' : PHASE_SCHEDULER }
|
</call>
|
<if expr="STAXResult != []">
|
<script> items.append(STAXResult) </script>
|
</if>
|
|
<!--== If configuration/schedulers phases have been run ==-->
|
<!--== then do some basic checks : isalive ==-->
|
<if expr="runConfiguration == 'true' or runScheduler == 'true'">
|
<sequence>
|
<script>
|
fileList = STAXGlobal([])
|
</script>
|
<script>
|
topoInstances = suffix.getTopology()
|
</script>
|
<paralleliterate in="topoInstances" var="topoInstance">
|
<sequence>
|
<!-- parallel process, all variables defined -->
|
<!-- and values set below are local to the sequence -->
|
<script>
|
instance = topoInstance.getInstanceRef()
|
</script>
|
<call function="'getLogFileName'">
|
{ 'type' : 'instance',
|
'object' : instance,
|
'prefix' : 'verdict'
|
}
|
</call>
|
<script>
|
logFile = STAXResult
|
|
fileList.append(logFile)
|
|
cFileFd = open(logFile,'w')
|
</script>
|
<call function="'writeStartTagInstance'">
|
{
|
'instance' : instance,
|
'fileFd' : cFileFd
|
}
|
</call>
|
|
|
<if expr="instance.getProduct() == 'opends'">
|
<sequence>
|
<!--== Get the list of opends instances in the topology ==-->
|
<call function="'getOpendsInstancesInATopology'">
|
{ 'suffix' : suffix }
|
</call>
|
<script>
|
opendsInstances = STAXResult
|
</script>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/shared/functions/opendstools.xml' %
|
TESTS_DIR"/>
|
<call function="'verdict4OpendsInstance'">
|
{
|
'instance' : instance,
|
'instances' : opendsInstances,
|
'suffix' : suffix,
|
'fileFd' : cFileFd
|
}
|
</call>
|
<script>
|
items.append(['instance %s' % instance.getName(),STAXResult])
|
</script>
|
</sequence>
|
</if>
|
|
<!--== Post operations ======-->
|
<message>
|
'%s : %s : verdict complete' % \
|
(instance.getHost(),instance.getName())
|
</message>
|
|
<call function="'writeEndTagInstance'">
|
{'fileFd' : cFileFd}
|
</call>
|
<script>
|
cFileFd.close()
|
</script>
|
|
</sequence>
|
</paralleliterate>
|
|
<!--========== Merge files ==========-->
|
<call function="'mergeFiles'">
|
{
|
'fileList' : fileList,
|
'fileFd' : LOG_MAIN_FD
|
}
|
</call>
|
</sequence>
|
</if>
|
|
|
<!--==== Calculate phase percentage ==========-->
|
<script>
|
nbItems = len(items)
|
nbItemSuccess = 0
|
percentageResult = 0
|
</script>
|
<if expr="nbItems > 0 ">
|
<sequence>
|
<iterate in="items" var="item">
|
<script>
|
if item[1] == 0:
|
nbItemSuccess += 1
|
</script>
|
</iterate>
|
<script>
|
percentageResult = nbItemSuccess * 100
|
percentageResult = percentageResult / nbItems
|
phase.setPercentage(percentageResult)
|
</script>
|
</sequence>
|
<else>
|
<script>
|
phase.setPercentage('100')
|
</script>
|
</else>
|
</if>
|
|
<!--========== Call postphase =========-->
|
<call function="'phasePostamble'">
|
{
|
'phase' : phase,
|
'fileFd' : LOG_MAIN_FD
|
}
|
</call>
|
|
</sequence>
|
</function>
|
|
|
|
|
<!-- ************************************************************ -->
|
<function name="checkPhaseResult" scope="local">
|
<function-map-args>
|
<function-arg-def name="phase" type="required">
|
<function-arg-description>
|
phase object
|
</function-arg-description>
|
</function-arg-def>
|
</function-map-args>
|
<sequence>
|
<script>
|
result = []
|
</script>
|
<if expr="phase.getRun() == 'true'">
|
<sequence>
|
<call function="'writeStartTagOperation'">
|
{ 'tagName' : 'checkPhaseResult',
|
'fileFd' : LOG_MAIN_FD }
|
</call>
|
<call function="'writeMessage'">
|
{ 'content' : 'Check number of error for %s phase' % phase.getName(),
|
'fileFd' : LOG_MAIN_FD }
|
</call>
|
<call function="'checkRC'">
|
{
|
'returncode' : phase.getErrNum(),
|
'result' : '',
|
'fileFd' : LOG_MAIN_FD
|
}
|
</call>
|
<call function="'writeEndTagOperation'">
|
{'fileFd' : LOG_MAIN_FD}
|
</call>
|
<script>
|
result = [ 'phase %s' % phase.getName() , phase.getErrNum() ]
|
</script>
|
</sequence>
|
</if>
|
<return> result </return>
|
</sequence>
|
</function>
|
|
|
</stax>
|