blob: f89c2dc473a343668432d5534bff7fc773d9fb4f [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',
29 'compile_repo' => 'False'
Victor Morales89ce3212017-06-16 18:32:48 -050030}
31
Victor Moralesdd074802017-07-26 16:06:35 -050032Vagrant.require_version ">= 1.8.6"
33
34# Determine the OS for the host computer
35module OS
36 def OS.windows?
37 (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
38 end
39
40 def OS.mac?
41 (/darwin/ =~ RUBY_PLATFORM) != nil
42 end
43
44 def OS.unix?
45 !OS.windows?
46 end
47
48 def OS.linux?
49 OS.unix? and not OS.mac?
50 end
51end
52
53if OS.windows?
54 puts "Vagrant launched from windows. This configuration has not fully tested."
55end
56
57# Determine the provider used
58provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
59puts "Using #{provider} provider"
60
Victor Morales89ce3212017-06-16 18:32:48 -050061vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml')
62if File.exist?(vd_conf)
63 require 'yaml'
64 user_conf = YAML.load_file(vd_conf)
65 conf.update(user_conf)
66end
67
68deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual')
69sdc_volume='vol1-sdc-data.vdi'
70
71Vagrant.configure("2") do |config|
72
73 if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil and ENV['no_proxy'] != nil
74 if not Vagrant.has_plugin?('vagrant-proxyconf')
75 system 'vagrant plugin install vagrant-proxyconf'
76 raise 'vagrant-proxyconf was installed but it requires to execute again'
77 end
78 config.proxy.http = ENV['http_proxy']
79 config.proxy.https = ENV['https_proxy']
80 config.proxy.no_proxy = ENV['no_proxy']
81 end
82
Victor Morales89ce3212017-06-16 18:32:48 -050083 config.vm.box = 'ubuntu/trusty64'
Victor Moralesdd074802017-07-26 16:06:35 -050084 if provider == :libvirt
85 config.vm.box = 'sputnik13/trusty64'
Victor Moralesf62e7b82017-07-27 17:26:06 -050086 if not Vagrant.has_plugin?('vagrant-libvirt')
87 system 'vagrant plugin install vagrant-libvirt'
88 raise 'vagrant-libvirt was installed but it requires to execute again'
89 end
Victor Moralesdd074802017-07-26 16:06:35 -050090 end
91 if provider == :openstack
92 config.vm.box = nil
93 config.ssh.username = 'ubuntu'
94 if not Vagrant.has_plugin?('vagrant-openstack-provider')
95 system 'vagrant plugin install vagrant-openstack-provider'
96 raise 'vagrant-openstack-provider was installed but it requires to execute again'
97 end
98 end
Victor Morales89ce3212017-06-16 18:32:48 -050099 #config.vm.provision "docker"
100 config.vm.synced_folder './opt', '/opt/', create: true
101 config.vm.synced_folder './lib', '/var/onap/', create: true
102 config.vm.synced_folder '~/.m2', '/root/.m2/', create: true
103
Victor Moralesdd074802017-07-26 16:06:35 -0500104 config.vm.provider :virtualbox do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500105 v.customize ["modifyvm", :id, "--memory", 4 * 1024]
106 end
Victor Moralesdd074802017-07-26 16:06:35 -0500107 config.vm.provider :libvirt do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500108 v.memory = 4 * 1024
109 v.nested = true
110 end
Victor Moralesdd074802017-07-26 16:06:35 -0500111 config.vm.provider :openstack do |v|
112
113 v.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
114 v.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
115 v.username = ENV.fetch('OS_USERNAME', '')
116 v.password = ENV.fetch('OS_PASSWORD', '')
117 v.region = ENV.fetch('OS_REGION_NAME', '')
118 v.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
119 v.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
120 v.project_name = ENV.fetch('OS_PROJECT_NAME', '')
121
122 v.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
123 v.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
124 v.image = ENV.fetch('OS_IMAGE', '')
125 v.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
126 v.flavor = 'm1.medium'
127 v.networks = ENV.fetch('OS_NETWORK', '')
128 end
Victor Morales89ce3212017-06-16 18:32:48 -0500129
130 case deploy_mode
131
132 when 'all-in-one'
133
134 config.vm.define :all_in_one do |all_in_one|
135 all_in_one.vm.hostname = 'all-in-one'
136 all_in_one.vm.network :private_network, ip: '192.168.50.3'
137 all_in_one.vm.provider "virtualbox" do |v|
138 v.customize ["modifyvm", :id, "--memory", 12 * 1024]
139 unless File.exist?(sdc_volume)
140 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
141 end
142 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
143 end
144 all_in_one.vm.provider "libvirt" do |v|
145 v.memory = 12 * 1024
146 v.nested = true
147 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
148 end
Victor Moralesdd074802017-07-26 16:06:35 -0500149 all_in_one.vm.provider "openstack" do |v|
150 v.server_name = 'all-in-one'
151 v.flavor = 'm1.xlarge'
152 end
Victor Morales89ce3212017-06-16 18:32:48 -0500153 all_in_one.vm.provision 'shell' do |s|
154 s.path = 'postinstall.sh'
Victor Moralesdd074802017-07-26 16:06:35 -0500155 s.args = ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc']
Victor Morales89ce3212017-06-16 18:32:48 -0500156 s.env = conf
157 end
158 end
159
160 when 'individual'
161
162 config.vm.define :dns do |dns|
163 dns.vm.hostname = 'dns'
164 dns.vm.network :private_network, ip: '192.168.50.3'
165 dns.vm.provider "virtualbox" do |v|
166 v.customize ["modifyvm", :id, "--memory", 1 * 1024]
167 end
168 dns.vm.provider "libvirt" do |v|
169 v.memory = 1 * 1024
170 v.nested = true
171 end
Victor Moralesdd074802017-07-26 16:06:35 -0500172 dns.vm.provider "openstack" do |v|
173 v.server_name = 'dns'
174 v.flavor = 'm1.small'
175 end
Victor Morales89ce3212017-06-16 18:32:48 -0500176 dns.vm.provision 'shell' do |s|
177 s.path = 'postinstall.sh'
178 s.env = conf
179 end
180 end
181
Victor Moralesdd074802017-07-26 16:06:35 -0500182 config.vm.define :mr do |mr|
183 mr.vm.hostname = 'message-router'
184 mr.vm.network :private_network, ip: '192.168.50.4'
185 mr.vm.provider "openstack" do |v|
186 v.server_name = 'message-router'
187 end
188 mr.vm.provision 'shell' do |s|
Victor Morales89ce3212017-06-16 18:32:48 -0500189 s.path = 'postinstall.sh'
190 s.args = ['mr']
191 s.env = conf
192 end
193 end
194
195 config.vm.define :sdc do |sdc|
196 sdc.vm.hostname = 'sdc'
197 sdc.vm.network :private_network, ip: '192.168.50.5'
198 sdc.vm.provider "virtualbox" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500199 unless File.exist?(sdc_volume)
200 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
201 end
202 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
203 end
204 sdc.vm.provider "libvirt" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500205 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
206 end
Victor Moralesdd074802017-07-26 16:06:35 -0500207 sdc.vm.provider "openstack" do |v|
208 v.server_name = 'sdc'
209 end
Victor Morales89ce3212017-06-16 18:32:48 -0500210 sdc.vm.provision 'shell' do |s|
211 s.path = 'postinstall.sh'
212 s.args = ['sdc']
213 s.env = conf
214 end
215 end
216
217 config.vm.define :aai do |aai|
218 aai.vm.hostname = 'aai'
219 aai.vm.network :private_network, ip: '192.168.50.6'
Victor Moralesdd074802017-07-26 16:06:35 -0500220 aai.vm.provider "openstack" do |v|
221 v.server_name = 'aai'
222 end
Victor Morales89ce3212017-06-16 18:32:48 -0500223 aai.vm.provision 'shell' do |s|
224 s.path = 'postinstall.sh'
225 s.args = ['aai']
226 s.env = conf
227 end
228 end
229
230 config.vm.define :mso do |mso|
Victor Moralesdd074802017-07-26 16:06:35 -0500231 mso.vm.hostname = 'mso'
Victor Morales89ce3212017-06-16 18:32:48 -0500232 mso.vm.network :private_network, ip: '192.168.50.7'
Victor Moralesdd074802017-07-26 16:06:35 -0500233 mso.vm.provider "openstack" do |v|
234 v.server_name = 'mso'
235 end
Victor Morales89ce3212017-06-16 18:32:48 -0500236 mso.vm.provision 'shell' do |s|
237 s.path = 'postinstall.sh'
238 s.args = ['mso']
239 s.env = conf
240 end
241 end
242
243 config.vm.define :robot do |robot|
244 robot.vm.hostname = 'robot'
245 robot.vm.network :private_network, ip: '192.168.50.8'
Victor Moralesdd074802017-07-26 16:06:35 -0500246 robot.vm.provider "openstack" do |v|
247 v.server_name = 'robot'
248 end
Victor Morales89ce3212017-06-16 18:32:48 -0500249 robot.vm.provision 'shell' do |s|
250 s.path = 'postinstall.sh'
251 s.args = ['robot']
252 s.env = conf
253 end
254 end
255
256 config.vm.define :vid do |vid|
257 vid.vm.hostname = 'vid'
258 vid.vm.network :private_network, ip: '192.168.50.9'
Victor Moralesdd074802017-07-26 16:06:35 -0500259 vid.vm.provider "openstack" do |v|
260 v.server_name = 'vid'
261 end
Victor Morales89ce3212017-06-16 18:32:48 -0500262 vid.vm.provision 'shell' do |s|
263 s.path = 'postinstall.sh'
264 s.args = ['vid']
265 s.env = conf
266 end
267 end
268
269 config.vm.define :sdnc do |sdnc|
270 sdnc.vm.hostname = 'sdnc'
271 sdnc.vm.network :private_network, ip: '192.168.50.10'
Victor Moralesdd074802017-07-26 16:06:35 -0500272 sdnc.vm.provider "openstack" do |v|
273 v.server_name = 'sdnc'
274 end
Victor Morales89ce3212017-06-16 18:32:48 -0500275 sdnc.vm.provision 'shell' do |s|
276 s.path = 'postinstall.sh'
277 s.args = ['sdnc']
278 s.env = conf
279 end
280 end
281
282 config.vm.define :portal do |portal|
283 portal.vm.hostname = 'portal'
284 portal.vm.network :private_network, ip: '192.168.50.11'
Victor Moralesdd074802017-07-26 16:06:35 -0500285 portal.vm.provider "openstack" do |v|
286 v.server_name = 'portal'
287 end
Victor Morales89ce3212017-06-16 18:32:48 -0500288 portal.vm.provision 'shell' do |s|
289 s.path = 'postinstall.sh'
290 s.args = ['portal']
291 s.env = conf
292 end
293 end
294
295 config.vm.define :dcae do |dcae|
296 dcae.vm.hostname = 'dcae'
297 dcae.vm.network :private_network, ip: '192.168.50.12'
Victor Moralesdd074802017-07-26 16:06:35 -0500298 dcae.vm.provider "openstack" do |v|
299 v.server_name = 'dcae'
300 end
Victor Morales89ce3212017-06-16 18:32:48 -0500301 dcae.vm.provision 'shell' do |s|
302 s.path = 'postinstall.sh'
303 s.args = ['dcae']
304 s.env = conf
305 end
306 end
307
308 config.vm.define :policy do |policy|
309 policy.vm.hostname = 'policy'
310 policy.vm.network :private_network, ip: '192.168.50.13'
Victor Moralesdd074802017-07-26 16:06:35 -0500311 policy.vm.provider "openstack" do |v|
312 v.server_name = 'policy'
313 end
Victor Morales89ce3212017-06-16 18:32:48 -0500314 policy.vm.provision 'shell' do |s|
315 s.path = 'postinstall.sh'
316 s.args = ['policy']
317 s.env = conf
318 end
319 end
320
321 config.vm.define :appc do |appc|
322 appc.vm.hostname = 'appc'
323 appc.vm.network :private_network, ip: '192.168.50.14'
Victor Moralesdd074802017-07-26 16:06:35 -0500324 appc.vm.provider "openstack" do |v|
325 v.server_name = 'appc'
326 end
Victor Morales89ce3212017-06-16 18:32:48 -0500327 appc.vm.provision 'shell' do |s|
328 s.path = 'postinstall.sh'
329 s.args = ['appc']
330 s.env = conf
331 end
332 end
333
Victor Moralesdd074802017-07-26 16:06:35 -0500334 config.vm.define :vfc do |vfc|
335 vfc.vm.hostname = 'vfc'
336 vfc.vm.network :private_network, ip: '192.168.50.15'
337 vfc.vm.provider "openstack" do |v|
338 v.server_name = 'vfc'
339 end
340 vfc.vm.provision 'shell' do |s|
341 s.path = 'postinstall.sh'
342 s.args = ['vfc']
343 s.env = conf
344 end
345 end
346
347 when 'testing'
348
349 config.vm.define :testing do |testing|
350 test_suite = ENV.fetch('TEST_SUITE', '*')
351 test_case = ENV.fetch('TEST_CASE', '*')
352
353 testing.vm.hostname = 'testing'
354 testing.vm.network :private_network, ip: '192.168.50.3'
355 testing.vm.synced_folder './tests', '/var/onap_tests/', create: true
356 testing.vm.provider "virtualbox" do |v|
357 v.customize ["modifyvm", :id, "--memory", 2 * 1024]
358 end
359 testing.vm.provider "libvirt" do |v|
360 v.memory = 2 * 1024
361 v.nested = true
362 end
363 testing.vm.provider "openstack" do |v|
364 v.server_name = 'testing'
365 v.flavor = 'm1.small'
366 end
367 testing.vm.provision 'shell' do |s|
368 s.path = 'unit_testing.sh'
369 s.args = [test_suite, test_case]
370 s.env = conf
371 end
372 end
373
Victor Morales89ce3212017-06-16 18:32:48 -0500374 end
375end