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