def report_system(self, system, osh): '@types: System, osh -> osh, list[osh]' reporter = sap.Reporter(sap.Builder()) linkReporter = sap.LinkReporter() system_osh = reporter.reportSystem(system) memb_osh = linkReporter.reportMembership(system_osh, osh) return system_osh, [system_osh, memb_osh]
def _updateSystemOsh(system, systemOsh): '@types: System, osh -> osh' builder = sap.Builder() if system: if system.uuid: builder.updateUuid(systemOsh, system.uuid) if system.type: builder.updateSystemType(systemOsh, system.type) return systemOsh
def _reportSapSystem(system, userName=None): r'@types: System, str -> tuple[osh[sap_system], osh[j2eecluster], oshv]' vector = ObjectStateHolderVector() systemPdo = sap.Builder.SystemPdo(system, username=userName) systemReporter = sap.Reporter(sap.Builder()) systemOsh = systemReporter.reportSystemPdo(systemPdo) vector.add(systemOsh) clusterOsh = reportClusterOnSystem(system, systemOsh) vector.add(clusterOsh) return systemOsh, clusterOsh, vector
def discoverSystems(solman): r'@types: saputils.SapSolman -> oshv, list[tuple[System, osh]]' logger.info('Discover SAP Systems') getSystemsQuery = GetSystems() queryExecutor = sap_abap_discoverer.TableQueryExecutor(solman) systemDetails = queryExecutor.executeQuery(getSystemsQuery) systems = map(first, systemDetails) reporter = sap.Reporter(sap.Builder()) oshs = map(reporter.reportSystem, systems) logger.info("Discovered %s systems" % len(oshs)) vector = ObjectStateHolderVector() fptools.each(vector.add, oshs) return vector, zip(systems, oshs)
def reportRfcConfig(config, trexHostOsh, resolver): r'@types: RfcConfiguration, osh, DnsResolver -> oshv' oshs = [] endpoints = _resolveEndpoint(resolver, config.createGatewayEndpoint()) if endpoints: sapOsh = sap.Reporter(sap.Builder()).reportSystem(config.system) oshs.append(sapOsh) system = config.system inst = first(system.getInstances()) oshs.extend( reportBareSapInstByEndpoints(endpoints, inst, system, sapOsh)) # connect served sap system with TREX host by rfc-connection link oshs.extend(_reportRfc(inst.getNumber(), sapOsh, trexHostOsh)) return oshs
def _reportSystem(sapUtils, system, domain, isSolMan, tmsDomain): '@types: SapUtils, System, str, bool, sap.TmsDomain -> osh' sapReporter = sap.Reporter(sap.Builder()) userName = fptools.safeFunc(sapUtils.getUserName)() credentialsId = fptools.safeFunc(sapUtils.getCredentialId)() systemOsh = sapReporter.reportSystemPdo( sap.Builder.SystemPdo(system, ipAddress=sapUtils.getIpAddress(), ipDomain=domain, username=userName, credentialsId=credentialsId, connectionClient=sapUtils.getConnectionClient(), router=sapUtils.getRouter(), isSolutionManager=isSolMan, tmsDomain=tmsDomain)) return systemOsh
def _discover_sap_system(sapUtils, systemName): '@types: SapUtils, str -> System' sapSystem = sap.System(systemName) systemBuilder = sap.Builder() sapReporter = sap.Reporter(systemBuilder) systemOsh = sapReporter.reportSystem(sapSystem) # x) sap system version is represented by master component version discoverer = sap_abap_discoverer.SoftwareComponentDiscovererByJco(sapUtils) try: masterCmpVersion = discoverer.discoveryMasterComponentVersionDescription() except: logger.reportWarning('Failed to discover master component version') else: # x) report SAP master component version if masterCmpVersion: systemOsh = sapReporter.reportSystemMasterComponentVersion(systemOsh, masterCmpVersion) return systemOsh
def report_system(system_name, instance_number, ip_address, application_ip=None, cred_id=None): oshs = [] system = sap.System(system_name) system_osh = sap.Builder().buildSapSystem(system) instance_osh = InstanceBuilder(reportName=False, reportInstName=False).buildNoNameInstance( instance_number, None, system, applicationIp=application_ip, credId=cred_id) host_osh = modeling.createHostOSH(ip_address) instance_osh.setContainer(host_osh) oshs.append(system_osh) oshs.append(instance_osh) linkReporter = sap.LinkReporter(sap.LinkBuilder()) oshs.append(linkReporter.reportMembership(system_osh, instance_osh)) return system_osh, oshs