use percentage result for specific phase (scheduler,verdict)
| | |
| | | <!-- ************************************************************ --> |
| | | <function name="configuration" 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 instances classes |
| | |
| | | <sequence> |
| | | <!-- == Call preambule == --> |
| | | <call function="'phasePreamble'"> |
| | | { 'phaseName' : 'configuration' , |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | { 'phase' : PHASE_CONFIGURATION, |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | </call> |
| | | |
| | | <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" |
| | |
| | | <!-- == Call postphase == --> |
| | | <call function="'phasePostamble'"> |
| | | { |
| | | 'phaseName' : 'configuration', |
| | | 'fileFd' : LOG_MAIN_FD |
| | | 'phase' : PHASE_CONFIGURATION, |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | |
| | |
| | | <!-- ************************************************************ --> |
| | | <function name="generateLdif" 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="suffix" type="required"> |
| | | <function-arg-description> |
| | | suffix |
| | |
| | | <sequence> |
| | | <!--========== Call preambule =========--> |
| | | <call function="'phasePreamble'"> |
| | | { 'phaseName' : 'generateLdif' , |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | { 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | </call> |
| | | |
| | | <!--========== Define variables =========--> |
| | |
| | | <!--========== Call postphase =========--> |
| | | <call function="'phasePostamble'"> |
| | | { |
| | | 'phaseName' : 'generateLdif', |
| | | 'fileFd' : LOG_MAIN_FD |
| | | 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | |
| | |
| | | <!-- ************************************************************ --> |
| | | <function name="installation" 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 instances |
| | |
| | | <sequence> |
| | | <!--========== Call preambule =========--> |
| | | <call function="'phasePreamble'"> |
| | | { 'phaseName' : 'installation' , |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | { 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | </call> |
| | | |
| | | <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" |
| | |
| | | <!--========== Call postphase =========--> |
| | | <call function="'phasePostamble'"> |
| | | { |
| | | 'phaseName' : 'installation', |
| | | 'fileFd' : LOG_MAIN_FD |
| | | 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | |
| | |
| | | </function-map-args> |
| | | <sequence> |
| | | <script> |
| | | def writeSummaryTag(objPhase): |
| | | if objPhase.getRun() == 'true': |
| | | str = '<phaseSummmary' |
| | | str = '%s name=\"%s\"' % (str,objPhase.getName()) |
| | | str = '%s errNum=\"%s\"' % (str,objPhase.getErrNum()) |
| | | str = '%s percentage=\"%s\"' % (str,objPhase.getPercentage()) |
| | | str = '%s start=\"%s\"' % (str,objPhase.getStartTime()) |
| | | str = '%s stop=\"%s\"' % (str,objPhase.getStopTime()) |
| | | str = '%s/>\n' % str |
| | | fileFd.write(str) |
| | | |
| | | |
| | | fileFd.write('<summary>\n') |
| | | |
| | | # write scenario informations into summary part |
| | | str = '<scenario name=\"%s\"' % scenario.getName() |
| | | str = '%s duration=\"%s%s\" >\n' % \ |
| | | (str,scenario.getDurationTime(),scenario.getDurationUnit()) |
| | | str = '%s %s \n</scenario>' % \ |
| | | str = '%s %s \n</scenario>\n' % \ |
| | | (str,scenario.getDescription()) |
| | | fileFd.write(str) |
| | | |
| | | if ERR_NUM_PARSER != '': |
| | | str = '<phaseSummmary name=\"parser\" result=\"%s\"/>\n' % \ |
| | | ERR_NUM_PARSER |
| | | fileFd.write(str) |
| | | if ERR_NUM_INSTALL != '': |
| | | str = '<phaseSummmary name=\"installation\" result=\"%s\"/>\n'%\ |
| | | ERR_NUM_INSTALL |
| | | fileFd.write(str) |
| | | if ERR_NUM_GEN_LDIF != '': |
| | | str = '<phaseSummmary name=\"generateLdif\" result=\"%s\"/>\n'%\ |
| | | ERR_NUM_GEN_LDIF |
| | | fileFd.write(str) |
| | | if ERR_NUM_PRE_CONFIGURATION != '': |
| | | str = '<phaseSummmary name=\"preconfiguration\" result=\"%s\"/>\n'%\ |
| | | ERR_NUM_PRE_CONFIGURATION |
| | | fileFd.write(str) |
| | | if ERR_NUM_CONFIGURATION != '': |
| | | str = '<phaseSummmary name=\"configuration\" result=\"%s\"/>\n'%\ |
| | | ERR_NUM_CONFIGURATION |
| | | fileFd.write(str) |
| | | if ERR_NUM_POST_CONFIGURATION != '': |
| | | str = '<phaseSummmary name=\"postconfiguration\" result=\"%s\"/>\n'%\ |
| | | ERR_NUM_POST_CONFIGURATION |
| | | fileFd.write(str) |
| | | if ERR_NUM_SCHEDULER != '': |
| | | str = '<phaseSummmary name=\"scheduler\" result=\"%s\"/>\n' % \ |
| | | ERR_NUM_SCHEDULER |
| | | fileFd.write(str) |
| | | if ERR_NUM_VERDICT != '': |
| | | str = '<phaseSummmary name=\"verdict\" result=\"%s\"/>\n' % \ |
| | | ERR_NUM_VERDICT |
| | | fileFd.write(str) |
| | | writeSummaryTag(PHASE_PARSER) |
| | | writeSummaryTag(PHASE_INSTALLATION) |
| | | writeSummaryTag(PHASE_GEN_LDIF) |
| | | writeSummaryTag(PHASE_PRE_CONFIGURATION) |
| | | writeSummaryTag(PHASE_CONFIGURATION) |
| | | writeSummaryTag(PHASE_POST_CONFIGURATION) |
| | | writeSummaryTag(PHASE_SCHEDULER) |
| | | writeSummaryTag(PHASE_VERDICT) |
| | | |
| | | fileFd.write('</summary>\n') |
| | | </script> |
| | |
| | | DOMAIN[0] = '' |
| | | |
| | | ERR_NUM = STAXGlobal([0]) |
| | | ERR_NUM_PARSER = '' |
| | | ERR_NUM_INSTALL = '' |
| | | ERR_NUM_GEN_LDIF = '' |
| | | ERR_NUM_PRE_CONFIGURATION = '' |
| | | ERR_NUM_CONFIGURATION = '' |
| | | ERR_NUM_POST_CONFIGURATION = '' |
| | | ERR_NUM_SCHEDULER = '' |
| | | ERR_NUM_VERDICT = '' |
| | | ERR_NUM_TOTAL = 0 |
| | | ERR_NUM_TOTAL = 0 |
| | | |
| | | SHARED_FUNC_DIR = '%s/phases/shared/functions' % TESTS_DIR |
| | | </script> |
| | |
| | | LOG_MAIN_FD.write(str) |
| | | </script> |
| | | |
| | | <!-- ======= Create object for each phase ====================== --> |
| | | <script> |
| | | sys.path.append("%s/phases/parser" % TESTS_DIR ) |
| | | from parser import * |
| | | PHASE_PARSER = Phase('parser') |
| | | PHASE_INSTALLATION = Phase('installation') |
| | | PHASE_GEN_LDIF = Phase('generateldif') |
| | | PHASE_PRE_CONFIGURATION = Phase('preconfiguration') |
| | | PHASE_CONFIGURATION = Phase('configuration') |
| | | PHASE_POST_CONFIGURATION = Phase('postconfiguration') |
| | | PHASE_SCHEDULER = Phase('scheduler') |
| | | PHASE_VERDICT = Phase('verdict') |
| | | </script> |
| | | |
| | | <!-- ============ PARSER ======================================= --> |
| | | <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" |
| | |
| | | suffix = result[2] |
| | | scheduler = result[3] |
| | | scenario = result[4] |
| | | ERR_NUM_PARSER = ERR_NUM[0] |
| | | PHASE_PARSER.setRun('true') |
| | | PHASE_PARSER.setErrNum(ERR_NUM[0]) |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | </script> |
| | | <if expr="ERR_NUM_PARSER != 0"> |
| | | <if expr="PHASE_PARSER.getErrNum() != 0"> |
| | | <return/> |
| | | </if> |
| | | |
| | |
| | | file="'%s/phases/installation/installation.xml' % (TESTS_DIR)"/> |
| | | <call function="'installation'"> |
| | | { |
| | | 'phase' : PHASE_INSTALLATION, |
| | | 'instances' : instances, |
| | | 'suffix' : suffix |
| | | } |
| | | </call> |
| | | <script> |
| | | ERR_NUM_INSTALL = ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | </script> |
| | | </sequence> |
| | | </if> |
| | |
| | | <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" |
| | | file="'%s' % preConfigurationFile"/> |
| | | <call function="'preConfiguration'"> |
| | | { |
| | | { |
| | | 'phase' : PHASE_PRE_CONFIGURATION, |
| | | 'instances' : instances, |
| | | 'suffix' : suffix, |
| | | 'scheduler' : scheduler |
| | | } |
| | | </call> |
| | | <script> |
| | | ERR_NUM_PRE_CONFIGURATION = ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | </script> |
| | | </sequence> |
| | | <else> |
| | |
| | | <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" |
| | | file="'%s/phases/generateLdif/generateLdif.xml' % (TESTS_DIR)"/> |
| | | <call function="'generateLdif'"> |
| | | { 'suffix' : suffix } |
| | | { |
| | | 'phase' : PHASE_GEN_LDIF, |
| | | 'suffix' : suffix |
| | | } |
| | | </call> |
| | | <script> |
| | | ERR_NUM_GEN_LDIF = ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | </script> |
| | | </sequence> |
| | | </if> |
| | |
| | | file="'%s/phases/configuration/configuration.xml' % TESTS_DIR"/> |
| | | <call function="'configuration'"> |
| | | { |
| | | 'phase' : PHASE_CONFIGURATION, |
| | | 'instances' : instances , |
| | | 'suffix' : suffix |
| | | } |
| | | </call> |
| | | <script> |
| | | ERR_NUM_CONFIGURATION = ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | </script> |
| | | </sequence> |
| | | </if> |
| | |
| | | file="'%s' % postConfigurationFile"/> |
| | | <call function="'postConfiguration'"> |
| | | { |
| | | 'phase' : PHASE_POST_CONFIGURATUON, |
| | | 'instances' : instances, |
| | | 'suffix' : suffix, |
| | | 'scheduler' : scheduler |
| | | } |
| | | </call> |
| | | <script> |
| | | ERR_NUM_POST_CONFIGURATION = ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | </script> |
| | | </sequence> |
| | | <else> |
| | |
| | | file="'%s/phases/scheduler/scheduler.xml' % (TESTS_DIR)"/> |
| | | <call function="'scheduler'"> |
| | | { |
| | | 'phase' : PHASE_SCHEDULER, |
| | | 'instances' : instances, |
| | | 'suffix' : suffix, |
| | | 'scheduler' : scheduler, |
| | |
| | | } |
| | | </call> |
| | | <script> |
| | | ERR_NUM_SCHEDULER = ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | </script> |
| | | </sequence> |
| | | </if> |
| | |
| | | <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" |
| | | file="'%s/phases/verdict/verdict.xml' % (TESTS_DIR)"/> |
| | | <call function="'verdict'"> |
| | | { 'instances' : instances, |
| | | { |
| | | 'phase' : PHASE_VERDICT, |
| | | 'instances' : instances, |
| | | 'suffix' : suffix, |
| | | 'runConfiguration' : runConfiguration, |
| | | 'runScheduler' : runScheduler |
| | | } |
| | | </call> |
| | | <script> |
| | | ERR_NUM_VERDICT = ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0] |
| | | </script> |
| | | |
| | | <!-- ====== Write information phases to xml report ============ --> |
| | | <!-- == Write phase summary == --> |
| | | <!-- (this function is in log phase and use ERR_NUM_* variables) --> |
| | | <!-- this function is in log/log.xml file --> |
| | | <call function="'writeSummary'"> |
| | | { |
| | | 'scenario' : scenario, |
| | |
| | | } |
| | | </call> |
| | | |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | </function> |
| | | |
| | | |
| | | </stax> |
| | |
| | | |
| | | |
| | | # |
| | | # Class for phases |
| | | # |
| | | class Phase: |
| | | "Describes the phase of a system test run" |
| | | def __init__(self, name): |
| | | self.name = name |
| | | self.run = 'false' |
| | | self.start = NOT_DEFINED |
| | | self.stop = NOT_DEFINED |
| | | self.errNum = NOT_DEFINED |
| | | self.percentage = NOT_DEFINED |
| | | |
| | | def getName(self): |
| | | return self.name |
| | | |
| | | def setRun(self,run): |
| | | self.run = run |
| | | |
| | | def getRun(self): |
| | | return self.run |
| | | |
| | | def setStartTime(self,start): |
| | | self.start = start |
| | | |
| | | def getStartTime(self): |
| | | return self.start |
| | | |
| | | def setStopTime(self,stop): |
| | | self.stop = stop |
| | | |
| | | def getStopTime(self): |
| | | return self.stop |
| | | |
| | | def setErrNum(self,errNum): |
| | | self.errNum = errNum |
| | | |
| | | def getErrNum(self): |
| | | return self.errNum |
| | | |
| | | def setPercentage(self,percentage): |
| | | self.percentage = percentage |
| | | |
| | | def getPercentage(self): |
| | | return self.percentage |
| | | |
| | | |
| | | |
| | | # |
| | | # Class for suffix |
| | | # |
| | | |
| | |
| | | <!-- ************************************************************ --> |
| | | <function name="scheduler" 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> |
| | | instance object |
| | |
| | | tagAttr.append(['duration',durationValue]) |
| | | </script> |
| | | <call function="'phasePreamble'"> |
| | | { 'phaseName' : 'scheduler' , |
| | | 'tagAttr' : tagAttr, |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | { 'phase' : phase, |
| | | 'tagAttr' : tagAttr, |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | </call> |
| | | |
| | | <!--==== Get the clients list from all modules ==============--> |
| | |
| | | 'suffix' : suffix |
| | | } |
| | | </call> |
| | | <!--========== Merge files ==========--> |
| | | <!--============ Merge files ===========--> |
| | | <call function="'mergeClientsFiles'"> |
| | | { |
| | | 'scheduler' : scheduler, |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | <!--==== Calculate phase percentage ==========--> |
| | | <script> |
| | | nbClients = len(clients) |
| | | nbClientSuccess = 0 |
| | | percentageResult = 0 |
| | | </script> |
| | | <iterate in="clients" var="client"> |
| | | <script> |
| | | if client.getResult() == 'SUCCESS': |
| | | nbClientSuccess += 1 |
| | | </script> |
| | | </iterate> |
| | | <script> |
| | | percentageResult = nbClientSuccess * 100 |
| | | percentageResult = percentageResult / nbClients |
| | | phase.setPercentage(percentageResult) |
| | | </script> |
| | | </sequence> |
| | | </if> |
| | | <!--========== Call postphase =========--> |
| | | <call function="'phasePostamble'"> |
| | | { |
| | | 'phaseName' : 'scheduler', |
| | | 'fileFd' : LOG_MAIN_FD |
| | | 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | </sequence> |
| | |
| | | <else> |
| | | <script> |
| | | result = 'FAIL' |
| | | ERR_NUM[0] += 1 |
| | | </script> |
| | | </else> |
| | | </if> |
| | |
| | | if instanceIndex != lastIndex: |
| | | instance2 = instances[instanceIndex + 1] |
| | | </script> |
| | | |
| | | |
| | | <if expr="instance2 != NOT_DEFINED"> |
| | | <sequence> |
| | | <call function="'writeStartTagStep'"> |
| | |
| | | ldapSearchRC = STAXResult[0] |
| | | </script> |
| | | |
| | | <if expr="(ldapSearchRC == 0) or (ldapSearchRC == 4)"> |
| | | <if expr="ldapSearchRC != 0"> |
| | | <!-- == If the reference tree could not be retrieved, == --> |
| | | <!-- == return an error == --> |
| | | <sequence> |
| | | <call function="'writeEndTagStep'">{ 'fileFd' : fileFd}</call> |
| | | <return> [1, None] </return> |
| | | <return> [FALSE, None] </return> |
| | | </sequence> |
| | | </if> |
| | | |
| | |
| | | ldapSearchRC = STAXResult[0] |
| | | </script> |
| | | |
| | | <if expr="(ldapSearchRC == 0) or (ldapSearchRC == 4)"> |
| | | <if expr="ldapSearchRC == 0"> |
| | | <sequence> |
| | | <!-- == Check if file is empty == --> |
| | | <call function="'isEmptyFile'"> |
| | |
| | | 'fileFd' : fileFd |
| | | } |
| | | </call> |
| | | <script> _errNum += STAXResult[0] </script> |
| | | <if expr="STAXResult[0] == FALSE"> |
| | | <script> _errNum += 1 </script> |
| | | </if> |
| | | |
| | | |
| | | <!--== Check error/access logs =========--> |
| | |
| | | </call> |
| | | <script> _errNum += STAXResult </script> |
| | | |
| | | |
| | | <return> _errNum </return> |
| | | </sequence> |
| | | </function> |
| | |
| | | </function-prolog> |
| | | |
| | | <function-map-args> |
| | | <function-arg-def name="phaseName" type="required"> |
| | | <function-arg-def name="phase" type="required"> |
| | | <function-arg-description> |
| | | phase object |
| | | </function-arg-description> |
| | | </function-arg-def> |
| | | <function-arg-def name="tagAttr" type="optional" default='[]'> |
| | | <function-arg-description> |
| | |
| | | <sequence> |
| | | <!-- Start time of test suite --> |
| | | <script> |
| | | phaseStartTime=strftime("%Y%m%d@%H:%M:%S",localtime()) |
| | | phase.setStartTime(strftime("%Y%m%d@%H:%M:%S",localtime())) |
| | | ERR_NUM[0] = 0 |
| | | if tagAttr == []: |
| | | tagAttr = [['date',phaseStartTime]] |
| | | tagAttr = [['date',phase.getStartTime()]] |
| | | else: |
| | | tagAttr.append(['date',phaseStartTime]) |
| | | tagAttr.append(['date',phase.getStartTime()]) |
| | | |
| | | </script> |
| | | |
| | | <message log="1">''</message> |
| | | <message log="1"> |
| | | '=================== START PHASE %s @ %s ========================='\ |
| | | % (phaseName,phaseStartTime) |
| | | % (phase.getName(),phase.getStartTime()) |
| | | </message> |
| | | |
| | | <call function="'writeStartTagPhase'"> |
| | | { |
| | | 'tagName' : phaseName , |
| | | 'tagName' : phase.getName(), |
| | | 'tagAttr' : tagAttr, |
| | | 'fileFd' : fileFd |
| | | } |
| | |
| | | Performs all the post operations for a phase |
| | | </function-prolog> |
| | | <function-map-args> |
| | | <function-arg-def name="phaseName" type="required"> |
| | | <function-arg-def name="phase" type="required"> |
| | | <function-arg-description> |
| | | Name of the phase |
| | | phase object |
| | | </function-arg-description> |
| | | </function-arg-def> |
| | | <function-arg-def name="fileFd" type="required"> |
| | |
| | | |
| | | <sequence> |
| | | |
| | | <if expr="phaseName == 'verdict'"> |
| | | <message log="1"> |
| | | '== Found a TOTAL of %s Error(s)' % (ERR_NUM[0]) |
| | | </message> |
| | | <else> |
| | | <message log="1"> |
| | | '== Found %s Error(s) during this phase' % (ERR_NUM[0]) |
| | | </message> |
| | | </else> |
| | | </if> |
| | | <script> |
| | | phase.setRun('true') |
| | | phase.setStopTime(strftime("%Y%m%d@%H:%M:%S",localtime())) |
| | | phase.setErrNum(ERR_NUM[0]) |
| | | </script> |
| | | |
| | | <message log="1"> |
| | | '== Found %s Error(s) during this phase' % (phase.getErrNum()) |
| | | </message> |
| | | <message log="1"> |
| | | '=================== STOP PHASE %s ============================' \ |
| | | % (phaseName) |
| | | % (phase.getName()) |
| | | </message> |
| | | |
| | | <call function="'writeTag'"> |
| | | { |
| | | 'tagName' : 'phaseResult', |
| | | 'tagAttr' : [['errNum',ERR_NUM[0]]] , |
| | | 'tagAttr' : [['errNum',phase.getErrNum()]] , |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | |
| | | <!-- ************************************************************ --> |
| | | <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 |
| | |
| | | <sequence> |
| | | <!--========== Call preambule =========--> |
| | | <call function="'phasePreamble'"> |
| | | { 'phaseName' : 'verdict', |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | { 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | </call> |
| | | |
| | | |
| | | <script> |
| | | items = STAXGlobal([]) |
| | | </script> |
| | | <!--== Check if previous phases raised some errors ==--> |
| | | <if expr="ERR_NUM_INSTALL != 0 and ERR_NUM_INSTALL != ''"> |
| | | <script> ERR_NUM[0] += 1 </script> |
| | | <!-- installation --> |
| | | <call function="'checkPhaseResult'"> |
| | | { 'phase' : PHASE_INSTALLATION } |
| | | </call> |
| | | <if expr="STAXResult != []"> |
| | | <script> items.append(STAXResult) </script> |
| | | </if> |
| | | <if expr="ERR_NUM_GEN_LDIF != 0 and ERR_NUM_GEN_LDIF != ''"> |
| | | <script> ERR_NUM[0] += 1 </script> |
| | | <!-- pre-configuration --> |
| | | <call function="'checkPhaseResult'"> |
| | | { 'phase' : PHASE_PRE_CONFIGURATION } |
| | | </call> |
| | | <if expr="STAXResult != []"> |
| | | <script> items.append(STAXResult) </script> |
| | | </if> |
| | | <if expr="ERR_NUM_CONFIGURATION != 0 and ERR_NUM_CONFIGURATION != ''"> |
| | | <script> ERR_NUM[0] += 1 </script> |
| | | <!-- gen-ldif --> |
| | | <call function="'checkPhaseResult'"> |
| | | { 'phase' : PHASE_GEN_LDIF } |
| | | </call> |
| | | <if expr="STAXResult != []"> |
| | | <script> items.append(STAXResult) </script> |
| | | </if> |
| | | <if expr="ERR_NUM_SCHEDULER != 0 and ERR_NUM_SCHEDULER != ''"> |
| | | <script> ERR_NUM[0] += 1 </script> |
| | | <!-- 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 ==--> |
| | |
| | | 'fileFd' : cFileFd |
| | | } |
| | | </call> |
| | | <script> |
| | | items.append(['instance %s' % instance.getName(),STAXResult]) |
| | | </script> |
| | | </sequence> |
| | | </if> |
| | | |
| | |
| | | </sequence> |
| | | </if> |
| | | |
| | | |
| | | <!--==== Calculate phase percentage ==========--> |
| | | <script> |
| | | nbItems = len(items) |
| | | nbItemSuccess = 0 |
| | | percentageResult = 0 |
| | | </script> |
| | | <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> |
| | | |
| | | <!--========== Call postphase =========--> |
| | | <call function="'phasePostamble'"> |
| | | { |
| | | 'phaseName' : 'verdict', |
| | | 'fileFd' : LOG_MAIN_FD |
| | | 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | |
| | |
| | | |
| | | |
| | | |
| | | <!-- ************************************************************ --> |
| | | <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> |
| | |
| | | <xsl:apply-templates select="instance"/> |
| | | <xsl:apply-templates select="operation"/> |
| | | <xsl:apply-templates select="message"/> |
| | | <xsl:apply-templates select="operationResult"/> |
| | | </p> |
| | | </body> |
| | | </html> |
| | |
| | | <xsl:with-param name="phaseName" select="'Installation'" /> |
| | | </xsl:call-template> |
| | | </xsl:when> |
| | | <xsl:when test="$phaseName = 'generateLdif'"> |
| | | <xsl:when test="$phaseName = 'generateldif'"> |
| | | <a name="generateLdif"/> |
| | | <xsl:call-template name="parsePhase"> |
| | | <xsl:with-param name="phaseName" select="'GenerateLdif'" /> |
| | |
| | | <a href="#{$name}"><xsl:value-of select="$name" /> </a> |
| | | </td> |
| | | <td> |
| | | <xsl:variable name="result" select="normalize-space(@result)"/> |
| | | <b> |
| | | <xsl:variable name="percentage" select="normalize-space(@percentage)"/> |
| | | <xsl:choose> |
| | | <xsl:when test="$result='0'"> |
| | | <span class="pass">PASS</span> |
| | | <!-- Display percentage first if exist else the number of error --> |
| | | <xsl:when test="$percentage != 'ERROR_not_defined'"> |
| | | <xsl:choose> |
| | | <xsl:when test="$percentage > '90'"> |
| | | <b> |
| | | <span class="pass"><xsl:value-of select="$percentage"/>%</span> |
| | | </b> |
| | | </xsl:when> |
| | | <xsl:otherwise> |
| | | <b> |
| | | <span class="fail"><xsl:value-of select="$percentage"/>%</span> |
| | | </b> |
| | | </xsl:otherwise> |
| | | </xsl:choose> |
| | | </xsl:when> |
| | | |
| | | <!-- Display number of error --> |
| | | <xsl:otherwise> |
| | | <span class="fail">FAIL</span> |
| | | <xsl:variable name="errNum" select="normalize-space(@errNum)"/> |
| | | <b> |
| | | <xsl:choose> |
| | | <xsl:when test="$errNum='0'"> |
| | | <span class="pass">PASS</span> |
| | | </xsl:when> |
| | | <xsl:otherwise> |
| | | <span class="fail">FAIL</span> |
| | | </xsl:otherwise> |
| | | </xsl:choose> |
| | | </b> |
| | | </xsl:otherwise> |
| | | </xsl:choose> |
| | | </b> |
| | | </td></tr> |
| | | </xsl:choose> |
| | | </td> |
| | | |
| | | </tr> |
| | | </xsl:template> |
| | | |
| | | |
| | |
| | | |
| | | <function name="postConfiguration" 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 instances classes |
| | |
| | | |
| | | <!-- ================= Call preambule ======================== --> |
| | | <call function="'phasePreamble'"> |
| | | { 'phaseName' : 'postconfiguration', |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | { 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | </call> |
| | | |
| | | |
| | |
| | | <!-- ================= Call postambule ======================= --> |
| | | <call function="'phasePostamble'"> |
| | | { |
| | | 'phaseName' : 'postconfiguration', |
| | | 'fileFd' : LOG_MAIN_FD |
| | | 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | </sequence> |
| | |
| | | |
| | | <function name="preConfiguration" 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 instances classes |
| | |
| | | <sequence> |
| | | <!-- ================= Call preambule ======================== --> |
| | | <call function="'phasePreamble'"> |
| | | { 'phaseName' : 'preconfiguration', |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | { 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD } |
| | | </call> |
| | | |
| | | |
| | |
| | | <!-- ================= Call postambule ======================= --> |
| | | <call function="'phasePostamble'"> |
| | | { |
| | | 'phaseName' : 'preconfiguration', |
| | | 'fileFd' : LOG_MAIN_FD |
| | | 'phase' : phase, |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | |