1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
15 # vi: set ts=2 sw=2 sts=2 et ft=ruby :
17 def add_compute(config, name, mgmt_ip, port1, port2)
18 config.vm.box_check_update = false
19 config.vbguest.auto_update = true
20 config.vm.define name do |node|
21 if Vagrant.has_plugin?("vagrant-proxyconf")
23 config.proxy.http = ENV["http_proxy"]
26 config.proxy.https = ENV["https_proxy"]
29 config.proxy.no_proxy = ENV["no_proxy"]
32 node.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
33 node.vm.hostname = name
34 node.vm.provision "shell", path: "vagrant_scripts/fix-perms.sh"
35 node.vm.provision "shell", path: "vagrant_scripts/add-user.sh"
36 node.vm.provision "shell", path: "vagrant_scripts/install-prereqs.sh"
37 node.vm.provision "shell", path: "vagrant_scripts/install-java8.sh"
38 node.vm.provision "shell", path: "vagrant_scripts/install-vpp.sh"
39 node.vm.provision "shell", path: "vagrant_scripts/configure-vpp.sh"
40 node.vm.provision "shell", path: "vagrant_scripts/install-hc.sh"
42 node.vm.network "private_network", ip: mgmt_ip
43 node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port1
44 node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port2
45 node.vm.provider "virtualbox" do |vb|
48 vb.customize ["modifyvm", :id, "--ioapic", "on"]
49 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"]
50 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"]
51 vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
52 vb.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
57 def add_controller(config, name, mgmt_ip, port1, port2)
58 config.vm.box_check_update = false
59 config.vbguest.auto_update = true
60 config.vm.define name do |node|
61 if Vagrant.has_plugin?("vagrant-proxyconf")
63 config.proxy.http = ENV["http_proxy"]
66 config.proxy.https = ENV["https_proxy"]
69 config.proxy.no_proxy = ENV["no_proxy"]
72 node.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
73 node.vm.hostname = name
74 node.vm.provision "shell", path: "vagrant_scripts/fix-perms.sh"
75 node.vm.provision "shell", path: "vagrant_scripts/add-user.sh"
76 node.vm.provision "shell", path: "vagrant_scripts/install-prereqs.sh"
77 node.vm.provision "shell", path: "vagrant_scripts/install-java8.sh"
78 node.vm.provision "shell", path: "vagrant_scripts/install-vpp.sh"
79 node.vm.provision "shell", path: "vagrant_scripts/configure-vpp.sh"
80 node.vm.provision "shell", path: "vagrant_scripts/install-hc.sh"
81 node.vm.provision "shell", path: "vagrant_scripts/install-odl.sh"
83 node.vm.network "private_network", ip: mgmt_ip
84 node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port1
85 node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port2
86 node.vm.provider "virtualbox" do |vb|
89 vb.customize ["modifyvm", :id, "--ioapic", "on"]
90 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"]
91 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"]
92 vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
93 vb.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
94 vb.customize ["modifyvm", :id, "--nicpromisc5", "allow-all"]
99 # install required plugins if necessary
101 # add required plugins here
102 required_plugins = %w( vagrant-vbguest vagrant-cachier)
104 required_plugins.each do |plugin|
105 missing_plugins.push(plugin) unless Vagrant.has_plugin? plugin
108 if ! missing_plugins.empty?
109 install_these = missing_plugins.join(' ')
110 puts "Found missing plugins: #{install_these}. Installing..."
111 cmd = "vagrant plugin install #{install_these}"
112 updateResult = system( cmd )
114 puts "Plugins #{install_these} installed."
115 #restart vagrant up process
118 abort("Failed to install plugins: #{install_these}.")
121 puts "No missing plugins. Ok to continue with vagrant setup."
125 Vagrant.configure(2) do |config|
126 # vagrant-cachier caches apt/yum etc to speed subsequent
129 # vagrant plugin install vagrant-cachier
131 if Vagrant.has_plugin?("vagrant-cachier")
132 config.cache.scope = :box
135 add_controller(config, "controller", "192.168.255.100/24", "public_net", "tenant_net",)
136 add_compute(config, "compute0", "192.168.255.101/24", "public_net", "tenant_net")
137 add_compute(config, "compute1", "192.168.255.102/24", "public_net", "tenant_net")