blob: 2b0634bc6059e2919990ce699c68f5587b2f627c [file] [log] [blame]
Victor Moralesdd074802017-07-26 16:06:35 -05001#!/bin/bash
2
3set -o xtrace
4
5source /var/onap/functions
Victor Moralesdd074802017-07-26 16:06:35 -05006
Victor Morales94b3e972017-08-17 14:55:55 -05007src_folder=$git_src_folder/vfc
Victor Moralesdd074802017-07-26 16:06:35 -05008vfc_repos=("gvnfm/vnflcm" "gvnfm/vnfmgr" "gvnfm/vnfres" "nfvo/catalog" "nfvo/driver/ems" "nfvo/driver/sfc" \
9 "nfvo/driver/vnfm/gvnfm" "nfvo/driver/vnfm/svnfm" "nfvo/lcm" "nfvo/resmanagement" "nfvo/wfengine")
10
11# clone_all_vfc_repos() - Function that clones VF-C source repo.
12function clone_all_vfc_repos {
13 for dirc in ${vfc_repos[@]}; do
14 clone_repo vfc/$dirc $src_folder/$dirc
15 done
16}
17
18# compile_all_vfc_repos() - Function that compiles VF-C source repo.
19function compile_all_vfc_repos {
Victor Morales970ec192017-07-31 09:10:11 -050020 install_python_package tox
21
Victor Moralesdd074802017-07-26 16:06:35 -050022 pushd $src_folder/gvnfm/vnflcm/lcm
23 tox -e py27
24 popd
25
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -070026
27 pushd $src_folder/nfvo/lcm
28 tox -e py27
29 popd
30
Victor Moralesdd074802017-07-26 16:06:35 -050031 # TODO(sshank): Add compile for other vfc_repos. (Both Java and Python based.)
32 # Python based:
33 # gvnfm/vnflcm/lcm
34 # gvnfm/vnfmgr/mgr
35 # gvnfm/vnfres/res
36 # nfvo/driver/vnfm/gvnfm/gvnfmadapter
37 # nfvo/driver/vnfm/svnfm/zte/vmanager
Victor Moralesdd074802017-07-26 16:06:35 -050038
39 # Java based:
40 # nfvo/catalog
41 # nfvo/driver/ems/ems/sems/boco/ems-driver
42 # nfvo/driver/sfc/zte/sfc-driver
43 # nfvo/driver/vnfm/gvnfm/juju/juju-vnfmadapter
44 # nfvo/driver/vnfm/svnfm/huawei/vnfmadapter
45 # nfvo/resmanagement
46 # nfvo/wfengine
47}
48
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -070049# build_nfvo_lcm_image() - Build VFC NFVO LCM docker image
50function build_nfvo_lcm_image {
51 pushd $src_folder/nfvo/lcm/docker
52 sed -i '$ d' build_image.sh
53 ./build_image.sh
54 popd
55}
56
57# get_vfc_images() - Build VFC docker images
58function get_vfc_images {
59 if [[ "$build_image" == "True" ]]; then
60 install_docker
61 build_nfvo_lcm_image
62 # TODO(sshank): Add other VFC component docker image builds when they are ready.
63 else
Victor Morales896c8072017-09-12 12:19:57 -070064 pull_onap_image vfc/nslcm
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -070065 fi
66}
67
Victor Moralesdd074802017-07-26 16:06:35 -050068# install_vfc() - Download and install vfc service from source code
69function install_vfc {
Victor Morales896c8072017-09-12 12:19:57 -070070 nslcm_image=`docker images | grep nslcm | grep latest| awk '{print $1 ":" $2}'`
71 docker run -d --name vfc-nslcm -p 3306:3306 -p 8403:8403 -e MSB_ADDR=127.0.0.1 $nslcm_image
72 # TODO(sshank): Run other VFC component docker images when they are ready.
Victor Morales94b3e972017-08-17 14:55:55 -050073}
74
75# init_vfc() - Function that initialize VF-C services
76function init_vfc {
77 install_package libmysqlclient-dev
78
Idan Amit1690e082017-08-20 08:58:14 +030079 if [[ "$clone_repo" == "True" ]]; then
80 clone_all_vfc_repos
81 if [[ "$compile_repo" == "False" ]]; then
82 compile_all_vfc_repos
83 fi
Victor Moralesdd074802017-07-26 16:06:35 -050084 fi
85
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -070086 get_vfc_images
Victor Moralesdd074802017-07-26 16:06:35 -050087 install_vfc
88}