def doDiscovery(Framework, shell, client, ip, codepage, connectedShellCredId=None): '''Framework, Shell, BaseClient, str, str -> ObjectStateHolderVector @raise Exception: discovery failed @raise JException: discovery failed ''' vector = ObjectStateHolderVector() languageName = shell.osLanguage.bundlePostfix host_cmdbid = Framework.getDestinationAttribute('host_cmdbid') host_key = Framework.getDestinationAttribute('host_key') mac_address = Framework.getDestinationAttribute('ip_mac_address') if not mac_address or len(mac_address) == 0 or mac_address == 'NA': mac_address = None langBund = Framework.getEnvironmentInformation().getBundle( 'langNetwork', languageName) shellObj = createShellObj(shell, client, ip, langBund, languageName, codepage, mac_address, connectedShellCredId) #NAT natIPs = getNatIPFromConfigurationFile() uduid = None if not isinstance(shell, shellutils.NexusShell): uduid = getUduid(client, isStampEnabled(Framework, ip)) logger.debug("Get UD_UNIQUE_ID:", uduid) if (shell.isWinOs()): try: environment = shell_interpreter.Factory().create( shell).getEnvironment() environment.appendPath('PATH', '%WINDIR%\\system32\\wbem\\') except: logger.debug('Failed to add default wmic path.') #NAT vector.addAll( NTCMD_Connection_Utils.doHPCmd(shell, shellObj, ip, langBund, Framework, host_cmdbid, host_key, None, uduid, natIPs)) else: vector.addAll( TTY_Connection_Utils.getOSandStuff(shell, shellObj, Framework, langBund, uduid, natIPs)) return vector
def doDiscovery(Framework, shell, client, ip, codepage, connectedShellCredId = None): '''Framework, Shell, BaseClient, str, str -> ObjectStateHolderVector @raise Exception: discovery failed @raise JException: discovery failed ''' vector = ObjectStateHolderVector() languageName = shell.osLanguage.bundlePostfix host_cmdbid = Framework.getDestinationAttribute('host_cmdbid') host_key = Framework.getDestinationAttribute('host_key') mac_address = Framework.getDestinationAttribute('ip_mac_address') if not mac_address or len(mac_address) == 0 or mac_address == 'NA': mac_address = None langBund = Framework.getEnvironmentInformation().getBundle('langNetwork', languageName) shellObj = createShellObj(shell, client, ip, langBund, languageName, codepage, mac_address, connectedShellCredId) #NAT natIPs = getNatIPFromConfigurationFile() uduid = None if not isinstance(shell, shellutils.NexusShell): uduid = getUduid(client, isStampEnabled(Framework, ip)) logger.debug("Get UD_UNIQUE_ID:", uduid) if (shell.isWinOs()): try: environment = shell_interpreter.Factory().create(shell).getEnvironment() environment.appendPath('PATH', '%WINDIR%\\system32\\wbem\\') except: logger.debug('Failed to add default wmic path.') #NAT vector.addAll(NTCMD_Connection_Utils.doHPCmd(shell, shellObj, ip, langBund, Framework, host_cmdbid, host_key, None, uduid, natIPs)) else: vector.addAll(TTY_Connection_Utils.getOSandStuff(shell, shellObj, Framework, langBund, uduid, natIPs)) return vector