blob: a8cf756b4286ba77047ed8e944739d6a8653fc82 [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 Morales65deef22017-08-18 20:53:42 -050010 compile_src $sdnc_src_folder/core/rootpom
Victor Moralesdd074802017-07-26 16:06:35 -050011 fi
Victor Moralesf6c0bf12017-10-27 11:08:04 -070012 compile_src $sdnc_src_folder${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 {
18 local folder=$sdnc_src_folder/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
36 pull_openecomp_image sdnc-image openecomp/sdnc-image:latest
37 pull_openecomp_image admportal-sdnc-image openecomp/admportal-sdnc-image:latest
38 pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest
39 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 Morales65deef22017-08-18 20:53:42 -050045 pushd $sdnc_src_folder/oam/installation/src/main/yaml
Victor Morales89ce3212017-06-16 18:32:48 -050046 install_docker_compose
47 /opt/docker/docker-compose up -d
48 popd
49}
50
51# init_sdnc() - Function that initialize SDNC services
52function init_sdnc {
Idan Amit1690e082017-08-20 08:58:14 +030053 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080054 clone_repos "sdnc"
Idan Amit1690e082017-08-20 08:58:14 +030055 if [[ "$compile_repo" == "True" ]]; then
56 compile_all_sdnc_repos
57 fi
Victor Moralesdd074802017-07-26 16:06:35 -050058 fi
Victor Morales6a919972017-09-28 18:29:54 -070059
60 if [[ "$skip_get_images" == "False" ]]; then
61 get_sdnc_images
62 if [[ "$skip_install" == "False" ]]; then
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -070063 start_ODL
Victor Morales6a919972017-09-28 18:29:54 -070064 install_sdnc
65 fi
66 fi
Victor Morales89ce3212017-06-16 18:32:48 -050067}