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