Victor Morales | 89ce321 | 2017-06-16 18:32:48 -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 | 664e6e9 | 2017-09-14 12:11:23 -0700 | [diff] [blame] | 4 | source /var/onap/ccsdk |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 5 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 6 | # compile_all_sdnc_repos() - Function that compiles SDNC source repo. |
| 7 | function compile_all_sdnc_repos { |
Victor Morales | 5464664 | 2017-12-08 11:57:42 -0800 | [diff] [blame] | 8 | for repo in ${repos[sdnc]}; do |
Victor Morales | f6c0bf1 | 2017-10-27 11:08:04 -0700 | [diff] [blame] | 9 | if [[ "$repo" == "sdnc/core" ]]; then |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 10 | compile_src $sdnc_src_folder/core/rootpom |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 11 | fi |
Victor Morales | f6c0bf1 | 2017-10-27 11:08:04 -0700 | [diff] [blame] | 12 | compile_src $sdnc_src_folder${repo#*sdnc} |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 13 | done |
| 14 | } |
| 15 | |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 16 | # _build_sdnc_images() - Builds SDNC images from source code |
| 17 | function _build_sdnc_images { |
| 18 | local folder=$sdnc_src_folder/oam |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 19 | |
Victor Morales | 664e6e9 | 2017-09-14 12:11:23 -0700 | [diff] [blame] | 20 | get_ccsdk_images |
Victor Morales | dbdc30a | 2017-08-17 11:50:42 -0500 | [diff] [blame] | 21 | install_package unzip |
Victor Morales | dbdc30a | 2017-08-17 11:50:42 -0500 | [diff] [blame] | 22 | # 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] | 23 | if [[ "$compile_repo" != "True" ]]; then |
| 24 | compile_src $folder |
Victor Morales | dbdc30a | 2017-08-17 11:50:42 -0500 | [diff] [blame] | 25 | fi |
| 26 | for dirc in ubuntu sdnc admportal dgbuilder; do |
| 27 | build_docker_image $folder/installation/$dirc |
| 28 | done |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | # get_sdnc_images() - Build or retrieve necessary images |
| 32 | function get_sdnc_images { |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 33 | if [[ "$build_image" == "True" ]]; then |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 34 | _build_sdnc_images |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 35 | else |
| 36 | pull_openecomp_image sdnc-image openecomp/sdnc-image:latest |
| 37 | pull_openecomp_image admportal-sdnc-image openecomp/admportal-sdnc-image:latest |
| 38 | pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest |
| 39 | fi |
Victor Morales | dbdc30a | 2017-08-17 11:50:42 -0500 | [diff] [blame] | 40 | pull_docker_image mysql/mysql-server:5.6 |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | # install_sdnc() - Download and install SDNC services from source code |
| 44 | function install_sdnc { |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 45 | pushd $sdnc_src_folder/oam/installation/src/main/yaml |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 46 | install_docker_compose |
| 47 | /opt/docker/docker-compose up -d |
| 48 | popd |
| 49 | } |
| 50 | |
| 51 | # init_sdnc() - Function that initialize SDNC services |
| 52 | function init_sdnc { |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 53 | if [[ "$clone_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 54 | clone_repos "sdnc" |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 55 | if [[ "$compile_repo" == "True" ]]; then |
| 56 | compile_all_sdnc_repos |
| 57 | fi |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 58 | fi |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 59 | |
| 60 | if [[ "$skip_get_images" == "False" ]]; then |
| 61 | get_sdnc_images |
| 62 | if [[ "$skip_install" == "False" ]]; then |
Shashank Kumar Shankar | d52d0af | 2017-10-20 16:06:08 -0700 | [diff] [blame] | 63 | start_ODL |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 64 | install_sdnc |
| 65 | fi |
| 66 | fi |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 67 | } |