blob: 50c18c76be734964e674adc1b1f19bb81361715d [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 Moralesd4036482017-08-15 17:54:14 -050084 if Vagrant.has_plugin?('vagrant-vbguest')
85 puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts'
86 config.vbguest.auto_update = false
87 end
88
Victor Morales89ce3212017-06-16 18:32:48 -050089 config.vm.box = 'ubuntu/trusty64'
Victor Moralesdd074802017-07-26 16:06:35 -050090 if provider == :libvirt
91 config.vm.box = 'sputnik13/trusty64'
Victor Moralesf62e7b82017-07-27 17:26:06 -050092 if not Vagrant.has_plugin?('vagrant-libvirt')
93 system 'vagrant plugin install vagrant-libvirt'
94 raise 'vagrant-libvirt was installed but it requires to execute again'
95 end
Victor Moralesdd074802017-07-26 16:06:35 -050096 end
97 if provider == :openstack
98 config.vm.box = nil
99 config.ssh.username = 'ubuntu'
100 if not Vagrant.has_plugin?('vagrant-openstack-provider')
101 system 'vagrant plugin install vagrant-openstack-provider'
102 raise 'vagrant-openstack-provider was installed but it requires to execute again'
103 end
104 end
Victor Morales89ce3212017-06-16 18:32:48 -0500105 #config.vm.provision "docker"
106 config.vm.synced_folder './opt', '/opt/', create: true
107 config.vm.synced_folder './lib', '/var/onap/', create: true
108 config.vm.synced_folder '~/.m2', '/root/.m2/', create: true
109
Victor Moralesdd074802017-07-26 16:06:35 -0500110 config.vm.provider :virtualbox do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500111 v.customize ["modifyvm", :id, "--memory", 4 * 1024]
112 end
Victor Moralesdd074802017-07-26 16:06:35 -0500113 config.vm.provider :libvirt do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500114 v.memory = 4 * 1024
115 v.nested = true
116 end
Victor Moralesdd074802017-07-26 16:06:35 -0500117 config.vm.provider :openstack do |v|
118
119 v.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
120 v.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
121 v.username = ENV.fetch('OS_USERNAME', '')
122 v.password = ENV.fetch('OS_PASSWORD', '')
123 v.region = ENV.fetch('OS_REGION_NAME', '')
124 v.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
125 v.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
126 v.project_name = ENV.fetch('OS_PROJECT_NAME', '')
127
128 v.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
129 v.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
130 v.image = ENV.fetch('OS_IMAGE', '')
131 v.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
132 v.flavor = 'm1.medium'
133 v.networks = ENV.fetch('OS_NETWORK', '')
134 end
Victor Morales89ce3212017-06-16 18:32:48 -0500135
136 case deploy_mode
137
138 when 'all-in-one'
139
140 config.vm.define :all_in_one do |all_in_one|
141 all_in_one.vm.hostname = 'all-in-one'
142 all_in_one.vm.network :private_network, ip: '192.168.50.3'
143 all_in_one.vm.provider "virtualbox" do |v|
144 v.customize ["modifyvm", :id, "--memory", 12 * 1024]
145 unless File.exist?(sdc_volume)
146 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
147 end
148 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
149 end
150 all_in_one.vm.provider "libvirt" do |v|
151 v.memory = 12 * 1024
152 v.nested = true
153 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
154 end
Victor Moralesdd074802017-07-26 16:06:35 -0500155 all_in_one.vm.provider "openstack" do |v|
156 v.server_name = 'all-in-one'
157 v.flavor = 'm1.xlarge'
158 end
Victor Morales89ce3212017-06-16 18:32:48 -0500159 all_in_one.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700160 s.path = 'vagrant_utils/postinstall.sh'
Victor Moralesdd074802017-07-26 16:06:35 -0500161 s.args = ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc']
Victor Morales89ce3212017-06-16 18:32:48 -0500162 s.env = conf
163 end
164 end
165
166 when 'individual'
167
168 config.vm.define :dns do |dns|
169 dns.vm.hostname = 'dns'
170 dns.vm.network :private_network, ip: '192.168.50.3'
171 dns.vm.provider "virtualbox" do |v|
172 v.customize ["modifyvm", :id, "--memory", 1 * 1024]
173 end
174 dns.vm.provider "libvirt" do |v|
175 v.memory = 1 * 1024
176 v.nested = true
177 end
Victor Moralesdd074802017-07-26 16:06:35 -0500178 dns.vm.provider "openstack" do |v|
179 v.server_name = 'dns'
180 v.flavor = 'm1.small'
181 end
Victor Morales89ce3212017-06-16 18:32:48 -0500182 dns.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700183 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500184 s.env = conf
185 end
186 end
187
Victor Moralesdd074802017-07-26 16:06:35 -0500188 config.vm.define :mr do |mr|
189 mr.vm.hostname = 'message-router'
190 mr.vm.network :private_network, ip: '192.168.50.4'
191 mr.vm.provider "openstack" do |v|
192 v.server_name = 'message-router'
193 end
194 mr.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700195 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500196 s.args = ['mr']
197 s.env = conf
198 end
199 end
200
201 config.vm.define :sdc do |sdc|
202 sdc.vm.hostname = 'sdc'
203 sdc.vm.network :private_network, ip: '192.168.50.5'
204 sdc.vm.provider "virtualbox" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500205 unless File.exist?(sdc_volume)
206 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
207 end
208 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
209 end
210 sdc.vm.provider "libvirt" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500211 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
212 end
Victor Moralesdd074802017-07-26 16:06:35 -0500213 sdc.vm.provider "openstack" do |v|
214 v.server_name = 'sdc'
215 end
Victor Morales89ce3212017-06-16 18:32:48 -0500216 sdc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700217 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500218 s.args = ['sdc']
219 s.env = conf
220 end
221 end
Victor Moralesd4036482017-08-15 17:54:14 -0500222
Victor Morales89ce3212017-06-16 18:32:48 -0500223 config.vm.define :aai do |aai|
224 aai.vm.hostname = 'aai'
225 aai.vm.network :private_network, ip: '192.168.50.6'
Victor Moralesdd074802017-07-26 16:06:35 -0500226 aai.vm.provider "openstack" do |v|
227 v.server_name = 'aai'
228 end
Victor Moralesd4036482017-08-15 17:54:14 -0500229 aai.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700230 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500231 s.args = ['aai']
232 s.env = conf
233 end
234 end
Victor Moralesd4036482017-08-15 17:54:14 -0500235
Victor Morales89ce3212017-06-16 18:32:48 -0500236 config.vm.define :mso do |mso|
Victor Moralesdd074802017-07-26 16:06:35 -0500237 mso.vm.hostname = 'mso'
Victor Morales89ce3212017-06-16 18:32:48 -0500238 mso.vm.network :private_network, ip: '192.168.50.7'
Victor Moralesdd074802017-07-26 16:06:35 -0500239 mso.vm.provider "openstack" do |v|
240 v.server_name = 'mso'
241 end
Victor Moralesd4036482017-08-15 17:54:14 -0500242 mso.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700243 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500244 s.args = ['mso']
245 s.env = conf
246 end
247 end
248
249 config.vm.define :robot do |robot|
250 robot.vm.hostname = 'robot'
251 robot.vm.network :private_network, ip: '192.168.50.8'
Victor Moralesdd074802017-07-26 16:06:35 -0500252 robot.vm.provider "openstack" do |v|
253 v.server_name = 'robot'
254 end
Victor Morales89ce3212017-06-16 18:32:48 -0500255 robot.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700256 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500257 s.args = ['robot']
258 s.env = conf
259 end
260 end
Victor Moralesd4036482017-08-15 17:54:14 -0500261
Victor Morales89ce3212017-06-16 18:32:48 -0500262 config.vm.define :vid do |vid|
263 vid.vm.hostname = 'vid'
264 vid.vm.network :private_network, ip: '192.168.50.9'
Victor Moralesdd074802017-07-26 16:06:35 -0500265 vid.vm.provider "openstack" do |v|
266 v.server_name = 'vid'
267 end
Victor Morales89ce3212017-06-16 18:32:48 -0500268 vid.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700269 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500270 s.args = ['vid']
271 s.env = conf
272 end
273 end
Victor Moralesd4036482017-08-15 17:54:14 -0500274
Victor Morales89ce3212017-06-16 18:32:48 -0500275 config.vm.define :sdnc do |sdnc|
276 sdnc.vm.hostname = 'sdnc'
277 sdnc.vm.network :private_network, ip: '192.168.50.10'
Victor Moralesdd074802017-07-26 16:06:35 -0500278 sdnc.vm.provider "openstack" do |v|
279 v.server_name = 'sdnc'
280 end
Victor Morales89ce3212017-06-16 18:32:48 -0500281 sdnc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700282 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500283 s.args = ['sdnc']
284 s.env = conf
285 end
286 end
Victor Moralesd4036482017-08-15 17:54:14 -0500287
Victor Morales89ce3212017-06-16 18:32:48 -0500288 config.vm.define :portal do |portal|
289 portal.vm.hostname = 'portal'
290 portal.vm.network :private_network, ip: '192.168.50.11'
Victor Moralesdd074802017-07-26 16:06:35 -0500291 portal.vm.provider "openstack" do |v|
292 v.server_name = 'portal'
293 end
Victor Morales89ce3212017-06-16 18:32:48 -0500294 portal.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700295 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500296 s.args = ['portal']
297 s.env = conf
298 end
299 end
Victor Moralesd4036482017-08-15 17:54:14 -0500300
Victor Morales89ce3212017-06-16 18:32:48 -0500301 config.vm.define :dcae do |dcae|
302 dcae.vm.hostname = 'dcae'
303 dcae.vm.network :private_network, ip: '192.168.50.12'
Victor Moralesdd074802017-07-26 16:06:35 -0500304 dcae.vm.provider "openstack" do |v|
305 v.server_name = 'dcae'
306 end
Victor Morales89ce3212017-06-16 18:32:48 -0500307 dcae.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700308 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500309 s.args = ['dcae']
310 s.env = conf
311 end
312 end
Victor Moralesd4036482017-08-15 17:54:14 -0500313
Victor Morales89ce3212017-06-16 18:32:48 -0500314 config.vm.define :policy do |policy|
315 policy.vm.hostname = 'policy'
316 policy.vm.network :private_network, ip: '192.168.50.13'
Victor Moralesdd074802017-07-26 16:06:35 -0500317 policy.vm.provider "openstack" do |v|
318 v.server_name = 'policy'
319 end
Victor Morales89ce3212017-06-16 18:32:48 -0500320 policy.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700321 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500322 s.args = ['policy']
323 s.env = conf
324 end
325 end
Victor Moralesd4036482017-08-15 17:54:14 -0500326
Victor Morales89ce3212017-06-16 18:32:48 -0500327 config.vm.define :appc do |appc|
328 appc.vm.hostname = 'appc'
329 appc.vm.network :private_network, ip: '192.168.50.14'
Victor Moralesdd074802017-07-26 16:06:35 -0500330 appc.vm.provider "openstack" do |v|
331 v.server_name = 'appc'
332 end
Victor Morales89ce3212017-06-16 18:32:48 -0500333 appc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700334 s.path = 'vagrant_utils/postinstall.sh'
Victor Morales89ce3212017-06-16 18:32:48 -0500335 s.args = ['appc']
336 s.env = conf
337 end
338 end
339
Victor Moralesdd074802017-07-26 16:06:35 -0500340 config.vm.define :vfc do |vfc|
341 vfc.vm.hostname = 'vfc'
342 vfc.vm.network :private_network, ip: '192.168.50.15'
343 vfc.vm.provider "openstack" do |v|
344 v.server_name = 'vfc'
345 end
346 vfc.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700347 s.path = 'vagrant_utils/postinstall.sh'
Victor Moralesdd074802017-07-26 16:06:35 -0500348 s.args = ['vfc']
349 s.env = conf
350 end
351 end
352
353 when 'testing'
354
355 config.vm.define :testing do |testing|
356 test_suite = ENV.fetch('TEST_SUITE', '*')
357 test_case = ENV.fetch('TEST_CASE', '*')
358
359 testing.vm.hostname = 'testing'
360 testing.vm.network :private_network, ip: '192.168.50.3'
361 testing.vm.synced_folder './tests', '/var/onap_tests/', create: true
362 testing.vm.provider "virtualbox" do |v|
Victor Morales158c18c2017-08-06 11:23:15 -0500363 v.customize ["modifyvm", :id, "--memory", 4 * 1024]
Victor Moralesdd074802017-07-26 16:06:35 -0500364 end
365 testing.vm.provider "libvirt" do |v|
Victor Morales158c18c2017-08-06 11:23:15 -0500366 v.memory = 4 * 1024
Victor Moralesdd074802017-07-26 16:06:35 -0500367 v.nested = true
368 end
369 testing.vm.provider "openstack" do |v|
370 v.server_name = 'testing'
371 v.flavor = 'm1.small'
372 end
373 testing.vm.provision 'shell' do |s|
Nate Potter8a0c9452017-08-02 15:17:41 -0700374 s.path = 'vagrant_utils/unit_testing.sh'
Victor Moralesdd074802017-07-26 16:06:35 -0500375 s.args = [test_suite, test_case]
376 s.env = conf
377 end
378 end
379
Victor Morales89ce3212017-06-16 18:32:48 -0500380 end
381end