#!/bin/bash source /var/onap/functions # 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" if [[ "$compile_repo" == "True" ]]; then repos="${repos[aai]}" fi for repo in ${repos[@]}; do compile_src ${src_folders[aai]}${repo#*aai} done } # setup_titan() - Function that configures AAI services to connect to Hadoop Titan function setup_titan { local subdirectory="bundleconfig-local/etc/appprops" install_python_package crudini for dirc in resources/aai-resources traversal/aai-traversal; do for file in titan-cached.properties titan-realtime.properties; do crudini --set "${src_folders[aai]}/$dirc/$subdirectory/$file" "" "storage.backend" "cassandra" crudini --set "${src_folders[aai]}/$dirc/$subdirectory/$file" "" "storage.hostname" "localhost" done done # Add the schema to the local instance compile_src ${src_folders[aai]}/resources/aai-resources/ uninstall_packages default-jre openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless pushd ${src_folders[aai]} java -DAJSC_HOME=${src_folders[aai]}/resources/aai-resources -DBUNDLECONFIG_DIR="bundleconfig-local" -cp aai-common/aai-core/target/aai-core-*.jar:resources/aai-resources/target/aai-resources.jar:resources/aai-resources/target/userjars/* org.onap.aai.dbgen.GenTester popd } # _start_data_managment() - Funtion that start a data management service function _start_data_managment { local service=$1 local debug_port=$2 install_maven pushd ${src_folders[aai]}/$service export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$debug_port,server=y,suspend=n" mvn -P runAjsc & popd } # start_aai_microservices() - Function that starts AAI microservices function start_aai_microservices { _start_data_managment resources 9446 sleep 360 _start_data_managment traversal 9447 } # install_aai() - Install AAI Services function install_aai { install_docker_compose pushd ${src_folders[aai]}/test-config ./deploy_vm2.sh ./deploy_vm1.sh popd } # get_aai_images() - Function that pulls or creates AAI docker images function get_aai_images { local aai_docker_version="1.2-STAGING-latest" local cassandra_version=2.1 local elasticsearch_version=2.4.1 local hbase_version=1.2.0 pull_docker_image cassandra:${cassandra_version} pull_docker_image elasticsearch:${elasticsearch_version} & docker_openecomp_login pull_docker_image ${nexus_docker_repo:-nexus3.onap.org:10001}/aaionap/hbase:${hbase_version} & wait_docker_pull if [[ "$build_image" == "True" ]]; then unset MAVEN_OPTS if [[ "$compile_repo" != "True" ]]; then compile_aai_repos fi for project in resources/aai-resources traversal/aai-traversal; do build_docker_image ${src_folders[aai]}/$project docker done for project in search-data-service data-router model-loader sparky-be/sparkybe-onap-application; do build_docker_image ${src_folders[aai]}/$project done for image in aai-resources aai-traversal search-data-service data-router model-loader sparky-be; do docker tag onap/$image ${nexus_docker_repo:-nexus3.onap.org:10001}/onap/$image $aai_docker_version done else for image in aai-resources aai-traversal search-data-service data-router model-loader sparky-be; do pull_onap_image $image $aai_docker_version & done wait_docker_pull fi } # init_aai() - Function that initialize AAI services function init_aai { if [[ "$clone_repo" == "True" ]]; then clone_repos "aai" if [[ "$compile_repo" == "True" ]]; then compile_aai_repos fi fi if [[ "$skip_get_images" == "False" ]]; then get_aai_images if [[ "$skip_install" == "False" ]]; then install_hadoop install_haproxy setup_titan #start_aai_microservices install_aai fi fi }