def DiscoveryMain(Framework):
    OSHVResult = ObjectStateHolderVector()

    connection = Framework.getProbeDatabaseConnection('common')
    
    for mac_preffix, vendor in THIN_CLIENT_MAC_TO_VENDOR_PAIRS.items():
        st = getPreparedStatement(connection, mac_preffix)
        rs = st.executeQuery()
        while (rs.next()):
            mac = rs.getString('mac_address')
            ip = rs.getString('ip_address')
            if ip_addr.isValidIpAddressNotZero(ip) and not DSM.isIpOutOfScope(ip) and DSM.isClientIp(ip): 
                ip_osh = build_client_ip_osh(ip, mac)
                node_osh = build_node_osh(mac, vendor)
                if ip_osh and node_osh:
                    link_osh = modeling.createLinkOSH('containment', node_osh, ip_osh)
                    interface_osh = modeling.createInterfaceOSH(mac, node_osh)
                    OSHVResult.add(ip_osh)
                    OSHVResult.add(node_osh)
                    OSHVResult.add(link_osh)
                    OSHVResult.add(interface_osh)
                else:
                    debug('Failed to create topology for ip %s , mac %s, vendor %s' % (ip, mac, vendor))
            else:
                debug('Skipping IP address %s since it is invalid or not assigned to any probe or not in client ip range. ' %  ip)
        rs.close()
        connection.close(st)
  
    connection.close()
    return OSHVResult
def DiscoveryMain(Framework):
    OSHVResult = ObjectStateHolderVector()

    connection = Framework.getProbeDatabaseConnection('common')

    for mac_preffix, vendor in THIN_CLIENT_MAC_TO_VENDOR_PAIRS.items():
        st = getPreparedStatement(connection, mac_preffix)
        rs = st.executeQuery()
        while (rs.next()):
            mac = rs.getString('mac_address')
            ip = rs.getString('ip_address')
            if ip_addr.isValidIpAddressNotZero(
                    ip) and not DSM.isIpOutOfScope(ip) and DSM.isClientIp(ip):
                ip_osh = build_client_ip_osh(ip, mac)
                node_osh = build_node_osh(mac, vendor)
                if ip_osh and node_osh:
                    link_osh = modeling.createLinkOSH('containment', node_osh,
                                                      ip_osh)
                    interface_osh = modeling.createInterfaceOSH(mac, node_osh)
                    OSHVResult.add(ip_osh)
                    OSHVResult.add(node_osh)
                    OSHVResult.add(link_osh)
                    OSHVResult.add(interface_osh)
                else:
                    debug(
                        'Failed to create topology for ip %s , mac %s, vendor %s'
                        % (ip, mac, vendor))
            else:
                debug(
                    'Skipping IP address %s since it is invalid or not assigned to any probe or not in client ip range. '
                    % ip)
        rs.close()
        connection.close(st)

    connection.close()
    return OSHVResult
 def __contains__(self, node):
     return node.isServer is not None and node.isServer and DOMAIN_SCOPE_MANAGER.isIpOutOfScope(
         node.ip)
 def __contains__(self, node):
     return node.isServer is not None and node.isServer and DOMAIN_SCOPE_MANAGER.isIpOutOfScope(node.ip)