Esempio n. 1
0
    def _discover(self, domainDto=None):
        '''
        if domainDto is None, domain controllers of self domain will be discovered,
        else controllers for specified domain will be discovered
        '''
        result = AdDiscoveryResult()
        dtoToOshMap = result.getMap()
        siteDtoToOshMap = result.getSiteDtoToOshMap()
        containerOshMap = result.getContainerOshMap()

        client = self._daoService.getClient()
        serverDao = self._daoService.getServerDao()
        domainDao = self._daoService.getDomainDao()
        siteDao = self._daoService.getSiteDao()
        if domainDto is None:
            domainDto = domainDao.createDto(domainDao.obtainSelfDomainId())

        serverDtos = serverDao.obtainServers(domainDto)
        selfControllerId = serverDao.obtainSelfServerId()
        for dto in serverDtos:
            hostOsh = None
            functionality = None
            #if this is controller that we are triggered on
            if selfControllerId == dto.id:
                dto.fullVersion = serverDao.obtainSelfFullVersion()
                dto.ipAddress = client.getIpAddress()
                if self.__isConnectionPortReported:
                    dto.port = client.getPort()
                dto.username = client.getUserName()
                dto.credentialId = client.getCredentialId()
                functionality = serverDao.obtainSelfFunctionality()
                if self._containerOsh:
                    hostOsh = self._containerOsh
            else:
                #determine container host
                try:
                    dto.ipAddress = InetAddress.getByName(
                        dto.dnsName).getHostAddress()
                    hostOsh = HostBuilder.incompleteByIp(dto.ipAddress).build()
                except JException:
                    logger.debug('Cannot resolve IP address for fqdn %s' %
                                 dto.dnsName)
            if hostOsh:
                siteDto = siteDao.createDto(dto.siteName)
                osh = self.createOsh(dto, hostOsh, functionality)
                dtoToOshMap[dto] = osh
                siteDtoToOshMap[siteDto] = osh
                containerOshMap[dto] = hostOsh
        return result
    def _discover(self, domainDto=None):
        '''
        if domainDto is None, domain controllers of self domain will be discovered,
        else controllers for specified domain will be discovered
        '''
        result = AdDiscoveryResult()
        dtoToOshMap = result.getMap()
        siteDtoToOshMap = result.getSiteDtoToOshMap()
        containerOshMap = result.getContainerOshMap()

        client = self._daoService.getClient()
        serverDao = self._daoService.getServerDao()
        domainDao = self._daoService.getDomainDao()
        siteDao = self._daoService.getSiteDao()
        if domainDto is None:
            domainDto = domainDao.createDto(domainDao.obtainSelfDomainId())

        serverDtos = serverDao.obtainServers(domainDto)
        selfControllerId = serverDao.obtainSelfServerId()
        for dto in serverDtos:
            hostOsh = None
            functionality = None
            #if this is controller that we are triggered on
            if selfControllerId == dto.id:
                dto.fullVersion = serverDao.obtainSelfFullVersion()
                dto.ipAddress = client.getIpAddress()
                if self.__isConnectionPortReported:
                    dto.port = client.getPort()
                dto.username = client.getUserName()
                dto.credentialId = client.getCredentialId()
                functionality = serverDao.obtainSelfFunctionality()
                if self._containerOsh:
                    hostOsh = self._containerOsh
            else:
                #determine container host
                try:
                    dto.ipAddress = InetAddress.getByName(dto.dnsName).getHostAddress()
                    hostOsh = HostBuilder.incompleteByIp(dto.ipAddress).build()
                except JException:
                    logger.debug('Cannot resolve IP address for fqdn %s' % dto.dnsName)
            if hostOsh:
                siteDto = siteDao.createDto(dto.siteName)
                osh = self.createOsh(dto, hostOsh, functionality)
                dtoToOshMap[dto] = osh
                siteDtoToOshMap[siteDto] = osh
                containerOshMap[dto] = hostOsh
        return result
Esempio n. 3
0
def __createRouterIncompleteHostByIp(ipAddress):
    builder = HostBuilder.incompleteByIp(ipAddress)
    return builder.setAsRouter(1).build()