4 Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
7 # Generic parameters used across all ONAP components
8 'key_name' => 'ecomp_key',
10 'nexus_repo' => 'https://nexus.onap.org/content/sites/raw',
11 'nexus_repo_root' => 'https://nexus.onap.org',
12 'nexus_url_snapshot' => 'https://nexus.onap.org/content/repositories/snapshots',
13 'nexus_docker_repo' => 'nexus3.onap.org:10001',
14 'nexus_username' => 'docker',
15 'nexus_password' => 'docker',
16 'dmaap_topic' => 'AUTO',
17 'artifacts_version' => '1.0.0',
18 'docker_version' => 'latest',
19 # Parameters for DCAE instantiation
20 'dcae_zone' => 'iad4',
22 'openstack_tenant_id' => '',
23 'openstack_username' => '',
24 'openstack_api_key' => '',
25 'openstack_password' => '',
26 'odl_version' => '0.5.3-Boron-SR3',
27 # Parameters for enabling features
29 'build_image' => 'True',
30 'clone_repo' => 'True',
31 'compile_repo' => 'False',
32 'enable_oparent' => 'True',
33 'skip_get_images' => 'False',
34 'skip_install' => 'True'
38 :virtualbox => 'ubuntu/trusty64',
39 :libvirt => 'elastic/ubuntu-14.04-x86_64',
46 :ips => ['10.252.0.6', "192.168.50.6"],
51 :groups => ["individual"],
54 { :guest => 8446, :host => 8446, :guest_ip => '192.168.50.6' },
55 { :guest => 9446, :host => 9446, :guest_ip => '192.168.50.6' },
59 :name => "all-in-one",
60 :ips => ['10.252.1.3', "192.168.51.3"],
65 :groups => ["all-in-one"],
66 :flavor => 'm1.xlarge',
67 :args => ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc', 'ccsdk', 'multicloud', 'vnfsdk', 'vpp', 'msb'],
71 :ips => ['10.252.0.14', "192.168.50.14"],
76 :groups => ["individual"],
81 :ips => ['10.252.0.19', "192.168.50.19"],
86 :groups => ["individual"],
91 :ips => ['10.252.0.12', "192.168.50.12"],
96 :groups => ["individual"],
101 :ips => ['10.252.0.3', "192.168.50.3"],
106 :groups => ["individual"],
107 :flavor => 'm1.small',
111 :name => "message-router",
112 :ips => ['10.252.0.4', "192.168.50.4"],
117 :groups => ["individual"],
122 :ips => ['10.252.0.20', "192.168.50.20"],
127 :groups => ["individual"],
132 :ips => ['10.252.0.7', "192.168.50.7"],
137 :groups => ["individual"],
141 :name => "multicloud",
142 :ips => ['10.252.0.16', "192.168.50.16"],
147 :groups => ["individual"],
148 :args => ["multicloud"],
150 { :guest => 9003, :host => 9003, :guest_ip => '192.168.50.16' },
155 :ips => ['10.252.0.21', "192.168.50.21"],
160 :groups => ["individual"],
162 :hd => { :virtualbox => "61440", :libvirt => "60G", },
164 { :guest => 8880, :host => 8880, :guest_ip => '192.168.50.21' },
165 { :guest => 8989, :host => 8989, :guest_ip => '192.168.50.21' },
170 :ips => ['10.252.0.13', "192.168.50.13"],
175 :groups => ["individual"],
180 :ips => ['10.252.0.11', "192.168.50.11"],
185 :groups => ["individual"],
190 :ips => ['10.252.0.8', "192.168.50.8"],
195 :groups => ["individual"],
200 :ips => ['10.252.0.5', "192.168.50.5"],
205 :groups => ["individual"],
207 :hd => { :virtualbox => "20480", :libvirt => "20G", },
209 { :guest => 8285, :host => 8285, :guest_ip => '192.168.50.5' },
214 :ips => ['10.252.0.10', "192.168.50.10"],
219 :groups => ["individual"],
224 :ips => ['10.252.2.3', "192.168.52.3"],
229 :groups => ["testing"],
230 :flavor => 'm1.small',
235 :ips => ['10.252.0.15', "192.168.50.15"],
240 :groups => ["individual"],
245 :ips => ['10.252.0.9', "192.168.50.9"],
250 :groups => ["individual"],
255 :ips => ['10.252.0.18', "192.168.50.18"],
260 :groups => ["individual"],
265 :ips => ['10.252.0.17', "192.168.50.17"],
270 :groups => ["individual"],
274 :name => "openstack",
275 :ips => ['10.252.3.3', "192.168.53.3"],
280 :groups => ["individual"],
281 :args => ['openstack'],
283 { :guest => 80, :host => 8888, :guest_ip => '192.168.53.4' },
284 { :guest => 6080, :host => 6080, :guest_ip => '192.168.53.4' },
289 run_path = 'vagrant_utils/postinstall.sh'
290 sdc_volume = 'vol1-sdc-data.vdi'
292 Vagrant.require_version ">= 1.8.6"
294 # Determine the provider used
295 provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
296 puts "[INFO] Provider: #{provider} "
298 vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml')
299 if File.exist?(vd_conf)
301 user_conf = YAML.load_file(vd_conf)
302 configuration.update(user_conf)
305 # Set network interface
306 net_interface = 'vboxnet0'
307 is_windows = Gem.win_platform?
309 net_interface = 'VirtualBox Host-Only Ethernet Adapter #2'
311 puts "[INFO] Net interface: #{net_interface}"
314 # If argument is given use it. Otherwise use Env: DEPLOY_MODE else use default
315 requested_machine = ARGV[1]
317 deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual')
318 if requested_machine != nil
319 if requested_machine.include?("all-in-one") || requested_machine.include?("testing")
320 deploy_mode = requested_machine
324 # Catch the status of all machines
325 if ARGV[0] == 'status' || ARGV[0] == 'destroy'
329 puts "[INFO] Deploy Mode: #{deploy_mode}"
331 # In case of all-in-one or testing clean the nodes list
334 nodes.select! do |node|
335 if node[:name].include?("all-in-one")
341 nodes.select! do |node|
342 if node[:groups][0].include?("individual")
348 nodes.select! do |node|
349 if node[:name].include?("testing")
355 Vagrant.configure("2") do |config|
358 if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil
359 if not Vagrant.has_plugin?('vagrant-proxyconf')
360 system 'vagrant plugin install vagrant-proxyconf'
361 raise 'vagrant-proxyconf was installed but it requires to execute again'
363 config.proxy.enabled = { docker: false }
364 config.proxy.http = ENV['http_proxy']
365 config.proxy.https = ENV['https_proxy']
366 configuration['socks_proxy'] = ENV['socks_proxy']
369 if Vagrant.has_plugin?('vagrant-vbguest')
370 puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts'
371 config.vbguest.auto_update = false
374 sync_type = "virtualbox"
375 if provider == :libvirt
376 if not Vagrant.has_plugin?('vagrant-libvirt')
377 system 'vagrant plugin install vagrant-libvirt'
378 raise 'vagrant-libvirt was installed but it requires to execute again'
383 if provider == :openstack
384 config.ssh.username = 'ubuntu'
385 if not Vagrant.has_plugin?('vagrant-openstack-provider')
386 system 'vagrant plugin install vagrant-openstack-provider'
387 raise 'vagrant-openstack-provider was installed but it requires to execute again'
392 config.vm.define node[:name] do |nodeconfig|
394 # NO_PROXY definitions
395 if ENV['no_proxy'] != nil
396 if not Vagrant.has_plugin?('vagrant-proxyconf')
397 system 'vagrant plugin install vagrant-proxyconf'
398 raise 'vagrant-proxyconf was installed but it requires to execute again'
400 config.proxy.no_proxy = node[:ips].join(",") + "," + ENV['no_proxy']
405 nodeconfig.vm.provider "virtualbox" do |vbox|
406 vbox.customize ['modifyvm', :id, '--nictype1', 'virtio']
407 vbox.customize ['modifyvm', :id, '--audio', 'none']
408 vbox.customize ['modifyvm', :id, '--vram', '1']
409 vbox.customize ['modifyvm', :id, "--cpuhotplug", "off"]
410 vbox.customize ['modifyvm', :id, "--cpuexecutioncap", node[:cpu]]
411 vbox.customize ['modifyvm', :id, "--cpus", node[:cpus]]
412 vbox.customize ["modifyvm", :id, "--memory", node[:ram]]
415 nodeconfig.vm.network :private_network,
417 :name => net_interface,
420 nodeconfig.vm.network :private_network,
422 :ip => node[:ips][1],
427 volume_file = node[:name] + '-vol1-data.vdi'
428 unless File.exist?(volume_file)
429 vbox.customize ['createmedium', 'disk', '--filename', volume_file, '--size', node[:hd][provider]]
431 vbox.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', volume_file]
435 nodeconfig.vm.provider "libvirt" do |lbox|
436 lbox.memory = node[:ram]
438 lbox.cpu_mode = 'host-passthrough'
439 lbox.cpus = node[:cpus]
442 nodeconfig.vm.network :private_network,
445 nodeconfig.vm.network :private_network,
446 :ip => node[:ips][1],
451 lbox.storage :file, bus: 'sata', device: 'sda', size: node[:hd][provider]
454 if node.has_key? :fwds
455 node[:fwds].each do |fwd|
456 nodeconfig.vm.network :forwarded_port,
457 :guest => fwd[:guest],
458 :guest_ip => fwd[:guest_ip],
460 :host_ip => "0.0.0.0"
464 nodeconfig.vm.provider :openstack do |obox|
465 obox.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
466 obox.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
467 obox.username = ENV.fetch('OS_USERNAME', '')
468 obox.password = ENV.fetch('OS_PASSWORD', '')
469 obox.region = ENV.fetch('OS_REGION_NAME', '')
470 obox.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
471 obox.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
472 obox.project_name = ENV.fetch('OS_PROJECT_NAME', '')
473 obox.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
474 obox.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
475 obox.image = ENV.fetch('OS_IMAGE', '')
476 obox.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
477 obox.networks = ENV.fetch('OS_NETWORK', '')
478 obox.flavor = node[:flavor]
479 obox.server_name = node[:name]
483 if "openstack" == node[:name]
485 :virtualbox => 'ubuntu/xenial64',
486 :libvirt => 'elastic/ubuntu-16.04-x86_64'
489 nodeconfig.vm.box = box[provider]
492 nodeconfig.vm.hostname = node[:name]
495 nodeconfig.vm.synced_folder ".", "/vagrant", disabled: true
496 nodeconfig.vm.synced_folder './opt', '/opt/onap/', create: true, type: sync_type
497 nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true, type: sync_type
499 nodeconfig.vm.synced_folder '~/.m2', '/root/.m2/', create: true
504 if node[:name].include? "testing"
505 nodeconfig.vm.synced_folder './tests', '/var/onap_tests/', create: true
506 test_suite = ENV.fetch('TEST_SUITE', '*')
507 test_case = ENV.fetch('TEST_CASE', '*')
509 run_path = 'vagrant_utils/unit_testing.sh'
510 node[:args] = [test_suite, test_case]
512 configuration['skip_get_images'] = ENV.fetch('SKIP_GET_IMAGES', configuration['skip_get_images'])
513 configuration['skip_install'] = ENV.fetch('SKIP_INSTALL', configuration['skip_install'])
516 if node[:name].include? "vfc"
517 nodeconfig.vm.provision 'docker'
520 nodeconfig.vm.provision 'shell' do |s|
523 s.env = configuration