#!/bin/bash

set -o xtrace

source /var/onap/commons
source /var/onap/_composed_functions
source /var/onap/_onap_functions

mvn_conf_file=/root/.m2/settings.xml
git_src_folder=/opt

# export_env_vars() - Export environment variables
function export_env_vars {
    export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' |sort -n | head -1)
    export IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
}

# configure_dns() - DNS/GW IP address configuration
function configure_dns {
    echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
    resolvconf -u
}

# _git_timed() - git can sometimes get itself infinitely stuck with transient network
# errors or other issues with the remote end.  This wraps git in a
# timeout/retry loop and is intended to watch over non-local git
# processes that might hang.
function _git_timed {
    local count=0
    local timeout=0

    install_package git
    until timeout -s SIGINT ${timeout} git "$@"; do
        # 124 is timeout(1)'s special return code when it reached the
        # timeout; otherwise assume fatal failure
        if [[ $? -ne 124 ]]; then
            exit 1
        fi

        count=$(($count + 1))
        if [ $count -eq 3 ]; then
            exit 1
        fi
        sleep 5
    done
}

# clone_repo() - Clone Git repository into specific folder
function clone_repo {
    local repo_url=https://git.onap.org/
    local repo=$1
    local dest_folder=${2:-$git_src_folder/$repo}
    if [ ! -d $dest_folder ]; then
        _git_timed clone -b $gerrit_branch --single-branch ${repo_url}${repo} $dest_folder
    else
        pushd $dest_folder
        _git_timed pull
        popd
    fi
}

# install_dev_tools() - Install basic dependencies
function install_dev_tools {
    install_package apt-transport-https
    install_package ca-certificates
    install_package curl
}

# _install_bind() - Install bind utils
function _install_bind {
    install_package bind9
    install_package bind9utils
}

# install_java() - Install java binaries
function install_java {
    if is_package_installed openjdk-8-jdk; then
        return
    fi
    install_package software-properties-common
    add-apt-repository -y ppa:openjdk-r/ppa
    install_package openjdk-8-jdk
    # ca-certificates-java is not a dependency in the Oracle JDK/JRE so this must be explicitly installed.
    /var/lib/dpkg/info/ca-certificates-java.postinst configure
}

# install_maven() - Install maven binaries
function install_maven {
    if is_package_installed maven3; then
        return
    fi
    install_java
    install_package software-properties-common
    add-apt-repository -y ppa:andrei-pozolotin/maven3
    install_package maven3

    # Force Maven3 to use jdk8
    apt-get purge openjdk-7-jdk -y

    _configure_maven
}

# _configure_docker_proxy() - Configures proxy in Docker from ENV
function _configure_docker_proxy {
    if [ $http_proxy ]; then
        echo "export http_proxy=$http_proxy" >> /etc/default/docker
    fi
    if [ $https_proxy ]; then
        echo "export https_proxy=$https_proxy" >> /etc/default/docker
    fi
}

# install_nodejs() - Download and install NodeJS
function install_nodejs {
    if is_package_installed nodejs; then
        return
    fi
    curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    install_package nodejs

    # Update NPM to latest version
    npm install npm -g
}

# install_python() - Install Python 2.7 and other tools necessary for development.
function install_python {
    install_package python2.7
    install_package python-dev
}

# _install_pip() - Install Python Package Manager
function _install_pip {
    install_python
    if [ ! -f /usr/local/bin/pip ]; then
        curl -sL https://bootstrap.pypa.io/get-pip.py | python
    fi
}

# install_python_package() - Install a python module
function install_python_package {
    local python_package=$1

    _install_pip
    pip install $python_package
}

# install_docker() - Download and install docker-engine
function install_docker {
    if is_package_installed docker-ce; then
        return
    fi
    install_package software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    add-apt-repository \
        "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
        $(lsb_release -cs) \
        stable"
    install_package docker-ce
    _configure_docker_proxy
    service docker restart
    sleep 10
}

# pull_docker_image() - Pull Docker container image from the Public Docker Registry Hub
function pull_docker_image {
    install_docker
    local image=$1
    local tag=$2
    docker pull ${image}
    if [ ${tag} ]; then
        docker tag ${image} $tag
    fi
}

# install_docker_compose() - Download and install docker-engine 
function install_docker_compose {
    local docker_compose_version=${1:-1.12.0}
    if [ ! -d /opt/docker ]; then
        mkdir /opt/docker
        curl -L https://github.com/docker/compose/releases/download/$docker_compose_version/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
        chmod +x /opt/docker/docker-compose
    fi
}

# _install_ODL() - Download and Install OpenDayLight SDN controller
function _install_ODL {
    if [ ! -d /opt/opendaylight/current ]; then
        mkdir -p /opt/opendaylight/
        wget "https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/integration/distribution-karaf/"$odl_version"/distribution-karaf-"$odl_version".tar.gz" -P /opt/
        tar xvf "/opt/distribution-karaf-"$odl_version".tar.gz" -C /opt/
        mv "/opt/distribution-karaf-"$odl_version /opt/opendaylight/current
        rm -rf "/opt/distribution-karaf-"$odl_version".tar.gz"
    fi
}

# start_ODL() - Start OpenDayLight SDN controller
function start_ODL {
    _install_ODL
    if [ -d /opt/opendaylight ]; then
        export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
        /opt/opendaylight/current/bin/start
        sleep 180
        /opt/opendaylight/current/bin/client feature:install odl-dlux-all
    fi
}

# compile_src() - Function that compiles the java source code thru maven
function compile_src {
    local src_folder=$1
    pushd $src_folder
    if [ -f pom.xml ]; then
        install_maven
        mvn clean install -DskipTests=true -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dadditionalparam=-Xdoclint:none
    fi
    popd
}

# build_docker_image() - Build Docker container image from source code
function build_docker_image {
    local src_folder=$1
    local profile=$2
    install_maven
    install_docker
    pushd $src_folder

    # Cleanup external repo
    sed -i 's|${docker.push.registry}/||g' pom.xml
    local mvn_docker="mvn clean package docker:build"
    if [ $profile ]; then
        mvn_docker+=" -P $profile"
    fi
    if [ $http_proxy ]; then
        if ! grep -ql "docker.buildArg.http_proxy" pom.xml ; then
            mvn_docker+=" -Ddocker.buildArg.http_proxy=$http_proxy"
        fi
        if ! grep -ql "docker.buildArg.HTTP_PROXY" pom.xml ; then
            mvn_docker+=" -Ddocker.buildArg.HTTP_PROXY=$http_proxy"
        fi
    fi
    if [ $https_proxy ]; then
        if ! grep -ql "docker.buildArg.https_proxy" pom.xml ; then
            mvn_docker+=" -Ddocker.buildArg.https_proxy=$https_proxy"
        fi
        if ! grep -ql "docker.buildArg.HTTPS_PROXY" pom.xml ; then
            mvn_docker+=" -Ddocker.buildArg.HTTPS_PROXY=$https_proxy"
        fi
    fi
    eval $mvn_docker
    popd
}
