예제 #1
0
def discoverySingleUCS(Framework, url, credentialIds):
    for credentialId in credentialIds:
        logger.debug('Begin trying credential id:', credentialId)
        params = {'credentialsId': credentialId}
        tmpFramework = MyFramework(Framework, parameters=params)
        manager = FrameworkBasedConnectionDataManager(tmpFramework, url=url)
        try:
            client = manager.getClient()
            if client:
                logger.debug("UCS Connected on URL:", manager.getConnectionUrl)
                logger.debug("Begin discovery topology...")
                return ucs_pull_base.discovery(Framework, manager)
        except:
            logger.debugException('')
            logger.debug('Can not connection by credential:', credentialId)
        finally:
            if manager:
                manager.closeClient()
    else:
        logger.warn(
            'All credentials have been tried. No credential can connect to UCS by url %s'
            % url)
        Framework.reportWarning(
            'All credentials have been tried. No credential can connect to UCS by ip %s'
            % url)
예제 #2
0
def DiscoveryMain(Framework):
    ip = Framework.getTriggerCIData('ip_address')
    if not ip:
        logger.warn('No Application IP for UCS')
        Framework.reportError('No Application IP for UCS')
        return

    preferCredential = Framework.getTriggerCIData('credentialsId')
    if not preferCredential:
        logger.warn('No credential found on UCS')
        Framework.reportError('No credential found on UCS')
        return

    originFramework = Framework
    connectionManager = None
    params = {'credentialsId': preferCredential}
    tmpFramework = MyFramework(originFramework, parameters=params)
    logger.debug("Connect IP %s by credential Id %s" % (ip, preferCredential))
    manager = FrameworkBasedConnectionDataManager(tmpFramework, ip)
    try:
        client = manager.getClient()
        if client:
            logger.debug("Connected")
            connectionManager = manager
    except:
        logger.debugException('')

    if connectionManager:
        return ucs_pull_base.discovery(Framework, connectionManager)
    else:
        logger.error('The credential is invalid on ip %s' % ip)
        Framework.reportError('The credential is invalid on ip %s' % ip)
예제 #3
0
def discoverySingleUCS(Framework, url, credentialIds):
    for credentialId in credentialIds:
        logger.debug('Begin trying credential id:', credentialId)
        params = {'credentialsId': credentialId}
        tmpFramework = MyFramework(Framework, parameters=params)
        manager = FrameworkBasedConnectionDataManager(tmpFramework, url=url)
        try:
            client = manager.getClient()
            if client:
                logger.debug("UCS Connected on URL:", manager.getConnectionUrl)
                logger.debug("Begin discovery topology...")
                return ucs_pull_base.discovery(Framework, manager)
        except:
            logger.debugException('')
            logger.debug('Can not connection by credential:', credentialId)
        finally:
            if manager:
                manager.closeClient()
    else:
        logger.warn('All credentials have been tried. No credential can connect to UCS by url %s' % url)
        Framework.reportWarning('All credentials have been tried. No credential can connect to UCS by ip %s' % url)
예제 #4
0
def DiscoveryMain(Framework):
    return ucs_pull_base.discovery(Framework)