blob: 6d7900bf36ced5725fa24e005dda15d5a9a1ef6f [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
Idan Amit46123862017-09-19 13:43:32 +03004configuration = {
5 # Generic parameters used across all ONAP components
Victor Morales89ce3212017-06-16 18:32:48 -05006 'key_name' => 'ecomp_key',
7 'pub_key' => '',
8 'nexus_repo' => 'https://nexus.onap.org/content/sites/raw',
Victor Morales6a919972017-09-28 18:29:54 -07009 'nexus_repo_root' => 'https://nexus.onap.org',
10 'nexus_url_snapshot' => 'https://nexus.onap.org/content/repositories/snapshots',
Victor Morales89ce3212017-06-16 18:32:48 -050011 'nexus_docker_repo' => 'nexus3.onap.org:10001',
12 'nexus_username' => 'docker',
13 'nexus_password' => 'docker',
14 'dmaap_topic' => 'AUTO',
15 'artifacts_version' => '1.0.0',
Victor Morales5d21f642017-12-07 11:54:59 -080016 'docker_version' => 'latest',
Victor Morales6a919972017-09-28 18:29:54 -070017 # Parameters for DCAE instantiation
Victor Morales89ce3212017-06-16 18:32:48 -050018 'dcae_zone' => 'iad4',
19 'dcae_state' => 'vi',
20 'openstack_tenant_id' => '',
21 'openstack_username' => '',
22 'openstack_api_key' => '',
23 'openstack_password' => '',
Victor Moralesdd074802017-07-26 16:06:35 -050024 'odl_version' => '0.5.3-Boron-SR3',
Victor Morales6a919972017-09-28 18:29:54 -070025 # Parameters for enabling features
Victor Morales7abf1a82017-11-06 09:20:27 -080026 'debug' => 'True',
Victor Morales6a919972017-09-28 18:29:54 -070027 'build_image' => 'True',
Idan Amit1690e082017-08-20 08:58:14 +030028 'clone_repo' => 'True',
Victor Morales2909e2e2017-08-08 15:51:52 -050029 'compile_repo' => 'False',
Victor Morales6a919972017-09-28 18:29:54 -070030 'enable_oparent' => 'True',
31 'skip_get_images' => 'False',
32 'skip_install' => 'True'
Victor Morales89ce3212017-06-16 18:32:48 -050033}
34
Idan Amit46123862017-09-19 13:43:32 +030035box = {
36 :virtualbox => 'ubuntu/trusty64',
Victor Morales9c525e42017-12-01 04:35:14 -080037 :libvirt => 'elastic/ubuntu-14.04-x86_64',
Idan Amit46123862017-09-19 13:43:32 +030038 :openstack => nil
39}
40
Idan Amit46123862017-09-19 13:43:32 +030041nodes = [
Victor Moralesdbe2e0b2017-09-20 09:55:45 -070042 {
Idan Amit46123862017-09-19 13:43:32 +030043 :name => "aai",
44 :ips => ['10.252.0.6', "192.168.50.6"],
45 :macs => [],
46 :cpus => 2,
47 :cpu => "50",
Victor Moralesbe844712018-01-22 10:07:28 -080048 :ram => 6 * 1024,
Idan Amit46123862017-09-19 13:43:32 +030049 :groups => ["individual"],
Victor Moralesbe844712018-01-22 10:07:28 -080050 :args => ["aai"],
51 :fwds => [
52 { :guest => 8446, :host => 8446, :guest_ip => '192.168.50.6' },
53 { :guest => 9446, :host => 9446, :guest_ip => '192.168.50.6' },
54 ]
Idan Amit46123862017-09-19 13:43:32 +030055 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -070056 {
Idan Amit46123862017-09-19 13:43:32 +030057 :name => "all-in-one",
Victor Morales071b81c2017-11-07 14:13:07 -080058 :ips => ['10.252.1.3', "192.168.51.3"],
Idan Amit46123862017-09-19 13:43:32 +030059 :macs => [],
60 :cpus => 2,
61 :cpu => "50",
62 :ram => 12 * 1024,
63 :groups => ["all-in-one"],
64 :flavor => 'm1.xlarge',
Victor Morales9d205bc2017-12-01 17:52:07 -080065 :args => ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc', 'ccsdk', 'multicloud', 'vnfsdk', 'vpp', 'msb'],
Idan Amit46123862017-09-19 13:43:32 +030066 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -070067 {
Idan Amit46123862017-09-19 13:43:32 +030068 :name => "appc",
69 :ips => ['10.252.0.14', "192.168.50.14"],
70 :macs => [],
71 :cpus => 2,
72 :cpu => "50",
73 :ram => 4 * 1024,
74 :groups => ["individual"],
75 :args => ["appc"],
76 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -070077 {
Idan Amit46123862017-09-19 13:43:32 +030078 :name => "ccsdk",
Victor Morales9d205bc2017-12-01 17:52:07 -080079 :ips => ['10.252.0.19', "192.168.50.19"],
Idan Amit46123862017-09-19 13:43:32 +030080 :macs => [],
81 :cpus => 2,
82 :cpu => "50",
83 :ram => 4 * 1024,
84 :groups => ["individual"],
85 :args => ["ccsdk"],
86 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -070087 {
Idan Amit46123862017-09-19 13:43:32 +030088 :name => "dcae",
89 :ips => ['10.252.0.12', "192.168.50.12"],
90 :macs => [],
91 :cpus => 2,
92 :cpu => "50",
93 :ram => 4 * 1024,
94 :groups => ["individual"],
95 :args => ["dcae"],
96 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -070097 {
Idan Amit46123862017-09-19 13:43:32 +030098 :name => "dns",
99 :ips => ['10.252.0.3', "192.168.50.3"],
100 :macs => [],
101 :cpus => 2,
102 :cpu => "50",
103 :ram => 1 * 1024,
104 :groups => ["individual"],
105 :flavor => 'm1.small',
106 :args => [" "]
107 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700108 {
Idan Amit46123862017-09-19 13:43:32 +0300109 :name => "message-router",
110 :ips => ['10.252.0.4', "192.168.50.4"],
111 :macs => [],
112 :cpus => 2,
113 :cpu => "50",
114 :ram => 4 * 1024,
115 :groups => ["individual"],
116 :args => ["mr"],
117 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700118 {
Idan Amit46123862017-09-19 13:43:32 +0300119 :name => "mso",
Victor Morales9d205bc2017-12-01 17:52:07 -0800120 :ips => ['10.252.0.20', "192.168.50.20"],
Idan Amit46123862017-09-19 13:43:32 +0300121 :macs => [],
122 :cpus => 2,
123 :cpu => "50",
124 :ram => 4 * 1024,
125 :groups => ["individual"],
126 :args => ["mso"],
127 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700128 {
Victor Morales9d205bc2017-12-01 17:52:07 -0800129 :name => "msb",
130 :ips => ['10.252.0.7', "192.168.50.7"],
131 :macs => [],
132 :cpus => 2,
133 :cpu => "50",
134 :ram => 4 * 1024,
135 :groups => ["individual"],
136 :args => ["msb"],
137 },
138 {
Idan Amit46123862017-09-19 13:43:32 +0300139 :name => "multicloud",
140 :ips => ['10.252.0.16', "192.168.50.16"],
141 :macs => [],
142 :cpus => 2,
143 :cpu => "50",
144 :ram => 4 * 1024,
145 :groups => ["individual"],
146 :args => ["multicloud"],
Victor Morales71f7d292018-01-04 16:27:07 -0800147 :fwds => [
148 { :guest => 9003, :host => 9003, :guest_ip => '192.168.50.16' },
149 ]
Idan Amit46123862017-09-19 13:43:32 +0300150 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700151 {
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800152 :name => "oom",
153 :ips => ['10.252.0.21', "192.168.50.21"],
154 :macs => [],
155 :cpus => 16,
156 :cpu => "50",
157 :ram => 64 * 1024,
158 :groups => ["individual"],
159 :args => ["oom"],
160 :hd => "60G",
161 :fwds => [
162 { :guest => 8880, :host => 8880, :guest_ip => '192.168.50.21' },
163 { :guest => 8989, :host => 8989, :guest_ip => '192.168.50.21' },
164 ]
165 },
166 {
Idan Amit46123862017-09-19 13:43:32 +0300167 :name => "policy",
168 :ips => ['10.252.0.13', "192.168.50.13"],
169 :macs => [],
170 :cpus => 2,
171 :cpu => "50",
172 :ram => 4 * 1024,
173 :groups => ["individual"],
174 :args => ["policy"],
175 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700176 {
Idan Amit46123862017-09-19 13:43:32 +0300177 :name => "portal",
178 :ips => ['10.252.0.11', "192.168.50.11"],
179 :macs => [],
180 :cpus => 2,
181 :cpu => "50",
182 :ram => 4 * 1024,
183 :groups => ["individual"],
184 :args => ["portal"],
185 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700186 {
Idan Amit46123862017-09-19 13:43:32 +0300187 :name => "robot",
188 :ips => ['10.252.0.8', "192.168.50.8"],
189 :macs => [],
190 :cpus => 2,
191 :cpu => "50",
192 :ram => 4 * 1024,
193 :groups => ["individual"],
194 :args => ["robot"],
195 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700196 {
Idan Amit46123862017-09-19 13:43:32 +0300197 :name => "sdc",
198 :ips => ['10.252.0.5', "192.168.50.5"],
199 :macs => [],
200 :cpus => 2,
201 :cpu => "50",
202 :ram => 8 * 1024,
203 :groups => ["individual"],
204 :args => ["sdc"],
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800205 :hd => "20G",
Idan Amit46123862017-09-19 13:43:32 +0300206 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700207 {
Idan Amit46123862017-09-19 13:43:32 +0300208 :name => "sdnc",
209 :ips => ['10.252.0.10', "192.168.50.10"],
210 :macs => [],
211 :cpus => 2,
212 :cpu => "50",
213 :ram => 4 * 1024,
214 :groups => ["individual"],
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700215 :args => ["sdnc"],
Idan Amit46123862017-09-19 13:43:32 +0300216 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700217 {
Idan Amit46123862017-09-19 13:43:32 +0300218 :name => "testing",
Victor Morales071b81c2017-11-07 14:13:07 -0800219 :ips => ['10.252.2.3', "192.168.52.3"],
Idan Amit46123862017-09-19 13:43:32 +0300220 :macs => [],
221 :cpus => 2,
222 :cpu => "50",
223 :ram => 4 * 1024,
224 :groups => ["testing"],
225 :flavor => 'm1.small',
226 :args => [""],
227 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700228 {
Idan Amit46123862017-09-19 13:43:32 +0300229 :name => "vfc",
230 :ips => ['10.252.0.15', "192.168.50.15"],
231 :macs => [],
232 :cpus => 2,
233 :cpu => "50",
234 :ram => 4 * 1024,
235 :groups => ["individual"],
236 :args => ['vfc'],
237 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700238 {
Idan Amit46123862017-09-19 13:43:32 +0300239 :name => "vid",
240 :ips => ['10.252.0.9', "192.168.50.9"],
241 :macs => [],
242 :cpus => 2,
243 :cpu => "50",
244 :ram => 4 * 1024,
245 :groups => ["individual"],
246 :args => ['vid'],
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700247 },
Victor Moralesd3cbcf22017-10-25 16:01:58 -0700248 {
Victor Morales071b81c2017-11-07 14:13:07 -0800249 :name => "vnfsdk",
250 :ips => ['10.252.0.18', "192.168.50.18"],
251 :macs => [],
252 :cpus => 2,
253 :cpu => "50",
254 :ram => 4 * 1024,
255 :groups => ["individual"],
256 :args => ['vnfsdk'],
Shashank Kumar Shankarf84c9a12017-10-23 11:08:31 -0700257 },
258 {
Victor Moralesd3cbcf22017-10-25 16:01:58 -0700259 :name => "vvp",
260 :ips => ['10.252.0.17', "192.168.50.17"],
261 :macs => [],
262 :cpus => 2,
263 :cpu => "50",
264 :ram => 4 * 1024,
265 :groups => ["individual"],
266 :args => ['vvp'],
Victor Morales4ab71c12017-11-08 07:28:28 -0800267 },
268 {
269 :name => "openstack",
270 :ips => ['10.252.3.3', "192.168.53.3"],
271 :macs => [],
272 :cpus => 2,
273 :cpu => "50",
274 :ram => 8 * 1024,
275 :groups => ["individual"],
276 :args => ['openstack'],
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800277 :fwds => [
278 { :guest => 80, :host => 8888, :guest_ip => '192.168.53.4' },
279 { :guest => 6080, :host => 6080, :guest_ip => '192.168.53.4' },
280 ]
Shashank Kumar Shankarf84c9a12017-10-23 11:08:31 -0700281 }
Idan Amit46123862017-09-19 13:43:32 +0300282]
283
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700284run_path = 'vagrant_utils/postinstall.sh'
285sdc_volume = 'vol1-sdc-data.vdi'
Idan Amit46123862017-09-19 13:43:32 +0300286
Victor Moralesdd074802017-07-26 16:06:35 -0500287Vagrant.require_version ">= 1.8.6"
288
Victor Moralesdd074802017-07-26 16:06:35 -0500289# Determine the provider used
290provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
Idan Amit46123862017-09-19 13:43:32 +0300291puts "[INFO] Provider: #{provider} "
292
Victor Morales89ce3212017-06-16 18:32:48 -0500293vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml')
294if File.exist?(vd_conf)
295 require 'yaml'
296 user_conf = YAML.load_file(vd_conf)
Idan Amit46123862017-09-19 13:43:32 +0300297 configuration.update(user_conf)
Victor Morales89ce3212017-06-16 18:32:48 -0500298end
299
Victor Morales6a919972017-09-28 18:29:54 -0700300# Set network interface
Areli Fussf57e9e72017-09-28 14:24:53 +0300301net_interface = 'vboxnet0'
Idan Amit46123862017-09-19 13:43:32 +0300302is_windows = Gem.win_platform?
303if is_windows
304 net_interface = 'VirtualBox Host-Only Ethernet Adapter #2'
Idan Amit46123862017-09-19 13:43:32 +0300305end
306puts "[INFO] Net interface: #{net_interface}"
307
308
Victor Morales6a919972017-09-28 18:29:54 -0700309# If argument is given use it. Otherwise use Env: DEPLOY_MODE else use default
Idan Amit46123862017-09-19 13:43:32 +0300310requested_machine = ARGV[1]
311
Victor Morales89ce3212017-06-16 18:32:48 -0500312deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual')
Idan Amit46123862017-09-19 13:43:32 +0300313if requested_machine != nil
314 if requested_machine.include?("all-in-one") || requested_machine.include?("testing")
315 deploy_mode = requested_machine
316 end
317end
318
Victor Morales6a919972017-09-28 18:29:54 -0700319# Catch the status of all machines
Idan Amit46123862017-09-19 13:43:32 +0300320if ARGV[0] == 'status' || ARGV[0] == 'destroy'
321 deploy_mode = 'NA'
322end
323
324puts "[INFO] Deploy Mode: #{deploy_mode}"
325
Victor Morales6a919972017-09-28 18:29:54 -0700326# In case of all-in-one or testing clean the nodes list
Idan Amit46123862017-09-19 13:43:32 +0300327case deploy_mode
328 when 'all-in-one'
329 nodes.select! do |node|
330 if node[:name].include?("all-in-one")
331 true if node[:name]
332 end
333 end
334
335 when 'individual'
336 nodes.select! do |node|
337 if node[:groups][0].include?("individual")
338 true if node[:name]
Idan Amit46123862017-09-19 13:43:32 +0300339 end
340 end
341
342 when 'testing'
343 nodes.select! do |node|
344 if node[:name].include?("testing")
345 true if node[:name]
346 end
347 end
348end
Victor Morales89ce3212017-06-16 18:32:48 -0500349
350Vagrant.configure("2") do |config|
351
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800352 # PROXY definitions
353 if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil
Idan Amit46123862017-09-19 13:43:32 +0300354 if not Vagrant.has_plugin?('vagrant-proxyconf')
355 system 'vagrant plugin install vagrant-proxyconf'
356 raise 'vagrant-proxyconf was installed but it requires to execute again'
357 end
358 config.proxy.http = ENV['http_proxy']
359 config.proxy.https = ENV['https_proxy']
Victor Moralescf269992017-10-18 09:29:55 -0700360 configuration['socks_proxy'] = ENV['socks_proxy']
Victor Morales89ce3212017-06-16 18:32:48 -0500361 end
Victor Morales89ce3212017-06-16 18:32:48 -0500362
Idan Amit46123862017-09-19 13:43:32 +0300363 if Vagrant.has_plugin?('vagrant-vbguest')
364 puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts'
365 config.vbguest.auto_update = false
Victor Moralesf62e7b82017-07-27 17:26:06 -0500366 end
Idan Amit46123862017-09-19 13:43:32 +0300367
Victor Morales71f7d292018-01-04 16:27:07 -0800368 sync_type = "virtualbox"
Idan Amit46123862017-09-19 13:43:32 +0300369 if provider == :libvirt
370 if not Vagrant.has_plugin?('vagrant-libvirt')
371 system 'vagrant plugin install vagrant-libvirt'
372 raise 'vagrant-libvirt was installed but it requires to execute again'
373 end
Victor Morales71f7d292018-01-04 16:27:07 -0800374 sync_type = "nfs"
Victor Moralesdd074802017-07-26 16:06:35 -0500375 end
Areli Fussf57e9e72017-09-28 14:24:53 +0300376
Idan Amit46123862017-09-19 13:43:32 +0300377 if provider == :openstack
378 config.ssh.username = 'ubuntu'
379 if not Vagrant.has_plugin?('vagrant-openstack-provider')
380 system 'vagrant plugin install vagrant-openstack-provider'
381 raise 'vagrant-openstack-provider was installed but it requires to execute again'
382 end
383 end
Victor Morales89ce3212017-06-16 18:32:48 -0500384
Idan Amit46123862017-09-19 13:43:32 +0300385 nodes.each do |node|
386 config.vm.define node[:name] do |nodeconfig|
Victor Moralesdd074802017-07-26 16:06:35 -0500387
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800388 # NO_PROXY definitions
389 if ENV['no_proxy'] != nil
390 if not Vagrant.has_plugin?('vagrant-proxyconf')
391 system 'vagrant plugin install vagrant-proxyconf'
392 raise 'vagrant-proxyconf was installed but it requires to execute again'
393 end
394 config.proxy.no_proxy = node[:ips].join(",") + "," + ENV['no_proxy']
395 end
396
Idan Amit46123862017-09-19 13:43:32 +0300397 # Common Settings:
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700398
Idan Amit46123862017-09-19 13:43:32 +0300399 nodeconfig.vm.provider "virtualbox" do |vbox|
400 vbox.customize ['modifyvm', :id, '--nictype1', 'virtio']
401 vbox.customize ['modifyvm', :id, '--audio', 'none']
402 vbox.customize ['modifyvm', :id, '--vram', '1']
403 vbox.customize ['modifyvm', :id, "--cpuhotplug", "off"]
404 vbox.customize ['modifyvm', :id, "--cpuexecutioncap", node[:cpu]]
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700405 vbox.customize ['modifyvm', :id, "--cpus", node[:cpus]]
Idan Amit46123862017-09-19 13:43:32 +0300406 vbox.customize ["modifyvm", :id, "--memory", node[:ram]]
Victor Morales9c525e42017-12-01 04:35:14 -0800407
408 # Set Network
409 nodeconfig.vm.network :private_network,
410 :adapter => 2,
411 :name => net_interface,
412 :ip => node[:ips][0]
413
414 nodeconfig.vm.network :private_network,
415 :adapter => 3,
416 :ip => node[:ips][1],
417 :type => :static
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800418
419 # Set Storage
420 if node.has_key? :hd
421 volume_file = node[:name] + '-vol1-data.vdi'
422 unless File.exist?(volume_file)
423 vbox.customize ['createhd', '--filename', volume_file, '--size', node[:hd]]
424 end
425 vbox.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', volume_file]
426 end
Victor Morales89ce3212017-06-16 18:32:48 -0500427 end
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700428
Idan Amit46123862017-09-19 13:43:32 +0300429 nodeconfig.vm.provider "libvirt" do |lbox|
430 lbox.memory = node[:ram]
431 lbox.nested = true
Victor Morales9c525e42017-12-01 04:35:14 -0800432 lbox.cpu_mode = 'host-passthrough'
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800433 lbox.cpus = node[:cpus]
Victor Morales9c525e42017-12-01 04:35:14 -0800434
435 # Set Network
436 nodeconfig.vm.network :private_network,
437 :ip => node[:ips][0]
438
439 nodeconfig.vm.network :private_network,
440 :ip => node[:ips][1],
441 :type => :static
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800442
443 # Set Storage
444 if node.has_key? :hd
445 lbox.storage :file, bus: 'sata', device: 'sda', size: node[:hd]
446 end
447 end
448 if node.has_key? :fwds
449 node[:fwds].each do |fwd|
450 nodeconfig.vm.network :forwarded_port,
451 :guest => fwd[:guest],
452 :guest_ip => fwd[:guest_ip],
453 :host => fwd[:host],
454 :host_ip => "0.0.0.0"
455 end
Victor Morales89ce3212017-06-16 18:32:48 -0500456 end
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700457
Idan Amit46123862017-09-19 13:43:32 +0300458 nodeconfig.vm.provider :openstack do |obox|
459 obox.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
460 obox.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
461 obox.username = ENV.fetch('OS_USERNAME', '')
462 obox.password = ENV.fetch('OS_PASSWORD', '')
463 obox.region = ENV.fetch('OS_REGION_NAME', '')
464 obox.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
465 obox.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
466 obox.project_name = ENV.fetch('OS_PROJECT_NAME', '')
467 obox.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
468 obox.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
469 obox.image = ENV.fetch('OS_IMAGE', '')
470 obox.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
471 obox.networks = ENV.fetch('OS_NETWORK', '')
472 obox.flavor = node[:flavor]
473 obox.server_name = node[:name]
Idan Amit46123862017-09-19 13:43:32 +0300474 end
Victor Moralesd4036482017-08-15 17:54:14 -0500475
Idan Amit46123862017-09-19 13:43:32 +0300476 # Set Box type
Victor Morales4ab71c12017-11-08 07:28:28 -0800477 if "openstack" == node[:name]
Victor Morales9c525e42017-12-01 04:35:14 -0800478 box = {
479 :virtualbox => 'ubuntu/xenial64',
480 :libvirt => 'elastic/ubuntu-16.04-x86_64'
481 }
Victor Morales4ab71c12017-11-08 07:28:28 -0800482 end
Victor Morales9c525e42017-12-01 04:35:14 -0800483 nodeconfig.vm.box = box[provider]
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700484
Idan Amit46123862017-09-19 13:43:32 +0300485 # Set Node name
486 nodeconfig.vm.hostname = node[:name]
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700487
Idan Amit46123862017-09-19 13:43:32 +0300488 # Set Sync Folder
489 nodeconfig.vm.synced_folder ".", "/vagrant", disabled: true
Victor Morales71f7d292018-01-04 16:27:07 -0800490 nodeconfig.vm.synced_folder './opt', '/opt/', create: true, type: sync_type
491 nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true, type: sync_type
Idan Amit46123862017-09-19 13:43:32 +0300492 if !is_windows
493 nodeconfig.vm.synced_folder '~/.m2', '/root/.m2/', create: true
494 end
Victor Morales6a919972017-09-28 18:29:54 -0700495
Idan Amit46123862017-09-19 13:43:32 +0300496 # Specific settings:
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700497
Idan Amit46123862017-09-19 13:43:32 +0300498 if node[:name].include? "testing"
499 nodeconfig.vm.synced_folder './tests', '/var/onap_tests/', create: true
500 test_suite = ENV.fetch('TEST_SUITE', '*')
501 test_case = ENV.fetch('TEST_CASE', '*')
502 # Override variables
503 run_path = 'vagrant_utils/unit_testing.sh'
504 node[:args] = [test_suite, test_case]
Victor Morales6a919972017-09-28 18:29:54 -0700505 else
506 configuration['skip_get_images'] = ENV.fetch('SKIP_GET_IMAGES', configuration['skip_get_images'])
507 configuration['skip_install'] = ENV.fetch('SKIP_INSTALL', configuration['skip_install'])
Idan Amit46123862017-09-19 13:43:32 +0300508 end
509
Idan Amit46123862017-09-19 13:43:32 +0300510 if node[:name].include? "vfc"
511 nodeconfig.vm.provision 'docker'
512 end
513
514 nodeconfig.vm.provision 'shell' do |s|
515 s.path = run_path
516 s.args = node[:args]
517 s.env = configuration
518 end
519
520 end #nodeconfig
521 end #node
522end #config