コード例 #1
0
    def discover(self, firstSuccessful=True):
        '''
        bool -> None
        @raise ValueError in case no connection configurations were initialized
        Perform discovery of connections
        '''

        if not self.contextsMap:
            raise NoConnectionConfigurationsException(
                "No connection configurations were found")

        vmwareNamespaces = [ns for ns in self.vmwareCategory.getNamespaces()]
        vmwareNamespacesCount = len(vmwareNamespaces)

        for contextsByCredentialsMap in self.contextsMap.itervalues():

            for contextList in contextsByCredentialsMap.itervalues():

                for context in contextList:

                    successfulNamespaces = []
                    for namespace in vmwareNamespaces:

                        try:
                            cim_discover.testConnectionWithNamespace(
                                self.framework, context.ipAddress,
                                context.credentialId, namespace)
                            # no exception, connection successful
                            successfulNamespaces.append(namespace)

                        except JException, ex:
                            msg = ex.getMessage()
                            msg = cim_discover.translateErrorMessage(msg)
                            logger.debug(msg)
                            errormessages.resolveAndAddToCollections(
                                msg, cim.Protocol.DISPLAY, context.warnings,
                                context.errors)
                            self.connectionHandler.onFailure(context)
                            break

                        except:
                            msg = logger.prepareJythonStackTrace('')
                            logger.debug(msg)
                            errormessages.resolveAndAddToCollections(
                                msg, cim.Protocol.DISPLAY, context.warnings,
                                context.errors)
                            self.connectionHandler.onFailure(context)
                            break
コード例 #2
0
    def discover(self, firstSuccessful=True):
        '''
        bool -> None
        @raise ValueError in case no connection configurations were initialized
        Perform discovery of connections
        '''
        
        if not self.contextsMap:
            raise NoConnectionConfigurationsException("No connection configurations were found")
        
        vmwareNamespaces = [ns for ns in self.vmwareCategory.getNamespaces()]
        vmwareNamespacesCount = len(vmwareNamespaces)
        
        for contextsByCredentialsMap in self.contextsMap.itervalues():
            
            for contextList in contextsByCredentialsMap.itervalues():
                
                for context in contextList:

                    successfulNamespaces = []
                    for namespace in vmwareNamespaces:
                    
                        try:
                            cim_discover.testConnectionWithNamespace(self.framework, context.ipAddress, context.credentialId, namespace)
                            # no exception, connection successful
                            successfulNamespaces.append(namespace)
                            
                        except JException, ex:
                            msg = ex.getMessage()
                            msg = cim_discover.translateErrorMessage(msg)
                            logger.debug(msg)
                            errormessages.resolveAndAddToCollections(msg, cim.Protocol.DISPLAY, context.warnings, context.errors)
                            self.connectionHandler.onFailure(context)
                            break
                        
                        except:
                            msg = logger.prepareJythonStackTrace('')
                            logger.debug(msg)
                            errormessages.resolveAndAddToCollections(msg, cim.Protocol.DISPLAY, context.warnings, context.errors)
                            self.connectionHandler.onFailure(context)
                            break
コード例 #3
0
ファイル: smis_connection.py プロジェクト: deezeesms/dd-git
def DiscoveryMain(Framework):
    warningsList = []
    errorsList = []
    vector = ObjectStateHolderVector()
    ip_address = Framework.getDestinationAttribute('ip_address')
    ip_domain = Framework.getDestinationAttribute('ip_domain')
    protocolName = cim.Protocol.DISPLAY

    credentials = netutils.getAvailableProtocols(Framework, cim.Protocol.FULL,
                                                 ip_address, ip_domain)
    credentials = smis_discoverer.getSmisCredentials(credentials, Framework)
    if len(credentials) == 0:
        msg = errormessages.makeErrorMessage(
            protocolName, pattern=errormessages.ERROR_NO_CREDENTIALS)
        errobj = errorobject.createError(
            errorcodes.NO_CREDENTIALS_FOR_TRIGGERED_IP, [protocolName], msg)
        warningsList.append(errobj)
        logger.debug(msg)

    smisNamespaces = smis_discoverer.getSmisNamespaces(Framework)
    if not smisNamespaces:
        msg = errormessages.makeErrorMessage(protocolName,
                                             "No SMI-S namespaces found")
        errobj = errorobject.createError(
            errorcodes.INTERNAL_ERROR_WITH_PROTOCOL_DETAILS,
            [cim.Protocol.DISPLAY, msg], msg)
        errorsList.append(errobj)
        logger.reportErrorObject(errobj)
        return vector

    for credential in credentials:
        testedNamespace = None
        for namespaceObject in smisNamespaces:
            try:

                testedNamespace = cim_discover.testConnectionWithNamespace(
                    Framework, ip_address, credential, namespaceObject)
                break
            except JException, ex:
                msg = ex.getMessage()
                msg = cim_discover.translateErrorMessage(msg)
                errormessages.resolveAndAddToObjectsCollections(
                    msg, protocolName, warningsList, errorsList)
            except:
コード例 #4
0
ファイル: smis_connection.py プロジェクト: ddonnelly19/dd-git
def DiscoveryMain(Framework):
    warningsList = []
    errorsList = []
    vector = ObjectStateHolderVector()
    ip_address = Framework.getDestinationAttribute('ip_address')
    ip_domain = Framework.getDestinationAttribute('ip_domain')
    protocolName = cim.Protocol.DISPLAY
    
    credentials = netutils.getAvailableProtocols(Framework, cim.Protocol.FULL, ip_address, ip_domain)
    credentials = smis_discoverer.getSmisCredentials(credentials, Framework)
    if len(credentials) == 0:
        msg = errormessages.makeErrorMessage(protocolName, pattern=errormessages.ERROR_NO_CREDENTIALS)
        errobj = errorobject.createError(errorcodes.NO_CREDENTIALS_FOR_TRIGGERED_IP, [protocolName], msg)
        warningsList.append(errobj)
        logger.debug(msg)
    
    smisNamespaces = smis_discoverer.getSmisNamespaces(Framework)
    if not smisNamespaces:
        msg = errormessages.makeErrorMessage(protocolName, "No SMI-S namespaces found")
        errobj = errorobject.createError(errorcodes.INTERNAL_ERROR_WITH_PROTOCOL_DETAILS, [cim.Protocol.DISPLAY, msg], msg)
        errorsList.append(errobj)
        logger.reportErrorObject(errobj)
        return vector
    
    for credential in credentials:
        testedNamespace = None
        for namespaceObject in smisNamespaces:
            try:
    
                testedNamespace = cim_discover.testConnectionWithNamespace(Framework, ip_address, credential, namespaceObject)
                break
            except JException, ex:
                msg = ex.getMessage()
                msg = cim_discover.translateErrorMessage(msg)
                errormessages.resolveAndAddToObjectsCollections(msg, protocolName, warningsList, errorsList)
            except: