예제 #1
0
파일: test.py 프로젝트: davelxmos/sw_avb_dc
def ptp_startup_single_port(e, grandmaster, user):
  """ Determine the PTP sequence for the node. If it is not the grandmaster
      it should go to slave and lock
  """
  slave_seq = []
  if grandmaster and (endpoints.get_avb_id(user, e) != endpoints.get_avb_id(user, grandmaster)):
      slave_seq = [Sequence(
                    [Expected(e['name'], 'PTP Role: Slave', 40),
                     Expected(e['name'], 'PTP sync locked', 5)])]

  return Sequence(
             [Expected(e['name'], 'PTP Role: Master', 40)] +
             slave_seq)
예제 #2
0
파일: test.py 프로젝트: davelxmos/sw_avb_dc
def ptp_startup_two_port(e, grandmaster, user):
  """ Determine the PTP sequence for the node. If it is not the grandmaster
      it should go to slave and lock
  """
  slave_seq = []
  if grandmaster and (endpoints.get_avb_id(user, e) != endpoints.get_avb_id(user, grandmaster)):
    # The length of time to sync will depend on the total number of endpoints
    sync_lock_time = 3 * len(endpoints.get_all())
    slave_seq = [Sequence(
                  [Expected(e['name'], 'PTP Port \d+ Role: Slave', 40),
                   Expected(e['name'], 'PTP sync locked', sync_lock_time)])]

  return Sequence(
            [Expected(e['name'], 'PTP Port 0 Role: Master', 40),
             Expected(e['name'], 'PTP Port 1 Role: Master', 5)] +
            slave_seq)
예제 #3
0
파일: test.py 프로젝트: davelxmos/sw_avb_dc
def check_endpoint_startup():
  """ Ensure that the endpoints have started correctly. The exact sequence will depend
      on which endpoint is the grandmaster.
  """
  grandmaster = endpoints.determine_grandmaster(args.user)
  log_info("Using grandmaster {gm_id}".format(gm_id=endpoints.get_avb_id(args.user, grandmaster)))

  # Check that all endpoints go to PTP master in 30 seconds and then one of the
  # ports will go Master or Slave and lock
  ptp_startup = [AllOf(
             [ptp_startup_two_port(e, grandmaster, args.user)
               for e in filter(lambda x: x['ports'] == 2, endpoints.get_all().values())] +
             [ptp_startup_single_port(e, grandmaster, args.user)
               for e in filter(lambda x: x['ports'] == 1, endpoints.get_all().values())]
            )]

  maap = [
      AllOf([Expected(e['name'],
            'MAAP reserved Talker stream #%d address: 91:E0:F0:0' % n, 40)
          for n in range(e['talker_streams'])])
      for e in endpoints.get_all().values()
    ]

  yield master.expect(AllOf(ptp_startup + maap))
예제 #4
0
def stream_id_from_guid(user, ep, num):
    stream_id = endpoints.get_avb_id(user, ep).replace("fffe","") + "000" + str(num)
    return stream_id.upper()