blob: be9da5e490a24bd8e9e1024f1c4dc19d5157a478 [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 Newberry59094fc2017-11-02 00:41:32 -070054 vb.memory = "512"
Eric Newberry8ab30bb2015-09-26 11:56:40 -070055 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
Eric Newberry59094fc2017-11-02 00:41:32 -070063 config.vm.provider "virtualbox" do |vb|
64 vb.memory = "6144"
65 vb.cpus = "4"
66 end
Eric Newberry8ab30bb2015-09-26 11:56:40 -070067 end
68
Eric Newberrye69cb692015-07-08 22:46:01 -070069 config.vm.define "A" do |a|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070070 a.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070071 a.vm.network "private_network", ip: "192.168.1.3", virtualbox__intnet: "ABC-switch"
72 a.vm.network "private_network", ip: "192.168.2.2", virtualbox__intnet: "AtoRouter"
73 a.vm.provision "shell", inline: $setup, privileged: false
74 a.vm.provision "shell", inline: $setup_a, privileged: false
Eric Newberrye69cb692015-07-08 22:46:01 -070075 end
76
77 config.vm.define "B" do |b|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070078 b.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070079 b.vm.network "private_network", ip: "192.168.1.2", virtualbox__intnet: "ABC-switch"
80 b.vm.provision "shell", inline: $setup, privileged: false
81 b.vm.provision "shell", inline: "ip -6 addr add fd01::2/64 dev eth1"
Eric Newberrye69cb692015-07-08 22:46:01 -070082 end
83
84 config.vm.define "C" do |c|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070085 c.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070086 c.vm.network "private_network", ip: "192.168.1.4", virtualbox__intnet: "ABC-switch"
87 c.vm.provision "shell", inline: $setup, privileged: false
88 c.vm.provision "shell", inline: "ip -6 addr add fd01::4/64 dev eth1"
Eric Newberrye69cb692015-07-08 22:46:01 -070089 end
90
91 config.vm.define "D" do |d|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070092 d.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070093 d.vm.network "private_network", ip: "192.168.3.3", virtualbox__intnet: "DtoRouter"
94 d.vm.provision "shell", inline: $setup, privileged: false
95 d.vm.provision "shell", inline: $setup_d
Eric Newberrye69cb692015-07-08 22:46:01 -070096 end
97
98 config.vm.define "router" do |router|
99 router.vm.network "private_network", ip: "192.168.2.3", virtualbox__intnet: "AtoRouter"
100 router.vm.network "private_network", ip: "192.168.3.2", virtualbox__intnet: "DtoRouter"
101 router.vm.provision "shell", inline: $setup_router
102 router.vm.provider "virtualbox" do |vb|
103 vb.memory = "128"
104 vb.cpus = "1"
105 end
106 end
107end