aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-11-16 20:34:41 +0000
committerGerrit Code Review <gerrit@onap.org>2017-11-16 20:34:41 +0000
commiteb3849ef8a5377e09aba704baee738222bb649bb (patch)
tree3770b1504f801254c033185ba3fcf66858230195
parent218d6a41c1c3a2e24f6c3ae73ccc6497f35c1437 (diff)
parent88d193e157c75cc544b92401aaac5ce6caaa3d8a (diff)
Merge "Implement steps for Multicloud Images"
-rwxr-xr-xbootstrap/vagrant-onap/lib/functions12
-rwxr-xr-xbootstrap/vagrant-onap/lib/multicloud19
-rwxr-xr-xbootstrap/vagrant-onap/tests/asserts12
-rw-r--r--bootstrap/vagrant-onap/tests/test_multicloud5
4 files changed, 45 insertions, 3 deletions
diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions
index 25fbba3e9..c4ed3c85f 100755
--- a/bootstrap/vagrant-onap/lib/functions
+++ b/bootstrap/vagrant-onap/lib/functions
@@ -178,7 +178,7 @@ function _install_pip {
fi
}
-# install_python_package() - Install a python module
+# install_python_package() - Install python modules
function install_python_package {
local python_packages=$@
@@ -186,6 +186,16 @@ function install_python_package {
pip install $python_packages
}
+# install_python_requirements() - Install a list of python modules defined in requirement.txt file
+function install_python_requirements {
+ local python_project_path=$1
+
+ _install_pip
+ pushd $python_project_path
+ pip install -r requirements.txt
+ popd
+}
+
# install_docker() - Download and install docker-engine
function install_docker {
if is_package_installed docker-ce; then
diff --git a/bootstrap/vagrant-onap/lib/multicloud b/bootstrap/vagrant-onap/lib/multicloud
index 05195877b..2f9e5d8d8 100755
--- a/bootstrap/vagrant-onap/lib/multicloud
+++ b/bootstrap/vagrant-onap/lib/multicloud
@@ -6,6 +6,7 @@ multicloud_src_folder=$git_src_folder/multicloud
multicloud_repos=("multicloud" "multicloud/framework" "multicloud/openstack" \
"multicloud/openstack/vmware" "multicloud/openstack/windriver" \
"multicloud/azure")
+openstack_release="newton"
# clone_multicloud_repos() - Function that clones the Multi Cloud repositories
function clone_multicloud_repos {
@@ -21,14 +22,28 @@ function compile_multicloud_repos {
done
}
+function _build_images {
+ install_docker
+ install_python_requirements $multicloud_src_folder/openstack/$openstack_release
+ pushd $multicloud_src_folder/openstack/$openstack_release
+ bash build_image.sh
+ popd
+}
+
# get_multicloud_images() -
function get_multicloud_images {
- echo "pass"
+ if [[ "$build_image" == "True" ]]; then
+ _build_images
+ else
+ pull_onap_image multicloud/openstack-$openstack_release
+ fi
}
# install_multicloud() -
function install_multicloud {
- echo "pass"
+ pushd $multicloud_src_folder/openstack/$openstack_release
+ /opt/docker/docker-compose up -d
+ popd
}
# init_multicloud() - Function that initialize Multi Cloud services
diff --git a/bootstrap/vagrant-onap/tests/asserts b/bootstrap/vagrant-onap/tests/asserts
index 52f0bce92..0fc8d38a1 100755
--- a/bootstrap/vagrant-onap/tests/asserts
+++ b/bootstrap/vagrant-onap/tests/asserts
@@ -2,6 +2,18 @@
source /var/onap/commons
+# asserts_http_status_code() - Function that determines if a HTTP status code is retrieved from URL
+function asserts_http_status_code {
+ local url=$1
+ local expected_code=${2:-"200"}
+
+ code=$(curl -I $url | head -n 1 | cut -d$' ' -f2)
+ local error_msg=${3:-"The URL $url responded with $code status code"}
+ if [[ "$code" == "$expected_code" ]]; then
+ raise_error $error_msg
+ fi
+}
+
# asserts_process() - Function that verifies if a specific process is running
function asserts_process {
local process=$1
diff --git a/bootstrap/vagrant-onap/tests/test_multicloud b/bootstrap/vagrant-onap/tests/test_multicloud
index b0b674894..62a010ad0 100644
--- a/bootstrap/vagrant-onap/tests/test_multicloud
+++ b/bootstrap/vagrant-onap/tests/test_multicloud
@@ -33,6 +33,8 @@ function test_compile_multicloud_repos {
function test_get_multicloud_images {
clone_multicloud_repos
get_multicloud_images
+
+ asserts_image onap/multicloud/openstack-$openstack_release
}
# test_install_multicloud() - Verify the built and start of Multi Cloud services
@@ -40,6 +42,9 @@ function test_install_multicloud {
clone_multicloud_repos
get_multicloud_images
install_multicloud
+
+ # NOTE(electrocucaracha): Depends on https://gerrit.onap.org/r/#/c/23631/
+ asserts_http_status_code http://127.0.0.1:9003/api/multicloud-$openstack_release/v0/swagger.json
}
if [ "$1" != '*' ]; then