blob: 33263213818b40f441ed25ff1d6c14f2a8760c68 [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
3set -o xtrace
4
Victor Moralesdd074802017-07-26 16:06:35 -05005source /var/onap/functions
Victor Moralesdd074802017-07-26 16:06:35 -05006
7src_folder=$git_src_folder/openecomp/sdnc
8sdnc_repos=("core" "adaptors" "northbound" "plugins" "oam")
9
10# clone_all_sdnc_repos() - Function that clones SDNC source repo.
11function clone_all_sdnc_repos {
12 for dirc in ${sdnc_repos[@]}; do
13 clone_repo sdnc/$dirc $src_folder/$dirc
14 done
Victor Morales89ce3212017-06-16 18:32:48 -050015}
16
Victor Moralesdd074802017-07-26 16:06:35 -050017# compile_all_sdnc_repos() - Function that compiles SDNC source repo.
18function compile_all_sdnc_repos {
19 for dirc in ${sdnc_repos[@]}; do
20 if [[ "$dirc" == "core" ]]; then
21 compile_src $src_folder/core/rootpom
22 fi
23 compile_src $src_folder/$dirc
24 done
25}
26
Victor Moralesdbdc30a2017-08-17 11:50:42 -050027# build_sdnc_images() - Builds SDNC images from source code
28function build_sdnc_images {
29 local folder=${1:-$src_folder/oam}
Victor Moralesdd074802017-07-26 16:06:35 -050030
Victor Moralesdbdc30a2017-08-17 11:50:42 -050031 install_package unzip
32 clone_repo sdnc/oam $src_folder/oam
33 # The OAM code depends on all the SDNC repos which should be downloaded and compiled first
34 if [[ "$compile_repo" == "False" ]]; then
35 compile_src $src_folder/oam/
36 fi
37 for dirc in ubuntu sdnc admportal dgbuilder; do
38 build_docker_image $folder/installation/$dirc
39 done
Victor Moralesdd074802017-07-26 16:06:35 -050040}
41
42# get_sdnc_images() - Build or retrieve necessary images
43function get_sdnc_images {
Victor Morales89ce3212017-06-16 18:32:48 -050044 if [[ "$build_image" == "True" ]]; then
Victor Moralesdbdc30a2017-08-17 11:50:42 -050045 build_sdnc_images
Victor Morales89ce3212017-06-16 18:32:48 -050046 else
47 pull_openecomp_image sdnc-image openecomp/sdnc-image:latest
48 pull_openecomp_image admportal-sdnc-image openecomp/admportal-sdnc-image:latest
49 pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest
50 fi
Victor Moralesdbdc30a2017-08-17 11:50:42 -050051 pull_docker_image mysql/mysql-server:5.6
Victor Moralesdd074802017-07-26 16:06:35 -050052}
53
54# install_sdnc() - Download and install SDNC services from source code
55function install_sdnc {
Victor Moralesdd074802017-07-26 16:06:35 -050056 clone_repo sdnc/oam $src_folder/oam
57 pushd $src_folder/oam/installation/src/main/yaml
Victor Morales89ce3212017-06-16 18:32:48 -050058 install_docker_compose
59 /opt/docker/docker-compose up -d
60 popd
61}
62
63# init_sdnc() - Function that initialize SDNC services
64function init_sdnc {
Victor Moralesdd074802017-07-26 16:06:35 -050065 start_ODL
66 clone_all_sdnc_repos
67 if [[ "$compile_repo" == "True" ]]; then
68 compile_all_sdnc_repos
69 fi
70 get_sdnc_images
Victor Morales89ce3212017-06-16 18:32:48 -050071 install_sdnc
72}