示例#1
0
def reportInstanceInfo(instInfo,
                       ips,
                       system,
                       credsId=None,
                       connectionClientNr=None,
                       application_ip=None,
                       system_osh=None):
    r'@types: InstanceInfo, list[ip_addr._BaseIP, System, str, str -> tuple[ObjectStateHolder, ObjectStateHolderVector]'
    vector = ObjectStateHolderVector()
    hostReporter = sap.HostReporter(sap.HostBuilder())
    ascsReporter = sap_abap.InstanceReporter(sap_abap.AscsInstanceBuilder())
    instReporter = sap_abap.InstanceReporter(sap_abap.InstanceBuilder())

    # report host of instInfo
    hostOsh, iVector = hostReporter.reportHostWithIps(*ips)
    vector.addAll(iVector)
    # report SAP system
    if system_osh:
        system_osh.setStringAttribute(
            'data_note',
            'This SAP System link to ' + hostOsh.getAttributeValue('host_key'))
        vector.add(system_osh)

    # report r3 server on host
    applicationIp = application_ip
    isScs = sap_abap.isCentralServicesInstance(instInfo.instance)
    serverOsh = None
    if isScs:
        pdo = sap_abap.AscsInstanceBuilder.createPdo(
            instInfo.instance,
            system,
            homeDirPath=instInfo.homeDirPath,
            codePage=instInfo.codePage,
            versionInfo=instInfo.versionInfo,
            startDate=instInfo.startDate,
            applicationIp=applicationIp,
            credId=credsId,
            connectionClientNr=connectionClientNr)
        serverOsh = ascsReporter.reportInstance(pdo, hostOsh)
    else:
        isCentral = None
        pdo = sap_abap.InstanceBuilder.createPdo(
            instInfo.instance,
            system,
            homeDirPath=instInfo.homeDirPath,
            dbLibraryInfo=instInfo.dbLibraryInfo,
            codePage=instInfo.codePage,
            numberOfProcesses=instInfo.numberOfProcesses,
            versionInfo=instInfo.versionInfo,
            startDate=instInfo.startDate,
            machineType=instInfo.host.machineType,
            osInfo=instInfo.host.osInfo,
            applicationIp=applicationIp,
            credId=credsId,
            connectionClientNr=connectionClientNr,
            isCentral=isCentral)
        serverOsh = instReporter.reportInstance(pdo, hostOsh)
    vector.add(serverOsh)
    return serverOsh, vector
示例#2
0
def reportInstanceInfo(instInfo, ips, system, credsId=None,
                        connectionClientNr=None, application_ip=None, system_osh=None):
    r'@types: InstanceInfo, list[ip_addr._BaseIP, System, str, str -> tuple[ObjectStateHolder, ObjectStateHolderVector]'
    vector = ObjectStateHolderVector()
    hostReporter = sap.HostReporter(sap.HostBuilder())
    ascsReporter = sap_abap.InstanceReporter(sap_abap.AscsInstanceBuilder())
    instReporter = sap_abap.InstanceReporter(sap_abap.InstanceBuilder())

    # report host of instInfo
    hostOsh, iVector = hostReporter.reportHostWithIps(*ips)
    vector.addAll(iVector)
    # report SAP system
    if system_osh:
        system_osh.setStringAttribute('data_note', 'This SAP System link to ' + hostOsh.getAttributeValue('host_key'))
        vector.add(system_osh)

    # report r3 server on host
    applicationIp = application_ip
    isScs = sap_abap.isCentralServicesInstance(instInfo.instance)
    serverOsh = None
    if isScs:
        pdo = sap_abap.AscsInstanceBuilder.createPdo(
                    instInfo.instance, system,
                    homeDirPath=instInfo.homeDirPath,
                    codePage=instInfo.codePage,
                    versionInfo=instInfo.versionInfo,
                    startDate=instInfo.startDate,
                    applicationIp=applicationIp,
                    credId=credsId,
                    connectionClientNr=connectionClientNr)
        serverOsh = ascsReporter.reportInstance(pdo, hostOsh)
    else:
        isCentral = None
        pdo = sap_abap.InstanceBuilder.createPdo(
                instInfo.instance, system,
                homeDirPath=instInfo.homeDirPath,
                dbLibraryInfo=instInfo.dbLibraryInfo,
                codePage=instInfo.codePage,
                numberOfProcesses=instInfo.numberOfProcesses,
                versionInfo=instInfo.versionInfo,
                startDate=instInfo.startDate,
                machineType=instInfo.host.machineType,
                osInfo=instInfo.host.osInfo,
                applicationIp=applicationIp,
                credId=credsId,
                connectionClientNr=connectionClientNr,
                isCentral=isCentral)
        serverOsh = instReporter.reportInstance(pdo, hostOsh)
    vector.add(serverOsh)
    return serverOsh, vector
示例#3
0
def checkDoubleStack(doc):
    r''' In double stack must be present Java SCS and at least
    one abap instance which central or SCS, one database but two schemas,
    optionally two message servers

    @types: IniDocument -> bool'''
    system = sap_discoverer.parse_system_in_pf(doc)
    instance = sap_discoverer.ProfileParser.parseInstance(doc)
    isAbapMsPresent = first(_parseUsedAbapMsDetails(doc)) is not None
    isJavaMsPresent = _parseUsedJavaMsDetails(doc) is not None
    isAbapCentral = None
    isAbapScs = sap_abap.isCentralServicesInstance(instance)

    return (system.type == sap.SystemType.DS
                     or (isAbapMsPresent and isJavaMsPresent)
                     or (isJavaMsPresent and (isAbapCentral or isAbapScs)))