blob: 8dacf9e16ef66ec18328529ff02be07a11160656 [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
Victor Moralesdd074802017-07-26 16:06:35 -05003source /var/onap/functions
Victor Morales664e6e92017-09-14 12:11:23 -07004source /var/onap/ccsdk
Victor Moralesdd074802017-07-26 16:06:35 -05005
Victor Moralesdd074802017-07-26 16:06:35 -05006# compile_all_sdnc_repos() - Function that compiles SDNC source repo.
7function compile_all_sdnc_repos {
Victor Morales54646642017-12-08 11:57:42 -08008 for repo in ${repos[sdnc]}; do
Victor Moralesf6c0bf12017-10-27 11:08:04 -07009 if [[ "$repo" == "sdnc/core" ]]; then
Victor Moralesf8730f52018-03-02 13:24:33 -080010 compile_src ${src_folders[sdnc]}/core/rootpom
Victor Moralesdd074802017-07-26 16:06:35 -050011 fi
Victor Moralesf8730f52018-03-02 13:24:33 -080012 compile_src ${src_folders[sdnc]}${repo#*sdnc}
Victor Moralesdd074802017-07-26 16:06:35 -050013 done
14}
15
Victor Morales65deef22017-08-18 20:53:42 -050016# _build_sdnc_images() - Builds SDNC images from source code
17function _build_sdnc_images {
Victor Moralesf8730f52018-03-02 13:24:33 -080018 local folder=${src_folders[sdnc]}/oam
Victor Moralesdd074802017-07-26 16:06:35 -050019
Victor Morales664e6e92017-09-14 12:11:23 -070020 get_ccsdk_images
Victor Moralesdbdc30a2017-08-17 11:50:42 -050021 install_package unzip
Victor Moralesdbdc30a2017-08-17 11:50:42 -050022 # The OAM code depends on all the SDNC repos which should be downloaded and compiled first
Victor Morales65deef22017-08-18 20:53:42 -050023 if [[ "$compile_repo" != "True" ]]; then
24 compile_src $folder
Victor Moralesdbdc30a2017-08-17 11:50:42 -050025 fi
26 for dirc in ubuntu sdnc admportal dgbuilder; do
27 build_docker_image $folder/installation/$dirc
28 done
Victor Moralesdd074802017-07-26 16:06:35 -050029}
30
31# get_sdnc_images() - Build or retrieve necessary images
32function get_sdnc_images {
Victor Morales89ce3212017-06-16 18:32:48 -050033 if [[ "$build_image" == "True" ]]; then
Victor Morales65deef22017-08-18 20:53:42 -050034 _build_sdnc_images
Victor Morales89ce3212017-06-16 18:32:48 -050035 else
Victor Moralesf8730f52018-03-02 13:24:33 -080036 for image in sdnc-image admportal-sdnc-image dgbuilder-sdnc-image; do
37 pull_openecomp_image $image openecomp/$image:latest
38 done
Victor Morales89ce3212017-06-16 18:32:48 -050039 fi
Victor Moralesdbdc30a2017-08-17 11:50:42 -050040 pull_docker_image mysql/mysql-server:5.6
Victor Moralesdd074802017-07-26 16:06:35 -050041}
42
43# install_sdnc() - Download and install SDNC services from source code
44function install_sdnc {
Victor Moralesf8730f52018-03-02 13:24:33 -080045 run_docker_compose ${src_folders[sdnc]}/oam/installation/src/main/yaml
Victor Morales89ce3212017-06-16 18:32:48 -050046}
47
48# init_sdnc() - Function that initialize SDNC services
49function init_sdnc {
Idan Amit1690e082017-08-20 08:58:14 +030050 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080051 clone_repos "sdnc"
Idan Amit1690e082017-08-20 08:58:14 +030052 if [[ "$compile_repo" == "True" ]]; then
53 compile_all_sdnc_repos
54 fi
Victor Moralesdd074802017-07-26 16:06:35 -050055 fi
Victor Morales6a919972017-09-28 18:29:54 -070056
57 if [[ "$skip_get_images" == "False" ]]; then
58 get_sdnc_images
59 if [[ "$skip_install" == "False" ]]; then
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -070060 start_ODL
Victor Morales6a919972017-09-28 18:29:54 -070061 install_sdnc
62 fi
63 fi
Victor Morales89ce3212017-06-16 18:32:48 -050064}