Update SDC instructions 55/30155/2
authorVictor Morales <victor.morales@intel.com>
Fri, 2 Feb 2018 16:26:50 +0000 (08:26 -0800)
committerVictor Morales <victor.morales@intel.com>
Mon, 5 Feb 2018 10:57:18 +0000 (02:57 -0800)
The variables and instructions of SDC script were out of date.
This change includes the usage of "src_folders" variable besides
the simplification of the process.

Change-Id: I557b2a9a2a2ed567003230febfae56a043a2e9e2
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-ID: INT-16

bootstrap/vagrant-onap/Vagrantfile
bootstrap/vagrant-onap/lib/functions
bootstrap/vagrant-onap/lib/oom
bootstrap/vagrant-onap/lib/sdc

index 6d7900b..72d73ab 100644 (file)
@@ -45,7 +45,7 @@ nodes = [
     :macs   => [],
     :cpus   => 2,
     :cpu    => "50",
-    :ram    => 6 * 1024,
+    :ram    => 8 * 1024,
     :groups => ["individual"],
     :args   => ["aai"],
     :fwds   => [
@@ -157,7 +157,7 @@ nodes = [
     :ram    => 64 * 1024,
     :groups => ["individual"],
     :args   => ["oom"],
-    :hd     => "60G",
+    :hd     => { :virtualbox => "61440", :libvirt => "60G", },
     :fwds   => [
       { :guest => 8880, :host => 8880, :guest_ip => '192.168.50.21' },
       { :guest => 8989, :host => 8989, :guest_ip => '192.168.50.21' },
@@ -202,7 +202,7 @@ nodes = [
     :ram    => 8 * 1024,
     :groups => ["individual"],
     :args   => ["sdc"],
-    :hd     => "20G",
+    :hd     => { :virtualbox => "20480", :libvirt => "20G", }
   },
   {
     :name   => "sdnc",
@@ -355,6 +355,7 @@ Vagrant.configure("2") do |config|
         system 'vagrant plugin install vagrant-proxyconf'
         raise 'vagrant-proxyconf was installed but it requires to execute again'
       end
+      config.proxy.enabled = { docker: false }
       config.proxy.http     = ENV['http_proxy']
       config.proxy.https    = ENV['https_proxy']
       configuration['socks_proxy'] = ENV['socks_proxy']
@@ -420,7 +421,7 @@ Vagrant.configure("2") do |config|
           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]]
+              vbox.customize ['createmedium', 'disk', '--filename', volume_file, '--size', node[:hd][provider]]
             end
             vbox.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', volume_file]
           end
@@ -442,7 +443,7 @@ Vagrant.configure("2") do |config|
 
           # Set Storage
           if node.has_key? :hd
-            lbox.storage :file, bus: 'sata', device: 'sda', size: node[:hd]
+            lbox.storage :file, bus: 'sata', device: 'sda', size: node[:hd][provider]
           end
         end
         if node.has_key? :fwds
index ba128d9..435c621 100755 (executable)
@@ -256,6 +256,21 @@ function pull_docker_image {
     fi
 }
 
+# wait_docker_pull() - Function that waits for all docker pull processes
+function wait_docker_pull {
+    local counter=60
+    local delay=${1:-60}
+
+    sleep $delay
+    while [ $(ps -ef | grep "docker pull" | wc -l) -gt 1 ]; do
+        sleep $delay
+        counter=$((counter - 1))
+        if [ "$counter" -eq 0 ]; then
+            break
+        fi
+    done
+}
+
 # run_docker_image() - Starts a Docker instance
 function run_docker_image {
     install_docker
@@ -334,6 +349,9 @@ function build_docker_image {
         if [ $profile ]; then
             docker_build+=" -P $profile"
         fi
+        if [[ "$debug" == "False" ]]; then
+            docker_build+=" -q"
+        fi
         if [ $http_proxy ]; then
             if ! grep -ql "docker.buildArg.http_proxy" pom.xml ; then
                 docker_build+=" -Ddocker.buildArg.http_proxy=$http_proxy"
index ef7e5ed..d52c029 100755 (executable)
@@ -33,7 +33,7 @@ function _pull_k8s_images {
 "k8s-dns-sidecar-amd64:1.14.5" "k8s-dns-kube-dns-amd64:1.14.5" \
 "k8s-dns-dnsmasq-nanny-amd64:1.14.5" "heapster-influxdb-amd64:v1.3.3" \
 "heapster-grafana-amd64:v4.4.3" "heapster-amd64:v1.4.0" "pause-amd64:3.0"; do
-        pull_docker_image gcr.io/google_containers/$image  &
+        pull_docker_image gcr.io/google_containers/$image &
     done
 }
 
@@ -72,7 +72,7 @@ function _install_kubernetes {
     _pull_rancher_images
     _pull_k8s_images
     pull_docker_image $rancher_agent
-    _wait_docker_pull
+    wait_docker_pull
 
     pushd /opt/rancher/current/
     export RANCHER_ENVIRONMENT=`./rancher env create -t kubernetes onap_on_kubernetes`
@@ -146,19 +146,6 @@ for (i in vname) {
     done
 }
 
-# _wait_docker_pull() - Function that waits for all docker pull processes
-function _wait_docker_pull {
-    local counter=150
-
-    while [ $(ps -ef | grep "docker pull" | wc -l) -gt 1 ]; do
-        sleep $oom_delay
-        counter=$((counter - 1))
-        if [ "$counter" -eq 0 ]; then
-            break
-        fi
-    done
-}
-
 # get_oom_images() - Function that retrieves ONAP images from official hub
 function get_oom_images {
     if [[ "$build_image" == "True" ]]; then
@@ -174,7 +161,7 @@ function get_oom_images {
             _pull_images_from_yaml_file $values_file
         done
         docker logout
-        _wait_docker_pull
+        wait_docker_pull
     fi
 }
 
index fee583d..91523f8 100755 (executable)
@@ -24,12 +24,19 @@ EOL
 
 # get_sdc_images() - Function that retrieves the SDC docker images
 function get_sdc_images {
+    build_docker_image ${src_folders[sdc]}/utils/webseal-simulator docker
     if [[ "$build_image" == "True" ]]; then
-        build_docker_image $sdc_src_folder/sdc-docker-base
+        build_docker_image ${src_folders[sdc]}/sdc-docker-base
+        compile_src  ${src_folders[sdc]}
+        for project in catalog-fe test-apis-ci; do
+            compile_src  ${src_folders[sdc]}/$project
+        done
+        build_docker_image ${src_folders[sdc]}/sdc-os-chef docker
     else
-        for image in backend frontend elasticsearch kibana cassandra sanity; do
-            pull_openecomp_image openecomp/sdc-$image
+        for image in elasticsearch init-elasticsearch cassandra kibana backend frontend sanity; do
+            pull_onap_image sdc-$image &
         done
+        wait_docker_pull
     fi
 }
 
@@ -39,15 +46,14 @@ function install_sdc {
     local MR_IP_ADDR='10.0.11.1'
 
     _init_data_folders
-    cp $sdc_src_folder/sdc-os-chef/environments/Template.json /data/environments
-    cp $sdc_src_folder/sdc-os-chef/scripts/docker_run.sh /data/scripts
-    cp $sdc_src_folder/sdc-os-chef/scripts/docker_health.sh /data/scripts
-    cp $sdc_src_folder/sdc-os-chef/scripts/docker_login.sh /data/scripts
-    cp $sdc_src_folder/sdc-os-chef/scripts/docker_clean.sh /data/scripts
-    chmod +x /data/scripts/docker_run.sh
-    chmod +x /data/scripts/docker_health.sh
-    chmod +x /data/scripts/docker_login.sh
-    chmod +x /data/scripts/docker_clean.sh
+    cp ${src_folders[sdc]}/sdc-os-chef/environments/Template.json /data/environments
+    cp ${src_folders[sdc]}/sdc-os-chef/scripts/docker_run.sh /data/scripts
+    cp ${src_folders[sdc]}/sdc-os-chef/scripts/docker_health.sh /data/scripts
+    cp ${src_folders[sdc]}/sdc-os-chef/scripts/docker_login.sh /data/scripts
+    cp ${src_folders[sdc]}/sdc-os-chef/scripts/docker_clean.sh /data/scripts
+    cp ${src_folders[sdc]}/sdc-os-chef/scripts/simulator_docker_run.sh /data/scripts
+
+    chmod +x /data/scripts/*.sh
 
     cat /data/environments/Template.json | sed "s/yyy/"$IP_ADDRESS"/g" > /data/environments/$ENV_NAME.json
     sed -i "s/xxx/"$ENV_NAME"/g" /data/environments/$ENV_NAME.json
@@ -56,7 +62,7 @@ function install_sdc {
 
     install_docker
     if [[ "$skip_get_images" == "False" ]]; then
-        bash /data/scripts/docker_run.sh -e $ENV_NAME  -l
+        bash /data/scripts/docker_run.sh -e $ENV_NAME -l
     else
         bash /data/scripts/docker_run.sh -e $ENV_NAME -r $docker_version -p $(echo $nexus_docker_repo | cut -d':' -f2)
     fi