blob: 6fa42182e14067b5b1f9d958ec09b1536b5ffa8c [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
64 pull_docker_image nexus3.onap.org:10003/onap/vfc/nslcm latest
65 fi
66}
67
68# run_vfc_images() - Run VFC docker images
69function run_vfc_images() {
70 docker run -d --name vfc-nslcm -p 3306:3306 -p 8403:8403 -e MSB_ADDR=127.0.0.1 nexus3.onap.org:10003/onap/vfc/nslcm
71 # TODO(sshank): Run other VFC component docker images when they are ready.
72}
73
Victor Moralesdd074802017-07-26 16:06:35 -050074# install_vfc() - Download and install vfc service from source code
75function install_vfc {
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -070076 run_vfc_images
Victor Morales94b3e972017-08-17 14:55:55 -050077}
78
79# init_vfc() - Function that initialize VF-C services
80function init_vfc {
81 install_package libmysqlclient-dev
82
Idan Amit1690e082017-08-20 08:58:14 +030083 if [[ "$clone_repo" == "True" ]]; then
84 clone_all_vfc_repos
85 if [[ "$compile_repo" == "False" ]]; then
86 compile_all_vfc_repos
87 fi
Victor Moralesdd074802017-07-26 16:06:35 -050088 fi
89
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -070090 get_vfc_images
Victor Moralesdd074802017-07-26 16:06:35 -050091 install_vfc
92}