blob: a46afd5fe6ba3d5c01ab7f3fcbc180275b2f437c [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'
86 end
87 if provider == :openstack
88 config.vm.box = nil
89 config.ssh.username = 'ubuntu'
90 if not Vagrant.has_plugin?('vagrant-openstack-provider')
91 system 'vagrant plugin install vagrant-openstack-provider'
92 raise 'vagrant-openstack-provider was installed but it requires to execute again'
93 end
94 end
Victor Morales89ce3212017-06-16 18:32:48 -050095 #config.vm.provision "docker"
96 config.vm.synced_folder './opt', '/opt/', create: true
97 config.vm.synced_folder './lib', '/var/onap/', create: true
98 config.vm.synced_folder '~/.m2', '/root/.m2/', create: true
99
Victor Moralesdd074802017-07-26 16:06:35 -0500100 config.vm.provider :virtualbox do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500101 v.customize ["modifyvm", :id, "--memory", 4 * 1024]
102 end
Victor Moralesdd074802017-07-26 16:06:35 -0500103 config.vm.provider :libvirt do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500104 v.memory = 4 * 1024
105 v.nested = true
106 end
Victor Moralesdd074802017-07-26 16:06:35 -0500107 config.vm.provider :openstack do |v|
108
109 v.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
110 v.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
111 v.username = ENV.fetch('OS_USERNAME', '')
112 v.password = ENV.fetch('OS_PASSWORD', '')
113 v.region = ENV.fetch('OS_REGION_NAME', '')
114 v.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
115 v.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
116 v.project_name = ENV.fetch('OS_PROJECT_NAME', '')
117
118 v.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
119 v.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
120 v.image = ENV.fetch('OS_IMAGE', '')
121 v.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
122 v.flavor = 'm1.medium'
123 v.networks = ENV.fetch('OS_NETWORK', '')
124 end
Victor Morales89ce3212017-06-16 18:32:48 -0500125
126 case deploy_mode
127
128 when 'all-in-one'
129
130 config.vm.define :all_in_one do |all_in_one|
131 all_in_one.vm.hostname = 'all-in-one'
132 all_in_one.vm.network :private_network, ip: '192.168.50.3'
133 all_in_one.vm.provider "virtualbox" do |v|
134 v.customize ["modifyvm", :id, "--memory", 12 * 1024]
135 unless File.exist?(sdc_volume)
136 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
137 end
138 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
139 end
140 all_in_one.vm.provider "libvirt" do |v|
141 v.memory = 12 * 1024
142 v.nested = true
143 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
144 end
Victor Moralesdd074802017-07-26 16:06:35 -0500145 all_in_one.vm.provider "openstack" do |v|
146 v.server_name = 'all-in-one'
147 v.flavor = 'm1.xlarge'
148 end
Victor Morales89ce3212017-06-16 18:32:48 -0500149 all_in_one.vm.provision 'shell' do |s|
150 s.path = 'postinstall.sh'
Victor Moralesdd074802017-07-26 16:06:35 -0500151 s.args = ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc']
Victor Morales89ce3212017-06-16 18:32:48 -0500152 s.env = conf
153 end
154 end
155
156 when 'individual'
157
158 config.vm.define :dns do |dns|
159 dns.vm.hostname = 'dns'
160 dns.vm.network :private_network, ip: '192.168.50.3'
161 dns.vm.provider "virtualbox" do |v|
162 v.customize ["modifyvm", :id, "--memory", 1 * 1024]
163 end
164 dns.vm.provider "libvirt" do |v|
165 v.memory = 1 * 1024
166 v.nested = true
167 end
Victor Moralesdd074802017-07-26 16:06:35 -0500168 dns.vm.provider "openstack" do |v|
169 v.server_name = 'dns'
170 v.flavor = 'm1.small'
171 end
Victor Morales89ce3212017-06-16 18:32:48 -0500172 dns.vm.provision 'shell' do |s|
173 s.path = 'postinstall.sh'
174 s.env = conf
175 end
176 end
177
Victor Moralesdd074802017-07-26 16:06:35 -0500178 config.vm.define :mr do |mr|
179 mr.vm.hostname = 'message-router'
180 mr.vm.network :private_network, ip: '192.168.50.4'
181 mr.vm.provider "openstack" do |v|
182 v.server_name = 'message-router'
183 end
184 mr.vm.provision 'shell' do |s|
Victor Morales89ce3212017-06-16 18:32:48 -0500185 s.path = 'postinstall.sh'
186 s.args = ['mr']
187 s.env = conf
188 end
189 end
190
191 config.vm.define :sdc do |sdc|
192 sdc.vm.hostname = 'sdc'
193 sdc.vm.network :private_network, ip: '192.168.50.5'
194 sdc.vm.provider "virtualbox" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500195 unless File.exist?(sdc_volume)
196 v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
197 end
198 v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
199 end
200 sdc.vm.provider "libvirt" do |v|
Victor Morales89ce3212017-06-16 18:32:48 -0500201 v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
202 end
Victor Moralesdd074802017-07-26 16:06:35 -0500203 sdc.vm.provider "openstack" do |v|
204 v.server_name = 'sdc'
205 end
Victor Morales89ce3212017-06-16 18:32:48 -0500206 sdc.vm.provision 'shell' do |s|
207 s.path = 'postinstall.sh'
208 s.args = ['sdc']
209 s.env = conf
210 end
211 end
212
213 config.vm.define :aai do |aai|
214 aai.vm.hostname = 'aai'
215 aai.vm.network :private_network, ip: '192.168.50.6'
Victor Moralesdd074802017-07-26 16:06:35 -0500216 aai.vm.provider "openstack" do |v|
217 v.server_name = 'aai'
218 end
Victor Morales89ce3212017-06-16 18:32:48 -0500219 aai.vm.provision 'shell' do |s|
220 s.path = 'postinstall.sh'
221 s.args = ['aai']
222 s.env = conf
223 end
224 end
225
226 config.vm.define :mso do |mso|
Victor Moralesdd074802017-07-26 16:06:35 -0500227 mso.vm.hostname = 'mso'
Victor Morales89ce3212017-06-16 18:32:48 -0500228 mso.vm.network :private_network, ip: '192.168.50.7'
Victor Moralesdd074802017-07-26 16:06:35 -0500229 mso.vm.provider "openstack" do |v|
230 v.server_name = 'mso'
231 end
Victor Morales89ce3212017-06-16 18:32:48 -0500232 mso.vm.provision 'shell' do |s|
233 s.path = 'postinstall.sh'
234 s.args = ['mso']
235 s.env = conf
236 end
237 end
238
239 config.vm.define :robot do |robot|
240 robot.vm.hostname = 'robot'
241 robot.vm.network :private_network, ip: '192.168.50.8'
Victor Moralesdd074802017-07-26 16:06:35 -0500242 robot.vm.provider "openstack" do |v|
243 v.server_name = 'robot'
244 end
Victor Morales89ce3212017-06-16 18:32:48 -0500245 robot.vm.provision 'shell' do |s|
246 s.path = 'postinstall.sh'
247 s.args = ['robot']
248 s.env = conf
249 end
250 end
251
252 config.vm.define :vid do |vid|
253 vid.vm.hostname = 'vid'
254 vid.vm.network :private_network, ip: '192.168.50.9'
Victor Moralesdd074802017-07-26 16:06:35 -0500255 vid.vm.provider "openstack" do |v|
256 v.server_name = 'vid'
257 end
Victor Morales89ce3212017-06-16 18:32:48 -0500258 vid.vm.provision 'shell' do |s|
259 s.path = 'postinstall.sh'
260 s.args = ['vid']
261 s.env = conf
262 end
263 end
264
265 config.vm.define :sdnc do |sdnc|
266 sdnc.vm.hostname = 'sdnc'
267 sdnc.vm.network :private_network, ip: '192.168.50.10'
Victor Moralesdd074802017-07-26 16:06:35 -0500268 sdnc.vm.provider "openstack" do |v|
269 v.server_name = 'sdnc'
270 end
Victor Morales89ce3212017-06-16 18:32:48 -0500271 sdnc.vm.provision 'shell' do |s|
272 s.path = 'postinstall.sh'
273 s.args = ['sdnc']
274 s.env = conf
275 end
276 end
277
278 config.vm.define :portal do |portal|
279 portal.vm.hostname = 'portal'
280 portal.vm.network :private_network, ip: '192.168.50.11'
Victor Moralesdd074802017-07-26 16:06:35 -0500281 portal.vm.provider "openstack" do |v|
282 v.server_name = 'portal'
283 end
Victor Morales89ce3212017-06-16 18:32:48 -0500284 portal.vm.provision 'shell' do |s|
285 s.path = 'postinstall.sh'
286 s.args = ['portal']
287 s.env = conf
288 end
289 end
290
291 config.vm.define :dcae do |dcae|
292 dcae.vm.hostname = 'dcae'
293 dcae.vm.network :private_network, ip: '192.168.50.12'
Victor Moralesdd074802017-07-26 16:06:35 -0500294 dcae.vm.provider "openstack" do |v|
295 v.server_name = 'dcae'
296 end
Victor Morales89ce3212017-06-16 18:32:48 -0500297 dcae.vm.provision 'shell' do |s|
298 s.path = 'postinstall.sh'
299 s.args = ['dcae']
300 s.env = conf
301 end
302 end
303
304 config.vm.define :policy do |policy|
305 policy.vm.hostname = 'policy'
306 policy.vm.network :private_network, ip: '192.168.50.13'
Victor Moralesdd074802017-07-26 16:06:35 -0500307 policy.vm.provider "openstack" do |v|
308 v.server_name = 'policy'
309 end
Victor Morales89ce3212017-06-16 18:32:48 -0500310 policy.vm.provision 'shell' do |s|
311 s.path = 'postinstall.sh'
312 s.args = ['policy']
313 s.env = conf
314 end
315 end
316
317 config.vm.define :appc do |appc|
318 appc.vm.hostname = 'appc'
319 appc.vm.network :private_network, ip: '192.168.50.14'
Victor Moralesdd074802017-07-26 16:06:35 -0500320 appc.vm.provider "openstack" do |v|
321 v.server_name = 'appc'
322 end
Victor Morales89ce3212017-06-16 18:32:48 -0500323 appc.vm.provision 'shell' do |s|
324 s.path = 'postinstall.sh'
325 s.args = ['appc']
326 s.env = conf
327 end
328 end
329
Victor Moralesdd074802017-07-26 16:06:35 -0500330 config.vm.define :vfc do |vfc|
331 vfc.vm.hostname = 'vfc'
332 vfc.vm.network :private_network, ip: '192.168.50.15'
333 vfc.vm.provider "openstack" do |v|
334 v.server_name = 'vfc'
335 end
336 vfc.vm.provision 'shell' do |s|
337 s.path = 'postinstall.sh'
338 s.args = ['vfc']
339 s.env = conf
340 end
341 end
342
343 when 'testing'
344
345 config.vm.define :testing do |testing|
346 test_suite = ENV.fetch('TEST_SUITE', '*')
347 test_case = ENV.fetch('TEST_CASE', '*')
348
349 testing.vm.hostname = 'testing'
350 testing.vm.network :private_network, ip: '192.168.50.3'
351 testing.vm.synced_folder './tests', '/var/onap_tests/', create: true
352 testing.vm.provider "virtualbox" do |v|
353 v.customize ["modifyvm", :id, "--memory", 2 * 1024]
354 end
355 testing.vm.provider "libvirt" do |v|
356 v.memory = 2 * 1024
357 v.nested = true
358 end
359 testing.vm.provider "openstack" do |v|
360 v.server_name = 'testing'
361 v.flavor = 'm1.small'
362 end
363 testing.vm.provision 'shell' do |s|
364 s.path = 'unit_testing.sh'
365 s.args = [test_suite, test_case]
366 s.env = conf
367 end
368 end
369
Victor Morales89ce3212017-06-16 18:32:48 -0500370 end
371end