blob: 2b5407ca3de3814ce2362c3dc10efa9ca52b5545 [file] [log] [blame]
Victor Moralesdd074802017-07-26 16:06:35 -05001#!/bin/bash
2
Victor Moralesdd074802017-07-26 16:06:35 -05003source /var/onap/functions
Victor Moralesdd074802017-07-26 16:06:35 -05004
Victor Moralesdd074802017-07-26 16:06:35 -05005# compile_all_vfc_repos() - Function that compiles VF-C source repo.
6function compile_all_vfc_repos {
Victor Morales970ec192017-07-31 09:10:11 -05007 install_python_package tox
8
Victor Moralesdbe2e0b2017-09-20 09:55:45 -07009 tox_repos=("gvnfm/vnflcm/lcm" "gvnfm/vnfmgr/mgr" "gvnfm/vnfres/res" "nfvo/lcm" \
10 "nfvo/driver/vnfm/gvnfm/gvnfmadapter" "nfvo/driver/vnfm/svnfm/zte/vmanager")
Shashank Kumar Shankar0be68942017-09-14 11:10:41 -070011 for dirc in ${tox_repos[@]}; do
Victor Morales8b8e7392017-09-25 22:13:26 -070012 pushd $vfc_src_folder/$dirc
Shashank Kumar Shankar0be68942017-09-14 11:10:41 -070013 tox -e py27
14 popd
15 done
Victor Moralesdd074802017-07-26 16:06:35 -050016
Shashank Kumar Shankar0be68942017-09-14 11:10:41 -070017 # TODO(sshank): Add compile for other vfc_repos. (Java based.)
Victor Moralesdd074802017-07-26 16:06:35 -050018
19 # Java based:
20 # nfvo/catalog
21 # nfvo/driver/ems/ems/sems/boco/ems-driver
22 # nfvo/driver/sfc/zte/sfc-driver
23 # nfvo/driver/vnfm/gvnfm/juju/juju-vnfmadapter
24 # nfvo/driver/vnfm/svnfm/huawei/vnfmadapter
25 # nfvo/resmanagement
26 # nfvo/wfengine
27}
28
Victor Morales8b8e7392017-09-25 22:13:26 -070029# _build_vfc_image() - Build VFC docker image
30function _build_vfc_image {
31 pushd $vfc_src_folder/$1/docker
32 sed -i "s/^push_image/#push_image/g" build_image.sh
33 sed -i 's|IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"|IMAGE_NAME=${ORG}/${IMAGE}|g' build_image.sh
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -070034 ./build_image.sh
35 popd
36}
37
38# get_vfc_images() - Build VFC docker images
39function get_vfc_images {
40 if [[ "$build_image" == "True" ]]; then
41 install_docker
Shashank Kumar Shankar0be68942017-09-14 11:10:41 -070042 # Separate methods are required since the image build process will change.
Victor Morales8b8e7392017-09-25 22:13:26 -070043 _build_vfc_image gvnfm/vnflcm/lcm onap/nslcm
44 _build_vfc_image gvnfm/vnfmgr/mgr onap/gvnfmdriver
45 _build_vfc_image gvnfm/vnfres/res onap/vnfres
46 _build_vfc_image nfvo/lcm onap/vnflcm
47 _build_vfc_image nfvo/driver/vnfm/gvnfm/gvnfmadapter
48
Shashank Kumar Shankar0be68942017-09-14 11:10:41 -070049 build_gvnfm_lcm_image
50 build_gvnfm_vnfmgr_image
51 build_gvnfm_vnfres_image
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -070052 build_nfvo_lcm_image
Shashank Kumar Shankar0be68942017-09-14 11:10:41 -070053 build_nfvo_vnfm_gvnfmadapter_image
54 # TODO(sshank): Add other VFC component docker image builds.
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -070055 else
Shashank Kumar Shankar0be68942017-09-14 11:10:41 -070056 pull_onap_image vfc/gvnfm/vnflcm/lcm
57 pull_onap_image vfc/gvnfm/vnfmgr/mgr
58 pull_onap_image vfc/gvnfm/vnfres/res
59 pull_onap_image vfc/nfvo/lcm
60 pull_onap_image vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter
Shashank Kumar Shankar6cc4a432017-09-05 13:26:19 -070061 fi
62}
63
Victor Moralesdd074802017-07-26 16:06:35 -050064# install_vfc() - Download and install vfc service from source code
65function install_vfc {
Victor Morales896c8072017-09-12 12:19:57 -070066 nslcm_image=`docker images | grep nslcm | grep latest| awk '{print $1 ":" $2}'`
Shashank Kumar Shankar0be68942017-09-14 11:10:41 -070067 vnflcm_image=`docker images | grep vnflcm | grep latest| awk '{print $1 ":" $2}'`
68 vnfmgr_image=`docker images | grep vnfmgr | grep latest| awk '{print $1 ":" $2}'`
69 vnfres_image=`docker images | grep vnfres | grep latest| awk '{print $1 ":" $2}'`
70 gvnfmdriver_image=`docker images | grep gvnfmdriver | grep latest| awk '{print $1 ":" $2}'`
71
Victor Morales9d205bc2017-12-01 17:52:07 -080072 run_docker_image -d --name vfc-nslcm -p 8403:8403 -e MSB_ADDR=127.0.0.1 $nslcm_image
73 run_docker_image -d --name vfc-vnflcm -p 8801:8801 -e MSB_ADDR=127.0.0.1 $vnflcm_image
74 run_docker_image -d --name vfc-vnfmgr -p 8803:8803 -e MSB_ADDR=127.0.0.1 $vnfmgr_image
75 run_docker_image -d --name vfc-vnfres -p 8802:8802 -e MSB_ADDR=127.0.0.1 $vnfres_image
76 run_docker_image -d --name vfc-gvnfmdriver -p 8484:8484 -e MSB_ADDR=127.0.0.1 $gvnfmdriver_image
Shashank Kumar Shankar0be68942017-09-14 11:10:41 -070077
78 # TODO(sshank): Run other VFC component docker images.
Victor Morales94b3e972017-08-17 14:55:55 -050079}
80
81# init_vfc() - Function that initialize VF-C services
82function init_vfc {
83 install_package libmysqlclient-dev
84
Idan Amit1690e082017-08-20 08:58:14 +030085 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080086 clone_repos "vfc"
Shashank Kumar Shankar0be68942017-09-14 11:10:41 -070087 if [[ "$compile_repo" == "True" ]]; then
Idan Amit1690e082017-08-20 08:58:14 +030088 compile_all_vfc_repos
89 fi
Victor Moralesdd074802017-07-26 16:06:35 -050090 fi
91
Victor Morales6a919972017-09-28 18:29:54 -070092 if [[ "$skip_get_images" == "False" ]]; then
93 get_vfc_images
94 if [[ "$skip_install" == "False" ]]; then
95 install_vfc
96 fi
97 fi
Victor Moralesdd074802017-07-26 16:06:35 -050098}