Merge "Add VNFSDK install scripts in Vagrant ONAP"
diff --git a/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst b/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst
index e2da336..713c0e0 100644
--- a/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst
+++ b/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst
@@ -2,7 +2,7 @@
 Modify execution values
 =======================
 
-In order to provide a flexible plataform that adjusts to different developer
+In order to provide a flexible platform that adjusts to different developer
 needs, it has been implemented two mechanism to configure the execution of this
 project.
 
@@ -71,4 +71,3 @@
 
 .. end
 
-
diff --git a/bootstrap/vagrant-onap/doc/source/features/example_usage.rst b/bootstrap/vagrant-onap/doc/source/features/example_usage.rst
index fc5f8b3..293c543 100644
--- a/bootstrap/vagrant-onap/doc/source/features/example_usage.rst
+++ b/bootstrap/vagrant-onap/doc/source/features/example_usage.rst
@@ -135,4 +135,17 @@
 
    $ vagrant destroy vfc
 
+.. end
+
+Testing
+-------
+
+Use the run.sh script to test if the provisioning scripts run without errors.
+
+And example test to check the number of covered repositories with this tool.
+
+.. code-block:: console
+
+   $ ./tools/run.sh testing -y -c coverity_repos -s functions
+
 .. end
\ No newline at end of file
diff --git a/bootstrap/vagrant-onap/lib/sdnc b/bootstrap/vagrant-onap/lib/sdnc
index 22066fd..f93a668 100755
--- a/bootstrap/vagrant-onap/lib/sdnc
+++ b/bootstrap/vagrant-onap/lib/sdnc
@@ -64,7 +64,6 @@
 
 # init_sdnc() - Function that initialize SDNC services
 function init_sdnc {
-    start_ODL
     if [[ "$clone_repo" == "True" ]]; then
         clone_all_sdnc_repos
         if [[ "$compile_repo" == "True" ]]; then
@@ -75,6 +74,7 @@
     if [[ "$skip_get_images" == "False" ]]; then
         get_sdnc_images
         if [[ "$skip_install" == "False" ]]; then
+            start_ODL
             install_sdnc
         fi
     fi
diff --git a/bootstrap/vagrant-onap/lib/vnfsdk b/bootstrap/vagrant-onap/lib/vnfsdk
new file mode 100644
index 0000000..b73e064
--- /dev/null
+++ b/bootstrap/vagrant-onap/lib/vnfsdk
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+set -o xtrace
+
+source /var/onap/functions
+
+vnfsdk_src_folder=$git_src_folder/vnfsdk
+
+vnfsdk_repos=("refrepo")
+
+# clone_all_vnfsdk_repos() - Function that clones vnfsdk source repo.
+function clone_all_vnfsdk_repos {
+
+    for dirc in ${vnfsdk_repos[@]}; do
+        clone_repo vnfsdk/$dirc $vnfsdk_src_folder/$dirc
+    done
+}
+
+# compile_all_vnfsdk_repos - Function that builds vnfsdk source repo
+function compile_all_vnfsdk_repos {
+
+    for dirc in ${vnfsdk_repos[@]}; do
+        clone_repo vnfsdk/$dirc $vnfsdk_src_folder/$dirc
+    done
+}
+
+# _build_vnfsdk_images() - Builds VNFSDK images from source code
+function _build_vnfsdk_images {
+    install_package unzip
+    pushd $vnfsdk_src_folder/refrepo/vnfmarket-be/deployment/docker/docker-refrepo
+    build_docker_image .
+    popd
+}
+
+# get_vnfsdk_images - Function that clones vnfsdk Docker images
+function get_vnfsdk_images {
+    if [[ "$build_image" == "True" ]]; then
+        # TODO(sshank): Has errors building.
+        _build_vnfsdk_images
+    else
+        pull_docker_image refrepo:1.0-STAGING-latest
+        pull_docker_image refrepo:latest
+    fi
+}
+
+# install_vnfsdk - Function that installs vnfsdk Docker images
+function install_vnfsdk {
+    install_docker_compose
+    pushd $vnfsdk_src_folder/refrepo/vnfmarket-be/deployment/install
+    /opt/docker/docker-compose up -d
+    popd
+}
+
+# init_vnfsdk() - Init VNFSDK services
+function init_vnfsdk {
+    if [[ "$clone_repo" == "True" ]]; then
+        clone_all_vnfsdk_repos
+        if [[ "$compile_repo" == "True" ]]; then
+            compile_all_vnfsdk_repos
+        fi
+    fi
+
+    if [[ "$skip_get_images" == "False" ]]; then
+        get_vnfsdk_images
+        if [[ "$skip_install" == "False" ]]; then
+            install_vnfsdk
+        fi
+    fi
+}
diff --git a/bootstrap/vagrant-onap/tests/test_vnfsdk b/bootstrap/vagrant-onap/tests/test_vnfsdk
new file mode 100644
index 0000000..5aeca45
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_vnfsdk
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/vnfsdk
+
+covered_functions=(
+"clone_all_vnfsdk_repos" "compile_all_vnfsdk_repos" "get_vnfsdk_images" "install_vnfsdk"
+)
+
+# test_clone_all_vnfsdk_repos() - Verify the cloning of VNFSDK source repo.
+function test_clone_all_vnfsdk_repos {
+    clone_all_vnfsdk_repos
+
+    asserts_file_exist $vnfsdk_src_folder/refrepo/pom.xml
+}
+
+# test_compile_all_vnfsdk_repos () - Verify if VNFSDK source repo compiles correctly.
+function test_compile_all_vnfsdk_repos {
+    clone_all_vnfsdk_repos
+    {
+        compile_all_vnfsdk_repos
+    } || {
+        set -e
+    }
+}
+
+# test_get_vnfsdk_images() - Verify that the VNFSDK images are created or retrieved
+function  test_get_vnfsdk_images {
+    clone_all_vnfsdk_repos
+    get_vnfsdk_images
+
+    asserts_image refrepo:1.0-STAGING-latest
+    asserts_image refrepo:latest
+}
+
+# test_install_vnfsdk() - Verify that VNFSDK docker images are running.
+function test_install_vnfsdk {
+    clone_all_vnfsdk_repos
+    get_vnfsdk_images
+    install_vnfsdk
+
+    asserts_image_running refrepo:1.0-STAGING-latest
+    asserts_image refrepo:latest
+}
+
+if [ "$1" != '*' ]; then
+    unset covered_functions
+    covered_functions=$1
+fi
+main "${covered_functions[@]}"
\ No newline at end of file
diff --git a/bootstrap/vagrant-onap/tools/run.sh b/bootstrap/vagrant-onap/tools/run.sh
index 9e03384..2f2743a 100755
--- a/bootstrap/vagrant-onap/tools/run.sh
+++ b/bootstrap/vagrant-onap/tools/run.sh
@@ -16,7 +16,7 @@
         Test case to use in testing mode.
 Commands:
     all_in_one  Deploy in all-in-one mode.
-    dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|multicloud|ccsdk  Deploy chosen service.
+    dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|vnfsdk|multicloud|ccsdk  Deploy chosen service.
     testing  Deploy in testing mode.
 EOF
 }
@@ -65,7 +65,7 @@
     "all_in_one" )
         export DEPLOY_MODE='all-in-one'
         ;;
-    "dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" | "vfc" | "multicloud" | "ccsdk" )
+    "dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" | "vfc" | "vnfsdk"| "multicloud" | "ccsdk" )
         export DEPLOY_MODE='individual'
         ;;
     "testing" )