#!/bin/bash

source /var/onap/functions
source /var/onap/ccsdk

# compile_all_sdnc_repos() - Function that compiles SDNC source repo.
function compile_all_sdnc_repos {
    for repo in ${repos[sdnc]}; do
        if [[ "$repo" == "sdnc/core" ]]; then
            compile_src ${src_folders[sdnc]}/core/rootpom
        fi
        compile_src ${src_folders[sdnc]}${repo#*sdnc}
    done
}

# _build_sdnc_images() - Builds SDNC images from source code
function _build_sdnc_images {
    local folder=${src_folders[sdnc]}/oam

    get_ccsdk_images
    install_package unzip
    # The OAM code depends on all the SDNC repos which should be downloaded and compiled first
    if [[ "$compile_repo" != "True" ]]; then
        compile_src $folder
    fi
    for dirc in ubuntu sdnc admportal dgbuilder; do
        build_docker_image $folder/installation/$dirc
    done
}

# get_sdnc_images() - Build or retrieve necessary images
function get_sdnc_images {
    if [[ "$build_image" == "True" ]]; then
        _build_sdnc_images
    else
        for image in sdnc-image admportal-sdnc-image dgbuilder-sdnc-image; do
            pull_openecomp_image $image openecomp/$image:latest
        done
    fi
    pull_docker_image mysql/mysql-server:5.6
}

# install_sdnc() -  Download and install SDNC services from source code
function install_sdnc {
    run_docker_compose ${src_folders[sdnc]}/oam/installation/src/main/yaml
}

# init_sdnc() - Function that initialize SDNC services
function init_sdnc {
    if [[ "$clone_repo" == "True" ]]; then
        clone_repos "sdnc"
        if [[ "$compile_repo" == "True" ]]; then
            compile_all_sdnc_repos
        fi
    fi

    if [[ "$skip_get_images" == "False" ]]; then
        get_sdnc_images
        if [[ "$skip_install" == "False" ]]; then
            start_ODL
            install_sdnc
        fi
    fi
}
