Exemplo n.º 1
0
def validateTemplates(domainProperties):
    valid = 1
    templates = domainProperties.getProperty('wls.templates')
    if not templates is None and len(templates) > 0:
        helper.printHeader('[VALIDATING] Domain Templates')
        templateList = templates.split(',')
        for template in templateList:
            templateFile = domainProperties.getProperty('wls.template.' +
                                                        str(template) +
                                                        '.file')
            if not templateFile is None:
                if not File(templateFile).exists():
                    valid = 0
                    log.error('Template defined in property wls.template.' +
                              str(template) + '.file does not exist: ' +
                              templateFile)
                    if templateFile.find('wlsb') > -1:
                        log.info('Suggested fix: Ensure OSB is installed.')
                    if templateFile.find('oracle.soa_template_11.1.1') > -1:
                        log.info(
                            'Suggested fix: Ensure SOA Suite 11g is installed.'
                        )
                else:
                    log.debug('Template ' + templateFile + ' is valid.')
    return valid
def validateMachines(domainProperties):
    error = 0
    machines = domainProperties.getProperty('wls.domain.machines')
    if not machines is None and len(machines)>0:
        machineList = machines.split(',')
        for machine in machineList:
            helper.printHeader('[VALIDATING] machine ' + str(machine) + ' properties')
            
            machineName = domainProperties.getProperty('wls.domain.machine.' + str(machine) + '.name')
            if machineName is None or len(machineName)==0:
                error = 1
                log.error('Please verify wls.domain.machine.' + str(machine) + '.name property if it exists in configuration.')
            else:
                log.debug('Machine [' + str(machine) + '] name property [' + str(machineName) + '] is valid.')
                
            nodeType = domainProperties.getProperty('wls.domain.machine.' + str(machine) + '.nodemanager.type')
            if not nodeType is None and len(nodeType)>0:
                if not nodeType=='SSH' and not nodeType=='RSH' and not nodeType=='Plain' and not nodeType=='SSL' and not nodeType=='ssh' and not nodeType=='rsh' and not nodeType=='ssl' and not nodeType=='plain':
                    error = 1
                    log.error('The wls.domain.machine.' + str(machine) + '.nodemanager.type property support only [SSH,RSH,Plain,SSL,ssh,rsh,ssl,plain].')
                else:
                    log.debug('Machine [' + str(machine) + '] node type property [' + str(nodeType) + '] is valid.')

                nodeAddr = domainProperties.getProperty('wls.domain.machine.' + str(machine) + '.nodemanager.address')
                if nodeAddr is None or len(nodeAddr)==0:
                    error = 1
                    log.error('Please verify wls.domain.machine.' + str(machine) + '.nodemanager.address property if it exists in configuration.')
                else:
                    log.debug('Machine [' + str(machine) + '] node address property [' + str(nodeAddr) + '] is valid.')

                nodePort = domainProperties.getProperty('wls.domain.machine.' + str(machine) + '.nodemanager.port')
                if not nodePort is None and len(nodePort)>0:
                    try:
                        int(nodePort)
                    except ValueError:
                        log.error('Please verify wls.domain.machine.' + str(machine) + '.nodemanager.port property.')
                    else:
                        if int(nodePort)<0 or int(nodePort)>65535:
                            log.error('Please verify wls.domain.machine.' + str(machine) + '.nodemanager.port property, port number is not in valid range [0-65535].')
                        else:
                            log.debug('Machine [' + str(machine) + '] node manager port [' + str(nodePort) + '] is valid.')

                if nodeType=='SSH' or nodeType=='ssh' or nodeType=='RSH' or nodeType=='rsh':
                    nodehome = domainProperties.getProperty('wls.domain.machine.' + str(machine) + '.nodemanager.nodeManagerHome')
                    if nodehome is None or len(nodehome)==0:
                        error = 1
                        log.error('Please verify wls.domain.machine.' + str(machine) + '.nodemanager.nodeManagerHome property if it exists in configuration.')
                    else:
                        log.debug('Machine [' + str(machine) + '] nodemanager home property [' + str(nodeAddr) + '] is valid.')

                    nodeShell = domainProperties.getProperty('wls.domain.machine.' + str(machine) + '.nodemanager.shellCommand')
                    if nodeShell is None or len(nodeShell)==0:
                        error = 1
                        log.error('Please verify wls.domain.machine.' + str(machine) + '.nodemanager.shellCommand property if it exists in configuration.')
                    else:
                        log.debug('Machine [' + str(machine) + '] nodemanager shell command property [' + str(nodeShell) + '] is valid.')
    return error
def validateFilestoresProperty(domainProperties):
    error = 0
    
    filestores = domainProperties.getProperty('persistent.filestores')
    if not filestores is None and len(filestores)>0:
       
        filestoreList = filestores.split(',')
        for filestore in filestoreList:
            helper.printHeader('[VALIDATING] filestore ' + str(filestore) + ' properties')
            
            filestoreName = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Name')
            if filestoreName is None or len(filestoreName)==0:
                error = 1
                log.error('Please verify persistent.filestore.' + str(filestore) + '.Name property if it exists in configuration.')
            else:
                log.debug('Filestore [' + str(filestore) + '] name property [' + str(filestoreName) + '] is valid.')
                
            filestoreTarget = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Target')
            if not filestoreTarget is None and len(filestoreTarget)>0:
                servers = domainProperties.getProperty('wls.servers')
                if not servers is None and len(servers)>0:
                    serverList = servers.split(',')
                    exist = 0
                    for server in serverList:
                        if server==filestoreTarget:
                            exist = 1
                            break
                    if not exist:
                        error = 1
                        log.error('persistent.filestore.' + str(filestore) + '.Target property refers to server that does not exist within wls.servers property.')
                    else:
                        log.debug('Filestore [' + str(filestore) + '] target property [' + str(filestoreTarget) + '] is valid.')
            
                filestoreMigratable = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Migratable')
                if not filestoreMigratable is None and len(filestoreMigratable)>0:
                    if not filestoreMigratable.upper()=='TRUE' and not filestoreMigratable.upper()=='FALSE':
                        error = 1
                        log.error('The persistent.filestore.' + str(filestore) + '.Migratable property supports only [true,false, or leave blank to use default].')
                    else:
                        log.debug('Filestore [' + str(filestore) + '] migratable property [' + str(filestoreMigratable) + '] is valid.')

            location = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Location')
            if not location is None and len(location)>0:
                file = File(location)
                if file.isAbsolute():
                    if not file.exists():
                        log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(location) + '].')
    return error
Exemplo n.º 4
0
def validateFilestoresProperty(domainProperties):
    error = 0
    
    filestores = domainProperties.getProperty('persistent.filestores')
    if not filestores is None and len(filestores)>0:
       
        filestoreList = filestores.split(',')
        for filestore in filestoreList:
            helper.printHeader('[VALIDATING] filestore ' + str(filestore) + ' properties')
            
            filestoreName = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Name')
            if filestoreName is None or len(filestoreName)==0:
                error = 1
                log.error('Please verify persistent.filestore.' + str(filestore) + '.Name property if it exists in configuration.')
            else:
                log.debug('Filestore [' + str(filestore) + '] name property [' + str(filestoreName) + '] is valid.')
                
            filestoreTarget = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Target')
            if not filestoreTarget is None and len(filestoreTarget)>0:
                servers = domainProperties.getProperty('wls.servers')
                if not servers is None and len(servers)>0:
                    serverList = servers.split(',')
                    exist = 0
                    for server in serverList:
                        if server==filestoreTarget:
                            exist = 1
                            break
                    if not exist:
                        error = 1
                        log.error('persistent.filestore.' + str(filestore) + '.Target property refers to server that does not exist within wls.servers property.')
                    else:
                        log.debug('Filestore [' + str(filestore) + '] target property [' + str(filestoreTarget) + '] is valid.')
            
                filestoreMigratable = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Migratable')
                if not filestoreMigratable is None and len(filestoreMigratable)>0:
                    if not filestoreMigratable.upper()=='TRUE' and not filestoreMigratable.upper()=='FALSE':
                        error = 1
                        log.error('The persistent.filestore.' + str(filestore) + '.Migratable property supports only [true,false, or leave blank to use default].')
                    else:
                        log.debug('Filestore [' + str(filestore) + '] migratable property [' + str(filestoreMigratable) + '] is valid.')

            location = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Location')
            if not location is None and len(location)>0:
                file = File(location)
                if file.isAbsolute():
                    if not file.exists():
                        log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(location) + '].')
    return error
def validateTemplates(domainProperties):  
    valid = 1
    templates = domainProperties.getProperty('wls.templates')
    if not templates is None and len(templates)>0:
        helper.printHeader('[VALIDATING] Domain Templates')
        templateList = templates.split(',')
        for template in templateList:
            templateFile = domainProperties.getProperty('wls.template.' + str(template) + '.file')
            if not templateFile is None:
                if not File(templateFile).exists():
                    valid = 0
                    log.error('Template defined in property wls.template.' + str(template) + '.file does not exist: ' + templateFile)
                    if templateFile.find('wlsb')>-1:
                        log.info('Suggested fix: Ensure OSB is installed.')
                    if templateFile.find('oracle.soa_template_11.1.1')>-1:
                        log.info('Suggested fix: Ensure SOA Suite 11g is installed.')
                else:
                    log.debug('Template ' + templateFile + ' is valid.')
    return valid
Exemplo n.º 6
0
def run(cfg):
    valid = 1

    helper.printHeader('[VALIDATING] nodemanager properties')

    if helper.validateBoolean(cfg, 'nodemanager.secure.listener') is 0:
        valid = 0
    if helper.validateBoolean(cfg, 'nodemanager.crashrecovery') is 0:
        valid = 0
    if helper.validateBoolean(cfg, 'nodemanager.startscriptenabled') is 0:
        valid = 0
    if helper.validateBoolean(cfg, 'nodemanager.domain.dir.sharing') is 0:
        valid = 0
    if helper.validateNumber(cfg, 'nodemanager.logcount') is 0:
        valid = 0
    if helper.validateNumber(cfg, 'nodemanager.loglimit') is 0:
        valid = 0
    if helper.validateNumber(cfg, 'nodemanager.listerner.port') is 0:
        valid = 0

    return valid
def run(cfg):
	valid=1
	
	helper.printHeader('[VALIDATING] nodemanager properties')
	
	if helper.validateBoolean(cfg,'nodemanager.secure.listener') is 0:
		valid=0		
	if helper.validateBoolean(cfg,'nodemanager.crashrecovery') is 0:
		valid=0		
	if helper.validateBoolean(cfg,'nodemanager.startscriptenabled') is 0:
		valid=0	
	if helper.validateBoolean(cfg,'nodemanager.domain.dir.sharing') is 0:
		valid=0
	if helper.validateNumber(cfg,'nodemanager.logcount') is 0:
		valid=0
	if helper.validateNumber(cfg,'nodemanager.loglimit') is 0:
		valid=0
	if helper.validateNumber(cfg,'nodemanager.listerner.port') is 0:
		valid=0
		
	return valid
		
def validateDataSources(domainProperties):

    error = 0

    datasources = domainProperties.getProperty('jdbc.datasources')
    if not datasources is None and len(datasources) > 0:
        datasourceList = datasources.split(',')
        for datasource in datasourceList:
            helper.printHeader('[VALIDATING] DataSource ' + str(datasource) +
                               ' properties')
            if validateDataSource(domainProperties, datasource):
                error = 1

    multidatasources = domainProperties.getProperty('jdbc.multidatasources')
    if not multidatasources is None and len(multidatasources) > 0:
        multidatasourceList = multidatasources.split(',')
        for multidatasource in multidatasourceList:
            helper.printHeader('[VALIDATING] Multi-DataSource ' +
                               str(multidatasource) + ' properties')
            if validateMultiDataSource(domainProperties, datasources,
                                       multidatasource):
                error = 1

    return error
Exemplo n.º 9
0
def sanityCheckInstall(domainProperties):

    beahome = domainProperties.getProperty('wls.oracle.home')

    helper.printHeader('[VALIDATING] wls.oracle.home property')

    if beahome is None or len(beahome) == 0:
        raise Exception("Required property wls.oracle.home does not exist.")
    else:
        homeDir = File(beahome)
        if not homeDir.exists():
            log.error(
                "Property wls.oracle.home refers to an installation directory "
                + beahome + " that does not exist.")
            sys.exit()
        else:
            log.debug('wls.oracle.home directory [' + str(beahome) +
                      '] exists.')

    helper.printHeader('[VALIDATING] WebLogic directory property')

    wls = domainProperties.getProperty('wls.name')
    wlsDir = File(str(beahome) + File.separator + str(wls))
    if not wlsDir.exists():
        log.error(
            'WebLogic directory does not exist in wls.oracle.home directory, please verify wls.name and wls.oracle.home property.'
        )
        sys.exit()
    else:
        log.debug('WebLogic directory [' + str(wls) + '] exists in ' + beahome)

    helper.printHeader('[VALIDATING] wls.domain.javahome property')

    javahome = domainProperties.getProperty('wls.domain.javahome')
    javahomeDir = File(str(javahome))
    if not javahomeDir.exists():
        log.error(
            'JAVA_HOME directory ' + str(javahomeDir) +
            ' does not exist, please verify wls.domain.javahome property.')
        sys.exit()
    else:
        log.debug('JAVA_HOME directory [' + str(javahome) + '] exists.')

        validTemplates = validateTemplates(domainProperties)
        if not validTemplates:
            sys.exit()
def sanityCheckInstall(domainProperties):

    beahome = domainProperties.getProperty('wls.oracle.home')

    helper.printHeader('[VALIDATING] wls.oracle.home property')

    if beahome is None or len(beahome)==0:
        raise Exception("Required property wls.oracle.home does not exist.")
    else:
        homeDir = File(beahome)
        if not homeDir.exists():
            log.error("Property wls.oracle.home refers to an installation directory " + beahome + " that does not exist.")
            sys.exit()
        else:
            log.debug('wls.oracle.home directory [' + str(beahome) + '] exists.')

    helper.printHeader('[VALIDATING] WebLogic directory property')

    wls = domainProperties.getProperty('wls.name')
    wlsDir = File(str(beahome) + File.separator + str(wls)) 
    if not wlsDir.exists():
        log.error('WebLogic directory does not exist in wls.oracle.home directory, please verify wls.name and wls.oracle.home property.')
        sys.exit()
    else:
        log.debug('WebLogic directory [' + str(wls) + '] exists in ' + beahome)

    helper.printHeader('[VALIDATING] wls.domain.javahome property')

    javahome = domainProperties.getProperty('wls.domain.javahome')
    javahomeDir = File(str(javahome))
    if not javahomeDir.exists():
        log.error('JAVA_HOME directory ' + str(javahomeDir) + ' does not exist, please verify wls.domain.javahome property.')
        sys.exit()
    else:
        log.debug('JAVA_HOME directory [' + str(javahome) + '] exists.')
        
	validTemplates=validateTemplates(domainProperties)
	if not validTemplates:
		sys.exit()
def validateWorkManagerProperty(domainProperties):

    error = 0
    
    workManagers = domainProperties.getProperty('wls.workManagers')
    if not workManagers is None and len(workManagers)>0:
        workManagerList = workManagers.split(',')
        for workManager in workManagerList:
            helper.printHeader('[VALIDATING] workmanager ' + str(workManager) + ' properties')
            
            workManagerName = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.name')
            if workManagerName is None or len(workManagerName)==0:
                error = 1
                log.error('Please verify wls.workManager.' + str(workManager) + '.name property if it exists in configuration.')
            else:
                log.debug('Workmanager [' + str(workManager) + '] name property [' + str(workManagerName) + '] is valid.')

            workManagerTargetType = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.targetType')
            if not workManagerTargetType is None and len(workManagerTargetType)>0:
                if not workManagerTargetType.upper()=='CLUSTER' and not workManagerTargetType.upper()=='SERVER':
                    error = 1
                    log.error('The wls.workManager.' + str(workManager) + '.targetType property supports only [Cluster,Server, or leave blank to target to AdminServer].')
                else:
                    log.debug('Workmanager [' + str(workManager) + '] target type property [' + str(workManagerTargetType) + '] is valid.')
                    
                    workManagerTargets = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.targets')
                    if workManagerTargets is None or len(workManagerTargets)==0:
                        error = 1
                        log.error('Please verify wls.workManager.' + str(workManager) + '.targets property if it exists in configuration.')
                    else:
                        clusters = domainProperties.getProperty('wls.clusters')
                        servers = domainProperties.getProperty('wls.servers')
                        workManagerTargetList = workManagerTargets.split(',')
                        for workManagerTarget in workManagerTargetList:
                            if workManagerTargetType.upper()=='SERVER':
                                if not servers is None and len(servers)>0:
                                    serverList = servers.split(',')
                                    exist = 0
                                    for server in serverList:
                                        if server==workManagerTarget:
                                            exist = 1
                                            break
                                    if not exist:
                                        error = 1
                                        log.error('Please verify wls.workManager.' + str(workManager) + '.targets property at server [' + str(workManagerTarget) + '] and wls.servers if they are configured properly.')
                                    else:
                                        log.debug('Workmanager [' + str(workManager) + '] target [' + str(workManagerTarget) + '] is valid.')
                            else:
                                if workManagerTargetType.upper()=='CLUSTER':
                                    if not clusters is None and len(clusters)>0:
                                        clusterList = clusters.split(',')
                                        exist = 0
                                        for cluster in clusterList:
                                            if cluster==workManagerTarget:
                                                exist = 1
                                                break
                                        if not exist:
                                            error = 1
                                            log.error('Please verify wls.workManager.' + str(workManager) + '.targets property at cluster [' + str(workManagerTarget) + '] and wls.clusters if they are configured properly.')
                                        else:
                                            log.debug('Workmanager [' + str(workManager) + '] target [' + str(workManagerTarget) + '] is valid.')

            minThreadsConstraintName = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.minThreadsConstraint.name')
            if not minThreadsConstraintName is None and len(minThreadsConstraintName)>0:
                log.debug('Workmanager [' + str(workManager) + '] min-thread constraint name property [' + str(minThreadsConstraintName) + '] is valid.')
                
                minThreadsConstraintCount = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.minThreadsConstraint.count')
                if not minThreadsConstraintCount is None and len(minThreadsConstraintCount)>0:
                    try:
                        int(minThreadsConstraintCount)
                    except ValueError:
                        log.error('Please verify wls.workManager.' + str(workManager) + '.minThreadsConstraint.count [' + str(minThreadsConstraintCount) + '] property.')
                    else:
                        if int(minThreadsConstraintCount)<0 or int(minThreadsConstraintCount)>65535:
                            log.error('Please verify wls.workManager.' + str(workManager) + '.minThreadsConstraint.count [' + str(minThreadsConstraintCount) + '] property, the number is not in valid range [0-65535].')
                        else:
                            log.debug('Workmanager [' + str(workManager) + '] min-thread constraint count property [' + str(minThreadsConstraintCount) + '] is valid.')
                    
                constraintTargetType = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.minThreadsConstraint.targetType')
                if not constraintTargetType is None and len(constraintTargetType)>0:
                    if not constraintTargetType.upper()=='CLUSTER' and not constraintTargetType.upper()=='SERVER':
                        error = 1
                        log.error('The wls.workManager.' + str(workManager) + '.minThreadsConstraint.targetType property supports only [Cluster,Server, or leave blank to target to AdminServer].')
                    else:
                        log.debug('Workmanager [' + str(workManager) + '] min-thread constraint target type property [' + str(constraintTargetType) + '] is valid.')
                        
                        constraintTargets = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.minThreadsConstraint.targets')
                        if constraintTargets is None or len(constraintTargets)==0:
                            error = 1
                            log.error('Please verify wls.workManager.' + str(workManager) + '.minThreadsConstraint.targets property if it exists in configuration.')
                        else:
                            clusters = domainProperties.getProperty('wls.clusters')
                            servers = domainProperties.getProperty('wls.servers')
                            constraintTargetList = constraintTargets.split(',')
                            for constraintTarget in constraintTargetList:
                                if constraintTargetType.upper()=='SERVER':
                                    if not servers is None and len(servers)>0:
                                        serverList = servers.split(',')
                                        exist = 0
                                        for server in serverList:
                                            if server==constraintTarget:
                                                exist = 1
                                                break
                                        if not exist:
                                            error = 1
                                            log.error('Please verify wls.workManager.' + str(workManager) + '.minThreadsConstraint.targets property at server [' + str(constraintTarget) + '] and wls.servers if they are configured properly.')
                                        else:
                                            log.debug('Workmanager [' + str(workManager) + '] min-thread constraint target [' + str(constraintTarget) + '] is valid.')
                                else:
                                    if constraintTargetType.upper()=='CLUSTER':
                                        if not clusters is None and len(clusters)>0:
                                            clusterList = clusters.split(',')
                                            exist = 0
                                            for cluster in clusterList:
                                                if cluster==constraintTarget:
                                                    exist = 1
                                                    break
                                            if not exist:
                                                error = 1
                                                log.error('Please verify wls.workManager.' + str(workManager) + '.minThreadsConstraint.targets property at cluster [' + str(constraintTarget) + '] and wls.clusters if they are configured properly.')
                                            else:
                                                log.debug('Workmanager [' + str(workManager) + '] min-thread constraint target [' + str(constraintTarget) + '] is valid.')

            maxThreadsConstraintName = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.maxThreadsConstraint.name')
            if not maxThreadsConstraintName is None and len(maxThreadsConstraintName)>0:
                log.debug('Workmanager [' + str(workManager) + '] max-thread constraint name property [' + str(maxThreadsConstraintName) + '] is valid.')
                
                maxThreadsConstraintCount = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.maxThreadsConstraint.count')
                if not maxThreadsConstraintCount is None and len(maxThreadsConstraintCount)>0:
                    try:
                        int(maxThreadsConstraintCount)
                    except ValueError:
                        log.error('Please verify wls.workManager.' + str(workManager) + '.maxThreadsConstraint.count [' + str(maxThreadsConstraintCount) + '] property.')
                    else:
                        if int(maxThreadsConstraintCount)<0 or int(maxThreadsConstraintCount)>65535:
                            log.error('Please verify wls.workManager.' + str(workManager) + '.maxThreadsConstraint.count [' + str(maxThreadsConstraintCount) + '] property, the number is not in valid range [0-65535].')
                        else:
                            log.debug('Workmanager [' + str(workManager) + '] max-thread constraint count property [' + str(maxThreadsConstraintCount) + '] is valid.')
                    
                constraintTargetType = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.maxThreadsConstraint.targetType')
                if not constraintTargetType is None and len(constraintTargetType)>0:
                    if not constraintTargetType.upper()=='CLUSTER' and not constraintTargetType.upper()=='SERVER':
                        error = 1
                        log.error('The wls.workManager.' + str(workManager) + '.maxThreadsConstraint.targetType property supports only [Cluster,Server, or leave blank to target to AdminServer].')
                    else:
                        log.debug('Workmanager [' + str(workManager) + '] max-thread constraint target type property [' + str(constraintTargetType) + '] is valid.')
                        
                        constraintTargets = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.maxThreadsConstraint.targets')
                        if constraintTargets is None or len(constraintTargets)==0:
                            error = 1
                            log.error('Please verify wls.workManager.' + str(workManager) + '.maxThreadsConstraint.targets property if it exists in configuration.')
                        else:
                            clusters = domainProperties.getProperty('wls.clusters')
                            servers = domainProperties.getProperty('wls.servers')
                            constraintTargetList = constraintTargets.split(',')
                            for constraintTarget in constraintTargetList:
                                if constraintTargetType.upper()=='SERVER':
                                    if not servers is None and len(servers)>0:
                                        serverList = servers.split(',')
                                        exist = 0
                                        for server in serverList:
                                            if server==constraintTarget:
                                                exist = 1
                                                break
                                        if not exist:
                                            error = 1
                                            log.error('Please verify wls.workManager.' + str(workManager) + '.maxThreadsConstraint.targets property at server [' + str(constraintTarget) + '] and wls.servers if they are configured properly.')
                                        else:
                                            log.debug('Workmanager [' + str(workManager) + '] max-thread constraint target [' + str(constraintTarget) + '] is valid.')
                                else:
                                    if constraintTargetType.upper()=='CLUSTER':
                                        if not clusters is None and len(clusters)>0:
                                            clusterList = clusters.split(',')
                                            exist = 0
                                            for cluster in clusterList:
                                                if cluster==constraintTarget:
                                                    exist = 1
                                                    break
                                            if not exist:
                                                error = 1
                                                log.error('Please verify wls.workManager.' + str(workManager) + '.maxThreadsConstraint.targets property at cluster [' + str(constraintTarget) + '] and wls.clusters if they are configured properly.')
                                            else:
                                                log.debug('Workmanager [' + str(workManager) + '] max-thread constraint target [' + str(constraintTarget) + '] is valid.')

            classCount=0
            fairShareRequestClassName = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.fairShareRequestClass.name')
            if not fairShareRequestClassName is None and len(fairShareRequestClassName)>0:
                log.debug('Workmanager [' + str(workManager) + '] fairshare constraint name property [' + str(fairShareRequestClassName) + '] is valid.')
                classCount=classCount+1
                
                fairShareRequestClassFairShare = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.fairShareRequestClass.fairShare')
                if not fairShareRequestClassFairShare is None and len(fairShareRequestClassFairShare)>0:
                    try:
                        int(fairShareRequestClassFairShare)
                    except ValueError:
                        log.error('Please verify wls.workManager.' + str(workManager) + '.fairShareRequestClass.fairShare [' + str(fairShareRequestClassFairShare) + '] property.')
                    else:
                        if int(fairShareRequestClassFairShare)<1 or int(fairShareRequestClassFairShare)>1000:
                            log.error('Please verify wls.workManager.' + str(workManager) + '.fairShareRequestClass.fairShare [' + str(fairShareRequestClassFairShare) + '] property, the number is not in valid range [1-1000].')
                        else:
                            log.debug('Workmanager [' + str(workManager) + '] fairshare constraint property [' + str(fairShareRequestClassFairShare) + '] is valid.')
                    
                constraintTargetType = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.fairShareRequestClass.targetType')
                if not constraintTargetType is None and len(constraintTargetType)>0:
                    if not constraintTargetType.upper()=='CLUSTER' and not constraintTargetType.upper()=='SERVER':
                        error = 1
                        log.error('The wls.workManager.' + str(workManager) + '.fairShareRequestClass.targetType property supports only [Cluster,Server, or leave blank to target to AdminServer].')
                    else:
                        log.debug('Workmanager [' + str(workManager) + '] fairshare constraint target type property [' + str(constraintTargetType) + '] is valid.')
                        
                        constraintTargets = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.fairShareRequestClass.targets')
                        if constraintTargets is None or len(constraintTargets)==0:
                            error = 1
                            log.error('Please verify wls.workManager.' + str(workManager) + '.fairShareRequestClass.targets property if it exists in configuration.')
                        else:
                            clusters = domainProperties.getProperty('wls.clusters')
                            servers = domainProperties.getProperty('wls.servers')
                            constraintTargetList = constraintTargets.split(',')
                            for constraintTarget in constraintTargetList:
                                if constraintTargetType.upper()=='SERVER':
                                    if not servers is None and len(servers)>0:
                                        serverList = servers.split(',')
                                        exist = 0
                                        for server in serverList:
                                            if server==constraintTarget:
                                                exist = 1
                                                break
                                        if not exist:
                                            error = 1
                                            log.error('Please verify wls.workManager.' + str(workManager) + '.fairShareRequestClass.targets property at server [' + str(constraintTarget) + '] and wls.servers if they are configured properly.')
                                        else:
                                            log.debug('Workmanager [' + str(workManager) + '] fairshare constraint target [' + str(constraintTarget) + '] is valid.')
                                else:
                                    if constraintTargetType.upper()=='CLUSTER':
                                        if not clusters is None and len(clusters)>0:
                                            clusterList = clusters.split(',')
                                            exist = 0
                                            for cluster in clusterList:
                                                if cluster==constraintTarget:
                                                    exist = 1
                                                    break
                                            if not exist:
                                                error = 1
                                                log.error('Please verify wls.workManager.' + str(workManager) + '.fairShareRequestClass.targets property at cluster [' + str(constraintTarget) + '] and wls.clusters if they are configured properly.')
                                            else:
                                                log.debug('Workmanager [' + str(workManager) + '] fairshare constraint target [' + str(constraintTarget) + '] is valid.')

            responseTimeRequestClassName = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.responseTimeRequestClass.name')
            if not responseTimeRequestClassName is None and len(responseTimeRequestClassName)>0:
                log.debug('Workmanager [' + str(workManager) + '] response-time constraint name property [' + str(responseTimeRequestClassName) + '] is valid.')
                classCount=classCount+1
                
                responseTimeRequestClassGoal = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.fairShareRequestClass.fairShare')
                if not responseTimeRequestClassGoal is None and len(responseTimeRequestClassGoal)>0:
                    try:
                        int(responseTimeRequestClassGoal)
                    except ValueError:
                        log.error('Please verify wls.workManager.' + str(workManager) + '.responseTimeRequestClass.goalMs [' + str(responseTimeRequestClassGoal) + '] property.')
                    else:
                        if int(responseTimeRequestClassGoal)<0 or int(responseTimeRequestClassGoal)>65535:
                            log.error('Please verify wls.workManager.' + str(workManager) + '.responseTimeRequestClass.goalMs [' + str(responseTimeRequestClassGoal) + '] property, the number is not in valid range [0-65535].')
                        else:
                            log.debug('Workmanager [' + str(workManager) + '] response-time constraint goal property [' + str(responseTimeRequestClassGoal) + '] is valid.')
                    
                constraintTargetType = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.responseTimeRequestClass.targetType')
                if not constraintTargetType is None and len(constraintTargetType)>0:
                    if not constraintTargetType.upper()=='CLUSTER' and not constraintTargetType.upper()=='SERVER':
                        error = 1
                        log.error('The wls.workManager.' + str(workManager) + '.responseTimeRequestClass.targetType property supports only [Cluster,Server, or leave blank to target to AdminServer].')
                    else:
                        log.debug('Workmanager [' + str(workManager) + '] response-time constraint target type property [' + str(constraintTargetType) + '] is valid.')
                        
                        constraintTargets = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.responseTimeRequestClass.targets')
                        if constraintTargets is None or len(constraintTargets)==0:
                            error = 1
                            log.error('Please verify wls.workManager.' + str(workManager) + '.responseTimeRequestClass.targets property if it exists in configuration.')
                        else:
                            clusters = domainProperties.getProperty('wls.clusters')
                            servers = domainProperties.getProperty('wls.servers')
                            constraintTargetList = constraintTargets.split(',')
                            for constraintTarget in constraintTargetList:
                                if constraintTargetType.upper()=='SERVER':
                                    if not servers is None and len(servers)>0:
                                        serverList = servers.split(',')
                                        exist = 0
                                        for server in serverList:
                                            if server==constraintTarget:
                                                exist = 1
                                                break
                                        if not exist:
                                            error = 1
                                            log.error('Please verify wls.workManager.' + str(workManager) + '.responseTimeRequestClass.targets property at server [' + str(constraintTarget) + '] and wls.servers if they are configured properly.')
                                        else:
                                            log.debug('Workmanager [' + str(workManager) + '] response-time constraint target [' + str(constraintTarget) + '] is valid.')
                                else:
                                    if constraintTargetType.upper()=='CLUSTER':
                                        if not clusters is None and len(clusters)>0:
                                            clusterList = clusters.split(',')
                                            exist = 0
                                            for cluster in clusterList:
                                                if cluster==constraintTarget:
                                                    exist = 1
                                                    break
                                            if not exist:
                                                error = 1
                                                log.error('Please verify wls.workManager.' + str(workManager) + '.responseTimeRequestClass.targets property at cluster [' + str(constraintTarget) + '] and wls.clusters if they are configured properly.')
                                            else:
                                                log.debug('Workmanager [' + str(workManager) + '] response-time constraint target [' + str(constraintTarget) + '] is valid.')

            contextRequestClassName = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.contextRequestClass.name')
            if not contextRequestClassName is None and len(contextRequestClassName)>0:
                log.debug('Workmanager [' + str(workManager) + '] context-request constraint name property [' + str(contextRequestClassName) + '] is valid.')
                classCount=classCount+1
                
                constraintTargetType = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.contextRequestClass.targetType')
                if not constraintTargetType is None and len(constraintTargetType)>0:
                    if not constraintTargetType.upper()=='CLUSTER' and not constraintTargetType.upper()=='SERVER':
                        error = 1
                        log.error('The wls.workManager.' + str(workManager) + '.contextRequestClass.targetType property supports only [Cluster,Server, or leave blank to target to AdminServer].')
                    else:
                        log.debug('Workmanager [' + str(workManager) + '] context-request constraint target type property [' + str(constraintTargetType) + '] is valid.')
                        
                        constraintTargets = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.contextRequestClass.targets')
                        if constraintTargets is None or len(constraintTargets)==0:
                            error = 1
                            log.error('Please verify wls.workManager.' + str(workManager) + '.contextRequestClass.targets property if it exists in configuration.')
                        else:
                            clusters = domainProperties.getProperty('wls.clusters')
                            servers = domainProperties.getProperty('wls.servers')
                            constraintTargetList = constraintTargets.split(',')
                            for constraintTarget in constraintTargetList:
                                if constraintTargetType.upper()=='SERVER':
                                    if not servers is None and len(servers)>0:
                                        serverList = servers.split(',')
                                        exist = 0
                                        for server in serverList:
                                            if server==constraintTarget:
                                                exist = 1
                                                break
                                        if not exist:
                                            error = 1
                                            log.error('Please verify wls.workManager.' + str(workManager) + '.contextRequestClass.targets property at server [' + str(constraintTarget) + '] and wls.servers if they are configured properly.')
                                        else:
                                            log.debug('Workmanager [' + str(workManager) + '] context-request constraint target [' + str(constraintTarget) + '] is valid.')
                                else:
                                    if constraintTargetType.upper()=='CLUSTER':
                                        if not clusters is None and len(clusters)>0:
                                            clusterList = clusters.split(',')
                                            exist = 0
                                            for cluster in clusterList:
                                                if cluster==constraintTarget:
                                                    exist = 1
                                                    break
                                            if not exist:
                                                error = 1
                                                log.error('Please verify wls.workManager.' + str(workManager) + '.contextRequestClass.targets property at cluster [' + str(constraintTarget) + '] and wls.clusters if they are configured properly.')
                                            else:
                                                log.debug('Workmanager [' + str(workManager) + '] context-request constraint target [' + str(constraintTarget) + '] is valid.')
            
            if classCount>1:
                log.error('Please verify wls.workManager.' + str(workManager) + '.fairShareRequestClass.name and wls.workManager.' + str(workManager) + '.responseTimeRequestClass.name and wls.workManager.' + str(workManager) + '.contextRequestClass.name in configuration. If more than one exist, please select only one of them and comment out the rest.')

            capacityConstraintName = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.capacityConstraint.name')
            if not capacityConstraintName is None and len(capacityConstraintName)>0:
                log.debug('Workmanager [' + str(workManager) + '] capacity constraint name property [' + str(capacityConstraintName) + '] is valid.')
                
                capacityConstraintCount = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.capacityConstraint.count')
                if not capacityConstraintCount is None and len(capacityConstraintCount)>0:
                    try:
                        int(capacityConstraintCount)
                    except ValueError:
                        log.error('Please verify wls.workManager.' + str(workManager) + '.capacityConstraint.count [' + str(capacityConstraintCount) + '] property.')
                    else:
                        if int(capacityConstraintCount)<0 or int(capacityConstraintCount)>65535:
                            log.error('Please verify wls.workManager.' + str(workManager) + '.capacityConstraint.count [' + str(capacityConstraintCount) + '] property, the number is not in valid range [0-65535].')
                        else:
                            log.debug('Workmanager [' + str(workManager) + '] capacity constraint count property [' + str(capacityConstraintCount) + '] is valid.')
                    
                constraintTargetType = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.capacityConstraint.targetType')
                if not constraintTargetType is None and len(constraintTargetType)>0:
                    if not constraintTargetType.upper()=='CLUSTER' and not constraintTargetType.upper()=='SERVER':
                        error = 1
                        log.error('The wls.workManager.' + str(workManager) + '.capacityConstraint.targetType property supports only [Cluster,Server, or leave blank to target to AdminServer].')
                    else:
                        log.debug('Workmanager [' + str(workManager) + '] capacity constraint target type property [' + str(constraintTargetType) + '] is valid.')
                        
                        constraintTargets = domainProperties.getProperty('wls.workManager.' + str(workManager) + '.capacityConstraint.targets')
                        if constraintTargets is None or len(constraintTargets)==0:
                            error = 1
                            log.error('Please verify wls.workManager.' + str(workManager) + '.capacityConstraint.targets property if it exists in configuration.')
                        else:
                            clusters = domainProperties.getProperty('wls.clusters')
                            servers = domainProperties.getProperty('wls.servers')
                            constraintTargetList = constraintTargets.split(',')
                            for constraintTarget in constraintTargetList:
                                if constraintTargetType.upper()=='SERVER':
                                    if not servers is None and len(servers)>0:
                                        serverList = servers.split(',')
                                        exist = 0
                                        for server in serverList:
                                            if server==constraintTarget:
                                                exist = 1
                                                break
                                        if not exist:
                                            error = 1
                                            log.error('Please verify wls.workManager.' + str(workManager) + '.capacityConstraint.targets property at server [' + str(constraintTarget) + '] and wls.servers if they are configured properly.')
                                        else:
                                            log.debug('Workmanager [' + str(workManager) + '] capacity constraint target [' + str(constraintTarget) + '] is valid.')
                                else:
                                    if constraintTargetType.upper()=='CLUSTER':
                                        if not clusters is None and len(clusters)>0:
                                            clusterList = clusters.split(',')
                                            exist = 0
                                            for cluster in clusterList:
                                                if cluster==constraintTarget:
                                                    exist = 1
                                                    break
                                            if not exist:
                                                error = 1
                                                log.error('Please verify wls.workManager.' + str(workManager) + '.capacityConstraint.targets property at cluster [' + str(constraintTarget) + '] and wls.clusters if they are configured properly.')
                                            else:
                                                log.debug('Workmanager [' + str(workManager) + '] capacity constraint target [' + str(constraintTarget) + '] is valid.')


    return error
Exemplo n.º 12
0
def validateJmsServersProperty(domainProperties):
    
    error = 0
    
    jmsservers = domainProperties.getProperty('jmsServers')
    filestores = domainProperties.getProperty('persistent.filestores')
    
    if not jmsservers is None and len(jmsservers)>0:
        jmsserverList = jmsservers.split(',')
        for jmsserver in jmsserverList:
            helper.printHeader('[VALIDATING] JMS Server ' + str(jmsserver) + ' properties')
            
            jmsserverName = domainProperties.getProperty('jmsServer.' + str(jmsserver) + '.Name')
            if jmsserverName is None or len(jmsserverName)==0:
                error = 1
                log.error('Please verify jmsServer.' + str(jmsserver) + '.Name property if it exists in configuration.')
            else:
                log.debug('JMS Server [' + str(jmsserver) + '] name property [' + str(jmsserverName) + '] is valid.')

            jmsserverTarget = domainProperties.getProperty('jmsServer.' + str(jmsserver) + '.Target')
            if not jmsserverTarget is None and len(jmsserverTarget)>0:
                servers = domainProperties.getProperty('wls.servers')
                if not servers is None and len(servers)>0:
                    serverList = servers.split(',')
                    exist = 0

                    for server in serverList:
                        if server==jmsserverTarget:
                            exist = 1
                            break
                    if not exist:
                        error = 1
                        log.error('jmsServer.' + str(jmsserver) + '.Target property refers to a server that does not exist within wls.servers.')
                    else:
                        log.debug('JMS Server [' + str(jmsserver) + '] target property [' + str(jmsserverTarget) + '] is valid.')

            jmsserverPersistStoreType = domainProperties.getProperty('jmsServer.' + str(jmsserver) + '.PersistentStoreType')
            if not jmsserverPersistStoreType is None:
                if jmsserverPersistStoreType.upper()=='FILE':
                    jmsserverPersistStore = domainProperties.getProperty('jmsServer.' + str(jmsserver) + '.PersistentStore')
                    if not filestores is None and len(filestores)>0:
                        filestoreList = filestores.split(',')
                        exist = 0
    
                        for filestore in filestoreList:
                            if filestore==jmsserverPersistStore:
                                exist = 1
                                break
                        if not exist:
                            error = 1
                            log.error('Please verify jmsServer.' + str(jmsserver) + '.PersistentStore property and persistent.filestores if they are configured properly.')
                        else:
                            log.debug('JMS Server [' + str(jmsserver) + '] persistent store property [' + str(jmsserverPersistStoreType) + '] is valid.')
                    else:
                        error = 1
                        log.error('Filestore configuration is missing, please verify jmsServer.' + str(jmsserver) + '.PersistentStoreType property and persistent.filestores if they are configured properly.')
                else:
                    error = 1
                    log.error('The persistent filestore type is likely incorrect, please verify jmsServer.' + str(jmsserver) + '.PersistentStoreType if they are configured properly.')

            jmsserverStoreEnabled = domainProperties.getProperty('jmsServer.' + str(jmsserver) + '.StoreEnabled')
            if not jmsserverStoreEnabled is None and len(jmsserverStoreEnabled)>0:
                if not jmsserverStoreEnabled.upper()=='TRUE' and not jmsserverStoreEnabled.upper()=='FALSE':
                    error = 1
                    log.error('The jmsServer.' + str(jmsserver) + '.StoreEnabled property supports only [true,false, or leave blank to use default].')
                else:
                    log.debug('JMS Server [' + str(jmsserver) + '] store-enabled property [' + str(jmsserverStoreEnabled) + '] is valid.')

    return error
Exemplo n.º 13
0
def validateJmsModulesProperty(domainProperties):
    
    error = 0

    jmsModules = domainProperties.getProperty('jmsModules')
    jmsservers = domainProperties.getProperty('jmsServers')
    
    if not jmsModules is None and len(jmsModules)>0:
        jmsModuleList = jmsModules.split(',')
        for jmsModule in jmsModuleList:
            helper.printHeader('[VALIDATING] JMS Module ' + str(jmsModule) + ' properties')
            
            jmsModuleName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.Name')
            if jmsModuleName is None or len(jmsModuleName)==0:
                error = 1
                log.error('Please verify jmsModule.' + str(jmsModule) + '.Name property if it exists in configuration.')
            else:
                log.debug('JMS Module [' + str(jmsModule) + '] name property [' + str(jmsModuleName) + '] is valid.')
                            
            jmsModuleTargetType = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.TargetType')
            if not jmsModuleTargetType is None and len(jmsModuleTargetType)>0:
                if not jmsModuleTargetType.upper()=='CLUSTER' and not jmsModuleTargetType.upper()=='SERVER':
                    error = 1
                    log.error('The jmsModule.' + str(jmsModule) + '.TargetType property supports only [Cluster,Server, or leave blank to target to AdminServer].')
                else:
                    log.debug('JMS Module [' + str(jmsModule) + '] target type property [' + str(jmsModuleTargetType) + '] is valid.')
                    
                    jmsModuleTargets = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.Targets')
                    if jmsModuleTargets is None or len(jmsModuleTargets)==0:
                        error = 1
                        log.error('Please verify jmsModule.' + str(jmsModule) + '.Targets property if it exists in configuration.')
                    else:
                        clusters = domainProperties.getProperty('wls.clusters')
                        servers = domainProperties.getProperty('wls.servers')
                        jmsModuleTargetList = jmsModuleTargets.split(',')
                        for jmsModuleTarget in jmsModuleTargetList:
                            if jmsModuleTargetType.upper()=='SERVER':
                                if not servers is None and len(servers)>0:
                                    serverList = servers.split(',')
                                    exist = 0
                                    for server in serverList:
                                        if server==jmsModuleTarget:
                                            exist = 1
                                            break
                                    if not exist:
                                        error = 1
                                        log.error('jmsModule.' + str(jmsModule) + '.Targets refers to server [' + str(jmsModuleTarget) + '] that does not exist within wls.servers.')
                                    else:
                                        log.debug('JMS Module [' + str(jmsModule) + '] target [' + str(jmsModuleTarget) + '] is valid.')
                            else:
                                if jmsModuleTargetType.upper()=='CLUSTER':
                                    if not clusters is None and len(clusters)>0:
                                        clusterList = clusters.split(',')
                                        exist = 0
                                        for cluster in clusterList:
                                            if cluster==jmsModuleTarget:
                                                exist = 1
                                                break
                                        if not exist:
                                            error = 1
                                            log.error('jmsModule.' + str(jmsModule) + '.Targets property refers to cluster [' + str(jmsModuleTarget) + '] that does not exist within wls.clusters.')
                                        else:
                                            log.debug('JMS Module [' + str(jmsModule) + '] target [' + str(jmsModuleTarget) + '] is valid.')

            jmsModuleSubDeployments = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployments')
            if not jmsModuleSubDeployments is None and len(jmsModuleSubDeployments)>0:
                jmsModuleSubDeploymentList = jmsModuleSubDeployments.split(',')
                for jmsModuleSubDeployment in jmsModuleSubDeploymentList:
                    helper.printHeader('[VALIDATING] JMS SubDeployment ' + str(jmsModuleSubDeployment) + ' of JMS Module ' + str(jmsModule) + ' properties')
                    
                    jmsModuleSubDeploymentName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Name')
                    if jmsModuleSubDeploymentName is None or len(jmsModuleSubDeploymentName)==0:
                        error = 1
                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Name property if it exists in configuration.')
                    else:
                        log.debug('JMS SubDeployment [' + str(jmsModuleSubDeployment) + '] name [' + str(jmsModuleSubDeploymentName) + '] is valid.')
                                            
                    jmsModuleSubDeploymentTargetType = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.TargetType')
                    if not jmsModuleSubDeploymentTargetType is None and len(jmsModuleSubDeploymentTargetType)>0:
                        if not jmsModuleSubDeploymentTargetType.upper()=='JMSSERVER' and not jmsModuleSubDeploymentTargetType.upper()=='CLUSTER':
                            error = 1
                            log.error('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.TargetType property is not valid. Valid target types are JMSServer and Cluster')
                        else:
                            log.debug('JMS SubDeployment [' + str(jmsModuleSubDeployment) + '] target type [' + str(jmsModuleSubDeploymentTargetType) + '] is valid.')
                            
                            jmsModuleSubDeploymentTargets = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Targets')
                            if jmsModuleSubDeploymentTargets is None or len(jmsModuleSubDeploymentTargets)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + jmsModule + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Targets property if it exists in configuration.')
                            else:
                                if jmsModuleSubDeploymentTargetType.upper()=='JMSSERVER':
                                    if not jmsservers is None and len(jmsservers)>0:
                                        jmsModuleSubDeploymentTargetList = jmsModuleSubDeploymentTargets.split(',')
                                        for jmsModuleSubDeploymentTarget in jmsModuleSubDeploymentTargetList:
                                            jmsserverList = jmsservers.split(',')
                                            exist = 0
                                            for jmsserver in jmsserverList:
                                                if jmsserver==jmsModuleSubDeploymentTarget:
                                                    exist = 1
                                                    break
                                            if not exist:
                                                error = 1
                                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Targets property at target jms server [' + str(jmsModuleSubDeploymentTarget) + '] and jmsServers property if they are configured properly.')
                                            else:
                                                log.debug('JMS SubDeployment [' + str(jmsModuleSubDeployment) + '] target [' + str(jmsModuleSubDeploymentTarget) + '] is valid.')
                                    else:
                                        error = 1
                                        log.error('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Targets property refers to a JMSServer but the jmsServers property does not exist.')
                                else:
                                    if jmsModuleSubDeploymentTargetType.upper()=='CLUSTER':
                                        clusters = domainProperties.getProperty('wls.clusters')
                                        if not clusters is None and len(clusters)>0:
                                            jmsModuleSubDeploymentTargetList = jmsModuleSubDeploymentTargets.split(',')
                                            for jmsModuleSubDeploymentTarget in jmsModuleSubDeploymentTargetList:
                                                clusterList = clusters.split(',')
                                                exist = 0
                                                for cluster in clusterList:
                                                    if cluster==jmsModuleSubDeploymentTarget:
                                                        exist = 1
                                                        break
                                                if not exist:
                                                    error = 1
                                                    log.error('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Targets property contains cluster [' + str(jmsModuleSubDeploymentTarget) + '] that does not exist within wls.cluster property.')
                                                else:
                                                    log.debug('JMS SubDeployment [' + str(jmsModuleSubDeployment) + '] target [' + str(jmsModuleSubDeploymentTarget) + '] is valid.')
                                        else:
                                            error = 1
                                            log.error('jmsModule.' + str(jmsModule) + '.Targets property is targeted to a cluster but no clusters are defined in wls.clusters property.')

                    jmsModuleSubDeploymentConnectionFactories = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactories')
                    if not jmsModuleSubDeploymentConnectionFactories is None and len(jmsModuleSubDeploymentConnectionFactories)>0:
                        jmsModuleSubDeploymentConnectionFactoryList = jmsModuleSubDeploymentConnectionFactories.split(',')
                        for jmsModuleSubDeploymentConnectionFactory in jmsModuleSubDeploymentConnectionFactoryList:
                            jmsConnectionFactoryName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.Name')
                            if jmsConnectionFactoryName is None or len(jmsConnectionFactoryName)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.Name property if it exists in configuration.')
                            else:
                                log.debug('Connection factory [' + str(jmsModuleSubDeploymentConnectionFactory) + '] name property [' + str(jmsConnectionFactoryName) + '] is valid.')

                            jmsConnectionFactoryJNDI = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.JNDI')
                            if jmsConnectionFactoryJNDI is None or len(jmsConnectionFactoryJNDI)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.JNDI property if it exists in configuration.')
                            else:
                                log.debug('Connection factory [' + str(jmsModuleSubDeploymentConnectionFactory) + '] JNDI property [' + str(jmsConnectionFactoryJNDI) + '] is valid.')

                            jmsConnectionFactoryReconnectPolicy = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.ReconnectPolicy')
                            if not jmsConnectionFactoryReconnectPolicy is None and len(jmsConnectionFactoryReconnectPolicy)>0:
                                if not jmsConnectionFactoryReconnectPolicy=='all' and not jmsConnectionFactoryReconnectPolicy=='producer' and not jmsConnectionFactoryReconnectPolicy=='all':
                                    error = 1
                                    log.error('The jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.ReconnectPolicy property supports only [all,producer,none].')
                                else:
                                    log.debug('Connection factory [' + str(jmsModuleSubDeploymentConnectionFactory) + '] reconnection policy property [' + str(jmsConnectionFactoryReconnectPolicy) + '] is valid.')


                            jmsConnectionFactoryServerAffinityEnabled = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.ServerAffinityEnabled')
                            if not jmsConnectionFactoryServerAffinityEnabled is None and len(jmsConnectionFactoryServerAffinityEnabled)>0:
                                if not jmsConnectionFactoryServerAffinityEnabled.upper()=='TRUE' and not jmsConnectionFactoryServerAffinityEnabled.upper()=='FALSE':
                                    error = 1
                                    log.error('The jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.ServerAffinityEnabled property supports only [true,false, or leave blank to use default].')
                                else:
                                    log.debug('Connection factory [' + str(jmsModuleSubDeploymentConnectionFactory) + '] server affinity enabled property [' + str(jmsConnectionFactoryServerAffinityEnabled) + '] is valid.')

                            jmsConnectionFactoryDefaultDeliveryMode = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.DefaultDeliveryMode')
                            if not jmsConnectionFactoryDefaultDeliveryMode is None and len(jmsConnectionFactoryDefaultDeliveryMode)>0:
                                if not jmsConnectionFactoryDefaultDeliveryMode=='Persistent' and not jmsConnectionFactoryDefaultDeliveryMode=='Non-persistent':
                                    error = 1
                                    log.error('The jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.DefaultDeliveryMode property supports only [Persistent,Non-persistent, or leave blank to use default].')
                                else:
                                    log.debug('Connection factory [' + str(jmsModuleSubDeploymentConnectionFactory) + '] default delivery mode property [' + str(jmsConnectionFactoryDefaultDeliveryMode) + '] is valid.')

                    jmsModuleSubDeploymentQueues = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Queues')
                    if not jmsModuleSubDeploymentQueues is None and len(jmsModuleSubDeploymentQueues)>0:
                        jmsModuleSubDeploymentQueueList = jmsModuleSubDeploymentQueues.split(',')
                        for jmsModuleSubDeploymentQueue in jmsModuleSubDeploymentQueueList:
                            jmsQueueName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Queue.' + str(jmsModuleSubDeploymentQueue) + '.Name')
                            if jmsQueueName is None or len(jmsQueueName)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Queue.' + str(jmsModuleSubDeploymentQueue) + '.Name property if it exists in configuration.')
                            else:
                                log.debug('Queue [' + str(jmsModuleSubDeploymentQueue) + '] name property [' + str(jmsQueueName) + '] is valid.')

                            jmsQueueJNDI = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Queue.' + str(jmsModuleSubDeploymentQueue) + '.JNDI')
                            if jmsQueueJNDI is None or len(jmsQueueJNDI)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Queue.' + str(jmsModuleSubDeploymentQueue) + '.JNDI property if it exists in configuration.')
                            else:
                                log.debug('Queue [' + str(jmsModuleSubDeploymentQueue) + '] JNDI property [' + str(jmsQueueJNDI) + '] is valid.')

                    jmsModuleSubDeploymentUniQueues = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueues')
                    if not jmsModuleSubDeploymentUniQueues is None and len(jmsModuleSubDeploymentUniQueues)>0:
                        jmsModuleSubDeploymentUniQueueList = jmsModuleSubDeploymentUniQueues.split(',')
                        for jmsModuleSubDeploymentUniQueue in jmsModuleSubDeploymentUniQueueList:
                            jmsUniQueueName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.Name')
                            if jmsUniQueueName is None or len(jmsUniQueueName)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.Name property if it exists in configuration.')
                            else:
                                log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] name property [' + str(jmsUniQueueName) + '] is valid.')
                                
                            jmsUniQueueJNDI = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.JNDI')
                            if jmsUniQueueJNDI is None or len(jmsUniQueueJNDI)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.JNDI property if it exists in configuration.')
                            else:
                                log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] JNDI property [' + str(jmsUniQueueJNDI) + '] is valid.')

                            jmsUniQueueLBPolicy = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.LoadBalancingPolicy')
                            if not jmsUniQueueLBPolicy is None and len(jmsUniQueueLBPolicy)>0:
                                if not jmsUniQueueLBPolicy=='Round-Robin' and not jmsUniQueueLBPolicy=='Random':
                                    error = 1
                                    log.error('The jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.LoadBalancingPolicy property supports only [Round-Robin,Random].')
                                else:
                                    log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] load balacing policy property [' + str(jmsUniQueueLBPolicy) + '] is valid.')

                            jmsUniQueueFwdDelay = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.ForwardDelay')
                            if not jmsUniQueueFwdDelay is None and len(jmsUniQueueFwdDelay)>0:
                                try:
                                    int(jmsUniQueueFwdDelay)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.ForwardDelay [' + str(jmsUniQueueFwdDelay) + '] property.')
                                else:
                                    if int(jmsUniQueueFwdDelay)<-1:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.ForwardDelay [' + str(jmsUniQueueFwdDelay) + '] property, number is not in valid range [>=-1].')
                                    else:
                                        log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] forward delay [' + str(jmsUniQueueFwdDelay) + '] is valid.')

                            jmsUniQueueMaximumMessageSize = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MaximumMessageSize')
                            if not jmsUniQueueMaximumMessageSize is None and len(jmsUniQueueMaximumMessageSize)>0:
                                try:
                                    int(jmsUniQueueMaximumMessageSize)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MaximumMessageSize [' + str(jmsUniQueueMaximumMessageSize) + '] property.')
                                else:
                                    if int(jmsUniQueueMaximumMessageSize)<0 or int(jmsUniQueueMaximumMessageSize)>2147483647:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MaximumMessageSize [' + str(jmsUniQueueMaximumMessageSize) + '] property, number is not in valid range [0-2147483647].')
                                    else:
                                        log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] max-message-size [' + str(jmsUniQueueMaximumMessageSize) + '] is valid.')

                            jmsUniQueueMsgPerfPref = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MessagingPerformancePreference')
                            if not jmsUniQueueMsgPerfPref is None and len(jmsUniQueueMsgPerfPref)>0:
                                try:
                                    int(jmsUniQueueMsgPerfPref)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MessagingPerformancePreference [' + str(jmsUniQueueMsgPerfPref) + '] property.')
                                else:
                                    if int(jmsUniQueueMsgPerfPref)<0 or int(jmsUniQueueMsgPerfPref)>100:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MessagingPerformancePreference [' + str(jmsUniQueueMsgPerfPref) + '] property, number is not in valid range [0-100].')
                                    else:
                                        log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] message-performance-preference [' + str(jmsUniQueueMsgPerfPref) + '] is valid.')

                            jmsUniQueueIncompleteWorkExpTime = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.IncompleteWorkExpirationTime')
                            if not jmsUniQueueIncompleteWorkExpTime is None and len(jmsUniQueueIncompleteWorkExpTime)>0:
                                try:
                                    int(jmsUniQueueIncompleteWorkExpTime)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.IncompleteWorkExpirationTime [' + str(jmsUniQueueIncompleteWorkExpTime) + '] property.')
                                else:
                                    if int(jmsUniQueueIncompleteWorkExpTime)<-1:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.IncompleteWorkExpirationTime [' + str(jmsUniQueueIncompleteWorkExpTime) + '] property, number is not in valid range [>=-1].')
                                    else:
                                        log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] incomplete-work-expiration-time [' + str(jmsUniQueueIncompleteWorkExpTime) + '] is valid.')

                    jmsModuleSubDeploymentTopics = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Topics')
                    if not jmsModuleSubDeploymentTopics is None and len(jmsModuleSubDeploymentTopics)>0:
                        jmsModuleSubDeploymentTopicList = jmsModuleSubDeploymentTopics.split(',')
                        for jmsModuleSubDeploymentTopic in jmsModuleSubDeploymentTopicList:
                            jmsTopicName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Topic.' + str(jmsModuleSubDeploymentTopic) + '.Name')
                            if jmsTopicName is None or len(jmsTopicName)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Topic.' + str(jmsModuleSubDeploymentTopic) + '.Name property if it exists in configuration.')
                            else:
                                log.debug('Topic [' + str(jmsModuleSubDeploymentTopic) + '] name property [' + str(jmsTopicName) + '] is valid.')

                            jmsTopicJNDI = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Topic.' + str(jmsModuleSubDeploymentTopic) + '.JNDI')
                            if jmsTopicJNDI is None or len(jmsTopicJNDI)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Topic.' + str(jmsModuleSubDeploymentTopic) + '.JNDI property if it exists in configuration.')
                            else:
                                log.debug('Topic [' + str(jmsModuleSubDeploymentTopic) + '] JNDI property [' + str(jmsTopicJNDI) + '] is valid.')
                                
                    jmsModuleSubDeploymentUniTopics = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopics')
                    if not jmsModuleSubDeploymentUniTopics is None and len(jmsModuleSubDeploymentUniTopics)>0:
                        jmsModuleSubDeploymentUniTopicList = jmsModuleSubDeploymentUniTopics.split(',')
                        for jmsModuleSubDeploymentUniTopic in jmsModuleSubDeploymentUniTopicList:
                            jmsUniTopicName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.Name')
                            if jmsUniTopicName is None or len(jmsUniTopicName)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.Name property if it exists in configuration.')
                            else:
                                log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] name property [' + str(jmsUniTopicName) + '] is valid.')

                            jmsUniTopicJNDI = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.JNDI')
                            if jmsUniTopicJNDI is None or len(jmsUniTopicJNDI)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.JNDI property if it exists in configuration.')
                            else:
                                log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] JNDI property [' + str(jmsUniTopicJNDI) + '] is valid.')

                            jmsUniTopicLBPolicy = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.LoadBalancingPolicy')
                            if not jmsUniTopicLBPolicy is None and len(jmsUniTopicLBPolicy)>0:
                                if not jmsUniTopicLBPolicy=='Round-Robin' and not jmsUniTopicLBPolicy=='Random':
                                    error = 1
                                    log.error('The jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.LoadBalancingPolicy property supports only [Round-Robin,Random].')
                                else:
                                    log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] load balancing policy property [' + str(jmsUniTopicLBPolicy) + '] is valid.')

                            jmsUniTopicFwdDelay = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.ForwardDelay')
                            if not jmsUniTopicFwdDelay is None and len(jmsUniTopicFwdDelay)>0:
                                try:
                                    int(jmsUniTopicFwdDelay)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.ForwardDelay [' + str(jmsUniTopicFwdDelay) + '] property.')
                                else:
                                    if int(jmsUniTopicFwdDelay)<-1:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.ForwardDelay [' + str(jmsUniTopicFwdDelay) + '] property, number is not in valid range [>=-1].')
                                    else:
                                        log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] forward delay [' + str(jmsUniTopicFwdDelay) + '] is valid.')

                            jmsUniTopicMaximumMessageSize = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MaximumMessageSize')
                            if not jmsUniTopicMaximumMessageSize is None and len(jmsUniTopicMaximumMessageSize)>0:
                                try:
                                    int(jmsUniTopicMaximumMessageSize)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MaximumMessageSize [' + str(jmsUniTopicMaximumMessageSize) + '] property.')
                                else:
                                    if int(jmsUniTopicMaximumMessageSize)<0 or int(jmsUniTopicMaximumMessageSize)>2147483647:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MaximumMessageSize [' + str(jmsUniTopicMaximumMessageSize) + '] property, number is not in valid range [0-2147483647].')
                                    else:
                                        log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] max-message-size [' + str(jmsUniTopicMaximumMessageSize) + '] is valid.')

                            jmsUniTopicMsgPerfPref = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MessagingPerformancePreference')
                            if not jmsUniTopicMsgPerfPref is None and len(jmsUniTopicMsgPerfPref)>0:
                                try:
                                    int(jmsUniTopicMsgPerfPref)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MessagingPerformancePreference [' + str(jmsUniTopicMsgPerfPref) + '] property.')
                                else:
                                    if int(jmsUniTopicMsgPerfPref)<0 or int(jmsUniTopicMsgPerfPref)>100:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MessagingPerformancePreference [' + str(jmsUniTopicMsgPerfPref) + '] property, number is not in valid range [0-100].')
                                    else:
                                        log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] message-performance-preference [' + str(jmsUniTopicMsgPerfPref) + '] is valid.')

                            jmsUniTopicIncompleteWorkExpTime = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.IncompleteWorkExpirationTime')
                            if not jmsUniTopicIncompleteWorkExpTime is None and len(jmsUniTopicIncompleteWorkExpTime)>0:
                                try:
                                    int(jmsUniTopicIncompleteWorkExpTime)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.IncompleteWorkExpirationTime [' + str(jmsUniTopicIncompleteWorkExpTime) + '] property.')
                                else:
                                    if int(jmsUniTopicIncompleteWorkExpTime)<-1:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.IncompleteWorkExpirationTime [' + str(jmsUniTopicIncompleteWorkExpTime) + '] property, number is not in valid range [>=-1].')
                                    else:
                                        log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] incomplete-work-expiration-time [' + str(jmsUniTopicIncompleteWorkExpTime) + '] is valid.')

    return error
def validateServerProperty(domainProperties):
    error = 0
    
    machines = domainProperties.getProperty('wls.domain.machines')
    clusters = domainProperties.getProperty('wls.clusters')
    servers = domainProperties.getProperty('wls.servers')
    if not servers is None and len(servers)>0:
        serverList = servers.split(',')
        for server in serverList:
            helper.printHeader('[VALIDATING] server ' + str(server) + ' properties')
    
            serverName = domainProperties.getProperty('wls.server.' + str(server) + '.name')
            if serverName is None or len(serverName)==0:
                error = 1
                log.error('Please verify wls.server.' + str(server) + '.name property if it exists in configuration.')
            else:
                log.debug('Server [' + str(server) + '] name property [' + str(serverName) + '] is valid.')

            targetCluster = domainProperties.getProperty('wls.server.' + str(server) + '.cluster')
            if targetCluster:
                if not clusters is None and len(clusters)>0:
                    clusterList = clusters.split(',')
                    exist = 0
                    for cluster in clusterList:
                        clusterName = domainProperties.getProperty('wls.cluster.' + str(cluster) + '.name')
                        if cluster==targetCluster:
                            exist = 1
                            break
                    if not exist:
                        error = 1
                        log.error('wls.server.' + str(server) + '.cluster property refers to a cluster [' + targetCluster + '] that does not exist within wls.clusters property.')
                    else:
                        log.debug('Server [' + str(server) + '] cluster property [' + str(clusterName) + '] is valid.')

            serverHost = domainProperties.getProperty('wls.server.' + str(server) + '.listener.address')
            if serverHost is None or len(serverHost)==0:
                serverHost = 'localhost'
            
            serverPort = domainProperties.getProperty('wls.server.' + str(server) + '.listener.port')
            if not serverPort is None and len(serverPort)>0:
                try:
                    int(serverPort)
                except ValueError:
                    log.error('Please verify wls.server.' + str(server) + '.listener.port [' + str(serverPort) + '] property.')
                else:
                    if int(serverPort)<0 or int(serverPort)>65535:
                        log.error('Please verify wls.server.' + str(server) + '.listener.port property, port number is not in valid range [0-65535].')
                    else:
                        log.debug('Server [' + str(server) + '] server port property [' + str(serverPort) + '] is valid.')
        
            enableSSL = domainProperties.getProperty('wls.server.' + str(server) + '.listener.enableSSL')
            if not enableSSL is None and len(enableSSL)>0:
                if not enableSSL.upper()=='TRUE' and not enableSSL.upper()=='FALSE':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.listener.enableSSL property supports only [true,false].')
                else:
                    log.debug('Server [' + str(server) + '] ssl enable property [' + str(enableSSL) + '] is valid.')
                    
                    if enableSSL.upper()=='TRUE':
                        sslPort = domainProperties.getProperty('wls.server.' + str(server) + '.listener.sslPort')
                        if not sslPort is None and len(sslPort)>0:
                            try:
                                int(sslPort)
                            except ValueError:
                                log.error('Please verify wls.server.' + str(server) + '.listener.sslPort [' + str(sslPort) + '] property.')
                            else:
                                if int(sslPort)<0 or int(sslPort)>65535:
                                    log.error('Please verify wls.server.' + str(server) + '.listener.sslPort property, port number is not in valid range [0-65535].')
                                else:
                                    log.debug('Server [' + str(server) + '] ssl port property [' + str(sslPort) + '] is valid.')

            customvars = domainProperties.getProperty('wls.server.' + str(server) + '.customenvvars')
            if not customvars is None and len(customvars)>0:
                customvarList = customvars.split(',')
                for customvar in customvarList:
                    helper.printHeader('[VALIDATING] Custom environment variable ' + str(customvar) + ' properties')
                    
                    customvarText = domainProperties.getProperty('wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text')
                    if customvarText is None or len(customvarText)==0:
                        error = 1
                        log.error('Please verify wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text property if it exists in configuration.')
                    else:
                        if customvarText.find('=')!=-1:
                            log.debug('Custome environment variable [' + str(customvar) + '] text property [' + str(customvarText) + '] is valid.')
                        else:
                            error = 1
                            log.error('Please verify wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text property, this is applicable only for key-value pairs format [<name>=<value>].')

            serverChannelName = domainProperties.getProperty('wls.server.' + str(server) + '.channel.name')
            if not serverChannelName is None and len(serverChannelName)>0:
            
                serverChannelProtocol = domainProperties.getProperty('wls.server.' + str(server) + '.channel.protocol')
                if not serverChannelProtocol=='t3' and not serverChannelProtocol=='t3s' and not serverChannelProtocol=='http' and not serverChannelProtocol=='https' and not serverChannelProtocol=='iiop' and not serverChannelProtocol=='iiops' and not serverChannelProtocol=='ldap' and not serverChannelProtocol=='ldaps' and not serverChannelProtocol=='admin':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.channel.protocol property supports only [t3,t3s,http,https,iiop,iiops,ldap,ldaps,admin].')
                else:
                    log.debug('Server [' + str(server) + '] channel protocol property [' + str(serverChannelProtocol) + '] is valid.')
                    
            serverChannelPort = domainProperties.getProperty('wls.server.' + str(server) + '.channel.listener.port')
            if not serverChannelPort is None and len(serverChannelPort)>0:
                try:
                    int(serverChannelPort)
                except ValueError:
                    log.error('Please verify wls.server.' + str(server) + '.channel.listener.port [' + str(serverChannelPort) + '] property.')
                else:
                    if int(serverChannelPort)<0 or int(serverChannelPort)>65535:
                        log.error('Please verify wls.server.' + str(server) + '.channel.listener.port property, port number is not in valid range [0-65535].')
                    else:
                        log.debug('Server [' + str(server) + '] channel port [' + str(serverChannelPort) + '] is valid.')
        
            serverChannelPublicPort = domainProperties.getProperty('wls.server.' + str(server) + '.channel.listener.publicPort')
            if not serverChannelPublicPort is None and len(serverChannelPublicPort)>0:
                try:
                    int(serverChannelPublicPort)
                except ValueError:
                    log.error('Please verify wls.server.' + str(server) + '.channel.listener.publicPort [' + str(serverChannelPublicPort) + '] property.')
                else:
                    if int(serverChannelPublicPort)<0 or int(serverChannelPublicPort)>65535:
                        log.error('Please verify wls.server.' + str(server) + '.channel.listener.publicPort property, port number is not in valid range [0-65535].')
                    else:
                        log.debug('Server [' + str(server) + '] channel public port [' + str(serverChannelPublicPort) + '] is valid.')
        
            httpEnable = domainProperties.getProperty('wls.server.' + str(server) + '.channel.httpEnable')
            if not httpEnable is None and len(httpEnable)>0:
                if not httpEnable.upper()=='TRUE' and not httpEnable.upper()=='FALSE':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.channel.httpEnable property supports only [true,false].')
                else:
                    log.debug('Server [' + str(server) + '] http channel enable property [' + str(httpEnable) + '] is valid.')
        
            enableTunneling = domainProperties.getProperty('wls.server.' + str(server) + '.enableTunneling')
            if not enableTunneling is None and len(enableTunneling)>0:
                if not enableTunneling.upper()=='TRUE' and not enableTunneling.upper()=='FALSE':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.enableTunneling property supports only [true,false].')
                else:
                    log.debug('Server [' + str(server) + '] tunnelling enable property [' + str(enableTunneling) + '] is valid.')
            
            targetMachine = domainProperties.getProperty('wls.server.' + str(server) + '.machine')
            if not targetMachine is None and len(targetMachine)>0:

                if not machines is None and len(machines)>0:
                    machineList = machines.split(',')
                    exist = 0
                    for machine in machineList:
                        machineName = domainProperties.getProperty('wls.domain.machine.' + str(machine) + '.name')
                        if machine==targetMachine:
                            exist = 1
                            break
                    if not exist:
                        error = 1
                        log.error('wls.server.' + str(server) + '.machine property refers to a machine that does not exist within the wls.domain.machines property list.')
                    else:
                        log.debug('Server [' + str(server) + '] machine property [' + str(targetMachine) + '] is valid.')
                        
            servercustomlog = domainProperties.getProperty('wls.server.' + str(server) + '.log.custom')
            if not servercustomlog is None and len(servercustomlog)>0:
               
                if not servercustomlog.upper()=='TRUE' and not servercustomlog.upper()=='FALSE':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.log.custom property supports only [true,false].')
                else:
                    log.debug('Server [' + str(server) + '] custom log enable property [' + str(servercustomlog) + '] is valid.')
                    if servercustomlog.upper()=='TRUE':
                        filename = domainProperties.getProperty('wls.server.' + str(server) + '.log.filename')
                        if not filename is None and len(filename)>0:
                            file = File(filename)
                            if file.isAbsolute():
                                if not file.exists():
                                    log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(filename) + '] on host [' + str(serverHost) + '].')

                        limitNumberOfFile = domainProperties.getProperty('wls.server.' + str(server) + '.log.limitNumOfFile')
                        if not limitNumberOfFile is None and len(limitNumberOfFile)>0:
                            if not limitNumberOfFile.upper()=='TRUE' and not limitNumberOfFile.upper()=='FALSE':
                                error = 1
                                log.error('The wls.admin.log.limitNumOfFile property supports only [true,false].')
                            else:
                                log.debug('Server [' + str(server) + '] log limit number of file property [' + str(limitNumberOfFile) + '] is valid.')
        
                        fileToRetain = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileToRetain')
                        if not fileToRetain is None and len(fileToRetain)>0:
                            if not fileToRetain is None and len(fileToRetain)>0:
                                try:
                                    int(fileToRetain)
                                except ValueError:
                                    log.error('Please verify wls.server.' + str(server) + '.log.fileToRetain [' + str(fileToRetain) + '] property.')
                                else:
                                    if int(fileToRetain)<1 or int(fileToRetain)>99999:
                                        log.error('Please verify wls.server.' + str(server) + '.log.fileToRetain property, number is not in valid range [1-99999].')
                                    else:
                                        log.debug('Server [' + str(server) + '] log file to retain [' + str(fileToRetain) + '] is valid.')
        
                        logRotateOnStartup = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotateLogOnStartup')
                        if not logRotateOnStartup is None and len(logRotateOnStartup)>0:
                            if not logRotateOnStartup.upper()=='TRUE' and not logRotateOnStartup.upper()=='FALSE':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.log.rotateLogOnStartup property supports only [true,false].')
                            else:
                                log.debug('Server [' + str(server) + '] log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.')

                        rotationType = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationType')
                        if not rotationType is None and len(rotationType)>0:
                            if not rotationType == 'bySize' and not rotationType == 'byTime':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.log.rotationType property supports only [bySize,byTime].')
                            else:
                                log.debug('Server [' + str(server) + '] log rotation type property [' + str(rotationType) + '] is valid.')

                            if rotationType == 'bySize':
                                fileMinSize = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileMinSize')
                                if not fileMinSize is None and len(fileMinSize)>0:
                                    try:
                                        int(fileMinSize)
                                    except ValueError:
                                        log.error('Please verify wls.server.' + str(server) + '.log.fileMinSize [' + str(fileMinSize) + '] property.')
                                    else:
                                        if int(fileMinSize)<0 or int(fileMinSize)>65535:
                                            log.error('Please verify wls.server.' + str(server) + '.log.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].')
                                        else:
                                            log.debug('Server [' + str(server) + '] log file min size [' + str(fileMinSize) + '] is valid.')
                                
                            if rotationType == 'byTime':
                                rotationTime = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationTime')
                                if not rotationTime is None and len(rotationTime)>0:
                                    if rotationTime.find(':')==-1:
                                        error = 1
                                        log.error('Please verify wls.server.' + str(server) + '.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                    else:
                                        if len(rotationTime)<4 or len(rotationTime)>5:
                                            error = 1
                                            log.error('The wls.server.' + str(server) + '.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                        else:
                                            log.debug('Server [' + str(server) + '] log rotation time [' + str(rotationTime) + '] is valid.')
                                
                                fileTimespan = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileTimeSpan')
                                if not fileTimespan is None and len(fileTimespan)>0:
                                    try:
                                        int(fileTimespan)
                                    except ValueError:
                                        log.error('Please verify wls.server.' + str(server) + '.log.fileTimeSpan [' + str(fileTimespan) + '] property.')
                                    else:
                                        if int(fileTimespan)<1:
                                            log.error('Please verify wls.server.' + str(server) + '.log.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [<=1].')
                                        else:
                                            log.debug('Server [' + str(server) + '] log file timespan [' + str(fileTimespan) + '] is valid.')
         
                        rotationDir = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationDir')
                        if not rotationDir is None and len(rotationDir)>0:
                            file = File(rotationDir)
                            if file.isAbsolute():
                                if not file.exists():
                                    log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '] on host [' + str(serverHost) + '].')

                        fileSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.logFileSeverity')
                        if not fileSeverity is None and len(fileSeverity)>0:
                            if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.log.logFileSeverity property supports only [Debug,Info,Warning].')
                            else:
                                log.debug('Server [' + str(server) + '] log file severity property [' + str(fileSeverity) + '] is valid.')
                                
                        broadcastSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.broadcastSeverity')
                        if not broadcastSeverity is None and len(broadcastSeverity)>0:
                            if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].')
                            else:
                                log.debug('Server [' + str(server) + '] broadcast severity log property [' + str(broadcastSeverity) + '] is valid.')
                                
                        memoryBufferSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.memoryBufferSeverity')
                        if not memoryBufferSeverity is None and len(memoryBufferSeverity)>0:
                            if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].')
                            else:
                                log.debug('Server [' + str(server) + '] memory buffer severity log property [' + str(memoryBufferSeverity) + '] is valid.')
    
            serverhttpcustomlog = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.enable')
            if not serverhttpcustomlog is None and len(serverhttpcustomlog)>0:
                if not serverhttpcustomlog.upper()=='TRUE' and not serverhttpcustomlog.upper()=='FALSE':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.httplog.enable property supports only [true,false].')
                else:
                    log.debug('Server [' + str(server) + '] http custom log enable property [' + str(serverhttpcustomlog) + '] is valid.')
                    
                    if serverhttpcustomlog.upper()=='TRUE':
                        filename = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.filename')
                        if not filename is None and len(filename)>0:
                            file = File(filename)
                            if file.isAbsolute():
                                if not file.exists():
                                    log.debug('[NOTE] Please make sure the user running this script has permission to create directories and directory and file [' + str(filename) + '] on host [' + str(serverHost) + '].')

                        rotationType = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationType')
                        if not rotationType is None and len(rotationType)>0:
                            if not rotationType == 'bySize' and not rotationType == 'byTime':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.httplog.rotationType property supports only [bySize,byTime].')
                            else:
                                log.debug('Server [' + str(server) + '] http log rotation type property [' + str(rotationType) + '] is valid.')

                            if rotationType == 'bySize':
                                fileMinSize = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.fileMinSize')
                                if not fileMinSize is None and len(fileMinSize)>0:
                                    try:
                                        int(fileMinSize)
                                    except ValueError:
                                        log.error('Please verify wls.server.' + str(server) + '.httplog.fileMinSize [' + str(fileMinSize) + '] property.')
                                    else:
                                        if int(fileMinSize)<0 or int(fileMinSize)>65535:
                                            log.error('Please verify wls.server.' + str(server) + '.httplog.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].')
                                        else:
                                            log.debug('Server [' + str(server) + '] http log file min size [' + str(fileMinSize) + '] is valid.')
                                
                            if rotationType == 'byTime':
                                rotationTime = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationTime')
                                if not rotationTime is None and len(rotationTime)>0:
                                    if rotationTime.find(':')==-1:
                                        error = 1
                                        log.error('Please verify wls.server.' + str(server) + '.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                    else:
                                        if len(rotationTime)<4 or len(rotationTime)>5:
                                            error = 1
                                            log.error('The wls.server.' + str(server) + '.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                        else:
                                            log.debug('Server [' + str(server) + '] http log rotation time [' + str(rotationTime) + '] is valid.')
                                
                                fileTimespan = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.fileTimeSpan')
                                if not fileTimespan is None and len(fileTimespan)>0:
                                    try:
                                        int(fileTimespan)
                                    except ValueError:
                                        log.error('Please verify wls.server.' + str(server) + '.httplog.fileTimeSpan [' + str(fileTimespan) + '] property.')
                                    else:
                                        if int(fileTimespan)<1:
                                            log.error('Please verify wls.server.' + str(server) + '.httplog.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].')
                                        else:
                                            log.debug('Server [' + str(server) + '] log file timespan [' + str(fileTimespan) + '] is valid.')
        
                        rotationDir = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationDir')
                        if not rotationDir is None and len(rotationDir)>0:
                            file = File(rotationDir)
                            if file.isAbsolute():
                                if not file.exists():
                                    log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '] on host [' + str(serverHost) + '].')

    return error
Exemplo n.º 15
0
def validateServerProperty(domainProperties):
    error = 0
    
    machines = domainProperties.getProperty('wls.domain.machines')
    clusters = domainProperties.getProperty('wls.clusters')
    servers = domainProperties.getProperty('wls.servers')
    if not servers is None and len(servers)>0:
        serverList = servers.split(',')
        for server in serverList:
            helper.printHeader('[VALIDATING] server ' + str(server) + ' properties')
    
            serverName = domainProperties.getProperty('wls.server.' + str(server) + '.name')
            if serverName is None or len(serverName)==0:
                error = 1
                log.error('Please verify wls.server.' + str(server) + '.name property if it exists in configuration.')
            else:
                log.debug('Server [' + str(server) + '] name property [' + str(serverName) + '] is valid.')

            targetCluster = domainProperties.getProperty('wls.server.' + str(server) + '.cluster')
            if targetCluster:
                if not clusters is None and len(clusters)>0:
                    clusterList = clusters.split(',')
                    exist = 0
                    for cluster in clusterList:
                        clusterName = domainProperties.getProperty('wls.cluster.' + str(cluster) + '.name')
                        if cluster==targetCluster:
                            exist = 1
                            break
                    if not exist:
                        error = 1
                        log.error('wls.server.' + str(server) + '.cluster property refers to a cluster [' + targetCluster + '] that does not exist within wls.clusters property.')
                    else:
                        log.debug('Server [' + str(server) + '] cluster property [' + str(clusterName) + '] is valid.')

            serverHost = domainProperties.getProperty('wls.server.' + str(server) + '.Hostname')
            if serverHost is None or len(serverHost)==0:
                serverHost = 'localhost'
            
            serverPort = domainProperties.getProperty('wls.server.' + str(server) + '.StartListenPortForHost')
            if not serverPort is None and len(serverPort)>0:
                try:
                    int(serverPort)
                except ValueError:
                    log.error('Please verify wls.server.' + str(server) + '.StartListenPortForHost [' + str(serverPort) + '] property.')
                else:
                    if int(serverPort)<0 or int(serverPort)>65535:
                        log.error('Please verify wls.server.' + str(server) + '.StartListenPortForHost property, port number is not in valid range [0-65535].')
                    else:
                        log.debug('Server [' + str(server) + '] server port property [' + str(serverPort) + '] is valid.')
        
            enableSSL = domainProperties.getProperty('wls.server.' + str(server) + '.listener.enableSSL')
            if not enableSSL is None and len(enableSSL)>0:
                if not enableSSL.upper()=='TRUE' and not enableSSL.upper()=='FALSE':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.listener.enableSSL property supports only [true,false].')
                else:
                    log.debug('Server [' + str(server) + '] ssl enable property [' + str(enableSSL) + '] is valid.')
                    
                    if enableSSL.upper()=='TRUE':
                        sslPort = domainProperties.getProperty('wls.server.' + str(server) + '.listener.sslPort')
                        if not sslPort is None and len(sslPort)>0:
                            try:
                                int(sslPort)
                            except ValueError:
                                log.error('Please verify wls.server.' + str(server) + '.listener.sslPort [' + str(sslPort) + '] property.')
                            else:
                                if int(sslPort)<0 or int(sslPort)>65535:
                                    log.error('Please verify wls.server.' + str(server) + '.listener.sslPort property, port number is not in valid range [0-65535].')
                                else:
                                    log.debug('Server [' + str(server) + '] ssl port property [' + str(sslPort) + '] is valid.')

            customvars = domainProperties.getProperty('wls.server.' + str(server) + '.customenvvars')
            if not customvars is None and len(customvars)>0:
                customvarList = customvars.split(',')
                for customvar in customvarList:
                    helper.printHeader('[VALIDATING] Custom environment variable ' + str(customvar) + ' properties')
                    
                    customvarText = domainProperties.getProperty('wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text')
                    if customvarText is None or len(customvarText)==0:
                        error = 1
                        log.error('Please verify wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text property if it exists in configuration.')
                    else:
                        if customvarText.find('=')!=-1:
                            log.debug('Custome environment variable [' + str(customvar) + '] text property [' + str(customvarText) + '] is valid.')
                        else:
                            error = 1
                            log.error('Please verify wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text property, this is applicable only for key-value pairs format [<name>=<value>].')

            serverChannelName = domainProperties.getProperty('wls.server.' + str(server) + '.channel.name')
            if not serverChannelName is None and len(serverChannelName)>0:
            
                serverChannelProtocol = domainProperties.getProperty('wls.server.' + str(server) + '.channel.protocol')
                if not serverChannelProtocol=='t3' and not serverChannelProtocol=='t3s' and not serverChannelProtocol=='http' and not serverChannelProtocol=='https' and not serverChannelProtocol=='iiop' and not serverChannelProtocol=='iiops' and not serverChannelProtocol=='ldap' and not serverChannelProtocol=='ldaps' and not serverChannelProtocol=='admin':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.channel.protocol property supports only [t3,t3s,http,https,iiop,iiops,ldap,ldaps,admin].')
                else:
                    log.debug('Server [' + str(server) + '] channel protocol property [' + str(serverChannelProtocol) + '] is valid.')
                    
            serverChannelPort = domainProperties.getProperty('wls.server.' + str(server) + '.channel.listener.port')
            if not serverChannelPort is None and len(serverChannelPort)>0:
                try:
                    int(serverChannelPort)
                except ValueError:
                    log.error('Please verify wls.server.' + str(server) + '.channel.listener.port [' + str(serverChannelPort) + '] property.')
                else:
                    if int(serverChannelPort)<0 or int(serverChannelPort)>65535:
                        log.error('Please verify wls.server.' + str(server) + '.channel.listener.port property, port number is not in valid range [0-65535].')
                    else:
                        log.debug('Server [' + str(server) + '] channel port [' + str(serverChannelPort) + '] is valid.')
        
            serverChannelPublicPort = domainProperties.getProperty('wls.server.' + str(server) + '.channel.listener.publicPort')
            if not serverChannelPublicPort is None and len(serverChannelPublicPort)>0:
                try:
                    int(serverChannelPublicPort)
                except ValueError:
                    log.error('Please verify wls.server.' + str(server) + '.channel.listener.publicPort [' + str(serverChannelPublicPort) + '] property.')
                else:
                    if int(serverChannelPublicPort)<0 or int(serverChannelPublicPort)>65535:
                        log.error('Please verify wls.server.' + str(server) + '.channel.listener.publicPort property, port number is not in valid range [0-65535].')
                    else:
                        log.debug('Server [' + str(server) + '] channel public port [' + str(serverChannelPublicPort) + '] is valid.')
        
            httpEnable = domainProperties.getProperty('wls.server.' + str(server) + '.channel.httpEnable')
            if not httpEnable is None and len(httpEnable)>0:
                if not httpEnable.upper()=='TRUE' and not httpEnable.upper()=='FALSE':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.channel.httpEnable property supports only [true,false].')
                else:
                    log.debug('Server [' + str(server) + '] http channel enable property [' + str(httpEnable) + '] is valid.')
        
            enableTunneling = domainProperties.getProperty('wls.server.' + str(server) + '.enableTunneling')
            if not enableTunneling is None and len(enableTunneling)>0:
                if not enableTunneling.upper()=='TRUE' and not enableTunneling.upper()=='FALSE':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.enableTunneling property supports only [true,false].')
                else:
                    log.debug('Server [' + str(server) + '] tunnelling enable property [' + str(enableTunneling) + '] is valid.')
            
            targetMachine = domainProperties.getProperty('wls.server.' + str(server) + '.machine')
            if not targetMachine is None and len(targetMachine)>0:

                if not machines is None and len(machines)>0:
                    machineList = machines.split(',')
                    exist = 0
                    for machine in machineList:
                        machineName = domainProperties.getProperty('wls.domain.machine.' + str(machine) + '.name')
                        if machine==targetMachine:
                            exist = 1
                            break
                    if not exist:
                        error = 1
                        log.error('wls.server.' + str(server) + '.machine property refers to a machine that does not exist within the wls.domain.machines property list.')
                    else:
                        log.debug('Server [' + str(server) + '] machine property [' + str(targetMachine) + '] is valid.')
                        
            servercustomlog = domainProperties.getProperty('wls.server.' + str(server) + '.log.custom')
            if not servercustomlog is None and len(servercustomlog)>0:
               
                if not servercustomlog.upper()=='TRUE' and not servercustomlog.upper()=='FALSE':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.log.custom property supports only [true,false].')
                else:
                    log.debug('Server [' + str(server) + '] custom log enable property [' + str(servercustomlog) + '] is valid.')
                    if servercustomlog.upper()=='TRUE':
                        filename = domainProperties.getProperty('wls.server.' + str(server) + '.log.filename')
                        if not filename is None and len(filename)>0:
                            file = File(filename)
                            if file.isAbsolute():
                                if not file.exists():
                                    log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(filename) + '] on host [' + str(serverHost) + '].')

                        limitNumberOfFile = domainProperties.getProperty('wls.server.' + str(server) + '.log.limitNumOfFile')
                        if not limitNumberOfFile is None and len(limitNumberOfFile)>0:
                            if not limitNumberOfFile.upper()=='TRUE' and not limitNumberOfFile.upper()=='FALSE':
                                error = 1
                                log.error('The wls.admin.log.limitNumOfFile property supports only [true,false].')
                            else:
                                log.debug('Server [' + str(server) + '] log limit number of file property [' + str(limitNumberOfFile) + '] is valid.')
        
                        fileToRetain = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileToRetain')
                        if not fileToRetain is None and len(fileToRetain)>0:
                            if not fileToRetain is None and len(fileToRetain)>0:
                                try:
                                    int(fileToRetain)
                                except ValueError:
                                    log.error('Please verify wls.server.' + str(server) + '.log.fileToRetain [' + str(fileToRetain) + '] property.')
                                else:
                                    if int(fileToRetain)<1 or int(fileToRetain)>99999:
                                        log.error('Please verify wls.server.' + str(server) + '.log.fileToRetain property, number is not in valid range [1-99999].')
                                    else:
                                        log.debug('Server [' + str(server) + '] log file to retain [' + str(fileToRetain) + '] is valid.')
        
                        logRotateOnStartup = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotateLogOnStartup')
                        if not logRotateOnStartup is None and len(logRotateOnStartup)>0:
                            if not logRotateOnStartup.upper()=='TRUE' and not logRotateOnStartup.upper()=='FALSE':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.log.rotateLogOnStartup property supports only [true,false].')
                            else:
                                log.debug('Server [' + str(server) + '] log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.')

                        rotationType = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationType')
                        if not rotationType is None and len(rotationType)>0:
                            if not rotationType == 'bySize' and not rotationType == 'byTime':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.log.rotationType property supports only [bySize,byTime].')
                            else:
                                log.debug('Server [' + str(server) + '] log rotation type property [' + str(rotationType) + '] is valid.')

                            if rotationType == 'bySize':
                                fileMinSize = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileMinSize')
                                if not fileMinSize is None and len(fileMinSize)>0:
                                    try:
                                        int(fileMinSize)
                                    except ValueError:
                                        log.error('Please verify wls.server.' + str(server) + '.log.fileMinSize [' + str(fileMinSize) + '] property.')
                                    else:
                                        if int(fileMinSize)<0 or int(fileMinSize)>65535:
                                            log.error('Please verify wls.server.' + str(server) + '.log.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].')
                                        else:
                                            log.debug('Server [' + str(server) + '] log file min size [' + str(fileMinSize) + '] is valid.')
                                
                            if rotationType == 'byTime':
                                rotationTime = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationTime')
                                if not rotationTime is None and len(rotationTime)>0:
                                    if rotationTime.find(':')==-1:
                                        error = 1
                                        log.error('Please verify wls.server.' + str(server) + '.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                    else:
                                        if len(rotationTime)<4 or len(rotationTime)>5:
                                            error = 1
                                            log.error('The wls.server.' + str(server) + '.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                        else:
                                            log.debug('Server [' + str(server) + '] log rotation time [' + str(rotationTime) + '] is valid.')
                                
                                fileTimespan = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileTimeSpan')
                                if not fileTimespan is None and len(fileTimespan)>0:
                                    try:
                                        int(fileTimespan)
                                    except ValueError:
                                        log.error('Please verify wls.server.' + str(server) + '.log.fileTimeSpan [' + str(fileTimespan) + '] property.')
                                    else:
                                        if int(fileTimespan)<1:
                                            log.error('Please verify wls.server.' + str(server) + '.log.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [<=1].')
                                        else:
                                            log.debug('Server [' + str(server) + '] log file timespan [' + str(fileTimespan) + '] is valid.')
         
                        rotationDir = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationDir')
                        if not rotationDir is None and len(rotationDir)>0:
                            file = File(rotationDir)
                            if file.isAbsolute():
                                if not file.exists():
                                    log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '] on host [' + str(serverHost) + '].')

                        fileSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.logFileSeverity')
                        if not fileSeverity is None and len(fileSeverity)>0:
                            if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.log.logFileSeverity property supports only [Debug,Info,Warning].')
                            else:
                                log.debug('Server [' + str(server) + '] log file severity property [' + str(fileSeverity) + '] is valid.')
                                
                        broadcastSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.broadcastSeverity')
                        if not broadcastSeverity is None and len(broadcastSeverity)>0:
                            if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].')
                            else:
                                log.debug('Server [' + str(server) + '] broadcast severity log property [' + str(broadcastSeverity) + '] is valid.')
                                
                        memoryBufferSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.memoryBufferSeverity')
                        if not memoryBufferSeverity is None and len(memoryBufferSeverity)>0:
                            if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].')
                            else:
                                log.debug('Server [' + str(server) + '] memory buffer severity log property [' + str(memoryBufferSeverity) + '] is valid.')
    
            serverhttpcustomlog = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.enable')
            if not serverhttpcustomlog is None and len(serverhttpcustomlog)>0:
                if not serverhttpcustomlog.upper()=='TRUE' and not serverhttpcustomlog.upper()=='FALSE':
                    error = 1
                    log.error('The wls.server.' + str(server) + '.httplog.enable property supports only [true,false].')
                else:
                    log.debug('Server [' + str(server) + '] http custom log enable property [' + str(serverhttpcustomlog) + '] is valid.')
                    
                    if serverhttpcustomlog.upper()=='TRUE':
                        filename = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.filename')
                        if not filename is None and len(filename)>0:
                            file = File(filename)
                            if file.isAbsolute():
                                if not file.exists():
                                    log.debug('[NOTE] Please make sure the user running this script has permission to create directories and directory and file [' + str(filename) + '] on host [' + str(serverHost) + '].')

                        rotationType = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationType')
                        if not rotationType is None and len(rotationType)>0:
                            if not rotationType == 'bySize' and not rotationType == 'byTime':
                                error = 1
                                log.error('The wls.server.' + str(server) + '.httplog.rotationType property supports only [bySize,byTime].')
                            else:
                                log.debug('Server [' + str(server) + '] http log rotation type property [' + str(rotationType) + '] is valid.')

                            if rotationType == 'bySize':
                                fileMinSize = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.fileMinSize')
                                if not fileMinSize is None and len(fileMinSize)>0:
                                    try:
                                        int(fileMinSize)
                                    except ValueError:
                                        log.error('Please verify wls.server.' + str(server) + '.httplog.fileMinSize [' + str(fileMinSize) + '] property.')
                                    else:
                                        if int(fileMinSize)<0 or int(fileMinSize)>65535:
                                            log.error('Please verify wls.server.' + str(server) + '.httplog.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].')
                                        else:
                                            log.debug('Server [' + str(server) + '] http log file min size [' + str(fileMinSize) + '] is valid.')
                                
                            if rotationType == 'byTime':
                                rotationTime = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationTime')
                                if not rotationTime is None and len(rotationTime)>0:
                                    if rotationTime.find(':')==-1:
                                        error = 1
                                        log.error('Please verify wls.server.' + str(server) + '.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                    else:
                                        if len(rotationTime)<4 or len(rotationTime)>5:
                                            error = 1
                                            log.error('The wls.server.' + str(server) + '.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                        else:
                                            log.debug('Server [' + str(server) + '] http log rotation time [' + str(rotationTime) + '] is valid.')
                                
                                fileTimespan = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.fileTimeSpan')
                                if not fileTimespan is None and len(fileTimespan)>0:
                                    try:
                                        int(fileTimespan)
                                    except ValueError:
                                        log.error('Please verify wls.server.' + str(server) + '.httplog.fileTimeSpan [' + str(fileTimespan) + '] property.')
                                    else:
                                        if int(fileTimespan)<1:
                                            log.error('Please verify wls.server.' + str(server) + '.httplog.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].')
                                        else:
                                            log.debug('Server [' + str(server) + '] log file timespan [' + str(fileTimespan) + '] is valid.')
        
                        rotationDir = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationDir')
                        if not rotationDir is None and len(rotationDir)>0:
                            file = File(rotationDir)
                            if file.isAbsolute():
                                if not file.exists():
                                    log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '] on host [' + str(serverHost) + '].')

    return error
def validateAdminServerProperty(domainProperties):
    error = 0

    helper.printHeader('[VALIDATING] admin server properties')

    adminPort = domainProperties.getProperty('wls.admin.listener.port')
    if not adminPort is None and len(adminPort) > 0:
        try:
            int(adminPort)
        except ValueError:
            log.error('Please verify wls.admin.listener.port [' +
                      str(adminPort) + '] property.')
        else:
            if int(adminPort) < 0 or int(adminPort) > 65535:
                log.error(
                    'Please verify wls.admin.listener.port property, port number is not in valid range [0-65535].'
                )
            else:
                log.debug('Admin server port [' + str(adminPort) +
                          '] is valid.')

    enableSSL = domainProperties.getProperty('wls.admin.listener.enableSSL')
    if not enableSSL is None and len(enableSSL) > 0:
        if not enableSSL.upper() == 'TRUE' and not enableSSL.upper(
        ) == 'FALSE':
            error = 1
            log.error(
                'The wls.admin.listener.enableSSL property supports only [true,false].'
            )
        else:
            log.debug('Admin server ssl enable property [' + str(enableSSL) +
                      '] is valid.')

            if enableSSL.upper() == 'TRUE':
                sslPort = domainProperties.getProperty(
                    'wls.admin.listener.sslPort')
                if not sslPort is None and len(sslPort) > 0:
                    try:
                        int(sslPort)
                    except ValueError:
                        log.error(
                            'Please verify wls.admin.listener.sslPort [' +
                            str(sslPort) + '] property.')
                    else:
                        if int(sslPort) < 0 or int(sslPort) > 65535:
                            log.error(
                                'Please verify wls.admin.listener.sslPort property, port number is not in valid range [0-65535].'
                            )
                        else:
                            log.debug('Admin server ssl port [' +
                                      str(sslPort) + '] is valid.')

    adminchprotocol = domainProperties.getProperty(
        'wls.admin.channel.protocol')
    if not adminchprotocol is None and len(adminchprotocol) > 0:
        if not adminchprotocol == 't3' and not adminchprotocol == 't3s' and not adminchprotocol == 'http' and not adminchprotocol == 'https' and not adminchprotocol == 'iiop' and not adminchprotocol == 'iiops' and not adminchprotocol == 'ldap' and not adminchprotocol == 'ldaps' and not adminchprotocol == 'admin':
            error = 1
            log.error(
                'The wls.admin.channel.protocol property supports only [t3,t3s,http,https,iiop,iiops,ldap,ldaps,admin].'
            )
        else:
            log.debug('Admin channel protocol property [' +
                      str(adminchprotocol) + '] is valid.')

    adminChannelPort = domainProperties.getProperty(
        'wls.admin.channel.listener.port')
    if not adminChannelPort is None and len(adminChannelPort) > 0:
        try:
            int(adminChannelPort)
        except ValueError:
            log.error('Please verify wls.admin.channel.listener.port [' +
                      str(adminChannelPort) + '] property.')
        else:
            if int(adminChannelPort) < 0 or int(adminChannelPort) > 65535:
                log.error(
                    'Please verify wls.admin.channel.listener.port property, port number is not in valid range [0-65535].'
                )
            else:
                log.debug('Admin channel port [' + str(adminChannelPort) +
                          '] is valid.')

    adminChannelPublicPort = domainProperties.getProperty(
        'wls.admin.channel.listener.publicPort')
    if not adminChannelPublicPort is None and len(adminChannelPublicPort) > 0:
        try:
            int(adminChannelPublicPort)
        except ValueError:
            log.error('Please verify wls.admin.channel.listener.publicPort [' +
                      str(adminChannelPublicPort) + '] property.')
        else:
            if int(adminChannelPublicPort) < 0 or int(
                    adminChannelPublicPort) > 65535:
                log.error(
                    'Please verify wls.admin.channel.listener.publicPort property, port number is not in valid range [0-65535].'
                )
            else:
                log.debug('Admin channel public port [' +
                          str(adminChannelPublicPort) + '] is valid.')

    httpEnable = domainProperties.getProperty('wls.admin.channel.httpEnable')
    if not httpEnable is None and len(httpEnable) > 0:
        if not httpEnable.upper() == 'TRUE' and not httpEnable.upper(
        ) == 'FALSE':
            error = 1
            log.error(
                'The wls.admin.channel.httpEnable property supports only [true,false].'
            )
        else:
            log.debug('Admin http channel enable property [' +
                      str(httpEnable) + '] is valid.')

    enableTunneling = domainProperties.getProperty('wls.admin.enableTunneling')
    if not enableTunneling is None and len(enableTunneling) > 0:
        if not enableTunneling.upper() == 'TRUE' and not enableTunneling.upper(
        ) == 'FALSE':
            error = 1
            log.error(
                'The wls.admin.enableTunneling property supports only [true,false].'
            )
        else:
            log.debug('Admin tunnelling enable property [' +
                      str(enableTunneling) + '] is valid.')

    admincustomlog = domainProperties.getProperty('wls.admin.log.custom')
    if not admincustomlog is None and len(admincustomlog) > 0:
        if not admincustomlog.upper() == 'TRUE' and not admincustomlog.upper(
        ) == 'FALSE':
            error = 1
            log.error(
                'The wls.admin.log.custom property supports only [true,false].'
            )
        else:
            log.debug('Admin custom log enable property [' +
                      str(admincustomlog) + '] is valid.')

            if admincustomlog.upper() == 'TRUE':
                filename = domainProperties.getProperty(
                    'wls.admin.log.filename')
                if not filename is None and len(filename) > 0:
                    file = File(filename)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug(
                                '[NOTE] Please make sure the user running this script has permission to create directory and file ['
                                + str(filename) + '].')

                limitNumberOfFile = domainProperties.getProperty(
                    'wls.admin.log.limitNumOfFile')
                if not limitNumberOfFile is None and len(
                        limitNumberOfFile) > 0:
                    if not limitNumberOfFile.upper(
                    ) == 'TRUE' and not limitNumberOfFile.upper() == 'FALSE':
                        error = 1
                        log.error(
                            'The wls.admin.log.limitNumOfFile property supports only [true,false].'
                        )
                    else:
                        log.debug('Admin log limit number of file property [' +
                                  str(limitNumberOfFile) + '] is valid.')

                fileToRetain = domainProperties.getProperty(
                    'wls.admin.log.fileToRetain')
                if not fileToRetain is None and len(fileToRetain) > 0:
                    if not fileToRetain is None and len(fileToRetain) > 0:
                        try:
                            int(fileToRetain)
                        except ValueError:
                            log.error(
                                'Please verify wls.admin.log.fileToRetain [' +
                                str(fileToRetain) + '] property.')
                        else:
                            if int(fileToRetain) < 1 or int(
                                    fileToRetain) > 99999:
                                log.error(
                                    'Please verify wls.admin.log.fileToRetain property, number is not in valid range [1-99999].'
                                )
                            else:
                                log.debug('Admin log file to retain [' +
                                          str(fileToRetain) + '] is valid.')

                logRotateOnStartup = domainProperties.getProperty(
                    'wls.admin.log.rotateLogOnStartup')
                if not logRotateOnStartup is None and len(
                        logRotateOnStartup) > 0:
                    if not logRotateOnStartup.upper(
                    ) == 'TRUE' and not logRotateOnStartup.upper() == 'FALSE':
                        error = 1
                        log.error(
                            'The wls.admin.log.rotateLogOnStartup property supports only [true,false].'
                        )
                    else:
                        log.debug('Admin log rotate on startup property [' +
                                  str(logRotateOnStartup) + '] is valid.')

                rotationType = domainProperties.getProperty(
                    'wls.admin.log.rotationType')
                if not rotationType is None and len(rotationType) > 0:
                    if not rotationType == 'bySize' and not rotationType == 'byTime':
                        error = 1
                        log.error(
                            'The wls.admin.log.rotationType property supports only [bySize,byTime].'
                        )
                    else:
                        log.debug('Admin log rotation type property [' +
                                  str(rotationType) + '] is valid.')

                    if rotationType == 'bySize':
                        fileMinSize = domainProperties.getProperty(
                            'wls.admin.log.fileMinSize')
                        if not fileMinSize is None and len(fileMinSize) > 0:
                            try:
                                int(fileMinSize)
                            except ValueError:
                                log.error(
                                    'Please verify wls.admin.log.fileMinSize ['
                                    + str(fileMinSize) + '] property.')
                            else:
                                if int(fileMinSize) < 0 or int(
                                        fileMinSize) > 65535:
                                    log.error(
                                        'Please verify wls.admin.log.fileMinSize ['
                                        + str(fileMinSize) +
                                        '] property, number is not in valid range [0-65535].'
                                    )
                                else:
                                    log.debug('Admin log file min size [' +
                                              str(fileMinSize) + '] is valid.')

                    if rotationType == 'byTime':
                        rotationTime = domainProperties.getProperty(
                            'wls.admin.log.rotationTime')
                        if not rotationTime is None and len(rotationTime) > 0:
                            if rotationTime.find(':') == -1:
                                error = 1
                                log.error(
                                    'Please verify wls.admin.log.rotationTime ['
                                    + str(rotationTime) +
                                    '] property, the property supports time format [HH:MM].'
                                )
                            else:
                                if len(rotationTime) < 4 or len(
                                        rotationTime) > 5:
                                    error = 1
                                    log.error(
                                        'The wls.admin.log.rotationTime [' +
                                        str(rotationTime) +
                                        '] property, the property supports time format [HH:MM].'
                                    )
                                else:
                                    log.debug('Admin log rotation time [' +
                                              str(rotationTime) +
                                              '] is valid.')

                        fileTimespan = domainProperties.getProperty(
                            'wls.admin.log.fileTimeSpan')
                        if not fileTimespan is None and len(fileTimespan) > 0:
                            try:
                                int(fileTimespan)
                            except ValueError:
                                log.error(
                                    'Please verify wls.admin.log.fileTimeSpan ['
                                    + str(fileTimespan) + '] property.')
                            else:
                                if int(fileTimespan) < 1:
                                    log.error(
                                        'Please verify wls.admin.log.fileTimeSpan ['
                                        + str(fileTimespan) +
                                        '] property, number is not in valid range [>=1].'
                                    )
                                else:
                                    log.debug('Admin log file timespan [' +
                                              str(fileTimespan) +
                                              '] is valid.')

                rotationDir = domainProperties.getProperty(
                    'wls.admin.log.rotationDir')
                if not rotationDir is None and len(rotationDir) > 0:
                    file = File(rotationDir)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug(
                                '[NOTE] Please make sure the user running this script has permission to create directory and file ['
                                + str(rotationDir) + '].')

                fileSeverity = domainProperties.getProperty(
                    'wls.admin.log.logFileSeverity')
                if not fileSeverity is None and len(fileSeverity) > 0:
                    if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning':
                        error = 1
                        log.error(
                            'The wls.admin.log.logFileSeverity property supports only [Debug,Info,Warning].'
                        )
                    else:
                        log.debug('Admin log file severity property [' +
                                  str(fileSeverity) + '] is valid.')

                broadcastSeverity = domainProperties.getProperty(
                    'wls.admin.log.broadcastSeverity')
                if not broadcastSeverity is None and len(
                        broadcastSeverity) > 0:
                    if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off':
                        error = 1
                        log.error(
                            'The wls.admin.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].'
                        )
                    else:
                        log.debug('Admin broadcast severity property [' +
                                  str(broadcastSeverity) + '] is valid.')

                memoryBufferSeverity = domainProperties.getProperty(
                    'wls.admin.log.memoryBufferSeverity')
                if not memoryBufferSeverity is None and len(
                        memoryBufferSeverity) > 0:
                    if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off':
                        error = 1
                        log.error(
                            'The wls.admin.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].'
                        )
                    else:
                        log.debug('Admin memory buffer severity property [' +
                                  str(memoryBufferSeverity) + '] is valid.')

    adminhttpcustomlog = domainProperties.getProperty(
        'wls.admin.httplog.enable')
    if not adminhttpcustomlog is None and len(adminhttpcustomlog) > 0:
        if not adminhttpcustomlog.upper(
        ) == 'TRUE' and not adminhttpcustomlog.upper() == 'FALSE':
            error = 1
            log.error(
                'The wls.admin.httplog.enable property supports only [true,false].'
            )
        else:
            log.debug('Admin http custom log enable property [' +
                      str(adminhttpcustomlog) + '] is valid.')

            if adminhttpcustomlog.upper() == 'TRUE':
                filename = domainProperties.getProperty(
                    'wls.admin.httplog.filename')
                if not filename is None and len(filename) > 0:
                    file = File(filename)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug(
                                '[NOTE] Please make sure the user running this script has permission to create directory and file for ['
                                + str(filename) + '].')

                limitNumberOfFile = domainProperties.getProperty(
                    'wls.admin.httplog.limitNumOfFile')
                if not limitNumberOfFile is None and len(
                        limitNumberOfFile) > 0:
                    if not limitNumberOfFile.upper(
                    ) == 'TRUE' and not limitNumberOfFile.upper() == 'FALSE':
                        error = 1
                        log.error(
                            'The wls.admin.httplog.limitNumOfFile property supports only [true,false].'
                        )
                    else:
                        log.debug(
                            'Admin http log limit number of file property [' +
                            str(limitNumberOfFile) + '] is valid.')

                fileToRetain = domainProperties.getProperty(
                    'wls.admin.httplog.fileToRetain')
                if not fileToRetain is None and len(fileToRetain) > 0:
                    if not fileToRetain is None and len(fileToRetain) > 0:
                        try:
                            int(fileToRetain)
                        except ValueError:
                            log.error(
                                'Please verify wls.admin.httplog.fileToRetain ['
                                + str(fileToRetain) + '] property.')
                        else:
                            if int(fileToRetain) < 1 or int(
                                    fileToRetain) > 99999:
                                log.error(
                                    'Please verify wls.admin.httplog.fileToRetain property, number is not in valid range [1-99999].'
                                )
                            else:
                                log.debug('Admin http log file to retain [' +
                                          str(fileToRetain) + '] is valid.')

                logRotateOnStartup = domainProperties.getProperty(
                    'wls.admin.httplog.rotateLogOnStartup')
                if not logRotateOnStartup is None and len(
                        logRotateOnStartup) > 0:
                    if not logRotateOnStartup.upper(
                    ) == 'TRUE' and not logRotateOnStartup.upper() == 'FALSE':
                        error = 1
                        log.error(
                            'The wls.admin.httplog.rotateLogOnStartup property supports only [true,false].'
                        )
                    else:
                        log.debug(
                            'Admin http log rotate on startup property [' +
                            str(logRotateOnStartup) + '] is valid.')

                rotationType = domainProperties.getProperty(
                    'wls.admin.httplog.rotationType')
                if not rotationType is None and len(rotationType) > 0:
                    if not rotationType == 'bySize' and not rotationType == 'byTime':
                        error = 1
                        log.error(
                            'The wls.admin.httplog.rotationType property supports only [bySize,byTime].'
                        )
                    else:
                        log.debug('Admin http log rotation type property [' +
                                  str(rotationType) + '] is valid.')

                    if rotationType == 'bySize':
                        fileMinSize = domainProperties.getProperty(
                            'wls.admin.httplog.fileMinSize')
                        if not fileMinSize is None and len(fileMinSize) > 0:
                            try:
                                int(fileMinSize)
                            except ValueError:
                                log.error(
                                    'Please verify wls.admin.httplog.fileMinSize ['
                                    + str(fileMinSize) + '] property.')
                            else:
                                if int(fileMinSize) < 0 or int(
                                        fileMinSize) > 65535:
                                    log.error(
                                        'Please verify wls.admin.httplog.fileMinSize ['
                                        + str(fileMinSize) +
                                        '] property, number is not in valid range [0-65535].'
                                    )
                                else:
                                    log.debug(
                                        'Admin http log file min size [' +
                                        str(fileMinSize) + '] is valid.')

                    if rotationType == 'byTime':
                        rotationTime = domainProperties.getProperty(
                            'wls.admin.httplog.rotationTime')
                        if not rotationTime is None and len(rotationTime) > 0:
                            if rotationTime.find(':') == -1:
                                error = 1
                                log.error(
                                    'Please verify wls.admin.httplog.rotationTime ['
                                    + str(rotationTime) +
                                    '] property, the property supports time format [HH:MM].'
                                )
                            else:
                                if len(rotationTime) < 4 or len(
                                        rotationTime) > 5:
                                    error = 1
                                    log.error(
                                        'The wls.admin.httplog.rotationTime ['
                                        + str(rotationTime) +
                                        '] property, the property supports time format [HH:MM].'
                                    )
                                else:
                                    log.debug(
                                        'Admin http log rotation time [' +
                                        str(rotationTime) + '] is valid.')

                        fileTimespan = domainProperties.getProperty(
                            'wls.admin.httplog.fileTimeSpan')
                        if not fileTimespan is None and len(fileTimespan) > 0:
                            try:
                                int(fileTimespan)
                            except ValueError:
                                log.error(
                                    'Please verify wls.admin.httplog.fileTimeSpan ['
                                    + str(fileTimespan) + '] property.')
                            else:
                                if int(fileTimespan) < 1:
                                    log.error(
                                        'Please verify wls.admin.httplog.fileTimeSpan ['
                                        + str(fileTimespan) +
                                        '] property, number is not in valid range [>=1].'
                                    )
                                else:
                                    log.debug(
                                        'Admin http log file timespan [' +
                                        str(fileTimespan) + '] is valid.')

                rotationDir = domainProperties.getProperty(
                    'wls.admin.httplog.rotationDir')
                if not rotationDir is None and len(rotationDir) > 0:
                    file = File(rotationDir)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug(
                                '[NOTE] Please make sure the user running this script has permission to create directory and file for ['
                                + str(rotationDir) + '].')

    return error
Exemplo n.º 17
0
def validateMachines(domainProperties):
    error = 0
    machines = domainProperties.getProperty('wls.domain.machines')
    if not machines is None and len(machines) > 0:
        machineList = machines.split(',')
        for machine in machineList:
            helper.printHeader('[VALIDATING] machine ' + str(machine) +
                               ' properties')

            machineName = domainProperties.getProperty('wls.domain.machine.' +
                                                       str(machine) + '.name')
            if machineName is None or len(machineName) == 0:
                error = 1
                log.error('Please verify wls.domain.machine.' + str(machine) +
                          '.name property if it exists in configuration.')
            else:
                log.debug('Machine [' + str(machine) + '] name property [' +
                          str(machineName) + '] is valid.')

            nodeType = domainProperties.getProperty('wls.domain.machine.' +
                                                    str(machine) +
                                                    '.nodemanager.type')
            if not nodeType is None and len(nodeType) > 0:
                if not nodeType == 'SSH' and not nodeType == 'RSH' and not nodeType == 'Plain' and not nodeType == 'SSL' and not nodeType == 'ssh' and not nodeType == 'rsh' and not nodeType == 'ssl' and not nodeType == 'plain':
                    error = 1
                    log.error(
                        'The wls.domain.machine.' + str(machine) +
                        '.nodemanager.type property support only [SSH,RSH,Plain,SSL,ssh,rsh,ssl,plain].'
                    )
                else:
                    log.debug('Machine [' + str(machine) +
                              '] node type property [' + str(nodeType) +
                              '] is valid.')

                nodeAddr = domainProperties.getProperty('wls.domain.machine.' +
                                                        str(machine) +
                                                        '.nodemanager.address')
                if nodeAddr is None or len(nodeAddr) == 0:
                    error = 1
                    log.error(
                        'Please verify wls.domain.machine.' + str(machine) +
                        '.nodemanager.address property if it exists in configuration.'
                    )
                else:
                    log.debug('Machine [' + str(machine) +
                              '] node address property [' + str(nodeAddr) +
                              '] is valid.')

                nodePort = domainProperties.getProperty('wls.domain.machine.' +
                                                        str(machine) +
                                                        '.nodemanager.port')
                if not nodePort is None and len(nodePort) > 0:
                    try:
                        int(nodePort)
                    except ValueError:
                        log.error('Please verify wls.domain.machine.' +
                                  str(machine) + '.nodemanager.port property.')
                    else:
                        if int(nodePort) < 0 or int(nodePort) > 65535:
                            log.error(
                                'Please verify wls.domain.machine.' +
                                str(machine) +
                                '.nodemanager.port property, port number is not in valid range [0-65535].'
                            )
                        else:
                            log.debug('Machine [' + str(machine) +
                                      '] node manager port [' + str(nodePort) +
                                      '] is valid.')

                if nodeType == 'SSH' or nodeType == 'ssh' or nodeType == 'RSH' or nodeType == 'rsh':
                    nodehome = domainProperties.getProperty(
                        'wls.domain.machine.' + str(machine) +
                        '.nodemanager.nodeManagerHome')
                    if nodehome is None or len(nodehome) == 0:
                        error = 1
                        log.error(
                            'Please verify wls.domain.machine.' +
                            str(machine) +
                            '.nodemanager.nodeManagerHome property if it exists in configuration.'
                        )
                    else:
                        log.debug('Machine [' + str(machine) +
                                  '] nodemanager home property [' +
                                  str(nodeAddr) + '] is valid.')

                    nodeShell = domainProperties.getProperty(
                        'wls.domain.machine.' + str(machine) +
                        '.nodemanager.shellCommand')
                    if nodeShell is None or len(nodeShell) == 0:
                        error = 1
                        log.error(
                            'Please verify wls.domain.machine.' +
                            str(machine) +
                            '.nodemanager.shellCommand property if it exists in configuration.'
                        )
                    else:
                        log.debug('Machine [' + str(machine) +
                                  '] nodemanager shell command property [' +
                                  str(nodeShell) + '] is valid.')
    return error
def validateDomainProperty(domainProperties):
    error = 0

    domainMode = domainProperties.getProperty('wls.domain.mode')
    if not domainMode is None and len(domainMode) == 0:
        if not domainMode == 'prod' and not domainMode == 'dev':
            error = 1
            log.error('The wls.domain.mode property supports only [prod,dev].')
        else:
            log.debug('Domain runtime mode [' + str(domainMode) +
                      '] is valid.')

    domainAdminPort = domainProperties.getProperty('wls.domain.adminPort')
    if not domainAdminPort is None and len(domainAdminPort) > 0:
        try:
            int(domainAdminPort)
        except ValueError:
            log.error('Please verify wls.domain.adminPort property.')
        else:
            if int(domainAdminPort) < 0 or int(domainAdminPort) > 65535:
                log.error(
                    'Please verify wls.domain.adminPort property, port number is not in valid range [0-65535].'
                )
            else:
                log.debug('Domain-wide administration port [' +
                          str(domainAdminPort) + '] is valid.')

    keystore = domainProperties.getProperty('wls.domain.trustKeyStore')
    if not keystore is None and len(keystore) > 0:
        if not keystore == 'DemoTrust' and not keystore == 'CustomTrust':
            error = 1
            log.error(
                'wls.domain.trustKeyStore property supports only [DemoTrust,CustomTrust].'
            )
        else:
            log.debug('Keystore type [' + str(keystore) + '] is valid.')
    else:
        if keystore == 'CustomTrust':
            tmpkeystoreFile = domainProperties.getProperty(
                'wls.domain.trustKeyStoreFile')
            keystoreFile = File(tmpkeystoreFile)
            if not keystoreFile.exists():
                error = 1
                log.error(
                    'File ' + str(tmpkeystoreFile) +
                    ' does not exist, please verify wls.domain.trustKeyStoreFile property.'
                )
            else:
                log.debug('Keystore file [' + str(tmpkeystoreFile) +
                          '] exists.')

    timeout = domainProperties.getProperty('wls.domain.jta.timeout')
    if not timeout is None and len(timeout) > 0:
        try:
            int(timeout)
        except:
            error = 1
            log.error('Please verify wls.domain.jta.timeout property.')
        else:
            if int(timeout) < 1 or int(timeout) > 2147483647:
                log.error(
                    'Please verify wls.domain.jta.timeout property, It is not in valid range [0-2147483647].'
                )
            else:
                log.debug('Domain JTA timeout property [' + str(timeout) +
                          '] is valid.')

    securityInteropMode = domainProperties.getProperty(
        'wls.domain.jta.securityInteropMode')
    if not securityInteropMode is None and len(securityInteropMode) > 0:
        if not securityInteropMode == 'default' and not securityInteropMode == 'performance' and not securityInteropMode == 'compatibility':
            error = 1
            log.error(
                'The wls.domain.jta.securityInteropMode property supports only [default,performance,compatibility, or leave blank to use default].'
            )
        else:
            log.debug('Domain JTA Security Interop Mode property [' +
                      str(securityInteropMode) + '] is valid.')

    authenticators = domainProperties.getProperty(
        'wls.domain.security.authenticators')
    if not authenticators is None and len(authenticators) > 0:
        authenticatorList = authenticators.split(',')
        for authenticator in authenticatorList:
            helper.printHeader('[VALIDATING] authenticator ' +
                               str(authenticator) + ' properties')

            authenticatorName = domainProperties.getProperty(
                'wls.domain.security.authenticator.' + str(authenticator) +
                '.name')
            if authenticatorName is None or len(authenticatorName) == 0:
                error = 1
                log.error('Please verify wls.domain.security.authenticator.' +
                          str(authenticator) +
                          '.name property if it exists in configuration.')
            else:
                log.debug('Authenticator [' + str(authenticator) +
                          '] name property [' + str(authenticatorName) +
                          '] is valid.')

            authenticatorType = domainProperties.getProperty(
                'wls.domain.security.authenticator.' + str(authenticator) +
                '.type')
            if authenticatorType is None or len(authenticatorType) == 0:
                error = 1
                log.error('Please verify wls.domain.security.authenticator.' +
                          str(authenticator) +
                          '.type property if it exists in configuration.')
            else:
                if not authenticatorType == 'OpenLDAP' and not authenticatorType == 'ActiveDirectory':
                    error = 1
                    log.error(
                        'The wls.domain.security.authenticator.' +
                        str(authenticator) +
                        '.type property supports only [OpenLDAP,ActiveDirectory].'
                    )
                else:
                    log.debug('Authenticator [' + str(authenticator) +
                              '] type property [' + str(authenticatorType) +
                              '] is valid.')

            authenticatorPrincipal = domainProperties.getProperty(
                'wls.domain.security.authenticator.' + str(authenticator) +
                '.principal')
            if authenticatorPrincipal is None or len(
                    authenticatorPrincipal) == 0:
                error = 1
                log.error('Please verify wls.domain.security.authenticator.' +
                          str(authenticator) +
                          '.principal property if it exists in configuration.')
            else:
                log.debug('Authenticator [' + str(authenticator) +
                          '] principal property [' +
                          str(authenticatorPrincipal) + '] is valid.')

            authenticatorCredential = domainProperties.getProperty(
                'wls.domain.security.authenticator.' + str(authenticator) +
                '.credential')
            if authenticatorCredential is None or len(
                    authenticatorCredential) == 0:
                error = 1
                log.error(
                    'Please verify wls.domain.security.authenticator.' +
                    str(authenticator) +
                    '.credential property if it exists in configuration.')
            else:
                log.debug('Authenticator [' + str(authenticator) +
                          '] credential property [' +
                          str(authenticatorCredential) + '] is valid.')

            authenticatorHost = domainProperties.getProperty(
                'wls.domain.security.authenticator.' + str(authenticator) +
                '.host')
            if authenticatorHost is None or len(authenticatorHost) == 0:
                error = 1
                log.error('Please verify wls.domain.security.authenticator.' +
                          str(authenticator) +
                          '.host property if it exists in configuration.')
            else:
                log.debug('Authenticator [' + str(authenticator) +
                          '] host property [' + str(authenticatorHost) +
                          '] is valid.')

            authenticatorPort = domainProperties.getProperty(
                'wls.domain.security.authenticator.' + str(authenticator) +
                '.port')
            if not authenticatorPort is None and len(authenticatorPort) > 0:
                try:
                    int(authenticatorPort)
                except:
                    error = 1
                    log.error(
                        'Please verify wls.domain.security.authenticator.' +
                        str(authenticator) + '.port property.')
                else:
                    if int(authenticatorPort) < 0 or int(
                            authenticatorPort) > 65535:
                        log.error(
                            'Please verify wls.domain.security.authenticator.'
                            + str(authenticator) +
                            '.port property, port number is not in valid range [0-65535].'
                        )
                    else:
                        log.debug('Authenticator [' + str(authenticator) +
                                  '] port property [' +
                                  str(authenticatorPort) + '] is valid.')

            authenticatorSSL = domainProperties.getProperty(
                'wls.domain.security.authenticator.' + str(authenticator) +
                '.sslEnabled')
            if not authenticatorSSL is None and len(authenticatorSSL) > 0:
                if not authenticatorSSL.upper(
                ) == 'TRUE' and not authenticatorSSL.upper() == 'FALSE':
                    error = 1
                    log.error(
                        'The wls.domain.security.authenticator.' +
                        str(authenticator) +
                        '.sslEnabled property supports only [true,false].')
                else:
                    log.debug('Authenticator [' + str(authenticator) +
                              '] ssl-enabled property [' +
                              str(authenticatorSSL) + '] is valid.')

            authenticatorKeepAlive = domainProperties.getProperty(
                'wls.domain.security.authenticator.' + str(authenticator) +
                '.keepAliveEnabled')
            if not authenticatorKeepAlive is None and len(
                    authenticatorKeepAlive) > 0:
                if not authenticatorKeepAlive.upper(
                ) == 'TRUE' and not authenticatorKeepAlive.upper() == 'FALSE':
                    error = 1
                    log.error(
                        'The wls.domain.security.authenticator.' +
                        str(authenticator) +
                        '.keepAliveEnabled property supports only [true,false].'
                    )
                else:
                    log.debug('Authenticator [' + str(authenticator) +
                              '] keep-alive-enabled property [' +
                              str(authenticatorKeepAlive) + '] is valid.')

            authenticatorGroupLookupCaching = domainProperties.getProperty(
                'wls.domain.security.authenticator.' + str(authenticator) +
                '.enableSIDtoGroupLookupCaching')
            if not authenticatorGroupLookupCaching is None and len(
                    authenticatorGroupLookupCaching) > 0:
                if not authenticatorGroupLookupCaching.upper(
                ) == 'TRUE' and not authenticatorGroupLookupCaching.upper(
                ) == 'FALSE':
                    error = 1
                    log.error(
                        'The wls.domain.security.authenticator.' +
                        str(authenticator) +
                        '.enableSIDtoGroupLookupCaching property supports only [true,false].'
                    )
                else:
                    log.debug(
                        'Authenticator [' + str(authenticator) +
                        '] enable-SID-to-group-lookup-caching property [' +
                        str(authenticatorGroupLookupCaching) + '] is valid.')

    groups = domainProperties.getProperty('wls.domain.security.groups')
    if not groups is None and len(groups) > 0:
        groupList = groups.split(',')
        for group in groupList:
            helper.printHeader('[VALIDATING] group ' + str(group) +
                               ' properties')

            groupname = domainProperties.getProperty(
                'wls.domain.security.group.' + str(group) + '.groupname')
            if groupname is None or len(groupname) == 0:
                error = 1
                log.error('Please verify wls.domain.security.group.' +
                          str(group) +
                          '.groupname property if it exists in configuration.')
            else:
                log.debug('Group [' + str(group) + '] name property [' +
                          str(groupname) + '] is valid.')

            groupauthenticator = domainProperties.getProperty(
                'wls.domain.security.group.' + str(group) + '.authenticator')
            if groupauthenticator is None or len(groupauthenticator) == 0:
                log.debug(
                    'Group [' + str(group) + '] authenticator property [' +
                    str(authenticator) +
                    '] is not specified, it will be defaulted to DefaultAuthenticator.'
                )
            else:
                if groupauthenticator != 'DefaultAuthenticator':
                    if not authenticators is None and len(authenticators) > 0:
                        authenticatorList = authenticators.split(',')
                        exist = 0
                        for authenticator in authenticatorList:
                            if groupauthenticator == authenticator:
                                exist = 1
                                break
                        if not exist:
                            error = 1
                            log.error(
                                'Please verify wls.domain.security.group.' +
                                str(group) +
                                '.authenticator property and wls.domain.security.authenticators if they are configured properly.'
                            )
                        else:
                            log.debug('Group ' + str(group) +
                                      ' authenticator property [' +
                                      str(groupauthenticator) + '] is valid.')
                else:
                    log.debug('Group [' + str(group) +
                              '] authenticator property [' +
                              str(groupauthenticator) + '] is valid.')

    users = domainProperties.getProperty('wls.domain.security.users')
    if not users is None and len(users) > 0:
        userList = users.split(',')
        for user in userList:
            helper.printHeader('[VALIDATING] user ' + str(user) +
                               ' properties')

            username = domainProperties.getProperty(
                'wls.domain.security.user.' + str(user) + '.username')
            if username is None or len(username) == 0:
                error = 1
                log.error('Please verify wls.domain.security.user.' +
                          str(user) +
                          '.username property if it exists in configuration.')
            else:
                log.debug('User [' + str(user) + '] name property [' +
                          str(username) + '] is valid.')

            userauthenticator = domainProperties.getProperty(
                'wls.domain.security.user.' + str(user) + '.authenticator')
            if userauthenticator is None or len(userauthenticator) == 0:
                log.debug(
                    'User [' + str(user) + '] authenticator property [' +
                    str(user) +
                    '] is not specified, it will be defaulted to DefaultAuthenticator.'
                )
            else:
                if userauthenticator != 'DefaultAuthenticator':
                    if not authenticators is None and len(authenticators) > 0:
                        authenticatorList = authenticators.split(',')
                        exist = 0
                        for authenticator in authenticatorList:
                            if userauthenticator == authenticator:
                                exist = 1
                                break
                        if not exist:
                            error = 1
                            log.error(
                                'Please verify wls.domain.security.user.' +
                                str(user) +
                                '.authenticator property and wls.domain.security.authenticators if they are configured properly.'
                            )
                        else:
                            log.debug('User ' + str(user) +
                                      ' authenticator property [' +
                                      str(userauthenticator) + '] is valid.')

                else:
                    log.debug('User [' + str(user) +
                              '] authenticator property [' +
                              str(userauthenticator) + '] is valid.')

    customvars = domainProperties.getProperty('wls.domain.customenvvars')
    if not customvars is None and len(customvars) > 0:
        customvarList = customvars.split(',')
        for customvar in customvarList:
            helper.printHeader('[VALIDATING] Custome environment variable ' +
                               str(customvar) + ' properties')

            customvarText = domainProperties.getProperty(
                'wls.domain.customenvvar.' + str(customvar) + '.text')
            if customvarText is None or len(customvarText) == 0:
                error = 1
                log.error('Please verify wls.domain.customenvvar.' +
                          str(customvar) +
                          '.text property if it exists in configuration.')
            else:
                if customvarText.find('=') != -1:
                    log.debug('Custome environment variable [' +
                              str(customvar) + '] text property [' +
                              str(customvarText) + '] is valid.')
                else:
                    error = 1
                    log.error(
                        'Please verify wls.domain.customenvvar.' +
                        str(customvar) +
                        '.text property, this is applicable only for key-value pairs format [<name>=<value>].'
                    )

    domaincustomlog = domainProperties.getProperty('wls.domain.log.custom')
    if not domaincustomlog is None and len(domaincustomlog) > 0:
        helper.printHeader('[VALIDATING] domain custom log properties')

        if not domaincustomlog.upper() == 'TRUE' and not domaincustomlog.upper(
        ) == 'FALSE':
            error = 1
            log.error(
                'The wls.domain.log.custom property supports only [true,false].'
            )
        else:
            log.debug('Domain custom log enable property [' +
                      str(domaincustomlog) + '] is valid.')

            if domaincustomlog.upper() == 'TRUE':
                filename = domainProperties.getProperty(
                    'wls.domain.log.filename')
                if not filename is None and len(filename) > 0:
                    file = File(filename)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug(
                                '[NOTE] Please verify the user running this script has permission to create directory and file ['
                                + str(filename) + '].')

                limitNumberOfFile = domainProperties.getProperty(
                    'wls.domain.log.limitNumOfFile')
                if not limitNumberOfFile is None and len(
                        limitNumberOfFile) > 0:
                    if not limitNumberOfFile.upper(
                    ) == 'TRUE' and not limitNumberOfFile.upper() == 'FALSE':
                        error = 1
                        log.error(
                            'The wls.domain.log.limitNumOfFile property supports only [true,false].'
                        )
                    else:
                        log.debug(
                            'Domain log limit number of file property [' +
                            str(limitNumberOfFile) + '] is valid.')

                fileToRetain = domainProperties.getProperty(
                    'wls.domain.log.fileToRetain')
                if not fileToRetain is None and len(fileToRetain) > 0:
                    if not fileToRetain is None and len(fileToRetain) > 0:
                        try:
                            int(fileToRetain)
                        except ValueError:
                            log.error(
                                'Please verify wls.domain.log.fileToRetain [' +
                                str(fileToRetain) + '] property.')
                        else:
                            if int(fileToRetain) < 1 or int(
                                    fileToRetain) > 99999:
                                log.error(
                                    'Please verify wls.domain.log.fileToRetain property, number is not in valid range [1-99999].'
                                )
                            else:
                                log.debug('Domain log file to retain [' +
                                          str(fileToRetain) + '] is valid.')

                logRotateOnStartup = domainProperties.getProperty(
                    'wls.domain.log.rotateLogOnStartup')
                if not logRotateOnStartup is None and len(
                        logRotateOnStartup) > 0:
                    if not logRotateOnStartup.upper(
                    ) == 'TRUE' and not logRotateOnStartup.upper() == 'FALSE':
                        error = 1
                        log.error(
                            'The wls.domain.log.rotateLogOnStartup property supports only [true,false].'
                        )
                    else:
                        log.debug('Domain log rotate on startup property [' +
                                  str(logRotateOnStartup) + '] is valid.')

                rotationType = domainProperties.getProperty(
                    'wls.domain.log.rotationType')
                if not rotationType is None and len(rotationType) > 0:
                    if not rotationType == 'bySize' and not rotationType == 'byTime':
                        error = 1
                        log.error(
                            'The wls.domain.log.rotationType property supports only [bySize,byTime].'
                        )
                    else:
                        log.debug('Domain log rotation type property [' +
                                  str(rotationType) + '] is valid.')

                    if rotationType == 'bySize':
                        fileMinSize = domainProperties.getProperty(
                            'wls.domain.log.fileMinSize')
                        if not fileMinSize is None and len(fileMinSize) > 0:
                            try:
                                int(fileMinSize)
                            except ValueError:
                                log.error(
                                    'Please verify wls.domain.log.fileMinSize ['
                                    + str(fileMinSize) + '] property.')
                            else:
                                if int(fileMinSize) < 0 or int(
                                        fileMinSize) > 65535:
                                    log.error(
                                        'Please verify wls.domain.log.fileMinSize ['
                                        + str(fileMinSize) +
                                        '] property, number is not in valid range [0-65535].'
                                    )
                                else:
                                    log.debug('Domain log file min size [' +
                                              str(fileMinSize) + '] is valid.')

                    if rotationType == 'byTime':
                        rotationTime = domainProperties.getProperty(
                            'wls.domain.log.rotationTime')
                        if not rotationTime is None and len(rotationTime) > 0:
                            if rotationTime.find(':') == -1:
                                error = 1
                                log.error(
                                    'Please verify wls.domain.log.rotationTime ['
                                    + str(rotationTime) +
                                    '] property, the property supports time format [HH:MM].'
                                )
                            else:
                                if len(rotationTime) < 4 or len(
                                        rotationTime) > 5:
                                    error = 1
                                    log.error(
                                        'The wls.domain.log.rotationTime [' +
                                        str(rotationTime) +
                                        '] property, the property supports time format [HH:MM].'
                                    )
                                else:
                                    log.debug('Domain log rotation time [' +
                                              str(rotationTime) +
                                              '] is valid.')

                        fileTimespan = domainProperties.getProperty(
                            'wls.domain.log.fileTimeSpan')
                        if not fileTimespan is None and len(fileTimespan) > 0:
                            try:
                                int(fileTimespan)
                            except ValueError:
                                log.error(
                                    'Please verify wls.domain.log.fileTimeSpan ['
                                    + str(fileTimespan) + '] property.')
                            else:
                                if int(fileTimespan) < 1:
                                    log.error(
                                        'Please verify wls.domain.log.fileTimeSpan ['
                                        + str(fileTimespan) +
                                        '] property, number is not in valid range [>=1].'
                                    )
                                else:
                                    log.debug('Domain log file timespan [' +
                                              str(fileTimespan) +
                                              '] is valid.')

                rotationDir = domainProperties.getProperty(
                    'wls.domain.log.rotationDir')
                if not rotationDir is None and len(rotationDir) > 0:
                    file = File(rotationDir)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug(
                                '[NOTE] Please make sure if the user running this script has permission to create directory and file ['
                                + str(rotationDir) + '].')

                fileSeverity = domainProperties.getProperty(
                    'wls.domain.log.logFileSeverity')
                if not fileSeverity is None and len(fileSeverity) > 0:
                    if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning':
                        error = 1
                        log.error(
                            'The wls.domain.log.logFileSeverity property supports only [Debug,Info,Warning].'
                        )
                    else:
                        log.debug('Domain log file severity property [' +
                                  str(fileSeverity) + '] is valid.')

                broadcastSeverity = domainProperties.getProperty(
                    'wls.domain.log.broadcastSeverity')
                if not broadcastSeverity is None and len(
                        broadcastSeverity) > 0:
                    if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off':
                        error = 1
                        log.error(
                            'The wls.domain.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].'
                        )
                    else:
                        log.debug('Domain broadcast severity property [' +
                                  str(broadcastSeverity) + '] is valid.')

                memoryBufferSeverity = domainProperties.getProperty(
                    'wls.domain.log.memoryBufferSeverity')
                if not memoryBufferSeverity is None and len(
                        memoryBufferSeverity) > 0:
                    if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off':
                        error = 1
                        log.error(
                            'The wls.domain.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].'
                        )
                    else:
                        log.debug('Domain memory buffer severity property [' +
                                  str(memoryBufferSeverity) + '] is valid.')

    return error
def validateAdminServerProperty(domainProperties):
    error = 0
    
    helper.printHeader('[VALIDATING] admin server properties')
         
    adminPort = domainProperties.getProperty('wls.admin.listener.port')
    if not adminPort is None and len(adminPort)>0:
        try:
            int(adminPort)
        except ValueError:
            log.error('Please verify wls.admin.listener.port [' + str(adminPort) + '] property.')
        else:
            if int(adminPort)<0 or int(adminPort)>65535:
                log.error('Please verify wls.admin.listener.port property, port number is not in valid range [0-65535].')
            else:
                log.debug('Admin server port [' + str(adminPort) + '] is valid.')

    enableSSL = domainProperties.getProperty('wls.admin.listener.enableSSL')
    if not enableSSL is None and len(enableSSL)>0:
        if not enableSSL.upper()=='TRUE' and not enableSSL.upper()=='FALSE':
            error = 1
            log.error('The wls.admin.listener.enableSSL property supports only [true,false].')
        else:
            log.debug('Admin server ssl enable property [' + str(enableSSL) + '] is valid.')
            
            if enableSSL.upper()=='TRUE':
                sslPort = domainProperties.getProperty('wls.admin.listener.sslPort')
                if not sslPort is None and len(sslPort)>0:
                    try:
                        int(sslPort)
                    except ValueError:
                        log.error('Please verify wls.admin.listener.sslPort [' + str(sslPort) + '] property.')
                    else:
                        if int(sslPort)<0 or int(sslPort)>65535:
                            log.error('Please verify wls.admin.listener.sslPort property, port number is not in valid range [0-65535].')
                        else:
                            log.debug('Admin server ssl port [' + str(sslPort) + '] is valid.')
           
    adminchprotocol = domainProperties.getProperty('wls.admin.channel.protocol')
    if not adminchprotocol is None and len(adminchprotocol)>0:
        if not adminchprotocol=='t3' and not adminchprotocol=='t3s' and not adminchprotocol=='http' and not adminchprotocol=='https' and not adminchprotocol=='iiop' and not adminchprotocol=='iiops' and not adminchprotocol=='ldap' and not adminchprotocol=='ldaps' and not adminchprotocol=='admin':
            error = 1
            log.error('The wls.admin.channel.protocol property supports only [t3,t3s,http,https,iiop,iiops,ldap,ldaps,admin].')
        else:
            log.debug('Admin channel protocol property [' + str(adminchprotocol) + '] is valid.')

    adminChannelPort = domainProperties.getProperty('wls.admin.channel.listener.port')
    if not adminChannelPort is None and len(adminChannelPort)>0:
        try:
            int(adminChannelPort)
        except ValueError:
            log.error('Please verify wls.admin.channel.listener.port [' + str(adminChannelPort) + '] property.')
        else:
            if int(adminChannelPort)<0 or int(adminChannelPort)>65535:
                log.error('Please verify wls.admin.channel.listener.port property, port number is not in valid range [0-65535].')
            else:
                log.debug('Admin channel port [' + str(adminChannelPort) + '] is valid.')

    adminChannelPublicPort = domainProperties.getProperty('wls.admin.channel.listener.publicPort')
    if not adminChannelPublicPort is None and len(adminChannelPublicPort)>0:
        try:
            int(adminChannelPublicPort)
        except ValueError:
            log.error('Please verify wls.admin.channel.listener.publicPort [' + str(adminChannelPublicPort) + '] property.')
        else:
            if int(adminChannelPublicPort)<0 or int(adminChannelPublicPort)>65535:
                log.error('Please verify wls.admin.channel.listener.publicPort property, port number is not in valid range [0-65535].')
            else:
                log.debug('Admin channel public port [' + str(adminChannelPublicPort) + '] is valid.')

    httpEnable = domainProperties.getProperty('wls.admin.channel.httpEnable')
    if not httpEnable is None and len(httpEnable)>0:
        if not httpEnable.upper()=='TRUE' and not httpEnable.upper()=='FALSE':
            error = 1
            log.error('The wls.admin.channel.httpEnable property supports only [true,false].')
        else:
            log.debug('Admin http channel enable property [' + str(httpEnable) + '] is valid.')

    enableTunneling = domainProperties.getProperty('wls.admin.enableTunneling')
    if not enableTunneling is None and len(enableTunneling)>0:
        if not enableTunneling.upper()=='TRUE' and not enableTunneling.upper()=='FALSE':
            error = 1
            log.error('The wls.admin.enableTunneling property supports only [true,false].')
        else:
            log.debug('Admin tunnelling enable property [' + str(enableTunneling) + '] is valid.')

    admincustomlog = domainProperties.getProperty('wls.admin.log.custom')
    if not admincustomlog is None and len(admincustomlog)>0:
        if not admincustomlog.upper()=='TRUE' and not admincustomlog.upper()=='FALSE':
            error = 1
            log.error('The wls.admin.log.custom property supports only [true,false].')
        else:
            log.debug('Admin custom log enable property [' + str(admincustomlog) + '] is valid.')
            
            if admincustomlog.upper()=='TRUE':                
                filename = domainProperties.getProperty('wls.admin.log.filename')
                if not filename is None and len(filename)>0:
                    file = File(filename)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(filename) + '].')

                limitNumberOfFile = domainProperties.getProperty('wls.admin.log.limitNumOfFile')
                if not limitNumberOfFile is None and len(limitNumberOfFile)>0:
                    if not limitNumberOfFile.upper()=='TRUE' and not limitNumberOfFile.upper()=='FALSE':
                        error = 1
                        log.error('The wls.admin.log.limitNumOfFile property supports only [true,false].')
                    else:
                        log.debug('Admin log limit number of file property [' + str(limitNumberOfFile) + '] is valid.')

                fileToRetain = domainProperties.getProperty('wls.admin.log.fileToRetain')
                if not fileToRetain is None and len(fileToRetain)>0:
                    if not fileToRetain is None and len(fileToRetain)>0:
                        try:
                            int(fileToRetain)
                        except ValueError:
                            log.error('Please verify wls.admin.log.fileToRetain [' + str(fileToRetain) + '] property.')
                        else:
                            if int(fileToRetain)<1 or int(fileToRetain)>99999:
                                log.error('Please verify wls.admin.log.fileToRetain property, number is not in valid range [1-99999].')
                            else:
                                log.debug('Admin log file to retain [' + str(fileToRetain) + '] is valid.')

                logRotateOnStartup = domainProperties.getProperty('wls.admin.log.rotateLogOnStartup')
                if not logRotateOnStartup is None and len(logRotateOnStartup)>0:
                    if not logRotateOnStartup.upper()=='TRUE' and not logRotateOnStartup.upper()=='FALSE':
                        error = 1
                        log.error('The wls.admin.log.rotateLogOnStartup property supports only [true,false].')
                    else:
                        log.debug('Admin log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.')

                rotationType = domainProperties.getProperty('wls.admin.log.rotationType')
                if not rotationType is None and len(rotationType)>0:
                    if not rotationType == 'bySize' and not rotationType == 'byTime':
                        error = 1
                        log.error('The wls.admin.log.rotationType property supports only [bySize,byTime].')
                    else:
                        log.debug('Admin log rotation type property [' + str(rotationType) + '] is valid.')

                    if rotationType == 'bySize':
                        fileMinSize = domainProperties.getProperty('wls.admin.log.fileMinSize')
                        if not fileMinSize is None and len(fileMinSize)>0:
                            try:
                                int(fileMinSize)
                            except ValueError:
                                log.error('Please verify wls.admin.log.fileMinSize [' + str(fileMinSize) + '] property.')
                            else:
                                if int(fileMinSize)<0 or int(fileMinSize)>65535:
                                    log.error('Please verify wls.admin.log.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].')
                                else:
                                    log.debug('Admin log file min size [' + str(fileMinSize) + '] is valid.')
                        
                    if rotationType == 'byTime':
                        rotationTime = domainProperties.getProperty('wls.admin.log.rotationTime')
                        if not rotationTime is None and len(rotationTime)>0:
                            if rotationTime.find(':')==-1:
                                error = 1
                                log.error('Please verify wls.admin.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                            else:
                                if len(rotationTime)<4 or len(rotationTime)>5:
                                    error = 1
                                    log.error('The wls.admin.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                else:
                                    log.debug('Admin log rotation time [' + str(rotationTime) + '] is valid.')
                        
                        fileTimespan = domainProperties.getProperty('wls.admin.log.fileTimeSpan')
                        if not fileTimespan is None and len(fileTimespan)>0:
                            try:
                                int(fileTimespan)
                            except ValueError:
                                log.error('Please verify wls.admin.log.fileTimeSpan [' + str(fileTimespan) + '] property.')
                            else:
                                if int(fileTimespan)<1:
                                    log.error('Please verify wls.admin.log.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].')
                                else:
                                    log.debug('Admin log file timespan [' + str(fileTimespan) + '] is valid.')
 
                rotationDir = domainProperties.getProperty('wls.admin.log.rotationDir')
                if not rotationDir is None and len(rotationDir)>0:
                    file = File(rotationDir)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '].')

                fileSeverity = domainProperties.getProperty('wls.admin.log.logFileSeverity')
                if not fileSeverity is None and len(fileSeverity)>0:
                    if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning':
                        error = 1
                        log.error('The wls.admin.log.logFileSeverity property supports only [Debug,Info,Warning].')
                    else:
                        log.debug('Admin log file severity property [' + str(fileSeverity) + '] is valid.')
                        
                broadcastSeverity = domainProperties.getProperty('wls.admin.log.broadcastSeverity')
                if not broadcastSeverity is None and len(broadcastSeverity)>0:
                    if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off':
                        error = 1
                        log.error('The wls.admin.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].')
                    else:
                        log.debug('Admin broadcast severity property [' + str(broadcastSeverity) + '] is valid.')
                        
                memoryBufferSeverity = domainProperties.getProperty('wls.admin.log.memoryBufferSeverity')
                if not memoryBufferSeverity is None and len(memoryBufferSeverity)>0:
                    if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off':
                        error = 1
                        log.error('The wls.admin.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].')
                    else:
                        log.debug('Admin memory buffer severity property [' + str(memoryBufferSeverity) + '] is valid.')

    adminhttpcustomlog = domainProperties.getProperty('wls.admin.httplog.enable')
    if not adminhttpcustomlog is None and len(adminhttpcustomlog)>0:
        if not adminhttpcustomlog.upper()=='TRUE' and not adminhttpcustomlog.upper()=='FALSE':
            error = 1
            log.error('The wls.admin.httplog.enable property supports only [true,false].')
        else:
            log.debug('Admin http custom log enable property [' + str(adminhttpcustomlog) + '] is valid.')
            
            if adminhttpcustomlog.upper()=='TRUE':
                filename = domainProperties.getProperty('wls.admin.httplog.filename')
                if not filename is None and len(filename)>0:
                    file = File(filename)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file for [' + str(filename) + '].')
                
                limitNumberOfFile = domainProperties.getProperty('wls.admin.httplog.limitNumOfFile')
                if not limitNumberOfFile is None and len(limitNumberOfFile)>0:
                    if not limitNumberOfFile.upper()=='TRUE' and not limitNumberOfFile.upper()=='FALSE':
                        error = 1
                        log.error('The wls.admin.httplog.limitNumOfFile property supports only [true,false].')
                    else:
                        log.debug('Admin http log limit number of file property [' + str(limitNumberOfFile) + '] is valid.')

                fileToRetain = domainProperties.getProperty('wls.admin.httplog.fileToRetain')
                if not fileToRetain is None and len(fileToRetain)>0:
                    if not fileToRetain is None and len(fileToRetain)>0:
                        try:
                            int(fileToRetain)
                        except ValueError:
                            log.error('Please verify wls.admin.httplog.fileToRetain [' + str(fileToRetain) + '] property.')
                        else:
                            if int(fileToRetain)<1 or int(fileToRetain)>99999:
                                log.error('Please verify wls.admin.httplog.fileToRetain property, number is not in valid range [1-99999].')
                            else:
                                log.debug('Admin http log file to retain [' + str(fileToRetain) + '] is valid.')

                logRotateOnStartup = domainProperties.getProperty('wls.admin.httplog.rotateLogOnStartup')
                if not logRotateOnStartup is None and len(logRotateOnStartup)>0:
                    if not logRotateOnStartup.upper()=='TRUE' and not logRotateOnStartup.upper()=='FALSE':
                        error = 1
                        log.error('The wls.admin.httplog.rotateLogOnStartup property supports only [true,false].')
                    else:
                        log.debug('Admin http log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.')

                rotationType = domainProperties.getProperty('wls.admin.httplog.rotationType')
                if not rotationType is None and len(rotationType)>0:
                    if not rotationType == 'bySize' and not rotationType == 'byTime':
                        error = 1
                        log.error('The wls.admin.httplog.rotationType property supports only [bySize,byTime].')
                    else:
                        log.debug('Admin http log rotation type property [' + str(rotationType) + '] is valid.')
 
                    if rotationType == 'bySize':
                        fileMinSize = domainProperties.getProperty('wls.admin.httplog.fileMinSize')
                        if not fileMinSize is None and len(fileMinSize)>0:
                            try:
                                int(fileMinSize)
                            except ValueError:
                                log.error('Please verify wls.admin.httplog.fileMinSize [' + str(fileMinSize) + '] property.')
                            else:
                                if int(fileMinSize)<0 or int(fileMinSize)>65535:
                                    log.error('Please verify wls.admin.httplog.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].')
                                else:
                                    log.debug('Admin http log file min size [' + str(fileMinSize) + '] is valid.')
                        
                    if rotationType == 'byTime':
                        rotationTime = domainProperties.getProperty('wls.admin.httplog.rotationTime')
                        if not rotationTime is None and len(rotationTime)>0:
                            if rotationTime.find(':')==-1:
                                error = 1
                                log.error('Please verify wls.admin.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                            else:
                                if len(rotationTime)<4 or len(rotationTime)>5:
                                    error = 1
                                    log.error('The wls.admin.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                else:
                                    log.debug('Admin http log rotation time [' + str(rotationTime) + '] is valid.')
                        
                        fileTimespan = domainProperties.getProperty('wls.admin.httplog.fileTimeSpan')
                        if not fileTimespan is None and len(fileTimespan)>0:
                            try:
                                int(fileTimespan)
                            except ValueError:
                                log.error('Please verify wls.admin.httplog.fileTimeSpan [' + str(fileTimespan) + '] property.')
                            else:
                                if int(fileTimespan)<1:
                                    log.error('Please verify wls.admin.httplog.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].')
                                else:
                                    log.debug('Admin http log file timespan [' + str(fileTimespan) + '] is valid.')

                rotationDir = domainProperties.getProperty('wls.admin.httplog.rotationDir')
                if not rotationDir is None and len(rotationDir)>0:
                    file = File(rotationDir)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file for [' + str(rotationDir) + '].')

    return error
def validateDomainProperty(domainProperties):
    error = 0
    
    domainMode = domainProperties.getProperty('wls.domain.mode')
    if not domainMode is None and len(domainMode)==0:
        if not domainMode == 'prod' and not domainMode == 'dev':
            error = 1
            log.error('The wls.domain.mode property supports only [prod,dev].')
        else:
            log.debug('Domain runtime mode [' + str(domainMode) + '] is valid.')
    
    domainAdminPort = domainProperties.getProperty('wls.domain.adminPort')
    if not domainAdminPort is None and len(domainAdminPort)>0:
        try:
            int(domainAdminPort)
        except ValueError:
            log.error('Please verify wls.domain.adminPort property.')
        else:
            if int(domainAdminPort)<0 or int(domainAdminPort)>65535:
                log.error('Please verify wls.domain.adminPort property, port number is not in valid range [0-65535].')
            else:
                log.debug('Domain-wide administration port [' + str(domainAdminPort) + '] is valid.')
    
    keystore = domainProperties.getProperty('wls.domain.trustKeyStore')
    if not keystore is None and len(keystore)>0:
        if not keystore == 'DemoTrust' and not keystore == 'CustomTrust':
            error = 1
            log.error('wls.domain.trustKeyStore property supports only [DemoTrust,CustomTrust].')
        else:
            log.debug('Keystore type [' + str(keystore) + '] is valid.')
    else:
        if keystore == 'CustomTrust':
            tmpkeystoreFile = domainProperties.getProperty('wls.domain.trustKeyStoreFile')
            keystoreFile = File(tmpkeystoreFile)
            if not keystoreFile.exists():
                error = 1
                log.error('File ' + str(tmpkeystoreFile) + ' does not exist, please verify wls.domain.trustKeyStoreFile property.')
            else:
                log.debug('Keystore file [' + str(tmpkeystoreFile) + '] exists.')
            
    timeout = domainProperties.getProperty('wls.domain.jta.timeout')
    if not timeout is None and len(timeout)>0:
        try:
            int(timeout)
        except:
            error = 1
            log.error('Please verify wls.domain.jta.timeout property.')
        else:
            if int(timeout)<1 or int(timeout)>2147483647:
                log.error('Please verify wls.domain.jta.timeout property, It is not in valid range [0-2147483647].')
            else:
                log.debug('Domain JTA timeout property [' + str(timeout) + '] is valid.')

    securityInteropMode = domainProperties.getProperty('wls.domain.jta.securityInteropMode')
    if not securityInteropMode is None and len(securityInteropMode)>0:
        if not securityInteropMode=='default' and not securityInteropMode=='performance' and not securityInteropMode=='compatibility':
            error = 1
            log.error('The wls.domain.jta.securityInteropMode property supports only [default,performance,compatibility, or leave blank to use default].')
        else:
            log.debug('Domain JTA Security Interop Mode property [' + str(securityInteropMode) + '] is valid.')

    authenticators = domainProperties.getProperty('wls.domain.security.authenticators')
    if not authenticators is None and len(authenticators)>0:
        authenticatorList = authenticators.split(',')
        for authenticator in authenticatorList:
            helper.printHeader('[VALIDATING] authenticator ' + str(authenticator) + ' properties')
            
            authenticatorName = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.name')
            if authenticatorName is None or len(authenticatorName)==0:
                error = 1
                log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.name property if it exists in configuration.')
            else:
                log.debug('Authenticator [' + str(authenticator) + '] name property [' + str(authenticatorName) + '] is valid.')

            authenticatorType = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.type')
            if authenticatorType is None or len(authenticatorType)==0:
                error = 1
                log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.type property if it exists in configuration.')
            else:
                if not authenticatorType=='OpenLDAP' and not authenticatorType=='ActiveDirectory':
                    error = 1
                    log.error('The wls.domain.security.authenticator.' + str(authenticator) + '.type property supports only [OpenLDAP,ActiveDirectory].')
                else:
                    log.debug('Authenticator [' + str(authenticator) + '] type property [' + str(authenticatorType) + '] is valid.')

            authenticatorPrincipal = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.principal')
            if authenticatorPrincipal is None or len(authenticatorPrincipal)==0:
                error = 1
                log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.principal property if it exists in configuration.')
            else:
                log.debug('Authenticator [' + str(authenticator) + '] principal property [' + str(authenticatorPrincipal) + '] is valid.')

            authenticatorCredential = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.credential')
            if authenticatorCredential is None or len(authenticatorCredential)==0:
                error = 1
                log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.credential property if it exists in configuration.')
            else:
                log.debug('Authenticator [' + str(authenticator) + '] credential property [' + str(authenticatorCredential) + '] is valid.')

            authenticatorHost = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.host')
            if authenticatorHost is None or len(authenticatorHost)==0:
                error = 1
                log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.host property if it exists in configuration.')
            else:
                log.debug('Authenticator [' + str(authenticator) + '] host property [' + str(authenticatorHost) + '] is valid.')

            authenticatorPort = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.port')
            if not authenticatorPort is None and len(authenticatorPort)>0:
                try:
                    int(authenticatorPort)
                except:
                    error = 1
                    log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.port property.')
                else:
                    if int(authenticatorPort)<0 or int(authenticatorPort)>65535:
                        log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.port property, port number is not in valid range [0-65535].')
                    else:
                        log.debug('Authenticator [' + str(authenticator) + '] port property [' + str(authenticatorPort) + '] is valid.')
            
            authenticatorSSL = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.sslEnabled')
            if not authenticatorSSL is None and len(authenticatorSSL)>0:
                if not authenticatorSSL.upper()=='TRUE' and not authenticatorSSL.upper()=='FALSE':
                    error = 1
                    log.error('The wls.domain.security.authenticator.' + str(authenticator) + '.sslEnabled property supports only [true,false].')
                else:
                    log.debug('Authenticator [' + str(authenticator) + '] ssl-enabled property [' + str(authenticatorSSL) + '] is valid.')

            authenticatorKeepAlive = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.keepAliveEnabled')
            if not authenticatorKeepAlive is None and len(authenticatorKeepAlive)>0:
                if not authenticatorKeepAlive.upper()=='TRUE' and not authenticatorKeepAlive.upper()=='FALSE':
                    error = 1
                    log.error('The wls.domain.security.authenticator.' + str(authenticator) + '.keepAliveEnabled property supports only [true,false].')
                else:
                    log.debug('Authenticator [' + str(authenticator) + '] keep-alive-enabled property [' + str(authenticatorKeepAlive) + '] is valid.')

            authenticatorGroupLookupCaching = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.enableSIDtoGroupLookupCaching')
            if not authenticatorGroupLookupCaching is None and len(authenticatorGroupLookupCaching)>0:
                if not authenticatorGroupLookupCaching.upper()=='TRUE' and not authenticatorGroupLookupCaching.upper()=='FALSE':
                    error = 1
                    log.error('The wls.domain.security.authenticator.' + str(authenticator) + '.enableSIDtoGroupLookupCaching property supports only [true,false].')
                else:
                    log.debug('Authenticator [' + str(authenticator) + '] enable-SID-to-group-lookup-caching property [' + str(authenticatorGroupLookupCaching) + '] is valid.')

    groups = domainProperties.getProperty('wls.domain.security.groups')
    if not groups is None and len(groups)>0:
        groupList = groups.split(',')
        for group in groupList:
            helper.printHeader('[VALIDATING] group ' + str(group) + ' properties')

            groupname = domainProperties.getProperty('wls.domain.security.group.' + str(group) + '.groupname')
            if groupname is None or len(groupname)==0:
                error = 1
                log.error('Please verify wls.domain.security.group.' + str(group) + '.groupname property if it exists in configuration.')
            else:
                log.debug('Group [' + str(group) + '] name property [' + str(groupname) + '] is valid.')

            groupauthenticator = domainProperties.getProperty('wls.domain.security.group.' + str(group) + '.authenticator')
            if groupauthenticator is None or len(groupauthenticator)==0:
                log.debug('Group [' + str(group) + '] authenticator property [' + str(authenticator) + '] is not specified, it will be defaulted to DefaultAuthenticator.')
            else:
                if groupauthenticator!='DefaultAuthenticator':
                    if not authenticators is None and len(authenticators)>0:
                        authenticatorList = authenticators.split(',')
                        exist = 0
                        for authenticator in authenticatorList:
                            if groupauthenticator==authenticator:
                                exist = 1
                                break
                        if not exist:
                            error = 1
                            log.error('Please verify wls.domain.security.group.' + str(group) + '.authenticator property and wls.domain.security.authenticators if they are configured properly.')
                        else:
                            log.debug('Group ' + str(group) + ' authenticator property [' + str(groupauthenticator) + '] is valid.')
                else:
                    log.debug('Group [' + str(group) + '] authenticator property [' + str(groupauthenticator) + '] is valid.')

    users = domainProperties.getProperty('wls.domain.security.users')
    if not users is None and len(users)>0:
        userList = users.split(',')
        for user in userList:
            helper.printHeader('[VALIDATING] user ' + str(user) + ' properties')

            username = domainProperties.getProperty('wls.domain.security.user.' + str(user) + '.username')
            if username is None or len(username)==0:
                error = 1
                log.error('Please verify wls.domain.security.user.' + str(user) + '.username property if it exists in configuration.')
            else:
                log.debug('User [' + str(user) + '] name property [' + str(username) + '] is valid.')

            userauthenticator = domainProperties.getProperty('wls.domain.security.user.' + str(user) + '.authenticator')
            if userauthenticator is None or len(userauthenticator)==0:
                log.debug('User [' + str(user) + '] authenticator property [' + str(user) + '] is not specified, it will be defaulted to DefaultAuthenticator.')
            else:
                if userauthenticator!='DefaultAuthenticator':
                    if not authenticators is None and len(authenticators)>0:
                        authenticatorList = authenticators.split(',')
                        exist = 0
                        for authenticator in authenticatorList:
                            if userauthenticator==authenticator:
                                exist = 1
                                break
                        if not exist:
                            error = 1
                            log.error('Please verify wls.domain.security.user.' + str(user) + '.authenticator property and wls.domain.security.authenticators if they are configured properly.')
                        else:
                            log.debug('User ' + str(user) + ' authenticator property [' + str(userauthenticator) + '] is valid.')
                    
                else:
                    log.debug('User [' + str(user) + '] authenticator property [' + str(userauthenticator) + '] is valid.')

    customvars = domainProperties.getProperty('wls.domain.customenvvars')
    if not customvars is None and len(customvars)>0:
        customvarList = customvars.split(',')
        for customvar in customvarList:
            helper.printHeader('[VALIDATING] Custome environment variable ' + str(customvar) + ' properties')
            
            customvarText = domainProperties.getProperty('wls.domain.customenvvar.' + str(customvar) + '.text')
            if customvarText is None or len(customvarText)==0:
                error = 1
                log.error('Please verify wls.domain.customenvvar.' + str(customvar) + '.text property if it exists in configuration.')
            else:
                if customvarText.find('=')!=-1:
                    log.debug('Custome environment variable [' + str(customvar) + '] text property [' + str(customvarText) + '] is valid.')
                else:
                    error = 1
                    log.error('Please verify wls.domain.customenvvar.' + str(customvar) + '.text property, this is applicable only for key-value pairs format [<name>=<value>].')

    domaincustomlog = domainProperties.getProperty('wls.domain.log.custom')
    if not domaincustomlog is None and len(domaincustomlog)>0:
        helper.printHeader('[VALIDATING] domain custom log properties')
        
        if not domaincustomlog.upper()=='TRUE' and not domaincustomlog.upper()=='FALSE':
            error = 1
            log.error('The wls.domain.log.custom property supports only [true,false].')
        else:
            log.debug('Domain custom log enable property [' + str(domaincustomlog) + '] is valid.')
            
            if domaincustomlog.upper()=='TRUE':                
                filename = domainProperties.getProperty('wls.domain.log.filename')
                if not filename is None and len(filename)>0:
                    file = File(filename)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug('[NOTE] Please verify the user running this script has permission to create directory and file [' + str(filename) + '].')

                limitNumberOfFile = domainProperties.getProperty('wls.domain.log.limitNumOfFile')
                if not limitNumberOfFile is None and len(limitNumberOfFile)>0:
                    if not limitNumberOfFile.upper()=='TRUE' and not limitNumberOfFile.upper()=='FALSE':
                        error = 1
                        log.error('The wls.domain.log.limitNumOfFile property supports only [true,false].')
                    else:
                        log.debug('Domain log limit number of file property [' + str(limitNumberOfFile) + '] is valid.')

                fileToRetain = domainProperties.getProperty('wls.domain.log.fileToRetain')
                if not fileToRetain is None and len(fileToRetain)>0:
                    if not fileToRetain is None and len(fileToRetain)>0:
                        try:
                            int(fileToRetain)
                        except ValueError:
                            log.error('Please verify wls.domain.log.fileToRetain [' + str(fileToRetain) + '] property.')
                        else:
                            if int(fileToRetain)<1 or int(fileToRetain)>99999:
                                log.error('Please verify wls.domain.log.fileToRetain property, number is not in valid range [1-99999].')
                            else:
                                log.debug('Domain log file to retain [' + str(fileToRetain) + '] is valid.')

                logRotateOnStartup = domainProperties.getProperty('wls.domain.log.rotateLogOnStartup')
                if not logRotateOnStartup is None and len(logRotateOnStartup)>0:
                    if not logRotateOnStartup.upper()=='TRUE' and not logRotateOnStartup.upper()=='FALSE':
                        error = 1
                        log.error('The wls.domain.log.rotateLogOnStartup property supports only [true,false].')
                    else:
                        log.debug('Domain log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.')

                rotationType = domainProperties.getProperty('wls.domain.log.rotationType')
                if not rotationType is None and len(rotationType)>0:
                    if not rotationType == 'bySize' and not rotationType == 'byTime':
                        error = 1
                        log.error('The wls.domain.log.rotationType property supports only [bySize,byTime].')
                    else:
                        log.debug('Domain log rotation type property [' + str(rotationType) + '] is valid.')

                    if rotationType == 'bySize':
                        fileMinSize = domainProperties.getProperty('wls.domain.log.fileMinSize')
                        if not fileMinSize is None and len(fileMinSize)>0:
                            try:
                                int(fileMinSize)
                            except ValueError:
                                log.error('Please verify wls.domain.log.fileMinSize [' + str(fileMinSize) + '] property.')
                            else:
                                if int(fileMinSize)<0 or int(fileMinSize)>65535:
                                    log.error('Please verify wls.domain.log.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].')
                                else:
                                    log.debug('Domain log file min size [' + str(fileMinSize) + '] is valid.')
                        
                    if rotationType == 'byTime':
                        rotationTime = domainProperties.getProperty('wls.domain.log.rotationTime')
                        if not rotationTime is None and len(rotationTime)>0:
                            if rotationTime.find(':')==-1:
                                error = 1
                                log.error('Please verify wls.domain.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                            else:
                                if len(rotationTime)<4 or len(rotationTime)>5:
                                    error = 1
                                    log.error('The wls.domain.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].')
                                else:
                                    log.debug('Domain log rotation time [' + str(rotationTime) + '] is valid.')
                        
                        fileTimespan = domainProperties.getProperty('wls.domain.log.fileTimeSpan')
                        if not fileTimespan is None and len(fileTimespan)>0:
                            try:
                                int(fileTimespan)
                            except ValueError:
                                log.error('Please verify wls.domain.log.fileTimeSpan [' + str(fileTimespan) + '] property.')
                            else:
                                if int(fileTimespan)<1:
                                    log.error('Please verify wls.domain.log.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].')
                                else:
                                    log.debug('Domain log file timespan [' + str(fileTimespan) + '] is valid.')
 
                rotationDir = domainProperties.getProperty('wls.domain.log.rotationDir')
                if not rotationDir is None and len(rotationDir)>0:
                    file = File(rotationDir)
                    if file.isAbsolute():
                        if not file.exists():
                            log.debug('[NOTE] Please make sure if the user running this script has permission to create directory and file [' + str(rotationDir) + '].')

                fileSeverity = domainProperties.getProperty('wls.domain.log.logFileSeverity')
                if not fileSeverity is None and len(fileSeverity)>0:
                    if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning':
                        error = 1
                        log.error('The wls.domain.log.logFileSeverity property supports only [Debug,Info,Warning].')
                    else:
                        log.debug('Domain log file severity property [' + str(fileSeverity) + '] is valid.')
                        
                broadcastSeverity = domainProperties.getProperty('wls.domain.log.broadcastSeverity')
                if not broadcastSeverity is None and len(broadcastSeverity)>0:
                    if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off':
                        error = 1
                        log.error('The wls.domain.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].')
                    else:
                        log.debug('Domain broadcast severity property [' + str(broadcastSeverity) + '] is valid.')
                        
                memoryBufferSeverity = domainProperties.getProperty('wls.domain.log.memoryBufferSeverity')
                if not memoryBufferSeverity is None and len(memoryBufferSeverity)>0:
                    if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off':
                        error = 1
                        log.error('The wls.domain.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].')
                    else:
                        log.debug('Domain memory buffer severity property [' + str(memoryBufferSeverity) + '] is valid.')

    return error
Exemplo n.º 21
0
def validateJmsModulesProperty(domainProperties):
    
    error = 0

    jmsModules = domainProperties.getProperty('jmsModules')
    jmsservers = domainProperties.getProperty('jmsServers')
    
    if not jmsModules is None and len(jmsModules)>0:
        jmsModuleList = jmsModules.split(',')
        for jmsModule in jmsModuleList:
            helper.printHeader('[VALIDATING] JMS Module ' + str(jmsModule) + ' properties')
            
            jmsModuleName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.Name')
            if jmsModuleName is None or len(jmsModuleName)==0:
                error = 1
                log.error('Please verify jmsModule.' + str(jmsModule) + '.Name property if it exists in configuration.')
            else:
                log.debug('JMS Module [' + str(jmsModule) + '] name property [' + str(jmsModuleName) + '] is valid.')
                            
            jmsModuleTargetType = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.TargetType')
            if not jmsModuleTargetType is None and len(jmsModuleTargetType)>0:
                if not jmsModuleTargetType.upper()=='CLUSTER' and not jmsModuleTargetType.upper()=='SERVER':
                    error = 1
                    log.error('The jmsModule.' + str(jmsModule) + '.TargetType property supports only [Cluster,Server, or leave blank to target to AdminServer].')
                else:
                    log.debug('JMS Module [' + str(jmsModule) + '] target type property [' + str(jmsModuleTargetType) + '] is valid.')
                    
                    jmsModuleTargets = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.Targets')
                    if jmsModuleTargets is None or len(jmsModuleTargets)==0:
                        error = 1
                        log.error('Please verify jmsModule.' + str(jmsModule) + '.Targets property if it exists in configuration.')
                    else:
                        clusters = domainProperties.getProperty('wls.clusters')
                        servers = domainProperties.getProperty('wls.servers')
                        jmsModuleTargetList = jmsModuleTargets.split(',')
                        for jmsModuleTarget in jmsModuleTargetList:
                            if jmsModuleTargetType.upper()=='SERVER':
                                if not servers is None and len(servers)>0:
                                    serverList = servers.split(',')
                                    exist = 0
                                    for server in serverList:
                                        if server==jmsModuleTarget:
                                            exist = 1
                                            break
                                    if not exist:
                                        error = 1
                                        log.error('jmsModule.' + str(jmsModule) + '.Targets refers to server [' + str(jmsModuleTarget) + '] that does not exist within wls.servers.')
                                    else:
                                        log.debug('JMS Module [' + str(jmsModule) + '] target [' + str(jmsModuleTarget) + '] is valid.')
                            else:
                                if jmsModuleTargetType.upper()=='CLUSTER':
                                    if not clusters is None and len(clusters)>0:
                                        clusterList = clusters.split(',')
                                        exist = 0
                                        for cluster in clusterList:
                                            if cluster==jmsModuleTarget:
                                                exist = 1
                                                break
                                        if not exist:
                                            error = 1
                                            log.error('jmsModule.' + str(jmsModule) + '.Targets property refers to cluster [' + str(jmsModuleTarget) + '] that does not exist within wls.clusters.')
                                        else:
                                            log.debug('JMS Module [' + str(jmsModule) + '] target [' + str(jmsModuleTarget) + '] is valid.')

            jmsModuleSubDeployments = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployments')
            if not jmsModuleSubDeployments is None and len(jmsModuleSubDeployments)>0:
                jmsModuleSubDeploymentList = jmsModuleSubDeployments.split(',')
                for jmsModuleSubDeployment in jmsModuleSubDeploymentList:
                    helper.printHeader('[VALIDATING] JMS SubDeployment ' + str(jmsModuleSubDeployment) + ' of JMS Module ' + str(jmsModule) + ' properties')
                    
                    jmsModuleSubDeploymentName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Name')
                    if jmsModuleSubDeploymentName is None or len(jmsModuleSubDeploymentName)==0:
                        error = 1
                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Name property if it exists in configuration.')
                    else:
                        log.debug('JMS SubDeployment [' + str(jmsModuleSubDeployment) + '] name [' + str(jmsModuleSubDeploymentName) + '] is valid.')
                                            
                    jmsModuleSubDeploymentTargetType = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.TargetType')
                    if not jmsModuleSubDeploymentTargetType is None and len(jmsModuleSubDeploymentTargetType)>0:
                        if not jmsModuleSubDeploymentTargetType.upper()=='JMSSERVER' and not jmsModuleSubDeploymentTargetType.upper()=='CLUSTER':
                            error = 1
                            log.error('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.TargetType property is not valid. Valid target types are JMSServer and Cluster')
                        else:
                            log.debug('JMS SubDeployment [' + str(jmsModuleSubDeployment) + '] target type [' + str(jmsModuleSubDeploymentTargetType) + '] is valid.')
                            
                            jmsModuleSubDeploymentTargets = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Targets')
                            if jmsModuleSubDeploymentTargets is None or len(jmsModuleSubDeploymentTargets)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + jmsModule + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Targets property if it exists in configuration.')
                            else:
                                if jmsModuleSubDeploymentTargetType.upper()=='JMSSERVER':
                                    if not jmsservers is None and len(jmsservers)>0:
                                        jmsModuleSubDeploymentTargetList = jmsModuleSubDeploymentTargets.split(',')
                                        for jmsModuleSubDeploymentTarget in jmsModuleSubDeploymentTargetList:
                                            jmsserverList = jmsservers.split(',')
                                            exist = 0
                                            for jmsserver in jmsserverList:
                                                if jmsserver==jmsModuleSubDeploymentTarget:
                                                    exist = 1
                                                    break
                                            if not exist:
                                                error = 1
                                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Targets property at target jms server [' + str(jmsModuleSubDeploymentTarget) + '] and jmsServers property if they are configured properly.')
                                            else:
                                                log.debug('JMS SubDeployment [' + str(jmsModuleSubDeployment) + '] target [' + str(jmsModuleSubDeploymentTarget) + '] is valid.')
                                    else:
                                        error = 1
                                        log.error('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Targets property refers to a JMSServer but the jmsServers property does not exist.')
                                else:
                                    if jmsModuleSubDeploymentTargetType.upper()=='CLUSTER':
                                        clusters = domainProperties.getProperty('wls.clusters')
                                        if not clusters is None and len(clusters)>0:
                                            jmsModuleSubDeploymentTargetList = jmsModuleSubDeploymentTargets.split(',')
                                            for jmsModuleSubDeploymentTarget in jmsModuleSubDeploymentTargetList:
                                                clusterList = clusters.split(',')
                                                exist = 0
                                                for cluster in clusterList:
                                                    if cluster==jmsModuleSubDeploymentTarget:
                                                        exist = 1
                                                        break
                                                if not exist:
                                                    error = 1
                                                    log.error('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Targets property contains cluster [' + str(jmsModuleSubDeploymentTarget) + '] that does not exist within wls.cluster property.')
                                                else:
                                                    log.debug('JMS SubDeployment [' + str(jmsModuleSubDeployment) + '] target [' + str(jmsModuleSubDeploymentTarget) + '] is valid.')
                                        else:
                                            error = 1
                                            log.error('jmsModule.' + str(jmsModule) + '.Targets property is targeted to a cluster but no clusters are defined in wls.clusters property.')

                    jmsModuleSubDeploymentConnectionFactories = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactories')
                    if not jmsModuleSubDeploymentConnectionFactories is None and len(jmsModuleSubDeploymentConnectionFactories)>0:
                        jmsModuleSubDeploymentConnectionFactoryList = jmsModuleSubDeploymentConnectionFactories.split(',')
                        for jmsModuleSubDeploymentConnectionFactory in jmsModuleSubDeploymentConnectionFactoryList:
                            jmsConnectionFactoryName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.Name')
                            if jmsConnectionFactoryName is None or len(jmsConnectionFactoryName)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.Name property if it exists in configuration.')
                            else:
                                log.debug('Connection factory [' + str(jmsModuleSubDeploymentConnectionFactory) + '] name property [' + str(jmsConnectionFactoryName) + '] is valid.')

                            jmsConnectionFactoryJNDI = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.JNDI')
                            if jmsConnectionFactoryJNDI is None or len(jmsConnectionFactoryJNDI)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.JNDI property if it exists in configuration.')
                            else:
                                log.debug('Connection factory [' + str(jmsModuleSubDeploymentConnectionFactory) + '] JNDI property [' + str(jmsConnectionFactoryJNDI) + '] is valid.')

                            jmsConnectionFactoryReconnectPolicy = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.ReconnectPolicy')
                            if not jmsConnectionFactoryReconnectPolicy is None and len(jmsConnectionFactoryReconnectPolicy)>0:
                                if not jmsConnectionFactoryReconnectPolicy=='all' and not jmsConnectionFactoryReconnectPolicy=='producer' and not jmsConnectionFactoryReconnectPolicy=='all':
                                    error = 1
                                    log.error('The jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.ReconnectPolicy property supports only [all,producer,none].')
                                else:
                                    log.debug('Connection factory [' + str(jmsModuleSubDeploymentConnectionFactory) + '] reconnection policy property [' + str(jmsConnectionFactoryReconnectPolicy) + '] is valid.')


                            jmsConnectionFactoryServerAffinityEnabled = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.ServerAffinityEnabled')
                            if not jmsConnectionFactoryServerAffinityEnabled is None and len(jmsConnectionFactoryServerAffinityEnabled)>0:
                                if not jmsConnectionFactoryServerAffinityEnabled.upper()=='TRUE' and not jmsConnectionFactoryServerAffinityEnabled.upper()=='FALSE':
                                    error = 1
                                    log.error('The jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.ServerAffinityEnabled property supports only [true,false, or leave blank to use default].')
                                else:
                                    log.debug('Connection factory [' + str(jmsModuleSubDeploymentConnectionFactory) + '] server affinity enabled property [' + str(jmsConnectionFactoryServerAffinityEnabled) + '] is valid.')

                            jmsConnectionFactoryDefaultDeliveryMode = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.DefaultDeliveryMode')
                            if not jmsConnectionFactoryDefaultDeliveryMode is None and len(jmsConnectionFactoryDefaultDeliveryMode)>0:
                                if not jmsConnectionFactoryDefaultDeliveryMode=='Persistent' and not jmsConnectionFactoryDefaultDeliveryMode=='Non-persistent':
                                    error = 1
                                    log.error('The jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.ConnectionFactory.' + str(jmsModuleSubDeploymentConnectionFactory) + '.DefaultDeliveryMode property supports only [Persistent,Non-persistent, or leave blank to use default].')
                                else:
                                    log.debug('Connection factory [' + str(jmsModuleSubDeploymentConnectionFactory) + '] default delivery mode property [' + str(jmsConnectionFactoryDefaultDeliveryMode) + '] is valid.')

                    jmsModuleSubDeploymentQueues = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Queues')
                    if not jmsModuleSubDeploymentQueues is None and len(jmsModuleSubDeploymentQueues)>0:
                        jmsModuleSubDeploymentQueueList = jmsModuleSubDeploymentQueues.split(',')
                        for jmsModuleSubDeploymentQueue in jmsModuleSubDeploymentQueueList:
                            jmsQueueName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Queue.' + str(jmsModuleSubDeploymentQueue) + '.Name')
                            if jmsQueueName is None or len(jmsQueueName)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Queue.' + str(jmsModuleSubDeploymentQueue) + '.Name property if it exists in configuration.')
                            else:
                                log.debug('Queue [' + str(jmsModuleSubDeploymentQueue) + '] name property [' + str(jmsQueueName) + '] is valid.')

                            jmsQueueJNDI = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Queue.' + str(jmsModuleSubDeploymentQueue) + '.JNDI')
                            if jmsQueueJNDI is None or len(jmsQueueJNDI)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Queue.' + str(jmsModuleSubDeploymentQueue) + '.JNDI property if it exists in configuration.')
                            else:
                                log.debug('Queue [' + str(jmsModuleSubDeploymentQueue) + '] JNDI property [' + str(jmsQueueJNDI) + '] is valid.')

                    jmsModuleSubDeploymentUniQueues = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueues')
                    if not jmsModuleSubDeploymentUniQueues is None and len(jmsModuleSubDeploymentUniQueues)>0:
                        jmsModuleSubDeploymentUniQueueList = jmsModuleSubDeploymentUniQueues.split(',')
                        for jmsModuleSubDeploymentUniQueue in jmsModuleSubDeploymentUniQueueList:
                            jmsUniQueueName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.Name')
                            if jmsUniQueueName is None or len(jmsUniQueueName)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.Name property if it exists in configuration.')
                            else:
                                log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] name property [' + str(jmsUniQueueName) + '] is valid.')
                                
                            jmsUniQueueJNDI = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.JNDI')
                            if jmsUniQueueJNDI is None or len(jmsUniQueueJNDI)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.JNDI property if it exists in configuration.')
                            else:
                                log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] JNDI property [' + str(jmsUniQueueJNDI) + '] is valid.')

                            jmsUniQueueLBPolicy = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.LoadBalancingPolicy')
                            if not jmsUniQueueLBPolicy is None and len(jmsUniQueueLBPolicy)>0:
                                if not jmsUniQueueLBPolicy=='Round-Robin' and not jmsUniQueueLBPolicy=='Random':
                                    error = 1
                                    log.error('The jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.LoadBalancingPolicy property supports only [Round-Robin,Random].')
                                else:
                                    log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] load balacing policy property [' + str(jmsUniQueueLBPolicy) + '] is valid.')

                            jmsUniQueueFwdDelay = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.ForwardDelay')
                            if not jmsUniQueueFwdDelay is None and len(jmsUniQueueFwdDelay)>0:
                                try:
                                    int(jmsUniQueueFwdDelay)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.ForwardDelay [' + str(jmsUniQueueFwdDelay) + '] property.')
                                else:
                                    if int(jmsUniQueueFwdDelay)<-1:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.ForwardDelay [' + str(jmsUniQueueFwdDelay) + '] property, number is not in valid range [>=-1].')
                                    else:
                                        log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] forward delay [' + str(jmsUniQueueFwdDelay) + '] is valid.')

                            jmsUniQueueMaximumMessageSize = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MaximumMessageSize')
                            if not jmsUniQueueMaximumMessageSize is None and len(jmsUniQueueMaximumMessageSize)>0:
                                try:
                                    int(jmsUniQueueMaximumMessageSize)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MaximumMessageSize [' + str(jmsUniQueueMaximumMessageSize) + '] property.')
                                else:
                                    if int(jmsUniQueueMaximumMessageSize)<0 or int(jmsUniQueueMaximumMessageSize)>2147483647:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MaximumMessageSize [' + str(jmsUniQueueMaximumMessageSize) + '] property, number is not in valid range [0-2147483647].')
                                    else:
                                        log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] max-message-size [' + str(jmsUniQueueMaximumMessageSize) + '] is valid.')

                            jmsUniQueueMsgPerfPref = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MessagingPerformancePreference')
                            if not jmsUniQueueMsgPerfPref is None and len(jmsUniQueueMsgPerfPref)>0:
                                try:
                                    int(jmsUniQueueMsgPerfPref)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MessagingPerformancePreference [' + str(jmsUniQueueMsgPerfPref) + '] property.')
                                else:
                                    if int(jmsUniQueueMsgPerfPref)<0 or int(jmsUniQueueMsgPerfPref)>100:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.MessagingPerformancePreference [' + str(jmsUniQueueMsgPerfPref) + '] property, number is not in valid range [0-100].')
                                    else:
                                        log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] message-performance-preference [' + str(jmsUniQueueMsgPerfPref) + '] is valid.')

                            jmsUniQueueIncompleteWorkExpTime = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.IncompleteWorkExpirationTime')
                            if not jmsUniQueueIncompleteWorkExpTime is None and len(jmsUniQueueIncompleteWorkExpTime)>0:
                                try:
                                    int(jmsUniQueueIncompleteWorkExpTime)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.IncompleteWorkExpirationTime [' + str(jmsUniQueueIncompleteWorkExpTime) + '] property.')
                                else:
                                    if int(jmsUniQueueIncompleteWorkExpTime)<-1:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedQueue.' + str(jmsModuleSubDeploymentUniQueue) + '.IncompleteWorkExpirationTime [' + str(jmsUniQueueIncompleteWorkExpTime) + '] property, number is not in valid range [>=-1].')
                                    else:
                                        log.debug('Uniform Distributed Queue [' + str(jmsModuleSubDeploymentUniQueue) + '] incomplete-work-expiration-time [' + str(jmsUniQueueIncompleteWorkExpTime) + '] is valid.')

                    jmsModuleSubDeploymentTopics = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Topics')
                    if not jmsModuleSubDeploymentTopics is None and len(jmsModuleSubDeploymentTopics)>0:
                        jmsModuleSubDeploymentTopicList = jmsModuleSubDeploymentTopics.split(',')
                        for jmsModuleSubDeploymentTopic in jmsModuleSubDeploymentTopicList:
                            jmsTopicName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Topic.' + str(jmsModuleSubDeploymentTopic) + '.Name')
                            if jmsTopicName is None or len(jmsTopicName)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Topic.' + str(jmsModuleSubDeploymentTopic) + '.Name property if it exists in configuration.')
                            else:
                                log.debug('Topic [' + str(jmsModuleSubDeploymentTopic) + '] name property [' + str(jmsTopicName) + '] is valid.')

                            jmsTopicJNDI = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Topic.' + str(jmsModuleSubDeploymentTopic) + '.JNDI')
                            if jmsTopicJNDI is None or len(jmsTopicJNDI)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.Topic.' + str(jmsModuleSubDeploymentTopic) + '.JNDI property if it exists in configuration.')
                            else:
                                log.debug('Topic [' + str(jmsModuleSubDeploymentTopic) + '] JNDI property [' + str(jmsTopicJNDI) + '] is valid.')
                                
                    jmsModuleSubDeploymentUniTopics = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopics')
                    if not jmsModuleSubDeploymentUniTopics is None and len(jmsModuleSubDeploymentUniTopics)>0:
                        jmsModuleSubDeploymentUniTopicList = jmsModuleSubDeploymentUniTopics.split(',')
                        for jmsModuleSubDeploymentUniTopic in jmsModuleSubDeploymentUniTopicList:
                            jmsUniTopicName = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.Name')
                            if jmsUniTopicName is None or len(jmsUniTopicName)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.Name property if it exists in configuration.')
                            else:
                                log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] name property [' + str(jmsUniTopicName) + '] is valid.')

                            jmsUniTopicJNDI = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.JNDI')
                            if jmsUniTopicJNDI is None or len(jmsUniTopicJNDI)==0:
                                error = 1
                                log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.JNDI property if it exists in configuration.')
                            else:
                                log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] JNDI property [' + str(jmsUniTopicJNDI) + '] is valid.')

                            jmsUniTopicLBPolicy = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.LoadBalancingPolicy')
                            if not jmsUniTopicLBPolicy is None and len(jmsUniTopicLBPolicy)>0:
                                if not jmsUniTopicLBPolicy=='Round-Robin' and not jmsUniTopicLBPolicy=='Random':
                                    error = 1
                                    log.error('The jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.LoadBalancingPolicy property supports only [Round-Robin,Random].')
                                else:
                                    log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] load balancing policy property [' + str(jmsUniTopicLBPolicy) + '] is valid.')

                            jmsUniTopicFwdDelay = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.ForwardDelay')
                            if not jmsUniTopicFwdDelay is None and len(jmsUniTopicFwdDelay)>0:
                                try:
                                    int(jmsUniTopicFwdDelay)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.ForwardDelay [' + str(jmsUniTopicFwdDelay) + '] property.')
                                else:
                                    if int(jmsUniTopicFwdDelay)<-1:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.ForwardDelay [' + str(jmsUniTopicFwdDelay) + '] property, number is not in valid range [>=-1].')
                                    else:
                                        log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] forward delay [' + str(jmsUniTopicFwdDelay) + '] is valid.')

                            jmsUniTopicMaximumMessageSize = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MaximumMessageSize')
                            if not jmsUniTopicMaximumMessageSize is None and len(jmsUniTopicMaximumMessageSize)>0:
                                try:
                                    int(jmsUniTopicMaximumMessageSize)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MaximumMessageSize [' + str(jmsUniTopicMaximumMessageSize) + '] property.')
                                else:
                                    if int(jmsUniTopicMaximumMessageSize)<0 or int(jmsUniTopicMaximumMessageSize)>2147483647:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MaximumMessageSize [' + str(jmsUniTopicMaximumMessageSize) + '] property, number is not in valid range [0-2147483647].')
                                    else:
                                        log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] max-message-size [' + str(jmsUniTopicMaximumMessageSize) + '] is valid.')

                            jmsUniTopicMsgPerfPref = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MessagingPerformancePreference')
                            if not jmsUniTopicMsgPerfPref is None and len(jmsUniTopicMsgPerfPref)>0:
                                try:
                                    int(jmsUniTopicMsgPerfPref)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MessagingPerformancePreference [' + str(jmsUniTopicMsgPerfPref) + '] property.')
                                else:
                                    if int(jmsUniTopicMsgPerfPref)<0 or int(jmsUniTopicMsgPerfPref)>100:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.MessagingPerformancePreference [' + str(jmsUniTopicMsgPerfPref) + '] property, number is not in valid range [0-100].')
                                    else:
                                        log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] message-performance-preference [' + str(jmsUniTopicMsgPerfPref) + '] is valid.')

                            jmsUniTopicIncompleteWorkExpTime = domainProperties.getProperty('jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.IncompleteWorkExpirationTime')
                            if not jmsUniTopicIncompleteWorkExpTime is None and len(jmsUniTopicIncompleteWorkExpTime)>0:
                                try:
                                    int(jmsUniTopicIncompleteWorkExpTime)
                                except ValueError:
                                    log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.IncompleteWorkExpirationTime [' + str(jmsUniTopicIncompleteWorkExpTime) + '] property.')
                                else:
                                    if int(jmsUniTopicIncompleteWorkExpTime)<-1:
                                        log.error('Please verify jmsModule.' + str(jmsModule) + '.SubDeployment.' + str(jmsModuleSubDeployment) + '.UniformDistributedTopic.' + str(jmsModuleSubDeploymentUniTopic) + '.IncompleteWorkExpirationTime [' + str(jmsUniTopicIncompleteWorkExpTime) + '] property, number is not in valid range [>=-1].')
                                    else:
                                        log.debug('Uniform Distributed Topic [' + str(jmsModuleSubDeploymentUniTopic) + '] incomplete-work-expiration-time [' + str(jmsUniTopicIncompleteWorkExpTime) + '] is valid.')

    return error
Exemplo n.º 22
0
def validateJmsServersProperty(domainProperties):
    
    error = 0
    
    jmsservers = domainProperties.getProperty('jmsServers')
    filestores = domainProperties.getProperty('persistent.filestores')
    
    if not jmsservers is None and len(jmsservers)>0:
        jmsserverList = jmsservers.split(',')
        for jmsserver in jmsserverList:
            helper.printHeader('[VALIDATING] JMS Server ' + str(jmsserver) + ' properties')
            
            jmsserverName = domainProperties.getProperty('jmsServer.' + str(jmsserver) + '.Name')
            if jmsserverName is None or len(jmsserverName)==0:
                error = 1
                log.error('Please verify jmsServer.' + str(jmsserver) + '.Name property if it exists in configuration.')
            else:
                log.debug('JMS Server [' + str(jmsserver) + '] name property [' + str(jmsserverName) + '] is valid.')

            jmsserverTarget = domainProperties.getProperty('jmsServer.' + str(jmsserver) + '.Target')
            if not jmsserverTarget is None and len(jmsserverTarget)>0:
                servers = domainProperties.getProperty('wls.servers')
                if not servers is None and len(servers)>0:
                    serverList = servers.split(',')
                    exist = 0

                    for server in serverList:
                        if server==jmsserverTarget:
                            exist = 1
                            break
                    if not exist:
                        error = 1
                        log.error('jmsServer.' + str(jmsserver) + '.Target property refers to a server that does not exist within wls.servers.')
                    else:
                        log.debug('JMS Server [' + str(jmsserver) + '] target property [' + str(jmsserverTarget) + '] is valid.')

            jmsserverPersistStoreType = domainProperties.getProperty('jmsServer.' + str(jmsserver) + '.PersistentStoreType')
            if not jmsserverPersistStoreType is None:
                if jmsserverPersistStoreType.upper()=='FILE':
                    jmsserverPersistStore = domainProperties.getProperty('jmsServer.' + str(jmsserver) + '.PersistentStore')
                    if not filestores is None and len(filestores)>0:
                        filestoreList = filestores.split(',')
                        exist = 0
    
                        for filestore in filestoreList:
                            if filestore==jmsserverPersistStore:
                                exist = 1
                                break
                        if not exist:
                            error = 1
                            log.error('Please verify jmsServer.' + str(jmsserver) + '.PersistentStore property and persistent.filestores if they are configured properly.')
                        else:
                            log.debug('JMS Server [' + str(jmsserver) + '] persistent store property [' + str(jmsserverPersistStoreType) + '] is valid.')
                    else:
                        error = 1
                        log.error('Filestore configuration is missing, please verify jmsServer.' + str(jmsserver) + '.PersistentStoreType property and persistent.filestores if they are configured properly.')
                else:
                    error = 1
                    log.error('The persistent filestore type is likely incorrect, please verify jmsServer.' + str(jmsserver) + '.PersistentStoreType if they are configured properly.')

            jmsserverStoreEnabled = domainProperties.getProperty('jmsServer.' + str(jmsserver) + '.StoreEnabled')
            if not jmsserverStoreEnabled is None and len(jmsserverStoreEnabled)>0:
                if not jmsserverStoreEnabled.upper()=='TRUE' and not jmsserverStoreEnabled.upper()=='FALSE':
                    error = 1
                    log.error('The jmsServer.' + str(jmsserver) + '.StoreEnabled property supports only [true,false, or leave blank to use default].')
                else:
                    log.debug('JMS Server [' + str(jmsserver) + '] store-enabled property [' + str(jmsserverStoreEnabled) + '] is valid.')

    return error