blob: 8bf6ae625390754e680b01dfc6da60d180ebe3e7 [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
6source /var/onap/asserts
7
8src_folder=$git_src_folder/openecomp/sdnc
9sdnc_repos=("core" "adaptors" "northbound" "plugins" "oam")
10
11# clone_all_sdnc_repos() - Function that clones SDNC source repo.
12function clone_all_sdnc_repos {
13 for dirc in ${sdnc_repos[@]}; do
14 clone_repo sdnc/$dirc $src_folder/$dirc
15 done
Victor Morales89ce3212017-06-16 18:32:48 -050016}
17
Victor Moralesdd074802017-07-26 16:06:35 -050018# compile_all_sdnc_repos() - Function that compiles SDNC source repo.
19function compile_all_sdnc_repos {
20 for dirc in ${sdnc_repos[@]}; do
21 if [[ "$dirc" == "core" ]]; then
22 compile_src $src_folder/core/rootpom
23 fi
24 compile_src $src_folder/$dirc
25 done
26}
27
28# _build_sdnc_images() - Builds SDNC images from source code
29function _build_sdnc_images {
30 local folder=$1
31
32 build_docker_image $folder/installation/ubuntu
33 asserts_image openecomp/ubuntu-sdnc-image
34
Victor Moralesdd074802017-07-26 16:06:35 -050035 build_docker_image $folder/installation/sdnc
36 asserts_image openecomp/sdnc-image
37
38 build_docker_image $folder/installation/admportal
39 asserts_image openecomp/admportal-sdnc-image
40
41 build_docker_image $folder/installation/dgbuilder
42 asserts_image openecomp/dgbuilder-sdnc-image
43}
44
45# get_sdnc_images() - Build or retrieve necessary images
46function get_sdnc_images {
Victor Morales89ce3212017-06-16 18:32:48 -050047 if [[ "$build_image" == "True" ]]; then
Victor Moralesdd074802017-07-26 16:06:35 -050048 # The OAM code depends on all the SDNC repos which should be downloaded and compiled first
49 if [[ "$compile_repo" == "False" ]]; then
50 compile_all_sdnc_repos
51 fi
52 _build_sdnc_images $src_folder/oam
Victor Morales89ce3212017-06-16 18:32:48 -050053 else
54 pull_openecomp_image sdnc-image openecomp/sdnc-image:latest
55 pull_openecomp_image admportal-sdnc-image openecomp/admportal-sdnc-image:latest
56 pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest
57 fi
Victor Moralesdd074802017-07-26 16:06:35 -050058}
59
60# install_sdnc() - Download and install SDNC services from source code
61function install_sdnc {
62 install_package unzip
63 clone_repo sdnc/oam $src_folder/oam
64 pushd $src_folder/oam/installation/src/main/yaml
Victor Morales89ce3212017-06-16 18:32:48 -050065 install_docker_compose
66 /opt/docker/docker-compose up -d
67 popd
68}
69
70# init_sdnc() - Function that initialize SDNC services
71function init_sdnc {
Victor Moralesdd074802017-07-26 16:06:35 -050072 start_ODL
73 clone_all_sdnc_repos
74 if [[ "$compile_repo" == "True" ]]; then
75 compile_all_sdnc_repos
76 fi
77 get_sdnc_images
Victor Morales89ce3212017-06-16 18:32:48 -050078 install_sdnc
79}