aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sdnc
blob: e3397bc1853b795a2dc8fffebeaf4fb2698a5e01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2017-2018
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#############################################################################

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 ${docker_version:-latest} 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
}