blob: 21766fe00dff886eb040d1c7128dd11574100f64 [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4conf = {
5# Generic parameters used across all ONAP components
6 'public_net_id' => '00000000-0000-0000-0000-000000000000',
7 'key_name' => 'ecomp_key',
8 'pub_key' => '',
9 'nexus_repo' => 'https://nexus.onap.org/content/sites/raw',
10 'nexus_docker_repo' => 'nexus3.onap.org:10001',
11 'nexus_username' => 'docker',
12 'nexus_password' => 'docker',
13 'dmaap_topic' => 'AUTO',
14 'artifacts_version' => '1.0.0',
15 'docker_version' => '1.0-STAGING-latest',
16 'gerrit_branch' => 'master',
17# Parameters for DCAE instantiation
18 'dcae_zone' => 'iad4',
19 'dcae_state' => 'vi',
20 'openstack_tenant_id' => '',
21 'openstack_username' => '',
22 'openstack_api_key' => '',
23 'openstack_password' => '',
24 'nexus_repo_root' => 'https://nexus.onap.org',
25 'nexus_url_snapshot' => 'https://nexus.onap.org/content/repositories/snapshots',
26 'gitlab_branch' => 'master',
Victor Moralesdd074802017-07-26 16:06:35 -050027 'build_image' => 'True',
Idan Amit0a295552017-08-17 17:03:59 +030028 'pull_docker_image' => 'True',
Victor Moralesdd074802017-07-26 16:06:35 -050029 'odl_version' => '0.5.3-Boron-SR3',
Victor Morales2909e2e2017-08-08 15:51:52 -050030 'compile_repo' => 'False',
31 'enable_oparent' => 'True'
Victor Morales89ce3212017-06-16 18:32:48 -050032}
33
Victor Moralesdd074802017-07-26 16:06:35 -050034Vagrant.require_version ">= 1.8.6"
35
36# Determine the OS for the host computer
37module OS
38 def OS.windows?
39 (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
40 end
41
42 def OS.mac?
43 (/darwin/ =~ RUBY_PLATFORM) != nil
44 end
45
46 def OS.unix?
47 !OS.windows?
48 end
49
50 def OS.linux?
51 OS.unix? and not OS.mac?
52 end
53end
54
55if OS.windows?
56 puts "Vagrant launched from windows. This configuration has not fully tested."
57end
58
59# Determine the provider used
60provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
61puts "Using #{provider} provider"
62
Victor Morales89ce3212017-06-16 18:32:48 -050063vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml')
64if File.exist?(vd_conf)
65 require 'yaml'
66 user_conf = YAML.load_file(vd_conf)
67 conf.update(user_conf)
68end
69
70deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual')
71sdc_volume='vol1-sdc-data.vdi'
72
73Vagrant.configure("2") do |config|
74
75 if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil and ENV['no_proxy'] != nil
76 if not Vagrant.has_plugin?('vagrant-proxyconf')
77 system 'vagrant plugin install vagrant-proxyconf'
78 raise 'vagrant-proxyconf was installed but it requires to execute again'
79 end
80 config.proxy.http = ENV['http_proxy']
81 config.proxy.https = ENV['https_proxy']
82 config.proxy.no_proxy = ENV['no_proxy']
83 end
84
Victor Moralesd4036482017-08-15 17:54:14 -050085 if Vagrant.has_plugin?('vagrant-vbguest')
86 puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts'
87 config.vbguest.auto_update = false
88 end
89
Victor Morales89ce3212017-06-16 18:32:48 -050090 config.vm.box = 'ubuntu/trusty64'
Victor Moralesdd074802017-07-26 16:06:35 -050091 if provider == :libvirt
92 config.vm.box = 'sputnik13/trusty64'
Victor Moralesf62e7b82017-07-27 17:26:06 -050093 if not Vagrant.has_plugin?('vagrant-libvirt')
94 system 'vagrant plugin install vagrant-libvirt'
95 raise 'vagrant-libvirt was installed but it requires to execute again'
96 end
Victor Moralesdd074802017-07-26 16:06:35 -050097 end
98 if provider == :openstack
99 config.vm.box = nil
100 config.ssh.username = 'ubuntu'
101 if not Vagrant.has_plugin?('vagrant-openstack-provider')
102 system 'vagrant plugin install vagrant-openstack-provider'
103 raise 'vagrant-openstack-provider was installed but it requires to execute again'
104 end
105 end
Victor Morales89ce3212017-06-16 18:32:48 -0500106 #config.vm.provision "docker"
107 config.vm.synced_folder './opt', '/opt/', create: true
108 config.vm.synced_folder './lib', '/var/onap/', create: true
109 config.vm.synced_folder '~/.m2', '/root/.m2/', create: true
110
Victor Moralesdd074802017-07-26 16:06:35 -0500111 config.vm.provider :virtualbox do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500112 v.customize ["modifyvm", :id, "--memory", 4 * 1024]
113 end
Victor Moralesdd074802017-07-26 16:06:35 -0500114 config.vm.provider :libvirt do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500115 v.memory = 4 * 1024
116 v.nested = true
117 end
Victor Moralesdd074802017-07-26 16:06:35 -0500118 config.vm.provider :openstack do |v|
119
120 v.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
121 v.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
122 v.username = ENV.fetch('OS_USERNAME', '')
123 v.password = ENV.fetch('OS_PASSWORD', '')
124 v.region = ENV.fetch('OS_REGION_NAME', '')
125 v.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
126 v.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
127 v.project_name = ENV.fetch('OS_PROJECT_NAME', '')
128
129 v.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
130 v.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
131 v.image = ENV.fetch('OS_IMAGE', '')
132 v.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
133 v.flavor = 'm1.medium'
134 v.networks = ENV.fetch('OS_NETWORK', '')
135 end
Victor Morales89ce3212017-06-16 18:32:48 -0500136
137 case deploy_mode
138
139 when 'all-in-one'
140
141 config.vm.define :all_in_one do |all_in_one|
142 all_in_one.vm.hostname = 'all-in-one'
143 all_in_one.vm.network :private_network, ip: '192.168.50.3'
144 all_in_one.vm.provider "virtualbox" do |v|
145 v.customize ["modifyvm", :id, "--memory", 12 * 1024]
146 unless File.exist?(sdc_volume)
147 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
148 end
149 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
150 end
151 all_in_one.vm.provider "libvirt" do |v|
152 v.memory = 12 * 1024
153 v.nested = true
154 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
155 end
Victor Moralesdd074802017-07-26 16:06:35 -0500156 all_in_one.vm.provider "openstack" do |v|
157 v.server_name = 'all-in-one'
158 v.flavor = 'm1.xlarge'
159 end
Victor Morales89ce3212017-06-16 18:32:48 -0500160 all_in_one.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700161 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales766b10e2017-08-17 16:16:53 -0500162 s.args = ['mr', 'asdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc']
Victor Morales89ce3212017-06-16 18:32:48 -0500163 s.env = conf
164 end
165 end
166
167 when 'individual'
168
169 config.vm.define :dns do |dns|
170 dns.vm.hostname = 'dns'
171 dns.vm.network :private_network, ip: '192.168.50.3'
172 dns.vm.provider "virtualbox" do |v|
173 v.customize ["modifyvm", :id, "--memory", 1 * 1024]
174 end
175 dns.vm.provider "libvirt" do |v|
176 v.memory = 1 * 1024
177 v.nested = true
178 end
Victor Moralesdd074802017-07-26 16:06:35 -0500179 dns.vm.provider "openstack" do |v|
180 v.server_name = 'dns'
181 v.flavor = 'm1.small'
182 end
Victor Morales89ce3212017-06-16 18:32:48 -0500183 dns.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700184 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500185 s.env = conf
186 end
187 end
188
Victor Moralesdd074802017-07-26 16:06:35 -0500189 config.vm.define :mr do |mr|
190 mr.vm.hostname = 'message-router'
191 mr.vm.network :private_network, ip: '192.168.50.4'
192 mr.vm.provider "openstack" do |v|
193 v.server_name = 'message-router'
194 end
195 mr.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700196 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500197 s.args = ['mr']
198 s.env = conf
199 end
200 end
201
202 config.vm.define :sdc do |sdc|
203 sdc.vm.hostname = 'sdc'
204 sdc.vm.network :private_network, ip: '192.168.50.5'
205 sdc.vm.provider "virtualbox" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500206 unless File.exist?(sdc_volume)
207 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
208 end
209 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
210 end
211 sdc.vm.provider "libvirt" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500212 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
213 end
Victor Moralesdd074802017-07-26 16:06:35 -0500214 sdc.vm.provider "openstack" do |v|
215 v.server_name = 'sdc'
216 end
Victor Morales89ce3212017-06-16 18:32:48 -0500217 sdc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700218 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales766b10e2017-08-17 16:16:53 -0500219 s.args = ['asdc']
Victor Morales89ce3212017-06-16 18:32:48 -0500220 s.env = conf
221 end
222 end
Victor Moralesd4036482017-08-15 17:54:14 -0500223
Victor Morales89ce3212017-06-16 18:32:48 -0500224 config.vm.define :aai do |aai|
225 aai.vm.hostname = 'aai'
226 aai.vm.network :private_network, ip: '192.168.50.6'
Victor Moralesdd074802017-07-26 16:06:35 -0500227 aai.vm.provider "openstack" do |v|
228 v.server_name = 'aai'
229 end
Victor Moralesd4036482017-08-15 17:54:14 -0500230 aai.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700231 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500232 s.args = ['aai']
233 s.env = conf
234 end
235 end
Victor Moralesd4036482017-08-15 17:54:14 -0500236
Victor Morales89ce3212017-06-16 18:32:48 -0500237 config.vm.define :mso do |mso|
Victor Moralesdd074802017-07-26 16:06:35 -0500238 mso.vm.hostname = 'mso'
Victor Morales89ce3212017-06-16 18:32:48 -0500239 mso.vm.network :private_network, ip: '192.168.50.7'
Victor Moralesdd074802017-07-26 16:06:35 -0500240 mso.vm.provider "openstack" do |v|
241 v.server_name = 'mso'
242 end
Victor Moralesd4036482017-08-15 17:54:14 -0500243 mso.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700244 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500245 s.args = ['mso']
246 s.env = conf
247 end
248 end
249
250 config.vm.define :robot do |robot|
251 robot.vm.hostname = 'robot'
252 robot.vm.network :private_network, ip: '192.168.50.8'
Victor Moralesdd074802017-07-26 16:06:35 -0500253 robot.vm.provider "openstack" do |v|
254 v.server_name = 'robot'
255 end
Victor Morales89ce3212017-06-16 18:32:48 -0500256 robot.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700257 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500258 s.args = ['robot']
259 s.env = conf
260 end
261 end
Victor Moralesd4036482017-08-15 17:54:14 -0500262
Victor Morales89ce3212017-06-16 18:32:48 -0500263 config.vm.define :vid do |vid|
264 vid.vm.hostname = 'vid'
265 vid.vm.network :private_network, ip: '192.168.50.9'
Victor Moralesdd074802017-07-26 16:06:35 -0500266 vid.vm.provider "openstack" do |v|
267 v.server_name = 'vid'
268 end
Victor Morales89ce3212017-06-16 18:32:48 -0500269 vid.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700270 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500271 s.args = ['vid']
272 s.env = conf
273 end
274 end
Victor Moralesd4036482017-08-15 17:54:14 -0500275
Victor Morales89ce3212017-06-16 18:32:48 -0500276 config.vm.define :sdnc do |sdnc|
277 sdnc.vm.hostname = 'sdnc'
278 sdnc.vm.network :private_network, ip: '192.168.50.10'
Victor Moralesdd074802017-07-26 16:06:35 -0500279 sdnc.vm.provider "openstack" do |v|
280 v.server_name = 'sdnc'
281 end
Victor Morales89ce3212017-06-16 18:32:48 -0500282 sdnc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700283 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500284 s.args = ['sdnc']
285 s.env = conf
286 end
287 end
Victor Moralesd4036482017-08-15 17:54:14 -0500288
Victor Morales89ce3212017-06-16 18:32:48 -0500289 config.vm.define :portal do |portal|
290 portal.vm.hostname = 'portal'
291 portal.vm.network :private_network, ip: '192.168.50.11'
Victor Moralesdd074802017-07-26 16:06:35 -0500292 portal.vm.provider "openstack" do |v|
293 v.server_name = 'portal'
294 end
Victor Morales89ce3212017-06-16 18:32:48 -0500295 portal.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700296 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500297 s.args = ['portal']
298 s.env = conf
299 end
300 end
Victor Moralesd4036482017-08-15 17:54:14 -0500301
Victor Morales89ce3212017-06-16 18:32:48 -0500302 config.vm.define :dcae do |dcae|
303 dcae.vm.hostname = 'dcae'
304 dcae.vm.network :private_network, ip: '192.168.50.12'
Victor Moralesdd074802017-07-26 16:06:35 -0500305 dcae.vm.provider "openstack" do |v|
306 v.server_name = 'dcae'
307 end
Victor Morales89ce3212017-06-16 18:32:48 -0500308 dcae.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700309 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500310 s.args = ['dcae']
311 s.env = conf
312 end
313 end
Victor Moralesd4036482017-08-15 17:54:14 -0500314
Victor Morales89ce3212017-06-16 18:32:48 -0500315 config.vm.define :policy do |policy|
316 policy.vm.hostname = 'policy'
317 policy.vm.network :private_network, ip: '192.168.50.13'
Victor Moralesdd074802017-07-26 16:06:35 -0500318 policy.vm.provider "openstack" do |v|
319 v.server_name = 'policy'
320 end
Victor Morales89ce3212017-06-16 18:32:48 -0500321 policy.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700322 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500323 s.args = ['policy']
324 s.env = conf
325 end
326 end
Victor Moralesd4036482017-08-15 17:54:14 -0500327
Victor Morales89ce3212017-06-16 18:32:48 -0500328 config.vm.define :appc do |appc|
329 appc.vm.hostname = 'appc'
330 appc.vm.network :private_network, ip: '192.168.50.14'
Victor Moralesdd074802017-07-26 16:06:35 -0500331 appc.vm.provider "openstack" do |v|
332 v.server_name = 'appc'
333 end
Victor Morales89ce3212017-06-16 18:32:48 -0500334 appc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700335 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500336 s.args = ['appc']
337 s.env = conf
338 end
339 end
340
Victor Moralesdd074802017-07-26 16:06:35 -0500341 config.vm.define :vfc do |vfc|
342 vfc.vm.hostname = 'vfc'
343 vfc.vm.network :private_network, ip: '192.168.50.15'
344 vfc.vm.provider "openstack" do |v|
345 v.server_name = 'vfc'
346 end
347 vfc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700348 s.path = 'vagrant_utils/postinstall.sh'
Victor Moralesdd074802017-07-26 16:06:35 -0500349 s.args = ['vfc']
350 s.env = conf
351 end
352 end
353
354 when 'testing'
355
356 config.vm.define :testing do |testing|
357 test_suite = ENV.fetch('TEST_SUITE', '*')
358 test_case = ENV.fetch('TEST_CASE', '*')
359
360 testing.vm.hostname = 'testing'
361 testing.vm.network :private_network, ip: '192.168.50.3'
362 testing.vm.synced_folder './tests', '/var/onap_tests/', create: true
363 testing.vm.provider "virtualbox" do |v|
Victor Morales158c18c2017-08-06 11:23:15 -0500364 v.customize ["modifyvm", :id, "--memory", 4 * 1024]
Victor Moralesdd074802017-07-26 16:06:35 -0500365 end
366 testing.vm.provider "libvirt" do |v|
Victor Morales158c18c2017-08-06 11:23:15 -0500367 v.memory = 4 * 1024
Victor Moralesdd074802017-07-26 16:06:35 -0500368 v.nested = true
369 end
370 testing.vm.provider "openstack" do |v|
371 v.server_name = 'testing'
372 v.flavor = 'm1.small'
373 end
374 testing.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700375 s.path = 'vagrant_utils/unit_testing.sh'
Victor Moralesdd074802017-07-26 16:06:35 -0500376 s.args = [test_suite, test_case]
377 s.env = conf
378 end
379 end
380
Victor Morales89ce3212017-06-16 18:32:48 -0500381 end
382end