From 5464664702bc07c180ed82eb1a5d9bcc9e5d18ec Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Fri, 8 Dec 2017 11:57:42 -0800 Subject: Centralize src_folder and repos info The configuration values that determines where the source code will be cloned and the list of repos associated to specific project have been included in a new global configuration file, which pretends to facilitate their changes. Change-Id: I700bfe02e6b2f8bf8eef763e44b5e037357ec892 Signed-off-by: Victor Morales Issue-ID: INT-367 --- bootstrap/vagrant-onap/lib/aai | 10 +--- bootstrap/vagrant-onap/lib/appc | 3 -- bootstrap/vagrant-onap/lib/ccsdk | 7 --- bootstrap/vagrant-onap/lib/config/env-vars | 77 ++++++++++++++++++++++++++++++ bootstrap/vagrant-onap/lib/dcae | 8 ---- bootstrap/vagrant-onap/lib/functions | 18 ++----- bootstrap/vagrant-onap/lib/mr | 2 - bootstrap/vagrant-onap/lib/msb | 3 -- bootstrap/vagrant-onap/lib/mso | 4 -- bootstrap/vagrant-onap/lib/multicloud | 5 +- bootstrap/vagrant-onap/lib/policy | 5 -- bootstrap/vagrant-onap/lib/portal | 15 +++--- bootstrap/vagrant-onap/lib/robot | 4 -- bootstrap/vagrant-onap/lib/sdc | 5 -- bootstrap/vagrant-onap/lib/sdnc | 6 +-- bootstrap/vagrant-onap/lib/vfc | 7 --- bootstrap/vagrant-onap/lib/vid | 3 -- bootstrap/vagrant-onap/lib/vnfsdk | 4 -- bootstrap/vagrant-onap/lib/vvp | 6 --- 19 files changed, 92 insertions(+), 100 deletions(-) create mode 100755 bootstrap/vagrant-onap/lib/config/env-vars (limited to 'bootstrap/vagrant-onap/lib') diff --git a/bootstrap/vagrant-onap/lib/aai b/bootstrap/vagrant-onap/lib/aai index a3e56725f..7a68fbbf4 100755 --- a/bootstrap/vagrant-onap/lib/aai +++ b/bootstrap/vagrant-onap/lib/aai @@ -3,12 +3,6 @@ source /var/onap/functions hbase_version=1.2.3 -aai_src_folder=$git_src_folder/aai -aai_repos=("aai/aai-common" "aai/aai-config" "aai/aai-data" "aai/aai-service" \ -"aai/babel" "aai/champ" "aai/data-router" "aai/esr-gui" "aai/esr-server" \ -"aai/gizmo" "aai/logging-service" "aai/model-loader" "aai/resources" \ -"aai/rest-client" "aai/router-core" "aai/search-data-service" \ -"aai/test-config" "aai/traversal" "aai/sparky-fe" "aai/sparky-be") # install_hadoop() - Function that installs Hadoop function install_hadoop { @@ -54,9 +48,9 @@ function install_haproxy { # compile_aai_repos() - Function that compiles AAI source repo. function compile_aai_repos { - local repos=("aai/aai-common" "aai/resources" "aai/logging-service" "aai/traversal") + local repos="aai/aai-common aai/resources aai/logging-service aai/traversal" if [[ "$compile_repo" == "True" ]]; then - repos=("${aai_repos[@]}") + repos="${repos[aai]}" fi for repo in ${repos[@]}; do diff --git a/bootstrap/vagrant-onap/lib/appc b/bootstrap/vagrant-onap/lib/appc index 14ba3cf96..ad01ca53e 100755 --- a/bootstrap/vagrant-onap/lib/appc +++ b/bootstrap/vagrant-onap/lib/appc @@ -3,9 +3,6 @@ source /var/onap/sdnc source /var/onap/functions -appc_src_folder=$git_src_folder/appc -appc_repos=("appc" "appc/deployment") - # _build_appc_images() - Function that creates APPC images from source code. function _build_appc_images { get_sdnc_images diff --git a/bootstrap/vagrant-onap/lib/ccsdk b/bootstrap/vagrant-onap/lib/ccsdk index 9f00e9ad2..112839c69 100755 --- a/bootstrap/vagrant-onap/lib/ccsdk +++ b/bootstrap/vagrant-onap/lib/ccsdk @@ -2,13 +2,6 @@ source /var/onap/functions -ccsdk_src_folder=$git_src_folder/ccsdk -ccsdk_repos=("ccsdk" "ccsdk/dashboard" "ccsdk/distribution" "ccsdk/parent" -"ccsdk/platform/blueprints" "ccsdk/platform/nbapi" "ccsdk/platform/plugins" -"ccsdk/sli" "ccsdk/sli/adaptors" "ccsdk/sli/core" "ccsdk/sli/northbound" -"ccsdk/sli/plugins" "ccsdk/storage" "ccsdk/storage/esaas" "ccsdk/storage/pgaas" -"ccsdk/utils") - # _build_ccsdk_images() - Build CCSDK Docker images from source code function _build_ccsdk_images { install_package unzip diff --git a/bootstrap/vagrant-onap/lib/config/env-vars b/bootstrap/vagrant-onap/lib/config/env-vars new file mode 100755 index 000000000..1eddf673e --- /dev/null +++ b/bootstrap/vagrant-onap/lib/config/env-vars @@ -0,0 +1,77 @@ +#!/bin/bash + +# Source code destination folder +git_src_folder=/opt + +declare -A src_folders +src_folders=( +["aai"]="$git_src_folder/aai" +["appc"]="$git_src_folder/appc" +["ccsdk"]="$git_src_folder/ccsdk" +["dcae"]="$git_src_folder/dcae" +["mr"]="$git_src_folder/dcae/message-router" +["msb"]="$git_src_folder/msb" +["mso"]="$git_src_folder/mso" +["multicloud"]="$git_src_folder/multicloud" +["policy"]="$git_src_folder/policy" +["portal"]="$git_src_folder/portal" +["robot"]="$git_src_folder/testsuite" +["sdc"]="$git_src_folder/sdc" +["sdnc"]="$git_src_folder/openecomp/sdnc" +["vfc"]="$git_src_folder/vfc" +["vid"]="$git_src_folder/vid" +["vnfsdk"]="$git_src_folder/vnfsdk" +["vvp"]="$git_src_folder/vvp" +) + +# Repositories list +declare -A repos +repos=( +["aai"]="aai/aai-common aai/aai-config aai/aai-data aai/aai-service \ +aai/babel aai/champ aai/data-router aai/esr-gui aai/esr-server aai/gizmo \ +aai/logging-service aai/model-loader aai/resources aai/rest-client \ +aai/router-core aai/search-data-service aai/test-config aai/traversal \ +aai/sparky-fe aai/sparky-be" +["appc"]="appc appc/deployment" +["ccsdk"]="ccsdk ccsdk/dashboard ccsdk/distribution ccsdk/parent \ +ccsdk/platform/blueprints ccsdk/platform/nbapi \ +ccsdk/platform/plugins ccsdk/sli ccsdk/sli/adaptors ccsdk/sli/core \ +ccsdk/sli/northbound ccsdk/sli/plugins ccsdk/storage \ +ccsdk/storage/esaas ccsdk/storage/pgaas ccsdk/utils" +["dcae"]="dcae dcae/apod dcae/apod/analytics dcae/apod/buildtools \ +dcae/apod/cdap dcae/collectors dcae/collectors/ves dcae/controller \ +dcae/controller/analytics dcae/dcae-inventory dcae/demo \ +dcae/demo/startup dcae/demo/startup/aaf dcae/demo/startup/controller \ +dcae/demo/startup/message-router dcae/dmaapbc dcae/operation \ +dcae/operation/utils dcae/orch-dispatcher dcae/pgaas dcae/utils \ +dcae/utils/buildtools" +["msb"]="msb/apigateway msb/discovery msb/java-sdk msb/swagger-sdk" +["mso"]="mso mso/chef-repo mso/docker-config mso/libs mso/mso-config" +["multicloud"]="multicloud multicloud/framework multicloud/openstack \ +multicloud/openstack/vmware multicloud/openstack/windriver \ +multicloud/azure" +["policy"]="policy/api policy/common policy/docker \ +policy/drools-applications policy/drools-pdp policy/engine \ +policy/gui policy/pap policy/pdp" +["portal"]="portal portal/sdk ecompsdkos ui/dmaapbc" +["robot"]="testsuite testsuite/heatbridge testsuite/properties \ +testsuite/python-testing-utils" +["sdc"]="sdc sdc/jtosca sdc/sdc-distribution-client \ +sdc/sdc-docker-base sdc/sdc-titan-cassandra sdc/sdc-tosca \ +sdc/sdc-vnfdesign sdc/sdc-workflow-designer sdc/sdc_common" +["sdnc"]="sdnc/adaptors sdnc/architecture sdnc/core sdnc/features \ +sdnc/northbound sdnc/oam sdnc/parent sdnc/plugins" +["vfc"]="vfc/gvnfm vfc/gvnfm/vnflcm vfc/gvnfm/vnfmgr \ +vfc/gvnfm/vnfres vfc/nfvo vfc/nfvo/catalog vfc/nfvo/driver \ +vfc/nfvo/driver/ems vfc/nfvo/driver/sfc vfc/nfvo/driver/vnfm \ +vfc/nfvo/driver/vnfm/gvnfm vfc/nfvo/driver/vnfm/svnfm vfc/nfvo/lcm \ +vfc/nfvo/resmanagement vfc/nfvo/wfengine" +["vid"]="vid vid/asdcclient" +["vnfsdk"]="vnfsdk/compliance vnfsdk/functest vnfsdk/lctest \ +vnfsdk/model vnfsdk/pkgtools vnfsdk/refrepo vnfsdk/validation" +["vvp"]="vvp/ansible-ice-bootstrap vvp/cms vvp/devkit \ +vvp/documentation vvp/engagementmgr vvp/gitlab vvp/image-scanner \ +vvp/jenkins vvp/portal vvp/postgresql vvp/test-engine \ +vvp/validation-scripts" +) + diff --git a/bootstrap/vagrant-onap/lib/dcae b/bootstrap/vagrant-onap/lib/dcae index 9150b37da..d6fdd89b2 100755 --- a/bootstrap/vagrant-onap/lib/dcae +++ b/bootstrap/vagrant-onap/lib/dcae @@ -2,14 +2,6 @@ source /var/onap/functions -dcae_src_folder=$git_src_folder/dcae -dcae_repos=("dcae" "dcae/apod" "dcae/apod/analytics" "dcae/apod/buildtools" -"dcae/apod/cdap" "dcae/collectors" "dcae/collectors/ves" "dcae/controller" -"dcae/controller/analytics" "dcae/dcae-inventory" "dcae/demo" -"dcae/demo/startup" "dcae/demo/startup/aaf" "dcae/demo/startup/controller" -"dcae/demo/startup/message-router" "dcae/dmaapbc" "dcae/operation" -"dcae/operation/utils" "dcae/orch-dispatcher" "dcae/pgaas" "dcae/utils" "dcae/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 diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions index 8d906dc68..08c6d916b 100755 --- a/bootstrap/vagrant-onap/lib/functions +++ b/bootstrap/vagrant-onap/lib/functions @@ -1,6 +1,7 @@ #!/bin/bash source /var/onap/commons +source /var/onap/config/env-vars source /var/onap/_composed_functions source /var/onap/_onap_functions @@ -9,7 +10,6 @@ export NIC=$(ip route get 8.8.8.8 | awk '{ print $5; exit }') export IP_ADDRESS=$(ifconfig $NIC | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) mvn_conf_file=/root/.m2/settings.xml -git_src_folder=/opt # configure_dns() - DNS/GW IP address configuration function configure_dns { @@ -71,13 +71,9 @@ function clone_repo { function clone_repos { local project=$1 local repo_name=${2:-$project} - local name=${project}_repos[@] - local src_name=${project}_src_folder - local repos_list=("${!name}") - local dest_folder=${!src_name} - for repo in ${repos_list[@]}; do - clone_repo $repo $dest_folder${repo#*$repo_name} + for repo in ${repos[$project]}; do + clone_repo $repo ${src_folders[$project]}${repo#*$repo_name} done } @@ -305,13 +301,9 @@ function compile_src { # compile_repos() - Function that compiles source repositories for a given project function compile_repos { local project=$1 - local name=${project}_repos[@] - local repos_list=("${!name}") - local dest_folder=${3:-$git_src_folder/$project} - install_package unzip - for repo in ${repos_list[@]}; do - compile_src $dest_folder${repo#*$project} + for repo in ${repos[$project]}; do + compile_src ${src_folders[$project]}${repo#*$project} done } diff --git a/bootstrap/vagrant-onap/lib/mr b/bootstrap/vagrant-onap/lib/mr index 2ffe69e26..499f53f6a 100755 --- a/bootstrap/vagrant-onap/lib/mr +++ b/bootstrap/vagrant-onap/lib/mr @@ -2,8 +2,6 @@ source /var/onap/functions -mr_src_folder=$git_src_folder/dcae/message-router - # get_mr_images() - Function that retrieves the Message Router Docker images function get_mr_images { pull_docker_image attos/dmaap diff --git a/bootstrap/vagrant-onap/lib/msb b/bootstrap/vagrant-onap/lib/msb index 262b29c0e..a14e8ea6c 100755 --- a/bootstrap/vagrant-onap/lib/msb +++ b/bootstrap/vagrant-onap/lib/msb @@ -2,9 +2,6 @@ source /var/onap/functions -msb_src_folder=$git_src_folder/msb -msb_repos=("msb/apigateway" "msb/discovery" "msb/java-sdk" "msb/swagger-sdk") - # _build_msb_images() - Function that creates Microservices Docker images from source code function _build_msb_images { if [[ "$compile_repo" != "True" ]]; then diff --git a/bootstrap/vagrant-onap/lib/mso b/bootstrap/vagrant-onap/lib/mso index e99bff912..44d4a7b04 100755 --- a/bootstrap/vagrant-onap/lib/mso +++ b/bootstrap/vagrant-onap/lib/mso @@ -2,10 +2,6 @@ source /var/onap/functions -mso_src_folder=$git_src_folder/mso -mso_repos=("mso" "mso/chef-repo" "mso/docker-config" "mso/libs" -"mso/mso-config") - # get_mso_images() - Function that retrieves or create MSO Docker images function get_mso_images { if [[ "$build_image" == "True" ]]; then diff --git a/bootstrap/vagrant-onap/lib/multicloud b/bootstrap/vagrant-onap/lib/multicloud index 4031956e4..377d4dcd7 100755 --- a/bootstrap/vagrant-onap/lib/multicloud +++ b/bootstrap/vagrant-onap/lib/multicloud @@ -2,12 +2,9 @@ source /var/onap/functions -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" +# _build_images() - Function that builds docker images from source code function _build_images { install_docker install_python_requirements $multicloud_src_folder/openstack/$openstack_release diff --git a/bootstrap/vagrant-onap/lib/policy b/bootstrap/vagrant-onap/lib/policy index 05ad32094..ad982ad95 100755 --- a/bootstrap/vagrant-onap/lib/policy +++ b/bootstrap/vagrant-onap/lib/policy @@ -2,11 +2,6 @@ source /var/onap/functions -policy_src_folder=$git_src_folder/policy -policy_repos=("policy/api" "policy/common" "policy/docker" \ -"policy/drools-applications" "policy/drools-pdp" "policy/engine" \ -"policy/gui" "policy/pap" "policy/pdp") - # _build_policy_images() - Function that build Policy docker images from source code function _build_policy_images { compile_src $policy_src_folder/docker diff --git a/bootstrap/vagrant-onap/lib/portal b/bootstrap/vagrant-onap/lib/portal index 915ccd59a..fe5469822 100755 --- a/bootstrap/vagrant-onap/lib/portal +++ b/bootstrap/vagrant-onap/lib/portal @@ -2,30 +2,27 @@ source /var/onap/functions -portal_src_folder=$git_src_folder/portal -portal_repos=("portal" "portal/sdk" "ecompsdkos" "ui/dmaapbc") - # clone_all_portal_repos() - Function that clones Portal source repo. function clone_all_portal_repos { - for repo in ${portal_repos[@]}; do + for repo in ${repos[portal]}; do if [[ "$repo" == "ui/dmaapbc" ]];then prefix="ui" else prefix="portal" fi - clone_repo $repo $portal_src_folder/${repo#*$prefix} + clone_repo $repo ${src_folders[portal]}/${repo#*$prefix} done } # compile_all_portal_repos() - Function that compiles Portal source repo. function compile_all_portal_repos { - for repo in ${portal_repos[@]}; do + for repo in ${repos[portal]}; do if [[ "$repo" == "ui/dmaapbc" ]];then prefix="ui" else prefix="portal" fi - compile_src $portal_src_folder/${repo#*$prefix} + compile_src ${src_folders[portal]}/${repo#*$prefix} done } @@ -33,7 +30,7 @@ function compile_all_portal_repos { function _build_portal_images { install_maven - pushd $portal_src_folder/deliveries + pushd ${src_folders[portal]}/deliveries chmod +x *.sh export MVN=$(which mvn) export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml @@ -64,7 +61,7 @@ function install_portal { docker rm -f ecompdb_portal docker rm -f 1610-1 - pushd $portal_src_folder/deliveries + pushd ${src_folders[portal]}/deliveries mkdir -p /PROJECT/OpenSource/UbuntuEP/logs install_package unzip unzip -o etc.zip -d /PROJECT/OpenSource/UbuntuEP/ diff --git a/bootstrap/vagrant-onap/lib/robot b/bootstrap/vagrant-onap/lib/robot index 588da6c1e..90fbcf8c0 100755 --- a/bootstrap/vagrant-onap/lib/robot +++ b/bootstrap/vagrant-onap/lib/robot @@ -2,10 +2,6 @@ source /var/onap/functions -robot_src_folder=$git_src_folder/testsuite -robot_repos=("testsuite" "testsuite/heatbridge" "testsuite/properties" \ -"testsuite/python-testing-utils") - # _setup_ete_folder() - Create and copy ete folder structure function _setup_ete_folder { mkdir -p /opt/eteshare/config diff --git a/bootstrap/vagrant-onap/lib/sdc b/bootstrap/vagrant-onap/lib/sdc index f99e8b204..9b0a69ee4 100755 --- a/bootstrap/vagrant-onap/lib/sdc +++ b/bootstrap/vagrant-onap/lib/sdc @@ -2,11 +2,6 @@ source /var/onap/functions -sdc_src_folder=$git_src_folder/sdc -sdc_repos=("sdc" "sdc/jtosca" "sdc/sdc-distribution-client" -"sdc/sdc-docker-base" "sdc/sdc-titan-cassandra" "sdc/sdc-tosca" -"sdc/sdc-vnfdesign" "sdc/sdc-workflow-designer" "sdc/sdc_common") - # _mount_external_partition() - Create partition and mount the external volume function _mount_external_partition { cat < /tmp/sdc_ext_volume_partitions.txt diff --git a/bootstrap/vagrant-onap/lib/sdnc b/bootstrap/vagrant-onap/lib/sdnc index 05165b18b..a8cf756b4 100755 --- a/bootstrap/vagrant-onap/lib/sdnc +++ b/bootstrap/vagrant-onap/lib/sdnc @@ -3,13 +3,9 @@ source /var/onap/functions source /var/onap/ccsdk -sdnc_src_folder=$git_src_folder/openecomp/sdnc -sdnc_repos=("sdnc/adaptors" "sdnc/architecture" "sdnc/core" "sdnc/features" \ -"sdnc/northbound" "sdnc/oam" "sdnc/parent" "sdnc/plugins") - # compile_all_sdnc_repos() - Function that compiles SDNC source repo. function compile_all_sdnc_repos { - for repo in ${sdnc_repos[@]}; do + for repo in ${repos[sdnc]}; do if [[ "$repo" == "sdnc/core" ]]; then compile_src $sdnc_src_folder/core/rootpom fi diff --git a/bootstrap/vagrant-onap/lib/vfc b/bootstrap/vagrant-onap/lib/vfc index 112f9a555..2b5407ca3 100755 --- a/bootstrap/vagrant-onap/lib/vfc +++ b/bootstrap/vagrant-onap/lib/vfc @@ -2,13 +2,6 @@ source /var/onap/functions -vfc_src_folder=$git_src_folder/vfc -vfc_repos=("vfc/gvnfm" "vfc/gvnfm/vnflcm" "vfc/gvnfm/vnfmgr" \ -"vfc/gvnfm/vnfres" "vfc/nfvo" "vfc/nfvo/catalog" "vfc/nfvo/driver" \ -"vfc/nfvo/driver/ems" "vfc/nfvo/driver/sfc" "vfc/nfvo/driver/vnfm" \ -"vfc/nfvo/driver/vnfm/gvnfm" "vfc/nfvo/driver/vnfm/svnfm" "vfc/nfvo/lcm" \ -"vfc/nfvo/resmanagement" "vfc/nfvo/wfengine") - # compile_all_vfc_repos() - Function that compiles VF-C source repo. function compile_all_vfc_repos { install_python_package tox diff --git a/bootstrap/vagrant-onap/lib/vid b/bootstrap/vagrant-onap/lib/vid index f253fdb59..f5ca9d293 100755 --- a/bootstrap/vagrant-onap/lib/vid +++ b/bootstrap/vagrant-onap/lib/vid @@ -2,9 +2,6 @@ source /var/onap/functions -vid_src_folder=$git_src_folder/vid -vid_repos=("vid" "vid/asdcclient") - # _build_vid_images() - Function that builds VID docker images function _build_vid_images { if [[ "$compile_repo" != "True" ]]; then diff --git a/bootstrap/vagrant-onap/lib/vnfsdk b/bootstrap/vagrant-onap/lib/vnfsdk index 020d437da..58e3a9aa2 100755 --- a/bootstrap/vagrant-onap/lib/vnfsdk +++ b/bootstrap/vagrant-onap/lib/vnfsdk @@ -2,10 +2,6 @@ source /var/onap/functions -vnfsdk_src_folder=$git_src_folder/vnfsdk -vnfsdk_repos=("vnfsdk/compliance" "vnfsdk/functest" "vnfsdk/lctest" \ -"vnfsdk/model" "vnfsdk/pkgtools" "vnfsdk/refrepo" "vnfsdk/validation") - # _build_vnfsdk_images() - Builds VNFSDK images from source code function _build_vnfsdk_images { install_package unzip diff --git a/bootstrap/vagrant-onap/lib/vvp b/bootstrap/vagrant-onap/lib/vvp index a924e7a80..f24431ee6 100755 --- a/bootstrap/vagrant-onap/lib/vvp +++ b/bootstrap/vagrant-onap/lib/vvp @@ -2,12 +2,6 @@ source /var/onap/functions -vvp_src_folder=$git_src_folder/vvp -vvp_repos=("vvp/ansible-ice-bootstrap" "vvp/cms" "vvp/devkit" \ -"vvp/documentation" "vvp/engagementmgr" "vvp/gitlab" "vvp/image-scanner" \ -"vvp/jenkins" "vvp/portal" "vvp/postgresql" "vvp/test-engine" \ -"vvp/validation-scripts") - # _build_vvp_images() - Builds VNFSDK images from source code function _build_vvp_images { echo "pass" -- cgit 1.2.3-korg