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