def _reportNonStopTopology(resultCollection, hostOsh, hostIp,
                           catalogUidToSqlMx, catalogUidToMxSchema, sqlmpList):
    for catalogUid, sqlmx in catalogUidToSqlMx.items():
        sqlmxOsh = modeling.createApplicationOSH("nonstop_sql_mx",
                                                 sqlmx.data_name, hostOsh,
                                                 "Database", sqlmx.vendor)
        sqlmxOsh.setStringAttribute('database_dbsid', sqlmx.database_dbsid)
        sqlmxOsh.setStringAttribute('database_dbversion', sqlmx.version)
        sqlmxOsh.setStringAttribute('application_version', sqlmx.version)
        sqlmxOsh.setStringAttribute('catalog_uuid', sqlmx.catalog_uuid)

        resultCollection.add(sqlmxOsh)

        sqlmxSchemaNames = catalogUidToMxSchema.get(catalogUid)
        if sqlmxSchemaNames:
            for sqlmxSchemaName in sqlmxSchemaNames:
                sqlmxSchemaOsh = ObjectStateHolder('database_instance')
                sqlmxSchemaOsh.setStringAttribute('data_name', sqlmxSchemaName)
                sqlmxSchemaOsh.setContainer(sqlmxOsh)
                resultCollection.add(sqlmxSchemaOsh)

    for sqlmp in sqlmpList:
        sqlmpOsh = modeling.createApplicationOSH("database", sqlmp.data_name,
                                                 hostOsh, "Database",
                                                 sqlmp.vendor)
        sqlmpOsh.setStringAttribute('database_dbsid', sqlmp.database_dbsid)
        sqlmpOsh.setStringAttribute('database_dbversion', sqlmp.version)
        sqlmpOsh.setStringAttribute('application_version', sqlmp.version)
        resultCollection.add(sqlmpOsh)
示例#2
0
def createFsmSoftware(fsmSoftware, hostOsh):
    """
    Creates the Object State Holder of the IBM FSM Management Sortware
    @param fsmSoftware: the discovered IBM FSM
    @type fsmSoftware: instance of the IbmFsm Data Object
    @param hostOsh: host the FSM is running on
    @type hostOsh:  Object State Holder of the Host CI or any of its children
    @return: Object State Holder of the IBM FSM Management Sortware
    """
    if fsmSoftware:
        fsmOsh = modeling.createApplicationOSH('ibm_fsm', fsmSoftware.name,
                                               hostOsh, 'virtualization',
                                               'ibm_corp')
        #        if fsmSoftware.bios:
        #            fsmOsh.setStringAttribute("fsm_bios", fsmSoftware.bios)
        if fsmSoftware.typeInformation.serialNum:
            fsmOsh.setStringAttribute("fsm_serial_number",
                                      fsmSoftware.typeInformation.serialNum)
        if fsmSoftware.typeInformation.fsmType:
            fsmOsh.setStringAttribute("fsm_type",
                                      fsmSoftware.typeInformation.fsmType)
        if fsmSoftware.versionInformation.shortVersion:
            fsmOsh.setStringAttribute(
                "application_version_number",
                fsmSoftware.versionInformation.shortVersion)
        if fsmSoftware.versionInformation.fullVersion:
            fsmOsh.setStringAttribute(
                "application_version",
                fsmSoftware.versionInformation.fullVersion)
        return fsmOsh
示例#3
0
def createOAMRunningSoftwareOsh(scpId, ip, port, protocolId, version, apacheOsh, vector):
    """
    Create OAM osh on oam endpoint, oam node & client server relation
    """
    logger.debug('submit OAM endpoint: %s:%s' % (ip, port))
    endpoint = netutils.createTcpEndpoint(ip, port)
    builder = netutils.ServiceEndpointBuilder()
    reporter = netutils.EndpointReporter(builder)
    nodeOsh = reporter.reportHostFromEndpoint(endpoint)
    endpointOsh = reporter.reportEndpoint(endpoint, nodeOsh)
    linkOsh = modeling.createLinkOSH('client_server', apacheOsh, endpointOsh)
    linkOsh.setStringAttribute('clientserver_protocol', 'tcp')
    oamServerOsh = modeling.createApplicationOSH('running_software', 'Oracle Access Management', nodeOsh, None, 'oracle_corp')
    oamServerOsh.setStringAttribute('credentials_id', protocolId)
    oamServerOsh.setStringAttribute('version', version)
    usageOsh = modeling.createLinkOSH('usage', oamServerOsh, endpointOsh)
    vector.add(nodeOsh)
    vector.add(endpointOsh)
    vector.add(linkOsh)
    vector.add(oamServerOsh)
    vector.add(usageOsh)
    logger.debug("create ownership between runningsoftware and scp")
    vector.addAll(scp.createOwnerShip(scpId, oamServerOsh))
    logger.debug("create consumer-provider link between apache and runningsoftware")
    reference = 'connection_type=oam, server_host=%s, server_ip=%s, server_port=%s' % (ip, ip, port)
    vector.addAll(scp.createCPLinkByOsh(apacheOsh, oamServerOsh, scpId, reference))
示例#4
0
 def build(self):
     if self.ipAddress and self.queueName:
         self.hostOsh = modeling.createHostOSH(self.ipAddress)
         self.msMqManagerOsh = modeling.createApplicationOSH('msmqmanager', 'Microsoft MQ Manager', self.hostOsh)
         self.queueOsh = ObjectStateHolder('msmqqueue')
         self.queueOsh.setAttribute('data_name', self.queueName.lower())
         self.queueOsh.setContainer(self.msMqManagerOsh)
示例#5
0
    def getTopology(self, ipAddress):
        lb = modeling.createHostOSH(ipAddress, 'host')
        cisco_ace = modeling.createApplicationOSH('cisco_ace', 'Cisco_ACE', lb, 'Load Balance', 'Cisco')
        self.OSHVResult.add(lb)
        self.OSHVResult.add(cisco_ace)

        self.discoverVirtualServers(cisco_ace)
示例#6
0
def DiscoveryMain(Framework):
    ip = Framework.getTriggerCIData('ip_address')
    credentialIds = netutils.getAvailableProtocols(Framework, 'ucs', ip)
    if not credentialIds:
        logger.warn('No generic credential for UCS')
        Framework.reportWarning('No generic credential for UCS')
        return

    ucs_id = Framework.getTriggerCIData('ucs_id')

    originFramework = Framework
    connectionManager = None
    connectedCredentialId = None
    for credentialId in credentialIds:
        logger.debug('Begin trying credential id:', credentialId)
        params = {'credentialsId': credentialId}
        tmpFramework = MyFramework(originFramework, parameters=params)
        manager = FrameworkBasedConnectionDataManager(tmpFramework, ip)
        try:
            client = manager.getClient()
            if client:
                logger.debug("Connected")
                connectionManager = manager
                connectedCredentialId = credentialId
                break
        except:
            logger.debugException('')
            logger.debug('Can not connection by credential:', credentialId)
        finally:
            if connectionManager:
                connectionManager.closeClient()

    if connectionManager:
        logger.debug('Connected by credential Id:', connectedCredentialId)
        vec = ObjectStateHolderVector()
        hostOsh = modeling.createHostOSH(ip)
        appOsh = modeling.createApplicationOSH('running_software',
                                               'UCS',
                                               hostOsh,
                                               vendor='Cisco')
        appOsh.setAttribute('application_ip', ip)
        appOsh.setAttribute('credentials_id', connectedCredentialId)
        vec.add(hostOsh)
        vec.add(appOsh)
        return vec
    else:
        if ucs_id:
            logger.debug('Delete the ucs since it can not be connected:%s' %
                         ucs_id)
            softwareOsh = modeling.createOshByCmdbId('running_software',
                                                     ucs_id)
            Framework.deleteObject(softwareOsh)

        logger.warn(
            'All credentials have been tried. No credential can connect to UCS by ip %s'
            % ip)
        Framework.reportWarning(
            'All credentials have been tried. No credential can connect to UCS by ip %s'
            % ip)
示例#7
0
    def getTopology(self, ipAddress):
        lb = modeling.createHostOSH(ipAddress, 'host')
        cisco_ace = modeling.createApplicationOSH('cisco_ace', 'Cisco_ACE', lb,
                                                  'Load Balance', 'Cisco')
        self.OSHVResult.add(lb)
        self.OSHVResult.add(cisco_ace)

        self.discoverVirtualServers(cisco_ace)
示例#8
0
 def build(self):
     if self.ipAddress and self.queueName:
         self.hostOsh = modeling.createHostOSH(self.ipAddress)
         self.msMqManagerOsh = modeling.createApplicationOSH(
             'msmqmanager', 'Microsoft MQ Manager', self.hostOsh)
         self.queueOsh = ObjectStateHolder('msmqqueue')
         self.queueOsh.setAttribute('data_name', self.queueName.lower())
         self.queueOsh.setContainer(self.msMqManagerOsh)
示例#9
0
 def getTopology(self, ipAddress):
     #TODO change host to lb
     lb = modeling.createHostOSH(ipAddress, 'host')
     f5 = modeling.createApplicationOSH('f5_ltm', 'F5 BIG-IP LTM', lb)
     self.add(lb)
     self.add(f5)        
     
     self.discoverF5(f5)
示例#10
0
def createIbmHypervisorOsh(managedSystemOsh):
        """
        Creates the IBM Hypervisor Object State Holder
        @param managedSystemOsh: the discovered Managed System the Hypervisor is runnig on
        @type managedSystemOsh: OSH instance of the Node which acts as a host for the VM 
        @return: Object State Holder for IBM Hypervisor  
        """
        return modeling.createApplicationOSH('virtualization_layer', "IBM Hypervisor", managedSystemOsh, None, "ibm_corp")
示例#11
0
def createIbmHypervisorOsh(managedSystemOsh):
    """
        Creates the IBM Hypervisor Object State Holder
        @param managedSystemOsh: the discovered Managed System the Hypervisor is runnig on
        @type managedSystemOsh: OSH instance of the Node which acts as a host for the VM 
        @return: Object State Holder for IBM Hypervisor  
        """
    return modeling.createApplicationOSH('virtualization_layer',
                                         "IBM Hypervisor", managedSystemOsh,
                                         None, "ibm_corp")
示例#12
0
 def reportDomainControllers(self, resultsVector):
     if self.domainFqdn:
         resolver = DNSResolver(self.client)
         ipList = resolver.resolveIpByNsLookup(self.domainFqdn)
         for ipAddress in ipList:
             logger.debug("Reporting Domain Controller for ip: " + ipAddress)
             hostOsh = modeling.createHostOSH(ipAddress)
             domainControllerOsh = modeling.createApplicationOSH("domaincontroller", "DomainController", hostOsh)
             modeling.setApplicationProductName(domainControllerOsh, "domain_controller")
             resultsVector.add(hostOsh)
             resultsVector.add(domainControllerOsh)
示例#13
0
def getAgates(shellUtils, installpath, sapitsOSH, OSHVResult):
    mapInstanceNameToAgate = HashMap()
    filePath = installpath + '\\config\\ItsRegistryWGATE.xml'
    data = shellUtils.safecat(filePath)
    logger.debug('got ItsRegistryWGATE file')
    if data == None or error(data):
        logger.error('Got: [', data, '] when performing command [ safecat ',
                     filePath, '] - terminating script')
    else:
        builder = SAXBuilder(0)
        doc = builder.build(StringReader(data))
        root = doc.getRootElement()
        localWgates = getElementByAttrValue(root, 'key', 'name', 'LocalWgates')
        wgates = localWgates.getChildren()
        it = wgates.iterator()
        while it.hasNext():
            wgate = it.next()
            value = wgate.getAttributeValue('name')
            if value.find('WGATE_') >= 0:
                instancesRoot = getElementByAttrValue(wgate, 'key', 'name',
                                                      'Instances')
                instances = instancesRoot.getChildren()
                itInstances = instances.iterator()
                while itInstances.hasNext():
                    instance = itInstances.next()
                    instanceName = instance.getAttributeValue('name')
                    logger.debug(instanceName)
                    agatesRoot = getElementByAttrValue(instance, 'key', 'name',
                                                       'Agates')
                    agates = agatesRoot.getChildren()
                    itAgates = agates.iterator()
                    while itAgates.hasNext():
                        agate = itAgates.next()
                        agateHost = getElementByAttrValue(
                            agate, 'value', 'name', 'Host')
                        host = agateHost.getText()
                        agates = mapInstanceNameToAgate.get(instanceName)
                        if agates == None:
                            agates = ArrayList()
                            mapInstanceNameToAgate.put(instanceName, agates)
                        try:
                            ip = netutils.getHostAddress(host)
                            hostOSH = modeling.createHostOSH(ip)
                            OSHVResult.add(hostOSH)

                            agateOSH = modeling.createApplicationOSH(
                                'sap_its_agate', 'ITS_AGATE_' + ip, hostOSH)
                            OSHVResult.add(agateOSH)

                            agates.add(agateOSH)
                        except:
                            logger.warn('Failed resolving IP for agate host ',
                                        host)
    return mapInstanceNameToAgate
示例#14
0
 def reportDomainControllers(self, resultsVector):
     if self.domainFqdn:
         resolver = DNSResolver(self.client)
         ipList = resolver.resolveIpByNsLookup(self.domainFqdn)
         for ipAddress in ipList:
             logger.debug('Reporting Domain Controller for ip: ' + ipAddress)
             hostOsh = modeling.createHostOSH(ipAddress)
             domainControllerOsh = modeling.createApplicationOSH('domaincontroller', "DomainController", hostOsh)
             modeling.setApplicationProductName(domainControllerOsh,'domain_controller')
             resultsVector.add(hostOsh)
             resultsVector.add(domainControllerOsh)
示例#15
0
def createListenerOSH(hostOSH, listenedIPs, listenerName, listenerVersion):
    if listenerName:
        listenerOSH = modeling.createApplicationOSH('oracle_listener', 'TNS Listener', hostOSH, 'Database', 'oracle_corp')
        if listenedIPs:
            listenerOSH.setAttribute('listened_ips',listenedIPs)
        modeling.setAdditionalKeyAttribute(listenerOSH, 'listener_name', listenerName)
        if listenerVersion:
            listenerOSH.setAttribute('application_version', listenerVersion)
        return listenerOSH
    else:
        logger.error('Failed to create Listener OSH. Listener name is not specified.')
示例#16
0
	def __init__(self, snmpAgent, OSHVResult, Framework, hostOsh):
		self.snmpAgent = snmpAgent
		self.OSHVResult = OSHVResult
		self.Framework = Framework
		
		self.css = modeling.createApplicationOSH('cisco_css', 'Cisco CSS', hostOsh)
		
		self.OSHVResult.add(self.css)
		
		self.resourcePools = {}
		# KB specific: fix of port translations
		self.resourcePoolsToServiceAddress = {}
示例#17
0
    def getTopology(self):
        self.lbOsh = self.discoveryLB()
        service_map = self.getServices()
        logger.debug('service_map:', service_map)

        service_group_map = self.getServiceGroup()
        logger.debug('service_group_map:', service_group_map)

        server_map = self.getServer()
        logger.debug('server_map:', server_map)

        v_server_map = self.getVServers()
        logger.debug('v_server_map:', v_server_map)

        v_service_map = self.getVServices()
        logger.debug('vservice:', v_service_map)
        self.linkVServerAndVServices(v_server_map, v_service_map)

        all_service_map = {}
        all_service_map.update(service_map)
        all_service_map.update(service_group_map)

        self.linkServerAndServices(server_map, all_service_map)

        logger.debug('server map:', server_map.values())

        self.linkVServerAndServers(v_server_map, all_service_map)
        logger.debug('v_server map:', v_server_map.values())

        vector = ObjectStateHolderVector()

        vector.add(self.lbOsh)

        ns_soft_osh = modeling.createApplicationOSH('citrix_netscaler',
                                                    'Citrix NetScaler',
                                                    self.lbOsh, 'Load Balance',
                                                    'Citrix')
        vector.add(ns_soft_osh)

        for v_server in v_server_map.values():
            vServerBuilder = VServerBuilder(v_server, ns_soft_osh)
            vector.addAll(vServerBuilder.build())
            crg_osh = vServerBuilder.getOsh()

            lbcBuilder = LBClusterBuilder(v_server, crg_osh, ns_soft_osh)
            vector.addAll(lbcBuilder.build())
            lbc_osh = lbcBuilder.getOsh()

            for service in v_server.services:
                serviceBuilder = ServiceBuilder(service, lbc_osh)
                vector.addAll(serviceBuilder.build())

        return vector
示例#18
0
    def __init__(self, snmpAgent, OSHVResult, Framework, hostOsh):
        self.snmpAgent = snmpAgent
        self.OSHVResult = OSHVResult
        self.Framework = Framework

        self.css = modeling.createApplicationOSH('cisco_css', 'Cisco CSS',
                                                 hostOsh)

        self.OSHVResult.add(self.css)

        self.resourcePools = {}
        # KB specific: fix of port translations
        self.resourcePoolsToServiceAddress = {}
    def getTopology(self):
        self.lbOsh = self.discoveryLB()
        service_map = self.getServices()
        logger.debug('service_map:', service_map)

        service_group_map = self.getServiceGroup()
        logger.debug('service_group_map:', service_group_map)

        server_map = self.getServer()
        logger.debug('server_map:', server_map)

        v_server_map = self.getVServers()
        logger.debug('v_server_map:', v_server_map)

        v_service_map = self.getVServices()
        logger.debug('vservice:', v_service_map)
        self.linkVServerAndVServices(v_server_map, v_service_map)

        all_service_map = {}
        all_service_map.update(service_map)
        all_service_map.update(service_group_map)

        self.linkServerAndServices(server_map, all_service_map)

        logger.debug('server map:', server_map.values())

        self.linkVServerAndServers(v_server_map, all_service_map)
        logger.debug('v_server map:', v_server_map.values())

        vector = ObjectStateHolderVector()

        vector.add(self.lbOsh)

        ns_soft_osh = modeling.createApplicationOSH('citrix_netscaler', 'Citrix NetScaler', self.lbOsh, 'Load Balance',
                                                    'Citrix')
        vector.add(ns_soft_osh)

        for v_server in v_server_map.values():
            vServerBuilder = VServerBuilder(v_server, ns_soft_osh)
            vector.addAll(vServerBuilder.build())
            crg_osh = vServerBuilder.getOsh()

            lbcBuilder = LBClusterBuilder(v_server, crg_osh, ns_soft_osh)
            vector.addAll(lbcBuilder.build())
            lbc_osh = lbcBuilder.getOsh()

            for service in v_server.services:
                serviceBuilder = ServiceBuilder(service, lbc_osh)
                vector.addAll(serviceBuilder.build())

        return vector
示例#20
0
    def getTopology(self):
        oshv = ObjectStateHolderVector()
        lb = modeling.createHostOSH(self.hostIp, 'lb')
        f5 = modeling.createApplicationOSH('f5_ltm', 'F5 BIG-IP LTM', lb)
        f5.setAttribute('application_version', self.version)
        oshv.add(lb)
        oshv.add(f5)
        for configFile in self.configFiles:
            oshv.add(modeling.createConfigurationDocumentOshByFile(configFile, f5, modeling.MIME_TEXT_PLAIN))

        for cluster in self.clusters:
            buildClusterOsh(oshv, f5, cluster)

        return oshv
示例#21
0
def makeSiebelgatewayOSH(client, username, enterprise, srvrmgrPath,
                         credentialsId, ip, port, Framework):
    # container host of siebel app
    containerHostOSH = modeling.createHostOSH(ip)

    # siebel gateway application
    gatewayOSH = modeling.createApplicationOSH('siebel_gateway', ip,
                                               containerHostOSH,
                                               'Enterprise App', 'oracle_corp')
    gatewayOSH.setAttribute('site', enterprise)
    gatewayOSH.setAttribute('application_ip', ip)
    gatewayOSH.setAttribute('application_username', username)
    gatewayOSH.setAttribute('srvrmgr_path', srvrmgrPath)
    gatewayOSH.setAttribute('credentials_id', credentialsId)
    if port:
        gatewayOSH.setIntegerAttribute('application_port', port)

    #9.0 workaround
    versionAsDouble = logger.Version().getVersion(Framework)
    if versionAsDouble >= 9:
        gatewayOSH.removeAttribute('data_name')
        gatewayOSH.setAttribute('name', ip)
        modeling.setApplicationProductName(gatewayOSH,
                                           'Siebel Gateway Name Server')

    # get DB (Data Source) Attributes
    cmd = 'list parameter DSConnectString for named subsystem GatewayDataSrc'
    gtwydsconnstrTblTxt = client.executeCmd(
        cmd)  #@@CMD_PERMISION siebel protocol execution
    gtwydsconnstrTbl = siebel_common.makeTable(gtwydsconnstrTblTxt)
    if gtwydsconnstrTbl == None:
        raise 'Failed to execute command: %s ;result %s ' % (
            cmd, gtwydsconnstrTblTxt)
    gtwydsconnstr = gtwydsconnstrTbl[0][0][1]
    gatewayOSH.setAttribute('gtwy_ds_conn_str', gtwydsconnstr)
    logger.debug('DSConnectString:', gtwydsconnstr)

    cmd = 'list parameters DSSQLStyle for named subsystem GatewayDataSrc'
    gtwydstype = getDataSourceType(client, cmd, gatewayOSH)
    if gtwydstype == None:
        cmd = 'list parameters DSSQLStyle for named subsystem ServerDataSrc'
        gtwydstype = getDataSourceType(client, cmd, gatewayOSH)
    if gtwydstype == None:
        cmd = 'list advanced params DSSQLStyle for named subsystem ServerDataSrc'
        gtwydstype = getDataSourceType(client, cmd, gatewayOSH)
    if gtwydstype == None:
        errorMSG = 'Failed to check gateway database type'
        logger.debugException(errorMSG)
        Framework.reportWarning(errorMSG)
    return gatewayOSH
示例#22
0
def DiscoveryMain(Framework):
    ip = Framework.getTriggerCIData('ip_address')
    credentialIds = netutils.getAvailableProtocols(Framework, 'ucs', ip)
    if not credentialIds:
        logger.warn('No generic credential for UCS')
        Framework.reportWarning('No generic credential for UCS')
        return

    ucs_id = Framework.getTriggerCIData('ucs_id')

    originFramework = Framework
    connectionManager = None
    connectedCredentialId = None
    for credentialId in credentialIds:
        logger.debug('Begin trying credential id:', credentialId)
        params = {'credentialsId': credentialId}
        tmpFramework = MyFramework(originFramework, parameters=params)
        manager = FrameworkBasedConnectionDataManager(tmpFramework, ip)
        try:
            client = manager.getClient()
            if client:
                logger.debug("Connected")
                connectionManager = manager
                connectedCredentialId = credentialId
                break
        except:
            logger.debugException('')
            logger.debug('Can not connection by credential:', credentialId)
        finally:
            if connectionManager:
                connectionManager.closeClient()

    if connectionManager:
        logger.debug('Connected by credential Id:', connectedCredentialId)
        vec = ObjectStateHolderVector()
        hostOsh = modeling.createHostOSH(ip)
        appOsh = modeling.createApplicationOSH('running_software', 'UCS', hostOsh, vendor='Cisco')
        appOsh.setAttribute('application_ip', ip)
        appOsh.setAttribute('credentials_id', connectedCredentialId)
        vec.add(hostOsh)
        vec.add(appOsh)
        return vec
    else:
        if ucs_id:
            logger.debug('Delete the ucs since it can not be connected:%s' % ucs_id)
            softwareOsh = modeling.createOshByCmdbId('running_software', ucs_id)
            Framework.deleteObject(softwareOsh)

        logger.warn('All credentials have been tried. No credential can connect to UCS by ip %s' % ip)
        Framework.reportWarning('All credentials have been tried. No credential can connect to UCS by ip %s' % ip)
示例#23
0
 def build(self, parentOsh):
     '''Builds the TNS Listener OSH
     @param parentOsh: root cointainer for the TNS Listener CI
     @return: TNS Listener OSH or None, if one of the prerequisits weren't met.
     '''
     if self.name:
         listenerOsh = modeling.createApplicationOSH('oracle_listener',
                         'TNS Listener', parentOsh, 'Database', 'Oracle')
         if self.name:
             listenerOsh.setStringAttribute('name', self.name)
         self.setApplicationIp(listenerOsh)
         return listenerOsh
     else:
         logger.error('Failed to create Listener OSH. Listener name is not specified.')
示例#24
0
def getAgates(shellUtils, installpath, sapitsOSH, OSHVResult):
    mapInstanceNameToAgate = HashMap()
    filePath = installpath + '\\config\\ItsRegistryWGATE.xml'
    data = shellUtils.safecat(filePath)
    logger.debug('got ItsRegistryWGATE file')
    if data == None or error(data):
        logger.error('Got: [', data, '] when performing command [ safecat ',
                     filePath, '] - terminating script')
    else:
        builder = SAXBuilder(0)
        doc = builder.build(StringReader(data))
        root = doc.getRootElement()
        localWgates = getElementByAttrValue(root, 'key', 'name', 'LocalWgates')
        wgates = localWgates.getChildren()
        it = wgates.iterator()
        while it.hasNext():
            wgate = it.next()
            value = wgate.getAttributeValue('name')
            if value.find('WGATE_') >= 0:
                instancesRoot = getElementByAttrValue(wgate, 'key', 'name', 'Instances')
                instances = instancesRoot.getChildren()
                itInstances = instances.iterator()
                while itInstances.hasNext():
                    instance = itInstances.next()
                    instanceName = instance.getAttributeValue('name')
                    logger.debug(instanceName)
                    agatesRoot = getElementByAttrValue(instance, 'key', 'name', 'Agates')
                    agates = agatesRoot.getChildren()
                    itAgates = agates.iterator()
                    while itAgates.hasNext():
                        agate = itAgates.next()
                        agateHost = getElementByAttrValue(agate, 'value', 'name', 'Host')
                        host = agateHost.getText()
                        agates = mapInstanceNameToAgate.get(instanceName)
                        if agates == None:
                            agates = ArrayList()
                            mapInstanceNameToAgate.put(instanceName, agates)
                        try:
                            ip = netutils.getHostAddress(host)
                            hostOSH = modeling.createHostOSH(ip)
                            OSHVResult.add(hostOSH)

                            agateOSH = modeling.createApplicationOSH('sap_its_agate', 'ITS_AGATE_' + ip, hostOSH)
                            OSHVResult.add(agateOSH)

                            agates.add(agateOSH)
                        except:
                            logger.warn('Failed resolving IP for agate host ', host)
    return mapInstanceNameToAgate
def _reportNonStopTopology(resultCollection, hostOsh, hostIp, catalogUidToSqlMx, catalogUidToMxSchema, sqlmpList):
    for catalogUid, sqlmx in catalogUidToSqlMx.items():
        sqlmxOsh = modeling.createApplicationOSH("nonstop_sql_mx", sqlmx.data_name, hostOsh, "Database", sqlmx.vendor)
        sqlmxOsh.setStringAttribute("database_dbsid", sqlmx.database_dbsid)
        sqlmxOsh.setStringAttribute("database_dbversion", sqlmx.version)
        sqlmxOsh.setStringAttribute("application_version", sqlmx.version)
        sqlmxOsh.setStringAttribute("catalog_uuid", sqlmx.catalog_uuid)

        resultCollection.add(sqlmxOsh)

        sqlmxSchemaNames = catalogUidToMxSchema.get(catalogUid)
        if sqlmxSchemaNames:
            for sqlmxSchemaName in sqlmxSchemaNames:
                sqlmxSchemaOsh = ObjectStateHolder("database_instance")
                sqlmxSchemaOsh.setStringAttribute("data_name", sqlmxSchemaName)
                sqlmxSchemaOsh.setContainer(sqlmxOsh)
                resultCollection.add(sqlmxSchemaOsh)

    for sqlmp in sqlmpList:
        sqlmpOsh = modeling.createApplicationOSH("database", sqlmp.data_name, hostOsh, "Database", sqlmp.vendor)
        sqlmpOsh.setStringAttribute("database_dbsid", sqlmp.database_dbsid)
        sqlmpOsh.setStringAttribute("database_dbversion", sqlmp.version)
        sqlmpOsh.setStringAttribute("application_version", sqlmp.version)
        resultCollection.add(sqlmpOsh)
示例#26
0
def createGatewayOsh(ip, port, resultsVector, framework):

	gatewayHostOsh = modeling.createHostOSH(ip)
	resultsVector.add(gatewayHostOsh)

	gatewayOsh = modeling.createApplicationOSH('siebel_gateway', ip, gatewayHostOsh, vendor = 'oracle_corp')
	gatewayOsh.setAttribute('application_port', int(port))

	#9.0 workaround
	versionAsDouble = logger.Version().getVersion(framework)
	if versionAsDouble >= 9:
		gatewayOsh.removeAttribute('data_name')
		gatewayOsh.setAttribute('name', ip)
		modeling.setApplicationProductName(gatewayOsh, 'Siebel Gateway Name Server')

	return gatewayOsh
示例#27
0
    def getTopology(self):
        oshv = ObjectStateHolderVector()
        lb = modeling.createHostOSH(self.hostIp, 'lb')
        f5 = modeling.createApplicationOSH('f5_ltm', 'F5 BIG-IP LTM', lb)
        f5.setAttribute('application_version', self.version)
        oshv.add(lb)
        oshv.add(f5)
        for configFile in self.configFiles:
            oshv.add(
                modeling.createConfigurationDocumentOshByFile(
                    configFile, f5, modeling.MIME_TEXT_PLAIN))

        for cluster in self.clusters:
            buildClusterOsh(oshv, f5, cluster)

        return oshv
示例#28
0
 def build(self, parentOsh):
     '''Builds the TNS Listener OSH
     @param parentOsh: root cointainer for the TNS Listener CI
     @return: TNS Listener OSH or None, if one of the prerequisits weren't met.
     '''
     if self.name:
         listenerOsh = modeling.createApplicationOSH(
             'oracle_listener', 'TNS Listener', parentOsh, 'Database',
             'Oracle')
         if self.name:
             listenerOsh.setStringAttribute('name', self.name)
         self.setApplicationIp(listenerOsh)
         return listenerOsh
     else:
         logger.error(
             'Failed to create Listener OSH. Listener name is not specified.'
         )
示例#29
0
def createOAMOsh(endpoint, apacheOsh, vector):
    """
    Create OAM osh on oam endpoint, oam node & client server relation
    """
    logger.debug('submit OAM endpoint: %s' % endpoint)
    builder = netutils.ServiceEndpointBuilder()
    reporter = netutils.EndpointReporter(builder)
    nodeOsh = reporter.reportHostFromEndpoint(endpoint)
    endpointOsh = reporter.reportEndpoint(endpoint, nodeOsh)
    linkOsh = modeling.createLinkOSH('client_server', apacheOsh, endpointOsh)
    linkOsh.setStringAttribute('clientserver_protocol', 'tcp')
    oamServerOsh = modeling.createApplicationOSH('running_software', 'Oracle Access Management', nodeOsh, None, 'oracle_corp')
    usageOsh = modeling.createLinkOSH('usage', oamServerOsh, endpointOsh)
    vector.add(nodeOsh)
    vector.add(endpointOsh)
    vector.add(linkOsh)
    vector.add(oamServerOsh)
    vector.add(usageOsh)
def makeSiebelgatewayOSH(client, username, enterprise, srvrmgrPath, credentialsId, ip, port, Framework):
	# container host of siebel app
	containerHostOSH = modeling.createHostOSH(ip)

	# siebel gateway application
	gatewayOSH = modeling.createApplicationOSH('siebel_gateway', ip, containerHostOSH, 'Enterprise App', 'oracle_corp')
	gatewayOSH.setAttribute('site', enterprise)
	gatewayOSH.setAttribute('application_ip', ip)
	gatewayOSH.setAttribute('application_username', username)
	gatewayOSH.setAttribute('srvrmgr_path', srvrmgrPath)
	gatewayOSH.setAttribute('credentials_id',credentialsId)
	if port:
		gatewayOSH.setIntegerAttribute('application_port', port)

	#9.0 workaround
	versionAsDouble = logger.Version().getVersion(Framework)
	if versionAsDouble >= 9:
		gatewayOSH.removeAttribute('data_name')
		gatewayOSH.setAttribute('name', ip)
		modeling.setApplicationProductName(gatewayOSH, 'Siebel Gateway Name Server')

	# get DB (Data Source) Attributes
	cmd = 'list parameter DSConnectString for named subsystem GatewayDataSrc'
	gtwydsconnstrTblTxt = client.executeCmd(cmd)#@@CMD_PERMISION siebel protocol execution
	gtwydsconnstrTbl = siebel_common.makeTable(gtwydsconnstrTblTxt)
	if gtwydsconnstrTbl == None:
		raise 'Failed to execute command: %s ;result %s ' % (cmd,gtwydsconnstrTblTxt)
	gtwydsconnstr = gtwydsconnstrTbl[0][0][1]
	gatewayOSH.setAttribute('gtwy_ds_conn_str', gtwydsconnstr)
	logger.debug('DSConnectString:', gtwydsconnstr)

	cmd = 'list parameters DSSQLStyle for named subsystem GatewayDataSrc'
	gtwydstype = getDataSourceType(client, cmd, gatewayOSH)
	if gtwydstype == None:
		cmd = 'list parameters DSSQLStyle for named subsystem ServerDataSrc'
		gtwydstype = getDataSourceType(client, cmd, gatewayOSH)
	if gtwydstype == None:
		cmd = 'list advanced params DSSQLStyle for named subsystem ServerDataSrc'
		gtwydstype = getDataSourceType(client, cmd, gatewayOSH)
	if gtwydstype == None:
		errorMSG = 'Failed to check gateway database type'
		logger.debugException(errorMSG)
		Framework.reportWarning(errorMSG)
	return gatewayOSH
示例#31
0
def createGatewayOsh(ip, port, resultsVector, framework):

    gatewayHostOsh = modeling.createHostOSH(ip)
    resultsVector.add(gatewayHostOsh)

    gatewayOsh = modeling.createApplicationOSH('siebel_gateway',
                                               ip,
                                               gatewayHostOsh,
                                               vendor='oracle_corp')
    gatewayOsh.setAttribute('application_port', int(port))

    #9.0 workaround
    versionAsDouble = logger.Version().getVersion(framework)
    if versionAsDouble >= 9:
        gatewayOsh.removeAttribute('data_name')
        gatewayOsh.setAttribute('name', ip)
        modeling.setApplicationProductName(gatewayOsh,
                                           'Siebel Gateway Name Server')

    return gatewayOsh
示例#32
0
def createOAMOsh(endpoint, apacheOsh, vector):
    """
    Create OAM osh on oam endpoint, oam node & client server relation
    """
    logger.debug('submit OAM endpoint: %s' % endpoint)
    builder = netutils.ServiceEndpointBuilder()
    reporter = netutils.EndpointReporter(builder)
    nodeOsh = reporter.reportHostFromEndpoint(endpoint)
    endpointOsh = reporter.reportEndpoint(endpoint, nodeOsh)
    linkOsh = modeling.createLinkOSH('client_server', apacheOsh, endpointOsh)
    linkOsh.setStringAttribute('clientserver_protocol', 'tcp')
    oamServerOsh = modeling.createApplicationOSH('running_software',
                                                 'Oracle Access Management',
                                                 nodeOsh, None, 'oracle_corp')
    usageOsh = modeling.createLinkOSH('usage', oamServerOsh, endpointOsh)
    vector.add(nodeOsh)
    vector.add(endpointOsh)
    vector.add(linkOsh)
    vector.add(oamServerOsh)
    vector.add(usageOsh)
 def createOsh(self, serverDto, containerOsh, functionality=None):
     citName = 'domaincontroller'
     name = "DomainController"
     osh = modeling.createApplicationOSH(citName, name, containerOsh, CATEGORY, VENDOR)
     modeling.setApplicationProductName(osh, 'domain_controller')
     #osh.setAttribute('domainname', serverDto.name)
     if serverDto.credentialId:
         osh.setAttribute('credentials_id', serverDto.credentialId)
     if serverDto.ipAddress:
         osh.setAttribute('application_ip', serverDto.ipAddress)
     if serverDto.port:
         osh.setIntegerAttribute('application_port', serverDto.port)
     if serverDto.username:
         osh.setAttribute('application_username', serverDto.username)
     if serverDto.fullVersion:
         osh.setAttribute('application_version', serverDto.fullVersion)
     if functionality and str(functionality).isdigit():
         osh.setAttribute('domaincontroller_functionality', int(functionality))
     if serverDto.siteName:
         osh.setAttribute('sitename', serverDto.siteName)
     return osh
示例#34
0
def createFsmSoftware(fsmSoftware, hostOsh):
    """
    Creates the Object State Holder of the IBM FSM Management Sortware
    @param fsmSoftware: the discovered IBM FSM
    @type fsmSoftware: instance of the IbmFsm Data Object
    @param hostOsh: host the FSM is running on
    @type hostOsh:  Object State Holder of the Host CI or any of its children
    @return: Object State Holder of the IBM FSM Management Sortware
    """
    if fsmSoftware:
        fsmOsh = modeling.createApplicationOSH('ibm_fsm', fsmSoftware.name, hostOsh, 'virtualization', 'ibm_corp')
#        if fsmSoftware.bios:
#            fsmOsh.setStringAttribute("fsm_bios", fsmSoftware.bios)
        if fsmSoftware.typeInformation.serialNum:
            fsmOsh.setStringAttribute("fsm_serial_number", fsmSoftware.typeInformation.serialNum)
        if fsmSoftware.typeInformation.fsmType:
            fsmOsh.setStringAttribute("fsm_type", fsmSoftware.typeInformation.fsmType)
        if fsmSoftware.versionInformation.shortVersion:
            fsmOsh.setStringAttribute("application_version_number", fsmSoftware.versionInformation.shortVersion)
        if fsmSoftware.versionInformation.fullVersion:
            fsmOsh.setStringAttribute("application_version", fsmSoftware.versionInformation.fullVersion)
        return fsmOsh
示例#35
0
def addApplicationCI(ip, hostOsh, serviceProduct,serviceVersion, OSHVResult):
    if serviceProduct:
        softwareName = None
        serviceProduct = serviceProduct.lower()
        patterns = SOFTWARE_NAMES_DICT.keys()
        patterns.sort()
        patterns.reverse()
        for pattern in patterns:
            if re.search(pattern, serviceProduct):
                softwareName = SOFTWARE_NAMES_DICT[pattern]
                break
        else:
            return

        applicationOSH = modeling.createApplicationOSH('application', softwareName, hostOsh)

        applicationOSH.setAttribute('application_ip', ip)

        if serviceVersion:
            applicationOSH.setAttribute('application_version', serviceVersion)

        OSHVResult.add(applicationOSH)
示例#36
0
def addApplicationCI(ip, hostOsh, serviceProduct, serviceVersion, OSHVResult):
    if serviceProduct:
        softwareName = None
        serviceProduct = serviceProduct.lower()
        patterns = SOFTWARE_NAMES_DICT.keys()
        patterns.sort()
        patterns.reverse()
        for pattern in patterns:
            if re.search(pattern, serviceProduct):
                softwareName = SOFTWARE_NAMES_DICT[pattern]
                break
        else:
            return

        applicationOSH = modeling.createApplicationOSH('application',
                                                       softwareName, hostOsh)

        applicationOSH.setAttribute('application_ip', ip)

        if serviceVersion:
            applicationOSH.setAttribute('application_version', serviceVersion)

        OSHVResult.add(applicationOSH)
示例#37
0
 def createOsh(self, serverDto, containerOsh, functionality=None):
     citName = 'domaincontroller'
     name = "DomainController"
     osh = modeling.createApplicationOSH(citName, name, containerOsh,
                                         CATEGORY, VENDOR)
     modeling.setApplicationProductName(osh, 'domain_controller')
     #osh.setAttribute('domainname', serverDto.name)
     if serverDto.credentialId:
         osh.setAttribute('credentials_id', serverDto.credentialId)
     if serverDto.ipAddress:
         osh.setAttribute('application_ip', serverDto.ipAddress)
     if serverDto.port:
         osh.setIntegerAttribute('application_port', serverDto.port)
     if serverDto.username:
         osh.setAttribute('application_username', serverDto.username)
     if serverDto.fullVersion:
         osh.setAttribute('application_version', serverDto.fullVersion)
     if functionality and str(functionality).isdigit():
         osh.setAttribute('domaincontroller_functionality',
                          int(functionality))
     if serverDto.siteName:
         osh.setAttribute('sitename', serverDto.siteName)
     return osh
示例#38
0
    def _buildFarmMembers(self):
        """
        Builds topology elements related to the farm member.
        The are: nt, application, configfile
        ->None
        """
        for farmMember in self._farmMembers:
            farmMember.hostOsh = modeling.createHostOSH(farmMember.ip, 'nt')
            sharepointOsh = modeling.createApplicationOSH('application', self.APPLICATION_NAME, farmMember.hostOsh)
            if self._farm.version:
                versionShort = self._farm.version[:2]
                if versionShort == '12':
                    versionDescription = 'Microsoft SharePoint 2007'
                elif versionShort == '14':
                    versionDescription = 'Microsoft SharePoint Server 2010'
                else:
                    versionDescription = self._farm.version

                sharepointOsh.setAttribute('application_version_number', self._farm.version)
                sharepointOsh.setAttribute('application_version', versionDescription)
            for service in farmMember.serviceConfigs:
                service.osh = self._createSpServiceOsh(service.name, service.configString, sharepointOsh)
                
            self._hostNameToSharepointOsh[farmMember.hostName] = sharepointOsh
示例#39
0
 def createVcloudDirectorOsh(self, hostOsh):
     vcloudDirectorOsh = modeling.createApplicationOSH(
         'vmware_vcloud_director', "VMware vCloud Director", hostOsh,
         "Virtualization")
     return vcloudDirectorOsh
def makeAppServer(client, username, enterprise, serverObj, serverDataRow, siteOSH, Framework, OSHVResult):
	# init return value

	logger.debug('server:', string.join(serverObj), ' dataRow:', serverDataRow)
	datalist = serverObj
	sblsvrName = datalist[0]
	logger.debug('sblsvrName:', sblsvrName)
	hostName = datalist[1]
	installDir = datalist[2]
	sblmgrPID = datalist[3]
	serverID = datalist[9]
	# if no PID, server is not running. send an event on it
	# the message of the event will be everything that follows
	# the PID field
	if string.strip(sblmgrPID) == '':
		logger.debug('problem server:', serverDataRow)
		runningServer = 0
		logger.debug('app server', sblsvrName, ' is not Running')
	else:
		runningServer = 1
		# called status, but actually version details
		status = datalist[8]
		logger.debug('status:', status)
		versionTokens = status.split()
		version = versionTokens[0]
		build = versionTokens[1]
		lang = versionTokens[2]

	# host
	logger.debug('building host:', hostName)
	try:
		ip = netutils.getHostAddress(hostName)
		logger.debug('found ip:', ip, ' for hostName:', hostName)
		if ip == None:
			return None
		if netutils.isLocalIp(ip):
			logger.debug('got loopback ip, probably error.')
			return None
		appServerHostOSH = modeling.createHostOSH(ip)
	except:
		logger.errorException('failed to convert host name:', hostName, ' to IP')
		return None

	# siebel application server
	appServerOSH = modeling.createApplicationOSH('siebel_app_server', sblsvrName, appServerHostOSH, 'Enterprise App', 'oracle_corp')
	appServerOSH.setAttribute('application_ip', ip)
	appServerOSH.setAttribute('application_username', username)
	appServerOSH.setAttribute('install_dir', installDir)
	appServerOSH.setAttribute('svr_id',serverID)

	modeling.setAppServerType(appServerOSH)

	#9.0 workaround
	versionAsDouble = logger.Version().getVersion(Framework)
	if versionAsDouble >= 9:
		appServerOSH.removeAttribute('data_name')
		appServerOSH.setAttribute('name', sblsvrName)
		modeling.setApplicationProductName(appServerOSH, 'Siebel Server')

	OSHVResult.add(appServerHostOSH)
	OSHVResult.add(appServerOSH)

	if runningServer:
		appServerOSH.setAttribute('version', version)
		appServerOSH.setAttribute('application_version', version)
		appServerOSH.setAttribute('build', build)
		appServerOSH.setAttribute('lang', lang)

		# NOTE: setting the current app server so that all info will be only
		# for it
		prompt = client.executeCmd(string.join(['set server ', sblsvrName]), 5000)#@@CMD_PERMISION siebel protocol execution
		logger.debug(prompt)

		# get component groups (and components for each group) for this server
		# NOTE: as far as we know there can't be components that are not under a group
		# if such a situation can exist we won't find such 'leaf' components
		# with the current code

		#
		#
		makeComponentGroups(client, appServerOSH, ip, OSHVResult, enterprise, siteOSH)

		if version[0] == '7' or version[0] == '8':
			# get DB (Data Source) Attributes
			# table[0][0][1] means:
			# [0] - first row (should be only one, we are inside a server context)
			# [0] - first column: the parsed fields (second column is original row for error purposes)
			# [1] - second value in the parsed fields
			try:
				svrdsconnstrTblTxt = client.executeCmd('list parameter DSConnectString for named subsystem ServerDataSrc')#@@CMD_PERMISION siebel protocol execution
				svrdsconnstrTbl = siebel_common.makeTable(svrdsconnstrTblTxt)
				svrdsconnstr = string.upper(svrdsconnstrTbl[0][0][1])
				logger.debug('svrdsconnstr:', svrdsconnstr)
				appServerOSH.setAttribute('srv_ds_conn_str', svrdsconnstr)
			except:
				error_message = 'failed to get DSConnectString (to set attribute srv_ds_conn_str) on server'
				logger.debug(error_message)
				Framework.reportWarning(error_message)
			try:
				svrdstypeTblTxt = client.executeCmd('list parameters DSSQLStyle for named subsystem ServerDataSrc')#@@CMD_PERMISION siebel protocol execution
				svrdstypeTbl = siebel_common.makeTable(svrdstypeTblTxt)
				if svrdstypeTbl:
					svrdstype = svrdstypeTbl[0][0][1]
				else:
					svrdstypeTblTxt = client.executeCmd('list parameters DSDLLName for named subsystem ServerDataSrc')#@@CMD_PERMISION siebel protocol execution
					svrdstypeTbl = siebel_common.makeTable(svrdstypeTblTxt)
					svrdstype = DLL_TO_SQL_TYPE_MAP[svrdstypeTbl[0][0][1]]

				logger.debug('svrdstype:', svrdstype)
				appServerOSH.setAttribute('svr_ds_type', svrdstype)
			except:
				error_message = 'failed to get DSSQLStyle (to set attribute svr_ds_type) on server'
				logger.debugException(error_message)
				Framework.reportWarning(error_message)


			serverType = getSiebelServerType(client)
			if serverType:
				appServerOSH.setStringAttribute('data_description', serverType)
			else:
				logger.warn("Cannot determine the type of server '%s', no required components were found" % sblsvrName)

		if version[0] == '6':
			# in Siebel 2000 (tested with 6.3), we can't obtain some of the parameters using command line API
			# get missing attributes from configuration file
			logger.info('Datasource parameters are not supported in version ', version)
			logger.info('Please run SIEBEL_DIS_APP_SERVER_CONFIG pattern to get server datasource attributes')

		try:
			odbcDSNTblTxt = client.executeCmd('list param connect')#@@CMD_PERMISION siebel protocol execution
			odbcDSNTbl = siebel_common.makeTable(odbcDSNTblTxt)
			odbcDSN = odbcDSNTbl[0][0][1]
			logger.debug('odbcDSN:', odbcDSN)
			appServerOSH.setAttribute('odbc_dsn', odbcDSN)
		except:
			error_message = 'failed to get ODBC DSN (connect param (to set attribute odbc_dsn) on server'
			logger.debug(error_message)
			Framework.reportWarning(error_message)

		# NOTE: unsetting the current app server
		prompt = client.executeCmd('unset server', 3000)#@@CMD_PERMISION siebel protocol execution
		logger.debug(prompt)

	return appServerOSH
示例#41
0
	def build(self):
		self.hostOsh = modeling.createHostOSH(self.serverIp)
		self.msmqManagerOsh = modeling.createApplicationOSH('msmqmanager', 'Microsoft MQ Manager', self.hostOsh)
示例#42
0
	except:
		exInfo = logger.prepareJythonStackTrace('')
		errormessages.resolveAndReport(exInfo, resolveProtocol(shellUtils, Framework), Framework)
	else:
		protocolName = resolveProtocol(shellUtils, Framework)
		try:
			applicationName = Framework.getDestinationAttribute('application_name')
			cf = Framework.getConfigFile(CollectorsParameters.KEY_COLLECTORS_SERVERDATA_APPLICATIONSIGNATURE)
			paths = cf.getConfigFilesForApplication(applicationName)
			if len(paths) > 0:
				hostId = Framework.getDestinationAttribute('hostId')
				fileMonitor = file_mon_utils.FileMonitor(Framework, shellUtils, OSHVResult, None, hostId)
				hostOSH = modeling.createOshByCmdbIdString('host',hostId)
				fileMonitor.getFilesByPath(hostOSH, paths)
				if OSHVResult.size() > 0:
					applicationOsh = modeling.createApplicationOSH('application', applicationName, hostOSH)

					resultSize = OSHVResult.size()
					for i in range(0, resultSize):
						aplicationCF = OSHVResult.get(i)
						#we suppose that all OSHs are of 'configfile' type
						#may be we should check class type of each OSH
						link = modeling.createLinkOSH('use', applicationOsh, aplicationCF)
						OSHVResult.add(link)
		except Exception, ex:
			exInfo = ex.getMessage()
			errormessages.resolveAndReport(exInfo, protocolName, Framework)
		except:
			exInfo = logger.prepareJythonStackTrace('')
			errormessages.resolveAndReport(exInfo, protocolName, Framework)
		if shellUtils is not None:
示例#43
0
 def getTopology(self, ipAddress):
     lb = modeling.createHostOSH(ipAddress, 'host')
     a10_vthunder = modeling.createApplicationOSH('a10_vthunder', 'A10_vThunder', lb, 'Load Balance', 'A10_Networks')
     self.OSHVResult.add(lb)
     self.OSHVResult.add(a10_vthunder)
     self.discoverA10_vthunder(a10_vthunder)
示例#44
0
def parseOpmnXml(opmnXML, HOST_IP, ORACLE_HOME, MANAGER_PORT, shellUtils, OSHVResult, Framework):

    builder = SAXBuilder(0)
    doc = builder.build(StringReader(opmnXML))
    root = doc.getRootElement()
    
    ucmdbVersion = modeling.CmdbClassModel().version()
    
    processManager = root.getChildren()
    
    processManagerIterator = processManager.iterator()
    while processManagerIterator.hasNext():
        currProcessManager = processManagerIterator.next()
        currElementName = currProcessManager.getName()
        
        if currElementName == 'process-manager':
            
            iasInstance = currProcessManager.getChildren()
            
            iasInstanceIterator = iasInstance.iterator()
            while iasInstanceIterator.hasNext():
                currIasInstance = iasInstanceIterator.next()
                
                if currIasInstance.getName() == 'ias-instance':

                    OracleApplicationServerName = currIasInstance.getAttributeValue('name') or currIasInstance.getAttributeValue('id') or 'Default Server'


                    discoveredHost = modeling.createHostOSH(HOST_IP)
                    
                    # Create Oracle IAS
                    oracleIASOSH = modeling.createJ2EEServer('oracleias', HOST_IP, int(MANAGER_PORT), discoveredHost, OracleApplicationServerName)
                    OSHVResult.add(oracleIASOSH)

                    iasComponent = currIasInstance.getChildren()
                    iasComponentIterator = iasComponent.iterator()
                    while iasComponentIterator.hasNext(): 
                        currIasComponent = iasComponentIterator.next()
                        if 'ias-component' == currIasComponent.getName(): 

                            groupName = currIasComponent.getAttributeValue('id')
                            
                            # Create OC4J Group
                            oc4jGroupOSH = ObjectStateHolder('oc4jgroup')
                            oc4jGroupOSH.setContainer(oracleIASOSH)
                            oc4jGroupOSH.setAttribute('data_name', groupName)
                            OSHVResult.add(oc4jGroupOSH)
                            
                            #'process-type'
                            processType = currIasComponent.getChildren()
                            processTypeIterator = processType.iterator()
                            while processTypeIterator.hasNext():
                                currProcessType = processTypeIterator.next()
                                
                                oc4jName = currProcessType.getAttributeValue('id')
                                moduleId = currProcessType.getAttributeValue('module-id')

                                if 'OC4J' == moduleId:
                                    
                                    oc4jOSH = ObjectStateHolder('oc4j')
                                    oc4jOSH.setContainer(oc4jGroupOSH)
                                    oc4jOSH.setAttribute('data_name', oc4jName)
                                    OSHVResult.add(oc4jOSH)
                                    
                                    try:
                                        serverXML = shellUtils.safecat('%s/j2ee/%s/config/server.xml' % (ORACLE_HOME, oc4jName))

                                        tg = '<application name="(\w+)"'
                                        compiled = re.compile(tg,re.S)
                                        matches = compiled.findall(serverXML)

                                        appList = {}
                                        for match in matches:
                                            if ucmdbVersion < 9:
                                                applicationOSH = modeling.createApplicationOSH('application', match, oc4jOSH)
                                            else:
                                                applicationOSH = ObjectStateHolder('oc4j_app')
                                                applicationOSH.setAttribute('data_name',match)
                                                applicationOSH.setContainer(oc4jOSH)
                                            #
                                            OSHVResult.add(applicationOSH)
                                            
                                            appList[match] = applicationOSH
                                        
                                    except:
                                        logger.debugException()
                                        logger.warn('Failed to get server.xml')
                                        
                                    # Check if it holds web service
                                    wsdlDir = shellUtils.rebuildPath('%s/j2ee/%s/application-deployments/' % (ORACLE_HOME, OracleApplicationServerName))
                                    fileMon = file_mon_utils.FileMonitor(Framework, shellUtils, OSHVResult, None, None)
                                    files = fileMon.getFilesInPath(wsdlDir, '*.wsdl')
                                    if (files == []):
                                        wsdlDir = shellUtils.rebuildPath('%s/j2ee/%s/application-deployments/' % (ORACLE_HOME, oc4jName))
                                        logger.info('Pi Debug - parseOpmnXml() - trying with wsdlDir = %s' % wsdlDir)
                                        files = fileMon.getFilesInPath(wsdlDir, '*.wsdl')
                                    wsdlDirRes = '\n'.join(files)
                                    if wsdlDirRes.find('File Not Found') != -1:
                                        # NO WSDL
                                        continue
                                    else:
                                        # WSDL
                                        handleWSDL(HOST_IP, MANAGER_PORT, wsdlDirRes, wsdlDir, appList, shellUtils, OSHVResult)
示例#45
0
 def createConsolidatorForHost(self, dataName, hostOsh):
     return modeling.createApplicationOSH("application", dataName, hostOsh, CATEGORY, VENDOR)
示例#46
0
 def createConsolidatorForHost(self, dataName, hostOsh):
     return modeling.createApplicationOSH("application", dataName, hostOsh,
                                          CATEGORY, VENDOR)
示例#47
0
 def discoverAlteon(self, hostOsh):
     alteon = modeling.createApplicationOSH('alteon_app_switch', 'Alteon application switch', hostOsh)
     self.OSHVResult.add(alteon)
     
     self.discoverVirtualServers(alteon)
    def discoverAlteon(self, hostOsh):
        alteon = modeling.createApplicationOSH("alteon_app_switch", "Alteon application switch", hostOsh)
        self.OSHVResult.add(alteon)

        self.discoverVirtualServers(alteon)
示例#49
0
    except:
        exInfo = logger.prepareJythonStackTrace("")
        errormessages.resolveAndReport(exInfo, resolveProtocol(shellUtils, Framework), Framework)
    else:
        protocolName = resolveProtocol(shellUtils, Framework)
        try:
            applicationName = Framework.getDestinationAttribute("application_name")
            cf = Framework.getConfigFile(CollectorsParameters.KEY_COLLECTORS_SERVERDATA_APPLICATIONSIGNATURE)
            paths = cf.getConfigFilesForApplication(applicationName)
            if len(paths) > 0:
                hostId = Framework.getDestinationAttribute("hostId")
                fileMonitor = file_mon_utils.FileMonitor(Framework, shellUtils, OSHVResult, None, hostId)
                hostOSH = modeling.createOshByCmdbIdString("host", hostId)
                fileMonitor.getFilesByPath(hostOSH, paths)
                if OSHVResult.size() > 0:
                    applicationOsh = modeling.createApplicationOSH("application", applicationName, hostOSH)

                    resultSize = OSHVResult.size()
                    for i in range(0, resultSize):
                        aplicationCF = OSHVResult.get(i)
                        # we suppose that all OSHs are of 'configfile' type
                        # may be we should check class type of each OSH
                        link = modeling.createLinkOSH("use", applicationOsh, aplicationCF)
                        OSHVResult.add(link)
        except Exception, ex:
            exInfo = ex.getMessage()
            errormessages.resolveAndReport(exInfo, protocolName, Framework)
        except:
            exInfo = logger.prepareJythonStackTrace("")
            errormessages.resolveAndReport(exInfo, protocolName, Framework)
        if shellUtils is not None:
def createWeakListener(hostOsh):
    osh = modeling.createApplicationOSH("application", "TNS Listener", hostOsh, "Database", "Oracle")
    return osh
示例#51
0
 def _buildRunningSoftware(self, node):
     osh = modeling.createApplicationOSH('running_software', None, node.hostOsh)
     osh.setStringAttribute('application_ip', node.ip)
     osh.setIntegerAttribute('application_port', node.port)
     return osh
示例#52
0
 def createVcloudDirectorOsh(self, hostOsh):
     vcloudDirectorOsh = modeling.createApplicationOSH('vmware_vcloud_director', "VMware vCloud Director", hostOsh, "Virtualization")
     return vcloudDirectorOsh
示例#53
0
def _reportAnonymouseGateway(containerOsh):
    '@types: osh -> osh'
    osh = modeling.createApplicationOSH('sap_gateway', None, containerOsh, None, 'sap_ag')
    osh.setStringAttribute('discovered_product_name', 'SAP Gateway')
    return osh