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 | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 10 | compile_src ${src_folders[sdnc]}/core/rootpom |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 11 | fi |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 12 | compile_src ${src_folders[sdnc]}${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 { |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 18 | local folder=${src_folders[sdnc]}/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 |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 36 | for image in sdnc-image admportal-sdnc-image dgbuilder-sdnc-image; do |
| 37 | pull_openecomp_image $image openecomp/$image:latest |
| 38 | done |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 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 | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 45 | run_docker_compose ${src_folders[sdnc]}/oam/installation/src/main/yaml |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | # init_sdnc() - Function that initialize SDNC services |
| 49 | function init_sdnc { |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 50 | if [[ "$clone_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 51 | clone_repos "sdnc" |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 52 | if [[ "$compile_repo" == "True" ]]; then |
| 53 | compile_all_sdnc_repos |
| 54 | fi |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 55 | fi |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 56 | |
| 57 | if [[ "$skip_get_images" == "False" ]]; then |
| 58 | get_sdnc_images |
| 59 | if [[ "$skip_install" == "False" ]]; then |
Shashank Kumar Shankar | d52d0af | 2017-10-20 16:06:08 -0700 | [diff] [blame] | 60 | start_ODL |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 61 | install_sdnc |
| 62 | fi |
| 63 | fi |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 64 | } |