#!/bin/bash

set -o xtrace

source /var/onap/functions

src_folder=$git_src_folder/mso
mso_repos=("mso" "mso/chef-repo" "mso/docker-config" "mso/libs"
"mso/mso-config")

# clone_all_mso_repos() - Function that clones MSO source repo.
function clone_all_mso_repos {
    for repo in ${mso_repos[@]}; do
        clone_repo $repo $src_folder${repo#*mso}
    done
}

# compile_all_mso_repos() - Function that compiles MSO source repo.
function compile_all_mso_repos {
    for repo in ${mso_repos[@]}; do
        compile_src $src_folder${repo#*mso}
    done
}

# get_mso_images() - Function that retrieves or create MSO Docker images
function get_mso_images {
    if [[ "$build_image" == "True" ]]; then
        export GIT_NO_PROJECT=/opt/
        compile_src $src_folder
        build_docker_image $src_folder/packages/docker docker
    fi
}

# install_mso() - Install MSO Docker configuration project
function install_mso {
    MSO_ENCRYPTION_KEY=$(cat /opt/mso/docker-config/encryption.key)
    echo -n "$openstack_api_key" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt

    # Deployments in OpenStack require a keystone file
    if [ -e /opt/config/keystone.txt ]; then
        KEYSTONE_URL=$(cat /opt/config/keystone.txt)
        DCP_CLLI="DEFAULT_KEYSTONE"
        AUTH_TYPE="USERNAME_PASSWORD"
    else
        KEYSTONE_URL="https://identity.api.rackspacecloud.com/v2.0"
        DCP_CLLI="RAX_KEYSTONE"
        AUTH_TYPE="RACKSPACE_APIKEY"
    fi

    # Update the MSO configuration file.
    read -d '' MSO_CONFIG_UPDATES <<-EOF
{
"default_attributes":
    {
    "asdc-connections":
        {
            "asdc-controller1":
            {
                "environmentName": "$dmaap_topic"
            }
        },
        "mso-po-adapter-config":
        {
            "identity_services":
            [
                {
                    "dcp_clli": "$DCP_CLLI",
                    "identity_url": "$KEYSTONE_URL",
                    "mso_id": "$openstack_username",
                    "mso_pass": "$openstack_password",
                    "admin_tenant": "service",
                    "member_role": "admin",
                    "tenant_metadata": "true",
                    "identity_server_type": "KEYSTONE",
                    "identity_authentication_type": "$AUTH_TYPE"
                }
            ]
        }
    }
}
EOF
    export MSO_CONFIG_UPDATES
    export MSO_DOCKER_IMAGE_VERSION=$docker_version

    is_package_installed docker-ce || install_docker
    install_docker_compose
    # Deploy the environment
    pushd $src_folder/docker-config
    chmod +x deploy.sh
    if [[ "$build_image" == "True" ]]; then
        bash deploy.sh
    else
        # This script takes in input 2 nexus repos (the first one for the MSO image, the second one for mariadb)
        bash deploy.sh $nexus_docker_repo $nexus_username $nexus_password $nexus_docker_repo $nexus_username $nexus_password
    fi
    popd
}

# init_mso() - Function that initialize MSO services
function init_mso {
    if [[ "$clone_repo" == "True" ]]; then
        clone_all_mso_repos
        if [[ "$compile_repo" == "True" ]]; then
            compile_all_mso_repos
        fi
    fi

    if [[ "$skip_get_images" == "False" ]]; then
        get_mso_images
        if [[ "$skip_install" == "False" ]]; then
            install_mso
        fi
    fi
}
