Ejemplo n.º 1
0
  def test_bview_fake_withdraw_nothing(self):
    """Check the bview_fake_withdraw() behavior when there is nothing to do."""

    rib = EmulatedRIB()
    rib.set_access_time(0)

    # Process an UPDATE
    route = Route(rib)
    route.process(update4)

    # Pretend to do a withdraw
    route_messages, hijack_messages = bview_fake_withdraw(rib, "collector", 0, 42)

    assert len(route_messages) == 0
    assert len(hijack_messages) == 0
    assert len(rib.nodes()) == 1
Ejemplo n.º 2
0
  def test_bview_fake_withdraw_route(self):
    """Check the bview_fake_withdraw() behavior with regular routes."""

    rib = EmulatedRIB()
    rib.set_access_time(0)

    # Process an UPDATE
    route = Route(rib)
    route.process(update4)

    # Pretend to do a withdraw
    route_messages, hijack_messages = bview_fake_withdraw(rib, "collector", 1, 42)

    assert len(route_messages) == 1
    assert route_messages[0] == expected_fake_withdraw_route
    assert len(hijack_messages) == 0

    assert len(rib.nodes()) == 0