aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap/vagrant-onap/lib/dcae110
-rw-r--r--bootstrap/vagrant-onap/tests/test_dcae110
-rwxr-xr-xbootstrap/vagrant-onap/tools/run.sh2
3 files changed, 167 insertions, 55 deletions
diff --git a/bootstrap/vagrant-onap/lib/dcae b/bootstrap/vagrant-onap/lib/dcae
index 05527bc1d..69e3b1c2c 100755
--- a/bootstrap/vagrant-onap/lib/dcae
+++ b/bootstrap/vagrant-onap/lib/dcae
@@ -3,12 +3,14 @@
set -o xtrace
source /var/onap/functions
-source /var/onap/asserts
-# create_config_file() - Creates a configuration yaml file for the controller
-function create_config_file {
- mkdir -p /opt/app/dcae-controller
- cat > /opt/app/dcae-controller/config.yaml << EOL
+dcae_src_folder=$git_src_folder/dcae
+dcae_repos=("apod" "apod/analytics" "apod/buildtools" "apod/cdap" "collectors" "collectors/ves" "controller" "controller/analytics" "dcae-inventory"
+"demo" "demo/startup" "demo/startup/aaf" "demo/startup/controller" "demo/startup/message-router" "dmaapbc" "operation" "operation/utils" "pgaas" "utils" "utils/buildtools")
+
+# _create_config_file() - Creates a configuration yaml file for the controller
+function _create_config_file {
+ cat > $dcae_src_folder/controller/config.yaml << EOL
ZONE: $dcae_zone
STATE: $dcae_state
DCAE-VERSION: $artifacts_version
@@ -35,15 +37,14 @@ GIT-MR-REPO: http://gerrit.onap.org/r/dcae/demo/startup/message-router.git
EOL
}
-# compile_docker_image() - Function that clones, compiles and build a Docker image
-function compile_docker_image {
- local repo=$1
- local src_folder=$2
- local name=$3
- clone_repo dcae/dmaapbc $src_folder
- compile_src $src_folder
+# _build_docker_image() - Function that clones, compiles and build a Docker image
+function _build_docker_image {
+ local src_folder=$1
+ local name=$2
+ install_docker
+
pushd $src_folder
- # TODO(electrocucaracha) Workaround for dmmapb images
+ # TODO(electrocucaracha) Workaround for dmmapbc images
sed -i '/LocalKey/d' Dockerfile
local docker_build="docker build -t $name -f ./Dockerfile ."
if [ $http_proxy ]; then
@@ -53,77 +54,78 @@ function compile_docker_image {
docker_build+=" --build-arg https_proxy=$https_proxy"
fi
eval $docker_build
- asserts_image $name
popd
}
# clone_all_dcae_repos() - Function that clones DCAE source repo.
function clone_all_dcae_repos {
- local src_folder=/opt/dcae
- clone_repo dcae $src_folder
-
- for dirc in apod apod/analytics apod/buildtools apod/buildtools collectors collectors/ves controller controller/analytics dcae-inventory \
- demo demo/startup demo/startup/aaf demo/startup/controller demo/startup/message-router dmaapbc operation operation/utils pgaas utils utils/buildtools; do
- clone_repo dcae/$dirc $src_folder/$dirc
+ clone_repo dcae $dcae_src_folder
+ for dirc in ${dcae_repos[@]}; do
+ clone_repo dcae/$dirc $dcae_src_folder/$dirc
done
}
# compile_all_dcae_repos() - Function that compiles DCAE source repo.
function compile_all_dcae_repos {
- local src_folder=/opt/dcae
-
- for dirc in apod apod/analytics apod/buildtools apod/buildtools collectors collectors/ves controller controller/analytics dcae-inventory \
- demo demo/startup demo/startup/aaf demo/startup/controller demo/startup/message-router dmaapbc operation operation/utils pgaas utils utils/buildtools; do
- compile_src $src_folder/$dirc
+ for dirc in ${dcae_repos[@]}; do
+ compile_src $dcae_src_folder/$dirc
done
}
-
-# install_dcae() - Function that clones and installs the DCAE controller services from source code
-function install_dcae {
- install_docker_compose
-
- clone_all_dcae_repos
- if [[ "$compile_repo" == "True" ]]; then
- compile_all_dcae_repos
+# _build_dcae_images() Function taht builds DCAE docker images from source code.
+function _build_dcae_images {
+ if [[ "$compile_repo" != "True" ]]; then
+ compile_src $dcae_src_folder/dmaapbc
+ compile_src $dcae_src_folder/orch-dispatcher
+ compile_src $dcae_src_folder/demo
+ compile_src $dcae_src_folder/dcae-inventory
fi
+ _build_docker_image $dcae_src_folder/dmaapbc openecomp/dcae-dmaapbc
+ _build_docker_image $dcae_src_folder/orch-dispatcher dcae/orch-dispatcher
- if [[ "$build_image" == "True" ]]; then
- install_docker
- local src_folder=/opt/dcae
-
- compile_docker_image dcae/dmaapb $src_folder/dmaapbc openecomp/dcae-dmaapbc
- compile_docker_image dcae/orch-dispatcher $src_folder/orch-dispatcher dcae/orch-dispatcher
+ pushd $dcae_src_folder/demo
+ bash dcae-demo-controller/src/main/docker-build/build.sh
+ popd
- clone_repo dcae/demo $src_folder/demo
- compile_src $src_folder/demo
- pushd $src_folder/demo
- bash dcae-demo-controller/src/main/docker-build/build.sh
- asserts_image dcae-controller
- popd
+ build_docker_image $dcae_src_folder/dcae-inventory
+}
- clone_repo dcae/dcae-inventory $src_folder/dcae-inventory
- compile_src $src_folder/dcae-inventory
- build_docker_image $src_folder/dcae-inventory
- asserts_image dcae-inventory
+# get_dcae_images() - Function that retrieves or builds DCAE docker images.
+function get_dcae_images {
+ if [[ "$build_image" == "True" ]]; then
+ _build_dcae_images
+ else
+ pull_openecomp_image dcae-dmaapbc openecomp/dcae-dmaapbc
+ pull_openecomp_image dcae-controller
+ fi
+}
+# install_dcae() - Function that clones and installs the DCAE controller services from source code
+function install_dcae {
+ install_docker_compose
+ pushd $dcae_src_folder/demo/startup/controller
+ if [[ "$build_image" == "True" ]]; then
dcae_image=`docker images | grep dcae-controller | awk '{print $1 ":" $2}'`
- pushd $src_folder/demo/startup/controller
sed -i "s|DOCKER-REGISTRY/openecomp/dcae-controller:DCAE-VERSION|$dcae_image|g" docker-compose.yml
sed -i "s|MTU|$MTU|g" docker-compose.yml
/opt/docker/docker-compose up -d
- popd
else
- pushd /opt/dcae/demo/startup/controller
bash init.sh
install_package make
make up
- popd
fi
+ popd
+ # docker run -p 8080:8080 -d -v <some local directory>/config.yml:/opt/config.yml --name dcae-inventory <docker registry>/dcae-inventory:<version>
}
# init_dcae() - Function that initialize DCAE Controller services
function init_dcae {
- create_config_file
+ clone_all_dcae_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_dcae_repos
+ fi
+
+ _create_config_file
+ get_dcae_images
install_dcae
}
diff --git a/bootstrap/vagrant-onap/tests/test_dcae b/bootstrap/vagrant-onap/tests/test_dcae
new file mode 100644
index 000000000..104cadd12
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_dcae
@@ -0,0 +1,110 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/dcae
+
+covered_functions=(
+"clone_all_dcae_repos" "compile_all_dcae_repos" "get_dcae_images" "install_dcae"
+)
+
+# test_clone_all_dcae_repos() - Verifies that can retrieve DCAE repositories properly
+function test_clone_all_dcae_repos {
+ clone_all_dcae_repos
+
+ asserts_file_exist $dcae_src_folder/apod/README.md
+ asserts_file_exist $dcae_src_folder/apod/analytics/pom.xml
+ asserts_file_exist $dcae_src_folder/apod/buildtools/LICENSE.txt
+ asserts_file_exist $dcae_src_folder/apod/cdap/LICENSE.txt
+ asserts_file_exist $dcae_src_folder/collectors/README.md
+ asserts_file_exist $dcae_src_folder/collectors/ves/pom.xml
+ asserts_file_exist $dcae_src_folder/controller/pom.xml
+ asserts_file_exist $dcae_src_folder/controller/analytics/pom.xml
+ asserts_file_exist $dcae_src_folder/dcae-inventory/pom.xml
+ asserts_file_exist $dcae_src_folder/demo/pom.xml
+ asserts_file_exist $dcae_src_folder/demo/startup/README.md
+ asserts_file_exist $dcae_src_folder/demo/startup/aaf/LICENSE.txt
+ asserts_file_exist $dcae_src_folder/demo/startup/controller/LICENSE.txt
+ asserts_file_exist $dcae_src_folder/demo/startup/message-router/LICENSE.txt
+ asserts_file_exist $dcae_src_folder/dmaapbc/pom.xml
+ asserts_file_exist $dcae_src_folder/operation/README.md
+ asserts_file_exist $dcae_src_folder/operation/utils/pom.xml
+ asserts_file_exist $dcae_src_folder/pgaas/LICENSE.txt
+ asserts_file_exist $dcae_src_folder/utils/README.md
+ asserts_file_exist $dcae_src_folder/utils/buildtools/LICENSE.txt
+}
+
+# test_compile_all_dcae_repos() - Verify that the DCAE source code is compiled properly
+function test_compile_all_dcae_repos {
+ clone_all_dcae_repos
+ compile_all_dcae_repos
+
+ asserts_file_exist $dcae_src_folder/collectors/ves/target/VESCollector-1.1.0-SNAPSHOT.jar
+
+ asserts_file_exist $dcae_src_folder/controller/analytics/dcae-analytics-cdap-common-model/target/dcae-analytics-cdap-common-model-1.1.0-SNAPSHOT.jar
+
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-core/dcae-controller-core-model/target/dcae-controller-core-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-core/dcae-controller-core-utils/target/dcae-controller-core-utils-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-core/dcae-controller-operation-utils/target/dcae-controller-operation-utils-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-core/dcae-controller-platform-model/target/dcae-controller-platform-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-core/dcae-controller-platform-server/target/dcae-controller-platform-server-1.1.0-SNAPSHOT.jar
+
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service/dcae-controller-service-dmaap-drsub/dcae-controller-service-dmaap-drsub-manager/target/dcae-controller-service-dmaap-drsub-manager-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service/dcae-controller-service-dmaap-drsub/dcae-controller-service-dmaap-drsub-model/target/dcae-controller-service-dmaap-drsub-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service/dcae-controller-service-standardeventcollector/dcae-controller-service-standardeventcollector-manager/target/dcae-controller-service-standardeventcollector-manager-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service/dcae-controller-service-standardeventcollector/dcae-controller-service-standardeventcollector-model/target/dcae-controller-service-standardeventcollector-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service/dcae-controller-service-storage-postgres-model/target/dcae-controller-service-storage-postgres-model-1.1.0-SNAPSHOT.jar
+
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/target/dcae-controller-service-cdap-adaptor-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/target/dcae-controller-service-cdap-cluster-manager-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-model/target/dcae-controller-service-cdap-cluster-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-cdap/dcae-controller-service-cdap-model/target/dcae-controller-service-cdap-model-1.1.0-SNAPSHOT.jar
+
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-docker/dcae-controller-service-common-docker/dcae-controller-service-common-docker-manager/target/dcae-controller-service-common-docker-manager-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-docker/dcae-controller-service-common-docker/dcae-controller-service-common-docker-model/target/dcae-controller-service-common-docker-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-docker/dcae-controller-service-docker-adaptor/target/dcae-controller-service-docker-adaptor-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-docker/dcae-controller-service-docker-host/dcae-controller-service-docker-host-manager/target/dcae-controller-service-docker-host-manager-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-docker/dcae-controller-service-docker-host/dcae-controller-service-docker-host-model/target/dcae-controller-service-docker-host-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-docker/dcae-controller-service-docker-model/target/dcae-controller-service-docker-model-1.1.0-SNAPSHOT.jar
+
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-vm/dcae-controller-service-common-vm/dcae-controller-service-common-vm-manager/target/dcae-controller-service-common-vm-manager-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-vm/dcae-controller-service-common-vm/dcae-controller-service-common-vm-model/target/dcae-controller-service-common-vm-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-vm/dcae-controller-service-vm-adaptor/target/dcae-controller-service-vm-adaptor-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $dcae_src_folder/controller/dcae-controller-service-vm/dcae-controller-service-vm-model/target/dcae-controller-service-vm-model-1.1.0-SNAPSHOT.jar
+
+ asserts_file_exist $dcae_src_folder/dcae-inventory/target/dcae-inventory-1.1.0.jar
+
+ asserts_file_exist $dcae_src_folder/demo/dcae-demo-controller/target/dcae-demo-controller-1.1.0-SNAPSHOT-runtime.zip
+
+ asserts_file_exist $dcae_src_folder/dmaapbc/target/dcae_dmaapbc.jar
+
+ asserts_file_exist $dcae_src_folder/operation/utils/operation-utils/target/operation-utils-1.1.0-SNAPSHOT.jar
+}
+
+# test_get_dcae_images() - Function that verifies DCAE images are retrieved properly
+function test_get_dcae_images {
+ clone_all_dcae_repos
+ compile_all_dcae_repos
+ get_dcae_images
+
+ asserts_image openecomp/dcae-dmaapbc
+ #asserts_image dcae/orch-dispatcher
+ asserts_image dcae-controller
+ asserts_image dcae-inventory
+}
+
+# test_install_dcae() - Function that verifies that DCAE services are up and running
+function test_install_dcae {
+ clone_all_dcae_repos
+ compile_all_dcae_repos
+ get_dcae_images
+ install_dcae
+
+ dcae_image=`docker images | grep dcae-controller | awk '{print $1 ":" $2}'`
+ asserts_image_running $dcae_image
+}
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"
diff --git a/bootstrap/vagrant-onap/tools/run.sh b/bootstrap/vagrant-onap/tools/run.sh
index cf31fe4c7..c606a0998 100755
--- a/bootstrap/vagrant-onap/tools/run.sh
+++ b/bootstrap/vagrant-onap/tools/run.sh
@@ -78,7 +78,7 @@ case $COMMAND in
export TEST_SUITE=$test_suite
export TEST_CASE=$test_case
- rm -rf ../opt/
+ rm -rf ./opt/
rm -rf ~/.m2/
;;
* )