#!/bin/bash

set -o xtrace

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

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)

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

# 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 ${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_packages apt-transport-https ca-certificates curl
}

# _install_bind() - Install bind utils
function _install_bind {
    install_packages bind9 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

    # Remove Java 7
    uninstall_packages default-jre openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless

    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

    # Remove Java 7
    uninstall_package openjdk-7-jdk

    _configure_maven
}

# _configure_docker_settings() - Configures Docker settings
function _configure_docker_settings {
    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

    echo "DOCKER_OPTS=\"-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock\"" >> /etc/default/docker
    usermod -a -G docker vagrant
}

# 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_packages python2.7 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_settings
    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
}
