diff options
-rw-r--r-- | bootstrap/vagrant-onap/README.md | 2 | ||||
-rw-r--r-- | bootstrap/vagrant-onap/doc/source/features/consuming_scripts.rst | 91 | ||||
-rw-r--r-- | bootstrap/vagrant-onap/doc/source/features/features.rst | 1 | ||||
-rwxr-xr-x | bootstrap/vagrant-onap/lib/_onap_functions | 1 | ||||
-rwxr-xr-x | bootstrap/vagrant-onap/lib/aai | 2 | ||||
-rwxr-xr-x | test/csit/plans/clamp/TCA/setup.sh | 31 | ||||
-rwxr-xr-x | test/csit/plans/clamp/TCA/teardown.sh | 3 | ||||
-rwxr-xr-x | test/csit/plans/clamp/UIs/setup.sh | 31 | ||||
-rwxr-xr-x | test/csit/plans/clamp/UIs/teardown.sh | 3 | ||||
-rwxr-xr-x | test/csit/scripts/clamp/clone_clamp_and_change_dockercompose.sh | 35 | ||||
-rwxr-xr-x | test/csit/scripts/clamp/kill_and_remove_clamp_and_db_containers.sh (renamed from test/csit/scripts/clamp/script1.sh) | 7 | ||||
-rwxr-xr-x | test/csit/scripts/clamp/start_clamp_containers.sh | 50 |
12 files changed, 192 insertions, 65 deletions
diff --git a/bootstrap/vagrant-onap/README.md b/bootstrap/vagrant-onap/README.md index cab72c5e9..9e7054c66 100644 --- a/bootstrap/vagrant-onap/README.md +++ b/bootstrap/vagrant-onap/README.md @@ -69,7 +69,7 @@ tool. This results in the creation of a new *doc/build/html* folder with the documentation converted in HTML pages that can be viewed through -the prefered Web Browser. +the preferred Web Browser. ## Contributing diff --git a/bootstrap/vagrant-onap/doc/source/features/consuming_scripts.rst b/bootstrap/vagrant-onap/doc/source/features/consuming_scripts.rst new file mode 100644 index 000000000..dd4f14ba7 --- /dev/null +++ b/bootstrap/vagrant-onap/doc/source/features/consuming_scripts.rst @@ -0,0 +1,91 @@ +============================== +Using the provisioning scripts +============================== + +Vagrant is a platform that uses prebaked images called +*vagrant boxes* to guarranty that running multiple times a +provisioning script will result in an expected output. This +mechanism is crucial for reducing the number of external factors +during the creation, development and testing of provisioning scripts. +However, it's possible to provide an ONAP development enviroment +without having to install Vagrant tool. This document explains how to +consume the provisioning scripts localed in **./lib** folder to +provision a development environment and the environment variables +that modifies their behavior. + +This project was built on an Ubuntu 14.04 ("Trusty") Operating System, +therefore it's necessary to have an user who has *sudo* permissions to +access to a Bare Metal or Virtual Machine. + +The following instructions retrieve the provisioning scripts and place +them into the */var/onap/* folder. + +.. code-block:: console + + $ sudo su - + # apt-get install git -y + # git clone https://git.onap.org/integration + # mv integration/bootstrap/vagrant-onap/lib/ /var/onap/ + +.. end + +Loading a provisioning script will be based on the desired ONAP +service, for example to setup the development environment for Active +and Available Inventory (AAI) service will be required to load the +*/var/onap/aai* script. + +.. note:: + + The **git_src_folder** environment variable specifies the + source code destination folder, it's default value is */opt/* + but it can be changed only after is loaded the provisioning + scripts. + +.. end + +.. code-block:: console + + # source /var/onap/aai + +.. end + +Lastly, every script has defined a initialization function with +*init_* as prefix. This function is the starting point to provision +the chosen ONAP service. This example uses the *init_aai* function +to provision a AAI Developement environment. + +.. note:: + + The **compile_repo** environment variable defines whether or not + the source code located on the repositories of the service. + Enabling this value can impact the provisioning time of the + service. + +.. end +.. note:: + + **nexus_docker_repo**, **nexus_username** and **nexus_password** + environment variables specify the connectivity to a private Docker + Hub. + +.. end +.. note:: + + **build_image** environment variable allows the Docker images + from source code. Enabling this value can impact the + provisioning time of the service. + +.. end + +.. code-block:: console + + # export nexus_docker_repo="nexus3.onap.org:10001" + # export nexus_username="docker" + # export nexus_password="docker" + # init_aai + +.. end + +As result, the source code is pulled into */opt/aai/* folder and the +AAI services are up and running with the proper connection to the +Titan Distributed Graph Database. diff --git a/bootstrap/vagrant-onap/doc/source/features/features.rst b/bootstrap/vagrant-onap/doc/source/features/features.rst index 0b06ba04c..949969828 100644 --- a/bootstrap/vagrant-onap/doc/source/features/features.rst +++ b/bootstrap/vagrant-onap/doc/source/features/features.rst @@ -8,6 +8,7 @@ Advanced features :maxdepth: 1 openstack.rst + consuming_scripts.rst This chapter explains how to use ONAP on Vagrant Advanced features like different providers. diff --git a/bootstrap/vagrant-onap/lib/_onap_functions b/bootstrap/vagrant-onap/lib/_onap_functions index 12ac1768b..9e06010ed 100755 --- a/bootstrap/vagrant-onap/lib/_onap_functions +++ b/bootstrap/vagrant-onap/lib/_onap_functions @@ -66,6 +66,7 @@ function _configure_maven { fi fi + mkdir -p $(dirname $mvn_conf_file) if [ ! -f $mvn_conf_file ]; then if [[ "$enable_oparent" == "True" ]]; then clone_repo oparent diff --git a/bootstrap/vagrant-onap/lib/aai b/bootstrap/vagrant-onap/lib/aai index faf916d9b..2b7f98106 100755 --- a/bootstrap/vagrant-onap/lib/aai +++ b/bootstrap/vagrant-onap/lib/aai @@ -183,7 +183,7 @@ function init_aai { compile_aai_repos setup_titan - start_aai_microservices + #start_aai_microservices mkdir -p /opt/openecomp/aai/logs mkdir -p /opt/openecomp/aai/data diff --git a/test/csit/plans/clamp/TCA/setup.sh b/test/csit/plans/clamp/TCA/setup.sh index 6398827bc..bb7a81447 100755 --- a/test/csit/plans/clamp/TCA/setup.sh +++ b/test/csit/plans/clamp/TCA/setup.sh @@ -17,37 +17,10 @@ # Modifications copyright (c) 2017 AT&T Intellectual Property # # Place the scripts in run order: -source ${WORKSPACE}/test/csit/scripts/clamp/script1.sh -# Clone Clamp repo to get extra folder that has all needed to run docker with docker-compose to start DB and Clamp -mkdir -p $WORKSPACE/archives/clamp-clone -cd $WORKSPACE/archives/clamp-clone -git clone --depth 1 http://gerrit.onap.org/r/clamp -b master -cd clamp/extra/docker/clamp/ +source ${WORKSPACE}/test/csit/scripts/clamp/clone_clamp_and_change_dockercompose.sh -# start Clamp and MariaDB containers with docker compose and configuration from clamp/extra/docker/clamp/docker-compose.yml -docker-compose up -d - -# WAIT 5 minutes maximum and test every 5 seconds if Clamp up using HealthCheck API -TIME_OUT=300 -INTERVAL=5 -TIME=0 -while [ "$TIME" -lt "$TIME_OUT" ]; do - response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8080/restservices/clds/v1/clds/healthcheck); echo $response - - if [ "$response" == "200" ]; then - echo Clamp and its database well started in $TIME seconds - break; - fi - - echo Sleep: $INTERVAL seconds before testing if Clamp is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds - sleep $INTERVAL - TIME=$(($TIME+$INTERVAL)) -done - -if [ "$TIME" -ge "$TIME_OUT" ]; then - echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests... -fi +source ${WORKSPACE}/test/csit/scripts/clamp/start_clamp_containers.sh # Pass any variables required by Robot test suites in ROBOT_VARIABLES #ROBOT_VARIABLES="-v TEST:${TEST}" diff --git a/test/csit/plans/clamp/TCA/teardown.sh b/test/csit/plans/clamp/TCA/teardown.sh index 1d1e2186e..07067e60e 100755 --- a/test/csit/plans/clamp/TCA/teardown.sh +++ b/test/csit/plans/clamp/TCA/teardown.sh @@ -17,7 +17,6 @@ # Modifications copyright (c) 2017 AT&T Intellectual Property # -kill-instance.sh clamp_clamp_1 -kill-instance.sh clamp_db_1 +source ${WORKSPACE}/test/csit/scripts/clamp/kill_and_remove_clamp_and_db_containers.sh # $WORKSPACE/archives/clamp-clone deleted with archives folder when tests starts so we keep it at the end for debugging diff --git a/test/csit/plans/clamp/UIs/setup.sh b/test/csit/plans/clamp/UIs/setup.sh index 6398827bc..bb7a81447 100755 --- a/test/csit/plans/clamp/UIs/setup.sh +++ b/test/csit/plans/clamp/UIs/setup.sh @@ -17,37 +17,10 @@ # Modifications copyright (c) 2017 AT&T Intellectual Property # # Place the scripts in run order: -source ${WORKSPACE}/test/csit/scripts/clamp/script1.sh -# Clone Clamp repo to get extra folder that has all needed to run docker with docker-compose to start DB and Clamp -mkdir -p $WORKSPACE/archives/clamp-clone -cd $WORKSPACE/archives/clamp-clone -git clone --depth 1 http://gerrit.onap.org/r/clamp -b master -cd clamp/extra/docker/clamp/ +source ${WORKSPACE}/test/csit/scripts/clamp/clone_clamp_and_change_dockercompose.sh -# start Clamp and MariaDB containers with docker compose and configuration from clamp/extra/docker/clamp/docker-compose.yml -docker-compose up -d - -# WAIT 5 minutes maximum and test every 5 seconds if Clamp up using HealthCheck API -TIME_OUT=300 -INTERVAL=5 -TIME=0 -while [ "$TIME" -lt "$TIME_OUT" ]; do - response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8080/restservices/clds/v1/clds/healthcheck); echo $response - - if [ "$response" == "200" ]; then - echo Clamp and its database well started in $TIME seconds - break; - fi - - echo Sleep: $INTERVAL seconds before testing if Clamp is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds - sleep $INTERVAL - TIME=$(($TIME+$INTERVAL)) -done - -if [ "$TIME" -ge "$TIME_OUT" ]; then - echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests... -fi +source ${WORKSPACE}/test/csit/scripts/clamp/start_clamp_containers.sh # Pass any variables required by Robot test suites in ROBOT_VARIABLES #ROBOT_VARIABLES="-v TEST:${TEST}" diff --git a/test/csit/plans/clamp/UIs/teardown.sh b/test/csit/plans/clamp/UIs/teardown.sh index 1d1e2186e..07067e60e 100755 --- a/test/csit/plans/clamp/UIs/teardown.sh +++ b/test/csit/plans/clamp/UIs/teardown.sh @@ -17,7 +17,6 @@ # Modifications copyright (c) 2017 AT&T Intellectual Property # -kill-instance.sh clamp_clamp_1 -kill-instance.sh clamp_db_1 +source ${WORKSPACE}/test/csit/scripts/clamp/kill_and_remove_clamp_and_db_containers.sh # $WORKSPACE/archives/clamp-clone deleted with archives folder when tests starts so we keep it at the end for debugging diff --git a/test/csit/scripts/clamp/clone_clamp_and_change_dockercompose.sh b/test/csit/scripts/clamp/clone_clamp_and_change_dockercompose.sh new file mode 100755 index 000000000..f3b080ea1 --- /dev/null +++ b/test/csit/scripts/clamp/clone_clamp_and_change_dockercompose.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# ONAP CLAMP +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END============================================ +# =================================================================== +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# + +echo "This is ${WORKSPACE}/test/csit/scripts/clamp/clone_clamp_and_change_dockercompose.sh" + +# Clone Clamp repo to get extra folder that has all needed to run docker with docker-compose to start DB and Clamp +mkdir -p $WORKSPACE/archives/clamp-clone +cd $WORKSPACE/archives/clamp-clone +git clone --depth 1 http://gerrit.onap.org/r/clamp -b master +cd clamp/extra/docker/clamp/ + +# Pull the Clamp docker image from nexus instead of local image by default in the docker-compose.yml +sed -i '/image: onap\/clamp/c\ image: nexus3.onap.org:10001\/onap\/clamp' docker-compose.yml + diff --git a/test/csit/scripts/clamp/script1.sh b/test/csit/scripts/clamp/kill_and_remove_clamp_and_db_containers.sh index 213a316c1..c51464300 100755 --- a/test/csit/scripts/clamp/script1.sh +++ b/test/csit/scripts/clamp/kill_and_remove_clamp_and_db_containers.sh @@ -17,4 +17,9 @@ # Modifications copyright (c) 2017 AT&T Intellectual Property # -echo "This is ${WORKSPACE}/test/csit/scripts/clamp/script1.sh" +echo "This is ${WORKSPACE}/test/csit/scripts/clamp/kill_and_remove_clamp_and_db_containers.sh" + +kill-instance.sh clamp_clamp_1 +kill-instance.sh clamp_db_1 + +# $WORKSPACE/archives/clamp-clone deleted with archives folder when tests starts so we keep it at the end for debugging diff --git a/test/csit/scripts/clamp/start_clamp_containers.sh b/test/csit/scripts/clamp/start_clamp_containers.sh new file mode 100755 index 000000000..143012f30 --- /dev/null +++ b/test/csit/scripts/clamp/start_clamp_containers.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# ONAP CLAMP +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END============================================ +# =================================================================== +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# + +echo "This is ${WORKSPACE}/test/csit/scripts/clamp/start_clamp_containers.sh" + +# start Clamp and MariaDB containers with docker compose and configuration from clamp/extra/docker/clamp/docker-compose.yml +docker-compose up -d + +# WAIT 5 minutes maximum and test every 5 seconds if Clamp up using HealthCheck API +TIME_OUT=300 +INTERVAL=5 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8080/restservices/clds/v1/clds/healthcheck); echo $response + + if [ "$response" == "200" ]; then + echo Clamp and its database well started in $TIME seconds + break; + fi + + echo Sleep: $INTERVAL seconds before testing if Clamp is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + sleep $INTERVAL + TIME=$(($TIME+$INTERVAL)) +done + +if [ "$TIME" -ge "$TIME_OUT" ]; then + echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests... +fi + |