blob: 863bae0f65d59d8bba29786730cb5b0892ed5810 [file] [log] [blame]
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -07001#!/bin/bash
2
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -07003source /var/onap/functions
4
5vnfsdk_src_folder=$git_src_folder/vnfsdk
Victor Morales6d280a12017-10-23 11:56:43 -07006vnfsdk_repos=("vnfsdk/compliance" "vnfsdk/functest" "vnfsdk/lctest" "vnfsdk/model" "vnfsdk/pkgtools" "vnfsdk/refrepo" "vnfsdk/validation")
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -07007
8# clone_all_vnfsdk_repos() - Function that clones vnfsdk source repo.
9function clone_all_vnfsdk_repos {
Victor Morales6d280a12017-10-23 11:56:43 -070010 for repo in ${vnfsdk_repos[@]}; do
11 clone_repo $repo $vnfsdk_src_folder${repo#*vnfsdk}
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -070012 done
13}
14
15# compile_all_vnfsdk_repos - Function that builds vnfsdk source repo
16function compile_all_vnfsdk_repos {
Victor Morales6d280a12017-10-23 11:56:43 -070017 for repo in ${vnfsdk_repos[@]}; do
18 compile_src $vnfsdk_src_folder${repo#*vnfsdk}
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -070019 done
20}
21
22# _build_vnfsdk_images() - Builds VNFSDK images from source code
23function _build_vnfsdk_images {
24 install_package unzip
25 pushd $vnfsdk_src_folder/refrepo/vnfmarket-be/deployment/docker/docker-refrepo
26 build_docker_image .
27 popd
28}
29
30# get_vnfsdk_images - Function that clones vnfsdk Docker images
31function get_vnfsdk_images {
32 if [[ "$build_image" == "True" ]]; then
33 # TODO(sshank): Has errors building.
34 _build_vnfsdk_images
35 else
36 pull_docker_image refrepo:1.0-STAGING-latest
37 pull_docker_image refrepo:latest
38 fi
39}
40
41# install_vnfsdk - Function that installs vnfsdk Docker images
42function install_vnfsdk {
43 install_docker_compose
44 pushd $vnfsdk_src_folder/refrepo/vnfmarket-be/deployment/install
45 /opt/docker/docker-compose up -d
46 popd
47}
48
49# init_vnfsdk() - Init VNFSDK services
50function init_vnfsdk {
51 if [[ "$clone_repo" == "True" ]]; then
52 clone_all_vnfsdk_repos
53 if [[ "$compile_repo" == "True" ]]; then
54 compile_all_vnfsdk_repos
55 fi
56 fi
57
58 if [[ "$skip_get_images" == "False" ]]; then
59 get_vnfsdk_images
60 if [[ "$skip_install" == "False" ]]; then
61 install_vnfsdk
62 fi
63 fi
64}