From dbdc30ad2cd10a1b6a38885f51f64ff169dfe4a4 Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Thu, 17 Aug 2017 11:50:42 -0500 Subject: Refactor and Improve SDNC UTs This change refactor the lib/sdnc script and add some unit tests to the SDNC component. Change-Id: Ia389c0e8e78de2eef1b41075a0701b013f9bc925 Signed-off-by: Victor Morales Issue-Id: INT-102 --- bootstrap/vagrant-onap/lib/sdnc | 35 +++++++++++--------------- bootstrap/vagrant-onap/tests/test_sdnc | 46 +++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 24 deletions(-) diff --git a/bootstrap/vagrant-onap/lib/sdnc b/bootstrap/vagrant-onap/lib/sdnc index 8bf6ae625..332632138 100755 --- a/bootstrap/vagrant-onap/lib/sdnc +++ b/bootstrap/vagrant-onap/lib/sdnc @@ -3,7 +3,6 @@ set -o xtrace source /var/onap/functions -source /var/onap/asserts src_folder=$git_src_folder/openecomp/sdnc sdnc_repos=("core" "adaptors" "northbound" "plugins" "oam") @@ -25,41 +24,35 @@ function compile_all_sdnc_repos { done } -# _build_sdnc_images() - Builds SDNC images from source code -function _build_sdnc_images { - local folder=$1 +# build_sdnc_images() - Builds SDNC images from source code +function build_sdnc_images { + local folder=${1:-$src_folder/oam} - build_docker_image $folder/installation/ubuntu - asserts_image openecomp/ubuntu-sdnc-image - - build_docker_image $folder/installation/sdnc - asserts_image openecomp/sdnc-image - - build_docker_image $folder/installation/admportal - asserts_image openecomp/admportal-sdnc-image - - build_docker_image $folder/installation/dgbuilder - asserts_image openecomp/dgbuilder-sdnc-image + install_package unzip + clone_repo sdnc/oam $src_folder/oam + # The OAM code depends on all the SDNC repos which should be downloaded and compiled first + if [[ "$compile_repo" == "False" ]]; then + compile_src $src_folder/oam/ + fi + for dirc in ubuntu sdnc admportal dgbuilder; do + build_docker_image $folder/installation/$dirc + done } # get_sdnc_images() - Build or retrieve necessary images function get_sdnc_images { if [[ "$build_image" == "True" ]]; then - # The OAM code depends on all the SDNC repos which should be downloaded and compiled first - if [[ "$compile_repo" == "False" ]]; then - compile_all_sdnc_repos - fi - _build_sdnc_images $src_folder/oam + build_sdnc_images else pull_openecomp_image sdnc-image openecomp/sdnc-image:latest pull_openecomp_image admportal-sdnc-image openecomp/admportal-sdnc-image:latest pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest fi + pull_docker_image mysql/mysql-server:5.6 } # install_sdnc() - Download and install SDNC services from source code function install_sdnc { - install_package unzip clone_repo sdnc/oam $src_folder/oam pushd $src_folder/oam/installation/src/main/yaml install_docker_compose diff --git a/bootstrap/vagrant-onap/tests/test_sdnc b/bootstrap/vagrant-onap/tests/test_sdnc index be900d3d8..93110a3f0 100644 --- a/bootstrap/vagrant-onap/tests/test_sdnc +++ b/bootstrap/vagrant-onap/tests/test_sdnc @@ -4,7 +4,7 @@ source /var/onap_tests/_test_base source /var/onap/sdnc covered_functions=( -"clone_all_sdnc_repos" "compile_all_sdnc_repos" "get_sdnc_images" +"clone_all_sdnc_repos" "compile_all_sdnc_repos" "get_sdnc_images" "install_sdnc" ) # test_clone_all_sdnc_repos() - Verify the source code retrieve of SDNC project @@ -23,9 +23,36 @@ function test_compile_all_sdnc_repos { clone_all_sdnc_repos compile_all_sdnc_repos - asserts_file_exist $src_folder/core/rootpom/boron-sr1/target/classes/LICENSE - asserts_file_exist $src_folder/core/rootpom/boron-sr3/target/classes/LICENSE + for adaptor in aai-service mdsal-resource resource-assignment sql-resource; do + asserts_file_exist $src_folder/adaptors/$adaptor/features/target/$adaptor-features-1.1.2-SNAPSHOT.jar + asserts_file_exist $src_folder/adaptors/$adaptor/installer/target/sdnc-$adaptor-1.1.2-SNAPSHOT-installer.zip + asserts_file_exist $src_folder/adaptors/$adaptor/provider/target/$adaptor-provider-1.1.2-SNAPSHOT.jar + done + + asserts_file_exist $src_folder/core/dblib/provider/target/dblib-provider-1.1.2-SNAPSHOT.jar asserts_file_exist $src_folder/core/rootpom/target/rootpom-1.1.0-site_en.xml + asserts_file_exist $src_folder/core/target/sdnc-core-1.1.2-SNAPSHOT-site.xml + + for component in asdcApi dataChange vnfapi vnftools; do + asserts_file_exist $src_folder/northbound/$component/features/target/$component-features-1.1.2-SNAPSHOT.jar + asserts_file_exist $src_folder/northbound/$component/installer/target/sdnc-$component-1.1.2-SNAPSHOT-installer.zip + if [[ "$component" != "vnftools" ]]; then + asserts_file_exist $src_folder/northbound/$component/model/target/$component-model-1.1.2-SNAPSHOT.jar + fi + asserts_file_exist $src_folder/northbound/$component/provider/target/$component-provider-1.1.2-SNAPSHOT.jar + done + asserts_file_exist $src_folder/northbound/dmaap-listener/target/dmaap-listener-1.1.2-SNAPSHOT.jar + asserts_file_exist $src_folder/northbound/ueb-listener/target/ueb-listener-1.1.2-SNAPSHOT.jar + + asserts_file_exist $src_folder/oam/admportal/target/admportal.1.1.2-SNAPSHOT.zip + asserts_file_exist $src_folder/oam/dgbuilder/target/dgbuilder.1.1.2-SNAPSHOT.zip + asserts_file_exist $src_folder/oam/platform-logic/installer/target/platform-logic-installer-1.1.2-SNAPSHOT.zip + + for plugin in properties-node restapi-call-node; do + asserts_file_exist $src_folder/plugins/$plugin/features/target/$plugin-features-1.1.2-SNAPSHOT.jar + asserts_file_exist $src_folder/plugins/$plugin/installer/target/sdnc-$plugin-1.1.2-SNAPSHOT-installer.zip + asserts_file_exist $src_folder/plugins/$plugin/provider/target/$plugin-provider-1.1.2-SNAPSHOT.jar + done } # test_get_sdnc_images() - Verify that the SDNC images are created or retrieved @@ -36,6 +63,19 @@ function test_get_sdnc_images { asserts_image openecomp/sdnc-image asserts_image openecomp/admportal-sdnc-image asserts_image openecomp/dgbuilder-sdnc-image + asserts_image mysql/mysql-server:5.6 +} + +# test_install_sdnc() - Verify that the SDNC Docker containers are up and running +function test_install_sdnc { + clone_all_sdnc_repos + get_sdnc_images + install_sdnc + + asserts_image_running openecomp/dgbuilder-sdnc-image + asserts_image_running openecomp/admportal-sdnc-image + asserts_image_running openecomp/sdnc-image + asserts_image_running mysql/mysql-server:5.6 } if [ "$1" != '*' ]; then -- cgit 1.2.3-korg