summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap/vagrant-onap/lib/portal96
-rw-r--r--bootstrap/vagrant-onap/tests/test_portal59
2 files changed, 121 insertions, 34 deletions
diff --git a/bootstrap/vagrant-onap/lib/portal b/bootstrap/vagrant-onap/lib/portal
index 44cedb20d..505bdde0c 100755
--- a/bootstrap/vagrant-onap/lib/portal
+++ b/bootstrap/vagrant-onap/lib/portal
@@ -3,53 +3,74 @@
set -o xtrace
source /var/onap/functions
-source /var/onap/asserts
-# install_mariadb() - Pull and create a MariaDB container
-function install_mariadb {
+policy_src_folder=$git_src_folder/portal
+policy_repos=("sdk")
+
+# clone_all_portal_repos() - Function that clones Portal source repo.
+function clone_all_portal_repos {
+ clone_repo portal $policy_src_folder
+ clone_repo ecompsdkos $policy_src_folder/ecompsdkos
+ clone_repo "ui/dmaapbc" $policy_src_folder/dmaapbc
+
+ for dirc in ${policy_repos[@]}; do
+ clone_repo portal/$dirc $policy_src_folder/$dirc
+ done
+}
+
+# compile_all_portal_repos() - Function that compiles Portal source repo.
+function compile_all_portal_repos {
+ compile_src $policy_src_folder
+
+ for dirc in ${policy_repos[@]}; do
+ compile_src $policy_src_folder/$dirc
+ done
+}
+
+# _build_portal_images() - Function that builds Portal Docker images from source code
+function _build_portal_images {
+ install_maven
+
+ pushd $policy_src_folder/deliveries
+ chmod +x *.sh
+ export MVN=$(which mvn)
+ export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml
+ export SETTINGS_FILE=$HOME/.m2/settings.xml
+ bash build_portalapps_dockers.sh
+ compile_src $policy_src_folder/ecomp-portal-widget-ms
+ build_docker_image $policy_src_folder/ecomp-portal-widget-ms
+ popd
+}
+
+# get_portal_images() - Function to get Portal images.
+function get_portal_images {
+ if [[ "$build_image" == "True" ]]; then
+ _build_portal_images
+ else
+ pull_openecomp_image portaldb ecompdb:portal
+ pull_openecomp_image portalapps ep:1610-1
+ fi
pull_docker_image mariadb
+}
+
+# _install_mariadb() - Pull and create a MariaDB container
+function _install_mariadb {
docker create --name data_vol_portal -v /var/lib/mysql mariadb
}
-# install_portal() - Function that pulls and install the source code of Portal
+# install_portal() - Function that installs the source code of Portal
function install_portal {
- local src_folder=/opt/portal
- clone_repo portal $src_folder
- clone_repo portal/sdk $src_folder/sdk
install_docker
docker rm -f ecompdb_portal
docker rm -f 1610-1
- pushd $src_folder/deliveries
- if [[ "$build_image" == "True" ]]; then
- install_maven
-
- clone_repo ecompsdkos $src_folder/ecompsdkos
- clone_repo "ui/dmaapbc" $src_folder/dmaapbc
- chmod +x *.sh
- export MVN=$(which mvn)
- export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml
- export SETTINGS_FILE=$HOME/.m2/settings.xml
- bash run.sh
- compile_src $src_folder/ecomp-portal-widget-ms
- build_docker_image $src_folder/ecomp-portal-widget-ms
- else
- pull_openecomp_image portaldb ecompdb:portal
- pull_openecomp_image portalapps ep:1610-1
- fi
- for image in ecompdb:portal ep:1610-1; do
- asserts_image $image
- done
-
- chmod +x new_start.sh
- chmod +x new_stop.sh
- chmod +x dbstart.sh
+ pushd $policy_src_folder/deliveries
mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
install_package unzip
unzip -o etc.zip -d /PROJECT/OpenSource/UbuntuEP/
- bash dbstart.sh
- bash new_start.sh
+ install_docker_compose
+ bash portal_vm_init.sh
sleep 180
@@ -63,6 +84,13 @@ function install_portal {
# init_portal() - Function that initialize Portal services
function init_portal {
- install_mariadb
+ if [[ "$clone_repo" == "True" ]]; then
+ clone_all_portal_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_portal_repos
+ fi
+ fi
+ get_portal_images
+ _install_mariadb
install_portal
}
diff --git a/bootstrap/vagrant-onap/tests/test_portal b/bootstrap/vagrant-onap/tests/test_portal
new file mode 100644
index 000000000..d586b73f5
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_portal
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/portal
+
+covered_functions=(
+"clone_all_portal_repos"
+"compile_all_portal_repos"
+"get_portal_images"
+"install_portal"
+)
+
+# test_clone_all_portal_repos() - Verify cloning of Portal source code
+function test_clone_all_portal_repos {
+ clone_all_portal_repos
+
+ asserts_file_exist $policy_src_folder/pom.xml
+ asserts_file_exist $policy_src_folder/ecompsdkos/LICENSE.txt
+ asserts_file_exist $policy_src_folder/dmaapbc/pom.xml
+ asserts_file_exist $policy_src_folder/sdk/LICENSE.txt
+}
+
+# test_compile_all_portal_repos() - Verify compiling of Portal source code
+function test_compile_all_portal_repos {
+ clone_all_portal_repos
+ compile_all_portal_repos
+
+ asserts_file_exist $policy_src_folder/ecomp-portal-BE-common/target/ecompportal-be-common.war
+ asserts_file_exist $policy_src_folder/ecomp-portal-BE-common-test/target/ecomp-portal-BE-common-test.jar
+ asserts_file_exist $policy_src_folder/ecomp-portal-BE-os/target/ecompportal-be-os.war
+}
+
+# test_get_portal_images() - Verify that Portal Docker images are retrieved or built properly
+function test_get_portal_images {
+ clone_all_portal_repos
+ get_portal_images
+
+ asserts_image portal-db
+ asserts_image portal-wms
+ asserts_image portal-apps
+ asserts_image mariadb
+}
+
+# test_install_portal() - Verify installation of Portal services
+function test_install_portal {
+ clone_all_portal_repos
+ install_mariadb
+ install_portal
+
+ asserts_image_running portal-db
+ asserts_image_running portal-wms
+ asserts_image_running portal-apps
+}
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"