#!/bin/bash

source /var/onap/functions

# _init_data_folders() - Function that initialize the data folders
function _init_data_folders {
    mkdir -p /data/environments
    mkdir -p /data/scripts
    mkdir -p /data/logs/BE
    mkdir -p /data/logs/FE
    chmod 777 /data
    chmod 777 /data/logs
}

# _setup_docker_aliases() - Function that setups the aliases required by sdc scripts
function _setup_docker_aliases {
    cat <<EOL > /root/.bash_aliases
alias dcls='/data/scripts/docker_clean.sh \$1'
alias dlog='/data/scripts/docker_login.sh \$1'
alias drun='/data/scripts/docker_run.sh'
alias health='/data/scripts/docker_health.sh'
EOL
}

# get_sdc_images() - Function that retrieves the SDC docker images
function get_sdc_images {
    build_docker_image ${src_folders[sdc]}/sdc-docker-base
    build_docker_image ${src_folders[sdc]}/utils/webseal-simulator docker
    if [[ "$build_image" == "True" ]]; then
        compile_src  ${src_folders[sdc]}
        for project in catalog-fe test-apis-ci; do
            compile_src  ${src_folders[sdc]}/$project
        done
        build_docker_image ${src_folders[sdc]}/sdc-os-chef docker
    else
        for image in elasticsearch init-elasticsearch cassandra kibana backend frontend sanity; do
            pull_onap_image sdc-$image &
        done
        wait_docker_pull
    fi
}

# install_sdc() - Function that pull templates and executes
function install_sdc {
    local ENV_NAME=$dmaap_topic
    local MR_IP_ADDR='10.0.11.1'

    pushd ${src_folders[sdc]}/utils/webseal-simulator
    bash scripts/simulator_docker_run.sh
    popd

    _init_data_folders

    cp ${src_folders[sdc]}/sdc-os-chef/scripts/{docker_run.sh,docker_health.sh,docker_login.sh,docker_clean.sh,simulator_docker_run.sh} /data/scripts
    chmod +x /data/scripts/*.sh

    cat ${src_folders[sdc]}/sdc-os-chef/environments/Template.json | sed "s/yyy/"$IP_ADDRESS"/g" > /data/environments/$ENV_NAME.json
    sed -i "s/xxx/"$ENV_NAME"/g" /data/environments/$ENV_NAME.json
    sed -i "s/\"ueb_url_list\":.*/\"ueb_url_list\": \""$MR_IP_ADDR","$MR_IP_ADDR"\",/g" /data/environments/$ENV_NAME.json
    sed -i "s/\"fqdn\":.*/\"fqdn\": [\""$MR_IP_ADDR"\", \""$MR_IP_ADDR"\"]/g" /data/environments/$ENV_NAME.json

    install_docker
    if [[ "$skip_get_images" == "False" ]]; then
        bash /data/scripts/docker_run.sh -e $ENV_NAME -l
    else
        bash /data/scripts/docker_run.sh -e $ENV_NAME -r $docker_version -p $(echo $nexus_docker_repo | cut -d':' -f2)
    fi
    install_chefdk
}

# init_sdc() - Function that initialize SDC services
function init_sdc {
    mount_external_partition sdb /data/
    if [[ "$clone_repo" == "True" ]]; then
        clone_repos "sdc"
        if [[ "$compile_repo" == "True" ]]; then
            compile_repos "sdc"
        fi
    fi

    if [[ "$skip_get_images" == "False" ]]; then
        get_sdc_images
    fi
    if [[ "$skip_install" == "False" ]]; then
        install_sdc
    fi
    _setup_docker_aliases
}
