blob: b96e535c05198fee80a905581bdba1f1fb6142bd [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 Morales472a3062018-02-02 08:26:50 -080048 :ram => 8 * 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"],
Victor Morales472a3062018-02-02 08:26:50 -0800160 :hd => { :virtualbox => "61440", :libvirt => "60G", },
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800161 :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 Morales56cd8df2018-02-12 16:51:40 -0800205 :hd => { :virtualbox => "20480", :libvirt => "20G", },
206 :fwds => [
207 { :guest => 8285, :host => 8285, :guest_ip => '192.168.50.5' },
208 ]
Idan Amit46123862017-09-19 13:43:32 +0300209 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700210 {
Idan Amit46123862017-09-19 13:43:32 +0300211 :name => "sdnc",
212 :ips => ['10.252.0.10', "192.168.50.10"],
213 :macs => [],
214 :cpus => 2,
215 :cpu => "50",
216 :ram => 4 * 1024,
217 :groups => ["individual"],
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700218 :args => ["sdnc"],
Idan Amit46123862017-09-19 13:43:32 +0300219 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700220 {
Idan Amit46123862017-09-19 13:43:32 +0300221 :name => "testing",
Victor Morales071b81c2017-11-07 14:13:07 -0800222 :ips => ['10.252.2.3', "192.168.52.3"],
Idan Amit46123862017-09-19 13:43:32 +0300223 :macs => [],
224 :cpus => 2,
225 :cpu => "50",
226 :ram => 4 * 1024,
227 :groups => ["testing"],
228 :flavor => 'm1.small',
229 :args => [""],
230 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700231 {
Idan Amit46123862017-09-19 13:43:32 +0300232 :name => "vfc",
233 :ips => ['10.252.0.15', "192.168.50.15"],
234 :macs => [],
235 :cpus => 2,
236 :cpu => "50",
237 :ram => 4 * 1024,
238 :groups => ["individual"],
239 :args => ['vfc'],
240 },
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700241 {
Idan Amit46123862017-09-19 13:43:32 +0300242 :name => "vid",
243 :ips => ['10.252.0.9', "192.168.50.9"],
244 :macs => [],
245 :cpus => 2,
246 :cpu => "50",
247 :ram => 4 * 1024,
248 :groups => ["individual"],
249 :args => ['vid'],
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700250 },
Victor Moralesd3cbcf22017-10-25 16:01:58 -0700251 {
Victor Morales071b81c2017-11-07 14:13:07 -0800252 :name => "vnfsdk",
253 :ips => ['10.252.0.18', "192.168.50.18"],
254 :macs => [],
255 :cpus => 2,
256 :cpu => "50",
257 :ram => 4 * 1024,
258 :groups => ["individual"],
259 :args => ['vnfsdk'],
Shashank Kumar Shankarf84c9a12017-10-23 11:08:31 -0700260 },
261 {
Victor Moralesd3cbcf22017-10-25 16:01:58 -0700262 :name => "vvp",
263 :ips => ['10.252.0.17', "192.168.50.17"],
264 :macs => [],
265 :cpus => 2,
266 :cpu => "50",
267 :ram => 4 * 1024,
268 :groups => ["individual"],
269 :args => ['vvp'],
Victor Morales4ab71c12017-11-08 07:28:28 -0800270 },
271 {
272 :name => "openstack",
273 :ips => ['10.252.3.3', "192.168.53.3"],
274 :macs => [],
275 :cpus => 2,
276 :cpu => "50",
277 :ram => 8 * 1024,
278 :groups => ["individual"],
279 :args => ['openstack'],
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800280 :fwds => [
281 { :guest => 80, :host => 8888, :guest_ip => '192.168.53.4' },
282 { :guest => 6080, :host => 6080, :guest_ip => '192.168.53.4' },
283 ]
Shashank Kumar Shankarf84c9a12017-10-23 11:08:31 -0700284 }
Idan Amit46123862017-09-19 13:43:32 +0300285]
286
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700287run_path = 'vagrant_utils/postinstall.sh'
288sdc_volume = 'vol1-sdc-data.vdi'
Idan Amit46123862017-09-19 13:43:32 +0300289
Victor Moralesdd074802017-07-26 16:06:35 -0500290Vagrant.require_version ">= 1.8.6"
291
Victor Moralesdd074802017-07-26 16:06:35 -0500292# Determine the provider used
293provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
Idan Amit46123862017-09-19 13:43:32 +0300294puts "[INFO] Provider: #{provider} "
295
Victor Morales89ce3212017-06-16 18:32:48 -0500296vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml')
297if File.exist?(vd_conf)
298 require 'yaml'
299 user_conf = YAML.load_file(vd_conf)
Idan Amit46123862017-09-19 13:43:32 +0300300 configuration.update(user_conf)
Victor Morales89ce3212017-06-16 18:32:48 -0500301end
302
Victor Morales6a919972017-09-28 18:29:54 -0700303# Set network interface
Areli Fussf57e9e72017-09-28 14:24:53 +0300304net_interface = 'vboxnet0'
Idan Amit46123862017-09-19 13:43:32 +0300305is_windows = Gem.win_platform?
306if is_windows
307 net_interface = 'VirtualBox Host-Only Ethernet Adapter #2'
Idan Amit46123862017-09-19 13:43:32 +0300308end
309puts "[INFO] Net interface: #{net_interface}"
310
311
Victor Morales6a919972017-09-28 18:29:54 -0700312# If argument is given use it. Otherwise use Env: DEPLOY_MODE else use default
Idan Amit46123862017-09-19 13:43:32 +0300313requested_machine = ARGV[1]
314
Victor Morales89ce3212017-06-16 18:32:48 -0500315deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual')
Idan Amit46123862017-09-19 13:43:32 +0300316if requested_machine != nil
317 if requested_machine.include?("all-in-one") || requested_machine.include?("testing")
318 deploy_mode = requested_machine
319 end
320end
321
Victor Morales6a919972017-09-28 18:29:54 -0700322# Catch the status of all machines
Idan Amit46123862017-09-19 13:43:32 +0300323if ARGV[0] == 'status' || ARGV[0] == 'destroy'
324 deploy_mode = 'NA'
325end
326
327puts "[INFO] Deploy Mode: #{deploy_mode}"
328
Victor Morales6a919972017-09-28 18:29:54 -0700329# In case of all-in-one or testing clean the nodes list
Idan Amit46123862017-09-19 13:43:32 +0300330case deploy_mode
331 when 'all-in-one'
332 nodes.select! do |node|
333 if node[:name].include?("all-in-one")
334 true if node[:name]
335 end
336 end
337
338 when 'individual'
339 nodes.select! do |node|
340 if node[:groups][0].include?("individual")
341 true if node[:name]
Idan Amit46123862017-09-19 13:43:32 +0300342 end
343 end
344
345 when 'testing'
346 nodes.select! do |node|
347 if node[:name].include?("testing")
348 true if node[:name]
349 end
350 end
351end
Victor Morales89ce3212017-06-16 18:32:48 -0500352
353Vagrant.configure("2") do |config|
354
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800355 # PROXY definitions
356 if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil
Idan Amit46123862017-09-19 13:43:32 +0300357 if not Vagrant.has_plugin?('vagrant-proxyconf')
358 system 'vagrant plugin install vagrant-proxyconf'
359 raise 'vagrant-proxyconf was installed but it requires to execute again'
360 end
Victor Morales472a3062018-02-02 08:26:50 -0800361 config.proxy.enabled = { docker: false }
Idan Amit46123862017-09-19 13:43:32 +0300362 config.proxy.http = ENV['http_proxy']
363 config.proxy.https = ENV['https_proxy']
Victor Moralescf269992017-10-18 09:29:55 -0700364 configuration['socks_proxy'] = ENV['socks_proxy']
Victor Morales89ce3212017-06-16 18:32:48 -0500365 end
Victor Morales89ce3212017-06-16 18:32:48 -0500366
Idan Amit46123862017-09-19 13:43:32 +0300367 if Vagrant.has_plugin?('vagrant-vbguest')
368 puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts'
369 config.vbguest.auto_update = false
Victor Moralesf62e7b82017-07-27 17:26:06 -0500370 end
Idan Amit46123862017-09-19 13:43:32 +0300371
Victor Morales71f7d292018-01-04 16:27:07 -0800372 sync_type = "virtualbox"
Idan Amit46123862017-09-19 13:43:32 +0300373 if provider == :libvirt
374 if not Vagrant.has_plugin?('vagrant-libvirt')
375 system 'vagrant plugin install vagrant-libvirt'
376 raise 'vagrant-libvirt was installed but it requires to execute again'
377 end
Victor Morales71f7d292018-01-04 16:27:07 -0800378 sync_type = "nfs"
Victor Moralesdd074802017-07-26 16:06:35 -0500379 end
Areli Fussf57e9e72017-09-28 14:24:53 +0300380
Idan Amit46123862017-09-19 13:43:32 +0300381 if provider == :openstack
382 config.ssh.username = 'ubuntu'
383 if not Vagrant.has_plugin?('vagrant-openstack-provider')
384 system 'vagrant plugin install vagrant-openstack-provider'
385 raise 'vagrant-openstack-provider was installed but it requires to execute again'
386 end
387 end
Victor Morales89ce3212017-06-16 18:32:48 -0500388
Idan Amit46123862017-09-19 13:43:32 +0300389 nodes.each do |node|
390 config.vm.define node[:name] do |nodeconfig|
Victor Moralesdd074802017-07-26 16:06:35 -0500391
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800392 # NO_PROXY definitions
393 if ENV['no_proxy'] != nil
394 if not Vagrant.has_plugin?('vagrant-proxyconf')
395 system 'vagrant plugin install vagrant-proxyconf'
396 raise 'vagrant-proxyconf was installed but it requires to execute again'
397 end
398 config.proxy.no_proxy = node[:ips].join(",") + "," + ENV['no_proxy']
399 end
400
Idan Amit46123862017-09-19 13:43:32 +0300401 # Common Settings:
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700402
Idan Amit46123862017-09-19 13:43:32 +0300403 nodeconfig.vm.provider "virtualbox" do |vbox|
404 vbox.customize ['modifyvm', :id, '--nictype1', 'virtio']
405 vbox.customize ['modifyvm', :id, '--audio', 'none']
406 vbox.customize ['modifyvm', :id, '--vram', '1']
407 vbox.customize ['modifyvm', :id, "--cpuhotplug", "off"]
408 vbox.customize ['modifyvm', :id, "--cpuexecutioncap", node[:cpu]]
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700409 vbox.customize ['modifyvm', :id, "--cpus", node[:cpus]]
Idan Amit46123862017-09-19 13:43:32 +0300410 vbox.customize ["modifyvm", :id, "--memory", node[:ram]]
Victor Morales9c525e42017-12-01 04:35:14 -0800411
412 # Set Network
413 nodeconfig.vm.network :private_network,
414 :adapter => 2,
415 :name => net_interface,
416 :ip => node[:ips][0]
417
418 nodeconfig.vm.network :private_network,
419 :adapter => 3,
420 :ip => node[:ips][1],
421 :type => :static
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800422
423 # Set Storage
424 if node.has_key? :hd
425 volume_file = node[:name] + '-vol1-data.vdi'
426 unless File.exist?(volume_file)
Victor Morales472a3062018-02-02 08:26:50 -0800427 vbox.customize ['createmedium', 'disk', '--filename', volume_file, '--size', node[:hd][provider]]
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800428 end
429 vbox.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', volume_file]
430 end
Victor Morales89ce3212017-06-16 18:32:48 -0500431 end
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700432
Idan Amit46123862017-09-19 13:43:32 +0300433 nodeconfig.vm.provider "libvirt" do |lbox|
434 lbox.memory = node[:ram]
435 lbox.nested = true
Victor Morales9c525e42017-12-01 04:35:14 -0800436 lbox.cpu_mode = 'host-passthrough'
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800437 lbox.cpus = node[:cpus]
Victor Morales9c525e42017-12-01 04:35:14 -0800438
439 # Set Network
440 nodeconfig.vm.network :private_network,
441 :ip => node[:ips][0]
442
443 nodeconfig.vm.network :private_network,
444 :ip => node[:ips][1],
445 :type => :static
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800446
447 # Set Storage
448 if node.has_key? :hd
Victor Morales472a3062018-02-02 08:26:50 -0800449 lbox.storage :file, bus: 'sata', device: 'sda', size: node[:hd][provider]
Victor Moralesfa9eb9c2017-12-18 09:56:13 -0800450 end
451 end
452 if node.has_key? :fwds
453 node[:fwds].each do |fwd|
454 nodeconfig.vm.network :forwarded_port,
455 :guest => fwd[:guest],
456 :guest_ip => fwd[:guest_ip],
457 :host => fwd[:host],
458 :host_ip => "0.0.0.0"
459 end
Victor Morales89ce3212017-06-16 18:32:48 -0500460 end
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700461
Idan Amit46123862017-09-19 13:43:32 +0300462 nodeconfig.vm.provider :openstack do |obox|
463 obox.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
464 obox.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
465 obox.username = ENV.fetch('OS_USERNAME', '')
466 obox.password = ENV.fetch('OS_PASSWORD', '')
467 obox.region = ENV.fetch('OS_REGION_NAME', '')
468 obox.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
469 obox.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
470 obox.project_name = ENV.fetch('OS_PROJECT_NAME', '')
471 obox.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
472 obox.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
473 obox.image = ENV.fetch('OS_IMAGE', '')
474 obox.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
475 obox.networks = ENV.fetch('OS_NETWORK', '')
476 obox.flavor = node[:flavor]
477 obox.server_name = node[:name]
Idan Amit46123862017-09-19 13:43:32 +0300478 end
Victor Moralesd4036482017-08-15 17:54:14 -0500479
Idan Amit46123862017-09-19 13:43:32 +0300480 # Set Box type
Victor Morales4ab71c12017-11-08 07:28:28 -0800481 if "openstack" == node[:name]
Victor Morales9c525e42017-12-01 04:35:14 -0800482 box = {
483 :virtualbox => 'ubuntu/xenial64',
484 :libvirt => 'elastic/ubuntu-16.04-x86_64'
485 }
Victor Morales4ab71c12017-11-08 07:28:28 -0800486 end
Victor Morales9c525e42017-12-01 04:35:14 -0800487 nodeconfig.vm.box = box[provider]
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700488
Idan Amit46123862017-09-19 13:43:32 +0300489 # Set Node name
490 nodeconfig.vm.hostname = node[:name]
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700491
Idan Amit46123862017-09-19 13:43:32 +0300492 # Set Sync Folder
493 nodeconfig.vm.synced_folder ".", "/vagrant", disabled: true
Victor Morales71f7d292018-01-04 16:27:07 -0800494 nodeconfig.vm.synced_folder './opt', '/opt/', create: true, type: sync_type
495 nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true, type: sync_type
Idan Amit46123862017-09-19 13:43:32 +0300496 if !is_windows
497 nodeconfig.vm.synced_folder '~/.m2', '/root/.m2/', create: true
498 end
Victor Morales6a919972017-09-28 18:29:54 -0700499
Idan Amit46123862017-09-19 13:43:32 +0300500 # Specific settings:
Victor Moralesdbe2e0b2017-09-20 09:55:45 -0700501
Idan Amit46123862017-09-19 13:43:32 +0300502 if node[:name].include? "testing"
503 nodeconfig.vm.synced_folder './tests', '/var/onap_tests/', create: true
504 test_suite = ENV.fetch('TEST_SUITE', '*')
505 test_case = ENV.fetch('TEST_CASE', '*')
506 # Override variables
507 run_path = 'vagrant_utils/unit_testing.sh'
508 node[:args] = [test_suite, test_case]
Victor Morales6a919972017-09-28 18:29:54 -0700509 else
510 configuration['skip_get_images'] = ENV.fetch('SKIP_GET_IMAGES', configuration['skip_get_images'])
511 configuration['skip_install'] = ENV.fetch('SKIP_INSTALL', configuration['skip_install'])
Idan Amit46123862017-09-19 13:43:32 +0300512 end
513
Idan Amit46123862017-09-19 13:43:32 +0300514 if node[:name].include? "vfc"
515 nodeconfig.vm.provision 'docker'
516 end
517
518 nodeconfig.vm.provision 'shell' do |s|
519 s.path = run_path
520 s.args = node[:args]
521 s.env = configuration
522 end
523
524 end #nodeconfig
525 end #node
526end #config