Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # vi: set ft=ruby : |
| 3 | |
| 4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! |
| 5 | VAGRANTFILE_API_VERSION = "2" |
| 6 | |
| 7 | $setup = <<SCRIPT |
| 8 | sudo apt-get update -qq |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 9 | SCRIPT |
| 10 | |
| 11 | $setup_integ = <<SCRIPT |
| 12 | cp -R /vagrant integration-tests |
| 13 | cd integration-tests && ./install_apps.py install_all 2>&1 | tee install.log |
Eric Newberry | f794338 | 2018-05-30 17:44:19 -0700 | [diff] [blame] | 14 | rm -rf prepare |
| 15 | cd install_helpers/tools && make clean |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 16 | SCRIPT |
| 17 | |
| 18 | $setup_ssh = <<SCRIPT |
| 19 | mkdir -p ~/.ssh |
| 20 | cp /vagrant/temp/sshkey ~/.ssh/id_rsa |
| 21 | cp /vagrant/temp/sshkey.pub ~/.ssh/id_rsa.pub |
| 22 | cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys |
| 23 | chown -R vagrant:vagrant ~/.ssh |
| 24 | chmod -R 700 ~/.ssh |
| 25 | SCRIPT |
| 26 | |
| 27 | $setup_a = <<SCRIPT |
| 28 | cat > ~/.ssh/config <<EOF |
| 29 | Host 192.168.*.* |
| 30 | StrictHostKeyChecking no |
| 31 | EOF |
| 32 | |
| 33 | sudo ip route add 192.168.3.0/24 via 192.168.2.3 |
Eric Newberry | 0302171 | 2018-03-29 00:56:17 -0700 | [diff] [blame] | 34 | sudo ip -6 addr add fd01::3/64 dev enp0s8 |
| 35 | sudo ip -6 addr add fd02::2/64 dev enp0s9 |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 36 | sudo ip -6 route add fd03::/64 via fd02::3 |
| 37 | SCRIPT |
| 38 | |
| 39 | $setup_d = <<SCRIPT |
| 40 | ip route add 192.168.2.0/24 via 192.168.3.2 |
Eric Newberry | 0302171 | 2018-03-29 00:56:17 -0700 | [diff] [blame] | 41 | ip -6 addr add fd03::3/64 dev enp0s8 |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 42 | ip -6 route add fd02::/64 via fd03::2 |
| 43 | SCRIPT |
| 44 | |
| 45 | $setup_router = <<SCRIPT |
| 46 | echo 1 > /proc/sys/net/ipv4/ip_forward |
| 47 | echo 1 > /proc/sys/net/ipv6/conf/all/forwarding |
Eric Newberry | 0302171 | 2018-03-29 00:56:17 -0700 | [diff] [blame] | 48 | ip -6 addr add fd02::3/64 dev enp0s8 |
| 49 | ip -6 addr add fd03::2/64 dev enp0s9 |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 50 | SCRIPT |
| 51 | |
| 52 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
Eric Newberry | 0302171 | 2018-03-29 00:56:17 -0700 | [diff] [blame] | 53 | config.vm.box = "ndn-jenkins/ubuntu1604-amd64" |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 54 | |
| 55 | config.vm.provider "virtualbox" do |vb| |
Eric Newberry | 59094fc | 2017-11-02 00:41:32 -0700 | [diff] [blame] | 56 | vb.memory = "512" |
Eric Newberry | 8ab30bb | 2015-09-26 11:56:40 -0700 | [diff] [blame] | 57 | vb.cpus = "1" |
Eric Newberry | 0302171 | 2018-03-29 00:56:17 -0700 | [diff] [blame] | 58 | vb.customize ["storagectl", :id, "--name", "SATA Controller", "--hostiocache", "off"] |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 59 | end |
| 60 | |
Eric Newberry | 8ab30bb | 2015-09-26 11:56:40 -0700 | [diff] [blame] | 61 | 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 Newberry | 59094fc | 2017-11-02 00:41:32 -0700 | [diff] [blame] | 65 | config.vm.provider "virtualbox" do |vb| |
| 66 | vb.memory = "6144" |
| 67 | vb.cpus = "4" |
| 68 | end |
Eric Newberry | 8ab30bb | 2015-09-26 11:56:40 -0700 | [diff] [blame] | 69 | end |
| 70 | |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 71 | config.vm.define "A" do |a| |
Eric Newberry | 8ab30bb | 2015-09-26 11:56:40 -0700 | [diff] [blame] | 72 | a.vm.box = "nfd-integ" |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 73 | 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 Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 77 | end |
| 78 | |
| 79 | config.vm.define "B" do |b| |
Eric Newberry | 8ab30bb | 2015-09-26 11:56:40 -0700 | [diff] [blame] | 80 | b.vm.box = "nfd-integ" |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 81 | b.vm.network "private_network", ip: "192.168.1.2", virtualbox__intnet: "ABC-switch" |
| 82 | b.vm.provision "shell", inline: $setup, privileged: false |
Eric Newberry | 0302171 | 2018-03-29 00:56:17 -0700 | [diff] [blame] | 83 | b.vm.provision "shell", inline: "ip -6 addr add fd01::2/64 dev enp0s8" |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 84 | end |
| 85 | |
| 86 | config.vm.define "C" do |c| |
Eric Newberry | 8ab30bb | 2015-09-26 11:56:40 -0700 | [diff] [blame] | 87 | c.vm.box = "nfd-integ" |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 88 | c.vm.network "private_network", ip: "192.168.1.4", virtualbox__intnet: "ABC-switch" |
| 89 | c.vm.provision "shell", inline: $setup, privileged: false |
Eric Newberry | 0302171 | 2018-03-29 00:56:17 -0700 | [diff] [blame] | 90 | c.vm.provision "shell", inline: "ip -6 addr add fd01::4/64 dev enp0s8" |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 91 | end |
| 92 | |
| 93 | config.vm.define "D" do |d| |
Eric Newberry | 8ab30bb | 2015-09-26 11:56:40 -0700 | [diff] [blame] | 94 | d.vm.box = "nfd-integ" |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 95 | 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 Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 98 | 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 Newberry | 0302171 | 2018-03-29 00:56:17 -0700 | [diff] [blame] | 105 | vb.memory = "256" |
Eric Newberry | e69cb69 | 2015-07-08 22:46:01 -0700 | [diff] [blame] | 106 | vb.cpus = "1" |
| 107 | end |
| 108 | end |
| 109 | end |