Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # vi: set ft=ruby : |
| 3 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 4 | |
| 5 | configuration = { |
| 6 | # Generic parameters used across all ONAP components |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 7 | 'public_net_id' => '00000000-0000-0000-0000-000000000000', |
| 8 | 'key_name' => 'ecomp_key', |
| 9 | 'pub_key' => '', |
| 10 | 'nexus_repo' => 'https://nexus.onap.org/content/sites/raw', |
| 11 | 'nexus_docker_repo' => 'nexus3.onap.org:10001', |
| 12 | 'nexus_username' => 'docker', |
| 13 | 'nexus_password' => 'docker', |
| 14 | 'dmaap_topic' => 'AUTO', |
| 15 | 'artifacts_version' => '1.0.0', |
| 16 | 'docker_version' => '1.0-STAGING-latest', |
| 17 | 'gerrit_branch' => 'master', |
| 18 | # Parameters for DCAE instantiation |
| 19 | 'dcae_zone' => 'iad4', |
| 20 | 'dcae_state' => 'vi', |
| 21 | 'openstack_tenant_id' => '', |
| 22 | 'openstack_username' => '', |
| 23 | 'openstack_api_key' => '', |
| 24 | 'openstack_password' => '', |
| 25 | 'nexus_repo_root' => 'https://nexus.onap.org', |
| 26 | 'nexus_url_snapshot' => 'https://nexus.onap.org/content/repositories/snapshots', |
| 27 | 'gitlab_branch' => 'master', |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 28 | 'build_image' => 'True', |
Idan Amit | 0a29555 | 2017-08-17 17:03:59 +0300 | [diff] [blame] | 29 | 'pull_docker_image' => 'True', |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 30 | 'odl_version' => '0.5.3-Boron-SR3', |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 31 | 'clone_repo' => 'True', |
Victor Morales | 2909e2e | 2017-08-08 15:51:52 -0500 | [diff] [blame] | 32 | 'compile_repo' => 'False', |
| 33 | 'enable_oparent' => 'True' |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 34 | } |
| 35 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 36 | |
| 37 | box = { |
| 38 | :virtualbox => 'ubuntu/trusty64', |
| 39 | :libvirt => 'sputnik13/trusty64', |
| 40 | :openstack => nil |
| 41 | } |
| 42 | |
| 43 | |
| 44 | nodes = [ |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 45 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 46 | :name => "aai", |
| 47 | :ips => ['10.252.0.6', "192.168.50.6"], |
| 48 | :macs => [], |
| 49 | :cpus => 2, |
| 50 | :cpu => "50", |
| 51 | :ram => 4 * 1024, |
| 52 | :groups => ["individual"], |
| 53 | :args => ["aai"] |
| 54 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 55 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 56 | :name => "all-in-one", |
| 57 | :ips => ['10.252.0.3', "192.168.50.3"], |
| 58 | :macs => [], |
| 59 | :cpus => 2, |
| 60 | :cpu => "50", |
| 61 | :ram => 12 * 1024, |
| 62 | :groups => ["all-in-one"], |
| 63 | :flavor => 'm1.xlarge', |
| 64 | :args => ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc', 'ccsdk'], |
| 65 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 66 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 67 | :name => "appc", |
| 68 | :ips => ['10.252.0.14', "192.168.50.14"], |
| 69 | :macs => [], |
| 70 | :cpus => 2, |
| 71 | :cpu => "50", |
| 72 | :ram => 4 * 1024, |
| 73 | :groups => ["individual"], |
| 74 | :args => ["appc"], |
| 75 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 76 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 77 | :name => "ccsdk", |
| 78 | :ips => ['10.252.0.14', "192.168.50.17"], |
| 79 | :macs => [], |
| 80 | :cpus => 2, |
| 81 | :cpu => "50", |
| 82 | :ram => 4 * 1024, |
| 83 | :groups => ["individual"], |
| 84 | :args => ["ccsdk"], |
| 85 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 86 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 87 | :name => "dcae", |
| 88 | :ips => ['10.252.0.12', "192.168.50.12"], |
| 89 | :macs => [], |
| 90 | :cpus => 2, |
| 91 | :cpu => "50", |
| 92 | :ram => 4 * 1024, |
| 93 | :groups => ["individual"], |
| 94 | :args => ["dcae"], |
| 95 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 96 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 97 | :name => "dns", |
| 98 | :ips => ['10.252.0.3', "192.168.50.3"], |
| 99 | :macs => [], |
| 100 | :cpus => 2, |
| 101 | :cpu => "50", |
| 102 | :ram => 1 * 1024, |
| 103 | :groups => ["individual"], |
| 104 | :flavor => 'm1.small', |
| 105 | :args => [" "] |
| 106 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 107 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 108 | :name => "message-router", |
| 109 | :ips => ['10.252.0.4', "192.168.50.4"], |
| 110 | :macs => [], |
| 111 | :cpus => 2, |
| 112 | :cpu => "50", |
| 113 | :ram => 4 * 1024, |
| 114 | :groups => ["individual"], |
| 115 | :args => ["mr"], |
| 116 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 117 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 118 | :name => "mso", |
| 119 | :ips => ['10.252.0.7', "192.168.50.7"], |
| 120 | :macs => [], |
| 121 | :cpus => 2, |
| 122 | :cpu => "50", |
| 123 | :ram => 4 * 1024, |
| 124 | :groups => ["individual"], |
| 125 | :args => ["mso"], |
| 126 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 127 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 128 | :name => "multicloud", |
| 129 | :ips => ['10.252.0.16', "192.168.50.16"], |
| 130 | :macs => [], |
| 131 | :cpus => 2, |
| 132 | :cpu => "50", |
| 133 | :ram => 4 * 1024, |
| 134 | :groups => ["individual"], |
| 135 | :args => ["multicloud"], |
| 136 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 137 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 138 | :name => "policy", |
| 139 | :ips => ['10.252.0.13', "192.168.50.13"], |
| 140 | :macs => [], |
| 141 | :cpus => 2, |
| 142 | :cpu => "50", |
| 143 | :ram => 4 * 1024, |
| 144 | :groups => ["individual"], |
| 145 | :args => ["policy"], |
| 146 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 147 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 148 | :name => "portal", |
| 149 | :ips => ['10.252.0.11', "192.168.50.11"], |
| 150 | :macs => [], |
| 151 | :cpus => 2, |
| 152 | :cpu => "50", |
| 153 | :ram => 4 * 1024, |
| 154 | :groups => ["individual"], |
| 155 | :args => ["portal"], |
| 156 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 157 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 158 | :name => "robot", |
| 159 | :ips => ['10.252.0.8', "192.168.50.8"], |
| 160 | :macs => [], |
| 161 | :cpus => 2, |
| 162 | :cpu => "50", |
| 163 | :ram => 4 * 1024, |
| 164 | :groups => ["individual"], |
| 165 | :args => ["robot"], |
| 166 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 167 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 168 | :name => "sdc", |
| 169 | :ips => ['10.252.0.5', "192.168.50.5"], |
| 170 | :macs => [], |
| 171 | :cpus => 2, |
| 172 | :cpu => "50", |
| 173 | :ram => 8 * 1024, |
| 174 | :groups => ["individual"], |
| 175 | :args => ["sdc"], |
| 176 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 177 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 178 | :name => "sdnc", |
| 179 | :ips => ['10.252.0.10', "192.168.50.10"], |
| 180 | :macs => [], |
| 181 | :cpus => 2, |
| 182 | :cpu => "50", |
| 183 | :ram => 4 * 1024, |
| 184 | :groups => ["individual"], |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 185 | :args => ["sdnc"], |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 186 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 187 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 188 | :name => "testing", |
| 189 | :ips => ['10.252.0.3', "192.168.50.3"], |
| 190 | :macs => [], |
| 191 | :cpus => 2, |
| 192 | :cpu => "50", |
| 193 | :ram => 4 * 1024, |
| 194 | :groups => ["testing"], |
| 195 | :flavor => 'm1.small', |
| 196 | :args => [""], |
| 197 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 198 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 199 | :name => "vfc", |
| 200 | :ips => ['10.252.0.15', "192.168.50.15"], |
| 201 | :macs => [], |
| 202 | :cpus => 2, |
| 203 | :cpu => "50", |
| 204 | :ram => 4 * 1024, |
| 205 | :groups => ["individual"], |
| 206 | :args => ['vfc'], |
| 207 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 208 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 209 | :name => "vid", |
| 210 | :ips => ['10.252.0.9', "192.168.50.9"], |
| 211 | :macs => [], |
| 212 | :cpus => 2, |
| 213 | :cpu => "50", |
| 214 | :ram => 4 * 1024, |
| 215 | :groups => ["individual"], |
| 216 | :args => ['vid'], |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 217 | }, |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 218 | ] |
| 219 | |
| 220 | |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 221 | run_path = 'vagrant_utils/postinstall.sh' |
| 222 | sdc_volume = 'vol1-sdc-data.vdi' |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 223 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 224 | Vagrant.require_version ">= 1.8.6" |
| 225 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 226 | # Determine the provider used |
| 227 | provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 228 | puts "[INFO] Provider: #{provider} " |
| 229 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 230 | vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml') |
| 231 | if File.exist?(vd_conf) |
| 232 | require 'yaml' |
| 233 | user_conf = YAML.load_file(vd_conf) |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 234 | configuration.update(user_conf) |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 235 | end |
| 236 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 237 | #Set network interface |
| 238 | is_windows = Gem.win_platform? |
| 239 | if is_windows |
| 240 | net_interface = 'VirtualBox Host-Only Ethernet Adapter #2' |
| 241 | else |
| 242 | net_interface = 'vboxnet0' |
| 243 | end |
| 244 | puts "[INFO] Net interface: #{net_interface}" |
| 245 | |
| 246 | |
| 247 | #If argument is given use it. Otherwise use Env: DEPLOY_MODE else use default |
| 248 | requested_machine = ARGV[1] |
| 249 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 250 | deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual') |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 251 | if requested_machine != nil |
| 252 | if requested_machine.include?("all-in-one") || requested_machine.include?("testing") |
| 253 | deploy_mode = requested_machine |
| 254 | end |
| 255 | end |
| 256 | |
| 257 | #Catch the status of all machines |
| 258 | if ARGV[0] == 'status' || ARGV[0] == 'destroy' |
| 259 | deploy_mode = 'NA' |
| 260 | end |
| 261 | |
| 262 | puts "[INFO] Deploy Mode: #{deploy_mode}" |
| 263 | |
| 264 | #In case of all-in-one or testing clean the nodes list |
| 265 | case deploy_mode |
| 266 | when 'all-in-one' |
| 267 | nodes.select! do |node| |
| 268 | if node[:name].include?("all-in-one") |
| 269 | true if node[:name] |
| 270 | end |
| 271 | end |
| 272 | |
| 273 | when 'individual' |
| 274 | nodes.select! do |node| |
| 275 | if node[:groups][0].include?("individual") |
| 276 | true if node[:name] |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 277 | end |
| 278 | end |
| 279 | |
| 280 | when 'testing' |
| 281 | nodes.select! do |node| |
| 282 | if node[:name].include?("testing") |
| 283 | true if node[:name] |
| 284 | end |
| 285 | end |
| 286 | end |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 287 | |
| 288 | Vagrant.configure("2") do |config| |
| 289 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 290 | # PROXY definitions |
| 291 | if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil and ENV['no_proxy'] != nil |
| 292 | if not Vagrant.has_plugin?('vagrant-proxyconf') |
| 293 | system 'vagrant plugin install vagrant-proxyconf' |
| 294 | raise 'vagrant-proxyconf was installed but it requires to execute again' |
| 295 | end |
| 296 | config.proxy.http = ENV['http_proxy'] |
| 297 | config.proxy.https = ENV['https_proxy'] |
| 298 | config.proxy.no_proxy = ENV['no_proxy'] |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 299 | end |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 300 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 301 | if Vagrant.has_plugin?('vagrant-vbguest') |
| 302 | puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts' |
| 303 | config.vbguest.auto_update = false |
Victor Morales | f62e7b8 | 2017-07-27 17:26:06 -0500 | [diff] [blame] | 304 | end |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 305 | |
| 306 | if provider == :libvirt |
| 307 | if not Vagrant.has_plugin?('vagrant-libvirt') |
| 308 | system 'vagrant plugin install vagrant-libvirt' |
| 309 | raise 'vagrant-libvirt was installed but it requires to execute again' |
| 310 | end |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 311 | end |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 312 | if provider == :openstack |
| 313 | config.ssh.username = 'ubuntu' |
| 314 | if not Vagrant.has_plugin?('vagrant-openstack-provider') |
| 315 | system 'vagrant plugin install vagrant-openstack-provider' |
| 316 | raise 'vagrant-openstack-provider was installed but it requires to execute again' |
| 317 | end |
| 318 | end |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 319 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 320 | nodes.each do |node| |
| 321 | config.vm.define node[:name] do |nodeconfig| |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 322 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 323 | # Common Settings: |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 324 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 325 | nodeconfig.vm.provider "virtualbox" do |vbox| |
| 326 | vbox.customize ['modifyvm', :id, '--nictype1', 'virtio'] |
| 327 | vbox.customize ['modifyvm', :id, '--audio', 'none'] |
| 328 | vbox.customize ['modifyvm', :id, '--vram', '1'] |
| 329 | vbox.customize ['modifyvm', :id, "--cpuhotplug", "off"] |
| 330 | vbox.customize ['modifyvm', :id, "--cpuexecutioncap", node[:cpu]] |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 331 | vbox.customize ['modifyvm', :id, "--cpus", node[:cpus]] |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 332 | vbox.customize ["modifyvm", :id, "--memory", node[:ram]] |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 333 | end |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 334 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 335 | nodeconfig.vm.provider "libvirt" do |lbox| |
| 336 | lbox.memory = node[:ram] |
| 337 | lbox.nested = true |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 338 | end |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 339 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 340 | nodeconfig.vm.provider :openstack do |obox| |
| 341 | obox.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '') |
| 342 | obox.tenant_name = ENV.fetch('OS_TENANT_NAME', '') |
| 343 | obox.username = ENV.fetch('OS_USERNAME', '') |
| 344 | obox.password = ENV.fetch('OS_PASSWORD', '') |
| 345 | obox.region = ENV.fetch('OS_REGION_NAME', '') |
| 346 | obox.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '') |
| 347 | obox.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '') |
| 348 | obox.project_name = ENV.fetch('OS_PROJECT_NAME', '') |
| 349 | obox.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '') |
| 350 | obox.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true') |
| 351 | obox.image = ENV.fetch('OS_IMAGE', '') |
| 352 | obox.security_groups = [ENV.fetch('OS_SEC_GROUP', '')] |
| 353 | obox.networks = ENV.fetch('OS_NETWORK', '') |
| 354 | obox.flavor = node[:flavor] |
| 355 | obox.server_name = node[:name] |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 356 | end |
Victor Morales | d403648 | 2017-08-15 17:54:14 -0500 | [diff] [blame] | 357 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 358 | # Set Box type |
| 359 | nodeconfig.vm.box = box[provider] |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 360 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 361 | # Set Node name |
| 362 | nodeconfig.vm.hostname = node[:name] |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 363 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 364 | # Set Sync Folder |
| 365 | nodeconfig.vm.synced_folder ".", "/vagrant", disabled: true |
| 366 | nodeconfig.vm.synced_folder './opt', '/opt/', create: true |
| 367 | nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true |
| 368 | if !is_windows |
| 369 | nodeconfig.vm.synced_folder '~/.m2', '/root/.m2/', create: true |
| 370 | end |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 371 | # Set Network |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 372 | nodeconfig.vm.network :private_network, ip: node[:ips][1] |
| 373 | |
| 374 | # Specific settings: |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 375 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 376 | #Set Storage (For SDC or All-in-one) |
| 377 | if node[:name].include?("all-in-one") || node[:name].include?("sdc") |
| 378 | nodeconfig.vm.provider "virtualbox" do |v| |
| 379 | unless File.exist?(sdc_volume) |
| 380 | v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024] |
| 381 | end |
| 382 | v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume] |
| 383 | end |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 384 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 385 | nodeconfig.vm.provider "libvirt" do |v| |
| 386 | v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G' |
| 387 | end |
| 388 | end |
| 389 | |
| 390 | |
| 391 | if node[:name].include? "testing" |
| 392 | nodeconfig.vm.synced_folder './tests', '/var/onap_tests/', create: true |
| 393 | test_suite = ENV.fetch('TEST_SUITE', '*') |
| 394 | test_case = ENV.fetch('TEST_CASE', '*') |
| 395 | # Override variables |
| 396 | run_path = 'vagrant_utils/unit_testing.sh' |
| 397 | node[:args] = [test_suite, test_case] |
| 398 | end |
| 399 | |
| 400 | |
| 401 | if node[:name].include? "vfc" |
| 402 | nodeconfig.vm.provision 'docker' |
| 403 | end |
| 404 | |
| 405 | nodeconfig.vm.provision 'shell' do |s| |
| 406 | s.path = run_path |
| 407 | s.args = node[:args] |
| 408 | s.env = configuration |
| 409 | end |
| 410 | |
| 411 | end #nodeconfig |
| 412 | end #node |
| 413 | end #config |