blob: 05165b18bbc9c6edb801dcb56a2f4cde2e8b9f17 [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 Morales65deef22017-08-18 20:53:42 -05006sdnc_src_folder=$git_src_folder/openecomp/sdnc
Victor Moralesf6c0bf12017-10-27 11:08:04 -07007sdnc_repos=("sdnc/adaptors" "sdnc/architecture" "sdnc/core" "sdnc/features" \
8"sdnc/northbound" "sdnc/oam" "sdnc/parent" "sdnc/plugins")
Victor Moralesdd074802017-07-26 16:06:35 -05009
Victor Moralesdd074802017-07-26 16:06:35 -050010# compile_all_sdnc_repos() - Function that compiles SDNC source repo.
11function compile_all_sdnc_repos {
Victor Moralesf6c0bf12017-10-27 11:08:04 -070012 for repo in ${sdnc_repos[@]}; do
13 if [[ "$repo" == "sdnc/core" ]]; then
Victor Morales65deef22017-08-18 20:53:42 -050014 compile_src $sdnc_src_folder/core/rootpom
Victor Moralesdd074802017-07-26 16:06:35 -050015 fi
Victor Moralesf6c0bf12017-10-27 11:08:04 -070016 compile_src $sdnc_src_folder${repo#*sdnc}
Victor Moralesdd074802017-07-26 16:06:35 -050017 done
18}
19
Victor Morales65deef22017-08-18 20:53:42 -050020# _build_sdnc_images() - Builds SDNC images from source code
21function _build_sdnc_images {
22 local folder=$sdnc_src_folder/oam
Victor Moralesdd074802017-07-26 16:06:35 -050023
Victor Morales664e6e92017-09-14 12:11:23 -070024 get_ccsdk_images
Victor Moralesdbdc30a2017-08-17 11:50:42 -050025 install_package unzip
Victor Moralesdbdc30a2017-08-17 11:50:42 -050026 # The OAM code depends on all the SDNC repos which should be downloaded and compiled first
Victor Morales65deef22017-08-18 20:53:42 -050027 if [[ "$compile_repo" != "True" ]]; then
28 compile_src $folder
Victor Moralesdbdc30a2017-08-17 11:50:42 -050029 fi
30 for dirc in ubuntu sdnc admportal dgbuilder; do
31 build_docker_image $folder/installation/$dirc
32 done
Victor Moralesdd074802017-07-26 16:06:35 -050033}
34
35# get_sdnc_images() - Build or retrieve necessary images
36function get_sdnc_images {
Victor Morales89ce3212017-06-16 18:32:48 -050037 if [[ "$build_image" == "True" ]]; then
Victor Morales65deef22017-08-18 20:53:42 -050038 _build_sdnc_images
Victor Morales89ce3212017-06-16 18:32:48 -050039 else
40 pull_openecomp_image sdnc-image openecomp/sdnc-image:latest
41 pull_openecomp_image admportal-sdnc-image openecomp/admportal-sdnc-image:latest
42 pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest
43 fi
Victor Moralesdbdc30a2017-08-17 11:50:42 -050044 pull_docker_image mysql/mysql-server:5.6
Victor Moralesdd074802017-07-26 16:06:35 -050045}
46
47# install_sdnc() - Download and install SDNC services from source code
48function install_sdnc {
Victor Morales65deef22017-08-18 20:53:42 -050049 pushd $sdnc_src_folder/oam/installation/src/main/yaml
Victor Morales89ce3212017-06-16 18:32:48 -050050 install_docker_compose
51 /opt/docker/docker-compose up -d
52 popd
53}
54
55# init_sdnc() - Function that initialize SDNC services
56function init_sdnc {
Idan Amit1690e082017-08-20 08:58:14 +030057 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080058 clone_repos "sdnc"
Idan Amit1690e082017-08-20 08:58:14 +030059 if [[ "$compile_repo" == "True" ]]; then
60 compile_all_sdnc_repos
61 fi
Victor Moralesdd074802017-07-26 16:06:35 -050062 fi
Victor Morales6a919972017-09-28 18:29:54 -070063
64 if [[ "$skip_get_images" == "False" ]]; then
65 get_sdnc_images
66 if [[ "$skip_install" == "False" ]]; then
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -070067 start_ODL
Victor Morales6a919972017-09-28 18:29:54 -070068 install_sdnc
69 fi
70 fi
Victor Morales89ce3212017-06-16 18:32:48 -050071}