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 | be84471 | 2018-01-22 10:07:28 -0800 | [diff] [blame^] | 48 | :ram => 6 * 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"], |
| 160 | :hd => "60G", |
| 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 | fa9eb9c | 2017-12-18 09:56:13 -0800 | [diff] [blame] | 205 | :hd => "20G", |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 206 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 207 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 208 | :name => "sdnc", |
| 209 | :ips => ['10.252.0.10', "192.168.50.10"], |
| 210 | :macs => [], |
| 211 | :cpus => 2, |
| 212 | :cpu => "50", |
| 213 | :ram => 4 * 1024, |
| 214 | :groups => ["individual"], |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 215 | :args => ["sdnc"], |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 216 | }, |
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 | :name => "testing", |
Victor Morales | 071b81c | 2017-11-07 14:13:07 -0800 | [diff] [blame] | 219 | :ips => ['10.252.2.3', "192.168.52.3"], |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 220 | :macs => [], |
| 221 | :cpus => 2, |
| 222 | :cpu => "50", |
| 223 | :ram => 4 * 1024, |
| 224 | :groups => ["testing"], |
| 225 | :flavor => 'm1.small', |
| 226 | :args => [""], |
| 227 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 228 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 229 | :name => "vfc", |
| 230 | :ips => ['10.252.0.15', "192.168.50.15"], |
| 231 | :macs => [], |
| 232 | :cpus => 2, |
| 233 | :cpu => "50", |
| 234 | :ram => 4 * 1024, |
| 235 | :groups => ["individual"], |
| 236 | :args => ['vfc'], |
| 237 | }, |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 238 | { |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 239 | :name => "vid", |
| 240 | :ips => ['10.252.0.9', "192.168.50.9"], |
| 241 | :macs => [], |
| 242 | :cpus => 2, |
| 243 | :cpu => "50", |
| 244 | :ram => 4 * 1024, |
| 245 | :groups => ["individual"], |
| 246 | :args => ['vid'], |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 247 | }, |
Victor Morales | d3cbcf2 | 2017-10-25 16:01:58 -0700 | [diff] [blame] | 248 | { |
Victor Morales | 071b81c | 2017-11-07 14:13:07 -0800 | [diff] [blame] | 249 | :name => "vnfsdk", |
| 250 | :ips => ['10.252.0.18', "192.168.50.18"], |
| 251 | :macs => [], |
| 252 | :cpus => 2, |
| 253 | :cpu => "50", |
| 254 | :ram => 4 * 1024, |
| 255 | :groups => ["individual"], |
| 256 | :args => ['vnfsdk'], |
Shashank Kumar Shankar | f84c9a1 | 2017-10-23 11:08:31 -0700 | [diff] [blame] | 257 | }, |
| 258 | { |
Victor Morales | d3cbcf2 | 2017-10-25 16:01:58 -0700 | [diff] [blame] | 259 | :name => "vvp", |
| 260 | :ips => ['10.252.0.17', "192.168.50.17"], |
| 261 | :macs => [], |
| 262 | :cpus => 2, |
| 263 | :cpu => "50", |
| 264 | :ram => 4 * 1024, |
| 265 | :groups => ["individual"], |
| 266 | :args => ['vvp'], |
Victor Morales | 4ab71c1 | 2017-11-08 07:28:28 -0800 | [diff] [blame] | 267 | }, |
| 268 | { |
| 269 | :name => "openstack", |
| 270 | :ips => ['10.252.3.3', "192.168.53.3"], |
| 271 | :macs => [], |
| 272 | :cpus => 2, |
| 273 | :cpu => "50", |
| 274 | :ram => 8 * 1024, |
| 275 | :groups => ["individual"], |
| 276 | :args => ['openstack'], |
Victor Morales | fa9eb9c | 2017-12-18 09:56:13 -0800 | [diff] [blame] | 277 | :fwds => [ |
| 278 | { :guest => 80, :host => 8888, :guest_ip => '192.168.53.4' }, |
| 279 | { :guest => 6080, :host => 6080, :guest_ip => '192.168.53.4' }, |
| 280 | ] |
Shashank Kumar Shankar | f84c9a1 | 2017-10-23 11:08:31 -0700 | [diff] [blame] | 281 | } |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 282 | ] |
| 283 | |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 284 | run_path = 'vagrant_utils/postinstall.sh' |
| 285 | sdc_volume = 'vol1-sdc-data.vdi' |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 286 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 287 | Vagrant.require_version ">= 1.8.6" |
| 288 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 289 | # Determine the provider used |
| 290 | provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 291 | puts "[INFO] Provider: #{provider} " |
| 292 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 293 | vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml') |
| 294 | if File.exist?(vd_conf) |
| 295 | require 'yaml' |
| 296 | user_conf = YAML.load_file(vd_conf) |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 297 | configuration.update(user_conf) |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 298 | end |
| 299 | |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 300 | # Set network interface |
Areli Fuss | f57e9e7 | 2017-09-28 14:24:53 +0300 | [diff] [blame] | 301 | net_interface = 'vboxnet0' |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 302 | is_windows = Gem.win_platform? |
| 303 | if is_windows |
| 304 | net_interface = 'VirtualBox Host-Only Ethernet Adapter #2' |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 305 | end |
| 306 | puts "[INFO] Net interface: #{net_interface}" |
| 307 | |
| 308 | |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 309 | # 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] | 310 | requested_machine = ARGV[1] |
| 311 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 312 | deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual') |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 313 | if requested_machine != nil |
| 314 | if requested_machine.include?("all-in-one") || requested_machine.include?("testing") |
| 315 | deploy_mode = requested_machine |
| 316 | end |
| 317 | end |
| 318 | |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 319 | # Catch the status of all machines |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 320 | if ARGV[0] == 'status' || ARGV[0] == 'destroy' |
| 321 | deploy_mode = 'NA' |
| 322 | end |
| 323 | |
| 324 | puts "[INFO] Deploy Mode: #{deploy_mode}" |
| 325 | |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 326 | # In case of all-in-one or testing clean the nodes list |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 327 | case deploy_mode |
| 328 | when 'all-in-one' |
| 329 | nodes.select! do |node| |
| 330 | if node[:name].include?("all-in-one") |
| 331 | true if node[:name] |
| 332 | end |
| 333 | end |
| 334 | |
| 335 | when 'individual' |
| 336 | nodes.select! do |node| |
| 337 | if node[:groups][0].include?("individual") |
| 338 | true if node[:name] |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 339 | end |
| 340 | end |
| 341 | |
| 342 | when 'testing' |
| 343 | nodes.select! do |node| |
| 344 | if node[:name].include?("testing") |
| 345 | true if node[:name] |
| 346 | end |
| 347 | end |
| 348 | end |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 349 | |
| 350 | Vagrant.configure("2") do |config| |
| 351 | |
Victor Morales | fa9eb9c | 2017-12-18 09:56:13 -0800 | [diff] [blame] | 352 | # PROXY definitions |
| 353 | if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 354 | if not Vagrant.has_plugin?('vagrant-proxyconf') |
| 355 | system 'vagrant plugin install vagrant-proxyconf' |
| 356 | raise 'vagrant-proxyconf was installed but it requires to execute again' |
| 357 | end |
| 358 | config.proxy.http = ENV['http_proxy'] |
| 359 | config.proxy.https = ENV['https_proxy'] |
Victor Morales | cf26999 | 2017-10-18 09:29:55 -0700 | [diff] [blame] | 360 | configuration['socks_proxy'] = ENV['socks_proxy'] |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 361 | end |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 362 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 363 | if Vagrant.has_plugin?('vagrant-vbguest') |
| 364 | puts 'vagrant-vbguest auto_update feature will be disable to avoid sharing conflicts' |
| 365 | config.vbguest.auto_update = false |
Victor Morales | f62e7b8 | 2017-07-27 17:26:06 -0500 | [diff] [blame] | 366 | end |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 367 | |
Victor Morales | 71f7d29 | 2018-01-04 16:27:07 -0800 | [diff] [blame] | 368 | sync_type = "virtualbox" |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 369 | if provider == :libvirt |
| 370 | if not Vagrant.has_plugin?('vagrant-libvirt') |
| 371 | system 'vagrant plugin install vagrant-libvirt' |
| 372 | raise 'vagrant-libvirt was installed but it requires to execute again' |
| 373 | end |
Victor Morales | 71f7d29 | 2018-01-04 16:27:07 -0800 | [diff] [blame] | 374 | sync_type = "nfs" |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 375 | end |
Areli Fuss | f57e9e7 | 2017-09-28 14:24:53 +0300 | [diff] [blame] | 376 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 377 | if provider == :openstack |
| 378 | config.ssh.username = 'ubuntu' |
| 379 | if not Vagrant.has_plugin?('vagrant-openstack-provider') |
| 380 | system 'vagrant plugin install vagrant-openstack-provider' |
| 381 | raise 'vagrant-openstack-provider was installed but it requires to execute again' |
| 382 | end |
| 383 | end |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 384 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 385 | nodes.each do |node| |
| 386 | config.vm.define node[:name] do |nodeconfig| |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 387 | |
Victor Morales | fa9eb9c | 2017-12-18 09:56:13 -0800 | [diff] [blame] | 388 | # NO_PROXY definitions |
| 389 | if ENV['no_proxy'] != nil |
| 390 | if not Vagrant.has_plugin?('vagrant-proxyconf') |
| 391 | system 'vagrant plugin install vagrant-proxyconf' |
| 392 | raise 'vagrant-proxyconf was installed but it requires to execute again' |
| 393 | end |
| 394 | config.proxy.no_proxy = node[:ips].join(",") + "," + ENV['no_proxy'] |
| 395 | end |
| 396 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 397 | # Common Settings: |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 398 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 399 | nodeconfig.vm.provider "virtualbox" do |vbox| |
| 400 | vbox.customize ['modifyvm', :id, '--nictype1', 'virtio'] |
| 401 | vbox.customize ['modifyvm', :id, '--audio', 'none'] |
| 402 | vbox.customize ['modifyvm', :id, '--vram', '1'] |
| 403 | vbox.customize ['modifyvm', :id, "--cpuhotplug", "off"] |
| 404 | vbox.customize ['modifyvm', :id, "--cpuexecutioncap", node[:cpu]] |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 405 | vbox.customize ['modifyvm', :id, "--cpus", node[:cpus]] |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 406 | vbox.customize ["modifyvm", :id, "--memory", node[:ram]] |
Victor Morales | 9c525e4 | 2017-12-01 04:35:14 -0800 | [diff] [blame] | 407 | |
| 408 | # Set Network |
| 409 | nodeconfig.vm.network :private_network, |
| 410 | :adapter => 2, |
| 411 | :name => net_interface, |
| 412 | :ip => node[:ips][0] |
| 413 | |
| 414 | nodeconfig.vm.network :private_network, |
| 415 | :adapter => 3, |
| 416 | :ip => node[:ips][1], |
| 417 | :type => :static |
Victor Morales | fa9eb9c | 2017-12-18 09:56:13 -0800 | [diff] [blame] | 418 | |
| 419 | # Set Storage |
| 420 | if node.has_key? :hd |
| 421 | volume_file = node[:name] + '-vol1-data.vdi' |
| 422 | unless File.exist?(volume_file) |
| 423 | vbox.customize ['createhd', '--filename', volume_file, '--size', node[:hd]] |
| 424 | end |
| 425 | vbox.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', volume_file] |
| 426 | end |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 427 | end |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 428 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 429 | nodeconfig.vm.provider "libvirt" do |lbox| |
| 430 | lbox.memory = node[:ram] |
| 431 | lbox.nested = true |
Victor Morales | 9c525e4 | 2017-12-01 04:35:14 -0800 | [diff] [blame] | 432 | lbox.cpu_mode = 'host-passthrough' |
Victor Morales | fa9eb9c | 2017-12-18 09:56:13 -0800 | [diff] [blame] | 433 | lbox.cpus = node[:cpus] |
Victor Morales | 9c525e4 | 2017-12-01 04:35:14 -0800 | [diff] [blame] | 434 | |
| 435 | # Set Network |
| 436 | nodeconfig.vm.network :private_network, |
| 437 | :ip => node[:ips][0] |
| 438 | |
| 439 | nodeconfig.vm.network :private_network, |
| 440 | :ip => node[:ips][1], |
| 441 | :type => :static |
Victor Morales | fa9eb9c | 2017-12-18 09:56:13 -0800 | [diff] [blame] | 442 | |
| 443 | # Set Storage |
| 444 | if node.has_key? :hd |
| 445 | lbox.storage :file, bus: 'sata', device: 'sda', size: node[:hd] |
| 446 | end |
| 447 | end |
| 448 | if node.has_key? :fwds |
| 449 | node[:fwds].each do |fwd| |
| 450 | nodeconfig.vm.network :forwarded_port, |
| 451 | :guest => fwd[:guest], |
| 452 | :guest_ip => fwd[:guest_ip], |
| 453 | :host => fwd[:host], |
| 454 | :host_ip => "0.0.0.0" |
| 455 | end |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 456 | end |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 457 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 458 | nodeconfig.vm.provider :openstack do |obox| |
| 459 | obox.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '') |
| 460 | obox.tenant_name = ENV.fetch('OS_TENANT_NAME', '') |
| 461 | obox.username = ENV.fetch('OS_USERNAME', '') |
| 462 | obox.password = ENV.fetch('OS_PASSWORD', '') |
| 463 | obox.region = ENV.fetch('OS_REGION_NAME', '') |
| 464 | obox.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '') |
| 465 | obox.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '') |
| 466 | obox.project_name = ENV.fetch('OS_PROJECT_NAME', '') |
| 467 | obox.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '') |
| 468 | obox.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true') |
| 469 | obox.image = ENV.fetch('OS_IMAGE', '') |
| 470 | obox.security_groups = [ENV.fetch('OS_SEC_GROUP', '')] |
| 471 | obox.networks = ENV.fetch('OS_NETWORK', '') |
| 472 | obox.flavor = node[:flavor] |
| 473 | obox.server_name = node[:name] |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 474 | end |
Victor Morales | d403648 | 2017-08-15 17:54:14 -0500 | [diff] [blame] | 475 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 476 | # Set Box type |
Victor Morales | 4ab71c1 | 2017-11-08 07:28:28 -0800 | [diff] [blame] | 477 | if "openstack" == node[:name] |
Victor Morales | 9c525e4 | 2017-12-01 04:35:14 -0800 | [diff] [blame] | 478 | box = { |
| 479 | :virtualbox => 'ubuntu/xenial64', |
| 480 | :libvirt => 'elastic/ubuntu-16.04-x86_64' |
| 481 | } |
Victor Morales | 4ab71c1 | 2017-11-08 07:28:28 -0800 | [diff] [blame] | 482 | end |
Victor Morales | 9c525e4 | 2017-12-01 04:35:14 -0800 | [diff] [blame] | 483 | nodeconfig.vm.box = box[provider] |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 484 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 485 | # Set Node name |
| 486 | nodeconfig.vm.hostname = node[:name] |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 487 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 488 | # Set Sync Folder |
| 489 | nodeconfig.vm.synced_folder ".", "/vagrant", disabled: true |
Victor Morales | 71f7d29 | 2018-01-04 16:27:07 -0800 | [diff] [blame] | 490 | nodeconfig.vm.synced_folder './opt', '/opt/', create: true, type: sync_type |
| 491 | nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true, type: sync_type |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 492 | if !is_windows |
| 493 | nodeconfig.vm.synced_folder '~/.m2', '/root/.m2/', create: true |
| 494 | end |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 495 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 496 | # Specific settings: |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 497 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 498 | if node[:name].include? "testing" |
| 499 | nodeconfig.vm.synced_folder './tests', '/var/onap_tests/', create: true |
| 500 | test_suite = ENV.fetch('TEST_SUITE', '*') |
| 501 | test_case = ENV.fetch('TEST_CASE', '*') |
| 502 | # Override variables |
| 503 | run_path = 'vagrant_utils/unit_testing.sh' |
| 504 | node[:args] = [test_suite, test_case] |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 505 | else |
| 506 | configuration['skip_get_images'] = ENV.fetch('SKIP_GET_IMAGES', configuration['skip_get_images']) |
| 507 | configuration['skip_install'] = ENV.fetch('SKIP_INSTALL', configuration['skip_install']) |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 508 | end |
| 509 | |
Idan Amit | 4612386 | 2017-09-19 13:43:32 +0300 | [diff] [blame] | 510 | if node[:name].include? "vfc" |
| 511 | nodeconfig.vm.provision 'docker' |
| 512 | end |
| 513 | |
| 514 | nodeconfig.vm.provision 'shell' do |s| |
| 515 | s.path = run_path |
| 516 | s.args = node[:args] |
| 517 | s.env = configuration |
| 518 | end |
| 519 | |
| 520 | end #nodeconfig |
| 521 | end #node |
| 522 | end #config |