blob: 8417cc953ae52c27e2935b6aed49070eef8ffe37 [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',
Idan Amit1690e082017-08-20 08:58:14 +030030 'clone_repo' => 'True',
Victor Morales2909e2e2017-08-08 15:51:52 -050031 'compile_repo' => 'False',
32 'enable_oparent' => 'True'
Victor Morales89ce3212017-06-16 18:32:48 -050033}
34
Victor Moralesdd074802017-07-26 16:06:35 -050035Vagrant.require_version ">= 1.8.6"
36
37# Determine the OS for the host computer
38module OS
39 def OS.windows?
40 (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
41 end
42
43 def OS.mac?
44 (/darwin/ =~ RUBY_PLATFORM) != nil
45 end
46
47 def OS.unix?
48 !OS.windows?
49 end
50
51 def OS.linux?
52 OS.unix? and not OS.mac?
53 end
54end
55
56if OS.windows?
57 puts "Vagrant launched from windows. This configuration has not fully tested."
58end
59
60# Determine the provider used
61provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
62puts "Using #{provider} provider"
63
Victor Morales89ce3212017-06-16 18:32:48 -050064vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml')
65if File.exist?(vd_conf)
66 require 'yaml'
67 user_conf = YAML.load_file(vd_conf)
68 conf.update(user_conf)
69end
70
71deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual')
72sdc_volume='vol1-sdc-data.vdi'
73
74Vagrant.configure("2") do |config|
75
76 if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil and ENV['no_proxy'] != nil
77 if not Vagrant.has_plugin?('vagrant-proxyconf')
78 system 'vagrant plugin install vagrant-proxyconf'
79 raise 'vagrant-proxyconf was installed but it requires to execute again'
80 end
81 config.proxy.http = ENV['http_proxy']
82 config.proxy.https = ENV['https_proxy']
83 config.proxy.no_proxy = ENV['no_proxy']
84 end
85
Victor Moralesd4036482017-08-15 17:54:14 -050086 if Vagrant.has_plugin?('vagrant-vbguest')
87 puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts'
88 config.vbguest.auto_update = false
89 end
90
Victor Morales89ce3212017-06-16 18:32:48 -050091 config.vm.box = 'ubuntu/trusty64'
Victor Moralesdd074802017-07-26 16:06:35 -050092 if provider == :libvirt
93 config.vm.box = 'sputnik13/trusty64'
Victor Moralesf62e7b82017-07-27 17:26:06 -050094 if not Vagrant.has_plugin?('vagrant-libvirt')
95 system 'vagrant plugin install vagrant-libvirt'
96 raise 'vagrant-libvirt was installed but it requires to execute again'
97 end
Victor Moralesdd074802017-07-26 16:06:35 -050098 end
99 if provider == :openstack
100 config.vm.box = nil
101 config.ssh.username = 'ubuntu'
102 if not Vagrant.has_plugin?('vagrant-openstack-provider')
103 system 'vagrant plugin install vagrant-openstack-provider'
104 raise 'vagrant-openstack-provider was installed but it requires to execute again'
105 end
106 end
Victor Morales89ce3212017-06-16 18:32:48 -0500107 #config.vm.provision "docker"
108 config.vm.synced_folder './opt', '/opt/', create: true
109 config.vm.synced_folder './lib', '/var/onap/', create: true
110 config.vm.synced_folder '~/.m2', '/root/.m2/', create: true
111
Victor Moralesdd074802017-07-26 16:06:35 -0500112 config.vm.provider :virtualbox do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500113 v.customize ["modifyvm", :id, "--memory", 4 * 1024]
114 end
Victor Moralesdd074802017-07-26 16:06:35 -0500115 config.vm.provider :libvirt do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500116 v.memory = 4 * 1024
117 v.nested = true
118 end
Victor Moralesdd074802017-07-26 16:06:35 -0500119 config.vm.provider :openstack do |v|
120
121 v.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
122 v.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
123 v.username = ENV.fetch('OS_USERNAME', '')
124 v.password = ENV.fetch('OS_PASSWORD', '')
125 v.region = ENV.fetch('OS_REGION_NAME', '')
126 v.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
127 v.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
128 v.project_name = ENV.fetch('OS_PROJECT_NAME', '')
129
130 v.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
131 v.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
132 v.image = ENV.fetch('OS_IMAGE', '')
133 v.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
134 v.flavor = 'm1.medium'
135 v.networks = ENV.fetch('OS_NETWORK', '')
136 end
Victor Morales89ce3212017-06-16 18:32:48 -0500137
138 case deploy_mode
139
140 when 'all-in-one'
141
142 config.vm.define :all_in_one do |all_in_one|
143 all_in_one.vm.hostname = 'all-in-one'
144 all_in_one.vm.network :private_network, ip: '192.168.50.3'
145 all_in_one.vm.provider "virtualbox" do |v|
146 v.customize ["modifyvm", :id, "--memory", 12 * 1024]
147 unless File.exist?(sdc_volume)
148 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
149 end
150 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
151 end
152 all_in_one.vm.provider "libvirt" do |v|
153 v.memory = 12 * 1024
154 v.nested = true
155 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
156 end
Victor Moralesdd074802017-07-26 16:06:35 -0500157 all_in_one.vm.provider "openstack" do |v|
158 v.server_name = 'all-in-one'
159 v.flavor = 'm1.xlarge'
160 end
Victor Morales89ce3212017-06-16 18:32:48 -0500161 all_in_one.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700162 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales896c8072017-09-12 12:19:57 -0700163 s.args = ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc', 'ccsdk']
Victor Morales89ce3212017-06-16 18:32:48 -0500164 s.env = conf
165 end
166 end
167
168 when 'individual'
169
170 config.vm.define :dns do |dns|
171 dns.vm.hostname = 'dns'
172 dns.vm.network :private_network, ip: '192.168.50.3'
173 dns.vm.provider "virtualbox" do |v|
174 v.customize ["modifyvm", :id, "--memory", 1 * 1024]
175 end
176 dns.vm.provider "libvirt" do |v|
177 v.memory = 1 * 1024
178 v.nested = true
179 end
Victor Moralesdd074802017-07-26 16:06:35 -0500180 dns.vm.provider "openstack" do |v|
181 v.server_name = 'dns'
182 v.flavor = 'm1.small'
183 end
Victor Morales89ce3212017-06-16 18:32:48 -0500184 dns.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700185 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500186 s.env = conf
187 end
188 end
189
Victor Moralesdd074802017-07-26 16:06:35 -0500190 config.vm.define :mr do |mr|
191 mr.vm.hostname = 'message-router'
192 mr.vm.network :private_network, ip: '192.168.50.4'
193 mr.vm.provider "openstack" do |v|
194 v.server_name = 'message-router'
195 end
196 mr.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700197 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500198 s.args = ['mr']
199 s.env = conf
200 end
201 end
202
203 config.vm.define :sdc do |sdc|
204 sdc.vm.hostname = 'sdc'
205 sdc.vm.network :private_network, ip: '192.168.50.5'
206 sdc.vm.provider "virtualbox" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500207 unless File.exist?(sdc_volume)
208 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
209 end
210 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
211 end
212 sdc.vm.provider "libvirt" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500213 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
214 end
Victor Moralesdd074802017-07-26 16:06:35 -0500215 sdc.vm.provider "openstack" do |v|
216 v.server_name = 'sdc'
217 end
Victor Morales89ce3212017-06-16 18:32:48 -0500218 sdc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700219 s.path = 'vagrant_utils/postinstall.sh'
Idan Amitbf1e7f02017-08-20 16:05:46 +0300220 s.args = ['sdc']
Victor Morales89ce3212017-06-16 18:32:48 -0500221 s.env = conf
222 end
223 end
Victor Moralesd4036482017-08-15 17:54:14 -0500224
Victor Morales89ce3212017-06-16 18:32:48 -0500225 config.vm.define :aai do |aai|
226 aai.vm.hostname = 'aai'
227 aai.vm.network :private_network, ip: '192.168.50.6'
Victor Moralesdd074802017-07-26 16:06:35 -0500228 aai.vm.provider "openstack" do |v|
229 v.server_name = 'aai'
230 end
Victor Moralesd4036482017-08-15 17:54:14 -0500231 aai.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700232 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500233 s.args = ['aai']
234 s.env = conf
235 end
236 end
Victor Moralesd4036482017-08-15 17:54:14 -0500237
Victor Morales89ce3212017-06-16 18:32:48 -0500238 config.vm.define :mso do |mso|
Victor Moralesdd074802017-07-26 16:06:35 -0500239 mso.vm.hostname = 'mso'
Victor Morales89ce3212017-06-16 18:32:48 -0500240 mso.vm.network :private_network, ip: '192.168.50.7'
Victor Moralesdd074802017-07-26 16:06:35 -0500241 mso.vm.provider "openstack" do |v|
242 v.server_name = 'mso'
243 end
Victor Moralesd4036482017-08-15 17:54:14 -0500244 mso.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700245 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500246 s.args = ['mso']
247 s.env = conf
248 end
249 end
250
251 config.vm.define :robot do |robot|
252 robot.vm.hostname = 'robot'
253 robot.vm.network :private_network, ip: '192.168.50.8'
Victor Moralesdd074802017-07-26 16:06:35 -0500254 robot.vm.provider "openstack" do |v|
255 v.server_name = 'robot'
256 end
Victor Morales89ce3212017-06-16 18:32:48 -0500257 robot.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700258 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500259 s.args = ['robot']
260 s.env = conf
261 end
262 end
Victor Moralesd4036482017-08-15 17:54:14 -0500263
Victor Morales89ce3212017-06-16 18:32:48 -0500264 config.vm.define :vid do |vid|
265 vid.vm.hostname = 'vid'
266 vid.vm.network :private_network, ip: '192.168.50.9'
Victor Moralesdd074802017-07-26 16:06:35 -0500267 vid.vm.provider "openstack" do |v|
268 v.server_name = 'vid'
269 end
Victor Morales89ce3212017-06-16 18:32:48 -0500270 vid.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700271 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500272 s.args = ['vid']
273 s.env = conf
274 end
275 end
Victor Moralesd4036482017-08-15 17:54:14 -0500276
Victor Morales89ce3212017-06-16 18:32:48 -0500277 config.vm.define :sdnc do |sdnc|
278 sdnc.vm.hostname = 'sdnc'
279 sdnc.vm.network :private_network, ip: '192.168.50.10'
Victor Moralesdd074802017-07-26 16:06:35 -0500280 sdnc.vm.provider "openstack" do |v|
281 v.server_name = 'sdnc'
282 end
Victor Morales89ce3212017-06-16 18:32:48 -0500283 sdnc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700284 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500285 s.args = ['sdnc']
286 s.env = conf
287 end
288 end
Victor Moralesd4036482017-08-15 17:54:14 -0500289
Victor Morales89ce3212017-06-16 18:32:48 -0500290 config.vm.define :portal do |portal|
291 portal.vm.hostname = 'portal'
292 portal.vm.network :private_network, ip: '192.168.50.11'
Victor Moralesdd074802017-07-26 16:06:35 -0500293 portal.vm.provider "openstack" do |v|
294 v.server_name = 'portal'
295 end
Victor Morales89ce3212017-06-16 18:32:48 -0500296 portal.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700297 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500298 s.args = ['portal']
299 s.env = conf
300 end
301 end
Victor Moralesd4036482017-08-15 17:54:14 -0500302
Victor Morales89ce3212017-06-16 18:32:48 -0500303 config.vm.define :dcae do |dcae|
304 dcae.vm.hostname = 'dcae'
305 dcae.vm.network :private_network, ip: '192.168.50.12'
Victor Moralesdd074802017-07-26 16:06:35 -0500306 dcae.vm.provider "openstack" do |v|
307 v.server_name = 'dcae'
308 end
Victor Morales89ce3212017-06-16 18:32:48 -0500309 dcae.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700310 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500311 s.args = ['dcae']
312 s.env = conf
313 end
314 end
Victor Moralesd4036482017-08-15 17:54:14 -0500315
Victor Morales89ce3212017-06-16 18:32:48 -0500316 config.vm.define :policy do |policy|
317 policy.vm.hostname = 'policy'
318 policy.vm.network :private_network, ip: '192.168.50.13'
Victor Moralesdd074802017-07-26 16:06:35 -0500319 policy.vm.provider "openstack" do |v|
320 v.server_name = 'policy'
321 end
Victor Morales89ce3212017-06-16 18:32:48 -0500322 policy.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700323 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500324 s.args = ['policy']
325 s.env = conf
326 end
327 end
Victor Moralesd4036482017-08-15 17:54:14 -0500328
Victor Morales89ce3212017-06-16 18:32:48 -0500329 config.vm.define :appc do |appc|
330 appc.vm.hostname = 'appc'
331 appc.vm.network :private_network, ip: '192.168.50.14'
Victor Moralesdd074802017-07-26 16:06:35 -0500332 appc.vm.provider "openstack" do |v|
333 v.server_name = 'appc'
334 end
Victor Morales89ce3212017-06-16 18:32:48 -0500335 appc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700336 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500337 s.args = ['appc']
338 s.env = conf
339 end
340 end
341
Victor Moralesdd074802017-07-26 16:06:35 -0500342 config.vm.define :vfc do |vfc|
343 vfc.vm.hostname = 'vfc'
344 vfc.vm.network :private_network, ip: '192.168.50.15'
345 vfc.vm.provider "openstack" do |v|
346 v.server_name = 'vfc'
347 end
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -0700348 vfc.vm.provision 'docker'
Victor Moralesdd074802017-07-26 16:06:35 -0500349 vfc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700350 s.path = 'vagrant_utils/postinstall.sh'
Victor Moralesdd074802017-07-26 16:06:35 -0500351 s.args = ['vfc']
352 s.env = conf
353 end
354 end
355
Victor Morales000de532017-08-31 17:28:10 -0500356 config.vm.define :multicloud do |multicloud|
357 multicloud.vm.hostname = 'multicloud'
358 multicloud.vm.network :private_network, ip: '192.168.50.16'
359 multicloud.vm.provider "openstack" do |v|
360 v.server_name = 'multicloud'
361 end
362 multicloud.vm.provision 'shell' do |s|
363 s.path = 'vagrant_utils/postinstall.sh'
364 s.args = ['multicloud']
365 s.env = conf
366 end
367 end
368
Victor Morales896c8072017-09-12 12:19:57 -0700369 config.vm.define :ccsdk do |ccsdk|
370 ccsdk.vm.hostname = 'ccsdk'
371 ccsdk.vm.network :private_network, ip: '192.168.50.17'
372 ccsdk.vm.provider "openstack" do |v|
373 v.server_name = 'ccsdk'
374 end
375 ccsdk.vm.provision 'shell' do |s|
376 s.path = 'vagrant_utils/postinstall.sh'
377 s.args = ['ccsdk']
378 s.env = conf
379 end
380 end
381
Victor Moralesdd074802017-07-26 16:06:35 -0500382 when 'testing'
383
384 config.vm.define :testing do |testing|
385 test_suite = ENV.fetch('TEST_SUITE', '*')
386 test_case = ENV.fetch('TEST_CASE', '*')
387
388 testing.vm.hostname = 'testing'
389 testing.vm.network :private_network, ip: '192.168.50.3'
390 testing.vm.synced_folder './tests', '/var/onap_tests/', create: true
391 testing.vm.provider "virtualbox" do |v|
Victor Morales158c18c2017-08-06 11:23:15 -0500392 v.customize ["modifyvm", :id, "--memory", 4 * 1024]
Victor Moralesdd074802017-07-26 16:06:35 -0500393 end
394 testing.vm.provider "libvirt" do |v|
Victor Morales158c18c2017-08-06 11:23:15 -0500395 v.memory = 4 * 1024
Victor Moralesdd074802017-07-26 16:06:35 -0500396 v.nested = true
397 end
398 testing.vm.provider "openstack" do |v|
399 v.server_name = 'testing'
400 v.flavor = 'm1.small'
401 end
402 testing.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700403 s.path = 'vagrant_utils/unit_testing.sh'
Victor Moralesdd074802017-07-26 16:06:35 -0500404 s.args = [test_suite, test_case]
405 s.env = conf
406 end
407 end
408
Victor Morales89ce3212017-06-16 18:32:48 -0500409 end
410end