Remove customize src_folder variables
[integration.git] / bootstrap / vagrant-onap / lib / sdnc
1 #!/bin/bash
2
3 source /var/onap/functions
4 source /var/onap/ccsdk
5
6 # compile_all_sdnc_repos() - Function that compiles SDNC source repo.
7 function compile_all_sdnc_repos {
8     for repo in ${repos[sdnc]}; do
9         if [[ "$repo" == "sdnc/core" ]]; then
10             compile_src ${src_folders[sdnc]}/core/rootpom
11         fi
12         compile_src ${src_folders[sdnc]}${repo#*sdnc}
13     done
14 }
15
16 # _build_sdnc_images() - Builds SDNC images from source code
17 function _build_sdnc_images {
18     local folder=${src_folders[sdnc]}/oam
19
20     get_ccsdk_images
21     install_package unzip
22     # The OAM code depends on all the SDNC repos which should be downloaded and compiled first
23     if [[ "$compile_repo" != "True" ]]; then
24         compile_src $folder
25     fi
26     for dirc in ubuntu sdnc admportal dgbuilder; do
27         build_docker_image $folder/installation/$dirc
28     done
29 }
30
31 # get_sdnc_images() - Build or retrieve necessary images
32 function get_sdnc_images {
33     if [[ "$build_image" == "True" ]]; then
34         _build_sdnc_images
35     else
36         for image in sdnc-image admportal-sdnc-image dgbuilder-sdnc-image; do
37             pull_openecomp_image $image openecomp/$image:latest
38         done
39     fi
40     pull_docker_image mysql/mysql-server:5.6
41 }
42
43 # install_sdnc() -  Download and install SDNC services from source code
44 function install_sdnc {
45     run_docker_compose ${src_folders[sdnc]}/oam/installation/src/main/yaml
46 }
47
48 # init_sdnc() - Function that initialize SDNC services
49 function init_sdnc {
50     if [[ "$clone_repo" == "True" ]]; then
51         clone_repos "sdnc"
52         if [[ "$compile_repo" == "True" ]]; then
53             compile_all_sdnc_repos
54         fi
55     fi
56
57     if [[ "$skip_get_images" == "False" ]]; then
58         get_sdnc_images
59         if [[ "$skip_install" == "False" ]]; then
60             start_ODL
61             install_sdnc
62         fi
63     fi
64 }