5 # Generic parameters used across all ONAP components
6 'key_name' => 'ecomp_key',
8 'nexus_repo' => 'https://nexus.onap.org/content/sites/raw',
9 'nexus_repo_root' => 'https://nexus.onap.org',
10 'nexus_url_snapshot' => 'https://nexus.onap.org/content/repositories/snapshots',
11 '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',
16 'docker_version' => 'latest',
17 # Parameters for DCAE instantiation
18 'dcae_zone' => 'iad4',
20 'openstack_tenant_id' => '',
21 'openstack_username' => '',
22 'openstack_api_key' => '',
23 'openstack_password' => '',
24 'odl_version' => '0.5.3-Boron-SR3',
25 # Parameters for enabling features
27 'build_image' => 'True',
28 'clone_repo' => 'True',
29 'compile_repo' => 'False',
30 'enable_oparent' => 'True',
31 'skip_get_images' => 'False',
32 'skip_install' => 'True'
36 :virtualbox => 'ubuntu/trusty64',
37 :libvirt => 'elastic/ubuntu-14.04-x86_64',
44 :ips => ['10.252.0.6', "192.168.50.6"],
49 :groups => ["individual"],
53 :name => "all-in-one",
54 :ips => ['10.252.1.3', "192.168.51.3"],
59 :groups => ["all-in-one"],
60 :flavor => 'm1.xlarge',
61 :args => ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc', 'ccsdk', 'multicloud', 'vnfsdk', 'vpp', 'msb'],
65 :ips => ['10.252.0.14', "192.168.50.14"],
70 :groups => ["individual"],
75 :ips => ['10.252.0.19', "192.168.50.19"],
80 :groups => ["individual"],
85 :ips => ['10.252.0.12', "192.168.50.12"],
90 :groups => ["individual"],
95 :ips => ['10.252.0.3', "192.168.50.3"],
100 :groups => ["individual"],
101 :flavor => 'm1.small',
105 :name => "message-router",
106 :ips => ['10.252.0.4', "192.168.50.4"],
111 :groups => ["individual"],
116 :ips => ['10.252.0.20', "192.168.50.20"],
121 :groups => ["individual"],
126 :ips => ['10.252.0.7', "192.168.50.7"],
131 :groups => ["individual"],
135 :name => "multicloud",
136 :ips => ['10.252.0.16', "192.168.50.16"],
141 :groups => ["individual"],
142 :args => ["multicloud"],
144 { :guest => 9003, :host => 9003, :guest_ip => '192.168.50.16' },
149 :ips => ['10.252.0.21', "192.168.50.21"],
154 :groups => ["individual"],
158 { :guest => 8880, :host => 8880, :guest_ip => '192.168.50.21' },
159 { :guest => 8989, :host => 8989, :guest_ip => '192.168.50.21' },
164 :ips => ['10.252.0.13', "192.168.50.13"],
169 :groups => ["individual"],
174 :ips => ['10.252.0.11', "192.168.50.11"],
179 :groups => ["individual"],
184 :ips => ['10.252.0.8', "192.168.50.8"],
189 :groups => ["individual"],
194 :ips => ['10.252.0.5', "192.168.50.5"],
199 :groups => ["individual"],
205 :ips => ['10.252.0.10', "192.168.50.10"],
210 :groups => ["individual"],
215 :ips => ['10.252.2.3', "192.168.52.3"],
220 :groups => ["testing"],
221 :flavor => 'm1.small',
226 :ips => ['10.252.0.15', "192.168.50.15"],
231 :groups => ["individual"],
236 :ips => ['10.252.0.9', "192.168.50.9"],
241 :groups => ["individual"],
246 :ips => ['10.252.0.18', "192.168.50.18"],
251 :groups => ["individual"],
256 :ips => ['10.252.0.17', "192.168.50.17"],
261 :groups => ["individual"],
265 :name => "openstack",
266 :ips => ['10.252.3.3', "192.168.53.3"],
271 :groups => ["individual"],
272 :args => ['openstack'],
274 { :guest => 80, :host => 8888, :guest_ip => '192.168.53.4' },
275 { :guest => 6080, :host => 6080, :guest_ip => '192.168.53.4' },
280 run_path = 'vagrant_utils/postinstall.sh'
281 sdc_volume = 'vol1-sdc-data.vdi'
283 Vagrant.require_version ">= 1.8.6"
285 # Determine the provider used
286 provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
287 puts "[INFO] Provider: #{provider} "
289 vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml')
290 if File.exist?(vd_conf)
292 user_conf = YAML.load_file(vd_conf)
293 configuration.update(user_conf)
296 # Set network interface
297 net_interface = 'vboxnet0'
298 is_windows = Gem.win_platform?
300 net_interface = 'VirtualBox Host-Only Ethernet Adapter #2'
302 puts "[INFO] Net interface: #{net_interface}"
305 # If argument is given use it. Otherwise use Env: DEPLOY_MODE else use default
306 requested_machine = ARGV[1]
308 deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual')
309 if requested_machine != nil
310 if requested_machine.include?("all-in-one") || requested_machine.include?("testing")
311 deploy_mode = requested_machine
315 # Catch the status of all machines
316 if ARGV[0] == 'status' || ARGV[0] == 'destroy'
320 puts "[INFO] Deploy Mode: #{deploy_mode}"
322 # In case of all-in-one or testing clean the nodes list
325 nodes.select! do |node|
326 if node[:name].include?("all-in-one")
332 nodes.select! do |node|
333 if node[:groups][0].include?("individual")
339 nodes.select! do |node|
340 if node[:name].include?("testing")
346 Vagrant.configure("2") do |config|
349 if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil
350 if not Vagrant.has_plugin?('vagrant-proxyconf')
351 system 'vagrant plugin install vagrant-proxyconf'
352 raise 'vagrant-proxyconf was installed but it requires to execute again'
354 config.proxy.http = ENV['http_proxy']
355 config.proxy.https = ENV['https_proxy']
356 configuration['socks_proxy'] = ENV['socks_proxy']
359 if Vagrant.has_plugin?('vagrant-vbguest')
360 puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts'
361 config.vbguest.auto_update = false
364 sync_type = "virtualbox"
365 if provider == :libvirt
366 if not Vagrant.has_plugin?('vagrant-libvirt')
367 system 'vagrant plugin install vagrant-libvirt'
368 raise 'vagrant-libvirt was installed but it requires to execute again'
373 if provider == :openstack
374 config.ssh.username = 'ubuntu'
375 if not Vagrant.has_plugin?('vagrant-openstack-provider')
376 system 'vagrant plugin install vagrant-openstack-provider'
377 raise 'vagrant-openstack-provider was installed but it requires to execute again'
382 config.vm.define node[:name] do |nodeconfig|
384 # NO_PROXY definitions
385 if ENV['no_proxy'] != nil
386 if not Vagrant.has_plugin?('vagrant-proxyconf')
387 system 'vagrant plugin install vagrant-proxyconf'
388 raise 'vagrant-proxyconf was installed but it requires to execute again'
390 config.proxy.no_proxy = node[:ips].join(",") + "," + ENV['no_proxy']
395 nodeconfig.vm.provider "virtualbox" do |vbox|
396 vbox.customize ['modifyvm', :id, '--nictype1', 'virtio']
397 vbox.customize ['modifyvm', :id, '--audio', 'none']
398 vbox.customize ['modifyvm', :id, '--vram', '1']
399 vbox.customize ['modifyvm', :id, "--cpuhotplug", "off"]
400 vbox.customize ['modifyvm', :id, "--cpuexecutioncap", node[:cpu]]
401 vbox.customize ['modifyvm', :id, "--cpus", node[:cpus]]
402 vbox.customize ["modifyvm", :id, "--memory", node[:ram]]
405 nodeconfig.vm.network :private_network,
407 :name => net_interface,
410 nodeconfig.vm.network :private_network,
412 :ip => node[:ips][1],
417 volume_file = node[:name] + '-vol1-data.vdi'
418 unless File.exist?(volume_file)
419 vbox.customize ['createhd', '--filename', volume_file, '--size', node[:hd]]
421 vbox.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', volume_file]
425 nodeconfig.vm.provider "libvirt" do |lbox|
426 lbox.memory = node[:ram]
428 lbox.cpu_mode = 'host-passthrough'
429 lbox.cpus = node[:cpus]
432 nodeconfig.vm.network :private_network,
435 nodeconfig.vm.network :private_network,
436 :ip => node[:ips][1],
441 lbox.storage :file, bus: 'sata', device: 'sda', size: node[:hd]
444 if node.has_key? :fwds
445 node[:fwds].each do |fwd|
446 nodeconfig.vm.network :forwarded_port,
447 :guest => fwd[:guest],
448 :guest_ip => fwd[:guest_ip],
450 :host_ip => "0.0.0.0"
454 nodeconfig.vm.provider :openstack do |obox|
455 obox.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
456 obox.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
457 obox.username = ENV.fetch('OS_USERNAME', '')
458 obox.password = ENV.fetch('OS_PASSWORD', '')
459 obox.region = ENV.fetch('OS_REGION_NAME', '')
460 obox.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
461 obox.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
462 obox.project_name = ENV.fetch('OS_PROJECT_NAME', '')
463 obox.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
464 obox.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
465 obox.image = ENV.fetch('OS_IMAGE', '')
466 obox.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
467 obox.networks = ENV.fetch('OS_NETWORK', '')
468 obox.flavor = node[:flavor]
469 obox.server_name = node[:name]
473 if "openstack" == node[:name]
475 :virtualbox => 'ubuntu/xenial64',
476 :libvirt => 'elastic/ubuntu-16.04-x86_64'
479 nodeconfig.vm.box = box[provider]
482 nodeconfig.vm.hostname = node[:name]
485 nodeconfig.vm.synced_folder ".", "/vagrant", disabled: true
486 nodeconfig.vm.synced_folder './opt', '/opt/', create: true, type: sync_type
487 nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true, type: sync_type
489 nodeconfig.vm.synced_folder '~/.m2', '/root/.m2/', create: true
494 if node[:name].include? "testing"
495 nodeconfig.vm.synced_folder './tests', '/var/onap_tests/', create: true
496 test_suite = ENV.fetch('TEST_SUITE', '*')
497 test_case = ENV.fetch('TEST_CASE', '*')
499 run_path = 'vagrant_utils/unit_testing.sh'
500 node[:args] = [test_suite, test_case]
502 configuration['skip_get_images'] = ENV.fetch('SKIP_GET_IMAGES', configuration['skip_get_images'])
503 configuration['skip_install'] = ENV.fetch('SKIP_INSTALL', configuration['skip_install'])
506 if node[:name].include? "vfc"
507 nodeconfig.vm.provision 'docker'
510 nodeconfig.vm.provision 'shell' do |s|
513 s.env = configuration