11.07.2015 Views

DDM 8.0 Advanced Student Guide

DDM 8.0 Advanced Student Guide

DDM 8.0 Advanced Student Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

caption = caption[0:249]hostOSH.setAttribute('host_os', caption)return hostOSHHP CONFIDENTIAL - ENABLEMENT ONLY, NOT FOR CUSTOMER USE.# WMI may report mulitple ip's in a comma separated string# WMI may report mulitple ip masks in a comma separated stringdef getIPNetworkMemebrList(ipList, netmaskList, dnsname=''):_ipList = []_maskList = []_ipOshList = []vec = ObjectStateHolderVector()ips = string.split(ipList, ',')for ip in ips:_ipList.append(ip)masks = string.split(netmaskList, ',')for mask in masks:_maskList.append(mask)for i in range(len(_ipList)):try:ip = _ipList[i]mask = _maskList[i]if ((not netutils.isValidIp(ip)) ornetutils.isLocalIp(ip)):# invalid or local iplogger.debug('ignoring invalid ip=%s' % ip )continuereturn vec# ip is valid and not local (i.e. 0.0.0.0, 127.0.0.1)# create an IPipOSH = modeling.createIpOSH(ip, mask)vec.add(ipOSH)# create networknetOSH = modeling.createNetworkOSH(ip, mask)link = modeling.createLinkOSH('member', ipOSH, netOSH)vec.add(netOSH)vec.add(link)except:logger.errorException("Failed parsing IP: ", ip)def doWMI(client, wmiOSH, ip_address, ip_domain, osbundle):wmihostForLinkOSH = modeling.createHostOSH(ip_address)wmiOSH.setContainer(hostForLinkOSH)machineName = ''#Modification made on 13/06/2006 to retrive host name directly from_wmiQuery6 = 'select Name from Win32_ComputerSystem'resultSet = client.executeQuery(_wmiQuery6)if resultSet.next():machineName = resultSet.getString(1)machineName = machineName.lower()DuplicateTest = ''HP Global Enablement© Copyright 2009 Hewlett-Packard Development Company, L.P. 48

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!