#!/bin/bash

source /var/onap/functions

hbase_version=1.2.3

# install_hadoop() - Function that installs Hadoop
function install_hadoop {
    local release=titan
    local version=1.0.0
    local filename=$release-$version-hadoop1
    local dest_folder=/opt/hadoop/current

    if [ ! -d $dest_folder ]; then
        curl http://s3.thinkaurelius.com/downloads/$release/$filename.zip -o /tmp/${filename}.zip
        install_package unzip
        mkdir -p $dest_folder
        unzip /tmp/${filename}.zip -d $dest_folder
        pushd $dest_folder/${filename}
        # Change commitlog_directory and data_file_directories values (https://stackoverflow.com/a/26856246/1707651)
        sed -i "s|db/cassandra/data|/tmp/data|g" conf/cassandra/cassandra.yaml
        sed -i "s|db/cassandra/commitlog|/tmp/commitlog|g" conf/cassandra/cassandra.yaml

        install_java
        ./bin/titan.sh start
        popd
    fi
}

# install_haproxy() - Function that install HAProxy
function install_haproxy {
    if is_package_installed haproxy; then
        return
    fi
    install_package software-properties-common
    add-apt-repository -y ppa:vbernat/haproxy-1.7
    install_package haproxy
    cp /var/onap/files/haproxy.cfg /etc/haproxy/
    cp /var/onap/files/aai.pem /etc/ssl/private/
    chmod 640 /etc/ssl/private/aai.pem
    chown root:ssl-cert /etc/ssl/private/aai.pem
    mkdir /usr/local/etc/haproxy
    #echo "127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resources.api.simpledemo.openecomp.org" >> /etc/hosts

    service haproxy restart
}


# 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 $aai_src_folder${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 "$aai_src_folder/$dirc/$subdirectory/$file" "" "storage.backend" "cassandra"
            crudini --set "$aai_src_folder/$dirc/$subdirectory/$file" "" "storage.hostname" "localhost"
        done
    done

    # Add the schema to the local isntance
    compile_src $aai_src_folder/resources/aai-resources/
    uninstall_packages default-jre openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless
    pushd $aai_src_folder
    java -DAJSC_HOME=$aai_src_folder/resources/aai-resources -DBUNDLECONFIG_DIR="bundleconfig-local" -cp aai-common/aai-core/target/aai-core-1.1.0-SNAPSHOT.jar:resources/aai-resources/target/aai-resources.jar:resources/aai-resources/target/userjars/* org.openecomp.aai.dbgen.GenTester
    popd
}

# start_aai_microservices() - Function that starts AAI microservices
function start_aai_microservices {
    install_maven
    export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n"
    for svc in resources traversal; do
        pushd $aai_src_folder/resources
        mvn -P runAjsc
        popd
    done
}

# install_hbase() - Install HBase Service
function install_hbase {
    docker rm -f hbase
    docker_openecomp_login
    docker pull $nexus_docker_repo/aaidocker/aai-hbase-${hbase_version}
    run_docker_image -d --net=host --name="hbase" $nexus_docker_repo/aaidocker/aai-hbase-${hbase_version}
}

# install_ajsc() - Install ASJC Java service container
function install_ajsc_aai {
    cat <<EOL > /etc/ajsc-aai.conf
AAI_REPO_PATH=r/aai
AAI_CHEF_ENV=simpledemo
AAI_CHEF_LOC=/var/chef/aai-data/environments
docker_gitbranch=master
EOL
    docker rm -f aai-service
    if [[ "$build_image" == "True" ]]; then
        build_docker_image $aai_src_folder/aai-service/ajsc-aai
    else
        pull_openecomp_image ajsc-aai
    fi

    run_docker_image --env-file /etc/ajsc-aai.conf --name=aai-service --net=host -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt -it -d $nexus_docker_repo/openecomp/ajsc-aai:$docker_version
}

# install_model_loader() Install Model Loader 
function install_model_loader {
    cat <<EOL > /etc/model-loader.conf
DISTR_CLIENT_ASDC_ADDRESS=${SDC_ADDRESS:-c2.vm1.sdc.simpledemo.openecomp.org:8443}
DISTR_CLIENT_CONSUMER_GROUP=${UEB_CONSUMER_GROUP:-SDCGroup}
DISTR_CLIENT_CONSUMER_ID=${UEB_CONSUMER_GROUP_ID:-UEB}
DISTR_CLIENT_ENVIRONMENT_NAME=${dmaap_topic}
DISTR_CLIENT_PASSWORD=${SDC_PASSWORD:-OBF:1ks51l8d1o3i1pcc1r2r1e211r391kls1pyj1z7u1njf1lx51go21hnj1y0k1mli1sop1k8o1j651vu91mxw1vun1mze1vv11j8x1k5i1sp11mjc1y161hlr1gm41m111nkj1z781pw31kku1r4p1e391r571pbm1o741l4x1ksp}
DISTR_CLIENT_USER=${SDC_USER:-aai}
                     
APP_SERVER_BASE_URL=${APP_SERVER_URL:-https://c1.vm1.aai.simpledemo.openecomp.org:8443}
APP_SERVER_AUTH_USER=${APP_USER:-ModelLoader}
APP_SERVER_KEYSTORE_PASSWORD=OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o
APP_SERVER_AUTH_PASSWORD=${APP_PASSWORD:-OBF:1qvu1v2h1sov1sar1wfw1j7j1wg21saj1sov1v1x1qxw}
EOL

    ARGS=""

    docker rm -f model-loader-service
    if [[ "$build_image" == "True" ]]; then
        build_docker_image $aai_src_folder/model-loader/
        ARGS+="--env-file /etc/model-loader.conf model-loader"
    else
        pull_openecomp_image model-loader
        ARGS+="--name=model-loader-service -it -d --env-file /etc/model-loader.conf $nexus_docker_repo/openecomp/model-loader:$docker_version"
    fi
    run_docker_image ${ARGS}
}

# _wait_for_sdc() - Function that determines if SDC is up and running
function _wait_for_sdc {
    if [[ -s "/opt/config/sdc_ip_addr.txt" ]]; then
        SDC_IP_ADDR=$(cat /opt/config/sdc_ip_addr.txt)
    else
        SDC_IP_ADDR="10.0.3.1"
    fi

     # Run Health Check against SDC and verify that all five components are up
    RES=$(curl http://$SDC_IP_ADDR:8181/sdc1/rest/healthCheck | grep -c "OK")
    while [[ $RES -lt 5 ]]; do
        RES=$(curl http://$SDC_IP_ADDR:8181/sdc1/rest/healthCheck | grep -c "OK")
    done
}

# init_aai() - Function that initialize AAI services
function init_aai {
    install_hadoop
    install_haproxy

    if [[ "$clone_repo" == "True" ]]; then
        clone_repos "aai"
        if [[ "$compile_repo" == "True" ]]; then
            compile_aai_repos
        fi
    fi

    setup_titan
    #start_aai_microservices

    mkdir -p /opt/openecomp/aai/logs
    mkdir -p /opt/openecomp/aai/data

    install_hbase

    # Wait 3 minutes before instantiating the A&AI container
    sleep 180

    install_ajsc_aai
    _wait_for_sdc
    if [[ "$skip_install" == "False" ]]; then
        install_model_loader
    fi
}
