Add OOM provisioning script
[integration.git] / bootstrap / vagrant-onap / Vagrantfile
index a0f3a19..01c6afd 100644 (file)
@@ -13,7 +13,7 @@ configuration = {
   'nexus_password'      => 'docker',
   'dmaap_topic'         => 'AUTO',
   'artifacts_version'   => '1.0.0',
-  'docker_version'      => '1.0-STAGING-latest',
+  'docker_version'      => 'latest',
   # Parameters for DCAE instantiation
   'dcae_zone'           => 'iad4',
   'dcae_state'          => 'vi',
@@ -34,7 +34,7 @@ configuration = {
 
 box = {
   :virtualbox => 'ubuntu/trusty64',
-  :libvirt => 'sputnik13/trusty64',
+  :libvirt => 'elastic/ubuntu-14.04-x86_64',
   :openstack => nil
 }
 
@@ -58,7 +58,7 @@ nodes = [
     :ram    => 12 * 1024,
     :groups => ["all-in-one"],
     :flavor => 'm1.xlarge',
-    :args   => ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc', 'ccsdk'],
+    :args   => ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc', 'ccsdk', 'multicloud', 'vnfsdk', 'vpp', 'msb'],
   },
   {
     :name   => "appc",
@@ -72,7 +72,7 @@ nodes = [
   },
   {
     :name   => "ccsdk",
-    :ips    => ['10.252.0.14', "192.168.50.17"],
+    :ips    => ['10.252.0.19', "192.168.50.19"],
     :macs   => [],
     :cpus   => 2,
     :cpu    => "50",
@@ -113,7 +113,7 @@ nodes = [
   },
   {
     :name   => "mso",
-    :ips    => ['10.252.0.7', "192.168.50.7"],
+    :ips    => ['10.252.0.20', "192.168.50.20"],
     :macs   => [],
     :cpus   => 2,
     :cpu    => "50",
@@ -121,6 +121,16 @@ nodes = [
     :groups => ["individual"],
     :args   => ["mso"],
   },
+  {
+    :name   => "msb",
+    :ips    => ['10.252.0.7', "192.168.50.7"],
+    :macs   => [],
+    :cpus   => 2,
+    :cpu    => "50",
+    :ram    => 4 * 1024,
+    :groups => ["individual"],
+    :args   => ["msb"],
+  },
   {
     :name   => "multicloud",
     :ips    => ['10.252.0.16', "192.168.50.16"],
@@ -131,6 +141,21 @@ nodes = [
     :groups => ["individual"],
     :args   => ["multicloud"],
   },
+  {
+    :name   => "oom",
+    :ips    => ['10.252.0.21', "192.168.50.21"],
+    :macs   => [],
+    :cpus   => 16,
+    :cpu    => "50",
+    :ram    => 64 * 1024,
+    :groups => ["individual"],
+    :args   => ["oom"],
+    :hd     => "60G",
+    :fwds   => [
+      { :guest => 8880, :host => 8880, :guest_ip => '192.168.50.21' },
+      { :guest => 8989, :host => 8989, :guest_ip => '192.168.50.21' },
+    ]
+  },
   {
     :name   => "policy",
     :ips    => ['10.252.0.13', "192.168.50.13"],
@@ -170,6 +195,7 @@ nodes = [
     :ram    => 8 * 1024,
     :groups => ["individual"],
     :args   => ["sdc"],
+    :hd     => "20G",
   },
   {
     :name   => "sdnc",
@@ -241,6 +267,10 @@ nodes = [
     :ram    => 8 * 1024,
     :groups => ["individual"],
     :args   => ['openstack'],
+    :fwds   => [
+      { :guest => 80, :host => 8888, :guest_ip => '192.168.53.4' },
+      { :guest => 6080, :host => 6080, :guest_ip => '192.168.53.4' },
+    ]
   }
 ]
 
@@ -312,15 +342,14 @@ end
 
 Vagrant.configure("2") do |config|
 
-  # PROXY definitions
-    if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil and ENV['no_proxy'] != nil
+    # PROXY definitions
+    if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil
       if not Vagrant.has_plugin?('vagrant-proxyconf')
         system 'vagrant plugin install vagrant-proxyconf'
         raise 'vagrant-proxyconf was installed but it requires to execute again'
       end
       config.proxy.http     = ENV['http_proxy']
       config.proxy.https    = ENV['https_proxy']
-      config.proxy.no_proxy = ENV['no_proxy']
       configuration['socks_proxy'] = ENV['socks_proxy']
     end
 
@@ -347,6 +376,15 @@ Vagrant.configure("2") do |config|
     nodes.each do |node|
       config.vm.define node[:name] do |nodeconfig|
 
+      # NO_PROXY definitions
+      if ENV['no_proxy'] != nil
+        if not Vagrant.has_plugin?('vagrant-proxyconf')
+          system 'vagrant plugin install vagrant-proxyconf'
+          raise 'vagrant-proxyconf was installed but it requires to execute again'
+        end
+        config.proxy.no_proxy = node[:ips].join(",") + "," + ENV['no_proxy']
+      end
+
         # Common Settings:
 
         nodeconfig.vm.provider "virtualbox" do |vbox|
@@ -357,11 +395,55 @@ Vagrant.configure("2") do |config|
           vbox.customize ['modifyvm', :id, "--cpuexecutioncap", node[:cpu]]
           vbox.customize ['modifyvm', :id, "--cpus", node[:cpus]]
           vbox.customize ["modifyvm", :id, "--memory", node[:ram]]
+
+          # Set Network
+          nodeconfig.vm.network :private_network,
+            :adapter => 2,
+            :name => net_interface,
+            :ip  => node[:ips][0]
+
+          nodeconfig.vm.network :private_network,
+            :adapter => 3,
+            :ip  => node[:ips][1],
+            :type => :static
+
+          # Set Storage
+          if node.has_key? :hd
+            volume_file = node[:name] + '-vol1-data.vdi'
+            unless File.exist?(volume_file)
+              vbox.customize ['createhd', '--filename', volume_file, '--size', node[:hd]]
+            end
+            vbox.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', volume_file]
+          end
         end
 
         nodeconfig.vm.provider "libvirt" do |lbox|
           lbox.memory = node[:ram]
           lbox.nested = true
+          lbox.cpu_mode = 'host-passthrough'
+          lbox.cpus = node[:cpus]
+
+          # Set Network
+          nodeconfig.vm.network :private_network,
+            :ip  => node[:ips][0]
+
+          nodeconfig.vm.network :private_network,
+            :ip  => node[:ips][1],
+            :type => :static
+
+          # Set Storage
+          if node.has_key? :hd
+            lbox.storage :file, bus: 'sata', device: 'sda', size: node[:hd]
+          end
+        end
+        if node.has_key? :fwds
+          node[:fwds].each do |fwd|
+            nodeconfig.vm.network :forwarded_port,
+              :guest => fwd[:guest],
+              :guest_ip => fwd[:guest_ip],
+              :host => fwd[:host],
+              :host_ip => "0.0.0.0"
+          end
         end
 
         nodeconfig.vm.provider :openstack do |obox|
@@ -383,49 +465,27 @@ Vagrant.configure("2") do |config|
         end
 
         # Set Box type
-        nodeconfig.vm.box = box[provider]
         if "openstack" == node[:name]
-          nodeconfig.vm.box = "ubuntu/xenial64"
+          box = {
+            :virtualbox => 'ubuntu/xenial64',
+            :libvirt => 'elastic/ubuntu-16.04-x86_64'
+          }
         end
+        nodeconfig.vm.box = box[provider]
 
         # Set Node name
         nodeconfig.vm.hostname = node[:name]
 
         # Set Sync Folder
         nodeconfig.vm.synced_folder ".", "/vagrant", disabled: true
-        nodeconfig.vm.synced_folder './opt', '/opt/', create: true
-        nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true
+        nodeconfig.vm.synced_folder './opt', '/opt/', create: true, type: "nfs"
+        nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true, type: "nfs"
         if !is_windows
           nodeconfig.vm.synced_folder '~/.m2', '/root/.m2/', create: true
         end
 
-        # Set Network
-        nodeconfig.vm.network :private_network,
-            :adapter => 2,
-            :name => net_interface,
-            :ip  => node[:ips][0]
-
-        nodeconfig.vm.network :private_network,
-            :adapter => 3,
-            :ip  => node[:ips][1],
-            :type => :static
-
         # Specific settings:
 
-        # Set Storage (For SDC or All-in-one)
-        if node[:name].include?("all-in-one") || node[:name].include?("sdc")
-          nodeconfig.vm.provider "virtualbox" do |v|
-              unless File.exist?(sdc_volume)
-                  v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
-              end
-              v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
-            end
-
-            nodeconfig.vm.provider "libvirt" do |v|
-                v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
-            end
-        end
-
         if node[:name].include? "testing"
             nodeconfig.vm.synced_folder './tests', '/var/onap_tests/', create: true
             test_suite = ENV.fetch('TEST_SUITE', '*')