Add OOM provisioning script

The instructions to provision a ONAP Operations Manager environment
was included into the vagrant-onap tool. This script requires a
specific docker version besides some tasks that wait for certain
services.

Change-Id: I39f0b7947e7c87d8aa44ffa93cdb414d700379bd
Signed-off-by: Victor Morales <victor.morales@intel.com>
Co-Authored-By: Shashank Kumar Shankar <shashank.kumar.shankar@intel.com>
Issue-ID: INT-370
diff --git a/bootstrap/vagrant-onap/Vagrantfile b/bootstrap/vagrant-onap/Vagrantfile
index 753e356..01c6afd 100644
--- a/bootstrap/vagrant-onap/Vagrantfile
+++ b/bootstrap/vagrant-onap/Vagrantfile
@@ -142,6 +142,21 @@
     :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"],
     :macs   => [],
@@ -180,6 +195,7 @@
     :ram    => 8 * 1024,
     :groups => ["individual"],
     :args   => ["sdc"],
+    :hd     => "20G",
   },
   {
     :name   => "sdnc",
@@ -251,6 +267,10 @@
     :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' },
+    ]
   }
 ]
 
@@ -322,15 +342,14 @@
 
 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
 
@@ -357,6 +376,15 @@
     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|
@@ -378,12 +406,22 @@
             :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,
@@ -392,6 +430,20 @@
           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|
@@ -426,28 +478,14 @@
 
         # 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
 
         # 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', '*')