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