blob: 95c0ab1930e77e61e8ac320bef40c105feb91799 [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
Eric Newberryf7943382018-05-30 17:44:19 -070014rm -rf prepare
15cd install_helpers/tools && make clean
Eric Newberrye69cb692015-07-08 22:46:01 -070016SCRIPT
17
18$setup_ssh = <<SCRIPT
19mkdir -p ~/.ssh
20cp /vagrant/temp/sshkey ~/.ssh/id_rsa
21cp /vagrant/temp/sshkey.pub ~/.ssh/id_rsa.pub
22cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
23chown -R vagrant:vagrant ~/.ssh
24chmod -R 700 ~/.ssh
25SCRIPT
26
27$setup_a = <<SCRIPT
28cat > ~/.ssh/config <<EOF
29Host 192.168.*.*
30 StrictHostKeyChecking no
31EOF
32
33sudo ip route add 192.168.3.0/24 via 192.168.2.3
Eric Newberry03021712018-03-29 00:56:17 -070034sudo ip -6 addr add fd01::3/64 dev enp0s8
35sudo ip -6 addr add fd02::2/64 dev enp0s9
Eric Newberrye69cb692015-07-08 22:46:01 -070036sudo ip -6 route add fd03::/64 via fd02::3
37SCRIPT
38
39$setup_d = <<SCRIPT
40ip route add 192.168.2.0/24 via 192.168.3.2
Eric Newberry03021712018-03-29 00:56:17 -070041ip -6 addr add fd03::3/64 dev enp0s8
Eric Newberrye69cb692015-07-08 22:46:01 -070042ip -6 route add fd02::/64 via fd03::2
43SCRIPT
44
45$setup_router = <<SCRIPT
46echo 1 > /proc/sys/net/ipv4/ip_forward
47echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
Eric Newberry03021712018-03-29 00:56:17 -070048ip -6 addr add fd02::3/64 dev enp0s8
49ip -6 addr add fd03::2/64 dev enp0s9
Eric Newberrye69cb692015-07-08 22:46:01 -070050SCRIPT
51
52Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
Eric Newberry03021712018-03-29 00:56:17 -070053 config.vm.box = "ndn-jenkins/ubuntu1604-amd64"
Eric Newberrye69cb692015-07-08 22:46:01 -070054
55 config.vm.provider "virtualbox" do |vb|
Eric Newberry59094fc2017-11-02 00:41:32 -070056 vb.memory = "512"
Eric Newberry8ab30bb2015-09-26 11:56:40 -070057 vb.cpus = "1"
Eric Newberry03021712018-03-29 00:56:17 -070058 vb.customize ["storagectl", :id, "--name", "SATA Controller", "--hostiocache", "off"]
Eric Newberrye69cb692015-07-08 22:46:01 -070059 end
60
Eric Newberry8ab30bb2015-09-26 11:56:40 -070061 config.vm.define "template" do |t|
62 t.vm.provision "shell", inline: $setup, privileged: false
63 t.vm.provision "shell", inline: $setup_ssh, privileged: false
64 t.vm.provision "shell", inline: $setup_integ, privileged: false
Eric Newberry59094fc2017-11-02 00:41:32 -070065 config.vm.provider "virtualbox" do |vb|
66 vb.memory = "6144"
67 vb.cpus = "4"
68 end
Eric Newberry8ab30bb2015-09-26 11:56:40 -070069 end
70
Eric Newberrye69cb692015-07-08 22:46:01 -070071 config.vm.define "A" do |a|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070072 a.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070073 a.vm.network "private_network", ip: "192.168.1.3", virtualbox__intnet: "ABC-switch"
74 a.vm.network "private_network", ip: "192.168.2.2", virtualbox__intnet: "AtoRouter"
75 a.vm.provision "shell", inline: $setup, privileged: false
76 a.vm.provision "shell", inline: $setup_a, privileged: false
Eric Newberrye69cb692015-07-08 22:46:01 -070077 end
78
79 config.vm.define "B" do |b|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070080 b.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070081 b.vm.network "private_network", ip: "192.168.1.2", virtualbox__intnet: "ABC-switch"
82 b.vm.provision "shell", inline: $setup, privileged: false
Eric Newberry03021712018-03-29 00:56:17 -070083 b.vm.provision "shell", inline: "ip -6 addr add fd01::2/64 dev enp0s8"
Eric Newberrye69cb692015-07-08 22:46:01 -070084 end
85
86 config.vm.define "C" do |c|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070087 c.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070088 c.vm.network "private_network", ip: "192.168.1.4", virtualbox__intnet: "ABC-switch"
89 c.vm.provision "shell", inline: $setup, privileged: false
Eric Newberry03021712018-03-29 00:56:17 -070090 c.vm.provision "shell", inline: "ip -6 addr add fd01::4/64 dev enp0s8"
Eric Newberrye69cb692015-07-08 22:46:01 -070091 end
92
93 config.vm.define "D" do |d|
Eric Newberry8ab30bb2015-09-26 11:56:40 -070094 d.vm.box = "nfd-integ"
Eric Newberrye69cb692015-07-08 22:46:01 -070095 d.vm.network "private_network", ip: "192.168.3.3", virtualbox__intnet: "DtoRouter"
96 d.vm.provision "shell", inline: $setup, privileged: false
97 d.vm.provision "shell", inline: $setup_d
Eric Newberrye69cb692015-07-08 22:46:01 -070098 end
99
100 config.vm.define "router" do |router|
101 router.vm.network "private_network", ip: "192.168.2.3", virtualbox__intnet: "AtoRouter"
102 router.vm.network "private_network", ip: "192.168.3.2", virtualbox__intnet: "DtoRouter"
103 router.vm.provision "shell", inline: $setup_router
104 router.vm.provider "virtualbox" do |vb|
Eric Newberry03021712018-03-29 00:56:17 -0700105 vb.memory = "256"
Eric Newberrye69cb692015-07-08 22:46:01 -0700106 vb.cpus = "1"
107 end
108 end
109end