Logo Search packages:      
Sourcecode: namebench version File versions  Download package

def libnamebench::history_parser::HistoryParser::GenerateTestData (   self,
  hosts,
  sorted_unique = False 
)

Given a set of hosts, generate test data.

Args:
  hosts: A list of hostnames
  sorted_unique: Return a sorted unique list of tests. Useful for large
             data sets.

Returns:
  A list of strings representing DNS requests to test with.

Definition at line 165 of file history_parser.py.

00165                                                         :
    """Given a set of hosts, generate test data.

    Args:
      hosts: A list of hostnames
      sorted_unique: Return a sorted unique list of tests. Useful for large
                     data sets.

    Returns:
      A list of strings representing DNS requests to test with.
    """
    history = []
    hits = {}
    last_host = None

    for host in hosts:
      if not host.endswith('.'):
        host = host + '.'

      if self.INTERNAL_RE.search(host):
        continue

      if self.IP_RE.match(host):
        continue

      if host != last_host:
        if sorted_unique:
          hits[host] = hits.get(host, 0) + 1
        else:
          history.append('A %s' % host)
        last_host = host

    if sorted_unique:
      for (hit, count) in sorted(hits.items(), key=operator.itemgetter(1),
                                 reverse=True):
        history.append('A %s # %s hits' % (hit, count))
    return history

  def _AddRoamLocalWindowsPaths(self, paths):


Generated by  Doxygen 1.6.0   Back to index