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