blob: a95f369fb4a8b9884de799617f72e3c619a9591b [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
Eric Newberrye69cb692015-07-08 22:46:01 -07009SCRIPT
10
11$setup_integ = <<SCRIPT
12cp -R /vagrant integration-tests
13cd integration-tests && ./install_apps.py install_all 2>&1 | tee install.log
14SCRIPT
15
16$setup_ssh = <<SCRIPT
17mkdir -p ~/.ssh
18cp /vagrant/temp/sshkey ~/.ssh/id_rsa
19cp /vagrant/temp/sshkey.pub ~/.ssh/id_rsa.pub
20cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
21chown -R vagrant:vagrant ~/.ssh
22chmod -R 700 ~/.ssh
23SCRIPT
24
25$setup_a = <<SCRIPT
26cat > ~/.ssh/config <<EOF
27Host 192.168.*.*
28 StrictHostKeyChecking no
29EOF
30
31sudo ip route add 192.168.3.0/24 via 192.168.2.3
32sudo ip -6 addr add fd01::3/64 dev eth1
33sudo ip -6 addr add fd02::2/64 dev eth2
34sudo ip -6 route add fd03::/64 via fd02::3
35SCRIPT
36
37$setup_d = <<SCRIPT
38ip route add 192.168.2.0/24 via 192.168.3.2
39ip -6 addr add fd03::3/64 dev eth1
40ip -6 route add fd02::/64 via fd03::2
41SCRIPT
42
43$setup_router = <<SCRIPT
44echo 1 > /proc/sys/net/ipv4/ip_forward
45echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
46ip -6 addr add fd02::3/64 dev eth1
47ip -6 addr add fd03::2/64 dev eth2
48SCRIPT
49
50Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
Eric Newberry7a77f332015-07-23 20:29:31 -070051 config.vm.box = "ubuntu/trusty64"
Eric Newberrye69cb692015-07-08 22:46:01 -070052
53 config.vm.provider "virtualbox" do |vb|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070054 vb.memory = "2048"
55 vb.cpus = "1"
Eric Newberrye69cb692015-07-08 22:46:01 -070056 vb.customize ["storagectl", :id, "--name", "SATAController", "--hostiocache", "off"]
57 end
58
Eric Newberry8ab30bb2015-09-26 11:56:40 -070059 config.vm.define "template" do |t|
60 t.vm.provision "shell", inline: $setup, privileged: false
61 t.vm.provision "shell", inline: $setup_ssh, privileged: false
62 t.vm.provision "shell", inline: $setup_integ, privileged: false
63 end
64
Eric Newberrye69cb692015-07-08 22:46:01 -070065 config.vm.define "A" do |a|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070066 a.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070067 a.vm.network "private_network", ip: "192.168.1.3", virtualbox__intnet: "ABC-switch"
68 a.vm.network "private_network", ip: "192.168.2.2", virtualbox__intnet: "AtoRouter"
69 a.vm.provision "shell", inline: $setup, privileged: false
70 a.vm.provision "shell", inline: $setup_a, privileged: false
Eric Newberrye69cb692015-07-08 22:46:01 -070071 end
72
73 config.vm.define "B" do |b|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070074 b.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070075 b.vm.network "private_network", ip: "192.168.1.2", virtualbox__intnet: "ABC-switch"
76 b.vm.provision "shell", inline: $setup, privileged: false
77 b.vm.provision "shell", inline: "ip -6 addr add fd01::2/64 dev eth1"
Eric Newberrye69cb692015-07-08 22:46:01 -070078 end
79
80 config.vm.define "C" do |c|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070081 c.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070082 c.vm.network "private_network", ip: "192.168.1.4", virtualbox__intnet: "ABC-switch"
83 c.vm.provision "shell", inline: $setup, privileged: false
84 c.vm.provision "shell", inline: "ip -6 addr add fd01::4/64 dev eth1"
Eric Newberrye69cb692015-07-08 22:46:01 -070085 end
86
87 config.vm.define "D" do |d|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070088 d.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070089 d.vm.network "private_network", ip: "192.168.3.3", virtualbox__intnet: "DtoRouter"
90 d.vm.provision "shell", inline: $setup, privileged: false
91 d.vm.provision "shell", inline: $setup_d
Eric Newberrye69cb692015-07-08 22:46:01 -070092 end
93
94 config.vm.define "router" do |router|
95 router.vm.network "private_network", ip: "192.168.2.3", virtualbox__intnet: "AtoRouter"
96 router.vm.network "private_network", ip: "192.168.3.2", virtualbox__intnet: "DtoRouter"
97 router.vm.provision "shell", inline: $setup_router
98 router.vm.provider "virtualbox" do |vb|
99 vb.memory = "128"
100 vb.cpus = "1"
101 end
102 end
103end