blob: 3edc96bbb20a8469db6076f03f16c4cbab8ef6d0 [file] [log] [blame]
Eric Newberrye69cb692015-07-08 22:46:01 -07001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5VAGRANTFILE_API_VERSION = "2"
6
7$setup = <<SCRIPT
8sudo apt-get update -qq
9sudo apt-get install -y python
10SCRIPT
11
12$setup_integ = <<SCRIPT
13cp -R /vagrant integration-tests
14cd integration-tests && ./install_apps.py install_all 2>&1 | tee install.log
15SCRIPT
16
17$setup_ssh = <<SCRIPT
18mkdir -p ~/.ssh
19cp /vagrant/temp/sshkey ~/.ssh/id_rsa
20cp /vagrant/temp/sshkey.pub ~/.ssh/id_rsa.pub
21cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
22chown -R vagrant:vagrant ~/.ssh
23chmod -R 700 ~/.ssh
24SCRIPT
25
26$setup_a = <<SCRIPT
27cat > ~/.ssh/config <<EOF
28Host 192.168.*.*
29 StrictHostKeyChecking no
30EOF
31
32sudo ip route add 192.168.3.0/24 via 192.168.2.3
33sudo ip -6 addr add fd01::3/64 dev eth1
34sudo ip -6 addr add fd02::2/64 dev eth2
35sudo ip -6 route add fd03::/64 via fd02::3
36SCRIPT
37
38$setup_d = <<SCRIPT
39ip route add 192.168.2.0/24 via 192.168.3.2
40ip -6 addr add fd03::3/64 dev eth1
41ip -6 route add fd02::/64 via fd03::2
42SCRIPT
43
44$setup_router = <<SCRIPT
45echo 1 > /proc/sys/net/ipv4/ip_forward
46echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
47ip -6 addr add fd02::3/64 dev eth1
48ip -6 addr add fd03::2/64 dev eth2
49SCRIPT
50
51Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
52 config.vm.box = "ubuntu/precise64"
53
54 config.vm.provider "virtualbox" do |vb|
55 vb.memory = "4096"
56 vb.cpus = "4"
57 vb.customize ["storagectl", :id, "--name", "SATAController", "--hostiocache", "off"]
58 end
59
60 config.vm.define "A" do |a|
61 a.vm.network "private_network", ip: "192.168.1.3", virtualbox__intnet: "ABC-switch"
62 a.vm.network "private_network", ip: "192.168.2.2", virtualbox__intnet: "AtoRouter"
63 a.vm.provision "shell", inline: $setup, privileged: false
64 a.vm.provision "shell", inline: $setup_a, privileged: false
65 a.vm.provision "shell", inline: $setup_ssh, privileged: false
66 a.vm.provision "shell", inline: $setup_integ, privileged: false
67 end
68
69 config.vm.define "B" do |b|
70 b.vm.network "private_network", ip: "192.168.1.2", virtualbox__intnet: "ABC-switch"
71 b.vm.provision "shell", inline: $setup, privileged: false
72 b.vm.provision "shell", inline: "ip -6 addr add fd01::2/64 dev eth1"
73 b.vm.provision "shell", inline: $setup_ssh, privileged: false
74 b.vm.provision "shell", inline: $setup_integ, privileged: false
75 end
76
77 config.vm.define "C" do |c|
78 c.vm.network "private_network", ip: "192.168.1.4", virtualbox__intnet: "ABC-switch"
79 c.vm.provision "shell", inline: $setup, privileged: false
80 c.vm.provision "shell", inline: "ip -6 addr add fd01::4/64 dev eth1"
81 c.vm.provision "shell", inline: $setup_ssh, privileged: false
82 c.vm.provision "shell", inline: $setup_integ, privileged: false
83 end
84
85 config.vm.define "D" do |d|
86 d.vm.network "private_network", ip: "192.168.3.3", virtualbox__intnet: "DtoRouter"
87 d.vm.provision "shell", inline: $setup, privileged: false
88 d.vm.provision "shell", inline: $setup_d
89 d.vm.provision "shell", inline: $setup_ssh, privileged: false
90 d.vm.provision "shell", inline: $setup_integ, privileged: false
91 end
92
93 config.vm.define "router" do |router|
94 router.vm.network "private_network", ip: "192.168.2.3", virtualbox__intnet: "AtoRouter"
95 router.vm.network "private_network", ip: "192.168.3.2", virtualbox__intnet: "DtoRouter"
96 router.vm.provision "shell", inline: $setup_router
97 router.vm.provider "virtualbox" do |vb|
98 vb.memory = "128"
99 vb.cpus = "1"
100 end
101 end
102end