Sync latest changes for vagrant-onap

Given some internal procedures was not possible to submit all the
changes.  In the meantime, those changes were placed into an
non-official project. This change syncronizes the latest changes
into the official repository.

Issue-id: INT-17

Change-Id: Ia4125f4b70273401e4ed3cc1908d2e2ad7d1c2e9
Signed-off-by: Victor Morales <victor.morales@intel.com>
diff --git a/bootstrap/vagrant-onap/lib/mso b/bootstrap/vagrant-onap/lib/mso
index 0cffbf0..b8d4326 100755
--- a/bootstrap/vagrant-onap/lib/mso
+++ b/bootstrap/vagrant-onap/lib/mso
@@ -3,21 +3,43 @@
 set -o xtrace
 
 source /var/onap/functions
+source /var/onap/asserts
+
+src_folder=$git_src_folder/mso
+mso_repos=("chef-repo" "docker-config" "libs" "mso-config")
+
+# clone_all_mso_repos() - Function that clones MSO source repo.
+function clone_all_mso_repos {
+    clone_repo mso $src_folder
+
+    for dirc in ${mso_repos[@]}; do
+        clone_repo mso/$dirc $src_folder/$dirc
+    done
+}
+
+# compile_all_mso_repos() - Function that compiles MSO source repo.
+function compile_all_mso_repos {
+    compile_src $src_folder
+
+    for dirc in ${mso_repos[@]}; do
+        compile_src $src_folder/$dirc
+    done
+}
 
 # install_mso() - Installation of mso images
 function install_mso {
-    local src_folder=/opt/mso
     if [[ "$build_image" == "True" ]]; then
-        clone_repo mso $src_folder
         export GIT_NO_PROJECT=/opt/
-        build_docker_image $src_folder/packages/docker
+        compile_src $src_folder
+        build_docker_image $src_folder/packages/docker docker
+        for image in mso mso-arquillian wildfly ubuntu-update jacoco; do
+            asserts_image openecomp/$image
+        done
     fi
 }
 
 # install_mso_docker_config() - Download and install MSO Docker configuration project
 function install_mso_docker_config {
-    local src_folder=/opt/mso/docker-config
-    clone_repo mso/docker-config $src_folder
     MSO_ENCRYPTION_KEY=$(cat /opt/mso/docker-config/encryption.key)
     echo -n "$openstack_api_key" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt
 
@@ -67,18 +89,27 @@
     export MSO_CONFIG_UPDATES
     export MSO_DOCKER_IMAGE_VERSION=$docker_version
 
-    # Deploy the environment
-    pushd $src_folder
-    chmod +x deploy.sh
     is_package_installed docker-ce || install_docker
     install_docker_compose
-    # This script takes in input 2 nexus repos (the first one for the MSO image, the second one for mariadb)
-    ./deploy.sh $nexus_docker_repo $nexus_username $nexus_password $nexus_docker_repo $nexus_username $nexus_password
+    # Deploy the environment
+    pushd $src_folder/docker-config
+    chmod +x deploy.sh
+    if [[ "$build_image" == "True" ]]; then
+        bash deploy.sh
+    else
+        # This script takes in input 2 nexus repos (the first one for the MSO image, the second one for mariadb)
+        bash deploy.sh $nexus_docker_repo $nexus_username $nexus_password $nexus_docker_repo $nexus_username $nexus_password
+    fi
     popd
 }
 
 # init_mso() - Function that initialize MSO services
 function init_mso {
+    clone_all_mso_repos
+    if [[ "$compile_repo" == "True" ]]; then
+        compile_all_mso_repos
+    fi
+
     install_mso
     install_mso_docker_config
 }