blob: 0e8e1da1c6564d463a8b72b1f629b42c77e7c659 [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',
28 'odl_version' => '0.5.3-Boron-SR3',
Victor Morales2909e2e2017-08-08 15:51:52 -050029 'compile_repo' => 'False',
30 'enable_oparent' => 'True'
Victor Morales89ce3212017-06-16 18:32:48 -050031}
32
Victor Moralesdd074802017-07-26 16:06:35 -050033Vagrant.require_version ">= 1.8.6"
34
35# Determine the OS for the host computer
36module OS
37 def OS.windows?
38 (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
39 end
40
41 def OS.mac?
42 (/darwin/ =~ RUBY_PLATFORM) != nil
43 end
44
45 def OS.unix?
46 !OS.windows?
47 end
48
49 def OS.linux?
50 OS.unix? and not OS.mac?
51 end
52end
53
54if OS.windows?
55 puts "Vagrant launched from windows. This configuration has not fully tested."
56end
57
58# Determine the provider used
59provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
60puts "Using #{provider} provider"
61
Victor Morales89ce3212017-06-16 18:32:48 -050062vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml')
63if File.exist?(vd_conf)
64 require 'yaml'
65 user_conf = YAML.load_file(vd_conf)
66 conf.update(user_conf)
67end
68
69deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual')
70sdc_volume='vol1-sdc-data.vdi'
71
72Vagrant.configure("2") do |config|
73
74 if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil and ENV['no_proxy'] != nil
75 if not Vagrant.has_plugin?('vagrant-proxyconf')
76 system 'vagrant plugin install vagrant-proxyconf'
77 raise 'vagrant-proxyconf was installed but it requires to execute again'
78 end
79 config.proxy.http = ENV['http_proxy']
80 config.proxy.https = ENV['https_proxy']
81 config.proxy.no_proxy = ENV['no_proxy']
82 end
83
Victor Morales89ce3212017-06-16 18:32:48 -050084 config.vm.box = 'ubuntu/trusty64'
Victor Moralesdd074802017-07-26 16:06:35 -050085 if provider == :libvirt
86 config.vm.box = 'sputnik13/trusty64'
Victor Moralesf62e7b82017-07-27 17:26:06 -050087 if not Vagrant.has_plugin?('vagrant-libvirt')
88 system 'vagrant plugin install vagrant-libvirt'
89 raise 'vagrant-libvirt was installed but it requires to execute again'
90 end
Victor Moralesdd074802017-07-26 16:06:35 -050091 end
92 if provider == :openstack
93 config.vm.box = nil
94 config.ssh.username = 'ubuntu'
95 if not Vagrant.has_plugin?('vagrant-openstack-provider')
96 system 'vagrant plugin install vagrant-openstack-provider'
97 raise 'vagrant-openstack-provider was installed but it requires to execute again'
98 end
99 end
Victor Morales89ce3212017-06-16 18:32:48 -0500100 #config.vm.provision "docker"
101 config.vm.synced_folder './opt', '/opt/', create: true
102 config.vm.synced_folder './lib', '/var/onap/', create: true
103 config.vm.synced_folder '~/.m2', '/root/.m2/', create: true
104
Victor Moralesdd074802017-07-26 16:06:35 -0500105 config.vm.provider :virtualbox do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500106 v.customize ["modifyvm", :id, "--memory", 4 * 1024]
107 end
Victor Moralesdd074802017-07-26 16:06:35 -0500108 config.vm.provider :libvirt do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500109 v.memory = 4 * 1024
110 v.nested = true
111 end
Victor Moralesdd074802017-07-26 16:06:35 -0500112 config.vm.provider :openstack do |v|
113
114 v.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
115 v.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
116 v.username = ENV.fetch('OS_USERNAME', '')
117 v.password = ENV.fetch('OS_PASSWORD', '')
118 v.region = ENV.fetch('OS_REGION_NAME', '')
119 v.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
120 v.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
121 v.project_name = ENV.fetch('OS_PROJECT_NAME', '')
122
123 v.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
124 v.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
125 v.image = ENV.fetch('OS_IMAGE', '')
126 v.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
127 v.flavor = 'm1.medium'
128 v.networks = ENV.fetch('OS_NETWORK', '')
129 end
Victor Morales89ce3212017-06-16 18:32:48 -0500130
131 case deploy_mode
132
133 when 'all-in-one'
134
135 config.vm.define :all_in_one do |all_in_one|
136 all_in_one.vm.hostname = 'all-in-one'
137 all_in_one.vm.network :private_network, ip: '192.168.50.3'
138 all_in_one.vm.provider "virtualbox" do |v|
139 v.customize ["modifyvm", :id, "--memory", 12 * 1024]
140 unless File.exist?(sdc_volume)
141 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
142 end
143 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
144 end
145 all_in_one.vm.provider "libvirt" do |v|
146 v.memory = 12 * 1024
147 v.nested = true
148 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
149 end
Victor Moralesdd074802017-07-26 16:06:35 -0500150 all_in_one.vm.provider "openstack" do |v|
151 v.server_name = 'all-in-one'
152 v.flavor = 'm1.xlarge'
153 end
Victor Morales89ce3212017-06-16 18:32:48 -0500154 all_in_one.vm.provision 'shell' do |s|
155 s.path = 'postinstall.sh'
Victor Moralesdd074802017-07-26 16:06:35 -0500156 s.args = ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc']
Victor Morales89ce3212017-06-16 18:32:48 -0500157 s.env = conf
158 end
159 end
160
161 when 'individual'
162
163 config.vm.define :dns do |dns|
164 dns.vm.hostname = 'dns'
165 dns.vm.network :private_network, ip: '192.168.50.3'
166 dns.vm.provider "virtualbox" do |v|
167 v.customize ["modifyvm", :id, "--memory", 1 * 1024]
168 end
169 dns.vm.provider "libvirt" do |v|
170 v.memory = 1 * 1024
171 v.nested = true
172 end
Victor Moralesdd074802017-07-26 16:06:35 -0500173 dns.vm.provider "openstack" do |v|
174 v.server_name = 'dns'
175 v.flavor = 'm1.small'
176 end
Victor Morales89ce3212017-06-16 18:32:48 -0500177 dns.vm.provision 'shell' do |s|
178 s.path = 'postinstall.sh'
179 s.env = conf
180 end
181 end
182
Victor Moralesdd074802017-07-26 16:06:35 -0500183 config.vm.define :mr do |mr|
184 mr.vm.hostname = 'message-router'
185 mr.vm.network :private_network, ip: '192.168.50.4'
186 mr.vm.provider "openstack" do |v|
187 v.server_name = 'message-router'
188 end
189 mr.vm.provision 'shell' do |s|
Victor Morales89ce3212017-06-16 18:32:48 -0500190 s.path = 'postinstall.sh'
191 s.args = ['mr']
192 s.env = conf
193 end
194 end
195
196 config.vm.define :sdc do |sdc|
197 sdc.vm.hostname = 'sdc'
198 sdc.vm.network :private_network, ip: '192.168.50.5'
199 sdc.vm.provider "virtualbox" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500200 unless File.exist?(sdc_volume)
201 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
202 end
203 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
204 end
205 sdc.vm.provider "libvirt" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500206 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
207 end
Victor Moralesdd074802017-07-26 16:06:35 -0500208 sdc.vm.provider "openstack" do |v|
209 v.server_name = 'sdc'
210 end
Victor Morales89ce3212017-06-16 18:32:48 -0500211 sdc.vm.provision 'shell' do |s|
212 s.path = 'postinstall.sh'
213 s.args = ['sdc']
214 s.env = conf
215 end
216 end
217
218 config.vm.define :aai do |aai|
219 aai.vm.hostname = 'aai'
220 aai.vm.network :private_network, ip: '192.168.50.6'
Victor Moralesdd074802017-07-26 16:06:35 -0500221 aai.vm.provider "openstack" do |v|
222 v.server_name = 'aai'
223 end
Victor Morales89ce3212017-06-16 18:32:48 -0500224 aai.vm.provision 'shell' do |s|
225 s.path = 'postinstall.sh'
226 s.args = ['aai']
227 s.env = conf
228 end
229 end
230
231 config.vm.define :mso do |mso|
Victor Moralesdd074802017-07-26 16:06:35 -0500232 mso.vm.hostname = 'mso'
Victor Morales89ce3212017-06-16 18:32:48 -0500233 mso.vm.network :private_network, ip: '192.168.50.7'
Victor Moralesdd074802017-07-26 16:06:35 -0500234 mso.vm.provider "openstack" do |v|
235 v.server_name = 'mso'
236 end
Victor Morales89ce3212017-06-16 18:32:48 -0500237 mso.vm.provision 'shell' do |s|
238 s.path = 'postinstall.sh'
239 s.args = ['mso']
240 s.env = conf
241 end
242 end
243
244 config.vm.define :robot do |robot|
245 robot.vm.hostname = 'robot'
246 robot.vm.network :private_network, ip: '192.168.50.8'
Victor Moralesdd074802017-07-26 16:06:35 -0500247 robot.vm.provider "openstack" do |v|
248 v.server_name = 'robot'
249 end
Victor Morales89ce3212017-06-16 18:32:48 -0500250 robot.vm.provision 'shell' do |s|
251 s.path = 'postinstall.sh'
252 s.args = ['robot']
253 s.env = conf
254 end
255 end
256
257 config.vm.define :vid do |vid|
258 vid.vm.hostname = 'vid'
259 vid.vm.network :private_network, ip: '192.168.50.9'
Victor Moralesdd074802017-07-26 16:06:35 -0500260 vid.vm.provider "openstack" do |v|
261 v.server_name = 'vid'
262 end
Victor Morales89ce3212017-06-16 18:32:48 -0500263 vid.vm.provision 'shell' do |s|
264 s.path = 'postinstall.sh'
265 s.args = ['vid']
266 s.env = conf
267 end
268 end
269
270 config.vm.define :sdnc do |sdnc|
271 sdnc.vm.hostname = 'sdnc'
272 sdnc.vm.network :private_network, ip: '192.168.50.10'
Victor Moralesdd074802017-07-26 16:06:35 -0500273 sdnc.vm.provider "openstack" do |v|
274 v.server_name = 'sdnc'
275 end
Victor Morales89ce3212017-06-16 18:32:48 -0500276 sdnc.vm.provision 'shell' do |s|
277 s.path = 'postinstall.sh'
278 s.args = ['sdnc']
279 s.env = conf
280 end
281 end
282
283 config.vm.define :portal do |portal|
284 portal.vm.hostname = 'portal'
285 portal.vm.network :private_network, ip: '192.168.50.11'
Victor Moralesdd074802017-07-26 16:06:35 -0500286 portal.vm.provider "openstack" do |v|
287 v.server_name = 'portal'
288 end
Victor Morales89ce3212017-06-16 18:32:48 -0500289 portal.vm.provision 'shell' do |s|
290 s.path = 'postinstall.sh'
291 s.args = ['portal']
292 s.env = conf
293 end
294 end
295
296 config.vm.define :dcae do |dcae|
297 dcae.vm.hostname = 'dcae'
298 dcae.vm.network :private_network, ip: '192.168.50.12'
Victor Moralesdd074802017-07-26 16:06:35 -0500299 dcae.vm.provider "openstack" do |v|
300 v.server_name = 'dcae'
301 end
Victor Morales89ce3212017-06-16 18:32:48 -0500302 dcae.vm.provision 'shell' do |s|
303 s.path = 'postinstall.sh'
304 s.args = ['dcae']
305 s.env = conf
306 end
307 end
308
309 config.vm.define :policy do |policy|
310 policy.vm.hostname = 'policy'
311 policy.vm.network :private_network, ip: '192.168.50.13'
Victor Moralesdd074802017-07-26 16:06:35 -0500312 policy.vm.provider "openstack" do |v|
313 v.server_name = 'policy'
314 end
Victor Morales89ce3212017-06-16 18:32:48 -0500315 policy.vm.provision 'shell' do |s|
316 s.path = 'postinstall.sh'
317 s.args = ['policy']
318 s.env = conf
319 end
320 end
321
322 config.vm.define :appc do |appc|
323 appc.vm.hostname = 'appc'
324 appc.vm.network :private_network, ip: '192.168.50.14'
Victor Moralesdd074802017-07-26 16:06:35 -0500325 appc.vm.provider "openstack" do |v|
326 v.server_name = 'appc'
327 end
Victor Morales89ce3212017-06-16 18:32:48 -0500328 appc.vm.provision 'shell' do |s|
329 s.path = 'postinstall.sh'
330 s.args = ['appc']
331 s.env = conf
332 end
333 end
334
Victor Moralesdd074802017-07-26 16:06:35 -0500335 config.vm.define :vfc do |vfc|
336 vfc.vm.hostname = 'vfc'
337 vfc.vm.network :private_network, ip: '192.168.50.15'
338 vfc.vm.provider "openstack" do |v|
339 v.server_name = 'vfc'
340 end
341 vfc.vm.provision 'shell' do |s|
342 s.path = 'postinstall.sh'
343 s.args = ['vfc']
344 s.env = conf
345 end
346 end
347
348 when 'testing'
349
350 config.vm.define :testing do |testing|
351 test_suite = ENV.fetch('TEST_SUITE', '*')
352 test_case = ENV.fetch('TEST_CASE', '*')
353
354 testing.vm.hostname = 'testing'
355 testing.vm.network :private_network, ip: '192.168.50.3'
356 testing.vm.synced_folder './tests', '/var/onap_tests/', create: true
357 testing.vm.provider "virtualbox" do |v|
Victor Morales158c18c2017-08-06 11:23:15 -0500358 v.customize ["modifyvm", :id, "--memory", 4 * 1024]
Victor Moralesdd074802017-07-26 16:06:35 -0500359 end
360 testing.vm.provider "libvirt" do |v|
Victor Morales158c18c2017-08-06 11:23:15 -0500361 v.memory = 4 * 1024
Victor Moralesdd074802017-07-26 16:06:35 -0500362 v.nested = true
363 end
364 testing.vm.provider "openstack" do |v|
365 v.server_name = 'testing'
366 v.flavor = 'm1.small'
367 end
368 testing.vm.provision 'shell' do |s|
369 s.path = 'unit_testing.sh'
370 s.args = [test_suite, test_case]
371 s.env = conf
372 end
373 end
374
Victor Morales89ce3212017-06-16 18:32:48 -0500375 end
376end