Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -o xtrace |
| 4 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 5 | source /var/onap/functions |
Victor Morales | 664e6e9 | 2017-09-14 12:11:23 -0700 | [diff] [blame] | 6 | source /var/onap/ccsdk |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 7 | |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 8 | sdnc_src_folder=$git_src_folder/openecomp/sdnc |
Victor Morales | a81fafc | 2017-09-21 13:55:36 -0700 | [diff] [blame] | 9 | sdnc_repos=("adaptors" "architecture" "core" "features" "northbound" "oam" "parent" "plugins") |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 10 | |
| 11 | # clone_all_sdnc_repos() - Function that clones SDNC source repo. |
| 12 | function clone_all_sdnc_repos { |
| 13 | for dirc in ${sdnc_repos[@]}; do |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 14 | clone_repo sdnc/$dirc $sdnc_src_folder/$dirc |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 15 | done |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 16 | } |
| 17 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 18 | # compile_all_sdnc_repos() - Function that compiles SDNC source repo. |
| 19 | function compile_all_sdnc_repos { |
| 20 | for dirc in ${sdnc_repos[@]}; do |
| 21 | if [[ "$dirc" == "core" ]]; then |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 22 | compile_src $sdnc_src_folder/core/rootpom |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 23 | fi |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 24 | compile_src $sdnc_src_folder/$dirc |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 25 | done |
| 26 | } |
| 27 | |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 28 | # _build_sdnc_images() - Builds SDNC images from source code |
| 29 | function _build_sdnc_images { |
| 30 | local folder=$sdnc_src_folder/oam |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 31 | |
Victor Morales | 664e6e9 | 2017-09-14 12:11:23 -0700 | [diff] [blame] | 32 | get_ccsdk_images |
Victor Morales | dbdc30a | 2017-08-17 11:50:42 -0500 | [diff] [blame] | 33 | install_package unzip |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 34 | clone_repo sdnc/oam $folder |
Victor Morales | dbdc30a | 2017-08-17 11:50:42 -0500 | [diff] [blame] | 35 | # The OAM code depends on all the SDNC repos which should be downloaded and compiled first |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 36 | if [[ "$compile_repo" != "True" ]]; then |
| 37 | compile_src $folder |
Victor Morales | dbdc30a | 2017-08-17 11:50:42 -0500 | [diff] [blame] | 38 | fi |
| 39 | for dirc in ubuntu sdnc admportal dgbuilder; do |
| 40 | build_docker_image $folder/installation/$dirc |
| 41 | done |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | # get_sdnc_images() - Build or retrieve necessary images |
| 45 | function get_sdnc_images { |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 46 | if [[ "$build_image" == "True" ]]; then |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 47 | _build_sdnc_images |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 48 | else |
| 49 | pull_openecomp_image sdnc-image openecomp/sdnc-image:latest |
| 50 | pull_openecomp_image admportal-sdnc-image openecomp/admportal-sdnc-image:latest |
| 51 | pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest |
| 52 | fi |
Victor Morales | dbdc30a | 2017-08-17 11:50:42 -0500 | [diff] [blame] | 53 | pull_docker_image mysql/mysql-server:5.6 |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | # install_sdnc() - Download and install SDNC services from source code |
| 57 | function install_sdnc { |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 58 | clone_repo sdnc/oam $sdnc_src_folder/oam |
| 59 | pushd $sdnc_src_folder/oam/installation/src/main/yaml |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 60 | install_docker_compose |
| 61 | /opt/docker/docker-compose up -d |
| 62 | popd |
| 63 | } |
| 64 | |
| 65 | # init_sdnc() - Function that initialize SDNC services |
| 66 | function init_sdnc { |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 67 | if [[ "$clone_repo" == "True" ]]; then |
| 68 | clone_all_sdnc_repos |
| 69 | if [[ "$compile_repo" == "True" ]]; then |
| 70 | compile_all_sdnc_repos |
| 71 | fi |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 72 | fi |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 73 | |
| 74 | if [[ "$skip_get_images" == "False" ]]; then |
| 75 | get_sdnc_images |
| 76 | if [[ "$skip_install" == "False" ]]; then |
Shashank Kumar Shankar | d52d0af | 2017-10-20 16:06:08 -0700 | [diff] [blame] | 77 | start_ODL |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 78 | install_sdnc |
| 79 | fi |
| 80 | fi |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 81 | } |