aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-10-21 00:02:58 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-21 00:02:58 +0000
commit402d8ff80db70c89d4a8777e546b646913d91815 (patch)
tree5397fa607258f83c7347c7280e10ac9b90b51436
parentf3a8006ea0f532760a7e62550c243a2d3856b40d (diff)
parentd52d0af3d1d76a5dfb7c6cadad47d95819aabb21 (diff)
Merge "Add VNFSDK install scripts in Vagrant ONAP"
-rw-r--r--bootstrap/vagrant-onap/doc/source/features/configure_execution.rst3
-rw-r--r--bootstrap/vagrant-onap/doc/source/features/example_usage.rst13
-rwxr-xr-xbootstrap/vagrant-onap/lib/sdnc2
-rw-r--r--bootstrap/vagrant-onap/lib/vnfsdk69
-rw-r--r--bootstrap/vagrant-onap/tests/test_vnfsdk50
-rwxr-xr-xbootstrap/vagrant-onap/tools/run.sh4
6 files changed, 136 insertions, 5 deletions
diff --git a/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst b/bootstrap/vagrant-onap/doc/source/features/configure_execution.rst
index e2da33681..713c0e0fd 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 @@ values that can be overriden using *-g* and *-i* respectively by the run scripts
.. end
-
diff --git a/bootstrap/vagrant-onap/doc/source/features/example_usage.rst b/bootstrap/vagrant-onap/doc/source/features/example_usage.rst
index fc5f8b39d..293c543fa 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 @@ 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
diff --git a/bootstrap/vagrant-onap/lib/sdnc b/bootstrap/vagrant-onap/lib/sdnc
index 22066fdd4..f93a6682d 100755
--- a/bootstrap/vagrant-onap/lib/sdnc
+++ b/bootstrap/vagrant-onap/lib/sdnc
@@ -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
index 000000000..b73e06426
--- /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 000000000..5aeca45c2
--- /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 9e03384f7..2f2743a16 100755
--- a/bootstrap/vagrant-onap/tools/run.sh
+++ b/bootstrap/vagrant-onap/tools/run.sh
@@ -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" )