Sha256: b06a2f70da40f3e9ef2dd52b92719e391f42e6cfdc7d02bf92faf45f6c9e229a

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

require_relative "test_helper"

class TestBGPCluster < Minitest::Unit::TestCase
  include Clusterfuck

  def setup
    @cluster = BGPCluster.new(:test)
  end

  def test_bgp_neighbors_simple
    one = BGPPeer.new(:peer1)
    two = BGPPeer.new(:peer2)

    @cluster.connect(one, two)

    assert_equal [one], @cluster.bgp_neighbors(two)
    assert_equal [two], @cluster.bgp_neighbors(one)
  end

  def test_bgp_neighbors_simple_tree
    spine = BGPPeer.new(:spine)
    leaf1 = BGPPeer.new(:leaf1)
    leaf2 = BGPPeer.new(:leaf2)

    @cluster.connect(spine, leaf1)
    @cluster.connect(spine, leaf2)

    assert_equal [leaf1, leaf2], @cluster.bgp_neighbors(spine)
    assert_equal [spine], @cluster.bgp_neighbors(leaf1)
    assert_equal [spine], @cluster.bgp_neighbors(leaf2)
  end

  def test_bgp_neighbors_tree_with_non_bgp_peers
    spine = BGPPeer.new(:spine)
    leaf1 = BGPPeer.new(:leaf1)
    host11 = Machine.new(:host11)

    leaf2 = BGPPeer.new(:leaf2)
    host21 = Machine.new(:host21)

    @cluster.connect(spine, leaf1)
    @cluster.connect(spine, leaf2)

    @cluster.connect(leaf1, host11)
    @cluster.connect(leaf2, host21)

    assert_equal [leaf1, leaf2], @cluster.bgp_neighbors(spine)
    assert_equal [spine], @cluster.bgp_neighbors(leaf1)
    assert_equal [spine], @cluster.bgp_neighbors(leaf2)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vagrant-clusterfuck-0.0.7 test/bgp_network_test.rb
vagrant-clusterfuck-0.0.6 test/bgp_network_test.rb
vagrant-clusterfuck-0.0.5 test/bgp_network_test.rb
vagrant-clusterfuck-0.0.4 test/bgp_network_test.rb
vagrant-clusterfuck-0.0.3 test/bgp_network_test.rb
vagrant-clusterfuck-0.0.2 test/bgp_network_test.rb