Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 3 | source /var/onap/functions |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 4 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 5 | # compile_all_vfc_repos() - Function that compiles VF-C source repo. |
| 6 | function compile_all_vfc_repos { |
Victor Morales | 970ec19 | 2017-07-31 09:10:11 -0500 | [diff] [blame] | 7 | install_python_package tox |
| 8 | |
Victor Morales | dbe2e0b | 2017-09-20 09:55:45 -0700 | [diff] [blame] | 9 | 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 Shankar | 0be6894 | 2017-09-14 11:10:41 -0700 | [diff] [blame] | 11 | for dirc in ${tox_repos[@]}; do |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 12 | pushd ${src_folders[vfc]}/$dirc |
Shashank Kumar Shankar | 0be6894 | 2017-09-14 11:10:41 -0700 | [diff] [blame] | 13 | tox -e py27 |
| 14 | popd |
| 15 | done |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 16 | |
Shashank Kumar Shankar | 0be6894 | 2017-09-14 11:10:41 -0700 | [diff] [blame] | 17 | # TODO(sshank): Add compile for other vfc_repos. (Java based.) |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 18 | |
| 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 Morales | 8b8e739 | 2017-09-25 22:13:26 -0700 | [diff] [blame] | 29 | # _build_vfc_image() - Build VFC docker image |
| 30 | function _build_vfc_image { |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 31 | pushd ${src_folders[vfc]}/$1/docker |
Victor Morales | 8b8e739 | 2017-09-25 22:13:26 -0700 | [diff] [blame] | 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 Shankar | 6cc4a43 | 2017-09-05 13:26:19 -0700 | [diff] [blame] | 34 | ./build_image.sh |
| 35 | popd |
| 36 | } |
| 37 | |
| 38 | # get_vfc_images() - Build VFC docker images |
| 39 | function get_vfc_images { |
| 40 | if [[ "$build_image" == "True" ]]; then |
| 41 | install_docker |
Shashank Kumar Shankar | 0be6894 | 2017-09-14 11:10:41 -0700 | [diff] [blame] | 42 | # Separate methods are required since the image build process will change. |
Victor Morales | 8b8e739 | 2017-09-25 22:13:26 -0700 | [diff] [blame] | 43 | _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 Shankar | 0be6894 | 2017-09-14 11:10:41 -0700 | [diff] [blame] | 49 | build_gvnfm_lcm_image |
| 50 | build_gvnfm_vnfmgr_image |
| 51 | build_gvnfm_vnfres_image |
Shashank Kumar Shankar | 6cc4a43 | 2017-09-05 13:26:19 -0700 | [diff] [blame] | 52 | build_nfvo_lcm_image |
Shashank Kumar Shankar | 0be6894 | 2017-09-14 11:10:41 -0700 | [diff] [blame] | 53 | build_nfvo_vnfm_gvnfmadapter_image |
| 54 | # TODO(sshank): Add other VFC component docker image builds. |
Shashank Kumar Shankar | 6cc4a43 | 2017-09-05 13:26:19 -0700 | [diff] [blame] | 55 | else |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 56 | for image in gvnfm/vnflcm/lcm gvnfm/vnfmgr/mgr gvnfm/vnfres/res nfvo/lcm nfvo/driver/vnfm/gvnfm/gvnfmadapter; do |
| 57 | pull_onap_image vfc/$image |
| 58 | done |
Shashank Kumar Shankar | 6cc4a43 | 2017-09-05 13:26:19 -0700 | [diff] [blame] | 59 | fi |
| 60 | } |
| 61 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 62 | # install_vfc() - Download and install vfc service from source code |
| 63 | function install_vfc { |
Victor Morales | 896c807 | 2017-09-12 12:19:57 -0700 | [diff] [blame] | 64 | nslcm_image=`docker images | grep nslcm | grep latest| awk '{print $1 ":" $2}'` |
Shashank Kumar Shankar | 0be6894 | 2017-09-14 11:10:41 -0700 | [diff] [blame] | 65 | vnflcm_image=`docker images | grep vnflcm | grep latest| awk '{print $1 ":" $2}'` |
| 66 | vnfmgr_image=`docker images | grep vnfmgr | grep latest| awk '{print $1 ":" $2}'` |
| 67 | vnfres_image=`docker images | grep vnfres | grep latest| awk '{print $1 ":" $2}'` |
| 68 | gvnfmdriver_image=`docker images | grep gvnfmdriver | grep latest| awk '{print $1 ":" $2}'` |
| 69 | |
Victor Morales | 9d205bc | 2017-12-01 17:52:07 -0800 | [diff] [blame] | 70 | run_docker_image -d --name vfc-nslcm -p 8403:8403 -e MSB_ADDR=127.0.0.1 $nslcm_image |
| 71 | run_docker_image -d --name vfc-vnflcm -p 8801:8801 -e MSB_ADDR=127.0.0.1 $vnflcm_image |
| 72 | run_docker_image -d --name vfc-vnfmgr -p 8803:8803 -e MSB_ADDR=127.0.0.1 $vnfmgr_image |
| 73 | run_docker_image -d --name vfc-vnfres -p 8802:8802 -e MSB_ADDR=127.0.0.1 $vnfres_image |
| 74 | run_docker_image -d --name vfc-gvnfmdriver -p 8484:8484 -e MSB_ADDR=127.0.0.1 $gvnfmdriver_image |
Shashank Kumar Shankar | 0be6894 | 2017-09-14 11:10:41 -0700 | [diff] [blame] | 75 | |
| 76 | # TODO(sshank): Run other VFC component docker images. |
Victor Morales | 94b3e97 | 2017-08-17 14:55:55 -0500 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | # init_vfc() - Function that initialize VF-C services |
| 80 | function init_vfc { |
| 81 | install_package libmysqlclient-dev |
| 82 | |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 83 | if [[ "$clone_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 84 | clone_repos "vfc" |
Shashank Kumar Shankar | 0be6894 | 2017-09-14 11:10:41 -0700 | [diff] [blame] | 85 | if [[ "$compile_repo" == "True" ]]; then |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 86 | compile_all_vfc_repos |
| 87 | fi |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 88 | fi |
| 89 | |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 90 | if [[ "$skip_get_images" == "False" ]]; then |
| 91 | get_vfc_images |
| 92 | if [[ "$skip_install" == "False" ]]; then |
| 93 | install_vfc |
| 94 | fi |
| 95 | fi |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 96 | } |