Class: Clusterfuck::QuaggaBGPRouter

Inherits:
BGPPeer show all
Defined in:
lib/clusterfuck/quagga_bgp_router.rb

Instance Attribute Summary

Attributes inherited from BGPPeer

#bgp_announce, #bgp_asn, #bgp_router_id

Attributes inherited from Machine

#cluster, #gateway, #ips, #name, #routes, #ssh_port

Instance Method Summary collapse

Methods inherited from BGPPeer

#bgp_neighbors, #initialize

Methods inherited from Machine

#initialize, #ip_in_same_subnet

Constructor Details

This class inherits a constructor from Clusterfuck::BGPPeer

Instance Method Details

#build(config) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/clusterfuck/quagga_bgp_router.rb', line 3

def build(config)
  super(config)

  config.vm.define(name) do |box|
    box.vm.provision :shell, inline: <<-EOS
  mkdir -p /tmp/quagga
  chown -R vagrant /tmp/quagga

  apt-get update
  apt-get -y install quagga
  EOS

    # TODO should be configured from BGP module if enabled
    # TODO have to move to /tmp/ first and then later to /etc/quagga because
    # Vagrant doens't copy as root.
    box.vm.provision :file,
      source: tmp_daemons_config,
      destination: "/tmp/quagga/daemons"

    box.vm.provision :file,
      source: tmp_bgp_config("../../../templates/quagga.zebra.conf.erb"),
      destination: "/tmp/quagga/zebra.conf"

    box.vm.provision :file,
      source: tmp_bgp_config("../../../templates/quagga.bgpd.conf.erb"),
      destination: "/tmp/quagga/bgpd.conf"

    box.vm.provision :shell, inline: <<-EOS
  echo net.ipv4.ip_forward=1 > /etc/sysctl.d/60-clusterfuck.conf
  sysctl -p /etc/sysctl.d/60-clusterfuck.conf

  mv /tmp/quagga/* /etc/quagga
  chown quagga.quagga /etc/quagga/*.conf
  chmod 640 /etc/quagga/*.conf

  service quagga restart
EOS
  end
end