Beispiel #1
0
def analyzer_qav_seq(test_step, src, dst, action, user):
  """ Get the expected sequence for any QAV analyzers active.
  """
  analyzer_expect = []

  for analyzer_name,analyzer in analyzers.get_all().iteritems():
    if analyzer['type'] != 'qav':
      continue

    # If the analyzer is a QAV analyzer then it will detect the stream through
    # the packets being forwarded through it
    if analyzer_name in graph.find_path(state.get_current(), src, dst):
      guid_string = endpoints.guid_in_ascii(user, endpoints.get(src))
      stream_string = endpoints.stream_from_guid(guid_string)
      if action == 'connect':
        action_string = "Adding"
        completionFn = hook_register_error
      else:
        action_string = "Removing"
        completionFn = hook_unregister_error

      analyzer_expect += [Expected(analyzer_name, "%s stream 0x%s" % (action_string, stream_string),
            timeoutTime=10,
            completionFn=completionFn,
            completionArgs=(analyzer_name, ['ERROR']))]

  return analyzer_expect
Beispiel #2
0
def talker_existing_connect_seq(test_step, user, src, src_stream, dst, dst_stream):
  stream_id = endpoints.stream_from_guid(endpoints.guid_in_ascii(user, endpoints.get(src)))
  listener_mac = endpoints.mac_in_ascii(user, endpoints.get(dst))
  talker_connection = [
        Sequence([Expected(src, "CONNECTING Talker stream #%d \(%s\) -> Listener %s" %
                    (src_stream, stream_id, listener_mac), 10)])
    ]
  return talker_connection
Beispiel #3
0
def talker_new_connect_seq(test_step, user, src, src_stream, dst, dst_stream):
  """ Only on the first time the talker is turned on must the 'ready' be seen.
  """
  stream_id = endpoints.stream_from_guid(endpoints.guid_in_ascii(user, endpoints.get(src)))
  listener_mac = endpoints.mac_in_ascii(user, endpoints.get(dst))
  seq = [Expected(src, "CONNECTING Talker stream #%d \(%s\) -> Listener %s" %
            (src_stream, stream_id, listener_mac), 10)]
  if not state.get_current().get_talker_on_count(src):
    seq += [Expected(src, "Talker stream #%d ready" % src_stream, 10)]
  seq += [Expected(src, "Talker stream #%d on" % src_stream, 10)]

  talker_connection = [Sequence(seq)]
  return talker_connection
Beispiel #4
0
def talker_new_connect_seq(test_step, user, src, src_stream, dst, dst_stream):
  """ Only on the first time the talker is turned on must the 'ready' be seen.
  """
  stream_id = endpoints.stream_from_guid(endpoints.guid_in_ascii(user, endpoints.get(src)))
  listener_mac = endpoints.mac_in_ascii(user, endpoints.get(dst))
  seq = [Expected(src, "CONNECTING Talker stream #%d \(%s\) -> Listener %s" %
            (src_stream, stream_id, listener_mac), 10)]
  if not state.get_current().get_talker_on_count(src):
    seq += [Expected(src, "Talker stream #%d ready" % src_stream, 10)]
  seq += [Expected(src, "Talker stream #%d on" % src_stream, 10)]

  # If in a sequence of commands then the order cannot be guaranteed - so only
  # expect a Sequence when not checkpointing
  if test_step.checkpoint is None:
    talker_connection = [Sequence(seq)]
  else:
    talker_connection = [AllOf(seq)]
  return talker_connection