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