Sha256: cbd06a7841513f044a3ec6da5108f53ee58d840e16e6bf51514c05095270a2b7

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

require_relative "lib/clusterfuck"
include Clusterfuck

# Create a BGPCluster. The BGPCluster is just a cluster that knows how to
# discover neighbouring BGP nodes.
cluster = BGPCluster.create(:test)

# The VIP subnet includes all the VIPs that any BGPPeer can take and announce.
# All hosts, even if they're on the same subnet as the node that owns the IP,
# will go through their gateway to route the IP.
vip_subnet = IPAddr.new("192.168.99.0/24")

# Spine becomes the catchall for 10.0.0.0/16 which is the subnet all the nodes
# belong to (each subnet is a /24).
priv_subnet = IPAddr.new("10.0.0.0/16")

# The Spine announces the VIP and private subnet.
spine = QuaggaBGPRouter.new(:spine, announce: [vip_subnet, priv_subnet])

# Define the leaf, announcements come later
leaf1_subnet = SubnetFactory.next_subnet
leaf1 = QuaggaBGPRouter.new(:leaf1, announce: leaf1_subnet.last_ip)

leaf2_subnet = SubnetFactory.next_subnet
leaf2 = QuaggaBGPRouter.new(:leaf2, announce: leaf2_subnet.last_ip)

# A normal host. All the Spine's BGP announcements (vip + priv) will go through
# the gateway.
host11 = Machine.new(:host11, routes: spine.bgp_announce, gateway: leaf1)

# A BGPPeer is just a machine with BGP information so that its BGP neighbours
# will automatically add it as a BGP peer. This is for a node to run e.g.
# ExaBGP.
host21 = BGPPeer.new(:host21, routes: spine.bgp_announce, gateway: leaf2)
host22 = Machine.new(:host22, routes: spine.bgp_announce, gateway: leaf2)

# The spines and leaves have their own subnets
cluster.connect(spine, leaf1)
cluster.connect(spine, leaf2)

# The leaves create a subnet with all their hosts.
cluster.connect(leaf1, host11, subnet: leaf1_subnet)
cluster.connect(leaf2, host21, host22, subnet: leaf2_subnet)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-clusterfuck-0.0.3 cluster.rb
vagrant-clusterfuck-0.0.2 cluster.rb