Esempio n. 1
0
def port_shaper_disconnect_seq(test_step, forward_ep, src, src_stream, dst, dst_stream):
  expect_change = False

  if state.get_current().connected(src, src_stream, dst, dst_stream):
    forward_port = graph.get_forward_port(state.get_current(), src, dst, forward_ep['name'])

    if forward_port is not None:
      expect_change = graph.port_will_see_bandwidth_change(state.get_current(), src, src_stream,
          forward_ep['name'], forward_port, 'disconnect')

  if expect_change:
    expected = port_shaper_change_seq(test_step, forward_ep, forward_port, 'Decreasing')
  else:
    expected = port_shaper_no_change_seq(test_step, forward_ep)

  # When running a sequences of checkpointed tests don't check shaper bandwidth
  # figures for interim steps. Instead, keep track of the state per end-point so
  # that the final state can be returned at the last checkpoint.
  if test_step.checkpoint is not None:
    global final_port_shaper_states
    if expected:
      if forward_port is None:
        final_port_shaper_states['%s' % forward_ep['name']] = expected
      else:
        final_port_shaper_states['%s_%s' % (forward_ep['name'], forward_port)] = expected
      expected = []

  return expected
Esempio n. 2
0
def port_shaper_disconnect_seq(test_step, forward_ep, src, src_stream, dst, dst_stream):
  expect_change = False

  if state.get_current().connected(src, src_stream, dst, dst_stream):
    forward_port = graph.get_forward_port(state.get_current(), src, dst, forward_ep['name'])

    if forward_port is not None:
      expect_change = graph.port_will_see_bandwidth_change(state.get_current(), src, src_stream,
          forward_ep['name'], forward_port, 'disconnect')

  if expect_change:
    return port_shaper_change_seq(test_step, forward_ep, forward_port, 'Decreasing')
  else:
    return port_shaper_no_change_seq(test_step, forward_ep)