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