Add VNFSDK install scripts in Vagrant ONAP 47/19947/1
authorShashank Kumar Shankar <shashank.kumar.shankar@intel.com>
Fri, 20 Oct 2017 23:06:08 +0000 (16:06 -0700)
committerShashank Kumar Shankar <shashank.kumar.shankar@intel.com>
Fri, 20 Oct 2017 23:06:08 +0000 (16:06 -0700)
This patch adds the VNFSDK installation scripts and other
minor fixed in the Vagrant ONAP project.

Issue-Id: INT-290

Change-Id: I6402a1ffad4e373eb701945beabd5e95f091ff5b
Signed-off-by: Shashank Kumar Shankar <shashank.kumar.shankar@intel.com>
bootstrap/vagrant-onap/doc/source/features/configure_execution.rst
bootstrap/vagrant-onap/doc/source/features/example_usage.rst
bootstrap/vagrant-onap/lib/sdnc
bootstrap/vagrant-onap/lib/vnfsdk [new file with mode: 0644]
bootstrap/vagrant-onap/tests/test_vnfsdk [new file with mode: 0644]
bootstrap/vagrant-onap/tools/run.sh

index e2da336..713c0e0 100644 (file)
@@ -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 @@ values that can be overriden using *-g* and *-i* respectively by the run scripts
 
 .. end
 
-
index fc5f8b3..293c543 100644 (file)
@@ -135,4 +135,17 @@ the ./opt files are in sync from the host to the VM.
 
    $ 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
index 22066fd..f93a668 100755 (executable)
@@ -64,7 +64,6 @@ function install_sdnc {
 
 # 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 @@ function init_sdnc {
     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 (file)
index 0000000..b73e064
--- /dev/null
@@ -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 (file)
index 0000000..5aeca45
--- /dev/null
@@ -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
index 9e03384..2f2743a 100755 (executable)
@@ -16,7 +16,7 @@ Optional arguments:
         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 @@ case $COMMAND in
     "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" )